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