]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliAnalysisStatistics.h
Removing centrality check from default:
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisStatistics.h
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
18 class TObjArray;
19 class TStopwatch;
20
21 class AliAnalysisStatistics : public TNamed {
22
23 protected:
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
28   UInt_t                      fOfflineMask;       // Offline mask used for accepted events
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   
37 public:
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) {}
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;}
59   UInt_t                      GetOfflineMask() const        {return fOfflineMask;}
60   static const char          *GetMaskAsString(UInt_t mask);
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) ? fTaskTimeReal[itask] : 0.;}
64   Double_t                    GetCPUTime(Int_t itask) const  {return (fTaskTimeCPU)  ? fTaskTimeCPU[itask] : 0.;}
65   
66   void                        SetOfflineMask(UInt_t mask)   {fOfflineMask = mask;}
67   virtual Long64_t            Merge(TCollection* list);
68   virtual void                Print(const Option_t *option="") const;
69   // Task timing
70   void                        StartTimer(Int_t itask, const char *name, const char *classname = "");
71   void                        StopTimer();
72
73   ClassDef(AliAnalysisStatistics,2)  // Class holding the processed events statistics
74 };
75 #endif