1 #ifndef ALIANALYSISTASKFULLPPJET_H
2 #define ALIANALYSISTASKFULLPPJET_H
4 // **************************************
5 // Task used for the analysis of full pp jets
6 // In additional, functions needed for systematic
7 // uncertainties are also included
8 // *******************************************
28 class AliEMCALGeometry;
29 class AliEMCALRecoUtils;
30 class AliESDCaloCluster;
35 #include "AliESDtrackCuts.h"
36 #include "AliAnalysisTaskSE.h"
37 #include "fastjet/JetDefinition.hh"
38 #include "fastjet/PseudoJet.hh"
40 class AliAnalysisTaskFullppJet : public AliAnalysisTaskSE {
42 AliAnalysisTaskFullppJet();
43 AliAnalysisTaskFullppJet(const char *name);
44 virtual ~AliAnalysisTaskFullppJet();
47 void UserCreateOutputObjects();
48 void UserExec(Option_t *option);
49 void Terminate(Option_t *);
52 enum {kTPCOnlyVtx = 1<<3,
64 void SetAnaType(Int_t ana) { fAnaType=ana; }
65 void SetMCAna(Bool_t mc) { fIsMC=mc; }
66 void SetPhySelForMC(Bool_t phy) { fPhySelForMC=phy; }
67 void SetChargedMC(Bool_t mc) { fChargedMC=mc; }
68 void SetRejectSPDPileup(Bool_t re) { fRejectPileup=re; }
69 void SetRejectExoticTrigger(Bool_t re) { fRejectExoticTrigger=re; }
70 void SetCheckTriggerMask(Bool_t check) { fCheckTriggerMask=check; }
71 void SetRunPeriod(char *p) { fPeriod=p; }
72 void SetOfflineTrigger(Bool_t t) { fOfflineTrigger=t; }
73 void SetXsec(Float_t Xsec) { fXsecScale=Xsec; }
74 void SetConstrainChargedInEMCal(Bool_t con) { fConstrainChInEMCal=con; }
75 void SetRejectNK(Bool_t reject) { fRejectNK=reject; }
76 void SetRejectWD(Bool_t reject) { fRejectWD=reject; }
77 void SetVerbosity(Int_t v) { fVerbosity = v; }
78 void SetTrackCutsType(Int_t type) { fTrackCutsType = type; }
79 void SetEsdTrackCuts(AliESDtrackCuts *cuts) { fEsdTrackCuts=cuts; }
80 void SetHybridTrackCuts1(AliESDtrackCuts *cuts) { fHybridTrackCuts1=cuts; }
81 void SetHybridTrackCuts2(AliESDtrackCuts *cuts) { fHybridTrackCuts2=cuts; }
82 void SetKinCutType(Int_t type) { fKinCutType = type; }
83 void SetZvtx(Double_t zvtx) { fZVtxMax = zvtx; }
84 void SetEtaMax(Double_t eta) { fTrkEtaMax = eta; }
85 void SetdEdxRange(Double_t min, Double_t max) { fdEdxMin=min; fdEdxMax=max; }
86 void SetEoverPRange(Double_t min, Double_t max) { fEoverPMin=min; fEoverPMax=max; }
87 void SetMatchType(Int_t type) { fMatchType=type; }
88 void SetRejectExoticCluster(Bool_t reject) { fRejectExoticCluster=reject; }
89 void SetRemoveProblematicSM4(Bool_t remove) { fRemoveBadChannel=remove; }
90 void SetUseGoodSM(Bool_t good) { fUseGoodSM=good; }
91 void SetStudySubEInHC(Bool_t study) { fStudySubEInHC=study; }
92 void SetStudyMcOverSubE(Bool_t study) { fStudyMcOverSubE=study; }
93 void SetRejectElectron(Bool_t reject) { fElectronRejection=reject; }
94 void SetCorrectHadron(Bool_t correct) { fHadronicCorrection=correct; }
95 void SetHCFraction(Float_t fraction) { fFractionHC=fraction; }
96 void SetHCLowerPtCutMIP(Double_t pt) { fHCLowerPtCutMIP=pt; }
97 void SetNonStdBranch(char* name) { fNonStdBranch=name; }
98 void SetNonStdFile(char* name) { fNonStdBranch=name; }
99 void SetAlgorithm(char *algo) { fAlgorithm=algo; }
100 void SetRadius(char *r) { fRadius=r; }
101 void SetRecombinationScheme(Int_t scheme) { fRecombinationScheme=scheme; }
102 void SetSpotGoodJet(Bool_t spot) { fSpotGoodJet=spot; }
103 void SetFindChargedOnlyJet(Bool_t ch) { fFindChargedOnlyJet=ch; }
104 void SetFindNeutralOnlyJet(Bool_t ne) { fFindNeutralOnlyJet=ne; }
105 void SetCheckTrkEffCorr(Bool_t check) { fCheckTrkEffCorr=check; }
106 void SetTrkEffCorrCutZ(Double_t zcut) { fTrkEffCorrCutZ=zcut; }
107 void SetSmearMC(Double_t smear) { fSmearMC=smear; }
108 void SetRunUE(Bool_t run) { fRunUE=run; }
109 void SetCheckTPCOnlyVtx(Bool_t check) { fCheckTPCOnlyVtx=check; }
110 void SetRunSecondaries(Bool_t run) { fRunSecondaries=run; }
112 //--------------------------------
114 //--------------------------------
115 void SetPtRange(Double_t minMB, Double_t maxMB, Double_t minHT, Double_t maxHT)
116 { fTrkPtMin[0]=minMB; fTrkPtMax[0]=maxMB; fTrkPtMin[1]=minHT; fTrkPtMax[1]=maxHT; }
118 void SetEtRange(Double_t minMB, Double_t maxMB, Double_t minHT, Double_t maxHT)
119 { fClsEtMin[0]=minMB; fClsEtMax[0]=maxMB; fClsEtMin[1]=minHT; fClsEtMax[1]=maxHT; }
121 //--------------------------------
123 //--------------------------------
124 void SetJetNEFCut(Double_t min, Double_t max)
125 { fJetNEFMin=min; fJetNEFMax=max; }
127 //---------------------------------
129 //---------------------------------
130 void SetSaveQAHistos(Bool_t save) { fSaveQAHistos=save; }
131 void SetSysJetTrigEff(Bool_t sys) { fSysJetTrigEff=sys; }
132 void SetVaryJetTrigEff(Double_t vary) { fVaryJetTrigEff=vary; }
133 void SetSysTrkPtRes(Bool_t sys) { fSysTrkPtRes=sys; }
134 void SetVaryTrkPtRes(Double_t vary) { fVaryTrkPtRes=vary; }
135 void SetSysTrkEff(Bool_t sys) { fSysTrkEff=sys; }
136 void SetVaryTrkEff(Double_t vary) { fVaryTrkEff=vary; }
137 void SetSysTrkClsMth(Bool_t sys) { fSysTrkClsMth=sys; }
138 void SetSysTrkClsCut(Double_t deta, Double_t dphi){ fCutdEta=deta; fCutdPhi=dphi; }
139 void SetSysNonLinearity(Bool_t sys) { fSysNonLinearity=sys; }
140 void SetSysClusterEScale(Bool_t sys) { fSysClusterEScale=sys; }
141 void SetVaryClusterEScale(Double_t vary) { fVaryClusterEScale=vary; }
142 void SetSysClusterERes(Bool_t sys) { fSysClusterERes=sys; }
143 void SetVaryClusterERes(Double_t vary) { fVaryClusterERes=vary; }
144 void SetSysClusterizer(Bool_t sys) { fSysClusterizer=sys; }
148 AliESDtrack *GetAcceptTrack(AliESDtrack *esdtrack);
149 Int_t RunOfflineTrigger();
150 Double_t GetOfflineTriggerProbability(AliESDCaloCluster *cluster);
151 Int_t GetClusterSuperModule(AliESDCaloCluster *cluster);
152 void ProcessMC(const Int_t r=0);
154 Bool_t IsGoodMcPartilce(const AliVParticle* vParticle, const Int_t ipart);
155 Int_t GetParentParton(const Int_t ipart);
156 Int_t FindSpatialMatchedJet(fastjet::PseudoJet jet, AliFJWrapper *jetFinder, Double_t &dEta, Double_t &dPhi, Double_t maxR);
157 Int_t FindEnergyMatchedJet(AliFJWrapper *jetFinder1, const Int_t index1, AliFJWrapper *jetFinder2, const Double_t fraction=0.5);
158 Bool_t HasPrimaryVertex() const;
159 Bool_t IsPrimaryVertexOk() const;
160 Bool_t IsTPCOnlyVtx() const;
161 Bool_t IsLEDEvent() const;
162 void CheckExoticEvent();
163 void CheckEventTriggerBit();
166 Bool_t IsElectron(AliESDtrack *track, Double_t clsE) const;
167 void GetESDEMCalClusters();
168 Bool_t IsGoodCluster(AliESDCaloCluster *cluster);
169 Double_t SubtractClusterEnergy(AliESDCaloCluster *cluster, Double_t &eRes, Double_t &MIPE, Double_t &MCsubE);
170 Double_t GetClusterEnergyResolution(AliESDCaloCluster *cluster);
171 void FindDetJets(const Int_t s=0, const Int_t a=0, const Int_t r=0);
172 void FillAODJets(TClonesArray *fJetArray, AliFJWrapper *jetFinder, const Bool_t isTruth = 0);
173 void AnalyzeJets(AliFJWrapper *jetFinder, const Int_t type, const Int_t r);
174 void RunAnalyzeUE(AliFJWrapper *jetFinder, const Int_t type, const Bool_t isMCTruth);
175 void AnalyzeSecondaryContribution(AliFJWrapper *jetFinder, const Int_t r, const Int_t etaCut);
176 void AnalyzeSecondaryContributionViaMatching(AliFJWrapper *jetFinder, const Int_t r, const Int_t type, const Int_t etaCut);
177 void GetSecondaryPtFraction(TParticle *particle, Double_t &chPt, Double_t &reGenPt, Double_t &reRecPt);
178 void CheckTPCOnlyVtx(const UInt_t trigger);
179 Bool_t IsGoodJet(fastjet::PseudoJet jet, Double_t radius);
180 Bool_t IsGoodJet(AliAODJet *jet, Double_t radius);
181 Double_t GetLeadingZ(const Int_t jetIndex, AliFJWrapper *jetFinder);
182 Double_t GetZ(const Double_t trkPx, const Double_t trkPy, const Double_t trkPz, const Double_t jetPx, const Double_t jetPy, const Double_t jetPz) const;
183 Double_t GetMeasuredJetPtResolution(const Int_t jetIndex, AliFJWrapper *jetFinder);
184 Double_t GetTrkEff(Double_t inPt);
185 Double_t GetJetMissPtDueToTrackingEfficiency(const Int_t jetIndex, AliFJWrapper *jetFinder, const Int_t radiusIndex);
186 Double_t GetExoticEnergyFraction(AliESDCaloCluster *cluster);
187 Double_t GetSmearedTrackPt(AliESDtrack *track);
189 enum { kNBins = 20 };
190 enum { kNRadii = 3 };
193 Int_t fVerbosity; // Control output
194 Int_t fEDSFileCounter; // Keep track of the ESD file inside a chain
195 Int_t fNTracksPerChunk; // Number of tracks per ESD file; used for debugging
196 Bool_t fRejectPileup; // Flag to reject SPD pileup events
197 Bool_t fRejectExoticTrigger; // Flag to reject events triggered by exotic clusters
198 Int_t fAnaType; // 0-local, 1-grid
199 TString fPeriod; // Data period
200 AliESDEvent *fESD; //! ESD object
201 AliAODEvent *fAOD; //! AOD object
202 AliMCEvent *fMC; //! MC object
203 AliStack *fStack; //! MC stack
204 TObjArray *fTrackArray; //! Array of input tracks
205 TObjArray *fClusterArray; //! Array of input clusters
206 TArrayI *fMcPartArray; //! Array of MC particles
207 Bool_t fIsMC; // Flag of MC data
208 Bool_t fPhySelForMC; // Flag to run physics selection in case of MC data
209 Bool_t fChargedMC; // Flag to find only charged MC jets
210 Float_t fXsecScale; // Corss section for each pT hard bin
211 Double_t fCentrality; // V0M for current event
212 Double_t fZVtxMax; // Max vertex z cut
213 Int_t fTriggerType; // 0-MB, 1-EMC
214 Bool_t fCheckTriggerMask; // Flag to check the trigger mask for triggered events
215 Bool_t fIsTPCOnlyVtx; // Flag of events with ONLY TPC vertex
216 Bool_t fIsExoticEvent3GeV; // Flag of events with exotic cluster above 3 GeV
217 Bool_t fIsExoticEvent5GeV; // Flag of events with exotic cluster above 5 GeV
218 Bool_t fIsEventTriggerBit; // Flag of triggered events with valid trigger bit
219 Bool_t fOfflineTrigger; // Run offline trigger
220 TH2F *fTriggerMask; //! Offline trigger mask
221 TH1D *fTriggerCurve[10]; //! Trigger turn-on curves of EMCal clusters
222 TF1 *fTriggerEfficiency[10]; //! Fit of trigger turn-on curves for EMCal clusters above 4-5 GeV
223 AliEMCALGeometry *fGeom; //! EMCal goemetry utility
224 AliEMCALRecoUtils *fRecoUtil; //! Reco utility
225 AliESDtrackCuts *fEsdTrackCuts; // Track cuts for good tracks
226 AliESDtrackCuts *fHybridTrackCuts1; // Track cuts for tracks without SPD hit
227 AliESDtrackCuts *fHybridTrackCuts2; // Track cuts for tracks witout SPD hit or ITS refit
228 Int_t fTrackCutsType; // 0-Global track, 1-TPCOnly track
229 Int_t fKinCutType; // 0-cut on track before jet finding, 1-cut on jet with high-pt tracks
230 Double_t fTrkEtaMax; // Max |eta| cut
231 Double_t fTrkPtMin[2]; // Min pt cut
232 Double_t fTrkPtMax[2]; // Max pt cut
233 Double_t fdEdxMin; // Min dE/dx cut
234 Double_t fdEdxMax; // Max dE/dx cut
235 Double_t fEoverPMin; // Min E/P cut
236 Double_t fEoverPMax; // Max E/P cut
237 Double_t fClsEtMin[2]; // Min et cut
238 Double_t fClsEtMax[2]; // Max et cut
239 Int_t fMatchType; // 0-extrapolation, 1-extrapolation + MC label
240 Bool_t fRejectExoticCluster; // Flag to reject exotic cluster
241 Bool_t fRemoveBadChannel; // Flag to remove problematic region in SM4
242 Bool_t fUseGoodSM; // Flag to not use trigger bit in SM2,3,4,5
243 Bool_t fStudySubEInHC; // If true, the hadronic correction will be ingored. For physics, it should be set to kFALSE
244 Bool_t fStudyMcOverSubE; // Study the over-subtraction of hadronic correction in simualtion.
245 Bool_t fElectronRejection; // Switches on electron correction to avoid double counting of electrons
246 Bool_t fHadronicCorrection; // switches on hadronic correction to avoid double counting of hadrons
247 Float_t fFractionHC; // fraction of hadronic correction
248 Double_t fHCLowerPtCutMIP; // Lower track pt cut for MIP correction
249 TF1 *fClusterEResolution; //! Parameterization of cluster energy resolution from test beam results
250 Double_t fJetNEFMin; // Min jet NEF cut
251 Double_t fJetNEFMax; // Max jet NEF cut
252 Bool_t fSpotGoodJet; // Good jet catching
253 Bool_t fFindChargedOnlyJet; // Find jets with TPC tracks
254 Bool_t fFindNeutralOnlyJet; // Find jets with EMCal clusters
255 Bool_t fCheckTrkEffCorr; // Check the procedure of tracking efficiency correction
256 Double_t fTrkEffCorrCutZ; // Cut on the tracks that are added back Z < 0.3
257 TF1 *fTrkEffFunc[3]; //! Fit function of tracking efficiency
258 TH1F *fhCorrTrkEffPtBin[2][kNRadii]; //! Number of tracks per jet pt bin, used to correct the tracking efficiency explicitly
259 TH1F *fhCorrTrkEffSample[2][kNRadii][kNBins]; //! Tracking efficiency estimated from simulation
260 TRandom3 *fRandomGen; //! Random number generator
261 Bool_t fRunUE; // Run analysis of underlying event
262 Bool_t fCheckTPCOnlyVtx; // Check events with TPC only vertices
263 Bool_t fRunSecondaries; // Run analysise for secondary particles
264 TH2F *fhSecondaryResponse[3]; //! Response matrix for secondary particles
266 Bool_t fSysJetTrigEff; // Flag of systematic uncertainty of jet trigger efficiency
267 Double_t fVaryJetTrigEff; // Variation of cluster E-scale for systematic uncertainty of jet trigger efficiency
268 Bool_t fSysTrkPtRes; // Flag of systematic uncertainty of tracking momentum resolution
269 Double_t fVaryTrkPtRes; // Variation of tracking momentum resolution
270 Bool_t fSysTrkEff; // Flag of systematic uncertainty of tracking efficiency
271 Double_t fVaryTrkEff; // Variation of tracking efficiency
272 Bool_t fSysTrkClsMth; // Flag of systematic uncertainty of track-cluster matching
273 Double_t fCutdEta; // Variation of dEta cut
274 Double_t fCutdPhi; // Variation of dPhi cut
275 Bool_t fSysNonLinearity; // Flag of systematic uncertainty of EMCal non-linearity
276 TF1 *fNonLinear; //! Non-linearity correction functions for data
277 Bool_t fSysClusterEScale; // Flag of systematic uncertainty of EMCal energy scale
278 Double_t fVaryClusterEScale; // Variation of EMCal energy scale
279 Bool_t fSysClusterERes; // Flag of systematic uncertainty of EMCal energy resolution
280 Double_t fVaryClusterERes; // Variation of EMCal energy resolution
281 Bool_t fSysClusterizer; // Flag of systematic uncertainty on clusterizer
283 TString fNonStdBranch; // Non-std branch name for AOD jets
284 TString fNonStdFile; // Name of optional file that the non-std branch is written to
285 TString fAlgorithm; // name of algorithm
286 TString fRadius; // Jet cone radius
287 Int_t fRecombinationScheme; // Recombination scheme of jet finding
288 AliFJWrapper *fDetJetFinder[3][2][kNRadii]; //! Jet finder
289 TClonesArray *fJetTCA[3][2][kNRadii]; //! TCA of jets: in - akt - r
290 Bool_t fConstrainChInEMCal; // Constain charged particle to be in EMCal acceptance
291 Bool_t fRejectNK; // Reject neutron and K_L
292 Bool_t fRejectWD; // Reject primaries, mainly k^0_S, that decay weakly
293 Bool_t fSmearMC; // Flag of smearing tracking resolution in MC to match data. Obselete.
294 TF1 *fTrkPtResData; //! Parameterazation of momentum resolution estimated from data
295 AliFJWrapper *fTrueJetFinder[kNRadii]; //! Jet finder for particle jets
296 TClonesArray *fMcTruthAntikt[kNRadii]; //! TCA of MC truth anti-kt jets
298 TList *fOutputList; //! Output list
299 Bool_t fSaveQAHistos; // Flag of saving QA histograms
300 TH1F *fhJetEventCount; //! Event counts to keep track of rejection criteria
301 TH1F *fhJetEventStat; //! Event counts used for jet analysis
302 TH1F *fhEventStatTPCVtx; //! Event counts for TPC only vertices
303 TH1F *fhChunkQA; //! Check if the chunk is corrupted
304 TH1F *fVertexGenZ[2]; //! Generated event vertex z
305 TH1F *fEventZ[2]; //! reconstructed event vertex z
306 TH1F *fhNTrials[2]; //! # of trials
307 TH1F *fhNMatchedTrack[2]; //! # of matched tracks per cluster
308 TH2F *fhSubEVsTrkPt[2][4]; //! Subtracted energy due to hadronic correction
309 TH2F *fhNeutralPtInJet[3][kNRadii]; //! pt of neutral constituents in jet
310 TH2F *fhTrigNeuPtInJet[3][kNRadii]; //! pt of neutral constituents in jet
311 TH2F *fhChargedPtInJet[3][kNRadii]; //! pt of charged constituents in jet
312 TH2F *fhLeadNePtInJet[3][kNRadii]; //! pt of leading neutral constituents in jet
313 TH2F *fhLeadChPtInJet[3][kNRadii]; //! pt of leading charged constituents in jet
314 TH2F *fhChLeadZVsJetPt[2][kNRadii]; //! Leading charged constituent Z vs jet pt
315 TH3F *fhJetPtVsZ[3][kNRadii]; //! Jet pt vs constituent Z vs constituent type
316 TH3F *fRelTrkCon[2][kNRadii]; //! Jet pt vs track pt contribution vs track class
317 TH2F *fhJetPtWithTrkThres[2][kNRadii]; //! pt of jets containing tracks above certian threshold
318 TH2F *fhJetPtWithClsThres[2][kNRadii]; //! pt of jets containing clusters above certian threshold
319 TH2F *fhJetPtVsLowPtCons[2][kNRadii][2]; //! Contribution of low pt particles to jet energy
320 THnSparse *fJetEnergyFraction[3][kNRadii]; //! Jet energy fraction
321 THnSparse *fJetNPartFraction[3][kNRadii]; //! Jet NPart fraction
322 TH1F *fJetCount[3][kNRadii]; //! pT distribution of pions detected
323 TH2F *fhSubClsEVsJetPt[2][kNRadii][5]; //! f*subtracted cluster energy vs jet pt
324 TH2F *fhHCTrkPtClean[2][kNRadii][5]; //! Cleanly subtracted charged pt
325 TH2F *fhHCTrkPtAmbig[2][kNRadii][5]; //! Ambiguously subtracted charged pt
326 TH2F *fHCOverSubE[kNRadii][5]; //! Error made by hadronic correction assessed by using particle jet
327 TH2F *fHCOverSubEFrac[kNRadii][5]; //! Error made by hadronic correction assessed by using particle jet
328 TH3F *fhFcrossVsZleading[2][kNRadii]; //! Jet pt vs Fcross vs Zleading
329 TH1F *fhJetPtInExoticEvent[2][kNRadii]; //! Jet pt in exotic events
330 TH2F *fhUEJetPtVsSumPt[3][2][2]; //! Leading jet pt vs underlying event pt
331 TH2F *fhUEJetPtVsConsPt[3][2][2]; //! Leading jet pt vs constituent pt in underlying event
332 TH1F *fhUEJetPtNorm[3][2][2]; //! Leading jet normalization
333 TH1F *fhClsE[2]; //! Cluster energy distribution
334 TH3F *fhJetInTPCOnlyVtx[2][kNRadii]; //! Jets in full TPC acceptance in events with TPC only vertex
335 TH1F *fhSysClusterE[2][2]; //! Cluster energy distribution before and after hadonic correction
336 TH2F *fhSysNCellVsClsE[2][2]; //! NCell vs cluster energy before and after hadonic correction
339 TH2F *fhNKFracVsJetPt[2][kNRadii]; //! Energy fraction lost due to missing neutron and K0L
340 TH2F *fhWeakFracVsJetPt[2][kNRadii]; //! Energy fraction lost due to weakly decaying particles
341 TH2F *fhJetResponseNK[2][kNRadii]; //! Jet response due to missing neutron and K0L using response matrix
342 TH2F *fhJetResponseWP[2][kNRadii]; //! Jet response due to missing weakly decayed particles using response matrix
343 TH2F *fhJetResolutionNK[2][kNRadii]; //! Jet resolution due to missing neutron and K0L using response matrix
344 TH2F *fhJetResolutionWP[2][kNRadii]; //! Jet resolution due to missing weakly decayed particles using response matrix
345 TH2F *fhJetResponseNKSM[2][kNRadii]; //! Jet response due to missing neutron and K0L via matching
346 TH2F *fhJetResponseWPSM[2][kNRadii]; //! Jet response due to missing weakly decayed particles via matching
347 TH3F *fhJetResolutionNKSM[2][kNRadii]; //! Jet resolution due to missing neutron and K0L via matching
348 TH3F *fhJetResolutionWPSM[2][kNRadii]; //! Jet resolution due to missing weakly decayed particles via matching
350 AliAnalysisTaskFullppJet(const AliAnalysisTaskFullppJet&); // not implemented
351 AliAnalysisTaskFullppJet &operator=(const AliAnalysisTaskFullppJet&); // not implemented
353 ClassDef(AliAnalysisTaskFullppJet, 3);