AliRoot Core  3dc7879 (3dc7879)
AliAnalysisStatistics.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISSTATISTICS_H
2 #define ALIANALYSISSTATISTICS_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
5 
14 
15 #ifndef ROOT_TNamed
16 #include "TNamed.h"
17 #endif
18 
19 class TObjArray;
20 class TStopwatch;
21 
22 class AliAnalysisStatistics : public TNamed {
23 
24 protected:
25  Long64_t fNinput;
26  Long64_t fNprocessed;
27  Long64_t fNfailed;
28  Long64_t fNaccepted;
29  UInt_t fOfflineMask;
30  Int_t fMaxTasks;
31  Int_t fNtasks;
32  Int_t fCurrentTask;
33  Double_t *fTaskTimeReal; //[fNtasks]
36  Double_t *fTaskTimeCPU; //[fNtasks]
38  TStopwatch *fTaskTimer;
39 
40 public:
41  AliAnalysisStatistics() : TNamed(),fNinput(0),fNprocessed(0),fNfailed(0),
42  fNaccepted(0),fOfflineMask(0), fMaxTasks(0),fNtasks(0), fCurrentTask(-1),
43  fTaskTimeReal(0), fTaskTimeCPU(0), fTaskNames(0), fTaskTimer(0) {}
44  AliAnalysisStatistics(const char *name)
45  : TNamed(name,""),fNinput(0),fNprocessed(0),fNfailed(0),
46  fNaccepted(0),fOfflineMask(0), fMaxTasks(0),fNtasks(0), fCurrentTask(-1),
47  fTaskTimeReal(0), fTaskTimeCPU(0), fTaskNames(0), fTaskTimer(0) {}
50 
52  // Update methods
53  void AddInput(Int_t nevents=1) {fNinput += nevents;}
54  void AddProcessed(Int_t nevents=1) {fNprocessed += nevents;}
55  void AddFailed(Int_t nevents=1) {fNfailed += nevents;}
56  void AddAccepted(Int_t nevents=1) {fNaccepted += nevents;}
57  // Getters
58  Long64_t GetNinput() const {return fNinput;}
59  Long64_t GetNprocessed() const {return fNprocessed;}
60  Long64_t GetNfailed() const {return fNfailed;}
61  Long64_t GetNaccepted() const {return fNaccepted;}
62  UInt_t GetOfflineMask() const {return fOfflineMask;}
63  static const char *GetMaskAsString(UInt_t mask);
64  Int_t GetNtasks() const {return fNtasks;}
65  const char *GetTaskName(Int_t itask) const;
66  Double_t GetRealTime(Int_t itask) const {return (fTaskTimeReal) ? fTaskTimeReal[itask] : 0.;}
67  Double_t GetCPUTime(Int_t itask) const {return (fTaskTimeCPU) ? fTaskTimeCPU[itask] : 0.;}
68 
69  void SetOfflineMask(UInt_t mask) {fOfflineMask = mask;}
70  virtual Long64_t Merge(TCollection* list);
71  virtual void Print(const Option_t *option="") const;
72  // Task timing
73  void StartTimer(Int_t itask, const char *name, const char *classname = "");
74  void StopTimer();
75 
76  ClassDef(AliAnalysisStatistics,2) // Class holding the processed events statistics
77 };
78 #endif
TStopwatch * fTaskTimer
! Stopwatch for task timing
Double_t GetRealTime(Int_t itask) const
Long64_t fNfailed
Number of events for which reading failed.
Int_t fNtasks
Number of tasks.
Double_t * fTaskTimeCPU
Cumulated CPU time per task.
#define TObjArray
void SetOfflineMask(UInt_t mask)
Long64_t fNinput
Total number of input events.
Long64_t GetNaccepted() const
TObjArray * fTaskNames
Task names.
Long64_t GetNprocessed() const
static const char * GetMaskAsString(UInt_t mask)
void AddAccepted(Int_t nevents=1)
void AddFailed(Int_t nevents=1)
UInt_t fOfflineMask
Offline mask used for accepted events.
const char * GetTaskName(Int_t itask) const
Long64_t fNaccepted
Number of events that passed filtering criteria.
AliAnalysisStatistics basic class for storing statistics for the processed events. The object is mergeable and can be used for general purpose. In case a AliAnalysisTaskStat is used, this will set the global statistics object to the analysis manager and will update it for the accepted events.
Long64_t GetNfailed() const
void AddInput(Int_t nevents=1)
Long64_t fNprocessed
Number of events processed.
virtual Long64_t Merge(TCollection *list)
AliAnalysisStatistics & operator=(const AliAnalysisStatistics &other)
void StartTimer(Int_t itask, const char *name, const char *classname="")
void AddProcessed(Int_t nevents=1)
Double_t * fTaskTimeReal
Cumulated CPU time per task.
Double_t GetCPUTime(Int_t itask) const
Long64_t GetNinput() const
virtual void Print(const Option_t *option="") const
AliAnalysisStatistics(const char *name)
UInt_t GetOfflineMask() const
Int_t fMaxTasks
Allocated size for the task timing arrays.