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