ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DumpObject.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DumpObject.cc
1 #include "DumpObject.h"
2 
3 #include "PHNodeDump.h"
4 
5 #include <fstream>
6 #include <iostream>
7 #include <string>
8 
9 using namespace std;
10 
11 DumpObject::DumpObject(const string &NodeName)
12  : fout(nullptr)
13  , ThisName(NodeName)
14  , write_run_event(1)
15  , OutDir("./")
16  , fp_precision(-1)
17  , myNodeDump(nullptr)
18  , no_output(0)
19 {
20  return;
21 }
22 
24 {
25  if (ThisName != "DUMMY")
26  {
27  OpenOutFile();
28  }
29  return 0;
30 }
31 
33 {
34  if (no_output)
35  {
36  return 0;
37  }
38  string fname = OutDir + "/" + ThisName + ".list";
39  fout = new ofstream(fname.c_str());
40  return 0;
41 }
42 
43 void DumpObject::Print(const char */*what*/) const
44 {
45  cout << ThisName << " did not implement Print method" << endl;
46  return;
47 }
48 
50 {
51  if (fout && write_run_event)
52  {
53  if (fp_precision > 0)
54  {
55  (*fout).precision(fp_precision);
56  }
57  *fout << endl
58  << "RunNumber: " << myNodeDump->RunNumber()
59  << ", Event Sequence: " << myNodeDump->EvtSequence()
60  << endl;
61  }
62  process_Node(myNode);
63  // cout << ThisName << " did not implement process_event method" << endl;
64  return 0;
65 }
66 
68 {
69  // cout << ThisName << " did not implement process_event method" << endl;
70  return 0;
71 }
72 
74 {
75  delete fout;
76  fout = 0;
77  return 0;
78 }