PandaRoot
BSEmcCounter.h
Go to the documentation of this file.
1 #ifndef BSEMCCOUNTER_HH
2 #define BSEMCCOUNTER_HH
3 
4 #include "TStopwatch.h"
5 
6 #include "FairLogger.h"
7 #include "FairRootManager.h"
8 
9 #include "PndProcess.h"
10 
19 template <class DataStruct>
20 class BSEmcCounter : public PndProcess<DataStruct> {
21  public:
22  virtual void SetData(DataStruct * /*t_data*/) /*override*/ {};
23  virtual void Process() /*override*/
24  {
25  if (fEventnumber % 100 == 0) {
26  fTimer.Stop();
27  Double_t realTime = fTimer.RealTime();
28  fTotalTime += realTime;
29  if (fEventnumber > 0) {
30  LOG(info) << "Event: " << fEventnumber << " - Last 100 Events took " << realTime << " s - expeting to finish in "
31  << (fTotalTime) * ((Double_t)fTotalEventNumber / (Double_t)(fEventnumber)-1);
32  }
33  fTimer.Reset();
34  fTimer.Start();
35  }
36  ++fEventnumber;
37  }
38  // virtual void SetupParameters(ParSet* /*parameter*/){};
39  virtual void SetupParameters(const PndParameterRegister * /*t_paramRegister*/) /*override*/
40  {
41  fTotalEventNumber = FairRootManager::Instance()->CheckMaxEventNo();
42  fTimer.Start();
43  };
44 
45  private:
46  TStopwatch fTimer{};
47  Double_t fTotalTime{0};
48  Int_t fEventnumber{0};
49  Int_t fTotalEventNumber{1000};
50 };
51 
52 #endif /*BSEMCCOUNTER_HH*/
Base Process class.
Definition: PndProcess.h:24
virtual void Process()
The actual data transformation (digitizing, clustering, etc.) should be defined here.
Definition: BSEmcCounter.h:23
Simple Process that prints every 100 Events the number of events.
Definition: BSEmcCounter.h:20
Helper class to indirect the Parameter fetching via the FairRuntimeDb.
virtual void SetData(DataStruct *)
Pass the data container ptrs to the process, and store pointers in class members. ...
Definition: BSEmcCounter.h:22
virtual void SetupParameters(const PndParameterRegister *)
Fetch all parameters from the PndParameterRegister.
Definition: BSEmcCounter.h:39