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