File indexing completed on 2025-08-06 08:17:55
0001 #include "DumpObject.h"
0002
0003 #include "PHNodeDump.h"
0004
0005 #include <fstream>
0006 #include <iostream>
0007 #include <string>
0008
0009 DumpObject::DumpObject(const std::string &NodeName)
0010 : ThisName(NodeName)
0011 {
0012 return;
0013 }
0014
0015 int DumpObject::Init()
0016 {
0017 if (ThisName != "DUMMY")
0018 {
0019 OpenOutFile();
0020 }
0021 return 0;
0022 }
0023
0024 int DumpObject::OpenOutFile()
0025 {
0026 if (no_output)
0027 {
0028 return 0;
0029 }
0030 std::string fname = OutDir + "/" + ThisName + ".list";
0031 fout = new std::ofstream(fname.c_str());
0032 return 0;
0033 }
0034
0035 void DumpObject::Print(const char * ) const
0036 {
0037 std::cout << ThisName << " did not implement Print method" << std::endl;
0038 return;
0039 }
0040
0041 int DumpObject::process_event(PHNode *myNode)
0042 {
0043 if (fout && write_run_event)
0044 {
0045 if (fp_precision > 0)
0046 {
0047 (*fout).precision(fp_precision);
0048 }
0049 *fout << std::endl
0050 << "RunNumber: " << myNodeDump->RunNumber();
0051 if (print_evtseq)
0052 {
0053 *fout << ", Event Sequence: " << myNodeDump->EvtSequence();
0054 }
0055 *fout << std::endl;
0056 }
0057 process_Node(myNode);
0058
0059 return 0;
0060 }
0061
0062 int DumpObject::process_Node(PHNode * )
0063 {
0064
0065 return 0;
0066 }
0067
0068 int DumpObject::CloseOutputFile()
0069 {
0070 delete fout;
0071 fout = nullptr;
0072 return 0;
0073 }