Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllEventOutputManager.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllEventOutputManager.cc
2 
5 
6 #include <fun4all/Fun4AllOutputManager.h> // for Fun4AllOutputManager
8 
9 #include <phool/getClass.h>
10 #include <phool/phool.h> // for PHWHERE
11 
12 #include <Event/Event.h>
13 
14 #include <iostream>
15 #include <string>
16 
17 Fun4AllEventOutputManager::Fun4AllEventOutputManager(const std::string &myname, const std::string &filerule, const unsigned int nEvents, const unsigned int sizeInMB, const int offset, const int increment)
18  : Fun4AllOutputManager(myname)
19  , m_OutFileRule(filerule)
20 {
21  m_OutStream = new Fun4AllRolloverFileOutStream(filerule, nEvents, sizeInMB, offset, increment);
22  m_OutStream->SetManager(this);
23  return;
24 }
25 
27 {
28  delete m_OutStream;
29  return;
30 }
31 
33 {
34  std::cout << Name() << " writes " << m_OutFileRule << std::endl;
35  // base class print method
37 
38  return;
39 }
40 
42 {
44  PHCompositeNode *topNode = se->topNode();
45  Event *evt = findNode::getClass<Event>(topNode, "PRDF");
46  if (!evt)
47  {
48  std::cout << PHWHERE << "0 Event Pointer" << std::endl;
49  return -1;
50  }
51  m_OutStream->WriteEvent(evt);
52  return 0;
53 }
54 
56 {
57  int iret = -1;
58  if (m_OutStream)
59  {
60  iret = m_OutStream->AddPacket(ipkt);
61  }
62  else
63  {
64  std::cout << PHWHERE << "Cannot add packet" << std::endl;
65  }
66  return iret;
67 }
68 
69 int Fun4AllEventOutputManager::AddPacketRange(const int ipktmin, const int ipktmax)
70 {
71  int iret = -1;
72  if (m_OutStream)
73  {
74  iret = m_OutStream->AddPacketRange(ipktmin, ipktmax);
75  }
76  else
77  {
78  std::cout << PHWHERE << "Cannot add packet" << std::endl;
79  }
80  return iret;
81 }
82 
84 {
85  int iret = -1;
86  if (m_OutStream)
87  {
88  iret = m_OutStream->DropPacket(ipkt);
89  }
90  else
91  {
92  std::cout << PHWHERE << "Cannot drop packet" << std::endl;
93  }
94  return iret;
95 }
96 
97 int Fun4AllEventOutputManager::DropPacketRange(const int ipktmin, const int ipktmax)
98 {
99  int iret = -1;
100  if (m_OutStream)
101  {
102  iret = m_OutStream->DropPacketRange(ipktmin, ipktmax);
103  }
104  else
105  {
106  std::cout << PHWHERE << "Cannot drop packet" << std::endl;
107  }
108  return iret;
109 }
110 
112 {
113  OutFileName(fname);
114  return;
115 }
116 
118 {
120  if (m_OutStream)
121  {
123  }
124  return;
125 }