PandaRoot
BSEmcCounter.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #ifndef BSEMCCOUNTER_HH
14 #define BSEMCCOUNTER_HH
15 
16 #include "TStopwatch.h"
17 
18 #include "FairLogger.h"
19 #include "FairRootManager.h"
20 
21 #include "PndProcess.h"
22 
31 class BSEmcCounter : public PndProcess {
32  public:
33  virtual void Process() /*override*/
34  {
35  if (fEventnumber % 100 == 0) {
36  fTimer.Stop();
37  Double_t realTime = fTimer.RealTime();
38  fTotalTime += realTime;
39  if (fEventnumber > 0) {
40  LOG(info) << "Event: " << fEventnumber << " - Last 100 Events took " << realTime << " s - expeting to finish in "
41  << (fTotalTime) * ((Double_t)fTotalEventNumber / (Double_t)(fEventnumber)-1);
42  }
43  fTimer.Reset();
44  fTimer.Start();
45  }
46  ++fEventnumber;
47  }
48  // virtual void SetupParameters(ParSet* /*parameter*/){};
49  virtual void SetupParameters(const PndParameterRegister * /*t_paramRegister*/) /*override*/
50  {
51  fTotalEventNumber = FairRootManager::Instance()->CheckMaxEventNo();
52  fTimer.Start();
53  };
54 
55  private:
56  TStopwatch fTimer{};
57  Double_t fTotalTime{0};
58  Int_t fEventnumber{0};
59  Int_t fTotalEventNumber{1000};
60 };
61 
62 #endif /*BSEMCCOUNTER_HH*/
Base Process class.
Definition: PndProcess.h:36
Simple Process that prints every 100 Events the number of events.
Definition: BSEmcCounter.h:31
virtual void Process()
The actual data transformation (digitizing, clustering, etc.) should be defined here.
Definition: BSEmcCounter.h:33
virtual void SetupParameters(const PndParameterRegister *)
Fetch all parameters from the PndParameterRegister.
Definition: BSEmcCounter.h:49
Helper class to indirect the Parameter fetching via the FairRuntimeDb.