//////////////////////////////////////////////////////////////////// // // This processor outputs SOC data into a T tree containing DS::SOC // instances and a runT tree containing DS::Run instances. The name of // the file can be specified at the command line, in the ratdb and in // the macro. // // Authors: P G Jones - contact person // Rob Stainforth -- contact person // // REVISION HISTORY: // 04 Oct 2012 : P Jones - first revision // 2014-04-26 : P Jones - refactor, add doxygen. // 2017-04-26: J Dunger - add end of job meta information // //////////////////////////////////////////////////////////////////// #ifndef __RATOutSOCProc___ #define __RATOutSOCProc___ #include #include #include class TFile; class TTree; namespace RAT { namespace DS { class SOC; } class OutSOCProc : public Processor { public: // Constructor, initialises pointers to NULL OutSOCProc(); // Destructor, close file and finalise ~OutSOCProc(); // Called when a procset string is set on the command line // // The options are, // `file name` which sets the name of a file to create and write to // `updatefile name` which sets the name of a file to update to // // param: parameter or command // value: value to set // Throws ParamUnknown if the param is not file or updatefile void SetS( const std::string& param, const std::string& value ); // Called when a procset int is set on the command line // // The options are, // `autosave value` which sets the maximum interval between points in run at which all // the baskets are closed and written to disk individually. // `autoflush value` which sets the maximum interval between points in run at which // a new key is written in the output root file and all data are output. // See comments in the SOC routine TTree.cxx // // param: parameter or command // value: value to set // Throws ParamUnknown if the param is not autosave or autoflush // Throws ParamInvalid if the autosave value is negative void SetI( const std::string& param, const int value ); // Begin of run, load from the database // // run: Data structure for the run void BeginOfRun( DS::Run& run ); // End of run, write out the run // // run: Data structure for the run void EndOfRun( DS::Run& run ); private: // Opens the file ready to write to void OpenFile(); std::string fDBFileName; // The file name as loaded from the ratdb, the default std::string fOverrideFileName; // The file name as set from the macro TFile* fFile; // The file to write to TTree* fSOCTree; // The dsTree to write DS::Entry instances to TTree* fRunTree; // The runTree to write DS::Run instances to DS::SOC* fSOCBranch; // The branch in the dsTree DS::Run* fRunBranch; // The branch in the runTree int fAutoSave; // Number to pass to SOC to indicate when to autosave int fAutoFlush; // Number to pass to SOC to indicate when to autoflush bool fUpdate; // Update the file if true, overwrite if false MetaHelper fMetaHelper; // to write some meta information about nevents generated etc. }; } // namespace RAT #endif