Fix for coverity (AdC)
[u/mrichter/AliRoot.git] / PWGJE / AliAnalysisTaskJetCorePP.h
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7// **************************************
8// This task performs hadron-trigger recoil jet correlations
9// Output pT spectrum of jet given trigger pT
8e103a56 10// Author: filip krizek 16th March 2013
ad869500 11// *******************************************
13class TH1F;
14class TH1D;
15class TH1I;
16class TH2F;
17class TH3F;
80ac66f6 18class TList;
49dc2855 19class TClonesArray;
ad869500 20class THnSparse;
8e103a56 21class TRandom3;
80ac66f6 22class TArrayI;
ea603b64 23class TProfile;
24class TFile;
25class TKey;
ad869500 26class AliESDEvent;
27class AliAODExtension;
28class AliAODEvent;
ea603b64 29class AliGenPythiaEventHeader;
49dc2855 30class AliMCEvent; //FK//
31class AliMCEventHandler; //FK//
32class AliGenEventHeader; //FK//
ad869500 33
34#include "AliAnalysisTaskSE.h"
35#include "AliVEvent.h"
37class AliAnalysisTaskJetCorePP : public AliAnalysisTaskSE {
39 AliAnalysisTaskJetCorePP();
40 AliAnalysisTaskJetCorePP(const char *name);
41 AliAnalysisTaskJetCorePP(const AliAnalysisTaskJetCorePP& a);
42 AliAnalysisTaskJetCorePP& operator=(const AliAnalysisTaskJetCorePP& a); // not implemented
43 virtual ~AliAnalysisTaskJetCorePP();
44 virtual void LocalInit() {Init();}
45 virtual void Init();
46 virtual void UserCreateOutputObjects();
47 virtual void UserExec(Option_t *option);
48 virtual void Terminate(const Option_t*);
ea603b64 49 virtual Bool_t Notify();
ad869500 50
51 virtual void SetBranchName(const TString &name){ fJetBranchName = name; }
255cb71c 52 virtual void SetBranchNameChargMC(const TString &name){ fJetBranchNameChargMC = name; }
49dc2855 53 virtual void SetBranchNameKine(const TString &name){ fJetBranchNameKine = name; }
255cb71c 54 virtual void SetBranchNameFullMC(const TString &name){ fJetBranchNameFullMC = name; }
55 virtual void SetBranchNameBg(const TString &name){ fJetBranchNameBg = name; }
56 virtual void SetBranchNameBgChargMC(const TString &name){ fJetBranchNameBgChargMC = name; }
49dc2855 57 virtual void SetBranchNameBgKine(const TString &name){ fJetBranchNameBgKine = name; }
ad869500 58 virtual void SetNonStdFile(char* c){fNonStdFile = c;}
59 virtual void SetSystem(Int_t sys) { fSystem = sys; }
60 virtual void SetJetR(Float_t jR) { fJetParamR = jR; }
8aa19603 61 virtual void SetBgJetR(Float_t bgjR) { fBgJetParamR = bgjR; }
62 virtual void SetBgMaxJetPt(Float_t mpt){ fBgMaxJetPt = mpt;}
63 virtual void SetRndTrials(Int_t nt){ fnTrials = nt;}
64 virtual void SetFreeAreaFrac(Float_t frac){ fJetFreeAreaFrac = frac;}
8aa19603 65 virtual void SetBgConeR(Float_t cr){ fBgConeR = cr; }
ad869500 66 virtual void SetOfflineTrgMask(AliVEvent::EOfflineTriggerTypes mask) { fOfflineTrgMask = mask; }
67 virtual void SetMinContribVtx(Int_t n) { fMinContribVtx = n; }
68 virtual void SetVtxZMin(Float_t z) { fVtxZMin = z; }
69 virtual void SetVtxZMax(Float_t z) { fVtxZMax = z; }
70 virtual void SetFilterMask(UInt_t i){fFilterMask = i;}
71 virtual void SetCentMin(Float_t cent) { fCentMin = cent; }
72 virtual void SetCentMax(Float_t cent) { fCentMax = cent; }
73 virtual void SetJetEtaMin(Float_t eta) { fJetEtaMin = eta; }
74 virtual void SetJetEtaMax(Float_t eta) { fJetEtaMax = eta; }
75 virtual void SetTriggerEtaCut(Float_t eta) { fTriggerEtaCut = eta; }
76 virtual void SetTrackEtaCut(Float_t eta) { fTrackEtaCut = eta; }
77 virtual void SetTrackLowPtCut(Float_t pt) { fTrackLowPtCut=pt; }
8e103a56 78 virtual void SetTriggerType(Int_t tt){ fHardest=tt;}
79 virtual void SetEventNumberRangeLow(Int_t rl){ fEventNumberRangeLow=rl;}
80 virtual void SetEventNumberRangeHigh(Int_t rh){ fEventNumberRangeHigh=rh;}
81 virtual void SetTriggerPtRangeLow(Float_t tl){ fTriggerPtRangeLow=tl;}
82 virtual void SetTriggerPtRangeHigh(Float_t th){ fTriggerPtRangeHigh=th;}
8aa19603 83 virtual void SetFillResponseMatrix(Bool_t brm){ fFillRespMx = brm;}
49dc2855 84 virtual void SetBinning(Bool_t bbb) { fDoubleBinning = bbb; }
85 virtual void SetUseExchangeContainerInput(Bool_t b){ fUseExchContainer = b;}
ad869500 86
87 Double_t RelativePhi(Double_t angle1, Double_t angle2);
90 //private member functions
8aa19603 91 Int_t GetListOfTracks(TList *list); //returns index of trig and track list
80ac66f6 93 Bool_t SelectMCGenTracks(AliVParticle *trk, TList *trkList, Double_t &ptLeading, Int_t &index, Int_t counter);
94 void FillEffHistos(TList *recList, TList *genList);
8aa19603 95
d1405a52 96 void EstimateBgRhoMedian(TList *listJet, TList* listPart, Double_t &rhoMedian, Int_t mode);//median method to estimate bg
8aa19603 97 void EstimateBgCone(TList *listJet, TList* listPart, Double_t &rhoPerpCone);//perp cone method to estimate bg
255cb71c 98 void ReadTClonesArray(TString bname, TList *list); //init jets lists
ad869500 99 //private member objects
100 AliESDEvent *fESD; //! ESD object
101 AliAODEvent *fAODIn; //! AOD event for AOD input tracks
102 AliAODEvent *fAODOut; //! AOD event
103 AliAODExtension *fAODExtension; //! where we take the jets from can be input or output AOD
49dc2855 104 AliMCEvent *fMcEvent; //! MC event
105 AliInputEventHandler *fMcHandler; //! MCEventHandler
ad869500 107
108 // jets to compare
109 TString fJetBranchName; // name of jet branch
49dc2855 110 TString fJetBranchNameChargMC; // name of jet branch output AOD
111 TString fJetBranchNameKine; // name of jet branch kine
255cb71c 112 TString fJetBranchNameFullMC; // name of jet branch
113 TString fJetBranchNameBg; // name of bg (kt) jet branch
114 TString fJetBranchNameBgChargMC; // name of bg (kT) jet branch
49dc2855 115 TString fJetBranchNameBgKine; // name of bg (kT) jet branch
80ac66f6 116 TList *fListJets; //! jet list reconstructed level
255cb71c 117 TList *fListJetsGen; //! jet list generator level
160dbdb8 118 TList *fListJetsGenFull; //! jet list generator level full jets
8aa19603 119 TList *fListJetsBg; //! jet list reconstructed level to be removed from bg
120 TList *fListJetsBgGen; //! jet list generator level to be removed from bg
255cb71c 121
ad869500 122
123 TString fNonStdFile; // name of delta aod file to catch the extension
125 // event selection
126 Int_t fSystem; // collision system pp=0, pPb=1
127 Float_t fJetParamR; // jet cone resolution (radius) R
8aa19603 128 Float_t fBgJetParamR; // jet cone resolution (radius) R of jet to be removed from bg
129 Float_t fBgMaxJetPt; // max pt of jets accepted in bg
130 Float_t fBgConeR; //perp cone R used to assess bg
ad869500 131 AliVEvent::EOfflineTriggerTypes fOfflineTrgMask; // mask of offline trigs
132 Int_t fMinContribVtx; // min numb of trk contrib for prim vertex
133 Float_t fVtxZMin; // lower bound on vertex z
134 Float_t fVtxZMax; // upper bound on vertex z
135 UInt_t fFilterMask; // filter bit for slected tracks
136 Float_t fCentMin; // lower bound on centrality
137 Float_t fCentMax; // upper bound on centrality
138 Float_t fJetEtaMin; // lower bound on eta for found jets
139 Float_t fJetEtaMax; // upper bound on eta for found jets
140 Float_t fTriggerEtaCut; // lower bound on eta for trigger track
141 Float_t fTrackEtaCut; // upper bound on eta for trigger track
142 Float_t fTrackLowPtCut; // upper bound on eta for trigger track
49dc2855 143 Bool_t fUseExchContainer; //use exhange container
ad869500 144
145 TList *fOutputList; //! output data container
146 TH1I *fHistEvtSelection; //! event selection statistic
147 TH2F *fh2Ntriggers; //trigger pT versus centrality
148 THnSparse *fHJetSpec; //Recoil jet spectrum
255cb71c 149 THnSparse *fHJetSpecSubUeMedian; //Recoil jet spectrum, jet pT corrected by kT median
8aa19603 150 THnSparse *fHJetSpecSubUeCone; //Recoil jet spectrum, jet pT corrected by perp cone rho
ad869500 151
49dc2855 152 THnSparse *fHJetPhiCorr; // Dphi distribution jet-triger
153 THnSparse *fHJetPhiCorrSubUeMedian; // Dphi distribution jet-triger
154 THnSparse *fHJetPhiCorrSubUeCone; // Dphi distribution jet-triger
ad869500 156 //Diagnostics
255cb71c 157 THnSparse *fHJetUeMedian; //UE background from kT median
8aa19603 158 THnSparse *fHJetUeCone; //UE background from perp cone
159 THnSparse *fHRhoUeMedianVsCone; //EBE UE from perp cone
255cb71c 160 //THnSparse *fHJetDensity; //density of jet with A>0.07 //fk
161 //THnSparse *fHJetDensityA4; //density of jets with A>0.4 //fk
7fc3d134 162 TH2D *fhJetPhi; //Azimuthal distribution of jets
163 TH2D *fhTriggerPhi; //Azimuthal distribution of trigger hadron
164 TH2D *fhJetEta; //Pseudorapidity distribution of jets
165 TH2D *fhTriggerEta; //Pseudorapidity distribution of trigger hadron
ad869500 166 TH1D *fhVertexZ; //z vertex distribution
167 TH1D *fhVertexZAccept; //z vertex distribution after cut
168 TH1D *fhContribVtx; //contributors to vertex
169 TH1D *fhContribVtxAccept; //contributors to vertex after cut
170 TH1D *fhDphiTriggerJet; //Deltaphi between trigger and jet
171 TH1D *fhDphiTriggerJetAccept; //Deltaphi between trigger and jet after cut
172 TH1D *fhCentrality; //Deltaphi between trigger and jet
173 TH1D *fhCentralityAccept; //Deltaphi between trigger and jet after cut
255cb71c 175 //THnSparse *fHJetPtRaw; //bg unsubtr. vs bg subtr. pT spectrum of jets vs jet area
176 //THnSparse *fHLeadingJetPtRaw; //bg unsubtr. vs bg. subtr. leading jet pT vs area
177 //THnSparse *fHDphiVsJetPtAll; //Dphitrigger-jet versus jet pt for all jets given pTtrigg
7fc3d134 178
80ac66f6 179 //MC generator level
180 TH2D *fhJetPtGenVsJetPtRec; //jet respose matrix
255cb71c 181 TH2D *fhJetPtGenVsJetPtRecSubUeMedian; //jet respose matrix both pT with subtracted kT median bg
8aa19603 182 TH2D *fhJetPtGenVsJetPtRecSubUeCone; //jet respose matrix both pT with subtracted weighted kT median bg
255cb71c 183 TH1D *fhJetPtGen; //generated pT spectrum of jets
184 TH1D *fhJetPtSubUeMedianGen; //generated pT spectrum of jets with subtracted kT median
8aa19603 185 TH1D *fhJetPtSubUeConeGen; //generated pT spectrum of jets with perp cone
160dbdb8 186 TH2D *fhJetPtGenChargVsJetPtGenFull; //generated pT spectrum of full jets
187 TH1D *fhJetPtGenFull; // generated pT spectrum of full jets
80ac66f6 188 TH2F *fh2NtriggersGen; //trigger pT versus centrality in generator level
255cb71c 189 THnSparse *fHJetSpecGen; //Recoil jet spectrum at generator level
190 THnSparse *fHJetSpecSubUeMedianGen; //Recoil jet spectrum at gen level, jet pT corrected by kT median
8aa19603 191 THnSparse *fHJetSpecSubUeConeGen; //Recoil jet spectrum at gen level, jet pT corrected with rho from cone
49dc2855 192 THnSparse *fHJetPhiCorrGen; // Dphi distribution jet-triger
193 THnSparse *fHJetPhiCorrSubUeMedianGen; // Dphi distribution jet-triger
194 THnSparse *fHJetPhiCorrSubUeConeGen; // Dphi distribution jet-triger
255cb71c 195 THnSparse *fHJetUeMedianGen; //UE background from kT median
8aa19603 196 THnSparse *fHJetUeConeGen; //UE background from Perp Cone
80ac66f6 197 TH2D *fhPtTrkTruePrimRec; // pt spectrum of true reconstructed primary tracks
198 TH2D *fhPtTrkTruePrimGen; // pt spectrum of true generated primary track
199 TH2D *fhPtTrkSecOrFakeRec; // pt spectrum of reconstructed fake or secondary tracks
8aa19603 200 THnSparse *fHRhoUeMedianVsConeGen; //EBE UE from Median vs Perp Cone generator level
202 TH1D *fhEntriesToMedian; //how many entries were used to calculate
203 TH1D *fhEntriesToMedianGen; //how many entries were used to calculate in MC
204 TH1D *fhCellAreaToMedian; //how many entries were used to calculate
205 TH1D *fhCellAreaToMedianGen; //how many entries were used to calculate in MC
49dc2855 208 Bool_t fIsChargedMC; //flag analysis on MC data with true and on the real+kine data false
209 Bool_t fIsKine; //flag analysis on kine data with true and on the real+MC data false
210 Bool_t fIsFullMC; //flag analysis on MC data with true and on the real+kine data false
80ac66f6 211 TArrayI faGenIndex; // labels of particles on MC generator level
212 TArrayI faRecIndex; // labels of particles on reconstructed track level
ad869500 213 const Double_t fkAcceptance; //eta times phi Alice coverage
80ac66f6 214 const Double_t fkDeltaPhiCut; //Delta phi cut on trigger-jet distance in azimuth
ea603b64 215
216 TProfile* fh1Xsec; //! pythia cross section and trials
217 TH1F* fh1Trials; //! trials are added
218 TH1F* fh1AvgTrials; //! trials are added
219 TH1F* fh1PtHard; //! Pt har of the event...
220 TH1F* fh1PtHardNoW; //! Pt har of the event without weigt
221 TH1F* fh1PtHardTrials; //! Number of trials
222 Float_t fAvgTrials; // Average number of trials
8e103a56 224
225 Int_t fHardest; // trigger type 0=single incl, 1=LP
226 Int_t fEventNumberRangeLow; // lower range of selected event numbers
227 Int_t fEventNumberRangeHigh; // high range of selected event numbers
228 Float_t fTriggerPtRangeLow; // lower range of selected trigger pt
229 Float_t fTriggerPtRangeHigh; // upper range of selected trigger pt
8aa19603 231 Bool_t fFillRespMx; //fill response matrix files
8e103a56 233
8aa19603 234 TRandom3* fRandom; // TRandom3
235 Int_t fnTrials; //number of random trials to measure cell area
236 Float_t fJetFreeAreaFrac; //fraction of area in cell free of jets
8aa19603 237 const Int_t fnPhi; //number of cells in phi
238 const Int_t fnEta; //number of cells in eta
239 const Double_t fEtaSize; //cell size in eta
240 const Double_t fPhiSize; //cell size in phi
241 const Double_t fCellArea; //cell area
242 Double_t fSafetyMargin; //enlarge a bit the jet size to avoid contamination of UE
49dc2855 244 Bool_t fDoubleBinning; //0=use 2 GeV/c bins ; 1= use 1 GeV/c bins
246 ClassDef(AliAnalysisTaskJetCorePP, 12); //has to end with number larger than 0
ad869500 247};