]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliAnalysisStatistics.h
Merge branch 'TPCdev'
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisStatistics.h
CommitLineData
f091ecb5 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
6/* $Id$ */
7// Author: Andrei Gheata, 20/12/2010
8
9//==============================================================================
10// AliAnalysisStatistics - Class holding statistics information regarding the
11// number of events processed, failed and accepted.
12//==============================================================================
13
14#ifndef ROOT_TNamed
15#include "TNamed.h"
16#endif
17
ed37a9ae 18class TObjArray;
19class TStopwatch;
f091ecb5 20
21class AliAnalysisStatistics : public TNamed {
22
23protected:
24 Long64_t fNinput; // Total number of input events
25 Long64_t fNprocessed; // Number of events processed
26 Long64_t fNfailed; // Number of events for which reading failed
27 Long64_t fNaccepted; // Number of events that passed filtering criteria
c3732d79 28 UInt_t fOfflineMask; // Offline mask used for accepted events
ed37a9ae 29 Int_t fMaxTasks; // Allocated size for the task timing arrays
30 Int_t fNtasks; // Number of tasks
31 Int_t fCurrentTask; // Current task being timed
32 Double_t *fTaskTimeReal; //[fNtasks] Cumulated CPU time per task
33 Double_t *fTaskTimeCPU; //[fNtasks] Cumulated CPU time per task
34 TObjArray *fTaskNames; // Task names
35 TStopwatch *fTaskTimer; //! Stopwatch for task timing
36
f091ecb5 37public:
ed37a9ae 38 AliAnalysisStatistics() : TNamed(),fNinput(0),fNprocessed(0),fNfailed(0),
39 fNaccepted(0),fOfflineMask(0), fMaxTasks(0),fNtasks(0), fCurrentTask(-1),
40 fTaskTimeReal(0), fTaskTimeCPU(0), fTaskNames(0), fTaskTimer(0) {}
41 AliAnalysisStatistics(const char *name)
42 : TNamed(name,""),fNinput(0),fNprocessed(0),fNfailed(0),
43 fNaccepted(0),fOfflineMask(0), fMaxTasks(0),fNtasks(0), fCurrentTask(-1),
44 fTaskTimeReal(0), fTaskTimeCPU(0), fTaskNames(0), fTaskTimer(0) {}
f091ecb5 45 AliAnalysisStatistics(const AliAnalysisStatistics &other);
46 virtual ~AliAnalysisStatistics() {}
47
48 AliAnalysisStatistics& operator=(const AliAnalysisStatistics &other);
49 // Update methods
50 void AddInput(Int_t nevents=1) {fNinput += nevents;}
51 void AddProcessed(Int_t nevents=1) {fNprocessed += nevents;}
52 void AddFailed(Int_t nevents=1) {fNfailed += nevents;}
53 void AddAccepted(Int_t nevents=1) {fNaccepted += nevents;}
54 // Getters
55 Long64_t GetNinput() const {return fNinput;}
56 Long64_t GetNprocessed() const {return fNprocessed;}
57 Long64_t GetNfailed() const {return fNfailed;}
58 Long64_t GetNaccepted() const {return fNaccepted;}
c3732d79 59 UInt_t GetOfflineMask() const {return fOfflineMask;}
60 static const char *GetMaskAsString(UInt_t mask);
ed37a9ae 61 Int_t GetNtasks() const {return fNtasks;}
62 const char *GetTaskName(Int_t itask) const;
63 Double_t GetRealTime(Int_t itask) const {return fTaskTimeReal[itask];}
64 Double_t GetCPUTime(Int_t itask) const {return fTaskTimeCPU[itask];}
c3732d79 65
66 void SetOfflineMask(UInt_t mask) {fOfflineMask = mask;}
f091ecb5 67 virtual Long64_t Merge(TCollection* list);
f5cbe261 68 virtual void Print(const Option_t *option="") const;
ed37a9ae 69 // Task timing
70 void StartTimer(Int_t itask, const char *name, const char *classname = "");
71 void StopTimer();
f091ecb5 72
ed37a9ae 73 ClassDef(AliAnalysisStatistics,2) // Class holding the processed events statistics
f091ecb5 74};
75#endif