ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllOutputManager.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllOutputManager.cc
1 #include "Fun4AllOutputManager.h"
2 
3 #include <iostream>
4 #include <string>
5 #include <vector>
6 
7 using namespace std;
8 
10  : Fun4AllBase(name)
11  , m_NEvents(0)
12 {
13 }
14 
15 Fun4AllOutputManager::Fun4AllOutputManager(const string &name, const string &outfname)
16  : Fun4AllBase(name)
17  , m_NEvents(0)
18  , m_OutFileName(outfname)
19 {
20 }
21 
22 //___________________________________________________________________
23 int Fun4AllOutputManager::AddEventSelector(const string &recomodule)
24 {
25  string newselector = recomodule;
26  for (string evtsel : m_EventSelectorsVector)
27  {
28  if (evtsel == newselector)
29  {
30  cout << "Event Selector " << newselector << " allready in list" << endl;
31  return -1;
32  }
33  }
34  cout << "EventSelector: " << &m_EventSelectorsVector << endl;
35  m_EventSelectorsVector.push_back(newselector);
36  return 0;
37 }
38 
39 //___________________________________________________________________
41 {
42  m_NEvents++;
43  int iret = Write(startNode);
44  return iret;
45 }
46 
47 //___________________________________________________________________
48 void Fun4AllOutputManager::Print(const string &what) const
49 {
50  if (what == "ALL" || what == "EVENTSELECTOR")
51  {
52  unsigned icnt = 0;
53  for (string evtsel : m_EventSelectorsVector)
54  {
55  cout << Name() << ": Reco Module " << evtsel << " select Events" << endl;
56  cout << Name() << ": Reco Module Index: " << m_RecoModuleIndexVector[icnt] << endl;
57  icnt++;
58  }
59  }
60  if (what == "ALL" || what == "EVENTSWRITTEN")
61  {
62  cout << Name() << " wrote " << EventsWritten() << " Events" << endl;
63  }
64  return;
65 }
66 
67 //___________________________________________________________________
68 int Fun4AllOutputManager::DoNotWriteEvent(vector<int> *retcodes) const
69 {
70  int iret = 0;
71  for (unsigned int index : m_RecoModuleIndexVector)
72  {
73  iret += (*retcodes)[index];
74  }
75  return iret;
76 }