]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/EBYE/NetParticle/AliAnalysisNetParticleHelper.h
Bug fixes for GRID operation (TStreamer)
[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 // Helper Class for for NetParticle Distributions
10 // Authors: Jochen Thaeder <jochen@thaeder.de>
11
12 #include "THnSparse.h"
13 #include "TParticle.h"
14 #include "TH1F.h"
15 #include "TF1.h"
16
17 class AliESDtrack;
18 class AliMCEvent;
19 class AliStack;
20 class AliPIDResponse;
21 class AliESDInputHandler;
22 class AliAODInputHandler;
23 class AliAODEvent;
24 class AliAODTrack;
25 class AliAODMCParticle;
26
27 class AliAnalysisNetParticleHelper : public TNamed {
28
29  public:
30
31   /*
32    * ---------------------------------------------------------------------------------
33    *                            Constructor / Destructor
34    * ---------------------------------------------------------------------------------
35    */
36
37   AliAnalysisNetParticleHelper();
38   virtual ~AliAnalysisNetParticleHelper();
39
40   /*
41    * ---------------------------------------------------------------------------------
42    *                                    Setter
43    * ---------------------------------------------------------------------------------
44    */
45
46   void SetCentralityBinMax(Int_t d)                  {fCentralityBinMax    = d;}
47   void SetVertexZMax(Float_t f)                      {fVertexZMax          = f;}
48   void SetRapidityMax(Float_t f)                     {fRapidityMax         = f;}
49   void SetMinTrackLengthMC(Float_t f)                {fMinTrackLengthMC    = f;}
50   void SetNSigmaMaxCdd(Float_t f)                    {fNSigmaMaxCdd        = f;}
51   void SetNSigmaMaxCzz(Float_t f)                    {fNSigmaMaxCzz        = f;}
52
53   void SetParticleSpecies(AliPID::EParticleType pid);
54   void SetControlParticleSpecies(Int_t pdgCode, Bool_t isNeutral, TString name) {
55     fControlParticleCode = pdgCode;
56     fControlParticleIsNeutral = isNeutral;
57     fControlParticleName = name;
58   }
59
60   void SetNSigmaMaxTPC(Float_t f)                    {fNSigmaMaxTPC        = f;}
61   void SetNSigmaMaxTOF(Float_t f)                    {fNSigmaMaxTOF        = f;}
62   void SetMinPtForTOFRequired(Float_t f)             {fMinPtForTOFRequired = f;}
63
64   /*
65    * ---------------------------------------------------------------------------------
66    *                                    Getter
67    * ---------------------------------------------------------------------------------
68    */
69   
70   AliPID::EParticleType GetParticleSpecies(){return fParticleSpecies;}
71   TString  GetParticleName(Int_t idxPart);
72   TString  GetParticleTitle(Int_t idxPart);
73   TString  GetParticleTitleLatex(Int_t idxPart);
74   TString  GetControlParticleName(Int_t idxPart);
75   TString  GetControlParticleTitle(Int_t idxPart);
76
77   TH1F*    GetHEventStat0()                  {return fHEventStat0;}
78   TH1F*    GetHEventStat1()                  {return fHEventStat1;}
79   TH1F*    GetHTriggerStat()                 {return fHTriggerStat;}
80   TH1F*    GetHCentralityStat()              {return fHCentralityStat;}
81
82   Int_t    GetCentralityBin()                {return fCentralityBin;}
83   Float_t  GetCentralityPercentile()         {return fCentralityPercentile;}
84
85   Int_t    GetControlParticleCode()          {return fControlParticleCode;}
86   Bool_t   IsControlParticleNeutral()        {return fControlParticleIsNeutral;}
87   TString& GetControlParticleName()          {return fControlParticleName;}
88
89   /*
90    * ---------------------------------------------------------------------------------
91    *                                 Public Methods
92    * ---------------------------------------------------------------------------------
93    */
94
95   /** Initialize Helper */
96   Int_t Initialize(Bool_t isMC);
97
98   /** Setup Event */
99   Int_t SetupEvent(AliESDInputHandler *esdHandler, AliAODInputHandler *aodHandler, AliMCEvent *mcEvent);
100
101   /*
102    * ---------------------------------------------------------------------------------
103    *                         Event / Trigger Statistics
104    * ---------------------------------------------------------------------------------
105    */
106
107   /** Check if event is triggred */
108   Bool_t IsEventTriggered();
109
110   /** Fill event cut statistics */
111   Bool_t IsEventRejected();
112
113   /*
114    * ---------------------------------------------------------------------------------
115    *                         Accept Particle Methods - private
116    * ---------------------------------------------------------------------------------
117    */
118   
119   /** Check if charged MC particle is accepted for basic parameters */
120   /** NOT possible for AODs (AliAODMCParticle NOT from TParticle)*/
121   Bool_t IsParticleAcceptedBasicCharged(TParticle *particle, Int_t idxMC);
122   Bool_t IsParticleAcceptedBasicCharged(AliAODMCParticle *particle);
123
124   /** Check if neutral MC particle is accepted for basic parameters */
125   /** NOT possible for AODs (AliAODMCParticle NOT from TParticle)*/
126   Bool_t IsParticleAcceptedBasicNeutral(TParticle *particle, Int_t idxMC);
127   Bool_t IsParticleAcceptedBasicNeutral(AliAODMCParticle *particle);
128  
129   /** Check if MC particle is accepted for Rapidity */
130   Bool_t IsParticleAcceptedRapidity(TParticle *particle, Double_t &yP);
131
132   /** Check if MC particle is findable tracks */
133   Bool_t IsParticleFindable(Int_t label);
134     
135   /*
136    * ---------------------------------------------------------------------------------
137    *                            Accept Track Methods - public
138    * ---------------------------------------------------------------------------------
139    */
140   
141   /** Check if track is accepted for basic parameters */
142   /** NOT possible with AliVTrack (GetInnerParam returns NULL) */
143   Bool_t IsTrackAcceptedBasicCharged(AliESDtrack *track);
144   Bool_t IsTrackAcceptedBasicCharged(AliAODTrack *track);
145   
146   /** Check if track is accepted for Rapidity */
147   Bool_t IsTrackAcceptedRapidity(AliVTrack *track, Double_t &yP);
148
149   /** Check if track is accepted for DCA */
150   Bool_t IsTrackAcceptedDCA(AliESDtrack *track);
151
152   /** Check if track is accepted for PID */
153   Bool_t IsTrackAcceptedPID(AliVTrack *track, Double_t *pid);
154
155   /*
156    * ---------------------------------------------------------------------------------
157    *                         Helper Methods
158    * ---------------------------------------------------------------------------------
159    */
160
161   /** Update eta corrected TPC pid */
162   void  UpdateEtaCorrectedTPCPid();
163
164   /** Get efficiency correctionf of particle dependent on (eta, phi, pt, centrality) */
165   Double_t GetTrackbyTrackCorrectionFactor(Double_t *aTrack,  Int_t flag);
166   
167   /** Method for the correct logarithmic binning of histograms */
168   void BinLogAxis(const THnSparseF *h, Int_t axisNumber);
169
170   ///////////////////////////////////////////////////////////////////////////////////
171
172  private:
173
174   AliAnalysisNetParticleHelper(const AliAnalysisNetParticleHelper&); // not implemented
175   AliAnalysisNetParticleHelper& operator=(const AliAnalysisNetParticleHelper&); // not implemented
176
177   /*
178    * ---------------------------------------------------------------------------------
179    *                           Initialize - Private
180    * ---------------------------------------------------------------------------------
181    */
182
183   /**  Initialize event cut statistics */
184   void InitializeEventStats();
185
186   /**  Initialize trigger statistics */
187   void InitializeTriggerStats();
188
189   /**  Initialize centrality statistics */
190   void InitializeCentralityStats();
191
192   /** Initialize eta correction maps for TPC pid */
193   Int_t InitializeEtaCorrection(Bool_t isMC);
194
195   /** Initialize track by track correction matrices */
196   Int_t InitializeTrackbyTrackCorrection();
197
198   /*
199    * ---------------------------------------------------------------------------------
200    *                         Event / Trigger Statistics - private
201    * ---------------------------------------------------------------------------------
202    */
203   
204   /** Fill event cut statistics */
205   Bool_t FillEventStats(Int_t *aEventCuts);
206
207   /*
208    * ---------------------------------------------------------------------------------
209    *                             Members - private
210    * ---------------------------------------------------------------------------------
211    */
212
213   AliESDInputHandler   *fESDHandler;               //! Ptr to ESD handler 
214   AliPIDResponse       *fPIDResponse;              //! Ptr to PID response Object
215   AliESDEvent          *fESD;                      //! Ptr to ESD event
216   AliAODInputHandler   *fAODHandler;               //! Ptr to AOD handler 
217   AliAODEvent          *fAOD;                      //! Ptr to AOD event
218   AliMCEvent           *fMCEvent;                  //! Ptr to MC event
219   AliStack             *fStack;                    //! Ptr to stack
220
221   // =======================================================================
222
223   Int_t                 fCentralityBin;            //  Centrality bin of current event within max centrality bin
224   Float_t               fCentralityPercentile;     //  Centrality percentile of current event
225   // ----------------------------------------------------------------------
226   Int_t                 fCentralityBinMax;         //  Max centrality bin to be used
227   Float_t               fVertexZMax;               //  VertexZ cut
228   Float_t               fRapidityMax;              //  Rapidity cut
229   Float_t               fMinTrackLengthMC;         //  Min track length for MC tracks
230   Float_t               fNSigmaMaxCdd;             //  N Sigma for dcar / sqrt(cdd) - turn off with 0.
231   Float_t               fNSigmaMaxCzz;             //  N Sigma for dcaz / sqrt(czz) - turn off with 0.
232   // -----------------------------------------------------------------------
233   AliPID::EParticleType fParticleSpecies;          //  Particle species on basis of AliPID
234   TString               fPartName[2];              //  Particle name (short) - particle/antiparticle 
235   TString               fPartTitle[2];             //  Particle name (long)  - particle/antiparticle 
236   TString               fPartTitleLatex[2];        //  Particle name (LATEX) - particle/antiparticle 
237   Int_t                 fControlParticleCode;      //  PDG code control particle
238   Bool_t                fControlParticleIsNeutral; //  Is control particle neutral
239   TString               fControlParticleName;      //  Name of control particle
240   // -----------------------------------------------------------------------
241   Float_t               fNSigmaMaxTPC;             //  N Sigma for TPC PID
242   Float_t               fNSigmaMaxTOF;             //  N Sigma for TOF PID
243   Float_t               fMinPtForTOFRequired;      //  Min pt from where TOF is required
244
245   // =======================================================================
246
247   TH1F                 *fHEventStat0;              //  Event cut statistics
248   TH1F                 *fHEventStat1;              //  Event cut statistics - incremental
249   Int_t                 fHEventStatMax;            //  Max N cuts to be included in HEventStat
250   // -----------------------------------------------------------------------
251   TH1F                 *fHTriggerStat;             //  Trigger statistics
252   Int_t                 fNTriggers;                //  N triggers used
253   // -----------------------------------------------------------------------
254   TH1F                 *fHCentralityStat;          //  Centrality statistics
255   Int_t                 fNCentralityBins;          //  N centrality bins used
256
257   // =======================================================================
258
259   TF1                  *fEtaCorrFunc;              //! Eta correction function for TPC dE/dx  
260   THnSparseF         ***fCorr0;                    // Correction matrices for particle / anti-particle
261   THnSparseF         ***fCorr1;                    // Correction matrices [cross section corrected] matrices for particle/ anti-particle
262   // -----------------------------------------------------------------------
263
264   ClassDef(AliAnalysisNetParticleHelper, 1);
265 };
266
267 #endif