Analysis Software
Documentation for sPHENIX simulation 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 <phool/phool.h>
4 
5 #include <TSystem.h>
6 
7 #include <iostream>
8 #include <string>
9 #include <vector>
10 
12  : Fun4AllBase(name)
13 {
14 }
15 
17  : Fun4AllBase(name)
18  , m_OutFileName(outfname)
19 {
20 }
21 
22 //___________________________________________________________________
24 {
25  const std::string &newselector = recomodule;
26  for (const std::string &evtsel : m_EventSelectorsVector)
27  {
28  if (evtsel == newselector)
29  {
30  std::cout << "Event Selector " << newselector << " allready in list" << std::endl;
31  return -1;
32  }
33  }
34  std::cout << "EventSelector: " << &m_EventSelectorsVector << std::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 //___________________________________________________________________
49 {
50  if (what == "ALL" || what == "EVENTSELECTOR")
51  {
52  unsigned icnt = 0;
53  for (const std::string &evtsel : m_EventSelectorsVector)
54  {
55  std::cout << Name() << ": Reco Module " << evtsel << " select Events" << std::endl;
56  std::cout << Name() << ": Reco Module Index: " << m_RecoModuleIndexVector[icnt] << std::endl;
57  icnt++;
58  }
59  }
60  if (what == "ALL" || what == "EVENTSWRITTEN")
61  {
62  std::cout << Name() << " wrote " << EventsWritten() << " Events" << std::endl;
63  }
64  return;
65 }
66 
67 //___________________________________________________________________
68 int Fun4AllOutputManager::DoNotWriteEvent(std::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 }
77 
79 {
80  unsigned int iret = 0;
81  if (!m_RunAfterClosingScript.empty())
82  {
84  iret = gSystem->Exec(fullcmd.c_str());
85  }
86  if (iret)
87  {
88  iret = iret >> 8U;
89  }
90  return iret;
91 }