]>
Commit | Line | Data |
---|---|---|
814ecea4 | 1 | /************************************************************************** |
e1aa1ec4 | 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 | **************************************************************************/ | |
814ecea4 | 15 | |
16 | /* $Id: AliTRDtrackingEfficiencyCombined.cxx 27496 2008-07-22 08:35:45Z cblume $ */ | |
17 | ||
18 | //////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Reconstruction QA // | |
21 | // // | |
22 | // Authors: // | |
23 | // Markus Fasel <M.Fasel@gsi.de> // | |
24 | // // | |
25 | //////////////////////////////////////////////////////////////////////////// | |
26 | ||
27 | #include <TObjArray.h> | |
5fbb7894 | 28 | #include <TClonesArray.h> |
814ecea4 | 29 | #include <TProfile.h> |
30 | #include <TMath.h> | |
31 | #include <TCanvas.h> | |
3d86166d | 32 | #include "TTreeStream.h" |
814ecea4 | 33 | |
34 | #include "AliMagFMaps.h" | |
5fbb7894 | 35 | #include "AliPID.h" |
814ecea4 | 36 | #include "AliTracker.h" |
814ecea4 | 37 | #include "AliTrackReference.h" |
814ecea4 | 38 | #include "AliAnalysisManager.h" |
3d86166d | 39 | |
5fbb7894 | 40 | #include "AliTRDcluster.h" |
3d86166d | 41 | #include "AliTRDseedV1.h" |
42 | #include "AliTRDtrackV1.h" | |
5fbb7894 | 43 | #include "AliTRDtrackerV1.h" |
44 | #include "Cal/AliTRDCalPID.h" | |
814ecea4 | 45 | #include "AliTRDtrackInfo/AliTRDtrackInfo.h" |
e1aa1ec4 | 46 | #include "AliTRDtrackInfoGen.h" |
814ecea4 | 47 | #include "AliTRDtrackingEfficiencyCombined.h" |
48 | ||
49 | ClassImp(AliTRDtrackingEfficiencyCombined) | |
50 | ||
51 | //_____________________________________________________________________________ | |
3d86166d | 52 | AliTRDtrackingEfficiencyCombined::AliTRDtrackingEfficiencyCombined() |
53 | :AliTRDrecoTask("TrackingEffMC", "Combined Tracking Efficiency") | |
814ecea4 | 54 | { |
55 | // | |
56 | // Default constructor | |
57 | // | |
ed383798 | 58 | } |
59 | ||
814ecea4 | 60 | |
61 | //_____________________________________________________________________________ | |
62 | void AliTRDtrackingEfficiencyCombined::CreateOutputObjects(){ | |
63 | // | |
64 | // Create output objects | |
65 | // | |
66 | ||
67 | OpenFile(0, "RECREATE"); | |
5fbb7894 | 68 | fContainer = Histos(); |
814ecea4 | 69 | |
814ecea4 | 70 | } |
71 | ||
72 | //_____________________________________________________________________________ | |
73 | void AliTRDtrackingEfficiencyCombined::Exec(Option_t *){ | |
74 | // | |
5fbb7894 | 75 | // Execute the task: |
814ecea4 | 76 | // |
5fbb7894 | 77 | // Loop over TrackInfos |
78 | // 1st: check if there is a TRDtrack | |
79 | // 2nd: put conditions on the track: | |
80 | // - check if we did not register it before | |
81 | // - check if we have Track References for the track | |
82 | // 3rd: Register track: | |
83 | // - accepted if both conditions are fulfilled | |
84 | // - contamination if at least one condition is not fulfilled | |
85 | // 4th: check Monte-Carlo Track wheter findable or not if there is no TRD track in this track info | |
86 | // 5th: register MC track as rejected if findable and not jet registered | |
87 | // Match the registers accepted and rejected and clean register rejected | |
88 | // Fill the histograms | |
89 | // | |
90 | const Int_t kArraySize = 10000; // Store indices of track references in an array | |
91 | Int_t index_accepted[kArraySize], index_rejected[kArraySize], index_contamination[kArraySize]; | |
92 | memset(index_accepted, 0, sizeof(Int_t) * kArraySize); | |
93 | memset(index_rejected, 0, sizeof(Int_t) * kArraySize); | |
94 | memset(index_contamination, 0, sizeof(Int_t) * kArraySize); | |
95 | Int_t naccepted = 0, nrejected = 0, ncontamination = 0; | |
96 | Bool_t isContamination = kFALSE; | |
e1aa1ec4 | 97 | |
98 | Int_t nTrackInfos = fTracks->GetEntriesFast(); | |
e1aa1ec4 | 99 | AliTRDtrackV1 *TRDtrack = 0x0; |
100 | AliTRDtrackInfo *trkInf = 0x0; | |
e1aa1ec4 | 101 | for(Int_t itinf = 0; itinf < nTrackInfos; itinf++){ |
e1aa1ec4 | 102 | trkInf = dynamic_cast<AliTRDtrackInfo *>(fTracks->UncheckedAt(itinf)); |
103 | if(!trkInf) continue; | |
5fbb7894 | 104 | if(trkInf->GetTrack() || trkInf->GetNumberOfClustersRefit()){ |
105 | isContamination = IsRegistered(trkInf,index_accepted,naccepted); | |
106 | if(!trkInf->GetNTrackRefs()){ | |
107 | // We reject the track since the Monte Carlo Information is missing | |
108 | printf("Error: Track Reference missing for Track %d\n", trkInf->GetLabel()); | |
109 | isContamination = kTRUE; | |
110 | // Debugging | |
111 | if(TRDtrack && fDebugLevel > 5) FillStreamTrackWOMC(trkInf); | |
112 | } | |
113 | if(isContamination){ | |
114 | // reject kink (we count these only once) | |
115 | if(trkInf->GetKinkIndex()) continue; | |
116 | // Register track as contamination | |
117 | index_contamination[ncontamination++]=itinf; | |
e1aa1ec4 | 118 | continue; |
119 | } | |
5fbb7894 | 120 | // Accept track |
e1aa1ec4 | 121 | if(fDebugLevel > 3)printf("Accept track\n"); |
5fbb7894 | 122 | // Register track as accepted |
123 | index_accepted[naccepted++] = itinf; | |
124 | }else{ | |
125 | if(IsFindable(trkInf)){ | |
126 | // register track as rejected if not already registered there | |
127 | // Attention: | |
128 | // These track infos are not!!! registered as contamination | |
129 | if(!IsRegistered(trkInf, index_rejected, nrejected)) index_rejected[nrejected++] = itinf; | |
e1aa1ec4 | 130 | } |
131 | } | |
132 | } | |
5fbb7894 | 133 | // we have to check if the rejected tracks are registered as found |
134 | // a possible source for this: | |
135 | // first the track is not found by the barrel tracking but it is later found | |
136 | // by the stand alone tracking, then two track info objects with the same | |
137 | // label would be created | |
138 | // Attention: | |
139 | // these tracks are not! registered as contamination | |
140 | Int_t tmprejected[kArraySize]; Int_t nrej = nrejected; | |
141 | memcpy(tmprejected, index_rejected, sizeof(Int_t) * nrejected); | |
142 | nrejected = 0; | |
143 | for(Int_t irej = 0; irej < nrej; irej++){ | |
144 | trkInf = dynamic_cast<AliTRDtrackInfo *>(fTracks->At(tmprejected[irej])); | |
145 | if(!IsRegistered(trkInf,index_accepted,naccepted)) index_rejected[nrejected++] = tmprejected[irej]; | |
814ecea4 | 146 | } |
5fbb7894 | 147 | // Fill Histograms |
148 | FillHistograms(naccepted, &index_accepted[0], kAccepted); | |
149 | FillHistograms(nrejected, &index_rejected[0], kRejected); | |
150 | FillHistograms(ncontamination, &index_contamination[0], kContamination); | |
151 | Int_t nall = naccepted + nrejected; | |
814ecea4 | 152 | //if(fDebugLevel>=1) |
0afb0559 | 153 | printf("%3d Tracks: MC[%3d] TRD[%3d | %5.2f%%] \n", (Int_t)AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry(), nall, naccepted, nall ? 1.E2*Float_t(naccepted)/Float_t(nall) : 0.); |
5fbb7894 | 154 | printf("%3d Tracks: ALL[%3d] Contamination[%3d | %5.2f%%] \n", (Int_t)AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry(), nall + ncontamination, ncontamination, nall ? 1.E2*Float_t(ncontamination)/Float_t(nall + ncontamination) : 0.); |
814ecea4 | 155 | |
3d86166d | 156 | PostData(0, fContainer); |
814ecea4 | 157 | } |
158 | ||
159 | //_____________________________________________________________________________ | |
160 | void AliTRDtrackingEfficiencyCombined::Terminate(Option_t *) | |
161 | { | |
162 | // | |
163 | // Termination | |
164 | // | |
165 | ||
3d86166d | 166 | if(fDebugStream){ |
167 | delete fDebugStream; | |
168 | fDebugStream = 0x0; | |
169 | fDebugLevel = 0; | |
170 | } | |
171 | ||
172 | fContainer = dynamic_cast<TObjArray*>(GetOutputData(0)); | |
173 | if (!fContainer) { | |
814ecea4 | 174 | Printf("ERROR: list not available"); |
175 | return; | |
176 | } | |
e1aa1ec4 | 177 | } |
814ecea4 | 178 | |
e1aa1ec4 | 179 | //_____________________________________________________________________________ |
180 | Bool_t AliTRDtrackingEfficiencyCombined::PostProcess() | |
181 | { | |
5fbb7894 | 182 | // |
183 | // Post Process | |
184 | // | |
185 | // Change the histogram style | |
186 | // For species histograms apply the colors connected with the given particle species | |
187 | // | |
188 | TH1 *histo = dynamic_cast<TH1 *>(fContainer->At(kEfficiencyHistogram)); | |
e1aa1ec4 | 189 | histo->SetMarkerStyle(22); |
190 | histo->SetMarkerColor(kBlue); | |
191 | histo->GetXaxis()->SetTitle("p [GeV/c]"); | |
192 | histo->GetXaxis()->SetMoreLogLabels(); | |
193 | histo->GetYaxis()->SetTitle("Efficiency [%]"); | |
194 | histo->GetYaxis()->SetRangeUser(0.99, 1.005); | |
814ecea4 | 195 | |
5fbb7894 | 196 | histo = dynamic_cast<TH1 *>(fContainer->At(kContaminationHistogram)); |
e1aa1ec4 | 197 | histo->SetMarkerStyle(22); |
198 | histo->SetMarkerColor(kBlue); | |
199 | histo->GetXaxis()->SetTitle("p [GeV/c]"); | |
200 | histo->GetXaxis()->SetMoreLogLabels(); | |
201 | histo->GetYaxis()->SetTitle("Contamination [%]"); | |
5fbb7894 | 202 | |
203 | // Species Efficiency Histograms | |
204 | for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){ | |
205 | histo = dynamic_cast<TH1 *>(fContainer->At(kEfficiencySpeciesHistogram + ispec)); | |
206 | histo->SetMarkerStyle(22); | |
207 | histo->SetLineColor(AliTRDCalPID::GetPartColor(ispec)); | |
208 | histo->SetMarkerColor(AliTRDCalPID::GetPartColor(ispec)); | |
209 | histo->GetXaxis()->SetTitle("p [GeV/c]"); | |
210 | histo->GetXaxis()->SetMoreLogLabels(); | |
211 | histo->GetYaxis()->SetTitle("Efficiency [%]"); | |
212 | histo->GetYaxis()->SetRangeUser(0.99, 1.005); | |
213 | } | |
214 | ||
215 | // Species Contamination Histograms | |
216 | for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){ | |
217 | histo = dynamic_cast<TH1 *>(fContainer->At(kContaminationSpeciesHistogram + ispec)); | |
218 | histo->SetMarkerStyle(22); | |
219 | histo->SetLineColor(AliTRDCalPID::GetPartColor(ispec)); | |
220 | histo->SetMarkerColor(AliTRDCalPID::GetPartColor(ispec)); | |
221 | histo->GetXaxis()->SetTitle("p [GeV/c]"); | |
222 | histo->GetXaxis()->SetMoreLogLabels(); | |
223 | histo->GetYaxis()->SetTitle("Contamination [%]"); | |
224 | } | |
225 | ||
226 | fNRefFigures = 6; | |
e1aa1ec4 | 227 | return kTRUE; |
228 | } | |
814ecea4 | 229 | |
e1aa1ec4 | 230 | //_____________________________________________________________________________ |
231 | void AliTRDtrackingEfficiencyCombined::GetRefFigure(Int_t ifig){ | |
5fbb7894 | 232 | // |
233 | // Plot the histograms | |
234 | // | |
235 | if(ifig >= fNRefFigures) return; | |
236 | if(ifig < 2){ | |
237 | (dynamic_cast<TH1 *>(fContainer->At(ifig)))->Draw("e1"); | |
238 | return; | |
239 | } | |
240 | switch(ifig){ | |
241 | case 2: | |
242 | (dynamic_cast<TH1 *>(fContainer->At(kEfficiencySpeciesHistogram)))->Draw("e1"); | |
243 | for(Int_t ispec = 1; ispec < AliPID::kSPECIES; ispec++) | |
244 | (dynamic_cast<TH1 *>(fContainer->At(kEfficiencySpeciesHistogram + ispec)))->Draw("e1same"); | |
245 | break; | |
246 | case 3: | |
247 | (dynamic_cast<TH1 *>(fContainer->At(kContaminationSpeciesHistogram)))->Draw("e1"); | |
248 | for(Int_t ispec = 1; ispec < AliPID::kSPECIES; ispec++) | |
249 | (dynamic_cast<TH1 *>(fContainer->At(kContaminationSpeciesHistogram + ispec)))->Draw("e1same"); | |
250 | break; | |
251 | case 4: | |
252 | (dynamic_cast<TH1 *>(fContainer->At(kEfficiencyNoPID)))->Draw("e1"); | |
253 | break; | |
254 | case 5: | |
255 | (dynamic_cast<TH1 *>(fContainer->At(kContaminationNoPID)))->Draw("e1"); | |
256 | break; | |
257 | } | |
814ecea4 | 258 | } |
5fbb7894 | 259 | |
260 | //_____________________________________________________________________________ | |
261 | TObjArray *AliTRDtrackingEfficiencyCombined::Histos(){ | |
262 | // | |
263 | // Create the histograms | |
264 | // | |
265 | const Int_t nbins = 11; | |
266 | ||
267 | if(fContainer) return fContainer; | |
268 | Float_t xbins[nbins+1] = {.5, .7, .9, 1.3, 1.7, 2.4, 3.5, 4.5, 5.5, 7., 9., 11.}; | |
269 | ||
270 | TString species[AliPID::kSPECIES] = {"Pions", "Muons", "Electrons", "Kaons", "Protons"}; | |
271 | TString species_short[AliPID::kSPECIES] = {"Pi", "Mu", "El", "Ka", "Pr"}; | |
272 | ||
273 | fContainer = new TObjArray(); | |
274 | fContainer->AddAt(new TProfile("trEffComb", "Combined Tracking Efficiency", nbins, xbins), kEfficiencyHistogram); | |
275 | fContainer->AddAt(new TProfile("trContComb", "Combined Tracking Contamination", nbins, xbins), kContaminationHistogram); | |
276 | for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++) | |
277 | fContainer->AddAt(new TProfile(Form("trEffComb%s", species_short[ispec].Data()), Form("Combined Tracking Efficiency %s", species[ispec].Data()), nbins, xbins), kEfficiencySpeciesHistogram + ispec); | |
278 | for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++) | |
279 | fContainer->AddAt(new TProfile(Form("trContComb%s", species_short[ispec].Data()), Form("Combined Tracking Contamination %s", species[ispec].Data()), nbins, xbins), kContaminationSpeciesHistogram + ispec); | |
280 | fContainer->AddAt(new TProfile("trEffCombNoPID", "Combined Tracking Efficiency", nbins, xbins), kEfficiencyNoPID); | |
281 | fContainer->AddAt(new TProfile("trContCombNoPID", "Combined Tracking Contamination", nbins, xbins), kContaminationNoPID); | |
282 | return fContainer; | |
283 | } | |
284 | ||
285 | //_____________________________________________________________________________ | |
286 | Bool_t AliTRDtrackingEfficiencyCombined::IsFindable(AliTRDtrackInfo *trkInf){ | |
287 | // | |
288 | // Apply Cuts on the Monte Carlo track references | |
289 | // return whether track is findable or not | |
290 | // | |
291 | const Float_t kAlpha = 0.349065850; | |
292 | ||
293 | if(fDebugLevel>10) printf("Analysing Track References\n"); | |
294 | // Check if track is findable | |
295 | Double_t mom = 0.; | |
296 | Float_t xmin = 10000.0, xmax = 0.0; | |
297 | Float_t ymin = 0.0, ymax = 0.0; | |
298 | Float_t zmin = 0.0, zmax = 0.0; | |
299 | Float_t lastx = 0.0, x = 0.0; | |
300 | Int_t nLayers = 0; | |
301 | Int_t sector[20]; | |
302 | AliTrackReference *trackRef = 0x0; | |
303 | for(Int_t itr = 0; itr < trkInf->GetNTrackRefs(); itr++){ | |
304 | trackRef = trkInf->GetTrackRef(itr); | |
305 | if(fDebugLevel>10) printf("%d. x[%f], y[%f], z[%f]\n", itr, trackRef->LocalX(), trackRef->LocalY(), trackRef->Z()); | |
306 | x = trackRef->LocalX(); | |
307 | ||
308 | // Be Sure that we are inside TRD | |
309 | if(x < AliTRDtrackInfoGen::xTPC || x > AliTRDtrackInfoGen::xTOF) continue; | |
310 | sector[itr] = Int_t(trackRef->Alpha()/kAlpha); | |
311 | if(x < xmin){ | |
312 | xmin = trackRef->LocalX(); | |
313 | ymin = trackRef->LocalY(); | |
314 | zmin = trackRef->Z(); | |
315 | mom = trackRef->P(); | |
316 | } else if(x > xmax){ | |
317 | xmax = trackRef->LocalX(); | |
318 | ymax = trackRef->LocalY(); | |
319 | zmax = trackRef->Z(); | |
320 | } | |
321 | if(itr > 0){ | |
322 | Float_t dist = TMath::Abs(x - lastx); | |
323 | if(fDebugLevel>10) printf("x = %f, lastx = %f, dist = %f\n", x, lastx, dist); | |
324 | if(TMath::Abs(dist - 3.7) < 0.1) nLayers++; // ref(i+1) has to be larger than ref(i) | |
325 | } | |
326 | lastx = x; | |
327 | } | |
328 | ||
329 | // Apply cuts | |
330 | Bool_t findable = kTRUE; | |
331 | if(trkInf->GetNTrackRefs() > 2 && xmax > xmin){ | |
332 | if(mom < 0.55) findable = kFALSE; // momentum cut at 0.6 | |
333 | Double_t yangle = (ymax -ymin)/(xmax - xmin); | |
334 | Double_t zangle = (zmax -zmin)/(xmax - xmin); | |
335 | if(fDebugLevel>10){ | |
336 | printf("track: y-Angle = %f, z-Angle = %f\n", yangle, zangle); | |
337 | printf("nLayers = %d\n", nLayers); | |
338 | } | |
339 | if(TMath::ATan(TMath::Abs(yangle)) > 45.) findable = kFALSE; | |
340 | if(TMath::ATan(TMath::Abs(zangle)) > 45.) findable = kFALSE; | |
341 | if(nLayers < 4) findable = kFALSE; | |
342 | if(!trkInf->IsPrimary()) findable = kFALSE; | |
343 | Bool_t samesec = kTRUE; | |
344 | for(Int_t iref = 1; iref < trkInf->GetNTrackRefs(); iref++) | |
345 | if(sector[iref] != sector[0]) samesec = kFALSE; | |
346 | if(!samesec) findable = kFALSE; // Discard all tracks which are passing more than one sector | |
347 | if(fDebugLevel){ | |
348 | Double_t trackAngle = TMath::ATan(yangle); | |
349 | Bool_t primary = trkInf->IsPrimary(); | |
350 | (*fDebugStream) << "NotFoundTrack" | |
351 | << "Momentum=" << mom | |
352 | << "trackAngle="<< trackAngle | |
353 | << "NLayers=" << nLayers | |
354 | << "Primary=" << primary | |
355 | << "\n"; | |
356 | } | |
357 | } | |
358 | else | |
359 | findable = kFALSE; | |
360 | return findable; | |
361 | } | |
362 | ||
363 | //_____________________________________________________________________________ | |
364 | void AliTRDtrackingEfficiencyCombined::FillHistograms(Int_t nTracks, Int_t *indices, FillingMode_t mode){ | |
365 | // | |
366 | // Fill Histograms in three different modes: | |
367 | // 1st tracks which are found and accepted | |
368 | // 2nd tracks which are not found and not already counted | |
369 | // 3rd contaminating tracks: either double counts (kinks!) or tracks with no MC hit inside TRD | |
370 | // | |
371 | const Int_t pid[AliPID::kSPECIES] = {211,13,11,321,2212}; | |
372 | Double_t trkmom = 0.; // the track momentum | |
373 | Int_t trkpid = -1; // particle species | |
374 | AliTRDtrackInfo *trkInf = 0x0; | |
375 | for(Int_t itk = 0; itk < nTracks; itk++){ | |
376 | trkInf = dynamic_cast<AliTRDtrackInfo *>(fTracks->At(indices[itk])); | |
377 | if(fDebugLevel > 2)printf("Accepted MC track: %d\n", trkInf->GetLabel()); | |
378 | if(trkInf->GetNTrackRefs()){ | |
379 | // use Monte-Carlo Information for Momentum and PID | |
380 | trkmom = trkInf->GetTrackRef(0)->P(); | |
381 | trkpid = trkInf->GetPDG(); | |
382 | }else{ | |
383 | // Use TPC Momentum | |
384 | trkmom = trkInf->GetTrack()->P(); | |
385 | } | |
386 | switch(mode){ | |
387 | case kAccepted: | |
388 | (dynamic_cast<TProfile *>(fContainer->At(kEfficiencyHistogram)))->Fill(trkmom, 1); | |
389 | (dynamic_cast<TProfile *>(fContainer->At(kContaminationHistogram)))->Fill(trkmom, 0); | |
390 | break; | |
391 | case kRejected: | |
392 | (dynamic_cast<TProfile *>(fContainer->At(kEfficiencyHistogram)))->Fill(trkmom, 0); | |
393 | (dynamic_cast<TProfile *>(fContainer->At(kContaminationHistogram)))->Fill(trkmom, 0); | |
394 | break; | |
395 | case kContamination: | |
396 | (dynamic_cast<TProfile *>(fContainer->At(kContaminationHistogram)))->Fill(trkmom, 1); | |
397 | break; | |
398 | } | |
399 | // Fill species histogram | |
400 | Int_t part_spec = -1; | |
401 | for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){ | |
402 | if(trkpid == pid[ispec]) part_spec = ispec; | |
403 | } | |
404 | if(part_spec >= 0){ | |
405 | switch(mode){ | |
406 | case kAccepted: | |
407 | (dynamic_cast<TProfile *>(fContainer->At(kEfficiencySpeciesHistogram + part_spec)))->Fill(trkmom, 1); | |
408 | (dynamic_cast<TProfile *>(fContainer->At(kContaminationSpeciesHistogram + part_spec)))->Fill(trkmom, 0); | |
409 | break; | |
410 | case kRejected: | |
411 | (dynamic_cast<TProfile *>(fContainer->At(kEfficiencySpeciesHistogram + part_spec)))->Fill(trkmom, 0); (dynamic_cast<TProfile *>(fContainer->At(kContaminationSpeciesHistogram + part_spec)))->Fill(trkmom, 0); | |
412 | break; | |
413 | case kContamination: | |
414 | (dynamic_cast<TProfile *>(fContainer->At(kContaminationSpeciesHistogram + part_spec)))->Fill(trkmom, 1); | |
415 | break; | |
416 | } | |
417 | } else { | |
418 | // The particle Type is not registered | |
419 | (dynamic_cast<TProfile *>(fContainer->At(kEfficiencyNoPID)))->Fill(trkmom, 1); | |
420 | (dynamic_cast<TProfile *>(fContainer->At(kContaminationNoPID)))->Fill(trkmom, 1); | |
421 | } | |
422 | } | |
423 | } | |
424 | ||
425 | //_____________________________________________________________________________ | |
426 | void AliTRDtrackingEfficiencyCombined::FillStreamTrackWOMC(AliTRDtrackInfo *trkInf){ | |
427 | // fill debug stream | |
428 | // we want to know: | |
429 | // 1. The event number | |
430 | // 2. The track label | |
431 | // 3. The TRD track label | |
432 | // 4. The frequency of the TRD Label | |
433 | // 5. Momentum from TPC (NO STAND ALONE TRACK) | |
434 | // 6. TPC Phi angle | |
435 | // 7. the TRD track | |
436 | // 8. Monte Carlo PID | |
437 | // 9. We check the Labels of the TRD track according to them we search the maching Monte-Carlo track. | |
438 | // From the matching Monte-Carlo track we store trackRefs, phi and momentum | |
439 | // 10. We may also want to keep the kink index | |
440 | Double_t mom = trkInf->GetOuterParam()->P(); | |
441 | Int_t event = (Int_t)AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry(); | |
442 | Int_t label = trkInf->GetLabel(); | |
443 | Int_t kinkIndex = trkInf->GetKinkIndex(); | |
444 | Int_t pdg = trkInf->GetPDG(); | |
445 | Double_t TPCphi = trkInf->GetOuterParam()->Phi(); | |
446 | Int_t TRDlabels[180]; // Container for the cluster labels | |
447 | Int_t sortlabels[360]; // Cluster Labels sorted according their occurancy | |
448 | AliTRDseedV1 *tracklet = 0x0; | |
449 | AliTRDcluster *c = 0x0; | |
450 | Int_t nclusters = 0x0; | |
451 | AliTRDtrackV1 *TRDtrack = trkInf->GetTrack(); | |
452 | for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){ | |
453 | tracklet = TRDtrack->GetTracklet(il); | |
454 | if(!tracklet) continue; | |
455 | tracklet->ResetClusterIter(); | |
456 | c = 0x0; | |
457 | while((c = tracklet->NextCluster())) TRDlabels[nclusters++] = c->GetLabel(0); | |
458 | } | |
459 | // Determine Label and Frequency | |
460 | AliTRDtrackerV1::Freq(nclusters, const_cast<const Int_t *>(&TRDlabels[0]), &sortlabels[0], kTRUE); | |
461 | Int_t TRDLabel = sortlabels[0]; | |
462 | Int_t freqTRD = sortlabels[1]; | |
463 | // find the track info object matching to the TRD track | |
464 | AliTRDtrackInfo *realtrack = 0; | |
465 | TObjArrayIter rtiter(fTracks); | |
466 | while((realtrack = (AliTRDtrackInfo *)rtiter())){ | |
467 | if(realtrack->GetLabel() != TRDLabel) continue; | |
468 | break; | |
469 | } | |
470 | TClonesArray trackRefs("AliTrackReference"); | |
471 | Int_t realPdg = -1; | |
472 | Double_t realP = 0.; | |
473 | Double_t realPhi = 0.; | |
474 | if(realtrack){ | |
475 | // pack the track references into the trackRefsContainer | |
476 | for(Int_t iref = 0; iref < realtrack->GetNTrackRefs(); iref++){ | |
477 | new(trackRefs[iref])AliTrackReference(*(realtrack->GetTrackRef(iref))); | |
478 | } | |
479 | realPdg = realtrack->GetPDG(); | |
480 | if(realtrack->GetNTrackRefs()){ | |
481 | realP = realtrack->GetTrackRef(0)->P(); | |
482 | realPhi = realtrack->GetTrackRef(0)->Phi(); | |
483 | } | |
484 | } | |
485 | (*fDebugStream) << "TrackingEffMCfake" | |
486 | << "Event=" << event | |
487 | << "Label=" << label | |
488 | << "TRDLabel=" << TRDLabel | |
489 | << "FreqTRDlabel=" << freqTRD | |
490 | << "TPCp=" << mom | |
491 | << "TPCphi=" << TPCphi | |
492 | << "TRDtrack=" << TRDtrack | |
493 | << "PDG=" << pdg | |
494 | << "TrackRefs=" << &trackRefs | |
495 | << "RealPDG=" << realPdg | |
496 | << "RealP=" << realP | |
497 | << "RealPhi" << realPhi | |
498 | << "KinkIndex=" << kinkIndex | |
499 | << "\n"; | |
500 | } | |
501 | ||
502 | //_____________________________________________________________________________ | |
503 | Bool_t AliTRDtrackingEfficiencyCombined::IsRegistered(AliTRDtrackInfo *trkInf, Int_t *indices, Int_t nTracks){ | |
504 | // | |
505 | // Checks if track is registered in a given mode | |
506 | // | |
507 | Bool_t isRegistered = kFALSE; | |
508 | for(Int_t il = 0; il < nTracks; il++){ | |
509 | if((dynamic_cast<AliTRDtrackInfo *>(fTracks->At(indices[il])))->GetLabel() == trkInf->GetLabel()){ | |
510 | isRegistered = kTRUE; | |
511 | break; | |
512 | } | |
513 | } | |
514 | return isRegistered; | |
515 | } | |
516 |