]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muon/AliAnalysisMuMuBase.h
Fix Coverity 24835
[u/mrichter/AliRoot.git] / PWG / muon / AliAnalysisMuMuBase.h
1 #ifndef ALIANALYSISMUMUBASE_H
2 #define ALIANALYSISMUMUBASE_H
3
4 /**
5  *
6  * \class AliAnalysisMuMuBase
7  *
8  * \brief Base class of the sub-analysis for AliAnalysisTaskMuMu
9  *
10  * \author L. Aphecetche (Subatech)
11  */
12
13 #include "TObject.h"
14 #include "TString.h"
15 #include "TProfile.h"
16
17 class AliCounterCollection;
18 class AliAnalysisMuMuBinning;
19 class AliMergeableCollection;
20 class AliVParticle;
21 class AliVEvent;
22 class AliMCEvent;
23 class TH1;
24 class AliInputEventHandler;
25 class AliAnalysisMuMuCutRegistry;
26
27 class AliAnalysisMuMuBase : public TObject
28 {
29 public:
30
31   AliAnalysisMuMuBase();
32   virtual ~AliAnalysisMuMuBase() {}
33
34   /** Define the histograms needed for the path starting at eventSelection/triggerClassName/centrality.
35    * This method has to ensure the histogram creation is performed only once !
36    */
37   virtual void DefineHistogramCollection(const char* eventSelection,
38                                          const char* triggerClassName,
39                                          const char* centrality) = 0;
40
41   /** Fill histograms for one event */
42   virtual void FillHistosForEvent(const char* /*eventSelection*/,const char* /*triggerClassName*/,const char* /*centrality*/) {}
43
44   /** Fill histograms for one MC event */
45   virtual void FillHistosForMCEvent(const char* /*eventSelection*/,const char* /*triggerClassName*/,const char* /*centrality*/) {}
46   
47   /** Fill histograms for one track */
48   virtual void FillHistosForTrack(const char* /*eventSelection*/,const char* /*triggerClassName*/,const char* /*centrality*/,
49                                   const char* /*trackCutName*/,
50                                   const AliVParticle& /*part*/) {}
51
52   /** Fill histograms for one track pair */
53   virtual void FillHistosForPair(const char* /*eventSelection*/,const char* /*triggerClassName*/,const char* /*centrality*/,
54                                  const char* /*pairCutName*/,
55                                  const AliVParticle& /*part1*/,
56                                  const AliVParticle& /*part2*/) {}
57   
58   virtual void Init(AliCounterCollection& cc,
59                     AliMergeableCollection& hc,
60                     const AliAnalysisMuMuBinning& binning,
61                     const AliAnalysisMuMuCutRegistry& cutRegister);
62
63   virtual void SetEvent(AliVEvent* event, AliMCEvent* mcEvent=0x0);
64
65   virtual Bool_t IsHistogramDisabled(const char* hname) const;
66   
67   virtual Bool_t IsHistogrammingDisabled() const;
68   
69   virtual void DisableHistograms(const char* pattern="*");
70   
71   AliVEvent* Event() const { return fEvent; }
72   
73   AliMCEvent* MCEvent() const { return fMCEvent; }
74   
75   static const char* MCInputPrefix() { return "MCINPUT" ; }
76   
77   /// Called at each new run
78   virtual void SetRun(const AliInputEventHandler* /*eventHandler*/) {}
79
80   virtual void Terminate(Option_t* /*opt*/="") {}
81   
82   enum EDataType
83   {
84     kHistoForMCInput = (1<<0),
85     kHistoForData = (1<<1)
86   };
87   
88   void SetMC() { fHasMC = kTRUE; }
89   
90   Bool_t HasMC() const { return fHasMC; }
91   
92   Bool_t AlwaysTrue(const AliVEvent& /*event*/) const { return kTRUE; }
93   Bool_t AlwaysTrue(const AliVParticle& /*particle*/) const { return kTRUE; }
94   Bool_t AlwaysTrue(const AliVParticle& /*particle*/, const AliVParticle& /*particle*/) const { return kTRUE; }
95   void NameOfAlwaysTrue(TString& name) const { name = "ALL"; }
96
97   Bool_t AlwaysFalse(const AliVEvent& /*event*/) const { return kFALSE; }
98   Bool_t AlwaysFalse(const AliVParticle& /*particle*/) const { return kFALSE; }
99   Bool_t AlwaysFalse(const AliVParticle& /*particle*/, const AliVParticle& /*particle*/) const { return kFALSE; }
100   void NameOfAlwaysFalse(TString& name) const { name = "NONE"; }
101   
102   void SetHistogramCollection(AliMergeableCollection* h) { fHistogramCollection = h; }
103   
104 protected:
105
106   void CreateHistos(const TObjArray& paths,
107                     const char* hname, const char* htitle,
108                     Int_t nbinsx, Double_t xmin, Double_t xmax,
109                     Int_t nbinsy=-1, Double_t ymin=0.0, Double_t ymax=0.0) const;
110
111   void CreateEventHistos(UInt_t dataType,
112                          const char* what,
113                          const char* hname, const char* htitle,
114                          Int_t nbinsx, Double_t xmin, Double_t xmax,
115                          Int_t nbinsy=-1, Double_t ymin=0.0, Double_t ymax=0.0) const;
116
117   void CreateEventHistos(UInt_t dataType,
118                          const char* eventSelection,
119                          const char* triggerClassName,
120                          const char* centrality,
121                          const char* hname, const char* htitle,
122                          Int_t nbinsx, Double_t xmin, Double_t xmax,
123                          Int_t nbinsy=-1, Double_t ymin=0.0, Double_t ymax=0.0) const;
124   
125   
126   void CreateTrackHistos(UInt_t dataType,
127                          const char* eventSelection,
128                          const char* triggerClassName,
129                          const char* centrality,
130                          const char* hname, const char* htitle,
131                          Int_t nbinsx, Double_t xmin, Double_t xmax,
132                          Int_t nbinsy=-1, Double_t ymin=0.0, Double_t ymax=0.0) const;
133   
134   void CreatePairHistos(UInt_t dataType,
135                         const char* eventSelection,
136                         const char* triggerClassName,
137                         const char* centrality,
138                         const char* hname, const char* htitle,
139                         Int_t nbinsx, Double_t xmin, Double_t xmax,
140                         Int_t nbinsy=-1, Double_t ymin=0.0, Double_t ymax=0.0) const;
141
142   TH1* Histo(const char* eventSelection, const char* histoname);
143   TH1* Histo(const char* eventSelection, const char* triggerClassName, const char* histoname);
144   TH1* Histo(const char* eventSelection, const char* triggerClassName, const char* cent, const char* histoname);
145   TH1* Histo(const char* eventSelection, const char* triggerClassName, const char* cent,
146              const char* what, const char* histoname);
147
148   TH1* MCHisto(const char* eventSelection, const char* histoname);
149   TH1* MCHisto(const char* eventSelection, const char* triggerClassName, const char* histoname);
150   TH1* MCHisto(const char* eventSelection, const char* triggerClassName, const char* cent, const char* histoname);
151   TH1* MCHisto(const char* eventSelection, const char* triggerClassName, const char* cent,
152              const char* what, const char* histoname);
153   
154   TProfile* Prof(const char* eventSelection, const char* histoname);
155   TProfile* Prof(const char* eventSelection, const char* triggerClassName, const char* histoname);
156   TProfile* Prof(const char* eventSelection, const char* triggerClassName, const char* cent, const char* histoname);
157   TProfile* Prof(const char* eventSelection, const char* triggerClassName, const char* cent,
158                  const char* what, const char* histoname);
159   
160   TProfile* MCProf(const char* eventSelection, const char* histoname);
161   TProfile* MCProf(const char* eventSelection, const char* triggerClassName, const char* histoname);
162   TProfile* MCProf(const char* eventSelection, const char* triggerClassName, const char* cent, const char* histoname);
163   TProfile* MCProf(const char* eventSelection, const char* triggerClassName, const char* cent,
164                  const char* what, const char* histoname);
165
166   Int_t GetNbins(Double_t xmin, Double_t xmax, Double_t xstep);
167
168   AliCounterCollection* CounterCollection() const { return fEventCounters; }
169   AliMergeableCollection* HistogramCollection() const { return fHistogramCollection; }
170   const AliAnalysisMuMuBinning* Binning() const { return fBinning; }
171   const AliAnalysisMuMuCutRegistry* CutRegistry() const { return fCutRegistry; }
172   
173 private:
174   
175   /// not implemented on purpose
176   AliAnalysisMuMuBase& operator=(const AliAnalysisMuMuBase& rhs);
177   /// not implemented on purpose
178   AliAnalysisMuMuBase(const AliAnalysisMuMuBase& rhs);
179   
180   AliCounterCollection* fEventCounters; //! event counters
181   AliMergeableCollection* fHistogramCollection; //! collection of histograms
182   const AliAnalysisMuMuBinning* fBinning; //! binning for particles
183   const AliAnalysisMuMuCutRegistry* fCutRegistry; //! registry of cut combinations
184   AliVEvent* fEvent; //! current event
185   AliMCEvent* fMCEvent; //! current MC event
186   TList* fHistogramToDisable; // list of regexp of histo name to disable
187   Bool_t fHasMC; // whether or not we're dealing with MC data
188   
189   ClassDef(AliAnalysisMuMuBase,1) // base class for a companion class to AliAnalysisMuMu
190 };
191
192 #endif
193