Protections for coverity: DIVIDE_BY_ZERO
[u/mrichter/AliRoot.git] / JETAN / AliAnalysisTaskJetCluster.h
CommitLineData
dbf053f0 1#ifndef ALIANALYSISTASKJETCLUSTER_H
2#define ALIANALYSISTASKJETCLUSTER_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7// **************************************
f840d64c 8// task used for comparing different jets D parmaters from fastjet
dbf053f0 9// *******************************************
10
11#include "AliAnalysisTaskSE.h"
12#include "THnSparse.h" // cannot forward declare ThnSparseF
13#include "fastjet/ClusterSequenceArea.hh"
14#include "fastjet/AreaDefinition.hh"
15#include "fastjet/JetDefinition.hh"
16#include "fastjet/PseudoJet.hh"
17
18////////////////
19class AliJetHeader;
20class AliESDEvent;
21class AliAODEvent;
54424110 22class AliAODExtension;
dbf053f0 23class AliAODJet;
24class AliGenPythiaEventHeader;
25class AliCFManager;
d6e66a82 26class AliAODJetEventBackground;
27class AliJetFinder;
dbf053f0 28class TList;
29class TChain;
30class TH2F;
31class TH1F;
32class TH3F;
33class TProfile;
d7ca0e14 34class TRandom3;
54424110 35class TRefArray;
8f85b773 36class TClonesArray;
006b2a30 37class TF1;
dbf053f0 38
39class AliAnalysisTaskJetCluster : public AliAnalysisTaskSE
40{
41 public:
42 AliAnalysisTaskJetCluster();
43 AliAnalysisTaskJetCluster(const char* name);
54424110 44 virtual ~AliAnalysisTaskJetCluster();
dbf053f0 45 // Implementation of interface methods
46 virtual void UserCreateOutputObjects();
47 virtual void Init();
48 virtual void LocalInit() { Init(); }
49 virtual void UserExec(Option_t *option);
50 virtual void Terminate(Option_t *option);
51 virtual Bool_t Notify();
52
d6e66a82 53
54
dbf053f0 55 virtual void SetAODTrackInput(Bool_t b){fUseAODTrackInput = b;}
56 virtual void SetAODMCInput(Bool_t b){fUseAODMCInput = b;}
ca6d12f9 57 virtual void SetEventSelection(Bool_t b){fEventSelection = b;}
dbf053f0 58 virtual void SetRecEtaWindow(Float_t f){fRecEtaWindow = f;}
8a320ab9 59 virtual void SetTrackEtaWindow(Float_t f){fTrackEtaWindow = f;}
dbf053f0 60 virtual void SetTrackTypeGen(Int_t i){fTrackTypeGen = i;}
61 virtual void SetTrackTypeRec(Int_t i){fTrackTypeRec = i;}
54424110 62 virtual void SetTrackPtCut(Float_t x){fTrackPtCut = x;}
aae7993b 63 virtual void SetCentralityCut(Float_t xLo,Float_t xUp){fCentCutLo = xLo; fCentCutUp = xUp;}
b2c1e955 64 virtual void SetFilterMask(UInt_t i,Int_t iType = 0){fFilterMask = i;
65 fFilterType = iType;}
bea24d2d 66 virtual void SetJetTypes(UInt_t i){fJetTypes = i;}
0341d0d8 67 virtual void SetJetTriggerPtCut(Float_t x){fJetTriggerPtCut = x;}
ca6d12f9 68 virtual void SetVtxCuts(Float_t z,Float_t r = 1){fVtxZCut = z; fVtxR2Cut = r *r;}
b5b166c5 69 virtual void SetBackgroundBranch(const char* c){fBackgroundBranch = c;}
70 virtual const char* GetBackgroundBranch(){return fBackgroundBranch.Data();}
bd80a748 71 virtual void SetNSkipLeadingRan(Int_t x){fNSkipLeadingRan = x;}
af399bc2 72 virtual void SetNSkipLeadingCone(Int_t x){fNSkipLeadingCone = x;}
d7ca0e14 73 virtual void SetNRandomCones(Int_t x){fNRandomCones = x;}
bd80a748 74
54424110 75 virtual void SetJetOutputBranch(const char *c){fNonStdBranch = c;}
b5b166c5 76 virtual const char* GetJetOutputBranch(){return fNonStdBranch.Data();}
54424110 77 virtual void SetJetOutputFile(const char *c){fNonStdFile = c;}
b5b166c5 78 virtual const char* GetJetOutputFile(){return fNonStdFile.Data();}
65c43de8 79 virtual void SetMaxTrackPtInJet(Float_t x){fMaxTrackPtInJet = x;}
54424110 80 virtual void SetJetOutputMinPt(Float_t x){fJetOutputMinPt = x;}
21ead515 81 virtual void SetBackgroundCalc(Bool_t b){fUseBackgroundCalc = b;}
54424110 82
006b2a30 83 //Setters for detector level effects
84 virtual void SetSmearResolution(Bool_t b){fUseTrMomentumSmearing = b;}
85 virtual void SetDiceEfficiency(Bool_t b){fUseDiceEfficiency = b;}
86 virtual void SetMomentumResolutionHybrid(TProfile *p1, TProfile *p2, TProfile *p3);
87 virtual void SetEfficiencyHybrid(TH1 *h1, TH1 *h2, TH1 *h3);
88
89 Double_t GetMomentumSmearing(Int_t cat, Double_t pt);
90 void FitMomentumResolution();
65c43de8 91
92
dbf053f0 93 // for Fast Jet
94 fastjet::JetAlgorithm GetAlgorithm() const {return fAlgorithm;}
95 fastjet::Strategy GetStrategy() const {return fStrategy;}
96 fastjet::RecombinationScheme GetRecombScheme() const {return fRecombScheme;}
97 fastjet::AreaType GetAreaType() const {return fAreaType;}
98 // Setters
99 void SetRparam(Double_t f) {fRparam = f;}
100 void SetAlgorithm(fastjet::JetAlgorithm f) {fAlgorithm = f;}
101 void SetStrategy(fastjet::Strategy f) {fStrategy = f;}
102 void SetRecombScheme(fastjet::RecombinationScheme f) {fRecombScheme = f;}
103 void SetAreaType(fastjet::AreaType f) {fAreaType = f;}
d6e66a82 104 void SetGhostArea(Double_t f) {fGhostArea = f;}
105 void SetActiveAreaRepeats(Int_t f) {fActiveAreaRepeats = f;}
106 void SetGhostEtamax(Double_t f) {fGhostEtamax = f;}
107
108
dbf053f0 109
110 // Helper
111 //
112
113 // we have different cases
114 // AOD reading -> MC from AOD
115 // ESD reading -> MC from Kinematics
116 // this has to match with our selection of input events
f840d64c 117 enum {kTrackUndef = 0, kTrackAOD, kTrackKineAll,kTrackKineCharged, kTrackAODMCAll, kTrackAODMCCharged, kTrackAODMCChargedAcceptance, kTrackAODextra, kTrackAODextraonly};
dbf053f0 118 enum {kMaxJets = 4};
119 enum {kMaxCorrelation = 3};
120 enum {kMaxRadius = 5};
aae7993b 121 enum {kMaxCent = 4};
bea24d2d 122 enum {kJet = 1<<0,
123 kJetRan = 1<<1,
124 kRC = 1<<2,
125 kRCRan = 1<<3
126 };
dbf053f0 127
128
129 private:
130
131 AliAnalysisTaskJetCluster(const AliAnalysisTaskJetCluster&);
132 AliAnalysisTaskJetCluster& operator=(const AliAnalysisTaskJetCluster&);
133
134 Int_t GetListOfTracks(TList *list,Int_t type);
135
54424110 136 AliAODEvent *fAOD; // ! where we take the jets from can be input or output AOD
137 AliAODExtension *fAODExtension; // ! AOD extension in case we write a non-sdt branch to a separate file and the aod is standard
138 TRefArray *fRef; // ! trefarray for track references within the jet
dbf053f0 139 Bool_t fUseAODTrackInput; // take track from input AOD not from ouptu AOD
140 Bool_t fUseAODMCInput; // take MC from input AOD not from ouptu AOD
21ead515 141 Bool_t fUseBackgroundCalc; // switches on background calculations
ca6d12f9 142 Bool_t fEventSelection; // use the event selection of this task, otherwise analyse all
54424110 143 UInt_t fFilterMask; // filter bit for slecected tracks
b2c1e955 144 UInt_t fFilterType; // filter type 0 = all, 1 = ITSTPC, 2 = TPC
006b2a30 145 UInt_t fJetTypes; // 1<<0 regular jets, 1<<1 << randomized event 1<<2 random cones 1<<3 random cones randomiuzed event
dbf053f0 146 Int_t fTrackTypeRec; // type of tracks used for FF
147 Int_t fTrackTypeGen; // type of tracks used for FF
af399bc2 148 Int_t fNSkipLeadingRan; // number of leading tracks to be skipped in the randomized event
149 Int_t fNSkipLeadingCone; // number of leading jets to be for the random cones
d7ca0e14 150 Int_t fNRandomCones; // number of generated random cones
dbf053f0 151 Float_t fAvgTrials; // Average nimber of trials
152 Float_t fExternalWeight; // external weight
ca6d12f9 153 Float_t fTrackEtaWindow; // eta window used for corraltion plots between rec and gen
dbf053f0 154 Float_t fRecEtaWindow; // eta window used for corraltion plots between rec and gen
54424110 155 Float_t fTrackPtCut; // minimum track pt to be accepted
156 Float_t fJetOutputMinPt; // minimum p_t for jets to be written out
65c43de8 157 Float_t fMaxTrackPtInJet; // maximum track pt within a jet for flagging...
0341d0d8 158 Float_t fJetTriggerPtCut; // minimum jwt pT for AOD to be written
ca6d12f9 159 Float_t fVtxZCut; // zvtx cut
160 Float_t fVtxR2Cut; // R vtx cut (squared)
aae7993b 161 Float_t fCentCutUp; // upper limit on centrality
162 Float_t fCentCutLo; // lower limit on centrality
54424110 163 // output configurartion
164 TString fNonStdBranch; // the name of the non-std branch name, if empty no branch is filled
0341d0d8 165 TString fBackgroundBranch; // name of the branch used for background subtraction
006b2a30 166 TString fNonStdFile; // The optional name of the output file the non-std branch is written to
167
168 //Detector level effects
169 TProfile *fMomResH1; // Momentum resolution from TrackQA Hybrid Category 1
170 TProfile *fMomResH2; // Momentum resolution from TrackQA Hybrid Category 2
171 TProfile *fMomResH3; // Momentum resolution from TrackQA Hybrid Category 3
172 TF1 *fMomResH1Fit; //fit
173 TF1 *fMomResH2Fit; //fit
174 TF1 *fMomResH3Fit; //fit
175
176 TH1 *fhEffH1; // Efficiency for Spectra Hybrid Category 1
177 TH1 *fhEffH2; // Efficiency for Spectra Hybrid Category 2
178 TH1 *fhEffH3; // Efficiency for Spectra Hybrid Category 3
179 Bool_t fUseTrMomentumSmearing; // Apply momentum smearing on track level
180 Bool_t fUseDiceEfficiency; // Apply efficiency on track level by dicing
54424110 181
dbf053f0 182 // Fast jet
f0659f11 183 Double_t fRparam; // fastjet distance parameter
dbf053f0 184 fastjet::JetAlgorithm fAlgorithm; //fastjet::kt_algorithm
185 fastjet::Strategy fStrategy; //= fastjet::Best;
186 fastjet::RecombinationScheme fRecombScheme; // = fastjet::BIpt_scheme;
f0659f11 187 fastjet::AreaType fAreaType; // fastjet area type
188 Double_t fGhostArea; // fasjet ghost area
189 Int_t fActiveAreaRepeats; // fast jet active area repeats
190 Double_t fGhostEtamax; // fast jet ghost area
8f85b773 191
006b2a30 192 TClonesArray *fTCAJetsOut; //! TCA of output jets
193 TClonesArray *fTCAJetsOutRan; //! TCA of output jets in randomized event
194 TClonesArray *fTCARandomConesOut; //! TCA of output jets in randomized event
8f85b773 195 TClonesArray *fTCARandomConesOutRan; //! TCA of output jets in randomized event
196 AliAODJetEventBackground *fAODJetBackgroundOut; //! jet background to be written out
197
d7ca0e14 198 TRandom3* fRandom; //! random number generator
d6e66a82 199 TProfile* fh1Xsec; //! pythia cross section and trials
200 TH1F* fh1Trials; //! trials are added
201 TH1F* fh1PtHard; //! Pt har of the event...
202 TH1F* fh1PtHardNoW; //! Pt har of the event without weigt
203 TH1F* fh1PtHardTrials; //! Number of trials
204
205 TH1F* fh1NJetsRec; //! number of reconstructed jets
206 TH1F* fh1NConstRec;//! number of constiutens in leading jet
207 TH1F* fh1NConstLeadingRec;//! number of constiutens in leading jet
208 TH1F* fh1PtJetsRecIn; //! Jet pt for all jets
209 TH1F* fh1PtJetsLeadingRecIn; //! Jet pt for all jets
210 TH1F* fh1PtJetConstRec;//! pt of constituents
dbf053f0 211 TH1F* fh1PtJetConstLeadingRec;// pt of constituents
d6e66a82 212 TH1F* fh1PtTracksRecIn; //! track pt for all tracks
213 TH1F* fh1PtTracksLeadingRecIn; //! track pt for all tracks
dbf053f0 214
215 // Randomized track histos
d6e66a82 216 TH1F* fh1NJetsRecRan; //! number of reconstructed jets from randomized
217 TH1F* fh1NConstRecRan;//! number of constiutens in leading jet
218 TH1F* fh1PtJetsLeadingRecInRan; //! Jet pt for all jets
219 TH1F* fh1NConstLeadingRecRan;//! number of constiutens in leading jet
220 TH1F* fh1PtJetsRecInRan; //! Jet pt for all jets
221
222 TH1F* fh1PtTracksGenIn; //! track pt for all tracks
223 TH1F* fh1Nch; //! charged particle mult
82a35b1a 224 TH1F* fh1BiARandomCones[3]; //! Residual distribtion from reandom cones on real event
225 TH1F* fh1BiARandomConesRan[3]; //! Residual distribtion from reandom cones on random event
aae7993b 226 TH1F* fh1CentralityPhySel; // ! centrality of anaylsed events
e2ca7519 227 TH1F* fh1Centrality; // ! centrality of anaylsed events
aae7993b 228 TH1F* fh1CentralitySelect; // ! centrality of selected events
e2ca7519 229 TH1F* fh1ZPhySel; // ! centrality of anaylsed events
230 TH1F* fh1Z; // ! centrality of anaylsed events
231 TH1F* fh1ZSelect; // ! centrality of selected events
232
d6e66a82 233
234 TH2F* fh2NRecJetsPt; //! Number of found jets above threshold
235 TH2F* fh2NRecTracksPt; //! Number of found tracks above threshold
236 TH2F* fh2NConstPt; //! number of constituents vs. pt
237 TH2F* fh2NConstLeadingPt; //! number of constituents vs. pt
238 TH2F* fh2JetPhiEta; //! jet phi eta
239 TH2F* fh2LeadingJetPhiEta; //! leading jet phi eta
240 TH2F* fh2JetEtaPt; //! leading jet eta
241 TH2F* fh2LeadingJetEtaPt; //! leading jet eta
242 TH2F* fh2TrackEtaPt; //! track eta
243 TH2F* fh2LeadingTrackEtaPt; //! leading track eta
244 TH2F* fh2JetsLeadingPhiEta; //! jet phi eta
245 TH2F* fh2JetsLeadingPhiPt; //! jet correlation with leading jet
246 TH2F* fh2TracksLeadingPhiEta; //! track correlation with leading track
247 TH2F* fh2TracksLeadingPhiPt; //! track correlation with leading track
248 TH2F* fh2TracksLeadingJetPhiPt; //! track correlation with leading Jet
249 TH2F* fh2JetsLeadingPhiPtW; //! jet correlation with leading jet
250 TH2F* fh2TracksLeadingPhiPtW; //! track correlation with leading track
251 TH2F* fh2TracksLeadingJetPhiPtW; //! track correlation with leading Jet
252 TH2F* fh2NRecJetsPtRan; //! Number of found jets above threshold
253 TH2F* fh2NConstPtRan; //! number of constituents vs. pt
254 TH2F* fh2NConstLeadingPtRan; //! number of constituents vs. pt
255 TH2F* fh2PtNch; //! p_T of cluster vs. multiplicity,
256 TH2F* fh2PtNchRan; //! p_T of cluster vs. multiplicity,random
257 TH2F* fh2PtNchN; //! p_T of cluster vs. multiplicity, weigthed with constituents
258 TH2F* fh2PtNchNRan; //! p_T of cluster vs. multiplicity, weigthed with constituents random
259 TH2F* fh2TracksLeadingJetPhiPtRan; //! track correlation with leading Jet
260 TH2F* fh2TracksLeadingJetPhiPtWRan; //! track correlation with leading Jet
82a35b1a 261
aae7993b 262
263 TH2F* fh2JetsLeadingPhiPtC[kMaxCent]; //! jet correlation with leading jet
264 TH2F* fh2JetsLeadingPhiPtWC[kMaxCent]; //! jet correlation with leading jet
265 TH2F* fh2TracksLeadingJetPhiPtC[kMaxCent]; //! track correlation with leading Jet
266 TH2F* fh2TracksLeadingJetPhiPtWC[kMaxCent]; //! track correlation with leading Jet
267
006b2a30 268 //Histos for detector level effects from toy model
269 TH2F *fh2PtGenPtSmeared; //! Control histo smeared momentum
270 TProfile *fp1Efficiency; //! Control profile efficiency
271 TProfile *fp1PtResolution; //! Control profile for pT resolution
272
d7ca0e14 273 TList *fHistList; //!leading tracks to be skipped in the randomized event Output list
dbf053f0 274
275
bea24d2d 276 ClassDef(AliAnalysisTaskJetCluster, 20)
dbf053f0 277};
278
279#endif