]>
Commit | Line | Data |
---|---|---|
b6e50056 | 1 | #ifndef ALIANALYSISTASKFULLPPJET_H |
2 | #define ALIANALYSISTASKFULLPPJET_H | |
3 | ||
4 | // ************************************** | |
5 | // Task used for the analysis of full pp jets | |
6 | // In additional, functions needed for systematic | |
7 | // uncertainties are also included | |
8 | // ******************************************* | |
9 | ||
10 | #include <vector> | |
11 | ||
12 | class TFormula; | |
13 | class TH2F; | |
14 | class TH1F; | |
15 | class TF1; | |
16 | class THnSparse; | |
17 | class TRandom3; | |
18 | class TObjArray; | |
19 | class TClonesArray; | |
20 | class TObject; | |
21 | class TString; | |
22 | class TProfile2D; | |
23 | class AliAODEvent; | |
24 | class AliESDEvent; | |
25 | class AliMCEvent; | |
26 | class AliStack; | |
27 | class AliESDtrack; | |
28 | class AliESDtrackCuts; | |
29 | class AliEMCALGeometry; | |
30 | class AliEMCALRecoUtils; | |
31 | class AliESDCaloCluster; | |
32 | class AliFJWrapper; | |
33 | class AliAODJet; | |
34 | ||
35 | #include "AliAnalysisTaskSE.h" | |
36 | #include "fastjet/JetDefinition.hh" | |
37 | #include "fastjet/PseudoJet.hh" | |
38 | ||
39 | #include "AliAnalysisTaskSE.h" | |
40 | ||
41 | class AliAnalysisTaskFullppJet : public AliAnalysisTaskSE { | |
42 | public: | |
43 | AliAnalysisTaskFullppJet(); | |
44 | AliAnalysisTaskFullppJet(const char *name); | |
45 | virtual ~AliAnalysisTaskFullppJet(); | |
46 | ||
47 | Bool_t Notify(); | |
48 | void UserCreateOutputObjects(); | |
49 | void UserExec(Option_t *option); | |
50 | void Terminate(Option_t *); | |
51 | void PrintConfig(); | |
52 | ||
53 | enum {kTPCOnlyVtx = 1<<3, | |
54 | kTrigger = 1<<4, | |
55 | kHighZ = 1<<5, | |
56 | kSuspicious = 1<<6}; | |
57 | ||
58 | void SetMCAna(Bool_t mc) { fIsMC=mc; } | |
59 | void SetMCStandalone(Bool_t mc) { fMCStandalone=mc; } | |
60 | void SetChargedMC(Bool_t mc) { fChargedMC=mc; } | |
61 | void SetRunPeriod(char *p) { fPeriod=p; } | |
62 | void SetOfflineTrigger(Bool_t t) { fOfflineTrigger=t; } | |
63 | void SetXsec(Float_t Xsec) { fXsecScale=Xsec; } | |
64 | void SetConstrainChargedInEMCal(Bool_t con) { fConstrainChInEMCal=con; } | |
65 | void SetRejectNK(Bool_t reject) { fRejectNK=reject; } | |
66 | void SetRejectWD(Bool_t reject) { fRejectWD=reject; } | |
67 | void SetVerbosity(Int_t v) { fVerbosity = v; } | |
68 | void SetTrackCutsType(Int_t type) { fTrackCutsType = type; } | |
69 | void SetEsdTrackCuts(AliESDtrackCuts *cuts) { fEsdTrackCuts=cuts; } | |
70 | void SetHybridTrackCuts1(AliESDtrackCuts *cuts) { fHybridTrackCuts1=cuts; } | |
71 | void SetHybridTrackCuts2(AliESDtrackCuts *cuts) { fHybridTrackCuts2=cuts; } | |
72 | void SetKinCutType(Int_t type) { fKinCutType = type; } | |
73 | void SetZvtx(Double_t zvtx) { fZVtxMax = zvtx; } | |
74 | void SetEtaMax(Double_t eta) { fTrkEtaMax = eta; } | |
75 | void SetdEdxRange(Double_t min, Double_t max) { fdEdxMin=min; fdEdxMax=max; } | |
76 | void SetEoverPRange(Double_t min, Double_t max) { fEoverPMin=min; fEoverPMax=max; } | |
77 | void SetMatchType(Int_t type) { fMatchType=type; } | |
78 | void SetRejectExoticCluster(Bool_t reject) { fRejectExoticCluster=reject; } | |
79 | void SetRemoveProblematicSM4(Bool_t remove) { fRemoveBadChannel=remove; } | |
80 | void SetUseGoodSM(Bool_t good) { fUseGoodSM=good; } | |
81 | void SetStudySubEInHC(Bool_t study) { fStudySubEInHC=study; } | |
82 | void SetStudyMcOverSubE(Bool_t study) { fStudyMcOverSubE=study; } | |
83 | void SetRejectElectron(Bool_t reject) { fElectronRejection=reject; } | |
84 | void SetCorrectHadron(Bool_t correct) { fHadronicCorrection=correct; } | |
85 | void SetHCFraction(Float_t fraction) { fFractionHC=fraction; } | |
86 | void SetHCLowerPtCutMIP(Double_t pt) { fHCLowerPtCutMIP=pt; } | |
87 | void SetNonStdBranch(char* name) { fNonStdBranch=name; } | |
88 | void SetNonStdFile(char* name) { fNonStdBranch=name; } | |
89 | void SetAlgorithm(char *algo) { fAlgorithm=algo; } | |
90 | void SetRadius(char *r) { fRadius=r; } | |
91 | void SetRecombinationScheme(Int_t scheme) { fRecombinationScheme=scheme; } | |
92 | void SetSpotGoodJet(Bool_t spot) { fSpotGoodJet=spot; } | |
93 | void SetFindChargedOnlyJet(Bool_t ch) { fFindChargedOnlyJet=ch; } | |
94 | void SetFindNeutralOnlyJet(Bool_t ne) { fFindNeutralOnlyJet=ne; } | |
95 | void SetCheckTrkEffCorr(Bool_t check) { fCheckTrkEffCorr=check; } | |
96 | void SetTrkEffCorrCutZ(Double_t zcut) { fTrkEffCorrCutZ=zcut; } | |
97 | void SetSmearMC(Double_t smear) { fSmearMC=smear; } | |
98 | void SetRunUE(Bool_t run) { fRunUE=run; } | |
99 | ||
100 | //-------------------------------- | |
101 | // Kinematic cut | |
102 | //-------------------------------- | |
103 | void SetPtRange(Double_t minMB, Double_t maxMB, Double_t minHT, Double_t maxHT) | |
104 | { fTrkPtMin[0]=minMB; fTrkPtMax[0]=maxMB; fTrkPtMin[1]=minHT; fTrkPtMax[1]=maxHT; } | |
105 | ||
106 | void SetEtRange(Double_t minMB, Double_t maxMB, Double_t minHT, Double_t maxHT) | |
107 | { fClsEtMin[0]=minMB; fClsEtMax[0]=maxMB; fClsEtMin[1]=minHT; fClsEtMax[1]=maxHT; } | |
108 | ||
109 | //-------------------------------- | |
110 | // Jet quality cut | |
111 | //-------------------------------- | |
112 | void SetJetNEFCut(Double_t min, Double_t max) | |
113 | { fJetNEFMin=min; fJetNEFMax=max; } | |
114 | ||
115 | //--------------------------------- | |
116 | // Systematic study | |
117 | //--------------------------------- | |
118 | void SetSaveQAHistos(Bool_t save) { fSaveQAHistos=save; } | |
119 | void SetSysJetTrigEff(Bool_t sys) { fSysJetTrigEff=sys; } | |
120 | void SetVaryJetTrigEff(Double_t vary) { fVaryJetTrigEff=vary; } | |
121 | void SetSysTrkPtRes(Bool_t sys) { fSysTrkPtRes=sys; } | |
122 | void SetVaryTrkPtRes(Double_t vary) { fVaryTrkPtRes=vary; } | |
123 | void SetSysTrkEff(Bool_t sys) { fSysTrkEff=sys; } | |
124 | void SetVaryTrkEff(Double_t vary) { fVaryTrkEff=vary; } | |
125 | void SetSysTrkClsMth(Bool_t sys) { fSysTrkClsMth=sys; } | |
126 | void SetSysTrkClsCut(Double_t deta, Double_t dphi){ fCutdEta=deta; fCutdPhi=dphi; } | |
127 | void SetSysNonLinearity(Bool_t sys) { fSysNonLinearity=sys; } | |
128 | void SetSysClusterEScale(Bool_t sys) { fSysClusterEScale=sys; } | |
129 | void SetVaryClusterEScale(Double_t vary) { fVaryClusterEScale=vary; } | |
130 | void SetSysClusterERes(Bool_t sys) { fSysClusterERes=sys; } | |
131 | void SetVaryClusterERes(Double_t vary) { fVaryClusterERes=vary; } | |
132 | ||
133 | ||
134 | protected: | |
135 | AliESDtrack *GetAcceptTrack(AliESDtrack *esdtrack); | |
136 | Int_t RunOfflineTrigger(); | |
137 | Double_t GetOfflineTriggerProbability(AliESDCaloCluster *cluster); | |
138 | Int_t GetClusterSuperModule(AliESDCaloCluster *cluster); | |
139 | void ProcessMC(const Int_t r=0); | |
140 | void GetMCInfo(); | |
141 | Bool_t IsGoodMcPartilce(const AliVParticle* vParticle, const Int_t ipart); | |
142 | Int_t FindSpatialMatchedJet(fastjet::PseudoJet jet, AliFJWrapper *jetFinder, const Double_t radius); | |
143 | Int_t FindEnergyMatchedJet(AliFJWrapper *jetFinder1, const Int_t index1, AliFJWrapper *jetFinder2, const Double_t fraction=0.5); | |
144 | Bool_t IsPrimaryVertexOk(const Double_t trueVtxZ) const; | |
145 | Bool_t IsTPCOnlyVtx() const; | |
146 | Bool_t IsLEDEvent() const; | |
147 | void CheckExoticEvent(); | |
148 | void CheckEventTriggerBit(); | |
149 | void BookHistos(); | |
150 | void GetESDTrax(); | |
151 | Bool_t IsElectron(AliESDtrack *track, Double_t clsE) const; | |
152 | void GetESDEMCalClusters(); | |
153 | Bool_t IsGoodCluster(AliESDCaloCluster *cluster); | |
154 | Double_t SubtractClusterEnergy(AliESDCaloCluster *cluster, Double_t &eRes, Double_t &MIPE, Double_t &MCsubE); | |
155 | Double_t GetClusterEnergyResolution(AliESDCaloCluster *cluster); | |
156 | void FindDetJets(const Int_t s=0, const Int_t a=0, const Int_t r=0); | |
157 | void FillAODJets(TClonesArray *fJetArray, AliFJWrapper *jetFinder, const Bool_t isTruth = 0); | |
158 | void AnalyzeJets(AliFJWrapper *jetFinder, const Int_t type, const Int_t r); | |
159 | void RunAnalyzeUE(AliFJWrapper *jetFinder); | |
160 | Bool_t IsGoodJet(fastjet::PseudoJet jet, Double_t radius); | |
161 | Bool_t IsGoodJet(AliAODJet *jet, Double_t radius); | |
162 | Double_t GetLeadingZ(const Int_t jetIndex, AliFJWrapper *jetFinder); | |
163 | 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; | |
164 | Double_t GetMeasuredJetPtResolution(const Int_t jetIndex, AliFJWrapper *jetFinder); | |
165 | Double_t GetTrkEff(Double_t inPt); | |
166 | Double_t GetJetMissPtDueToTrackingEfficiency(const Int_t jetIndex, AliFJWrapper *jetFinder, const Int_t radiusIndex); | |
167 | Double_t GetExoticEnergyFraction(AliESDCaloCluster *cluster); | |
168 | Double_t GetSmearedTrackPt(AliESDtrack *track); | |
169 | Double_t GetAdditionalSmearing(AliESDtrack *track); | |
170 | ||
171 | enum { kNBins = 20 }; | |
172 | ||
173 | private: | |
174 | Int_t fVerbosity; // Control output | |
175 | Int_t fEDSFileCounter; // Keep track of the ESD file inside a chain | |
176 | Int_t fNTracksPerChunk; // Number of tracks per ESD file; used for debugging | |
177 | TString fPeriod; // Data period | |
178 | AliESDEvent *fESD; //! ESD object | |
179 | AliAODEvent *fAOD; //! AOD object | |
180 | AliMCEvent *fMC; //! MC object | |
181 | AliStack *fStack; //! MC stack | |
182 | TObjArray *fTrackArray; //! Array of input tracks | |
183 | TObjArray *fClusterArray; //! Array of input clusters | |
184 | TArrayI *fMcPartArray; //! Array of MC particles | |
185 | Bool_t fIsMC; // Flag if analyzing MC data | |
186 | Bool_t fMCStandalone; // Flag if only analyze Particle-Level MC | |
187 | Bool_t fChargedMC; // Flag if finding only charged MC jets | |
188 | Float_t fXsecScale; // Corss section | |
189 | Double_t fCentrality; //! V0M for current event | |
190 | Double_t fZVtxMax; // Max vertex z cut | |
191 | Int_t fTriggerType; // 0-MB, 1-EMC | |
192 | Bool_t fIsTPCOnlyVtx; // Flag of events with ONLY TPC vertex | |
193 | Bool_t fIsExoticEvent3GeV; // Flag of events with exotic cluster above 3 GeV | |
194 | Bool_t fIsExoticEvent5GeV; // Flag of events with exotic cluster above 5 GeV | |
195 | Bool_t fIsEventTriggerBit; // Flag of triggered events with valid trigger bit | |
196 | Bool_t fOfflineTrigger; // Run offline trigger | |
197 | TH2F *fTriggerMask; //! Offline trigger mask | |
198 | TH1D *fTriggerCurve[10]; //! Trigger turn-on curves of EMCal clusters | |
199 | TF1 *fTriggerEfficiency[10]; //! Fit of trigger turn-on curves for EMCal clusters above 4-5 GeV | |
200 | AliEMCALGeometry *fGeom; //! EMCal goemetry utility | |
201 | AliEMCALRecoUtils *fRecoUtil; //! Reco utility | |
202 | AliESDtrackCuts *fEsdTrackCuts; //! Track cuts for good tracks | |
203 | AliESDtrackCuts *fHybridTrackCuts1; //! Track cuts for tracks without SPD hit | |
204 | AliESDtrackCuts *fHybridTrackCuts2; //! Track cuts for tracks witout SPD hit or ITS refit | |
205 | Int_t fTrackCutsType; // 0-Global track, 1-TPCOnly track | |
206 | Int_t fKinCutType; // 0-cut on track before jet finding, 1-cut on jet with high-pt tracks | |
207 | Double_t fTrkEtaMax; // Max |eta| cut | |
208 | Double_t fTrkPtMin[2]; // Min pt cut | |
209 | Double_t fTrkPtMax[2]; // Max pt cut | |
210 | Double_t fdEdxMin; // Min dE/dx cut | |
211 | Double_t fdEdxMax; // Max dE/dx cut | |
212 | Double_t fEoverPMin; // Min E/P cut | |
213 | Double_t fEoverPMax; // Max E/P cut | |
214 | Double_t fClsEtMin[2]; // Min et cut | |
215 | Double_t fClsEtMax[2]; // Max et cut | |
216 | Int_t fMatchType; // 0-extrapolation, 1-extrapolation + MC label | |
217 | Bool_t fRejectExoticCluster; // Flag to reject exotic cluster | |
218 | Bool_t fRemoveBadChannel; // Flag to remove problematic region in SM4 | |
219 | Bool_t fUseGoodSM; // Flag to not use trigger bit in SM2,3,4,5 | |
220 | Bool_t fStudySubEInHC; // If true, the hadronic correction will be ingored. For physics, it should be set to kFALSE | |
221 | Bool_t fStudyMcOverSubE; // Study the over-subtraction of hadronic correction in simualtion. | |
222 | Bool_t fElectronRejection; // Switches on electron correction to avoid double counting of electrons | |
223 | Bool_t fHadronicCorrection; // switches on hadronic correction to avoid double counting of hadrons | |
224 | Float_t fFractionHC; // fraction of hadronic correction | |
225 | Double_t fHCLowerPtCutMIP; // Lower track pt cut for MIP correction | |
226 | TF1 *fClusterEResolution; //! Parameterization of cluster energy resolution from test beam results | |
227 | TF1 *fMCNonLin; //! Non-linearity of simualtion | |
228 | Double_t fJetNEFMin; // Min jet NEF cut | |
229 | Double_t fJetNEFMax; // Max jet NEF cut | |
230 | Bool_t fSpotGoodJet; // Good jet catching | |
231 | Bool_t fFindChargedOnlyJet; // Find jets with TPC tracks | |
232 | Bool_t fFindNeutralOnlyJet; // Find jets with EMCal clusters | |
233 | Bool_t fCheckTrkEffCorr; // Check the procedure of tracking efficiency correction | |
234 | Double_t fTrkEffCorrCutZ; // Cut on the tracks that are added back Z < 0.3 | |
235 | TF1 *fTrkEffFunc[3]; //! Fit function of tracking efficiency | |
236 | TH1F *fhCorrTrkEffPtBin[2][2]; //! Number of tracks per jet pt bin, used to correct the tracking efficiency explicitly | |
237 | TH1F *fhCorrTrkEffSample[2][2][kNBins]; //! Tracking efficiency estimated from simulation | |
238 | TRandom3 *fRandomGen; //! Random number generator | |
239 | Bool_t fRunUE; // Run analysis of underlying event | |
240 | ||
241 | Bool_t fSysJetTrigEff; // Flag of systematic uncertainty of jet trigger efficiency | |
242 | Double_t fVaryJetTrigEff; // Variation of cluster E-scale for systematic uncertainty of jet trigger efficiency | |
243 | Bool_t fSysTrkPtRes; // Flag of systematic uncertainty of tracking momentum resolution | |
244 | Double_t fVaryTrkPtRes; // Variation of tracking momentum resolution | |
245 | Bool_t fSysTrkEff; // Flag of systematic uncertainty of tracking efficiency | |
246 | Double_t fVaryTrkEff; // Variation of tracking efficiency | |
247 | Bool_t fSysTrkClsMth; // Flag of systematic uncertainty of track-cluster matching | |
248 | Double_t fCutdEta; // Variation of dEta cut | |
249 | Double_t fCutdPhi; // Variation of dPhi cut | |
250 | Bool_t fSysNonLinearity; // Flag of systematic uncertainty of EMCal non-linearity | |
251 | Bool_t fSysClusterEScale; // Flag of systematic uncertainty of EMCal energy scale | |
252 | Double_t fVaryClusterEScale; // Variation of EMCal energy scale | |
253 | Bool_t fSysClusterERes; // Flag of systematic uncertainty of EMCal energy resolution | |
254 | Double_t fVaryClusterERes; // Variation of EMCal energy resolution | |
255 | ||
256 | TString fNonStdBranch; //! Non-std branch name for AOD jets | |
257 | TString fNonStdFile; //! Name of optional file that the non-std branch is written to | |
258 | TString fAlgorithm; //! name of algorithm | |
259 | TString fRadius; //! Jet cone radius | |
260 | Int_t fRecombinationScheme; // Recombination scheme of jet finding | |
261 | AliFJWrapper *fDetJetFinder[3][2][2]; //! Jet finder | |
262 | TClonesArray *fJetTCA[3][2][2]; //! TCA of jets: in - akt - 0.4 | |
263 | Bool_t fConstrainChInEMCal; // Constain charged particle to be in EMCal acceptance | |
264 | Bool_t fRejectNK; // Reject neutron and K_L | |
265 | Bool_t fRejectWD; // Reject primaries, mainly k^0_S, that decay weakly | |
266 | Bool_t fSmearMC; // Flag of smearing tracking resolution in MC to match data. Obselete. | |
267 | TF1 *fTrkPtResData; //! Parameterazation of momentum resolution estimated from data | |
268 | AliFJWrapper *fTrueJetFinder[2]; //! Jet finder for particle jets | |
269 | TClonesArray *fMcTruthAntikt[2]; //! TCA of MC truth anti-kt jets | |
270 | ||
271 | TList *fOutputList; //! Output list | |
272 | Bool_t fSaveQAHistos; // Flag of saving QA histograms | |
273 | TH1F *fhJetEventStat; //! Event counts used for jet analysis | |
274 | TH1F *fhEventCheck; //! Event statistics for vertex types | |
275 | TH2F *fhTrkPhiEtaCheck; //! Phi vs Eta of tracks in events with only TPC vertex | |
276 | TH1F *fhChunkQA; //! Check if the chunk is corrupted | |
277 | TH1F *fVertexGenZ[2]; //! Generated event vertex z | |
278 | TH1F *fEventZ[2]; //! reconstructed event vertex z | |
279 | TH1F *fhNTrials[2]; //! # of trials | |
280 | TH1F *fhNMatchedTrack[2]; //! # of matched tracks per cluster | |
281 | TH2F *fhSubEVsTrkPt[2][4]; //! Subtracted energy due to hadronic correction | |
282 | TH2F *fhNeutralPtInJet[3][2]; //! pt of neutral constituents in jet | |
283 | TH2F *fhChargedPtInJet[3][2]; //! pt of charged constituents in jet | |
284 | TH2F *fhLeadNePtInJet[3][2]; //! pt of leading neutral constituents in jet | |
285 | TH2F *fhLeadChPtInJet[3][2]; //! pt of leading charged constituents in jet | |
286 | TH2F *fhChLeadZVsJetPt[2][2]; //! Leading charged constituent Z vs jet pt | |
287 | TH3F *fhJetPtVsZ[3][2]; //! Jet pt vs constituent Z vs constituent type | |
288 | TH3F *fRelTrkCon[2][2]; //! Jet pt vs track pt contribution vs track class | |
289 | TH2F *fhJetPtWithTrkThres[2][2]; //! pt of jets containing tracks above certian threshold | |
290 | TH2F *fhJetPtWithClsThres[2][2]; //! pt of jets containing clusters above certian threshold | |
291 | TH2F *fhJetPtVsLowPtCons[2][2]; //! Contribution of low pt particles to jet energy | |
292 | THnSparse *fJetEnergyFraction[3][2]; //! Jet energy fraction | |
293 | THnSparse *fJetNPartFraction[3][2]; //! Jet NPart fraction | |
294 | TH1F *fJetCount[3][2]; //! pT distribution of pions detected | |
295 | TH2F *fhSubClsEVsJetPt[2][2][5]; //! f*subtracted cluster energy vs jet pt | |
296 | TH2F *fhHCTrkPtClean[2][2][5]; //! Cleanly subtracted charged pt | |
297 | TH2F *fhHCTrkPtAmbig[2][2][5]; //! Ambiguously subtracted charged pt | |
298 | TH2F *fHCOverSubE[2][5]; //! Error made by hadronic correction assessed by using particle jet | |
299 | TH2F *fHCOverSubEFrac[2][5]; //! Error made by hadronic correction assessed by using particle jet | |
300 | TH3F *fhFcrossVsZleading[2][2]; //! Jet pt vs Fcross vs Zleading | |
301 | TH1F *fhJetPtInExoticEvent[2][2]; //! Jet pt in exotic events | |
302 | TH2F *fhJetPtVsUE[2]; //! Underlying event contribution | |
303 | TH1F *fhClsE[2]; //! Cluster energy distribution | |
304 | ||
305 | AliAnalysisTaskFullppJet(const AliAnalysisTaskFullppJet&); // not implemented | |
306 | AliAnalysisTaskFullppJet &operator=(const AliAnalysisTaskFullppJet&); // not implemented | |
307 | ||
308 | ClassDef(AliAnalysisTaskFullppJet, 1); | |
309 | }; | |
310 | ||
311 | #endif |