FairRoot/PandaRoot
PndEventCounterTask.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndEventCounterTask source file -----
3 // ----- Created 24/09/10 by R. Kliemt -----
4 // -------------------------------------------------------------------------
5 
6 #include "PndEventCounterTask.h"
7 
8 #include "FairRootManager.h"
9 
10 #include <iostream>
11 
12 PndEventCounterTask::PndEventCounterTask(const char* name, Int_t nev, Int_t talk) :
13 FairTask(name),
14 fInitialiezed(kFALSE),
15 fEvtCounter(0),
16 fEvtTalk(talk),
17 fNEvts(nev),
18 fTimeOffset(0.),
19 fTimer()
20 {
21  fTimer.Start();
22 }
23 // -------------------------------------------------------------------------
24 
25 // ----- Destructor ----------------------------------------------------
27 {
28 }
29 // -------------------------------------------------------------------------
30 
31 // ----- Init ----------------------------------------------------
33 {
34  if (fNEvts==0)
35  {
36  fNEvts = FairRootManager::Instance()->CheckMaxEventNo(0);
37  }
38 
39  return kSUCCESS;
40 }
41 // -------------------------------------------------------------------------
42 
44  fTimeOffset=fTimer.RealTime();
45  fTimer.Continue();
46  fEvtCounter = 0;
47  fInitialiezed = kTRUE;
48 }
49 
50 // ----- Public method Exec --------------------------------------------
51 void PndEventCounterTask::Exec(Option_t* )
52 {
53  if (!fInitialiezed) StartTimer();
54  fEvtCounter++;
55  if(fEvtCounter%fEvtTalk == 0 || fVerbose>1)
56  {
57  Double_t t=fTimer.RealTime();
58  fTimer.Continue();
59  printf("Event %i/%i : time %6.1f sec, (%6.0f sec remaining)\n",
61  }
62  return;
63 }
64 
66 
int fVerbose
Definition: poormantracks.C:24
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
ClassImp(PndEventCounterTask)
virtual void Exec(Option_t *opt)
PndEventCounterTask(const char *name="Event Counter", Int_t nev=1, Int_t talk=1)
Double_t
TString name
TTree * t
Definition: bump_analys.C:13
virtual InitStatus Init()