]>
Commit | Line | Data |
---|---|---|
5e00415f | 1 | #if !defined( __CINT__) || defined(__MAKECINT__) |
2 | #include <TFile.h> | |
3 | #include <TError.h> | |
4 | #include <TH1.h> | |
5 | #include <TH2.h> | |
6 | #include <TF1.h> | |
7 | #include <TCanvas.h> | |
8 | #include <TVector3.h> | |
9 | #include <TPDGCode.h> | |
8b462fd8 | 10 | #include <TParticle.h> |
5e00415f | 11 | |
12 | #include "AliRunLoader.h" | |
13 | #include "AliLoader.h" | |
14 | #include "AliESD.h" | |
15 | #include "AliRun.h" | |
16 | #include "AliStack.h" | |
17 | #include "AliHeader.h" | |
18 | #include "AliGenEventHeader.h" | |
5fed899a | 19 | #include "AliPID.h" |
f0cfab93 | 20 | #else |
21 | const Int_t kXiMinus = 3312; | |
22 | const Int_t kOmegaMinus = 3334; | |
5e00415f | 23 | #endif |
24 | ||
25 | ||
26 | TH1F* CreateHisto(const char* name, const char* title, | |
27 | Int_t nBins, Double_t xMin, Double_t xMax, | |
28 | const char* xLabel = NULL, const char* yLabel = NULL) | |
29 | { | |
30 | // create a histogram | |
31 | ||
32 | TH1F* result = new TH1F(name, title, nBins, xMin, xMax); | |
33 | result->SetOption("E"); | |
34 | if (xLabel) result->GetXaxis()->SetTitle(xLabel); | |
35 | if (yLabel) result->GetYaxis()->SetTitle(yLabel); | |
36 | result->SetMarkerStyle(kFullCircle); | |
37 | return result; | |
38 | } | |
39 | ||
40 | TH1F* CreateEffHisto(TH1F* hGen, TH1F* hRec) | |
41 | { | |
42 | // create an efficiency histogram | |
43 | ||
44 | Int_t nBins = hGen->GetNbinsX(); | |
45 | TH1F* hEff = (TH1F*) hGen->Clone("hEff"); | |
46 | hEff->SetTitle(""); | |
47 | hEff->SetStats(kFALSE); | |
48 | hEff->SetMinimum(0.); | |
49 | hEff->SetMaximum(110.); | |
50 | hEff->GetYaxis()->SetTitle("#epsilon [%]"); | |
51 | ||
52 | for (Int_t iBin = 0; iBin <= nBins; iBin++) { | |
53 | Double_t nGen = hGen->GetBinContent(iBin); | |
54 | Double_t nRec = hRec->GetBinContent(iBin); | |
55 | if (nGen > 0) { | |
56 | Double_t eff = nRec/nGen; | |
57 | hEff->SetBinContent(iBin, 100. * eff); | |
58 | Double_t error = sqrt(eff*(1.-eff) / nGen); | |
59 | if (error == 0) error = 0.0001; | |
60 | hEff->SetBinError(iBin, 100. * error); | |
61 | } else { | |
62 | hEff->SetBinContent(iBin, -100.); | |
63 | hEff->SetBinError(iBin, 0); | |
64 | } | |
65 | } | |
66 | ||
67 | return hEff; | |
68 | } | |
69 | ||
70 | Bool_t FitHisto(TH1* histo, Double_t& res, Double_t& resError) | |
71 | { | |
72 | // fit a gaussian to a histogram | |
73 | ||
74 | static TF1* fitFunc = new TF1("fitFunc", "gaus"); | |
75 | fitFunc->SetLineWidth(2); | |
76 | fitFunc->SetFillStyle(0); | |
77 | Double_t maxFitRange = 2; | |
78 | ||
79 | if (histo->Integral() > 50) { | |
80 | Float_t mean = histo->GetMean(); | |
81 | Float_t rms = histo->GetRMS(); | |
82 | fitFunc->SetRange(mean - maxFitRange*rms, mean + maxFitRange*rms); | |
83 | fitFunc->SetParameters(mean, rms); | |
84 | histo->Fit(fitFunc, "QRI0"); | |
85 | histo->GetFunction("fitFunc")->ResetBit(1<<9); | |
86 | res = TMath::Abs(fitFunc->GetParameter(2)); | |
87 | resError = TMath::Abs(fitFunc->GetParError(2)); | |
88 | return kTRUE; | |
89 | } | |
90 | ||
91 | return kFALSE; | |
92 | } | |
93 | ||
94 | ||
95 | Bool_t CheckESD(const char* gAliceFileName = "galice.root", | |
96 | const char* esdFileName = "AliESDs.root") | |
97 | { | |
98 | // check the content of the ESD | |
99 | ||
100 | // check values | |
101 | Int_t checkNGenLow = 1; | |
102 | ||
103 | Double_t checkEffLow = 0.5; | |
104 | Double_t checkEffSigma = 3; | |
105 | Double_t checkFakeHigh = 0.5; | |
106 | Double_t checkFakeSigma = 3; | |
107 | ||
108 | Double_t checkResPtInvHigh = 5; | |
109 | Double_t checkResPtInvSigma = 3; | |
110 | Double_t checkResPhiHigh = 10; | |
111 | Double_t checkResPhiSigma = 3; | |
112 | Double_t checkResThetaHigh = 10; | |
113 | Double_t checkResThetaSigma = 3; | |
114 | ||
115 | Double_t checkPIDEffLow = 0.5; | |
116 | Double_t checkPIDEffSigma = 3; | |
117 | Double_t checkResTOFHigh = 500; | |
118 | Double_t checkResTOFSigma = 3; | |
119 | ||
120 | Double_t checkPHOSNLow = 5; | |
121 | Double_t checkPHOSEnergyLow = 0.3; | |
122 | Double_t checkPHOSEnergyHigh = 1.0; | |
123 | Double_t checkEMCALNLow = 50; | |
124 | Double_t checkEMCALEnergyLow = 0.05; | |
125 | Double_t checkEMCALEnergyHigh = 1.0; | |
126 | ||
127 | Double_t checkMUONNLow = 1; | |
128 | Double_t checkMUONPtLow = 0.5; | |
129 | Double_t checkMUONPtHigh = 10.; | |
130 | ||
131 | Double_t cutPtV0 = 0.3; | |
132 | Double_t checkV0EffLow = 0.02; | |
133 | Double_t checkV0EffSigma = 3; | |
134 | Double_t cutPtCascade = 0.5; | |
135 | Double_t checkCascadeEffLow = 0.01; | |
136 | Double_t checkCascadeEffSigma = 3; | |
137 | ||
138 | // open run loader and load gAlice, kinematics and header | |
139 | AliRunLoader* runLoader = AliRunLoader::Open(gAliceFileName); | |
140 | if (!runLoader) { | |
141 | Error("CheckESD", "getting run loader from file %s failed", | |
142 | gAliceFileName); | |
143 | return kFALSE; | |
144 | } | |
145 | runLoader->LoadgAlice(); | |
146 | gAlice = runLoader->GetAliRun(); | |
147 | if (!gAlice) { | |
148 | Error("CheckESD", "no galice object found"); | |
149 | return kFALSE; | |
150 | } | |
151 | runLoader->LoadKinematics(); | |
152 | runLoader->LoadHeader(); | |
153 | ||
154 | // open the ESD file | |
155 | TFile* esdFile = TFile::Open(esdFileName); | |
156 | if (!esdFile || !esdFile->IsOpen()) { | |
157 | Error("CheckESD", "opening ESD file %s failed", esdFileName); | |
158 | return kFALSE; | |
159 | } | |
8b462fd8 | 160 | AliESD* esd = new AliESD; |
161 | TTree* tree = (TTree*) esdFile->Get("esdTree"); | |
162 | if (!tree) { | |
163 | Error("CheckESD", "no ESD tree found"); | |
164 | return kFALSE; | |
165 | } | |
166 | tree->SetBranchAddress("ESD", &esd); | |
5e00415f | 167 | |
168 | // efficienc and resolution histograms | |
169 | Int_t nBinsPt = 15; | |
170 | Float_t minPt = 0.1; | |
171 | Float_t maxPt = 3.1; | |
172 | TH1F* hGen = CreateHisto("hGen", "generated tracks", | |
173 | nBinsPt, minPt, maxPt, "p_{t} [GeV/c]", "N"); | |
174 | TH1F* hRec = CreateHisto("hRec", "reconstructed tracks", | |
175 | nBinsPt, minPt, maxPt, "p_{t} [GeV/c]", "N"); | |
176 | Int_t nGen = 0; | |
177 | Int_t nRec = 0; | |
178 | Int_t nFake = 0; | |
179 | ||
180 | TH1F* hResPtInv = CreateHisto("hResPtInv", "", 100, -10, 10, | |
181 | "(p_{t,rec}^{-1}-p_{t,sim}^{-1}) / p_{t,sim}^{-1} [%]", "N"); | |
182 | TH1F* hResPhi = CreateHisto("hResPhi", "", 100, -20, 20, | |
183 | "#phi_{rec}-#phi_{sim} [mrad]", "N"); | |
184 | TH1F* hResTheta = CreateHisto("hResTheta", "", 100, -20, 20, | |
185 | "#theta_{rec}-#theta_{sim} [mrad]", "N"); | |
186 | ||
187 | // PID | |
5fed899a | 188 | Int_t partCode[AliPID::kSPECIES] = |
5e00415f | 189 | {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; |
5fed899a | 190 | const char* partName[AliPID::kSPECIES+1] = |
5e00415f | 191 | {"electron", "muon", "pion", "kaon", "proton", "other"}; |
5fed899a | 192 | Double_t partFrac[AliPID::kSPECIES] = |
5e00415f | 193 | {0.01, 0.01, 0.85, 0.10, 0.05}; |
5fed899a | 194 | Int_t identified[AliPID::kSPECIES+1][AliPID::kSPECIES]; |
195 | for (Int_t iGen = 0; iGen < AliPID::kSPECIES+1; iGen++) { | |
196 | for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) { | |
5e00415f | 197 | identified[iGen][iRec] = 0; |
198 | } | |
199 | } | |
200 | Int_t nIdentified = 0; | |
201 | ||
202 | // dE/dx and TOF | |
203 | TH2F* hDEdxRight = new TH2F("hDEdxRight", "", 300, 0, 3, 100, 0, 400); | |
204 | hDEdxRight->SetStats(kFALSE); | |
205 | hDEdxRight->GetXaxis()->SetTitle("p [GeV/c]"); | |
206 | hDEdxRight->GetYaxis()->SetTitle("dE/dx_{TPC}"); | |
207 | hDEdxRight->SetMarkerStyle(kFullCircle); | |
208 | hDEdxRight->SetMarkerSize(0.4); | |
209 | TH2F* hDEdxWrong = new TH2F("hDEdxWrong", "", 300, 0, 3, 100, 0, 400); | |
210 | hDEdxWrong->SetStats(kFALSE); | |
211 | hDEdxWrong->GetXaxis()->SetTitle("p [GeV/c]"); | |
212 | hDEdxWrong->GetYaxis()->SetTitle("dE/dx_{TPC}"); | |
213 | hDEdxWrong->SetMarkerStyle(kFullCircle); | |
214 | hDEdxWrong->SetMarkerSize(0.4); | |
215 | hDEdxWrong->SetMarkerColor(kRed); | |
216 | TH1F* hResTOFRight = CreateHisto("hResTOFRight", "", 100, -1000, 1000, | |
217 | "t_{TOF}-t_{track} [ps]", "N"); | |
218 | TH1F* hResTOFWrong = CreateHisto("hResTOFWrong", "", 100, -1000, 1000, | |
219 | "t_{TOF}-t_{track} [ps]", "N"); | |
220 | hResTOFWrong->SetLineColor(kRed); | |
221 | ||
222 | // calorimeters | |
223 | TH1F* hEPHOS = CreateHisto("hEPHOS", "PHOS", 100, 0, 5, "E [GeV]", "N"); | |
f04585c3 | 224 | TH1F* hEEMCAL = CreateHisto("hEEMCAL", "EMCAL", 100, 0, 50, "E [GeV]", "N"); |
5e00415f | 225 | |
226 | // muons | |
227 | TH1F* hPtMUON = CreateHisto("hPtMUON", "MUON", 100, 0, 20, | |
228 | "p_{t} [GeV/c]", "N"); | |
229 | ||
230 | // V0s and cascades | |
231 | TH1F* hMassK0 = CreateHisto("hMassK0", "K^{0}", 100, 0.4, 0.6, | |
232 | "M(#pi^{+}#pi^{-}) [GeV/c^{2}]", "N"); | |
233 | TH1F* hMassLambda = CreateHisto("hMassLambda", "#Lambda", 100, 1.0, 1.2, | |
234 | "M(p#pi^{-}) [GeV/c^{2}]", "N"); | |
235 | TH1F* hMassLambdaBar = CreateHisto("hMassLambdaBar", "#bar{#Lambda}", | |
236 | 100, 1.0, 1.2, | |
237 | "M(#bar{p}#pi^{+}) [GeV/c^{2}]", "N"); | |
238 | Int_t nGenV0s = 0; | |
239 | Int_t nRecV0s = 0; | |
240 | TH1F* hMassXi = CreateHisto("hMassXi", "#Xi", 100, 1.2, 1.5, | |
241 | "M(#Lambda#pi) [GeV/c^{2}]", "N"); | |
242 | TH1F* hMassOmega = CreateHisto("hMassOmega", "#Omega", 100, 1.5, 1.8, | |
243 | "M(#LambdaK) [GeV/c^{2}]", "N"); | |
244 | Int_t nGenCascades = 0; | |
245 | Int_t nRecCascades = 0; | |
246 | ||
247 | // loop over events | |
248 | for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) { | |
249 | runLoader->GetEvent(iEvent); | |
250 | ||
251 | // select simulated primary particles, V0s and cascades | |
252 | AliStack* stack = gAlice->Stack(); | |
253 | Int_t nParticles = stack->GetNtrack(); | |
254 | TArrayF vertex(3); | |
255 | runLoader->GetHeader()->GenEventHeader()->PrimaryVertex(vertex); | |
256 | TObjArray selParticles; | |
257 | TObjArray selV0s; | |
258 | TObjArray selCascades; | |
259 | for (Int_t iParticle = 0; iParticle < nParticles; iParticle++) { | |
260 | TParticle* particle = stack->Particle(iParticle); | |
261 | if (!particle) continue; | |
262 | if (particle->Pt() < 0.001) continue; | |
263 | if (TMath::Abs(particle->Eta()) > 0.9) continue; | |
264 | TVector3 dVertex(particle->Vx() - vertex[0], | |
265 | particle->Vy() - vertex[1], | |
266 | particle->Vz() - vertex[2]); | |
267 | if (dVertex.Mag() > 0.0001) continue; | |
268 | ||
269 | switch (TMath::Abs(particle->GetPdgCode())) { | |
270 | case kElectron: | |
271 | case kMuonMinus: | |
272 | case kPiPlus: | |
273 | case kKPlus: | |
274 | case kProton: { | |
275 | if (particle->Pt() > minPt) { | |
276 | selParticles.Add(particle); | |
277 | nGen++; | |
278 | hGen->Fill(particle->Pt()); | |
279 | } | |
280 | break; | |
281 | } | |
282 | case kK0Short: | |
283 | case kLambda0: { | |
284 | if (particle->Pt() > cutPtV0) { | |
285 | nGenV0s++; | |
286 | selV0s.Add(particle); | |
287 | } | |
288 | break; | |
289 | } | |
290 | case kXiMinus: | |
291 | case kOmegaMinus: { | |
292 | if (particle->Pt() > cutPtCascade) { | |
293 | nGenCascades++; | |
294 | selCascades.Add(particle); | |
295 | } | |
296 | break; | |
297 | } | |
298 | default: break; | |
299 | } | |
300 | } | |
301 | ||
302 | // get the event summary data | |
8b462fd8 | 303 | tree->GetEvent(iEvent); |
5e00415f | 304 | if (!esd) { |
305 | Error("CheckESD", "no ESD object found for event %d", iEvent); | |
306 | return kFALSE; | |
307 | } | |
308 | ||
309 | // loop over tracks | |
310 | for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) { | |
311 | AliESDtrack* track = esd->GetTrack(iTrack); | |
312 | ||
313 | // select tracks of selected particles | |
314 | Int_t label = TMath::Abs(track->GetLabel()); | |
315 | if (label > stack->GetNtrack()) continue; // background | |
316 | TParticle* particle = stack->Particle(label); | |
317 | if (!selParticles.Contains(particle)) continue; | |
318 | if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) continue; | |
319 | if (track->GetConstrainedChi2() > 1e9) continue; | |
320 | selParticles.Remove(particle); // don't count multiple tracks | |
321 | ||
322 | nRec++; | |
323 | hRec->Fill(particle->Pt()); | |
324 | if (track->GetLabel() < 0) nFake++; | |
325 | ||
326 | // resolutions | |
327 | Double_t p[3]; | |
328 | track->GetConstrainedPxPyPz(p); | |
329 | TVector3 pTrack(p); | |
330 | hResPtInv->Fill(100. * (1./pTrack.Pt() - 1./particle->Pt()) * | |
331 | particle->Pt()); | |
332 | hResPhi->Fill(1000. * (pTrack.Phi() - particle->Phi())); | |
333 | hResTheta->Fill(1000. * (pTrack.Theta() - particle->Theta())); | |
334 | ||
335 | // PID | |
336 | if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) continue; | |
337 | Int_t iGen = 5; | |
5fed899a | 338 | for (Int_t i = 0; i < AliPID::kSPECIES; i++) { |
5e00415f | 339 | if (TMath::Abs(particle->GetPdgCode()) == partCode[i]) iGen = i; |
340 | } | |
5fed899a | 341 | Double_t probability[AliPID::kSPECIES]; |
5e00415f | 342 | track->GetESDpid(probability); |
343 | Double_t pMax = 0; | |
344 | Int_t iRec = 0; | |
5fed899a | 345 | for (Int_t i = 0; i < AliPID::kSPECIES; i++) { |
5e00415f | 346 | probability[i] *= partFrac[i]; |
347 | if (probability[i] > pMax) { | |
348 | pMax = probability[i]; | |
349 | iRec = i; | |
350 | } | |
351 | } | |
352 | identified[iGen][iRec]++; | |
353 | if (iGen == iRec) nIdentified++; | |
354 | ||
355 | // dE/dx and TOF | |
5fed899a | 356 | Double_t time[AliPID::kSPECIES]; |
5e00415f | 357 | track->GetIntegratedTimes(time); |
358 | if (iGen == iRec) { | |
359 | hDEdxRight->Fill(pTrack.Mag(), track->GetTPCsignal()); | |
360 | if ((track->GetStatus() & AliESDtrack::kTOFpid) != 0) { | |
361 | hResTOFRight->Fill(track->GetTOFsignal() - time[iRec]); | |
362 | } | |
363 | } else { | |
364 | hDEdxWrong->Fill(pTrack.Mag(), track->GetTPCsignal()); | |
365 | if ((track->GetStatus() & AliESDtrack::kTOFpid) != 0) { | |
366 | hResTOFWrong->Fill(track->GetTOFsignal() - time[iRec]); | |
367 | } | |
368 | } | |
369 | } | |
370 | ||
5e00415f | 371 | // loop over muon tracks |
f0cfab93 | 372 | { |
5e00415f | 373 | for (Int_t iTrack = 0; iTrack < esd->GetNumberOfMuonTracks(); iTrack++) { |
f0cfab93 | 374 | AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack); |
375 | Double_t ptInv = TMath::Abs(muonTrack->GetInverseBendingMomentum()); | |
5e00415f | 376 | if (ptInv > 0.001) { |
377 | hPtMUON->Fill(1./ptInv); | |
378 | } | |
379 | } | |
f0cfab93 | 380 | } |
5e00415f | 381 | |
382 | // loop over V0s | |
383 | for (Int_t iV0 = 0; iV0 < esd->GetNumberOfV0s(); iV0++) { | |
384 | AliESDv0* v0 = esd->GetV0(iV0); | |
f980f8fb | 385 | v0->ChangeMassHypothesis(kK0Short); |
386 | hMassK0->Fill(v0->GetEffMass()); | |
387 | v0->ChangeMassHypothesis(kLambda0); | |
388 | hMassLambda->Fill(v0->GetEffMass()); | |
389 | v0->ChangeMassHypothesis(kLambda0Bar); | |
390 | hMassLambdaBar->Fill(v0->GetEffMass()); | |
5e00415f | 391 | |
392 | Int_t negLabel = TMath::Abs(esd->GetTrack(v0->GetNindex())->GetLabel()); | |
393 | if (negLabel > stack->GetNtrack()) continue; // background | |
394 | Int_t negMother = stack->Particle(negLabel)->GetMother(0); | |
395 | if (negMother < 0) continue; | |
f980f8fb | 396 | Int_t posLabel = TMath::Abs(esd->GetTrack(v0->GetPindex())->GetLabel()); |
5e00415f | 397 | if (posLabel > stack->GetNtrack()) continue; // background |
398 | Int_t posMother = stack->Particle(posLabel)->GetMother(0); | |
399 | if (negMother != posMother) continue; | |
400 | TParticle* particle = stack->Particle(negMother); | |
401 | if (!selV0s.Contains(particle)) continue; | |
402 | selV0s.Remove(particle); | |
403 | nRecV0s++; | |
404 | } | |
405 | ||
406 | // loop over Cascades | |
407 | for (Int_t iCascade = 0; iCascade < esd->GetNumberOfCascades(); | |
408 | iCascade++) { | |
409 | AliESDcascade* cascade = esd->GetCascade(iCascade); | |
f980f8fb | 410 | Double_t v0q; |
411 | cascade->ChangeMassHypothesis(v0q,kXiMinus); | |
412 | hMassXi->Fill(cascade->GetEffMass()); | |
413 | cascade->ChangeMassHypothesis(v0q,kOmegaMinus); | |
414 | hMassOmega->Fill(cascade->GetEffMass()); | |
5e00415f | 415 | |
416 | Int_t negLabel = TMath::Abs(esd->GetTrack(cascade->GetNindex()) | |
417 | ->GetLabel()); | |
418 | if (negLabel > stack->GetNtrack()) continue; // background | |
419 | Int_t negMother = stack->Particle(negLabel)->GetMother(0); | |
420 | if (negMother < 0) continue; | |
f980f8fb | 421 | Int_t posLabel = TMath::Abs(esd->GetTrack(cascade->GetPindex()) |
5e00415f | 422 | ->GetLabel()); |
423 | if (posLabel > stack->GetNtrack()) continue; // background | |
424 | Int_t posMother = stack->Particle(posLabel)->GetMother(0); | |
425 | if (negMother != posMother) continue; | |
426 | Int_t v0Mother = stack->Particle(negMother)->GetMother(0); | |
427 | if (v0Mother < 0) continue; | |
428 | Int_t bacLabel = TMath::Abs(esd->GetTrack(cascade->GetBindex()) | |
429 | ->GetLabel()); | |
430 | if (bacLabel > stack->GetNtrack()) continue; // background | |
431 | Int_t bacMother = stack->Particle(bacLabel)->GetMother(0); | |
432 | if (v0Mother != bacMother) continue; | |
433 | TParticle* particle = stack->Particle(v0Mother); | |
434 | if (!selCascades.Contains(particle)) continue; | |
435 | selCascades.Remove(particle); | |
436 | nRecCascades++; | |
437 | } | |
f04585c3 | 438 | |
439 | // loop over the PHOS clusters | |
440 | { | |
441 | Int_t firstPHOSCluster = esd->GetFirstPHOSCluster(); | |
442 | Int_t lastPHOSCluster = firstPHOSCluster + esd->GetNumberOfPHOSClusters(); | |
443 | for (Int_t iCluster=firstPHOSCluster; iCluster<lastPHOSCluster; iCluster++) | |
444 | hEPHOS->Fill(esd->GetCaloCluster(iCluster)->GetClusterEnergy()); | |
445 | } | |
446 | ||
447 | // loop over the EMCAL clusters | |
448 | { | |
449 | Int_t firstEMCALCluster = esd->GetFirstEMCALCluster(); | |
450 | Int_t lastEMCALCluster = firstEMCALCluster + esd->GetNumberOfEMCALClusters(); | |
451 | for (Int_t iCluster=firstEMCALCluster; iCluster<lastEMCALCluster; iCluster++) | |
452 | hEEMCAL->Fill(esd->GetCaloCluster(iCluster)->GetClusterEnergy()); | |
453 | } | |
5e00415f | 454 | } |
455 | ||
456 | // perform checks | |
457 | if (nGen < checkNGenLow) { | |
458 | Warning("CheckESD", "low number of generated particles: %d", Int_t(nGen)); | |
459 | } | |
460 | ||
461 | TH1F* hEff = CreateEffHisto(hGen, hRec); | |
462 | ||
463 | Info("CheckESD", "%d out of %d tracks reconstructed including %d " | |
464 | "fake tracks", nRec, nGen, nFake); | |
465 | if (nGen > 0) { | |
466 | // efficiency | |
467 | Double_t eff = nRec*1./nGen; | |
468 | Double_t effError = TMath::Sqrt(eff*(1.-eff) / nGen); | |
469 | Double_t fake = nFake*1./nGen; | |
470 | Double_t fakeError = TMath::Sqrt(fake*(1.-fake) / nGen); | |
471 | Info("CheckESD", "eff = (%.1f +- %.1f) %% fake = (%.1f +- %.1f) %%", | |
472 | 100.*eff, 100.*effError, 100.*fake, 100.*fakeError); | |
473 | ||
474 | if (eff < checkEffLow - checkEffSigma*effError) { | |
475 | Warning("CheckESD", "low efficiency: (%.1f +- %.1f) %%", | |
476 | 100.*eff, 100.*effError); | |
477 | } | |
478 | if (fake > checkFakeHigh + checkFakeSigma*fakeError) { | |
479 | Warning("CheckESD", "high fake: (%.1f +- %.1f) %%", | |
480 | 100.*fake, 100.*fakeError); | |
481 | } | |
482 | ||
483 | // resolutions | |
484 | Double_t res, resError; | |
485 | if (FitHisto(hResPtInv, res, resError)) { | |
486 | Info("CheckESD", "relative inverse pt resolution = (%.1f +- %.1f) %%", | |
487 | res, resError); | |
488 | if (res > checkResPtInvHigh + checkResPtInvSigma*resError) { | |
489 | Warning("CheckESD", "bad pt resolution: (%.1f +- %.1f) %%", | |
490 | res, resError); | |
491 | } | |
492 | } | |
493 | ||
494 | if (FitHisto(hResPhi, res, resError)) { | |
495 | Info("CheckESD", "phi resolution = (%.1f +- %.1f) mrad", res, resError); | |
496 | if (res > checkResPhiHigh + checkResPhiSigma*resError) { | |
497 | Warning("CheckESD", "bad phi resolution: (%.1f +- %.1f) mrad", | |
498 | res, resError); | |
499 | } | |
500 | } | |
501 | ||
502 | if (FitHisto(hResTheta, res, resError)) { | |
503 | Info("CheckESD", "theta resolution = (%.1f +- %.1f) mrad", | |
504 | res, resError); | |
505 | if (res > checkResThetaHigh + checkResThetaSigma*resError) { | |
506 | Warning("CheckESD", "bad theta resolution: (%.1f +- %.1f) mrad", | |
507 | res, resError); | |
508 | } | |
509 | } | |
510 | ||
511 | // PID | |
512 | if (nRec > 0) { | |
513 | Double_t eff = nIdentified*1./nRec; | |
514 | Double_t effError = TMath::Sqrt(eff*(1.-eff) / nRec); | |
515 | Info("CheckESD", "PID eff = (%.1f +- %.1f) %%", | |
516 | 100.*eff, 100.*effError); | |
517 | if (eff < checkPIDEffLow - checkPIDEffSigma*effError) { | |
518 | Warning("CheckESD", "low PID efficiency: (%.1f +- %.1f) %%", | |
519 | 100.*eff, 100.*effError); | |
520 | } | |
521 | } | |
522 | ||
523 | printf("%9s:", "gen\\rec"); | |
5fed899a | 524 | for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) { |
5e00415f | 525 | printf("%9s", partName[iRec]); |
526 | } | |
527 | printf("\n"); | |
5fed899a | 528 | for (Int_t iGen = 0; iGen < AliPID::kSPECIES+1; iGen++) { |
5e00415f | 529 | printf("%9s:", partName[iGen]); |
5fed899a | 530 | for (Int_t iRec = 0; iRec < AliPID::kSPECIES; iRec++) { |
5e00415f | 531 | printf("%9d", identified[iGen][iRec]); |
532 | } | |
533 | printf("\n"); | |
534 | } | |
535 | ||
536 | if (FitHisto(hResTOFRight, res, resError)) { | |
537 | Info("CheckESD", "TOF resolution = (%.1f +- %.1f) ps", res, resError); | |
538 | if (res > checkResTOFHigh + checkResTOFSigma*resError) { | |
539 | Warning("CheckESD", "bad TOF resolution: (%.1f +- %.1f) ps", | |
540 | res, resError); | |
541 | } | |
542 | } | |
543 | ||
544 | // calorimeters | |
545 | if (hEPHOS->Integral() < checkPHOSNLow) { | |
546 | Warning("CheckESD", "low number of PHOS particles: %d", | |
547 | Int_t(hEPHOS->Integral())); | |
548 | } else { | |
549 | Double_t mean = hEPHOS->GetMean(); | |
550 | if (mean < checkPHOSEnergyLow) { | |
551 | Warning("CheckESD", "low mean PHOS energy: %.1f GeV", mean); | |
552 | } else if (mean > checkPHOSEnergyHigh) { | |
553 | Warning("CheckESD", "high mean PHOS energy: %.1f GeV", mean); | |
554 | } | |
555 | } | |
556 | ||
557 | if (hEEMCAL->Integral() < checkEMCALNLow) { | |
558 | Warning("CheckESD", "low number of EMCAL particles: %d", | |
559 | Int_t(hEEMCAL->Integral())); | |
560 | } else { | |
561 | Double_t mean = hEEMCAL->GetMean(); | |
562 | if (mean < checkEMCALEnergyLow) { | |
563 | Warning("CheckESD", "low mean EMCAL energy: %.1f GeV", mean); | |
564 | } else if (mean > checkEMCALEnergyHigh) { | |
565 | Warning("CheckESD", "high mean EMCAL energy: %.1f GeV", mean); | |
566 | } | |
567 | } | |
568 | ||
569 | // muons | |
570 | if (hPtMUON->Integral() < checkMUONNLow) { | |
571 | Warning("CheckESD", "low number of MUON particles: %d", | |
572 | Int_t(hPtMUON->Integral())); | |
573 | } else { | |
574 | Double_t mean = hPtMUON->GetMean(); | |
575 | if (mean < checkMUONPtLow) { | |
576 | Warning("CheckESD", "low mean MUON pt: %.1f GeV/c", mean); | |
577 | } else if (mean > checkMUONPtHigh) { | |
578 | Warning("CheckESD", "high mean MUON pt: %.1f GeV/c", mean); | |
579 | } | |
580 | } | |
581 | ||
582 | // V0s | |
583 | if (nGenV0s > 0) { | |
584 | Double_t eff = nRecV0s*1./nGenV0s; | |
585 | Double_t effError = TMath::Sqrt(eff*(1.-eff) / nGenV0s); | |
586 | if (effError == 0) effError = checkV0EffLow / TMath::Sqrt(1.*nGenV0s); | |
587 | Info("CheckESD", "V0 eff = (%.1f +- %.1f) %%", | |
588 | 100.*eff, 100.*effError); | |
589 | if (eff < checkV0EffLow - checkV0EffSigma*effError) { | |
590 | Warning("CheckESD", "low V0 efficiency: (%.1f +- %.1f) %%", | |
591 | 100.*eff, 100.*effError); | |
592 | } | |
593 | } | |
594 | ||
595 | // Cascades | |
596 | if (nGenCascades > 0) { | |
597 | Double_t eff = nRecCascades*1./nGenCascades; | |
598 | Double_t effError = TMath::Sqrt(eff*(1.-eff) / nGenCascades); | |
599 | if (effError == 0) effError = checkV0EffLow / | |
600 | TMath::Sqrt(1.*nGenCascades); | |
601 | Info("CheckESD", "Cascade eff = (%.1f +- %.1f) %%", | |
602 | 100.*eff, 100.*effError); | |
603 | if (eff < checkCascadeEffLow - checkCascadeEffSigma*effError) { | |
604 | Warning("CheckESD", "low Cascade efficiency: (%.1f +- %.1f) %%", | |
605 | 100.*eff, 100.*effError); | |
606 | } | |
607 | } | |
608 | } | |
609 | ||
610 | // draw the histograms if not in batch mode | |
611 | if (!gROOT->IsBatch()) { | |
612 | new TCanvas; | |
613 | hEff->DrawCopy(); | |
614 | new TCanvas; | |
615 | hResPtInv->DrawCopy("E"); | |
616 | new TCanvas; | |
617 | hResPhi->DrawCopy("E"); | |
618 | new TCanvas; | |
619 | hResTheta->DrawCopy("E"); | |
620 | new TCanvas; | |
621 | hDEdxRight->DrawCopy(); | |
622 | hDEdxWrong->DrawCopy("SAME"); | |
623 | new TCanvas; | |
624 | hResTOFRight->DrawCopy("E"); | |
625 | hResTOFWrong->DrawCopy("SAME"); | |
626 | new TCanvas; | |
627 | hEPHOS->DrawCopy("E"); | |
628 | new TCanvas; | |
629 | hEEMCAL->DrawCopy("E"); | |
630 | new TCanvas; | |
631 | hPtMUON->DrawCopy("E"); | |
632 | new TCanvas; | |
633 | hMassK0->DrawCopy("E"); | |
634 | new TCanvas; | |
635 | hMassLambda->DrawCopy("E"); | |
636 | new TCanvas; | |
637 | hMassLambdaBar->DrawCopy("E"); | |
638 | new TCanvas; | |
639 | hMassXi->DrawCopy("E"); | |
640 | new TCanvas; | |
641 | hMassOmega->DrawCopy("E"); | |
642 | } | |
643 | ||
644 | // write the output histograms to a file | |
645 | TFile* outputFile = TFile::Open("check.root", "recreate"); | |
646 | if (!outputFile || !outputFile->IsOpen()) { | |
647 | Error("CheckESD", "opening output file check.root failed"); | |
648 | return kFALSE; | |
649 | } | |
650 | hEff->Write(); | |
651 | hResPtInv->Write(); | |
652 | hResPhi->Write(); | |
653 | hResTheta->Write(); | |
654 | hDEdxRight->Write(); | |
655 | hDEdxWrong->Write(); | |
656 | hResTOFRight->Write(); | |
657 | hResTOFWrong->Write(); | |
658 | hEPHOS->Write(); | |
659 | hEEMCAL->Write(); | |
660 | hPtMUON->Write(); | |
661 | hMassK0->Write(); | |
662 | hMassLambda->Write(); | |
663 | hMassLambdaBar->Write(); | |
664 | hMassXi->Write(); | |
665 | hMassOmega->Write(); | |
666 | outputFile->Close(); | |
667 | delete outputFile; | |
668 | ||
669 | // clean up | |
670 | delete hGen; | |
671 | delete hRec; | |
672 | delete hEff; | |
673 | delete hResPtInv; | |
674 | delete hResPhi; | |
675 | delete hResTheta; | |
676 | delete hDEdxRight; | |
677 | delete hDEdxWrong; | |
678 | delete hResTOFRight; | |
679 | delete hResTOFWrong; | |
680 | delete hEPHOS; | |
681 | delete hEEMCAL; | |
682 | delete hPtMUON; | |
683 | delete hMassK0; | |
684 | delete hMassLambda; | |
685 | delete hMassLambdaBar; | |
686 | delete hMassXi; | |
687 | delete hMassOmega; | |
688 | ||
8b462fd8 | 689 | delete esd; |
5e00415f | 690 | esdFile->Close(); |
691 | delete esdFile; | |
692 | ||
693 | runLoader->UnloadHeader(); | |
694 | runLoader->UnloadKinematics(); | |
695 | delete runLoader; | |
696 | ||
697 | // result of check | |
698 | Info("CheckESD", "check of ESD was successfull"); | |
699 | return kTRUE; | |
700 | } |