5a2e469f56671e75ea34efe3ac7ae627ad184c49
[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
25 // container classes
26 class AliJetContainer;
27 class AliParticleContainer;
28 class AliClusterContainer;
29
30 // includes
31 #include <AliAnalysisTaskEmcalJet.h>
32 #include <AliEmcalJet.h>
33 #include <AliVEvent.h>
34 #include <AliVTrack.h>
35 #include <AliVCluster.h>
36 #include <TClonesArray.h>
37 #include <TMath.h>
38 #include <TRandom3.h>
39 #include <AliLog.h>
40
41 // Local Rho includes
42 #include "AliAnalysisTaskLocalRho.h"
43 #include "AliLocalRhoParameter.h"
44
45 // PID includes
46 #include "AliPIDResponse.h"
47
48 #include "AliAnalysisFilter.h"
49
50 class AliAnalysisTaskEmcalJetHadEPpid : public AliAnalysisTaskEmcalJet {
51  public:
52   AliAnalysisTaskEmcalJetHadEPpid();
53   AliAnalysisTaskEmcalJetHadEPpid(const char *name);
54   //virtual ~AliAnalysisTaskEmcalJetHadEPpid() {}
55   virtual ~AliAnalysisTaskEmcalJetHadEPpid();
56
57   virtual void            UserCreateOutputObjects();
58   // THnSparse Setup
59   virtual THnSparse*      NewTHnSparseD(const char* name, UInt_t entries);
60   virtual void            GetDimParams(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
61   virtual THnSparse*      NewTHnSparseDPID(const char* name, UInt_t entries);
62   virtual void            GetDimParamsPID(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
63   virtual THnSparse*      NewTHnSparseDCorr(const char* name, UInt_t entries);
64   virtual void            GetDimParamsCorr(Int_t iEntry,TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax);
65
66   // set a bun of histogram switches up
67   void                    SetPlotGlobalRho(Bool_t g)            { doPlotGlobalRho = g; } // plot global rho switch
68   void                    SetVariableBinning(Bool_t v)          { doVariableBinning = v; } // do variable binning switch
69   void                        SetvarbinTHnSparse(Bool_t vb)         { dovarbinTHnSparse = vb; } // variable THnSparse bin switch
70   void                                    SetallpidAXIS(Bool_t allAXIS)                 { allpidAXIS = allAXIS; } // fill all PID sparse axis's
71   void                                    SetmakeQAhistos(Bool_t QAhist)        { makeQAhistos = QAhist; } // make QA histos  
72   void                                    SetmakeBIAShistos(Bool_t BIAShist)    { makeBIAShistos = BIAShist; } // make bias histos
73   void                            SetmakeextraCORRhistos(Bool_t Xhist)  { makeextraCORRhistos = Xhist; } // make extra correlations histos
74   void                                    SetoldJEThadhistos(Bool_t oldJH)      { makeoldJEThadhistos = oldJH; } // make older JH histos for comparison
75
76   // set data, detectors type, and PID and PID w bias switches
77   void                                    SetcutType(TString cut)                               { fcutType = cut; }    // EMCAL / TPC acceptance cut
78   void                    SetdoPID(Bool_t p)                    { doPID = p; }   // do PID switch
79   void                                    SetdoPIDtrackBIAS(Bool_t PIDbias)     { doPIDtrackBIAS = PIDbias; } // do PID track bias switch
80
81   // give comments setter
82   void                                    SetdoComments(Bool_t comm)                    { doComments = comm; } // give comment switch
83
84   // getters
85   TString                 GetLocalRhoName() const               {return fLocalRhoName; }
86
87   // set names of some objects
88   virtual void            SetLocalRhoName(const char *ln)       { fLocalRhoName = ln; }
89   virtual void            SetTracksName(const char *tn)         { fTracksName = tn; }
90   virtual void            SetJetsName(const char *jn)           { fJetsName = jn; }
91
92   // bias and cuts - setters
93   virtual void            SetAreaCut(Double_t a)                { fAreacut    = a; }
94   virtual void            SetTrkBias(Double_t b)                { fTrkBias    = b; }  //require a track with pt > b in jet
95   virtual void            SetClusBias(Double_t b)               { fClusBias   = b; }  //require a cluster with pt > b in jet
96   virtual void            SetTrkEta(Double_t e)                 { fTrkEta   = e; }  //eta range of the associated tracks
97   virtual void            SetJetPtcut(Double_t jpt)             { fJetPtcut = jpt; } // jet pt cut
98   virtual void                    SetJetRad(Double_t jrad)                              { fJetRad = jrad; } // jet radius 
99   virtual void                    SetConstituentCut(Double_t constCut)  { fConstituentCut = constCut; } // constituent Cut
100
101   // eta and phi limits of jets - setters
102   virtual void            SetJetEta(Double_t emin, Double_t emax)  { fEtamin = emin; fEtamax = emax; }
103   virtual void            SetJetPhi(Double_t pmin, Double_t pmax)  { fPhimin = pmin; fPhimax = pmax; }
104
105   // event mixing - setters
106   virtual void            SetEventMixing(Int_t yesno)              { fDoEventMixing=yesno; }
107   virtual void            SetMixingTracks(Int_t tracks)            { fMixingTracks = tracks; }
108
109   // jet container - setters
110   void SetContainerAllJets(Int_t c)         { fContainerAllJets      = c;}
111   void SetContainerPIDJets(Int_t c)         { fContainerPIDJets      = c;}
112
113 protected:
114   // functions 
115   void                                   ExecOnce();
116   Bool_t                         Run();
117   virtual void           Terminate(Option_t *); 
118   virtual Int_t          AcceptMyJet(AliEmcalJet *jet);   // applies basic jet tests/cuts before accepting
119   virtual Int_t          GetCentBin(Double_t cent) const; // centrality bin of event
120   Double_t               RelativePhi(Double_t mphi,Double_t vphi) const; // relative jet track angle
121   Double_t               RelativeEPJET(Double_t jetAng, Double_t EPAng) const;  // relative jet event plane angle
122   virtual Int_t          GetEtaBin(Double_t eta) const;      // eta bins
123   virtual Int_t          GetpTjetBin(Double_t pt) const;     // jet pt bins
124   virtual Int_t          GetpTtrackBin(Double_t pt) const;   // track pt bins
125   virtual Int_t          GetzVertexBin(Double_t zVtx) const; // zVertex bin
126   void                   SetfHistPIDcounterLabels(TH1* fHistPID) const;  // PID counter
127
128   // parameters of detector to cut on for event
129   Double_t               fPhimin;                  // phi min
130   Double_t               fPhimax;                  // phi max
131   Double_t               fEtamin;                  // eta min
132   Double_t               fEtamax;                  // eta max
133   Double_t               fAreacut;                 // area cut
134   Double_t               fTrkBias;                 // track bias
135   Double_t               fClusBias;                // cluster bias
136   Double_t               fTrkEta;                  // eta min/max of tracks
137   Double_t                   fJetPtcut;                    // jet pt to cut on for correlations
138   Double_t                               fJetRad;                                  // jet radius
139   Double_t                               fConstituentCut;          // jet constituent cut
140
141   // event mixing
142   Int_t                  fDoEventMixing;
143   Int_t                  fMixingTracks;
144
145   // switches for plots
146   Bool_t                 doPlotGlobalRho;
147   Bool_t                 doVariableBinning;
148   Bool_t         dovarbinTHnSparse;
149   Bool_t                 makeQAhistos;
150   Bool_t                 makeBIAShistos;
151   Bool_t                 makeextraCORRhistos; 
152   Bool_t                 makeoldJEThadhistos;
153   Bool_t                 allpidAXIS;
154
155   // Cut type (EMCAL/TPC acceptance)
156   TString        fcutType;
157
158   // switches for PID
159   Bool_t                 doPID;
160   Bool_t                 doPIDtrackBIAS;
161
162   // do comment switch
163   Bool_t                 doComments;
164
165   // local rho value
166   Double_t               fLocalRhoVal;
167
168   // object names
169   TString                fTracksName;
170   TString                fJetsName;
171
172   // event counter
173   Int_t                  event;
174
175   // boolean functions for PID
176   Bool_t                 isPItpc, isKtpc, isPtpc;
177   Bool_t                 isPIits, isKits, isPits;
178   Bool_t                 isPItof, isKtof, isPtof;
179
180   // event pool
181   TObjArray*                CloneAndReduceTrackList(TObjArray* tracks);
182   AliEventPoolManager   *fPoolMgr;  // event pool Manager object
183
184   // PID
185   AliPIDResponse        *fPIDResponse;   // PID response object
186   AliTPCPIDResponse     *fTPCResponse;   // TPC pid response object
187
188  private:
189   // needed for PID, track objects
190   AliESDEvent       *fESD;          // ESD object
191   AliAODEvent       *fAOD;                // AOD object
192
193   TH2F                  *fHistTPCdEdX;//!
194   TH2F                  *fHistITSsignal;//!
195 //  TH2F                    *fHistTOFsignal;//!
196
197   TH2F                  *fHistRhovsCent;//!
198   TH2F                  *fHistNjetvsCent;//! number of jets versus Centrality
199   TH2F                  *fHistJetPtvsTrackPt[6];//!
200   TH2F                  *fHistRawJetPtvsTrackPt[6];//!
201   TH1F                  *fHistTrackPt[6];//!
202   TH1F                  *fHistEP0[6];//!
203   TH1F                  *fHistEP0A[6];//!
204   TH1F                  *fHistEP0C[6];//!
205   TH2F                  *fHistEPAvsC[6];//!
206   TH1F                                  *fHistJetPtcorrGlRho[6];//!
207   TH2F                  *fHistJetPtvsdEP[6];//!
208   TH2F                  *fHistJetPtvsdEPBias[6];//!
209   TH2F                  *fHistRhovsdEP[6];//!
210   TH3F                  *fHistJetEtaPhiPt[6];//!
211   TH3F                  *fHistJetEtaPhiPtBias[6];//!
212   TH2F                  *fHistJetPtArea[6];//!
213   TH2F                  *fHistJetPtAreaBias[6];//!
214   TH2F                  *fHistJetPtNcon[6];//!
215   TH2F                  *fHistJetPtNconBias[6];//!
216   TH2F                  *fHistJetPtNconCh[6];//!
217   TH2F                  *fHistJetPtNconBiasCh[6];//!
218   TH2F                  *fHistJetPtNconEm[6];//!
219   TH2F                  *fHistJetPtNconBiasEm[6];//!
220   TH1F                      *fHistJetHaddPhiINcent[6];//!
221   TH1F                          *fHistJetHaddPhiOUTcent[6];//!
222   TH1F                          *fHistJetHaddPhiMIDcent[6];//!
223
224   TH1                   *fHistCentrality;//!
225   TH1                   *fHistZvtx;//!
226   TH1                   *fHistMult;//!
227   TH1                           *fHistJetPhi;//!
228   TH1                       *fHistTrackPhi;//!
229   TH1                       *fHistJetHaddPhiIN;//!
230   TH1                           *fHistJetHaddPhiOUT;//!
231   TH1                           *fHistJetHaddPhiMID;//!
232   TH1                                   *fHistJetHaddPhiBias;//!
233   TH1                                   *fHistJetHaddPhiINBias;//!
234   TH1                                   *fHistJetHaddPhiOUTBias;//!
235   TH1                                   *fHistJetHaddPhiMIDBias;//!
236
237   TH1                   *fHistMEdPHI;//! // phi distrubtion of mixed events
238   TH1                                   *fHistTrackPtallcent;//!
239
240   TH2                   *fHistJetEtaPhi;//!  
241   TH2                   *fHistTrackEtaPhi[4][7];//!
242   TH1                           *fHistJetHadbindPhi[9];//! 
243   TH1                                   *fHistJetHadbindPhiIN[9];//! 
244   TH1                                   *fHistJetHadbindPhiMID[9];//! 
245   TH1                           *fHistJetHadbindPhiOUT[9];//! 
246   TH2                   *fHistJetHEtaPhi;//!
247
248   TH1                   *fHistJetPt[6];//!
249   TH1                   *fHistJetPtBias[6];//!
250   TH1                   *fHistJetPtTT[6];//!
251   TH2                   *fHistAreavsRawPt[6];//!
252   TH2                   *fHistJetH[6][5][3];//!
253   TH2                   *fHistJetHBias[6][5][3];//!
254   TH2                   *fHistJetHTT[6][5][3];//!
255   TH1F                                  *fHistJetHdPHI[11];//!
256   TH2F                                  *fHistJetHdETAdPHI[11];//!
257   TH2F                  *fHistSEphieta;//! // single events phi-eta distributions
258   TH2F                  *fHistMEphieta;//! // mixed events phi-eta distributions
259   TH1F                                  *fHistJetHaddPHI;//!
260
261   // PID status histo's
262   TH1                                   *fHistPID;//!
263
264   // THn Sparse's
265   THnSparse             *fhnPID;//!          // PID sparse
266   THnSparse             *fhnMixedEvents;//!  // mixed events matrix
267   THnSparse             *fhnJH;//!           // jet hadron events matrix
268   THnSparse                             *fhnCorr;//!              // sparse to get # jet triggers
269
270   // container objects
271   AliJetContainer            *fJetsCont;                   //!Jets
272   AliParticleContainer       *fTracksCont;                 //!Tracks
273   AliClusterContainer        *fCaloClustersCont;           //!Clusters
274
275   // container specifier
276   Int_t                                 fContainerAllJets;  // number of container with all full jets
277   Int_t                                 fContainerPIDJets;  // number of container with full jets meeting Pt cut (for PID)
278
279 // ***********************************************************
280    
281   //Declare it private to avoid compilation warning
282   AliAnalysisTaskEmcalJetHadEPpid(const AliAnalysisTaskEmcalJetHadEPpid & g) ; // cpy ctor
283
284   AliAnalysisTaskEmcalJetHadEPpid& operator=(const AliAnalysisTaskEmcalJetHadEPpid&); // not implemented
285   ClassDef(AliAnalysisTaskEmcalJetHadEPpid, 4); // Emcal jet hadron PID - Event plane dependence
286 };
287 #endif