]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/EBYE/NetParticle/AliAnalysisNetParticleHelper.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / EBYE / NetParticle / AliAnalysisNetParticleHelper.h
1 //-*- Mode: C++ -*-
2
3 #ifndef ALIANALYSISNETPARTICLEHELPER_H
4 #define ALIANALYSISNETPARTICLEHELPER_H
5
6 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
7  * See cxx source for full Copyright notice                               */
8   
9 /**
10  * Class for NetParticle Distributions
11  * -- Helper class for net particle istributions
12  * Authors: Jochen Thaeder <jochen@thaeder.de>
13  *          Michael Weber <m.weber@cern.ch>
14  */
15
16 #include "THnBase.h"
17 #include "THn.h"
18 #include "TH1F.h"
19 #include "TF1.h"
20 #include "TProfile2D.h"
21 #include "TRandom3.h"
22
23 class AliESDtrack;
24 class AliMCEvent;
25 class AliStack;
26 class AliPIDResponse;
27 class AliESDtrackCuts;
28 class AliInputEventHandler;
29 class AliESDInputHandler;
30 class AliAODInputHandler;
31 class AliAODEvent;
32 class AliAODTrack;
33 class AliAODMCParticle;
34 class AliMCParticle;
35
36 class AliAnalysisNetParticleHelper : public TNamed {
37
38  public:
39
40   /*
41    * ---------------------------------------------------------------------------------
42    *                            Constructor / Destructor
43    * ---------------------------------------------------------------------------------
44    */
45
46   AliAnalysisNetParticleHelper();
47   virtual ~AliAnalysisNetParticleHelper();
48
49   /*
50    * ---------------------------------------------------------------------------------
51    *                                    Setter
52    * ---------------------------------------------------------------------------------
53    */
54
55   void SetCentralityBinMax(Int_t d)                  {fCentralityBinMax    = d;}
56   void SetVertexZMax(Float_t f)                      {fVertexZMax          = f;}
57   void SetRapidityMax(Float_t f)                     {fRapidityMax         = f;}
58   void SetMinTrackLengthMC(Float_t f)                {fMinTrackLengthMC    = f;}
59   void SetNSigmaMaxCdd(Float_t f)                    {fNSigmaMaxCdd        = f;}
60   void SetNSigmaMaxCzz(Float_t f)                    {fNSigmaMaxCzz        = f;}
61
62   void SetPhiRange(Float_t f1, Float_t f2);
63
64   void SetParticleSpecies(AliPID::EParticleType pid);
65
66   void SetUsePID(Bool_t b);
67   void SetPIDStrategy(Int_t i)                       {fPIDStrategy         = i;}
68   void SetNSigmaMaxITS(Float_t f)                    {fNSigmaMaxITS        = f;}
69   void SetNSigmaMaxTPC(Float_t f)                    {fNSigmaMaxTPC        = f;}
70   void SetNSigmaMaxTPClow(Float_t f)                 {fNSigmaMaxTPClow     = f;}
71   void SetNSigmaMaxTOF(Float_t f)                    {fNSigmaMaxTOF        = f;}
72   void SetMinPtForTOFRequired(Float_t f)             {fMinPtForTOFRequired = f;}
73   void SetMaxPtForTPClow(Float_t f)                  {fMaxPtForTPClow      = f;}
74
75   void SetNSubSamples(Int_t i)                       {fNSubSamples         = i;}
76
77   /*
78    * ---------------------------------------------------------------------------------
79    *                                    Getter
80    * ---------------------------------------------------------------------------------
81    */
82   
83   AliPID::EParticleType GetParticleSpecies()   {return fParticleSpecies;}
84   TString  GetParticleName(Int_t idxPart);
85   TString  GetParticleTitle(Int_t idxPart);
86   TString  GetParticleTitleLatex(Int_t idxPart);
87
88   TH1F*    GetHEventStat0()                    {return fHEventStat0;}
89   TH1F*    GetHEventStat1()                    {return fHEventStat1;}
90   TH1F*    GetHTriggerStat()                   {return fHTriggerStat;}
91   TH1F*    GetHCentralityStat()                {return fHCentralityStat;}
92
93   Int_t    GetCentralityBin()                  {return fCentralityBin;}
94   Float_t  GetCentralityPercentile()           {return fCentralityPercentile;}
95
96   Bool_t   GetUsePID()                         {return fUsePID;}
97
98   Float_t  GetMinPtForTOFRequired()            {return fMinPtForTOFRequired;}
99   Float_t  GetMaxPtForTPClow()                 {return fMaxPtForTPClow;}
100   Float_t  GetRapidityMax()                    {return fRapidityMax;}
101   Float_t  GetPhiMin()                         {return fPhiMin;}
102   Float_t  GetPhiMax()                         {return fPhiMax;}
103  
104   AliESDtrackCuts* GetESDTrackCuts()           {return fESDTrackCuts;}
105   Bool_t           GetIsMC()                   {return fIsMC;}
106   Int_t            GetAODtrackCutBit()         {return fAODtrackCutBit;}
107
108   AliInputEventHandler* GetInputEventHandler() {return fInputEventHandler;}
109   AliMCEvent*           GetMCEvent()           {return fMCEvent;}
110
111   Int_t    GetSubSampleIdx()                   {return fSubSampleIdx;}
112   Int_t    GetNSubSamples()                    {return fNSubSamples;}
113
114   /*
115    * ---------------------------------------------------------------------------------
116    *                                 Public Methods
117    * ---------------------------------------------------------------------------------
118    */
119
120   /** Initialize Helper */
121   Int_t Initialize(AliESDtrackCuts *cuts, Bool_t isMC, Int_t trackCutBit, Int_t modeDistCreation);
122
123   /** Setup Event */
124   Int_t SetupEvent(AliESDInputHandler *esdHandler, AliAODInputHandler *aodHandler, AliMCEvent *mcEvent);
125
126   /*
127    * ---------------------------------------------------------------------------------
128    *                         Event / Trigger Statistics
129    * ---------------------------------------------------------------------------------
130    */
131
132   /** Check if event is triggred */
133   Bool_t IsEventTriggered();
134
135   /** Fill event cut statistics */
136   Bool_t IsEventRejected();
137
138   /*
139    * ---------------------------------------------------------------------------------
140    *                         Accept Particle Methods - private
141    * ---------------------------------------------------------------------------------
142    */
143   
144   /** Check if charged MC particle is accepted for basic parameters */
145   Bool_t IsParticleAcceptedBasicCharged(AliVParticle *particle, Int_t idxMC);
146
147   /** Check if neutral MC particle is accepted for basic parameters */
148   Bool_t IsParticleAcceptedBasicNeutral(AliVParticle *particle, Int_t idxMC);
149  
150   /** Check if MC particle is accepted for Rapidity */
151   Bool_t IsParticleAcceptedRapidity(AliVParticle *particle, Double_t &yP);
152
153   /** Check if MC particle is accepted for Phi */
154   Bool_t IsParticleAcceptedPhi(AliVParticle *particle);
155
156   /** Check if MC particle is findable tracks */
157   Bool_t IsParticleFindable(Int_t label);
158     
159   /*
160    * ---------------------------------------------------------------------------------
161    *                            Accept Track Methods - public
162    * ---------------------------------------------------------------------------------
163    */
164   
165   /** Check if track is accepted for basic parameters */
166   Bool_t IsTrackAcceptedBasicCharged(AliVTrack *track);
167   
168   /** Check if track is accepted for Rapidity */
169   Bool_t IsTrackAcceptedRapidity(AliVTrack *track, Double_t &yP);
170
171   /** Check if track is accepted for DCA */
172   Bool_t IsTrackAcceptedDCA(AliVTrack *track);
173
174   /** Check if track is accepted for PID */
175   Bool_t IsTrackAcceptedPID(AliVTrack *track, Double_t *pid);
176
177   /** Check if trackis  accepted for Phi */
178   Bool_t IsTrackAcceptedPhi(AliVTrack *track);
179
180   /*
181    * ---------------------------------------------------------------------------------
182    *                         Helper Methods
183    * ---------------------------------------------------------------------------------
184    */
185   
186   /** Method for the correct logarithmic binning of histograms 
187    *  and Update MinPtForTOFRequired, using the pT log-scale 
188    */
189   void BinLogAxis(const THnBase *h, Int_t axisNumber, AliESDtrackCuts* cuts = NULL);
190
191   /*
192    * ---------------------------------------------------------------------------------
193    *                    Static Const Members - public
194    * ---------------------------------------------------------------------------------
195    */
196
197   static const Float_t fgkfHistBinWitdthRap;   // Histogram std bin width for rapidity/eta
198   static const Float_t fgkfHistBinWitdthPt;    // Histogram std bin width for pt
199
200   static const Float_t fgkfHistRangeCent[];    // Histogram range for centrality
201   static const Int_t   fgkfHistNBinsCent;      // Histogram N bins for centrality
202   static const Float_t fgkfHistRangeEta[];     // Histogram range for eta
203   static const Int_t   fgkfHistNBinsEta;       // Histogram N bins for eta
204   static const Float_t fgkfHistRangeRap[];     // Histogram range for rapidity
205   static const Int_t   fgkfHistNBinsRap;       // Histogram N bins for rapidity
206   static const Float_t fgkfHistRangePhi[];     // Histogram range for phi
207   static const Int_t   fgkfHistNBinsPhi;       // Histogram N bins for phi
208   static const Float_t fgkfHistRangePt[];      // Histogram range for pt
209   static const Int_t   fgkfHistNBinsPt;        // Histogram N bins for pt
210   static const Float_t fgkfHistRangeSign[];    // Histogram range for sign
211   static const Int_t   fgkfHistNBinsSign;      // Histogram N bins for sign
212
213   static const Char_t* fgkEventNames[];         // Event names 
214   static const Char_t* fgkCentralityMaxNames[]; // Centrality names 
215   static const Char_t* fgkTriggerNames[];       // Trigger names 
216   static const Char_t* fgkCentralityNames[];    // Centrality names 
217
218
219   ///////////////////////////////////////////////////////////////////////////////////
220
221  private:
222
223   AliAnalysisNetParticleHelper(const AliAnalysisNetParticleHelper&); // not implemented
224   AliAnalysisNetParticleHelper& operator=(const AliAnalysisNetParticleHelper&); // not implemented
225
226   /*
227    * ---------------------------------------------------------------------------------
228    *                           Initialize - Private
229    * ---------------------------------------------------------------------------------
230    */
231
232   /**  Initialize event cut statistics */
233   void InitializeEventStats();
234
235   /**  Initialize trigger statistics */
236   void InitializeTriggerStats();
237
238   /**  Initialize centrality statistics */
239   void InitializeCentralityStats();
240
241   /*
242    * ---------------------------------------------------------------------------------
243    *                         Event / Trigger Statistics - private
244    * ---------------------------------------------------------------------------------
245    */
246   
247   /** Fill event cut statistics */
248   Bool_t FillEventStats(Int_t *aEventCuts);
249
250   /*
251    * ---------------------------------------------------------------------------------
252    *                             Members - private
253    * ---------------------------------------------------------------------------------
254    */
255   Int_t                 fModeDistCreation;         //  Dist creation mode       : 1 = on | 0 = off 
256   // =======================================================================
257   AliInputEventHandler *fInputEventHandler;        //! Ptr to input event handler (ESD or AOD)
258   AliPIDResponse       *fPIDResponse;              //! Ptr to PID response Object
259   AliESDEvent          *fESD;                      //! Ptr to ESD event
260   AliESDtrackCuts      *fESDTrackCuts;             //! Ptr to ESD cuts  
261   AliAODEvent          *fAOD;                      //! Ptr to AOD event
262   Int_t                 fAODtrackCutBit;           //  Track filter bit for AOD tracks
263   Bool_t                fIsMC;                     //  Is MC event
264   AliMCEvent           *fMCEvent;                  //! Ptr to MC event
265   AliStack             *fStack;                    //! Ptr to stack
266   // =======================================================================
267   Int_t                 fCentralityBin;            //  Centrality bin of current event within max centrality bin
268   Float_t               fCentralityPercentile;     //  Centrality percentile of current event
269   // ----------------------------------------------------------------------
270   Int_t                 fCentralityBinMax;         //  Max centrality bin to be used
271   Float_t               fVertexZMax;               //  VertexZ cut
272   Float_t               fRapidityMax;              //  Rapidity cut
273   Float_t               fPhiMin;                   //  Phi min cut
274   Float_t               fPhiMax;                   //  Phi max cut
275   Float_t               fMinTrackLengthMC;         //  Min track length for MC tracks
276   Float_t               fNSigmaMaxCdd;             //  N Sigma for dcar / sqrt(cdd) - turn off with 0.
277   Float_t               fNSigmaMaxCzz;             //  N Sigma for dcaz / sqrt(czz) - turn off with 0.
278   // -----------------------------------------------------------------------
279   AliPID::EParticleType fParticleSpecies;          //  Particle species on basis of AliPID
280   TString               fPartName[2];              //  Particle name (short) - particle/antiparticle 
281   TString               fPartTitle[2];             //  Particle name (long)  - particle/antiparticle 
282   TString               fPartTitleLatex[2];        //  Particle title (LATEX) - particle/antiparticle
283   // -----------------------------------------------------------------------
284   Bool_t                fUsePID;                   //  Use PID, default is on
285   Int_t                 fPIDStrategy;              //  PID Strategy to be used
286   Float_t               fNSigmaMaxITS;             //  N Sigma for ITS PID
287   Float_t               fNSigmaMaxTPC;             //  N Sigma for TPC PID
288   Float_t               fNSigmaMaxTPClow;          //  N Sigma for TPC PID lower part
289   Float_t               fNSigmaMaxTOF;             //  N Sigma for TOF PID
290   Float_t               fMinPtForTOFRequired;      //  Min pt from where TOF is required
291   Float_t               fMaxPtForTPClow;           //  Max pt until TPClow is used
292   // =======================================================================
293   TH1F                 *fHEventStat0;              //  Event cut statistics
294   TH1F                 *fHEventStat1;              //  Event cut statistics - incremental
295   Int_t                 fHEventStatMax;            //  Max N cuts to be included in HEventStat
296   // -----------------------------------------------------------------------
297   TH1F                 *fHTriggerStat;             //  Trigger statistics
298   Int_t                 fNTriggers;                //  N triggers used
299   // -----------------------------------------------------------------------
300   TH1F                 *fHCentralityStat;          //  Centrality statistics
301   Int_t                 fNCentralityBins;          //  N centrality bins used
302   // =======================================================================
303   Int_t                 fNSubSamples;              //  N subsamples
304   Int_t                 fSubSampleIdx;             //  Subsample idx for current event
305   TRandom3             *fRandom;                   //  Random generator
306
307   ClassDef(AliAnalysisNetParticleHelper, 1);
308 };
309
310 #endif