Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllOutputManager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllOutputManager.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef FUN4ALL_FUN4ALLOUTPUTMANAGER_H
4 #define FUN4ALL_FUN4ALLOUTPUTMANAGER_H
5 
6 #include "Fun4AllBase.h"
7 
8 #include <limits>
9 #include <string>
10 #include <vector>
11 
12 class PHCompositeNode;
13 
15 {
16  public:
18  ~Fun4AllOutputManager() override = default;
19 
21  void Print(const std::string &what = "ALL") const override;
22 
24  virtual int AddNode(const std::string & /*nodename*/)
25  {
26  return 0;
27  }
28 
30  virtual int AddRunNode(const std::string & /*nodename*/)
31  {
32  return 0;
33  }
34 
36  virtual int StripNode(const std::string & /*nodename*/)
37  {
38  return 0;
39  }
40 
42  virtual int StripRunNode(const std::string & /*nodename*/)
43  {
44  return 0;
45  }
46 
47  virtual void SaveRunNode(const int) { return; }
48  virtual void SaveDstNode(const int) { return; }
49 
55  virtual int AddEventSelector(const std::string &recomodule);
56 
58  virtual int outfileopen(const std::string & /*nodename*/)
59  {
60  return 0;
61  }
62 
64  int WriteGeneric(PHCompositeNode *startNode);
65 
67  virtual int Write(PHCompositeNode * /*startNode*/)
68  {
69  return 0;
70  }
71 
73  virtual int WriteNode(PHCompositeNode * /*thisNode*/)
74  {
75  return 0;
76  }
77 
79  virtual std::vector<std::string> *EventSelector()
80  {
81  return &m_EventSelectorsVector;
82  }
83 
85  virtual std::vector<unsigned> *RecoModuleIndex()
86  {
88  }
89 
91  virtual int DoNotWriteEvent(std::vector<int> *retcodes) const;
92 
94  virtual unsigned int EventsWritten() const { return m_NEvents; }
96  virtual void IncrementEvents(const unsigned int i) { m_NEvents += i; }
98  virtual void SetEventsWritten(const unsigned int i) { m_NEvents = i; }
100  virtual std::string OutFileName() const { return m_OutFileName; }
102  void SetClosingScript(const std::string &script) { m_RunAfterClosingScript = script; }
104  int RunAfterClosing();
105  void UseFileRule() { m_UseFileRuleFlag = true; }
106  bool ApplyFileRule() const { return m_UseFileRuleFlag; }
107  void SetNEvents(const unsigned int nevt) { m_MaxEvents = nevt; }
108  unsigned int GetNEvents() const { return m_MaxEvents; }
109 
110  protected:
115  Fun4AllOutputManager(const std::string &myname);
116  Fun4AllOutputManager(const std::string &myname, const std::string &outfname);
117 
118  private:
120  bool m_UseFileRuleFlag{false};
121 
123  unsigned int m_NEvents{0};
124 
126  unsigned int m_MaxEvents{std::numeric_limits<unsigned int>::max()};
127 
130 
133 
136 
138  std::vector<std::string> m_EventSelectorsVector;
139 
141  std::vector<unsigned> m_RecoModuleIndexVector;
142 };
143 
144 #endif