Hall C ROOT/C++ Analyzer (hcana)
THcPeriodicReport.cxx
Go to the documentation of this file.
1 
38 #include "THcPeriodicReport.h"
39 
40 #include <iostream>
41 
42 using namespace std;
43 
44 //_____________________________________________________________________________
45 THcPeriodicReport::THcPeriodicReport(const char *name, const char *description,
46  const char *templatefile,
47  const char *ofile)
48  : THaPhysicsModule(name, description), fTimePeriod(2), fEventPeriod(0),
49  fDoPrint(kFALSE), fAnalyzer(0) {
50  // Constructor
51  fTemplateFilename = templatefile;
52  fOutputFilename = ofile;
53 }
54 //_____________________________________________________________________________
56  // destructor
57 }
58 //_____________________________________________________________________________
59 THaAnalysisObject::EStatus THcPeriodicReport::Init(const TDatime &run_time) {
60  // Standard initialization. Calls this object's DefineVariables().
61  if (THaPhysicsModule::Init(run_time) != kOK)
62  return fStatus;
63 
64  fAnalyzer = static_cast<THcAnalyzer *>(THcAnalyzer::GetInstance());
65  return fStatus = kOK;
66 }
67 //_____________________________________________________________________________
69  fDoPrint = kTRUE; // Generate report on first event
72 
73  return 0;
74 }
75 //_____________________________________________________________________________
77  // Print out the report a final time
78  PrintReport();
79 
80  return 0;
81 }
82 //_____________________________________________________________________________
84  UInt_t now = TDatime().Convert();
86  if (!fDoPrint && (fTimePeriod > 0) &&
87  ((now - fLastPrintTime) >= fTimePeriod)) {
88  fDoPrint = kTRUE;
89  }
90  if (!fDoPrint && (fEventPeriod > 0) && (fEventsSincePrint >= fEventPeriod)) {
91  fDoPrint = kTRUE;
92  }
93  if (fDoPrint) {
94  fLastPrintTime = now;
96  PrintReport();
97  fDoPrint = kFALSE;
98  }
99  return (0);
100 }
101 //_____________________________________________________________________________
104 }
UInt_t Convert(Bool_t toGMT=kFALSE) const
Hall C analyzer class.
Definition: THcAnalyzer.h:12
int Int_t
STL namespace.
THcPeriodicReport(const char *name, const char *description, const char *templatefile, const char *ofile)
Construct the period report generator.
A physics module to generate periodic reports from a template.
THcAnalyzer * fAnalyzer
unsigned int UInt_t
void PrintReport(const char *templatefile, const char *ofile)
Definition: THcAnalyzer.cxx:53
const Bool_t kFALSE
ClassImp(THcDCLookupTTDConv) THcDCLookupTTDConv
virtual Int_t Begin(THaRunBase *r=0)
virtual EStatus Init(const TDatime &run_time)
virtual Int_t End(THaRunBase *r=0)
virtual Int_t Process(const THaEvData &)
const Bool_t kTRUE
virtual ~THcPeriodicReport()
A destructor.