6b0ed88f8e5e7f2ea39766037f91e7e24cefee01
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskEmcalJetHadEPpid.h
1 #ifndef AliAnalysisTaskEmcalJetHadEPpid_h
2 #define AliAnalysisTaskEmcalJetHadEPpid_h
3
4 // root classes
5 class TClonesArray;
6 class TH1F;
7 class TH2F;
8 class TH3F;
9 class THnSparse;
10 class TList;
11 class TLorentzVector;
12 class TGraph;
13
14 // AliROOT classes
15 class AliEventPoolManager;
16 class AliLocalRhoParameter;
17 class AliEMCALTrack;
18 class AliMagF;
19 class AliESDEvent;
20 class AliAODEvent;
21 class AliEMCALGeometry;
22 class AliEMCALRecoUtils;
23 class AliESDtrack;
24 class AliESDtrackCuts;
25
26 // container classes
27 class AliJetContainer;
28 class AliParticleContainer;
29 class AliClusterContainer;
30
31 // includes
32 #include <AliAnalysisTaskEmcalJet.h>
33 #include <AliEmcalJet.h>
34 #include <AliVEvent.h>
35 #include <AliVTrack.h>
36 #include <AliVCluster.h>
37 #include <TClonesArray.h>
38 #include <TMath.h>
39 #include <TRandom3.h>
40 #include <AliLog.h>
41 #include "AliESDtrackCuts.h"
42
43 // Local Rho includes
44 #include "AliAnalysisTaskLocalRho.h"
45 #include "AliLocalRhoParameter.h"
46
47 // PID includes
48 #include "AliPIDResponse.h"
49
50 #include "AliAnalysisFilter.h"
51
52 class AliAnalysisTaskEmcalJetHadEPpid : public AliAnalysisTaskEmcalJet {
53  public:
54   AliAnalysisTaskEmcalJetHadEPpid();
55   AliAnalysisTaskEmcalJetHadEPpid(const char *name);
56   //virtual ~AliAnalysisTaskEmcalJetHadEPpid() {}
57   virtual ~AliAnalysisTaskEmcalJetHadEPpid();
58
59   virtual void            UserCreateOutputObjects();
60   // THnSparse Setup
61   virtual THnSparse*      NewTHnSparseF(const char* name, UInt_t entries);
62   virtual void            GetDimParams(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
63   virtual THnSparse*      NewTHnSparseFPID(const char* name, UInt_t entries);
64   virtual void            GetDimParamsPID(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
65   virtual THnSparse*      NewTHnSparseFCorr(const char* name, UInt_t entries);
66   virtual void            GetDimParamsCorr(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
67
68   // set a bun of histogram switches up
69   void                    SetPlotGlobalRho(Bool_t g)            { doPlotGlobalRho = g; } // plot global rho switch
70   void                    SetVariableBinning(Bool_t v)          { doVariableBinning = v; } // do variable binning switch
71   void                        SetvarbinTHnSparse(Bool_t vb)         { dovarbinTHnSparse = vb; } // variable THnSparse bin switch
72   void                                    SetallpidAXIS(Bool_t allAXIS)                 { allpidAXIS = allAXIS; } // fill all PID sparse axis's
73   void                                    SetmakeQAhistos(Bool_t QAhist)        { makeQAhistos = QAhist; } // make QA histos  
74   void                                    SetmakeBIAShistos(Bool_t BIAShist)    { makeBIAShistos = BIAShist; } // make bias histos
75   void                            SetmakeextraCORRhistos(Bool_t Xhist)  { makeextraCORRhistos = Xhist; } // make extra correlations histos
76   void                                    SetoldJEThadhistos(Bool_t oldJH)      { makeoldJEThadhistos = oldJH; } // make older JH histos for comparison
77
78   // set data, detectors type, and PID and PID w bias switches
79   void                                    SetcutType(TString cut)                               { fcutType = cut; }    // EMCAL / TPC acceptance cut
80   void                    SetdoPID(Bool_t p)                    { doPID = p; }   // do PID switch
81   void                                    SetdoPIDtrackBIAS(Bool_t PIDbias)     { doPIDtrackBIAS = PIDbias; } // do PID track bias switch
82
83   // esd track cuts setters
84   void SetTrackCuts(AliESDtrackCuts *cuts)                      { fesdTrackCuts = cuts; }
85
86   // give comments setter
87   void                                    SetdoComments(Bool_t comm)                    { doComments = comm; } // give comment switch
88
89   // setter switch for flavour jet analysis
90   void                                    SetFlavourJetAnalysis(Bool_t flj)     { doFlavourJetAnalysis = flj; } // set on flavour jet analysis
91   virtual void                    SetJETFlavourTag(Int_t fltag)        { fJetFlavTag = fltag; } // set manual tag #
92
93   // setter for beamtype (needed for UserCreateObjects section)
94   virtual void                    SetCollType(BeamType bm) { fBeam = bm; } // set beamtype 
95
96   // getters
97   TString                         GetLocalRhoName() const               {return fLocalRhoName; }
98
99   // set names of some objects
100   virtual void            SetLocalRhoName(const char *ln)       { fLocalRhoName = ln; }
101   virtual void            SetTracksName(const char *tn)         { fTracksName = tn; }
102   virtual void                    SetTracksNameME(const char *MEtn)     { fTracksNameME = MEtn; }
103   virtual void            SetJetsName(const char *jn)           { fJetsName = jn; }
104
105   // bias and cuts - setters
106   virtual void            SetAreaCut(Double_t a)                { fAreacut    = a; }
107   virtual void            SetTrkBias(Double_t b)                { fTrkBias    = b; }  //require a track with pt > b in jet
108   virtual void            SetClusBias(Double_t b)               { fClusBias   = b; }  //require a cluster with pt > b in jet
109   virtual void            SetTrkEta(Double_t e)                 { fTrkEta   = e; }  //eta range of the associated tracks
110   virtual void            SetJetPtcut(Double_t jpt)             { fJetPtcut = jpt; } // jet pt cut
111   virtual void                    SetJetRad(Double_t jrad)                              { fJetRad = jrad; } // jet radius 
112   virtual void                    SetConstituentCut(Double_t constCut)  { fConstituentCut = constCut; } // constituent Cut
113
114   // eta and phi limits of jets - setters
115   virtual void            SetJetEta(Double_t emin, Double_t emax)  { fEtamin = emin; fEtamax = emax; }
116   virtual void            SetJetPhi(Double_t pmin, Double_t pmax)  { fPhimin = pmin; fPhimax = pmax; }
117
118   // event mixing - setters
119   virtual void            SetEventMixing(Int_t yesno)              { fDoEventMixing=yesno; }
120   virtual void            SetMixingTracks(Int_t tracks)            { fMixingTracks = tracks; }
121   virtual void            SetNMixedTr(Int_t nmt)               { fNMIXtracks = nmt; }
122   virtual void            SetNMixedEvt(Int_t nme)              { fNMIXevents = nme; }
123
124   // event trigger/mixed selection - setters
125   virtual void            SetTriggerEventType(UInt_t te)       { fTriggerEventType = te; }
126   virtual void            SetMixedEventType(UInt_t me)         { fMixingEventType = me; }
127   virtual void            SetCentBinSize(Bool_t centbins)      { fCentBinSize = centbins; }
128
129   // set efficiency correction
130   void                    SetDoEffCorr(Int_t effcorr)          { fDoEffCorr = effcorr; }
131   virtual void            SetEffCorrFunc(Double_t efffunc)     { fEffFunctionCorr = efffunc; }
132
133   // jet container - setters
134   void SetContainerAllJets(Int_t c)         { fContainerAllJets      = c;}
135   void SetContainerPIDJets(Int_t c)         { fContainerPIDJets      = c;}
136
137 protected:
138   // functions 
139   void                                   ExecOnce();
140   Bool_t                         Run();
141   virtual void           Terminate(Option_t *); 
142   virtual Int_t          AcceptMyJet(AliEmcalJet *jet);   // applies basic jet tests/cuts before accepting
143   virtual Int_t          GetCentBin(Double_t cent) const; // centrality bin of event
144   Double_t               RelativePhi(Double_t mphi,Double_t vphi) const; // relative jet track angle
145   Double_t               RelativeEPJET(Double_t jetAng, Double_t EPAng) const;  // relative jet event plane angle
146   virtual Int_t          GetEtaBin(Double_t eta) const;      // eta bins
147   virtual Int_t          GetpTjetBin(Double_t pt) const;     // jet pt bins
148   virtual Int_t          GetpTtrackBin(Double_t pt) const;   // track pt bins
149   virtual Int_t          GetzVertexBin(Double_t zVtx) const; // zVertex bin
150   void                   SetfHistPIDcounterLabels(TH1* fHistPID) const;  // PID counter
151   void                               SetfHistQAcounterLabels(TH1* h) const; // QA counter
152   void                   SetfHistEvtSelQALabels(TH1* h) const; // Event Selection Counter
153   //virtual Int_t                        AcceptFlavourJet(AliEmcalJet *jet, Int_t NUM, Int_t NUM2, Int_t NUM3); // flavour jet acceptor
154   virtual Int_t                  AcceptFlavourJet(AliEmcalJet *jet, Int_t NUM); // flavour jet acceptor
155   Double_t               EffCorrection(Double_t trkETA, Double_t trkPT, Int_t effswitch) const; // efficiency correction function
156
157   // parameters of detector to cut on for event
158   Double_t               fPhimin;                  // phi min
159   Double_t               fPhimax;                  // phi max
160   Double_t               fEtamin;                  // eta min
161   Double_t               fEtamax;                  // eta max
162   Double_t               fAreacut;                 // area cut
163   Double_t               fTrkBias;                 // track bias
164   Double_t               fClusBias;                // cluster bias
165   Double_t               fTrkEta;                  // eta min/max of tracks
166   Double_t                   fJetPtcut;                    // jet pt to cut on for correlations
167   Double_t                               fJetRad;                                  // jet radius
168   Double_t                               fConstituentCut;          // jet constituent cut
169
170   // esd track cuts
171   AliESDtrackCuts       *fesdTrackCuts;                    // esdTrackCuts
172
173   // event mixing
174   Int_t                  fDoEventMixing;
175   Int_t                  fMixingTracks;
176   Int_t          fNMIXtracks;
177   Int_t          fNMIXevents;
178   UInt_t         fCentBinSize; // centrality bin size of mixed event pools
179
180   // event selection types
181   UInt_t         fTriggerEventType;
182   UInt_t         fMixingEventType;
183
184   // efficiency correction
185   Int_t    fDoEffCorr;
186   Double_t       fEffFunctionCorr;
187
188   // switches for plots
189   Bool_t                 doPlotGlobalRho;
190   Bool_t                 doVariableBinning;
191   Bool_t         dovarbinTHnSparse;
192   Bool_t                 makeQAhistos;
193   Bool_t                 makeBIAShistos;
194   Bool_t                 makeextraCORRhistos; 
195   Bool_t                 makeoldJEThadhistos;
196   Bool_t                 allpidAXIS;
197
198   // Cut type (EMCAL/TPC acceptance)
199   TString        fcutType;
200
201   // switches for PID
202   Bool_t                 doPID;
203   Bool_t                 doPIDtrackBIAS;
204
205   // do comment switch
206   Bool_t                 doComments;
207
208   // do flavour jet analysis switch, and set flavour jet tag
209   Bool_t             doFlavourJetAnalysis;
210   Int_t                  fJetFlavTag;
211
212   // beam type
213   BeamType fBeam;
214
215   // local rho value
216   Double_t               fLocalRhoVal;
217
218   // object names
219   TString                fTracksName;
220   TString                fTracksNameME;
221   TString                fJetsName;
222
223   // event counter
224   Int_t                  event;
225
226   // boolean functions for PID
227   Bool_t                 isPItpc, isKtpc, isPtpc;
228   Bool_t                 isPIits, isKits, isPits;
229   Bool_t                 isPItof, isKtof, isPtof;
230
231   // event pool
232   TObjArray                 *CloneAndReduceTrackList(TObjArray* tracks);
233   AliEventPoolManager   *fPoolMgr;//!  // event pool Manager object
234
235   // PID
236   AliPIDResponse        *fPIDResponse;   // PID response object
237   AliTPCPIDResponse     *fTPCResponse;   // TPC pid response object
238
239  private:
240   // needed for PID, track objects
241   AliESDEvent       *fESD;//!         // ESD object
242   AliAODEvent       *fAOD;//!             // AOD object
243   AliVEvent             *fVevent;//!      // Vevent object
244
245   TH1F                              *fHistEventQA;//!
246   TH1F                  *fHistEventSelectionQA;//!
247
248   TH2F                  *fHistCentZvertGA;//!
249   TH2F                  *fHistCentZvertJE;//!
250   TH2F                  *fHistCentZvertMB;//!
251   TH2F                  *fHistCentZvertAny;//!
252
253   TH2F                  *fHistTPCdEdX;//!
254   TH2F                  *fHistITSsignal;//!
255 //  TH2F                    *fHistTOFsignal;//!
256
257   TH2F                  *fHistRhovsCent;//!
258   TH2F                  *fHistNjetvsCent;//! number of jets versus Centrality
259   TH2F                  *fHistJetPtvsTrackPt[6];//!
260   TH2F                  *fHistRawJetPtvsTrackPt[6];//!
261   TH1F                  *fHistTrackPt[6];//!
262   TH1F                  *fHistEP0[6];//!
263   TH1F                  *fHistEP0A[6];//!
264   TH1F                  *fHistEP0C[6];//!
265   TH2F                  *fHistEPAvsC[6];//!
266   TH1F                                  *fHistJetPtcorrGlRho[6];//!
267   TH2F                  *fHistJetPtvsdEP[6];//!
268   TH2F                  *fHistJetPtvsdEPBias[6];//!
269   TH2F                  *fHistRhovsdEP[6];//!
270   TH3F                  *fHistJetEtaPhiPt[6];//!
271   TH3F                  *fHistJetEtaPhiPtBias[6];//!
272   TH2F                  *fHistJetPtArea[6];//!
273   TH2F                  *fHistJetPtAreaBias[6];//!
274   TH2F                  *fHistJetPtNcon[6];//!
275   TH2F                  *fHistJetPtNconBias[6];//!
276   TH2F                  *fHistJetPtNconCh[6];//!
277   TH2F                  *fHistJetPtNconBiasCh[6];//!
278   TH2F                  *fHistJetPtNconEm[6];//!
279   TH2F                  *fHistJetPtNconBiasEm[6];//!
280   TH1F                      *fHistJetHaddPhiINcent[6];//!
281   TH1F                          *fHistJetHaddPhiOUTcent[6];//!
282   TH1F                          *fHistJetHaddPhiMIDcent[6];//!
283
284   TH1                   *fHistCentrality;//!
285   TH1                   *fHistZvtx;//!
286   TH1                   *fHistMult;//!
287   TH1                           *fHistJetPhi;//!
288   TH1                       *fHistTrackPhi;//!
289   TH1                   *fHistLocalRhoJetpt;//!
290   TH1                       *fHistJetHaddPhiIN;//!
291   TH1                           *fHistJetHaddPhiOUT;//!
292   TH1                           *fHistJetHaddPhiMID;//!
293   TH1                                   *fHistJetHaddPhiBias;//!
294   TH1                                   *fHistJetHaddPhiINBias;//!
295   TH1                                   *fHistJetHaddPhiOUTBias;//!
296   TH1                                   *fHistJetHaddPhiMIDBias;//!
297
298   TH1                   *fHistMEdPHI;//! // phi distrubtion of mixed events
299   TH1                                   *fHistTrackPtallcent;//!
300
301   TH2                   *fHistJetEtaPhi;//!  
302   TH2                   *fHistTrackEtaPhi[4][7];//!
303   TH1                           *fHistJetHadbindPhi[9];//! 
304   TH1                                   *fHistJetHadbindPhiIN[9];//! 
305   TH1                                   *fHistJetHadbindPhiMID[9];//! 
306   TH1                           *fHistJetHadbindPhiOUT[9];//! 
307   TH2                   *fHistJetHEtaPhi;//!
308
309   TH1                   *fHistJetPt[6];//!
310   TH1                   *fHistJetPtBias[6];//!
311   TH1                   *fHistJetPtTT[6];//!
312   TH2                   *fHistAreavsRawPt[6];//!
313   TH2                   *fHistJetH[6][5][3];//!
314   TH2                   *fHistJetHBias[6][5][3];//!
315   TH2                   *fHistJetHTT[6][5][3];//!
316   TH1F                                  *fHistJetHdPHI[11];//!
317   TH2F                                  *fHistJetHdETAdPHI[11];//!
318   TH2F                  *fHistSEphieta;//! // single events phi-eta distributions
319   TH2F                  *fHistMEphieta;//! // mixed events phi-eta distributions
320   TH1F                                  *fHistJetHaddPHI;//!
321
322   // PID status histo's
323   TH1                                   *fHistPID;//!
324
325   // THn Sparse's
326   THnSparse             *fhnPID;//!          // PID sparse
327   THnSparse             *fhnMixedEvents;//!  // mixed events matrix
328   THnSparse             *fhnJH;//!           // jet hadron events matrix
329   THnSparse                             *fhnCorr;//!              // sparse to get # jet triggers
330
331   // container objects
332   AliJetContainer            *fJetsCont;                   //!Jets
333   AliParticleContainer       *fTracksCont;                 //!Tracks
334   AliClusterContainer        *fCaloClustersCont;           //!Clusters
335
336   // container specifier
337   Int_t                                 fContainerAllJets;  // number of container with all full jets
338   Int_t                                 fContainerPIDJets;  // number of container with full jets meeting Pt cut (for PID)
339
340 // ***********************************************************
341    
342   //Declare it private to avoid compilation warning
343   AliAnalysisTaskEmcalJetHadEPpid(const AliAnalysisTaskEmcalJetHadEPpid & g) ; // cpy ctor
344
345   AliAnalysisTaskEmcalJetHadEPpid& operator=(const AliAnalysisTaskEmcalJetHadEPpid&); // not implemented
346   ClassDef(AliAnalysisTaskEmcalJetHadEPpid, 4); // Emcal jet hadron PID - Event plane dependence
347 };
348 #endif