move EMCALJetTasks from PWGGA to PWGJE
[u/mrichter/AliRoot.git] / PWGJE / AliAnalysisTaskJetSpectrum2.h
CommitLineData
b99018c6 1
3b7ffecf 2#ifndef ALIANALYSISTASKJETSPECTRUM2_H
3#define ALIANALYSISTASKJETSPECTRUM2_H
4
5/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * See cxx source for full Copyright notice */
7
8// **************************************
9// Task used for the correction of determiantion of reconstructed jet spectra
10// Compares input (gen) and output (rec) jets
11// *******************************************
12
13#include "AliAnalysisTaskSE.h"
14#include "THnSparse.h" // cannot forward declare ThnSparseF
15
16////////////////
17class AliJetHeader;
18class AliESDEvent;
19class AliAODEvent;
a31b8a87 20class AliAODExtension;
3b7ffecf 21class AliAODJet;
d7117cbd 22class AliVParticle;
c2785065 23class AliAODJetEventBackground;
3b7ffecf 24class AliGenPythiaEventHeader;
25class AliCFManager;
152a0744 26class AliCFContainer;
b99018c6 27class AliTHn;
3b7ffecf 28
29class TList;
30class TChain;
c2785065 31class TH1F;
3b7ffecf 32class TH2F;
33class TH3F;
742ee86c 34class TRandom3;
3b7ffecf 35class TProfile;
2eded560 36class TProfile2D;
b1cd90b5 37class TSTring;
3b7ffecf 38
39
40class AliAnalysisTaskJetSpectrum2 : public AliAnalysisTaskSE
41{
42 public:
43 AliAnalysisTaskJetSpectrum2();
44 AliAnalysisTaskJetSpectrum2(const char* name);
3d1dba29 45 virtual ~AliAnalysisTaskJetSpectrum2();
3b7ffecf 46 // Implementation of interface methods
47 virtual void UserCreateOutputObjects();
48 virtual void Init();
49 virtual void LocalInit() { Init(); }
50 virtual void UserExec(Option_t *option);
51 virtual void Terminate(Option_t *option);
52 virtual Bool_t Notify();
53
b5cc0c6d 54 virtual void SetUseGlobalSelection(Bool_t b){fUseGlobalSelection = b;}
f4132e7d 55 virtual void SetEventClass(Int_t i){fEventClass = i;}
3b7ffecf 56 virtual void SetExternalWeight(Float_t f){fExternalWeight = f;}
57 virtual void SetUseExternalWeightOnly(Bool_t b){fUseExternalWeightOnly = b;}
565584e8 58 virtual void SetAODJetInput(Bool_t b){fUseAODJetInput = b;}
59 virtual void SetAODTrackInput(Bool_t b){fUseAODTrackInput = b;}
60 virtual void SetAODMCInput(Bool_t b){fUseAODMCInput = b;}
3b7ffecf 61 virtual void SetLimitGenJetEta(Bool_t b){fLimitGenJetEta = b;}
a31b8a87 62 virtual void SetJetEtaWindow(Float_t f){fJetRecEtaWindow = f;}
63 virtual void SetTrackEtaWindow(Float_t f){fTrackRecEtaWindow = f;}
64 virtual void SetNMatchJets(Short_t f){fNMatchJets = f;}
9280dfa6 65 virtual void SetMinJetPt(Float_t f){fMinJetPt = f;}
7b822bc5 66 virtual void SetNRPBins(Short_t i){fNRPBins = i;}
85b5b73e 67 virtual void SetNMultBins(Short_t i) {fNBinsMult=i;}
68 virtual void SetNPtLeadingBins(Short_t i) {fNBinsLeadingTrackPt=i;}
742ee86c 69 virtual void SetFlagJetType(Int_t iType,Int_t iF){fFlagJetType[iType] = iF;}
a31b8a87 70 virtual void SetMinTrackPt(Float_t f){fMinTrackPt = f;}
9280dfa6 71 virtual void SetDeltaPhiWindow(Float_t f){fDeltaPhiWindow = f;}
3b7ffecf 72 virtual void SetAnalysisType(Int_t i){fAnalysisType = i;}
73 virtual void SetBranchGen(const char* c){fBranchGen = c;}
74 virtual void SetBranchRec(const char* c){fBranchRec = c;}
37eb26ea 75 virtual void SetBranchBkgRec(const char* c){fBranchBkgRec = c;}
76 virtual void SetBranchBkgGen(const char* c){fBranchBkgGen = c;}
3b7ffecf 77 virtual void SetTrackTypeGen(Int_t i){fTrackTypeGen = i;}
78 virtual void SetTrackTypeRec(Int_t i){fTrackTypeRec = i;}
79 virtual void SetFilterMask(UInt_t i){fFilterMask = i;}
d7396b04 80 virtual void SetJetTriggerExclude(UInt_t i){fJetTriggerExcludeMask = i;}
81 virtual void SetJetTriggerBest(UInt_t i){fJetTriggerBestMask = i;}
9fd4cc3e 82 virtual void SetMatching(Bool_t b = kTRUE){fDoMatching = b;}
2eded560 83 virtual void SetRPMethod(Int_t i){fRPMethod = i;}
f2dd0695 84 virtual void SetEventSelectionMask(UInt_t i){fEventSelectionMask = i;}
2eded560 85
a31b8a87 86 virtual void SetNonStdFile(char* c){fNonStdFile = c;}
3b7ffecf 87
3d1dba29 88 virtual void SetNTrigger(Int_t n);
89 virtual void SetTrigger(Int_t i,UInt_t it,const char* c = "");
90
3b7ffecf 91
db745d29 92 virtual void SetNAcceptance(Int_t n);
93 virtual void SetAcceptance(Int_t i,Float_t phiMin,Float_t phiMax,Float_t etaMin,Float_t etaMax);// non overlapping regions
94 virtual Int_t CheckAcceptance(Float_t phi,Float_t eta);
3b7ffecf 95 // Helper
96 //
97
98 // we have different cases
99 // AOD reading -> MC from AOD
100 // ESD reading -> MC from Kinematics
101 // this has to match with our selection of input events
565584e8 102 enum {kTrackUndef = 0, kTrackAOD, kTrackKineAll,kTrackKineCharged, kTrackAODMCAll, kTrackAODMCCharged, kTrackAODMCChargedAcceptance};
3b7ffecf 103 enum {kAnaMC = 0x1, kAnaMCESD = 0x2};
3170a3f8 104 enum {kMaxJets = 2};
a2522483 105 enum {kJetRec = 0, kJetGen, kJetRecFull, kJetGenFull, kJetTypes}; //
3b7ffecf 106 enum {kMaxCorrelation = 3};
107
108 //
152a0744 109 // Stored as function of generated values
110 // 0 all gen jets
111 // 1 all gen jets in eta window
112 // 2 all gen jets with rec partner
113 // 3 all gen jets in eta window with rec partner
114 // 4 all gen jets in eta window with rec partner in eta window
115 // 5 all gen jets in eta window with rec partner in eta window with leading track on reconstructed level
116 // 6 all rec jets in eta window with gen partner
117
118 // Stored as function of reconstructed values:
119 // 7 all rec jets in eta window
120
121
122 enum {kStep0 = 0, kStep1, kStep2, kStep3, kStep4, kStep5, kStep6, kStep7,kMaxStep};
3b7ffecf 123
124
125 private:
126
127 AliAnalysisTaskJetSpectrum2(const AliAnalysisTaskJetSpectrum2&);
128 AliAnalysisTaskJetSpectrum2& operator=(const AliAnalysisTaskJetSpectrum2&);
129
a31b8a87 130 void MakeJetContainer();
131 Int_t GetListOfTracks(TList *list,Int_t type);
132 void FillTrackHistos(TList &particlesList,int iType);
742ee86c 133 Float_t GetCentrality();
134 Bool_t CalculateReactionPlaneAngle(const TList *trackList);
135 Int_t GetPhiBin(Double_t phi);
c08c3ad2 136 Double_t GetPhiWeight(Double_t phi,Double_t signedpt);
a31b8a87 137 Int_t GetListOfJets(TList *list,TClonesArray* jarray,Int_t type);
138 void FillJetHistos(TList &jetsList,TList &particlesList,Int_t iType);
139
140 void FillMatchHistos(TList &recJetsList,TList &genJetsList);
141
142 Bool_t JetSelected(AliAODJet *jet);
37eb26ea 143 Int_t MultFromJetRefs(TClonesArray *jets);
d7117cbd 144 AliVParticle *LeadingTrackFromJetRefs(AliAODJet* jet);
145 AliVParticle *LeadingTrackInCone(AliAODJet* jet,TList *list,Float_t r = 0.4);
146
37eb26ea 147
3493c3a9 148 AliJetHeader *fJetHeaderRec;//! The jet header that can be fetched from the userinfo
149 AliJetHeader *fJetHeaderGen;//! The jet header that can fetched from the userinfo
a31b8a87 150 AliAODEvent *fAODIn; //! where we take the jets from
151 AliAODEvent *fAODOut; //! where we take the jets from
152 AliAODExtension *fAODExtension; //! where we take the jets from can be input or output AOD
152a0744 153
154 AliCFContainer *fhnJetContainer; //! like particle container in corrfw with different steps need AliCFContainer with Scale(), and clone() to do the same
155 THnSparse *fhnCorrelation; //! response matrix for unfolding
156 THnSparseF *fhnEvent; //! event counts
157 TF1 *f1PtScale; //! correction function to correct to the average true jet energy depending on p_T,rec
3b7ffecf 158
159 TString fBranchRec; // AOD branch name for reconstructed
160 TString fBranchGen; // AOD brnach for genereated
37eb26ea 161 TString fBranchBkgRec; //AOD branch for background
162 TString fBranchBkgGen; //AOD branch for background
a31b8a87 163 TString fNonStdFile; // name of delta aod file to catch the extension
3b7ffecf 164
742ee86c 165 TRandom3* fRandomizer; //! randomizer
166
565584e8 167 Bool_t fUseAODJetInput; // take jet from input AOD not from ouptu AOD
168 Bool_t fUseAODTrackInput; // take track from input AOD not from ouptu AOD
169 Bool_t fUseAODMCInput; // take MC from input AOD not from ouptu AOD
b5cc0c6d 170 Bool_t fUseGlobalSelection; // Limit the eta of the generated jets
3b7ffecf 171 Bool_t fUseExternalWeightOnly; // use only external weight
172 Bool_t fLimitGenJetEta; // Limit the eta of the generated jets
b99018c6 173 Bool_t fDoMatching; // switch on the matching between rec and gen
a31b8a87 174 Short_t fNMatchJets; // number of leading jets considered from the list
7b822bc5 175 Short_t fNRPBins; // number of bins with respect to RP
d7396b04 176 UInt_t fJetTriggerExcludeMask; // mask for jet triggers to exclude
177 UInt_t fJetTriggerBestMask; // mask for best jet triggers
f2dd0695 178 UInt_t fFilterMask; // filter bit for slecected tracks
179 UInt_t fEventSelectionMask; // Selection information used to filter events
3d1dba29 180 Int_t fNTrigger; // number of triggers for selection
181 UInt_t *fTriggerBit; //[fNTrigger] trigger bits
db745d29 182 Int_t fNAcceptance; // number of triggers for selection
85b5b73e 183 Short_t fNBinsLeadingTrackPt; // number of bins leading track pt in sparse. Two options: 1 or 10
184 Short_t fNBinsMult; // number of bins in multiplicity in sparse
3b7ffecf 185 Int_t fAnalysisType; // Analysis type
186 Int_t fTrackTypeRec; // type of tracks used for FF
187 Int_t fTrackTypeGen; // type of tracks used for FF
742ee86c 188 Int_t fFlagJetType[kJetTypes]; // disable the filling and booking of certain JetType histos
f4132e7d 189 Int_t fEventClass; // event class to be looked at for this instance of the task
2eded560 190 Int_t fRPMethod; // method for subevent calculation
3b7ffecf 191 Float_t fAvgTrials; // Average nimber of trials
192 Float_t fExternalWeight; // external weight
a31b8a87 193 Float_t fJetRecEtaWindow; // eta window for rec jets
194 Float_t fTrackRecEtaWindow; // eta window for rec tracks
9280dfa6 195 Float_t fMinJetPt; // limits the jet p_T in addition to what already is done in the jet finder, this is important for jet matching for JF with lo threshold
a31b8a87 196 Float_t fMinTrackPt; // limits the track p_T
26fa06fb 197 Float_t fDeltaPhiWindow; // minium angle between dijets
db745d29 198 Float_t *fAcceptancePhiMin; //[fNAcceptance] minimum phi
199 Float_t *fAcceptancePhiMax; //[fNAcceptance] maximum phi
200 Float_t *fAcceptanceEtaMin; //[fNAcceptance] minimum eta
201 Float_t *fAcceptanceEtaMax; //[fNAcceptance] maximum eta
742ee86c 202 Float_t fCentrality; // ! centrality
203 Float_t fRPAngle; // ! RP angle of the reaction plane
37eb26ea 204 Int_t fMultRec; // ! reconstructed track multiplicity
205 Int_t fMultGen; // ! generated track multiplicity
3d1dba29 206 TString *fTriggerName; //[fNTrigger] array of trigger names
3b7ffecf 207
3493c3a9 208 TProfile* fh1Xsec; //! pythia cross section and trials
209 TH1F* fh1Trials; //! trials are added
432abb2b 210 TH1F* fh1AvgTrials; //! trials are added
3493c3a9 211 TH1F* fh1PtHard; //! Pt har of the event...
212 TH1F* fh1PtHardNoW; //! Pt har of the event without weigt
213 TH1F* fh1PtHardTrials; //! Number of trials
57ca1193 214 TH1F* fh1ZVtx; //! z-vtx distribution
7b822bc5 215 TH1F* fh1RP; //! RP distribution
742ee86c 216 TH1F* fh1Centrality; //! centrality distribution
37eb26ea 217 TH1F* fh1TmpRho; //! just temporary histo for calculation
218 TH2F* fh2MultRec; //! reconstructed track multiplicity
219 TH2F* fh2MultGen; //! generated track multiplicity
742ee86c 220 TH2F* fh2RPCentrality; //! RP vs centrality
37eb26ea 221
a31b8a87 222 TH2F* fh2PtFGen; //! found vs generated
3493c3a9 223 TH2F* fh2RelPtFGen; //! relative difference between generated and found
742ee86c 224
37eb26ea 225
9a83d4af 226
a31b8a87 227 // Jet histos second go
228
229 TH1F* fh1NJets[kJetTypes]; //! nr of gen jets
230 TH1F* fh1SumPtTrack[kJetTypes]; //! sum over all track pT
231
37eb26ea 232 TH1F* fh1PtIn[kJetTypes][kMaxJets+1]; //! Jet pt
3170a3f8 233 TH1F* fh1PtJetsIn[kJetTypes]; //! Jet pt for all jets
65c43de8 234 TH1F* fh1PtJetsInRej[kJetTypes]; //! Jet pt for all rejected jets
d7396b04 235 TH1F* fh1PtJetsInBest[kJetTypes]; //! Jet pt for all rejected jets
3170a3f8 236 TH1F* fh1PtTracksIn[kJetTypes]; //! track pt for all tracks
cb883243 237 TH1F* fh1PtTracksInLow[kJetTypes]; //! track pt for all tracks
a31b8a87 238
239 TH2F* fh2NJetsPt[kJetTypes]; //! Number of found jets above threshold
a2522483 240 TH2F* fh2NTracksPt[kJetTypes]; //! Number of tracks above threshold
2eded560 241 TProfile2D *fp2MultRPPhiTrackPt[kJetTypes]; //! for mean pT vs RP
242 TProfile2D *fp2CentRPPhiTrackPt[kJetTypes]; //! for mean pT vs RP
90a006c2 243 THnSparseF *fhnJetPt[kJetTypes]; //! jet pt information for analysis
17f4943e 244 THnSparseF *fhnJetPtBest[kJetTypes]; //! best jet for analysis
245 THnSparseF *fhnJetPtRej[kJetTypes]; //! Rej jet for analysis
90a006c2 246 THnSparseF *fhnJetPtQA[kJetTypes]; //! jet pt information for QA
247 THnSparseF *fhnTrackPt[kJetTypes]; //! track pt information for analysis
248 THnSparseF *fhnTrackPtQA[kJetTypes]; //! track pt information for analysis
7b822bc5 249
d7117cbd 250 TH2F* fh2LTrackPtJetPt[kJetTypes][kMaxJets+1]; //! leading track within the jet vs jet pt
a31b8a87 251
252 TH1F* fh1DijetMinv[kJetTypes]; //! dijet inv mass
253 TH2F* fh2DijetDeltaPhiPt[kJetTypes]; //! dijet delta phi vs pt
254 TH2F* fh2DijetAsymPt[kJetTypes]; //! dijet asym vs pt after delta phi cut
255 TH2F* fh2DijetPt2vsPt1[kJetTypes]; //! dijet pt2 vs pt1
256 TH2F* fh2DijetDifvsSum[kJetTypes]; //! dijet dif vs sum
257
7b822bc5 258
f4132e7d 259 TList *fHistList; //! Output list
3b7ffecf 260
261
432abb2b 262 ClassDef(AliAnalysisTaskJetSpectrum2, 23); // Analysis task for standard jet analysis
3b7ffecf 263};
264
265#endif