File indexing completed on 2025-08-03 08:16:45
0001
0002
0003 #ifndef FUN4ALL_FUN4ALLOUTPUTMANAGER_H
0004 #define FUN4ALL_FUN4ALLOUTPUTMANAGER_H
0005
0006 #include "Fun4AllBase.h"
0007
0008 #include <limits>
0009 #include <string>
0010 #include <vector>
0011
0012 class PHCompositeNode;
0013
0014 class Fun4AllOutputManager : public Fun4AllBase
0015 {
0016 public:
0017
0018 ~Fun4AllOutputManager() override;
0019
0020
0021 void Print(const std::string &what = "ALL") const override;
0022
0023
0024 virtual int AddNode(const std::string & )
0025 {
0026 return 0;
0027 }
0028
0029
0030 virtual int AddRunNode(const std::string & )
0031 {
0032 return 0;
0033 }
0034
0035
0036 virtual int StripNode(const std::string & )
0037 {
0038 return 0;
0039 }
0040
0041
0042 virtual int StripRunNode(const std::string & )
0043 {
0044 return 0;
0045 }
0046
0047 virtual int StripCompositeNode(const std::string & ) {return 0;}
0048
0049 virtual void SaveRunNode(const int) { return; }
0050 virtual void SaveDstNode(const int) { return; }
0051
0052
0053
0054
0055
0056
0057 virtual int AddEventSelector(const std::string &recomodule);
0058
0059
0060 virtual int outfileopen(const std::string & )
0061 {
0062 return 0;
0063 }
0064
0065
0066 int WriteGeneric(PHCompositeNode *startNode);
0067
0068
0069 virtual int Write(PHCompositeNode * )
0070 {
0071 return 0;
0072 }
0073
0074
0075 virtual int WriteNode(PHCompositeNode * )
0076 {
0077 return 0;
0078 }
0079
0080
0081 virtual std::vector<std::string> *EventSelector()
0082 {
0083 return &m_EventSelectorsVector;
0084 }
0085
0086
0087 virtual std::vector<unsigned> *RecoModuleIndex()
0088 {
0089 return &m_RecoModuleIndexVector;
0090 }
0091
0092
0093 virtual int DoNotWriteEvent(std::vector<int> *retcodes) const;
0094
0095
0096 virtual unsigned int EventsWritten() const { return m_NEvents; }
0097
0098 virtual void IncrementEvents(const unsigned int i) { m_NEvents += i; }
0099
0100 virtual void SetEventsWritten(const unsigned int i) { m_NEvents = i; }
0101
0102 virtual std::string OutFileName() const { return m_OutFileName; }
0103
0104 virtual void CompressionSetting(const int ) { return; }
0105
0106 void OutFileName(const std::string &name) { m_OutFileName = name; }
0107 void SetClosingScript(const std::string &script) { m_RunAfterClosingScript = script; }
0108 void SetClosingScriptArgs(const std::string &args) { m_ClosingArgs = args; }
0109 int RunAfterClosing();
0110 void UseFileRule() { m_UseFileRuleFlag = true; }
0111 bool ApplyFileRule() const { return m_UseFileRuleFlag; }
0112 void SetNEvents(const unsigned int nevt);
0113 unsigned int GetNEvents() const { return m_MaxEvents; }
0114 void FileRule(const std::string &newrule) { m_FileRule = newrule; }
0115 const std::string &FileRule() const { return m_FileRule; }
0116 void SplitLevel(const int split) { splitlevel = split; }
0117 void BufferSize(const int size) { buffersize = size; }
0118 int SplitLevel() const { return splitlevel; }
0119 int BufferSize() const { return buffersize; }
0120 int Segment() { return m_CurrentSegment; }
0121
0122 protected:
0123
0124
0125
0126
0127 Fun4AllOutputManager(const std::string &myname);
0128 Fun4AllOutputManager(const std::string &myname, const std::string &outfname);
0129
0130
0131 int m_CurrentSegment{0};
0132
0133 private:
0134
0135 bool m_UseFileRuleFlag{false};
0136
0137
0138 int buffersize{std::numeric_limits<int>::min()};
0139
0140
0141 int splitlevel{std::numeric_limits<int>::min()};
0142
0143
0144 unsigned int m_NEvents{0};
0145
0146
0147 unsigned int m_MaxEvents{std::numeric_limits<unsigned int>::max()};
0148
0149
0150 std::string m_RunAfterClosingScript;
0151
0152
0153 std::string m_ClosingArgs;
0154
0155
0156 std::string m_OutFileName;
0157
0158
0159 std::string m_LastClosedFileName;
0160
0161
0162 std::string m_FileRule{"-%08d-%05d"};
0163
0164
0165 std::vector<std::string> m_EventSelectorsVector;
0166
0167
0168 std::vector<unsigned> m_RecoModuleIndexVector;
0169 };
0170
0171 #endif