PandaRoot
PndEventCounterTask.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 
20 #ifndef PNDEVENTCOUNTERTASK_H
21 #define PNDEVENTCOUNTERTASK_H
22 
23 #include "FairTask.h"
24 #include "TStopwatch.h"
25 
26 class TClonesArray;
27 
28 class PndEventCounterTask : public FairTask {
29  public:
30  PndEventCounterTask(const char *name = "Event Counter", Int_t nev = 1, Int_t talk = 1);
31  virtual ~PndEventCounterTask();
32  virtual void SetParContainers() { return; }
33  virtual InitStatus Init();
34  virtual InitStatus ReInit() { return kSUCCESS; }
35  virtual void Exec(Option_t *opt);
36  void SetVerbose(Int_t iVerbose) { fVerbose = iVerbose; }
37  void SetAnnounce(Int_t iann) { fEvtTalk = iann; }
38  void SetNEvts(Int_t n) { fNEvts = n; }
39  Int_t GetEventCount() const { return fEvtCounter; }
40  Double_t GetTime()
41  {
42  return fTimer.RealTime();
43  fTimer.Continue();
44  }
45 
46  private:
47  void StartTimer();
48  Bool_t fInitialiezed;
49  Int_t fEvtCounter;
50  Int_t fEvtTalk;
51  Int_t fNEvts;
52  Double_t fTimeOffset;
53  TStopwatch fTimer;
54  ClassDef(PndEventCounterTask, 1);
55 };
56 
57 #endif
virtual InitStatus ReInit()
virtual InitStatus Init()
PndEventCounterTask(const char *name="Event Counter", Int_t nev=1, Int_t talk=1)
virtual ~PndEventCounterTask()
virtual void Exec(Option_t *opt)
virtual void SetParContainers()
void SetVerbose(Int_t iVerbose)
Int_t GetEventCount() const
Task to print the event number, the time needed per event and the expected remaining time...
void SetAnnounce(Int_t iann)