]>
Commit | Line | Data |
---|---|---|
fdceab34 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //----------------------------------------------------------------------- | |
17 | // This class compares the global reconstruction with the MC information | |
18 | // Momentum resolution is stored as function of track cuts and pt. | |
19 | // Output: Histograms for different set of cuts | |
20 | //----------------------------------------------------------------------- | |
21 | // Author : Marta Verweij - UU | |
22 | //----------------------------------------------------------------------- | |
23 | ||
df943115 | 24 | #ifndef ALIPWG4HighPtQAMC_CXX |
25 | #define ALIPWG4HighPtQAMC_CXX | |
26 | ||
fdceab34 | 27 | #include "AliPWG4HighPtQAMC.h" |
28 | ||
29 | #include "TH1.h" | |
30 | #include "TH2.h" | |
31 | #include "TH3.h" | |
b4691ee7 | 32 | #include "TProfile.h" |
fdceab34 | 33 | #include "TList.h" |
b4691ee7 | 34 | #include "TFile.h" |
fdceab34 | 35 | #include "TChain.h" |
36 | #include "TH3F.h" | |
b4691ee7 | 37 | #include "TKey.h" |
38 | #include "TSystem.h" | |
39 | ||
40 | #include "AliAnalysisTask.h" | |
fdceab34 | 41 | #include "AliAnalysisManager.h" |
42 | #include "AliESDInputHandler.h" | |
43 | #include "AliMCEvent.h" | |
44 | #include "AliMCEventHandler.h" | |
45 | #include "AliStack.h" | |
46 | #include "AliESDtrack.h" | |
47 | #include "AliESDtrackCuts.h" | |
48 | #include "AliExternalTrackParam.h" | |
df943115 | 49 | #include "AliLog.h" |
b4691ee7 | 50 | #include "AliGenPythiaEventHeader.h" |
51 | #include "AliGenCocktailEventHeader.h" | |
52 | //#include "AliAnalysisHelperJetTasks.h" | |
fdceab34 | 53 | |
54 | using namespace std; //required for resolving the 'cout' symbol | |
55 | ||
56 | ClassImp(AliPWG4HighPtQAMC) | |
57 | ||
b4691ee7 | 58 | AliPWG4HighPtQAMC::AliPWG4HighPtQAMC() |
59 | : AliAnalysisTask("AliPWG4HighPtQAMC", ""), | |
fdceab34 | 60 | fESD(0), |
b1cd0099 | 61 | fMC(0), |
cce400da | 62 | fStack(0), |
36c36a0c | 63 | fVtx(0x0), |
fdceab34 | 64 | fTrackCuts(0), |
65 | fTrackCutsITS(0), | |
71e77a79 | 66 | fTrackType(0), |
b1cd0099 | 67 | fPtMax(100.), |
b4691ee7 | 68 | fAvgTrials(1), |
8f0faa80 | 69 | fNEventAll(0), |
70 | fNEventSel(0), | |
cb76764e | 71 | fNEventReject(0), |
b4691ee7 | 72 | fh1Xsec(0), |
73 | fh1Trials(0), | |
74 | fh1PtHard(0), | |
75 | fh1PtHardTrials(0), | |
df943115 | 76 | fPtAll(0), |
77 | fPtSel(0), | |
36c36a0c | 78 | fPtSelFakes(0), |
79 | fNPointTPCFakes(0), | |
80 | fPtSelLargeLabel(0), | |
81 | fMultRec(0), | |
82 | fNPointTPCMultRec(0), | |
83 | fDeltaPtMultRec(0), | |
57bee263 | 84 | fPtAllvsPtMC(0), |
fdceab34 | 85 | fPtAllminPtMCvsPtAll(0), |
57bee263 | 86 | fPtAllvsPtMCvsMult(0), |
87 | fPtAllminPtMCvsPtAllvsMult(0), | |
fdceab34 | 88 | fPtAllminPtMCvsPtAllNPointTPC(0), |
89 | fPtAllminPtMCvsPtAllDCAR(0), | |
90 | fPtAllminPtMCvsPtAllDCAZ(0), | |
91 | fPtAllminPtMCvsPtAllPhi(0), | |
92 | fPtAllminPtMCvsPtAllNPointITS(0), | |
93 | fPtAllminPtMCvsPtAllNSigmaToVertex(0), | |
94 | fPtAllminPtMCvsPtAllChi2C(0), | |
95 | fPtAllminPtMCvsPtAllRel1PtUncertainty(0), | |
96 | fPtAllMC(0), | |
97 | fPtSelMC(0), | |
98 | fPtSelMCITS(0), | |
99 | fHistList(0), | |
100 | fPtSelITS(0), | |
101 | fPtITSminPtMCvsPtITS(0), | |
102 | fPtITSminPtMCvsPtITSNPointTPC(0), | |
103 | fPtITSminPtMCvsPtITSDCAR(0), | |
104 | fPtITSminPtMCvsPtITSDCAZ(0), | |
105 | fPtITSminPtMCvsPtITSPhi(0), | |
106 | fPtITSminPtMCvsPtITSNPointITS(0), | |
107 | fPtITSminPtMCvsPtITSNSigmaToVertex(0), | |
108 | fPtITSminPtMCvsPtITSChi2C(0), | |
109 | fPtITSminPtMCvsPtITSRel1PtUncertainty(0), | |
110 | fHistListITS(0) | |
111 | { | |
df943115 | 112 | |
fdceab34 | 113 | } |
114 | //________________________________________________________________________ | |
115 | AliPWG4HighPtQAMC::AliPWG4HighPtQAMC(const char *name): | |
b4691ee7 | 116 | AliAnalysisTask(name,""), |
fdceab34 | 117 | fESD(0), |
b1cd0099 | 118 | fMC(0), |
cce400da | 119 | fStack(0), |
36c36a0c | 120 | fVtx(0x0), |
fdceab34 | 121 | fTrackCuts(), |
122 | fTrackCutsITS(), | |
71e77a79 | 123 | fTrackType(0), |
b1cd0099 | 124 | fPtMax(100.), |
b4691ee7 | 125 | fAvgTrials(1), |
8f0faa80 | 126 | fNEventAll(0), |
127 | fNEventSel(0), | |
cb76764e | 128 | fNEventReject(0), |
b4691ee7 | 129 | fh1Xsec(0), |
130 | fh1Trials(0), | |
131 | fh1PtHard(0), | |
132 | fh1PtHardTrials(0), | |
df943115 | 133 | fPtAll(0), |
134 | fPtSel(0), | |
36c36a0c | 135 | fPtSelFakes(0), |
136 | fNPointTPCFakes(0), | |
137 | fPtSelLargeLabel(0), | |
138 | fMultRec(0), | |
139 | fNPointTPCMultRec(0), | |
140 | fDeltaPtMultRec(0), | |
57bee263 | 141 | fPtAllvsPtMC(0), |
fdceab34 | 142 | fPtAllminPtMCvsPtAll(0), |
57bee263 | 143 | fPtAllvsPtMCvsMult(0), |
144 | fPtAllminPtMCvsPtAllvsMult(0), | |
fdceab34 | 145 | fPtAllminPtMCvsPtAllNPointTPC(0), |
146 | fPtAllminPtMCvsPtAllDCAR(0), | |
147 | fPtAllminPtMCvsPtAllDCAZ(0), | |
148 | fPtAllminPtMCvsPtAllPhi(0), | |
149 | fPtAllminPtMCvsPtAllNPointITS(0), | |
150 | fPtAllminPtMCvsPtAllNSigmaToVertex(0), | |
151 | fPtAllminPtMCvsPtAllChi2C(0), | |
152 | fPtAllminPtMCvsPtAllRel1PtUncertainty(0), | |
153 | fPtAllMC(0), | |
154 | fPtSelMC(0), | |
155 | fPtSelMCITS(0), | |
156 | fHistList(0), | |
157 | fPtSelITS(0), | |
158 | fPtITSminPtMCvsPtITS(0), | |
159 | fPtITSminPtMCvsPtITSNPointTPC(0), | |
160 | fPtITSminPtMCvsPtITSDCAR(0), | |
161 | fPtITSminPtMCvsPtITSDCAZ(0), | |
162 | fPtITSminPtMCvsPtITSPhi(0), | |
163 | fPtITSminPtMCvsPtITSNPointITS(0), | |
164 | fPtITSminPtMCvsPtITSNSigmaToVertex(0), | |
165 | fPtITSminPtMCvsPtITSChi2C(0), | |
166 | fPtITSminPtMCvsPtITSRel1PtUncertainty(0), | |
167 | fHistListITS(0) | |
168 | { | |
169 | // | |
170 | // Constructor. Initialization of Inputs and Outputs | |
171 | // | |
f51451be | 172 | AliDebug(2,Form("AliPWG4HighPtQAMC Calling Constructor")); |
fdceab34 | 173 | // Input slot #0 works with a TChain ESD |
174 | DefineInput(0, TChain::Class()); | |
b4691ee7 | 175 | // Output slot #0, #1 write into a TList |
fdceab34 | 176 | DefineOutput(0, TList::Class()); |
fdceab34 | 177 | DefineOutput(1, TList::Class()); |
df943115 | 178 | } |
fdceab34 | 179 | |
180 | //________________________________________________________________________ | |
181 | void AliPWG4HighPtQAMC::ConnectInputData(Option_t *) | |
182 | { | |
b1cd0099 | 183 | // Connect ESD and MC event handler here |
fdceab34 | 184 | // Called once |
df943115 | 185 | AliDebug(2,Form(">> AliPWG4HighPtSpectra::ConnectInputData \n")); |
fdceab34 | 186 | TTree* tree = dynamic_cast<TTree*> (GetInputData(0)); |
187 | if (!tree) { | |
b1cd0099 | 188 | AliDebug(2,Form( "ERROR: Could not read chain from input slot 0 \n")); |
189 | return; | |
fdceab34 | 190 | } |
b1cd0099 | 191 | |
192 | AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
193 | ||
194 | if (!esdH) { | |
195 | AliDebug(2,Form("ERROR: Could not get ESDInputHandler")); | |
196 | return; | |
197 | } else | |
198 | fESD = esdH->GetEvent(); | |
199 | ||
cce400da | 200 | AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); |
201 | if (!eventHandler) { | |
202 | AliDebug(2,Form( "ERROR: Could not retrieve MC event handler \n")); | |
203 | } | |
b1cd0099 | 204 | else |
205 | fMC = eventHandler->MCEvent(); | |
206 | ||
fdceab34 | 207 | } |
208 | ||
b4691ee7 | 209 | |
fdceab34 | 210 | //________________________________________________________________________ |
211 | void AliPWG4HighPtQAMC::CreateOutputObjects() { | |
212 | //Create output objects | |
df943115 | 213 | AliDebug(2,Form(">> AliPWG4HighPtQATPConly::CreateOutputObjects \n")); |
214 | ||
215 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
216 | TH1::AddDirectory(kFALSE); | |
217 | ||
fdceab34 | 218 | OpenFile(0); |
219 | fHistList = new TList(); | |
b4691ee7 | 220 | fHistList->SetOwner(kTRUE); |
fdceab34 | 221 | OpenFile(1); |
222 | fHistListITS = new TList(); | |
b4691ee7 | 223 | fHistListITS->SetOwner(kTRUE); |
fdceab34 | 224 | |
225 | Int_t fgkNPhiBins=18; | |
226 | Float_t kMinPhi = 0.; | |
227 | Float_t kMaxPhi = 2.*TMath::Pi(); | |
228 | ||
57bee263 | 229 | Int_t fgkNPtBins=100; |
230 | Float_t fgkPtMin=0.;//2.; | |
b1cd0099 | 231 | Float_t fgkPtMax=fPtMax; |
8f0faa80 | 232 | Int_t fgkResPtBins=80; |
fdceab34 | 233 | |
57bee263 | 234 | Int_t fgkNMultBins = 50; |
235 | Float_t fgkMultMin = 0; | |
236 | Float_t fgkMultMax = 500; | |
237 | ||
8f0faa80 | 238 | fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5); |
239 | fHistList->Add(fNEventAll); | |
240 | fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5); | |
241 | fHistList->Add(fNEventSel); | |
cb76764e | 242 | fNEventReject = new TH1F("fNEventReject","Reason events are rejectected for analysis",20,0,20); |
36c36a0c | 243 | //Set labels |
244 | fNEventReject->Fill("noESD",0); | |
245 | fNEventReject->Fill("Trigger",0); | |
246 | fNEventReject->Fill("noMCEvent",0); | |
11245558 | 247 | fNEventReject->Fill("noStack",0); |
36c36a0c | 248 | fNEventReject->Fill("NTracks<2",0); |
249 | fNEventReject->Fill("noVTX",0); | |
250 | fNEventReject->Fill("VtxStatus",0); | |
251 | fNEventReject->Fill("NCont<2",0); | |
252 | fNEventReject->Fill("ZVTX>10",0); | |
cb76764e | 253 | fHistList->Add(fNEventReject); |
b4691ee7 | 254 | |
255 | fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1); | |
256 | fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>"); | |
257 | fHistList->Add(fh1Xsec); | |
258 | ||
259 | fh1Trials = new TH1F("fh1Trials","trials root file",1,0,1); | |
260 | fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}"); | |
261 | fHistList->Add(fh1Trials); | |
262 | ||
263 | fh1PtHard = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5); | |
264 | fHistList->Add(fh1PtHard); | |
265 | fh1PtHardTrials = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5); | |
266 | fHistList->Add(fh1PtHardTrials); | |
267 | ||
fdceab34 | 268 | fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax); |
269 | fHistList->Add(fPtAll); | |
270 | fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax); | |
271 | fHistList->Add(fPtSel); | |
36c36a0c | 272 | |
273 | fPtSelFakes = new TH1F("fPtSelFakes","PtSelFakes",fgkNPtBins, fgkPtMin, fgkPtMax); | |
274 | fHistList->Add(fPtSelFakes); | |
275 | ||
276 | fNPointTPCFakes = new TH1F("fNPointTPCFakes","fNPointTPCFakes",160,0.5,160.5); | |
277 | fHistList->Add(fNPointTPCFakes); | |
278 | ||
279 | fPtSelLargeLabel = new TH1F("fPtSelLargeLabel","PtSelLargeLabel",fgkNPtBins, fgkPtMin, fgkPtMax); | |
280 | fHistList->Add(fPtSelLargeLabel); | |
281 | ||
282 | fMultRec = new TH1F("fMultRec","Multiple reconstruction of tracks",20,0,20); | |
283 | fHistList->Add(fMultRec); | |
284 | ||
285 | fNPointTPCMultRec = new TH1F("fNPointTPCMultRec","Multiple reconstruction of tracks",160,0.5,160.5); | |
286 | fHistList->Add(fNPointTPCMultRec); | |
287 | ||
288 | fDeltaPtMultRec = new TH2F("fDeltaPtMultRec","Delta pT vs pT for multiple reconstructed tracks",100,0.,50.,100,-20.,20.); | |
289 | fHistList->Add(fDeltaPtMultRec); | |
290 | ||
57bee263 | 291 | fPtAllvsPtMC = new TH2F("fPtAllvsPtMC","fPtAllvsPtMC;p_{T,MC};p_{T,rec}",fgkNPtBins, fgkPtMin,fgkPtMax,fgkNPtBins, fgkPtMin,fgkPtMax); |
292 | fHistList->Add(fPtAllvsPtMC); | |
293 | ||
fdceab34 | 294 | fPtAllminPtMCvsPtAll = new TH2F("fPtAllminPtMCvsPtAll","PtAllminPtMCvsPtAll",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.); |
295 | fPtAllminPtMCvsPtAll->SetXTitle("p_{t}^{MC}"); | |
296 | fPtAllminPtMCvsPtAll->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
297 | fHistList->Add(fPtAllminPtMCvsPtAll); | |
57bee263 | 298 | |
299 | fPtAllvsPtMCvsMult = new TH3F("fPtAllvsPtMCvsMult","fPtAllvsPtMCvsMult;p_{T,MC};p_{T,rec};N_{tracks}",fgkNPtBins, fgkPtMin,fgkPtMax,fgkNPtBins, fgkPtMin,fgkPtMax,fgkNMultBins,fgkMultMin,fgkMultMax); | |
300 | fHistList->Add(fPtAllvsPtMCvsMult); | |
301 | ||
302 | fPtAllminPtMCvsPtAllvsMult = new TH3F("fPtAllminPtMCvsPtAllvsMult","fPtAllminPtMCvsPtAllvsMult",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNMultBins,fgkMultMin,fgkMultMax); | |
303 | fPtAllminPtMCvsPtAllvsMult->SetXTitle("p_{t}^{MC}"); | |
304 | fPtAllminPtMCvsPtAllvsMult->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
305 | fPtAllminPtMCvsPtAllvsMult->SetZTitle("N_{tracks}"); | |
306 | fHistList->Add(fPtAllminPtMCvsPtAllvsMult); | |
fdceab34 | 307 | |
308 | fPtAllminPtMCvsPtAllNPointTPC = new TH3F("fPtAllminPtMCvsPtAllNPointTPC","PtAllminPtMCvsPtAllNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5); | |
309 | fPtAllminPtMCvsPtAllNPointTPC->SetXTitle("p_{t}^{MC}"); | |
310 | fPtAllminPtMCvsPtAllNPointTPC->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
311 | fPtAllminPtMCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}"); | |
312 | fHistList->Add(fPtAllminPtMCvsPtAllNPointTPC); | |
313 | ||
8f0faa80 | 314 | fPtAllminPtMCvsPtAllDCAR = new TH3F("fPtAllminPtMCvsPtAllDCAR","PtAllminPtMCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2); |
fdceab34 | 315 | fPtAllminPtMCvsPtAllDCAR->SetXTitle("p_{t}^{MC}"); |
316 | fPtAllminPtMCvsPtAllDCAR->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
317 | fPtAllminPtMCvsPtAllDCAR->SetZTitle("DCA_{R}"); | |
318 | fHistList->Add(fPtAllminPtMCvsPtAllDCAR); | |
319 | ||
8f0faa80 | 320 | fPtAllminPtMCvsPtAllDCAZ = new TH3F("fPtAllminPtMCvsPtAllDCAZ","PtAllminPtMCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.); |
fdceab34 | 321 | fPtAllminPtMCvsPtAllDCAZ->SetXTitle("p_{t}^{MC}"); |
322 | fPtAllminPtMCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
323 | fPtAllminPtMCvsPtAllDCAZ->SetZTitle("DCA_{Z}"); | |
324 | fHistList->Add(fPtAllminPtMCvsPtAllDCAZ); | |
325 | ||
326 | fPtAllminPtMCvsPtAllPhi = new TH3F("fPtAllminPtMCvsPtAllPhi","PtAllminPtMCvsPtAllPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi); | |
327 | fPtAllminPtMCvsPtAllPhi->SetXTitle("p_{t}^{MC}"); | |
328 | fPtAllminPtMCvsPtAllPhi->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
329 | fPtAllminPtMCvsPtAllPhi->SetZTitle("#phi"); | |
330 | fHistList->Add(fPtAllminPtMCvsPtAllPhi); | |
331 | ||
332 | fPtAllminPtMCvsPtAllNPointITS = new TH3F("fPtAllminPtMCvsPtAllNPointITS","PtAllminPtMCvsPtAllNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5); | |
333 | fPtAllminPtMCvsPtAllNPointITS->SetXTitle("p_{t}^{MC}"); | |
334 | fPtAllminPtMCvsPtAllNPointITS->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
335 | fPtAllminPtMCvsPtAllNPointITS->SetZTitle("N_{point,ITS}}"); | |
336 | fHistList->Add(fPtAllminPtMCvsPtAllNPointITS); | |
337 | ||
338 | fPtAllminPtMCvsPtAllNSigmaToVertex = new TH3F("fPtAllminPtMCvsPtAllNSigmaToVertex","PtAllminPtMCvsPtAllNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.); | |
339 | fPtAllminPtMCvsPtAllNSigmaToVertex->SetXTitle("p_{t}^{MC}"); | |
340 | fPtAllminPtMCvsPtAllNSigmaToVertex->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
341 | fPtAllminPtMCvsPtAllNSigmaToVertex->SetZTitle("N#sigma to vertex"); | |
342 | fHistList->Add(fPtAllminPtMCvsPtAllNSigmaToVertex); | |
343 | ||
344 | fPtAllminPtMCvsPtAllChi2C = new TH3F("fPtAllminPtMCvsPtAllChi2C","PtAllminPtMCvsPtAllChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.); | |
345 | fPtAllminPtMCvsPtAllChi2C->SetXTitle("p_{t}^{MC}"); | |
346 | fPtAllminPtMCvsPtAllChi2C->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
347 | fPtAllminPtMCvsPtAllChi2C->SetZTitle("Constrained #chi^{2}"); | |
348 | fHistList->Add(fPtAllminPtMCvsPtAllChi2C); | |
349 | ||
350 | fPtAllminPtMCvsPtAllRel1PtUncertainty = new TH3F("fPtAllminPtMCvsPtAllRel1PtUncertainty","PtAllminPtMCvsPtAllRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3); | |
351 | fPtAllminPtMCvsPtAllRel1PtUncertainty->SetXTitle("p_{t}^{MC}"); | |
352 | fPtAllminPtMCvsPtAllRel1PtUncertainty->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
353 | fPtAllminPtMCvsPtAllRel1PtUncertainty->SetZTitle("Rel1PtUncertainty"); | |
354 | fHistList->Add(fPtAllminPtMCvsPtAllRel1PtUncertainty); | |
355 | ||
356 | //ITSrefit | |
357 | fPtSelITS = new TH1F("fPtSelITSrefit","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax); | |
358 | fHistListITS->Add(fPtSelITS); | |
359 | ||
360 | fPtITSminPtMCvsPtITS = new TH2F("fPtITSminPtMCvsPtITS","PtITSminPtMCvsPtITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.); | |
361 | fPtITSminPtMCvsPtITS->SetXTitle("p_{t}^{MC}"); | |
362 | fPtITSminPtMCvsPtITS->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
363 | fHistListITS->Add(fPtITSminPtMCvsPtITS); | |
364 | ||
365 | fPtITSminPtMCvsPtITSNPointTPC = new TH3F("fPtITSminPtMCvsPtITSNPointTPC","PtITSminPtMCvsPtITSNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5); | |
366 | fPtITSminPtMCvsPtITSNPointTPC->SetXTitle("p_{t}^{MC}"); | |
367 | fPtITSminPtMCvsPtITSNPointTPC->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
368 | fPtITSminPtMCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}"); | |
369 | fHistListITS->Add(fPtITSminPtMCvsPtITSNPointTPC); | |
370 | ||
8f0faa80 | 371 | fPtITSminPtMCvsPtITSDCAR = new TH3F("fPtITSminPtMCvsPtITSDCAR","PtITSminPtMCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2); |
fdceab34 | 372 | fPtITSminPtMCvsPtITSDCAR->SetXTitle("p_{t}^{MC}"); |
373 | fPtITSminPtMCvsPtITSDCAR->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
374 | fPtITSminPtMCvsPtITSDCAR->SetZTitle("DCA_{R}"); | |
375 | fHistListITS->Add(fPtITSminPtMCvsPtITSDCAR); | |
376 | ||
8f0faa80 | 377 | fPtITSminPtMCvsPtITSDCAZ = new TH3F("fPtITSminPtMCvsPtITSDCAZ","PtITSminPtMCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.); |
fdceab34 | 378 | fPtITSminPtMCvsPtITSDCAZ->SetXTitle("p_{t}^{MC}"); |
379 | fPtITSminPtMCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
380 | fPtITSminPtMCvsPtITSDCAZ->SetZTitle("DCA_{Z}"); | |
381 | fHistListITS->Add(fPtITSminPtMCvsPtITSDCAZ); | |
382 | ||
383 | fPtITSminPtMCvsPtITSPhi = new TH3F("fPtITSminPtMCvsPtITSPhi","PtITSminPtMCvsPtITSPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi); | |
384 | fPtITSminPtMCvsPtITSPhi->SetXTitle("p_{t}^{MC}"); | |
385 | fPtITSminPtMCvsPtITSPhi->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
386 | fPtITSminPtMCvsPtITSPhi->SetZTitle("#phi"); | |
387 | fHistListITS->Add(fPtITSminPtMCvsPtITSPhi); | |
388 | ||
389 | fPtITSminPtMCvsPtITSNPointITS = new TH3F("fPtITSminPtMCvsPtITSNPointITS","PtITSminPtMCvsPtITSNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5); | |
390 | fPtITSminPtMCvsPtITSNPointITS->SetXTitle("p_{t}^{MC}"); | |
391 | fPtITSminPtMCvsPtITSNPointITS->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})}"); | |
392 | fPtITSminPtMCvsPtITSNPointITS->SetZTitle("N_{point,ITS}}"); | |
393 | fHistListITS->Add(fPtITSminPtMCvsPtITSNPointITS); | |
394 | ||
395 | fPtITSminPtMCvsPtITSNSigmaToVertex = new TH3F("fPtITSminPtMCvsPtITSNSigmaToVertex","PtITSminPtMCvsPtITSNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.); | |
396 | fPtITSminPtMCvsPtITSNSigmaToVertex->SetXTitle("p_{t}^{MC}"); | |
397 | fPtITSminPtMCvsPtITSNSigmaToVertex->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
398 | fPtITSminPtMCvsPtITSNSigmaToVertex->SetZTitle("N#sigma to vertex"); | |
399 | fHistListITS->Add(fPtITSminPtMCvsPtITSNSigmaToVertex); | |
400 | ||
401 | fPtITSminPtMCvsPtITSChi2C = new TH3F("fPtITSminPtMCvsPtITSChi2C","PtITSminPtMCvsPtITSChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.); | |
402 | fPtITSminPtMCvsPtITSChi2C->SetXTitle("p_{t}^{MC}"); | |
403 | fPtITSminPtMCvsPtITSChi2C->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
404 | fPtITSminPtMCvsPtITSChi2C->SetZTitle("Constrained #chi^{2}"); | |
405 | fHistListITS->Add(fPtITSminPtMCvsPtITSChi2C); | |
406 | ||
407 | fPtITSminPtMCvsPtITSRel1PtUncertainty = new TH3F("fPtITSminPtMCvsPtITSRel1PtUncertainty","PtITSminPtMCvsPtITSRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3); | |
408 | fPtITSminPtMCvsPtITSRel1PtUncertainty->SetXTitle("p_{t}^{MC}"); | |
409 | fPtITSminPtMCvsPtITSRel1PtUncertainty->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})"); | |
410 | fPtITSminPtMCvsPtITSRel1PtUncertainty->SetZTitle("Rel1PtUncertainty"); | |
411 | fHistListITS->Add(fPtITSminPtMCvsPtITSRel1PtUncertainty); | |
412 | ||
413 | fPtAllMC = new TH1F("fPtAllMC","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax); | |
414 | fHistList->Add(fPtAllMC); | |
415 | fPtSelMC = new TH1F("fPtSelMC","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax); | |
416 | fHistList->Add(fPtSelMC); | |
417 | fPtSelMCITS = new TH1F("fPtSelMCITS","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax); | |
418 | fHistList->Add(fPtSelMCITS); | |
419 | ||
df943115 | 420 | TH1::AddDirectory(oldStatus); |
421 | ||
11245558 | 422 | PostData(0, fHistList); |
423 | PostData(1, fHistListITS); | |
424 | ||
fdceab34 | 425 | } |
cce400da | 426 | |
fdceab34 | 427 | //________________________________________________________________________ |
cce400da | 428 | Bool_t AliPWG4HighPtQAMC::SelectEvent() { |
429 | // | |
430 | // Decide if event should be selected for analysis | |
431 | // | |
8f0faa80 | 432 | |
cce400da | 433 | // Checks following requirements: |
434 | // - fESD available | |
435 | // - trigger info from AliPhysicsSelection | |
436 | // - MCevent available | |
437 | // - number of reconstructed tracks > 1 | |
438 | // - primary vertex reconstructed | |
439 | // - z-vertex < 10 cm | |
440 | ||
441 | Bool_t selectEvent = kTRUE; | |
442 | ||
443 | //fESD object available? | |
fdceab34 | 444 | if (!fESD) { |
b4691ee7 | 445 | AliDebug(2,Form("ERROR: fInputEvent not available\n")); |
cb76764e | 446 | fNEventReject->Fill("noESD",1); |
cce400da | 447 | selectEvent = kFALSE; |
448 | return selectEvent; | |
fdceab34 | 449 | } |
450 | ||
cce400da | 451 | //Trigger |
bfd58011 | 452 | UInt_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected(); |
453 | if(!(isSelected&AliVEvent::kMB)) { //Select collison candidates | |
8f0faa80 | 454 | AliDebug(2,Form(" Trigger Selection: event REJECTED ... ")); |
cb76764e | 455 | fNEventReject->Fill("Trigger",1); |
cce400da | 456 | selectEvent = kFALSE; |
457 | return selectEvent; | |
8f0faa80 | 458 | } |
cce400da | 459 | |
460 | //MCEvent available? | |
461 | //if yes: get stack | |
b1cd0099 | 462 | if(fMC) { |
463 | AliDebug(2,Form("MC particles: %d", fMC->GetNumberOfTracks())); | |
cce400da | 464 | fStack = fMC->Stack(); //Particles Stack |
11245558 | 465 | if(fStack) { |
466 | AliDebug(2,Form("MC particles stack: %d", fStack->GetNtrack())); | |
467 | } | |
468 | else { | |
469 | AliDebug(2,Form("ERROR: Could not retrieve MC eventHandler")); | |
470 | fNEventReject->Fill("noStack",1); | |
471 | selectEvent = kFALSE; | |
472 | return selectEvent; | |
473 | } | |
b1cd0099 | 474 | } else { |
11245558 | 475 | AliDebug(2,Form("ERROR: Could not retrieve stack")); |
cb76764e | 476 | fNEventReject->Fill("noMCEvent",1); |
cce400da | 477 | selectEvent = kFALSE; |
478 | return selectEvent; | |
fdceab34 | 479 | } |
480 | ||
cce400da | 481 | //Check if number of reconstructed tracks is larger than 1 |
482 | if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2) { | |
483 | fNEventReject->Fill("NTracks<2",1); | |
484 | selectEvent = kFALSE; | |
485 | return selectEvent; | |
cb76764e | 486 | } |
b4691ee7 | 487 | |
cce400da | 488 | //Check if vertex is reconstructed |
36c36a0c | 489 | if(fTrackType==1) fVtx = fESD->GetPrimaryVertexTPC(); |
490 | else fVtx = fESD->GetPrimaryVertexSPD(); | |
491 | ||
492 | if(!fVtx) { | |
493 | fNEventReject->Fill("noVTX",1); | |
494 | selectEvent = kFALSE; | |
495 | return selectEvent; | |
496 | } | |
497 | ||
498 | if(!fVtx->GetStatus()) { | |
499 | fNEventReject->Fill("VtxStatus",1); | |
500 | selectEvent = kFALSE; | |
501 | return selectEvent; | |
502 | } | |
503 | ||
fdceab34 | 504 | // Need vertex cut |
36c36a0c | 505 | // TString vtxName(fVtx->GetName()); |
506 | if(fVtx->GetNContributors()<2) { | |
507 | fNEventReject->Fill("NCont<2",1); | |
508 | selectEvent = kFALSE; | |
509 | return selectEvent; | |
8f0faa80 | 510 | } |
36c36a0c | 511 | |
cce400da | 512 | //Check if z-vertex < 10 cm |
75946d5d | 513 | double primVtx[3]; |
36c36a0c | 514 | fVtx->GetXYZ(primVtx); |
8f0faa80 | 515 | if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){ |
cb76764e | 516 | fNEventReject->Fill("ZVTX>10",1); |
cce400da | 517 | selectEvent = kFALSE; |
518 | return selectEvent; | |
8f0faa80 | 519 | } |
36c36a0c | 520 | |
521 | AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",fVtx->GetTitle(), fVtx->GetStatus(), fVtx->GetNContributors())); | |
fdceab34 | 522 | |
cce400da | 523 | return selectEvent; |
524 | ||
525 | } | |
526 | ||
527 | //________________________________________________________________________ | |
528 | void AliPWG4HighPtQAMC::Exec(Option_t *) { | |
529 | // Main loop | |
530 | // Called for each event | |
531 | AliDebug(2,Form(">> AliPWG4HighPtQATPConly::Exec \n")); | |
532 | // All events without selection | |
533 | fNEventAll->Fill(0.); | |
534 | ||
535 | if(!SelectEvent()) { | |
536 | // Post output data | |
8f0faa80 | 537 | PostData(0, fHistList); |
538 | PostData(1, fHistListITS); | |
539 | return; | |
540 | } | |
fdceab34 | 541 | |
cce400da | 542 | // ---- Get MC Header information (for MC productions in pThard bins) ---- |
543 | Double_t ptHard = 0.; | |
544 | Double_t nTrials = 1; // trials for MC trigger weight for real data | |
545 | ||
546 | if(fMC){ | |
547 | AliGenPythiaEventHeader* pythiaGenHeader = GetPythiaEventHeader(fMC); | |
548 | if(pythiaGenHeader){ | |
549 | nTrials = pythiaGenHeader->Trials(); | |
550 | ptHard = pythiaGenHeader->GetPtHard(); | |
551 | ||
552 | fh1PtHard->Fill(ptHard); | |
553 | fh1PtHardTrials->Fill(ptHard,nTrials); | |
554 | ||
555 | fh1Trials->Fill("#sum{ntrials}",fAvgTrials); | |
556 | } | |
557 | } | |
558 | ||
b4691ee7 | 559 | //Need to keep track of selected events |
560 | fNEventSel->Fill(0.); | |
561 | ||
fdceab34 | 562 | Int_t nTracks = fESD->GetNumberOfTracks(); |
b1cd0099 | 563 | AliDebug(2,Form("nTracks ESD%d", nTracks)); |
df943115 | 564 | |
cce400da | 565 | int nMCtracks = fStack->GetNtrack(); |
cba109a0 | 566 | |
71e77a79 | 567 | Float_t pt = 0.; |
568 | Float_t ptMC = 0.; | |
569 | Float_t phi = 0.; | |
570 | Float_t dca2D = 0.; | |
571 | Float_t dcaZ = 0.; | |
572 | Int_t nPointITS = 0; | |
573 | Float_t chi2C = 0.; | |
574 | Float_t nSigmaToVertex = 0.; | |
575 | Float_t relUncertainty1Pt = 0.; | |
576 | ||
fdceab34 | 577 | for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) { |
578 | ||
71e77a79 | 579 | AliESDtrack *track; |
580 | AliESDtrack *esdtrack = fESD->GetTrack(iTrack); | |
581 | if(!esdtrack) continue; | |
71e77a79 | 582 | |
d756027f | 583 | if(fTrackType==1 || fTrackType==3) |
71e77a79 | 584 | track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID()); |
36c36a0c | 585 | else if(fTrackType==2) { |
586 | track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID()); | |
587 | if(!track) { | |
588 | delete track; | |
589 | continue; | |
590 | } | |
591 | AliExternalTrackParam exParam; | |
592 | Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam); | |
593 | if( !relate ) { | |
594 | delete track; | |
595 | continue; | |
596 | } | |
597 | track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance()); | |
598 | } | |
71e77a79 | 599 | else |
600 | track = esdtrack; | |
71e77a79 | 601 | |
36c36a0c | 602 | if(!track) { |
603 | if(fTrackType==1 || fTrackType==2) delete track; | |
604 | continue; | |
605 | } | |
71e77a79 | 606 | |
fdceab34 | 607 | Int_t label = TMath::Abs(track->GetLabel()); |
36c36a0c | 608 | if(label>=nMCtracks) { |
609 | if (fTrackCuts->AcceptTrack(track)) { fPtSelLargeLabel->Fill(pt); } | |
610 | if(fTrackType==1 || fTrackType==2) delete track; | |
611 | continue; | |
612 | } | |
cce400da | 613 | TParticle *particle = fStack->Particle(label) ; |
36c36a0c | 614 | if(!particle) { |
615 | if(fTrackType==1 || fTrackType==2) delete track; | |
616 | continue; | |
617 | } | |
fdceab34 | 618 | |
71e77a79 | 619 | ptMC = particle->Pt(); |
620 | ||
621 | if(fTrackType==0) { //Global | |
622 | pt = track->Pt(); | |
623 | phi = track->Phi(); | |
624 | track->GetImpactParameters(dca2D,dcaZ); | |
625 | } | |
36c36a0c | 626 | else if(fTrackType==1 || fTrackType==2) { //TPConly |
627 | pt = track->Pt(); | |
628 | phi = track->Phi(); | |
71e77a79 | 629 | track->GetImpactParametersTPC(dca2D,dcaZ); |
630 | } | |
631 | else {continue;} | |
632 | ||
633 | ||
fdceab34 | 634 | UChar_t itsMap = track->GetITSClusterMap(); |
fdceab34 | 635 | for (Int_t i=0; i < 6; i++) { |
636 | if (itsMap & (1 << i)) | |
637 | nPointITS ++; | |
638 | } | |
71e77a79 | 639 | nSigmaToVertex = fTrackCuts->GetSigmaToVertex(track);// Calculates the number of sigma to the vertex for a track. |
640 | chi2C = track->GetConstrainedChi2(); | |
641 | relUncertainty1Pt = TMath::Sqrt(track->GetSigma1Pt2())*pt; | |
642 | ||
fdceab34 | 643 | fPtAll->Fill(pt); |
644 | fPtAllMC->Fill(ptMC); | |
71e77a79 | 645 | |
fdceab34 | 646 | if (fTrackCuts->AcceptTrack(track)) { |
647 | ||
648 | fPtSel->Fill(pt); | |
36c36a0c | 649 | if(track->GetLabel()<0) { |
650 | fPtSelFakes->Fill(pt); | |
651 | fNPointTPCFakes->Fill(track->GetTPCNcls()); | |
652 | } | |
fdceab34 | 653 | fPtSelMC->Fill(ptMC); |
57bee263 | 654 | fPtAllvsPtMC->Fill(ptMC,pt); |
fdceab34 | 655 | fPtAllminPtMCvsPtAll->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC) ); |
656 | fPtAllminPtMCvsPtAllNPointTPC->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),track->GetTPCNcls()); | |
657 | fPtAllminPtMCvsPtAllDCAR->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),dca2D); | |
658 | fPtAllminPtMCvsPtAllDCAZ->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),dcaZ); | |
659 | fPtAllminPtMCvsPtAllPhi->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),phi); | |
660 | fPtAllminPtMCvsPtAllNPointITS->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),nPointITS); | |
661 | fPtAllminPtMCvsPtAllNSigmaToVertex->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),nSigmaToVertex); | |
662 | fPtAllminPtMCvsPtAllChi2C->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),chi2C); | |
663 | fPtAllminPtMCvsPtAllRel1PtUncertainty->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),relUncertainty1Pt); | |
36c36a0c | 664 | |
57bee263 | 665 | int mult = fTrackCuts->CountAcceptedTracks(fESD); |
666 | fPtAllvsPtMCvsMult->Fill(ptMC,pt,mult); | |
667 | fPtAllminPtMCvsPtAllvsMult->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC), mult); | |
668 | ||
36c36a0c | 669 | //Check if track is reconstructed multiple times |
670 | int multCounter = 1; | |
671 | for (Int_t iTrack2 = iTrack+1; iTrack2 < nTracks; iTrack2++) { | |
672 | // AliESDtrack *track2 = GetTrackForAnalysis(iTrack2); | |
673 | AliESDtrack *track2; | |
674 | AliESDtrack *esdtrack2 = fESD->GetTrack(iTrack2); | |
675 | if(!esdtrack2) continue; | |
676 | ||
677 | if(fTrackType==1) | |
678 | track2 = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack2->GetID()); | |
679 | else if(fTrackType==2) { | |
680 | track2 = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack2->GetID()); | |
681 | if(!track2) { | |
682 | delete track2; | |
683 | continue; | |
684 | } | |
685 | AliExternalTrackParam exParam2; | |
686 | Bool_t relate = track2->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam2); | |
687 | if( !relate ) { | |
688 | delete track2; | |
689 | continue; | |
690 | } | |
691 | track2->Set(exParam2.GetX(),exParam2.GetAlpha(),exParam2.GetParameter(),exParam2.GetCovariance()); | |
692 | } | |
693 | else | |
694 | track2 = esdtrack2; | |
695 | if(!track2) { | |
696 | if(fTrackType==1 || fTrackType==2) delete track2; | |
697 | continue; | |
698 | } | |
699 | ||
700 | if (fTrackCuts->AcceptTrack(track2)) { | |
701 | Int_t label2 = TMath::Abs(track2->GetLabel()); | |
702 | if(label==label2) { | |
703 | fNPointTPCMultRec->Fill(track->GetTPCNcls()); | |
704 | fNPointTPCMultRec->Fill(track2->GetTPCNcls()); | |
705 | fDeltaPtMultRec->Fill(track->Pt(),track->Pt()-track2->Pt()); | |
706 | multCounter++; | |
707 | } | |
708 | } | |
709 | if(fTrackType==1 || fTrackType==2) delete track2; | |
710 | }//track2 loop | |
711 | if(multCounter>1) fMultRec->Fill(multCounter); | |
712 | ||
713 | }//fTrackCuts selection | |
714 | ||
fdceab34 | 715 | //ITSrefit selection |
71e77a79 | 716 | if (fTrackCutsITS->AcceptTrack(track) && fTrackType==0) { |
fdceab34 | 717 | |
718 | fPtSelITS->Fill(pt); | |
719 | fPtSelMCITS->Fill(ptMC); | |
720 | fPtITSminPtMCvsPtITS->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC) ); | |
721 | fPtITSminPtMCvsPtITSNPointTPC->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),track->GetTPCNcls()); | |
722 | fPtITSminPtMCvsPtITSDCAR->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),dca2D); | |
723 | fPtITSminPtMCvsPtITSDCAZ->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),dcaZ); | |
724 | fPtITSminPtMCvsPtITSPhi->Fill(ptMC,(pt-ptMC)/(pt),phi); | |
725 | fPtITSminPtMCvsPtITSNPointITS->Fill(ptMC,(pt-ptMC)/(pt),nPointITS); | |
726 | fPtITSminPtMCvsPtITSNSigmaToVertex->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),nSigmaToVertex); | |
727 | fPtITSminPtMCvsPtITSChi2C->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),chi2C); | |
728 | fPtITSminPtMCvsPtITSRel1PtUncertainty->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),relUncertainty1Pt); | |
729 | }//fTrackCutsITS loop | |
36c36a0c | 730 | |
731 | if(fTrackType==1 || fTrackType==2) delete track; | |
732 | ||
fdceab34 | 733 | }//ESD track loop |
734 | ||
735 | // Post output data | |
736 | PostData(0, fHistList); | |
737 | PostData(1, fHistListITS); | |
738 | ||
739 | } | |
b4691ee7 | 740 | //________________________________________________________________________ |
741 | Bool_t AliPWG4HighPtQAMC::PythiaInfoFromFile(const char* currFile,Float_t &fXsec,Float_t &fTrials){ | |
742 | // | |
743 | // get the cross section and the trails either from pyxsec.root or from pysec_hists.root | |
744 | // This is to called in Notify and should provide the path to the AOD/ESD file | |
745 | // Copied from AliAnalysisTaskJetSpectrum2 | |
746 | // | |
747 | ||
748 | TString file(currFile); | |
749 | fXsec = 0; | |
750 | fTrials = 1; | |
751 | ||
752 | if(file.Contains("root_archive.zip#")){ | |
753 | Ssiz_t pos1 = file.Index("root_archive",12,TString::kExact); | |
754 | Ssiz_t pos = file.Index("#",1,pos1,TString::kExact); | |
755 | file.Replace(pos+1,20,""); | |
756 | } | |
757 | else { | |
758 | // not an archive take the basename.... | |
759 | file.ReplaceAll(gSystem->BaseName(file.Data()),""); | |
760 | } | |
cb76764e | 761 | // Printf("%s",file.Data()); |
b4691ee7 | 762 | |
763 | ||
764 | TFile *fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec.root")); // problem that we cannot really test the existance of a file in a archive so we have to lvie with open error message from root | |
765 | if(!fxsec){ | |
766 | // next trial fetch the histgram file | |
767 | fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root")); | |
768 | if(!fxsec){ | |
769 | // not a severe condition but inciate that we have no information | |
770 | return kFALSE; | |
771 | } | |
772 | else{ | |
773 | // find the tlist we want to be independtent of the name so use the Tkey | |
774 | TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0); | |
775 | if(!key){ | |
776 | fxsec->Close(); | |
777 | return kFALSE; | |
778 | } | |
779 | TList *list = dynamic_cast<TList*>(key->ReadObj()); | |
780 | if(!list){ | |
781 | fxsec->Close(); | |
782 | return kFALSE; | |
783 | } | |
784 | fXsec = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1); | |
785 | fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1); | |
786 | fxsec->Close(); | |
787 | } | |
788 | } // no tree pyxsec.root | |
789 | else { | |
790 | TTree *xtree = (TTree*)fxsec->Get("Xsection"); | |
791 | if(!xtree){ | |
792 | fxsec->Close(); | |
793 | return kFALSE; | |
794 | } | |
795 | UInt_t ntrials = 0; | |
796 | Double_t xsection = 0; | |
797 | xtree->SetBranchAddress("xsection",&xsection); | |
798 | xtree->SetBranchAddress("ntrials",&ntrials); | |
799 | xtree->GetEntry(0); | |
800 | fTrials = ntrials; | |
801 | fXsec = xsection; | |
802 | fxsec->Close(); | |
803 | } | |
804 | return kTRUE; | |
805 | } | |
806 | //________________________________________________________________________ | |
807 | Bool_t AliPWG4HighPtQAMC::Notify() | |
808 | { | |
809 | // | |
810 | // Implemented Notify() to read the cross sections | |
811 | // and number of trials from pyxsec.root | |
812 | // Copied from AliAnalysisTaskJetSpectrum2 | |
813 | // | |
814 | ||
815 | TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree(); | |
816 | Float_t xsection = 0; | |
817 | Float_t ftrials = 1; | |
818 | ||
819 | fAvgTrials = 1; | |
820 | if(tree){ | |
821 | TFile *curfile = tree->GetCurrentFile(); | |
822 | if (!curfile) { | |
823 | Error("Notify","No current file"); | |
824 | return kFALSE; | |
825 | } | |
826 | if(!fh1Xsec||!fh1Trials){ | |
cb76764e | 827 | // Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__); |
b4691ee7 | 828 | return kFALSE; |
829 | } | |
830 | PythiaInfoFromFile(curfile->GetName(),xsection,ftrials); | |
831 | fh1Xsec->Fill("<#sigma>",xsection); | |
832 | // construct a poor man average trials | |
833 | Float_t nEntries = (Float_t)tree->GetTree()->GetEntries(); | |
834 | if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries; | |
835 | } | |
836 | return kTRUE; | |
837 | } | |
838 | ||
839 | //________________________________________________________________________ | |
840 | AliGenPythiaEventHeader* AliPWG4HighPtQAMC::GetPythiaEventHeader(AliMCEvent *mcEvent){ | |
841 | ||
842 | if(!mcEvent)return 0; | |
843 | AliGenEventHeader* genHeader = mcEvent->GenEventHeader(); | |
844 | AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader); | |
845 | if(!pythiaGenHeader){ | |
846 | // cocktail ?? | |
847 | AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(genHeader); | |
848 | ||
849 | if (!genCocktailHeader) { | |
cb76764e | 850 | // AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Unknown header type (not Pythia or Cocktail)"); |
b4691ee7 | 851 | // AliWarning(Form("%s %d: Unknown header type (not Pythia or Cocktail)",(char*)__FILE__,__LINE__)); |
852 | return 0; | |
853 | } | |
854 | TList* headerList = genCocktailHeader->GetHeaders(); | |
855 | for (Int_t i=0; i<headerList->GetEntries(); i++) { | |
856 | pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i)); | |
857 | if (pythiaGenHeader) | |
858 | break; | |
859 | } | |
860 | if(!pythiaGenHeader){ | |
861 | AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Pythia event header not found"); | |
862 | return 0; | |
863 | } | |
864 | } | |
865 | return pythiaGenHeader; | |
866 | ||
867 | } | |
868 | ||
fdceab34 | 869 | //________________________________________________________________________ |
870 | void AliPWG4HighPtQAMC::Terminate(Option_t *) | |
871 | { | |
df943115 | 872 | // The Terminate() function is the last function to be called during |
873 | // a query. It always runs on the client, it can be used to present | |
874 | // the results graphically or save the results to file. | |
fdceab34 | 875 | |
fdceab34 | 876 | } |
df943115 | 877 | |
878 | #endif |