added streamer fix for header pointers and switch for define IO in constructor
[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   // define I/O
85   void                                    SetIOon(Bool_t IO)                                    { doIOon = IO; } // set on IO in constructor (temp)
86
87   // getters
88   TString                 GetLocalRhoName() const               {return fLocalRhoName; }
89
90   // set names of some objects
91   virtual void            SetLocalRhoName(const char *ln)       { fLocalRhoName = ln; }
92   virtual void            SetTracksName(const char *tn)         { fTracksName = tn; }
93   virtual void            SetJetsName(const char *jn)           { fJetsName = jn; }
94
95   // bias and cuts - setters
96   virtual void            SetAreaCut(Double_t a)                { fAreacut    = a; }
97   virtual void            SetTrkBias(Double_t b)                { fTrkBias    = b; }  //require a track with pt > b in jet
98   virtual void            SetClusBias(Double_t b)               { fClusBias   = b; }  //require a cluster with pt > b in jet
99   virtual void            SetTrkEta(Double_t e)                 { fTrkEta   = e; }  //eta range of the associated tracks
100   virtual void            SetJetPtcut(Double_t jpt)             { fJetPtcut = jpt; } // jet pt cut
101   virtual void                    SetJetRad(Double_t jrad)                              { fJetRad = jrad; } // jet radius 
102   virtual void                    SetConstituentCut(Double_t constCut)  { fConstituentCut = constCut; } // constituent Cut
103
104   // eta and phi limits of jets - setters
105   virtual void            SetJetEta(Double_t emin, Double_t emax)  { fEtamin = emin; fEtamax = emax; }
106   virtual void            SetJetPhi(Double_t pmin, Double_t pmax)  { fPhimin = pmin; fPhimax = pmax; }
107
108   // event mixing - setters
109   virtual void            SetEventMixing(Int_t yesno)              { fDoEventMixing=yesno; }
110   virtual void            SetMixingTracks(Int_t tracks)            { fMixingTracks = tracks; }
111
112   // jet container - setters
113   void SetContainerAllJets(Int_t c)         { fContainerAllJets      = c;}
114   void SetContainerPIDJets(Int_t c)         { fContainerPIDJets      = c;}
115
116 protected:
117   // functions 
118   void                                   ExecOnce();
119   Bool_t                         Run();
120   virtual void           Terminate(Option_t *); 
121   virtual Int_t          AcceptMyJet(AliEmcalJet *jet);   // applies basic jet tests/cuts before accepting
122   virtual Int_t          GetCentBin(Double_t cent) const; // centrality bin of event
123   Double_t               RelativePhi(Double_t mphi,Double_t vphi) const; // relative jet track angle
124   Double_t               RelativeEPJET(Double_t jetAng, Double_t EPAng) const;  // relative jet event plane angle
125   virtual Int_t          GetEtaBin(Double_t eta) const;      // eta bins
126   virtual Int_t          GetpTjetBin(Double_t pt) const;     // jet pt bins
127   virtual Int_t          GetpTtrackBin(Double_t pt) const;   // track pt bins
128   virtual Int_t          GetzVertexBin(Double_t zVtx) const; // zVertex bin
129   void                   SetfHistPIDcounterLabels(TH1* fHistPID) const;  // PID counter
130
131   // parameters of detector to cut on for event
132   Double_t               fPhimin;                  // phi min
133   Double_t               fPhimax;                  // phi max
134   Double_t               fEtamin;                  // eta min
135   Double_t               fEtamax;                  // eta max
136   Double_t               fAreacut;                 // area cut
137   Double_t               fTrkBias;                 // track bias
138   Double_t               fClusBias;                // cluster bias
139   Double_t               fTrkEta;                  // eta min/max of tracks
140   Double_t                   fJetPtcut;                    // jet pt to cut on for correlations
141   Double_t                               fJetRad;                                  // jet radius
142   Double_t                               fConstituentCut;          // jet constituent cut
143
144   // event mixing
145   Int_t                  fDoEventMixing;
146   Int_t                  fMixingTracks;
147
148   // switches for plots
149   Bool_t                 doPlotGlobalRho;
150   Bool_t                 doVariableBinning;
151   Bool_t         dovarbinTHnSparse;
152   Bool_t                 makeQAhistos;
153   Bool_t                 makeBIAShistos;
154   Bool_t                 makeextraCORRhistos; 
155   Bool_t                 makeoldJEThadhistos;
156   Bool_t                 allpidAXIS;
157
158   // Cut type (EMCAL/TPC acceptance)
159   TString        fcutType;
160
161   // switches for PID
162   Bool_t                 doPID;
163   Bool_t                 doPIDtrackBIAS;
164
165   // do comment switch
166   Bool_t                 doComments;
167
168   // do I/O on switch
169   Bool_t                 doIOon;
170
171   // local rho value
172   Double_t               fLocalRhoVal;
173
174   // object names
175   TString                fTracksName;
176   TString                fJetsName;
177
178   // event counter
179   Int_t                  event;
180
181   // boolean functions for PID
182   Bool_t                 isPItpc, isKtpc, isPtpc;
183   Bool_t                 isPIits, isKits, isPits;
184   Bool_t                 isPItof, isKtof, isPtof;
185
186   // event pool
187   TObjArray                 *CloneAndReduceTrackList(TObjArray* tracks);
188   AliEventPoolManager   *fPoolMgr;//!  // event pool Manager object
189
190   // PID
191   AliPIDResponse        *fPIDResponse;   // PID response object
192   AliTPCPIDResponse     *fTPCResponse;   // TPC pid response object
193
194  private:
195   // needed for PID, track objects
196   AliESDEvent       *fESD;//!         // ESD object
197   AliAODEvent       *fAOD;//!             // AOD object
198
199   TH2F                  *fHistTPCdEdX;//!
200   TH2F                  *fHistITSsignal;//!
201 //  TH2F                    *fHistTOFsignal;//!
202
203   TH2F                  *fHistRhovsCent;//!
204   TH2F                  *fHistNjetvsCent;//! number of jets versus Centrality
205   TH2F                  *fHistJetPtvsTrackPt[6];//!
206   TH2F                  *fHistRawJetPtvsTrackPt[6];//!
207   TH1F                  *fHistTrackPt[6];//!
208   TH1F                  *fHistEP0[6];//!
209   TH1F                  *fHistEP0A[6];//!
210   TH1F                  *fHistEP0C[6];//!
211   TH2F                  *fHistEPAvsC[6];//!
212   TH1F                                  *fHistJetPtcorrGlRho[6];//!
213   TH2F                  *fHistJetPtvsdEP[6];//!
214   TH2F                  *fHistJetPtvsdEPBias[6];//!
215   TH2F                  *fHistRhovsdEP[6];//!
216   TH3F                  *fHistJetEtaPhiPt[6];//!
217   TH3F                  *fHistJetEtaPhiPtBias[6];//!
218   TH2F                  *fHistJetPtArea[6];//!
219   TH2F                  *fHistJetPtAreaBias[6];//!
220   TH2F                  *fHistJetPtNcon[6];//!
221   TH2F                  *fHistJetPtNconBias[6];//!
222   TH2F                  *fHistJetPtNconCh[6];//!
223   TH2F                  *fHistJetPtNconBiasCh[6];//!
224   TH2F                  *fHistJetPtNconEm[6];//!
225   TH2F                  *fHistJetPtNconBiasEm[6];//!
226   TH1F                      *fHistJetHaddPhiINcent[6];//!
227   TH1F                          *fHistJetHaddPhiOUTcent[6];//!
228   TH1F                          *fHistJetHaddPhiMIDcent[6];//!
229
230   TH1                   *fHistCentrality;//!
231   TH1                   *fHistZvtx;//!
232   TH1                   *fHistMult;//!
233   TH1                           *fHistJetPhi;//!
234   TH1                       *fHistTrackPhi;//!
235   TH1                       *fHistJetHaddPhiIN;//!
236   TH1                           *fHistJetHaddPhiOUT;//!
237   TH1                           *fHistJetHaddPhiMID;//!
238   TH1                                   *fHistJetHaddPhiBias;//!
239   TH1                                   *fHistJetHaddPhiINBias;//!
240   TH1                                   *fHistJetHaddPhiOUTBias;//!
241   TH1                                   *fHistJetHaddPhiMIDBias;//!
242
243   TH1                   *fHistMEdPHI;//! // phi distrubtion of mixed events
244   TH1                                   *fHistTrackPtallcent;//!
245
246   TH2                   *fHistJetEtaPhi;//!  
247   TH2                   *fHistTrackEtaPhi[4][7];//!
248   TH1                           *fHistJetHadbindPhi[9];//! 
249   TH1                                   *fHistJetHadbindPhiIN[9];//! 
250   TH1                                   *fHistJetHadbindPhiMID[9];//! 
251   TH1                           *fHistJetHadbindPhiOUT[9];//! 
252   TH2                   *fHistJetHEtaPhi;//!
253
254   TH1                   *fHistJetPt[6];//!
255   TH1                   *fHistJetPtBias[6];//!
256   TH1                   *fHistJetPtTT[6];//!
257   TH2                   *fHistAreavsRawPt[6];//!
258   TH2                   *fHistJetH[6][5][3];//!
259   TH2                   *fHistJetHBias[6][5][3];//!
260   TH2                   *fHistJetHTT[6][5][3];//!
261   TH1F                                  *fHistJetHdPHI[11];//!
262   TH2F                                  *fHistJetHdETAdPHI[11];//!
263   TH2F                  *fHistSEphieta;//! // single events phi-eta distributions
264   TH2F                  *fHistMEphieta;//! // mixed events phi-eta distributions
265   TH1F                                  *fHistJetHaddPHI;//!
266
267   // PID status histo's
268   TH1                                   *fHistPID;//!
269
270   // THn Sparse's
271   THnSparse             *fhnPID;//!          // PID sparse
272   THnSparse             *fhnMixedEvents;//!  // mixed events matrix
273   THnSparse             *fhnJH;//!           // jet hadron events matrix
274   THnSparse                             *fhnCorr;//!              // sparse to get # jet triggers
275
276   // container objects
277   AliJetContainer            *fJetsCont;                   //!Jets
278   AliParticleContainer       *fTracksCont;                 //!Tracks
279   AliClusterContainer        *fCaloClustersCont;           //!Clusters
280
281   // container specifier
282   Int_t                                 fContainerAllJets;  // number of container with all full jets
283   Int_t                                 fContainerPIDJets;  // number of container with full jets meeting Pt cut (for PID)
284
285 // ***********************************************************
286    
287   //Declare it private to avoid compilation warning
288   AliAnalysisTaskEmcalJetHadEPpid(const AliAnalysisTaskEmcalJetHadEPpid & g) ; // cpy ctor
289
290   AliAnalysisTaskEmcalJetHadEPpid& operator=(const AliAnalysisTaskEmcalJetHadEPpid&); // not implemented
291   ClassDef(AliAnalysisTaskEmcalJetHadEPpid, 4); // Emcal jet hadron PID - Event plane dependence
292 };
293 #endif