]>
Commit | Line | Data |
---|---|---|
76d0b522 | 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 | // Debug tree task | |
17 | // | |
18 | // Authors: | |
19 | // R.Bailhache <R.Bailhache@gsi.de> | |
20 | // | |
21 | #include <TBits.h> | |
22 | #include <TString.h> | |
23 | #include <TArrayI.h> | |
24 | ||
25 | #include "AliAnalysisManager.h" | |
26 | #include "AliCentrality.h" | |
27 | #include "AliAODTrack.h" | |
28 | #include "AliAODEvent.h" | |
959ea9d8 | 29 | #include "AliAODPid.h" |
76d0b522 | 30 | #include "AliHFEcuts.h" |
31 | #include "AliHFEextraCuts.h" | |
32 | #include "AliInputEventHandler.h" | |
33 | #include "AliLog.h" | |
34 | #include "AliPIDResponse.h" | |
35 | #include "AliVEvent.h" | |
36 | #include "AliHFEpidTPC.h" | |
37 | #include "TTreeStream.h" | |
38 | #include "AliESDtrack.h" | |
39 | #include "TClonesArray.h" | |
40 | #include "AliAODMCHeader.h" | |
41 | #include "AliHFEsignalCuts.h" | |
42 | #include "AliAODMCParticle.h" | |
43 | #include "AliVTrack.h" | |
7bdde22f | 44 | #include "AliVCluster.h" |
76d0b522 | 45 | #include "AliAODVertex.h" |
46 | ||
47 | #include "AliHFEdebugTreeTaskAOD.h" | |
48 | ||
49 | ClassImp(AliHFEdebugTreeTaskAOD) | |
50 | ||
51 | AliHFEdebugTreeTaskAOD::AliHFEdebugTreeTaskAOD(): | |
52 | AliAnalysisTaskSE(), | |
53 | fAODMCHeader(NULL), | |
54 | fAODArrayMCInfo(NULL), | |
55 | fTrackCuts(NULL), | |
56 | fExtraCuts(NULL), | |
57 | fSignalCuts(NULL), | |
58 | fTPCpid(NULL), | |
59 | fEventNumber(0), | |
60 | fNclustersTPC(70), | |
61 | fNclustersTPCPID(0), | |
62 | fNclustersITS(2), | |
63 | fFilename("HFEtree.root"), | |
959ea9d8 | 64 | fDebugTree(NULL) |
76d0b522 | 65 | { |
66 | ||
67 | } | |
68 | ||
69 | AliHFEdebugTreeTaskAOD::AliHFEdebugTreeTaskAOD(const char *name): | |
70 | AliAnalysisTaskSE(name), | |
71 | fAODMCHeader(NULL), | |
72 | fAODArrayMCInfo(NULL), | |
73 | fTrackCuts(NULL), | |
74 | fExtraCuts(NULL), | |
75 | fSignalCuts(NULL), | |
76 | fTPCpid(NULL), | |
77 | fEventNumber(0), | |
78 | fNclustersTPC(70), | |
79 | fNclustersTPCPID(0), | |
80 | fNclustersITS(2), | |
81 | fFilename("HFEtree.root"), | |
959ea9d8 | 82 | fDebugTree(NULL) |
76d0b522 | 83 | { |
84 | fTPCpid = new AliHFEpidTPC("QAtpcPID"); | |
85 | } | |
86 | ||
87 | AliHFEdebugTreeTaskAOD::~AliHFEdebugTreeTaskAOD(){ | |
88 | ||
89 | if(fDebugTree) delete fDebugTree; | |
90 | if(fTPCpid) delete fTPCpid; | |
91 | } | |
92 | ||
93 | void AliHFEdebugTreeTaskAOD::UserCreateOutputObjects(){ | |
94 | // | |
95 | // Create debug tree, signal cuts and track cuts | |
96 | // | |
97 | ||
98 | //printf("test\n"); | |
959ea9d8 | 99 | fDebugTree = new TTreeSRedirector(fFilename.Data()); |
76d0b522 | 100 | |
bca6abf5 | 101 | // printf("testa\n"); |
76d0b522 | 102 | fSignalCuts = new AliHFEsignalCuts("HFEsignalCuts", "HFE MC Signal definition"); |
103 | //printf("testb\n"); | |
104 | ||
105 | fTrackCuts = new AliHFEcuts("fTrackCuts", "Basic HFE track cuts"); | |
106 | fTrackCuts->CreateStandardCuts(); | |
107 | fTrackCuts->SetAOD(); | |
108 | // Track cuts | |
109 | fTrackCuts->SetMinNClustersTPC(fNclustersTPC); | |
110 | fTrackCuts->SetMinRatioTPCclusters(0); | |
111 | fTrackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable); | |
112 | fTrackCuts->SetMinNClustersTPCPID(fNclustersTPCPID); | |
113 | fTrackCuts->SetMinNClustersITS(fNclustersITS); | |
114 | // Event cuts | |
115 | fTrackCuts->SetUseMixedVertex(kTRUE); | |
116 | fTrackCuts->SetVertexRange(10.); | |
117 | //printf("testa\n"); | |
118 | fTrackCuts->Initialize(); | |
119 | //printf("testb\n"); | |
120 | ||
121 | fExtraCuts = new AliHFEextraCuts("hfeExtraCuts","HFE Extra Cuts"); | |
122 | ||
123 | } | |
124 | ||
125 | void AliHFEdebugTreeTaskAOD::UserExec(Option_t *){ | |
126 | // | |
127 | // User Exec: Fill debug Tree | |
128 | // | |
129 | ||
130 | // Get PID response | |
131 | AliPIDResponse *pid = NULL; | |
132 | AliInputEventHandler *handler = dynamic_cast<AliInputEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
133 | if(handler){ | |
bca6abf5 | 134 | // printf("testb\n"); |
76d0b522 | 135 | pid = handler->GetPIDResponse(); |
136 | } else { | |
137 | AliError("No Handler"); | |
138 | } | |
139 | if(!pid){ | |
bca6abf5 | 140 | // printf("testc\n"); |
76d0b522 | 141 | AliError("No PID response"); |
142 | return; | |
143 | } | |
144 | if(!fInputEvent) { | |
145 | AliError("No Input event"); | |
146 | return; | |
147 | } | |
148 | ||
959ea9d8 | 149 | AliAODTrack copyTrack; |
150 | ||
76d0b522 | 151 | // MC info |
152 | Bool_t mcthere = kTRUE; | |
153 | AliAODEvent *aodE = dynamic_cast<AliAODEvent *>(fInputEvent); | |
bca6abf5 | 154 | if(!aodE){ |
155 | // printf("testd\n"); | |
76d0b522 | 156 | AliError("No AOD Event"); |
157 | return; | |
158 | } | |
159 | fAODMCHeader = dynamic_cast<AliAODMCHeader *>(fInputEvent->FindListObject(AliAODMCHeader::StdBranchName())); | |
160 | if(!fAODMCHeader){ | |
bca6abf5 | 161 | mcthere = kFALSE; |
162 | // return; | |
76d0b522 | 163 | } |
164 | fAODArrayMCInfo = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName())); | |
165 | if(!fAODArrayMCInfo){ | |
bca6abf5 | 166 | mcthere = kFALSE; |
167 | // return; | |
76d0b522 | 168 | } |
169 | else { | |
170 | fSignalCuts->SetMCAODInfo(fAODArrayMCInfo); | |
171 | fTrackCuts->SetMCEvent(aodE); | |
172 | } | |
173 | ||
174 | // Set for track cuts | |
175 | fTrackCuts->SetRecEvent(fInputEvent); | |
176 | ||
177 | if(!fTrackCuts->CheckEventCuts("fCutsEvRec", fInputEvent)){ | |
178 | AliDebug(1, "Event rejected by the event cuts\n"); | |
179 | return; | |
180 | } | |
181 | if(!fExtraCuts){ | |
182 | fExtraCuts = new AliHFEextraCuts("hfeExtraCuts","HFE Extra Cuts"); | |
183 | } | |
184 | fExtraCuts->SetRecEventInfo(fInputEvent); | |
185 | ||
959ea9d8 | 186 | |
187 | ||
188 | ||
76d0b522 | 189 | // Get run number |
959ea9d8 | 190 | Int_t run = fInputEvent->GetRunNumber(); |
191 | ||
76d0b522 | 192 | // Derive trigger |
193 | UInt_t trigger = fInputHandler->IsEventSelected(); | |
194 | Bool_t isMBTrigger = trigger & AliVEvent::kMB; | |
195 | Bool_t isCentralTrigger = trigger & AliVEvent::kCentral; | |
196 | Bool_t isSemicentralTrigger = trigger & AliVEvent::kSemiCentral; | |
197 | Bool_t isEMCALTrigger = trigger & AliVEvent::kEMCEJE; | |
198 | ||
199 | // Get Primary Vertex | |
200 | const AliVVertex *vertex = fInputEvent->GetPrimaryVertex(); | |
201 | Double_t vtx[3]; | |
202 | vertex->GetXYZ(vtx); | |
203 | Double_t ncontrib = fInputEvent->GetPrimaryVertex()->GetNContributors(); | |
204 | ||
205 | // Get centrality | |
959ea9d8 | 206 | Float_t centrality = -1.; |
76d0b522 | 207 | AliCentrality *hicent = fInputEvent->GetCentrality(); |
959ea9d8 | 208 | centrality = hicent->GetCentralityPercentile("V0M"); |
209 | ||
210 | // Store event selection variables | |
211 | (*fDebugTree) << "EventDebug" | |
212 | << "Centrality=" << centrality | |
213 | << "VertexZ=" << vtx[2] | |
214 | << "NumberOfContributors=" << ncontrib | |
215 | << "run=" << run | |
216 | << "\n"; | |
217 | ||
218 | ||
76d0b522 | 219 | |
220 | // Look for kink mother | |
221 | Int_t numberofvertices = aodE->GetNumberOfVertices(); | |
222 | Double_t listofmotherkink[numberofvertices]; | |
223 | Int_t numberofmotherkink = 0; | |
224 | //printf("Number of vertices %d\n",numberofvertices); | |
225 | for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) { | |
226 | AliAODVertex *aodvertex = aodE->GetVertex(ivertex); | |
227 | if(!aodvertex) continue; | |
228 | //printf("Type %d\n",aodvertex->GetType()); | |
229 | if(aodvertex->GetType()==AliAODVertex::kKink) { | |
230 | //printf("Find one kink\n"); | |
231 | AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent(); | |
232 | if(!mother) continue; | |
233 | Int_t idmother = mother->GetID(); | |
234 | listofmotherkink[numberofmotherkink] = idmother; | |
235 | //printf("ID %d\n",idmother); | |
236 | numberofmotherkink++; | |
237 | } | |
238 | } | |
239 | //printf("Number of kink mother in the events %d\n",numberofmotherkink); | |
959ea9d8 | 240 | |
241 | // | |
242 | // Loop on MC tracks only | |
243 | // | |
244 | AliAODMCParticle *mctrack = NULL; | |
245 | // Monte-Carlo info | |
246 | Double_t eR,vx,vy,vz; | |
247 | Double_t chargemc, etamc, phimc, momentummc, transversemomentummc; | |
248 | Int_t source,pdg,signal; | |
249 | if(mcthere) { | |
250 | for(Int_t itrack = 0; itrack < fAODArrayMCInfo->GetEntriesFast(); itrack++) { | |
251 | mctrack = (AliAODMCParticle *)(fAODArrayMCInfo->At(itrack)); | |
252 | if(!mctrack) continue; | |
253 | signal = 0; | |
254 | if(fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mctrack)) signal = 1; | |
255 | // Kinematics | |
256 | chargemc = mctrack->Charge() > 0. ? 1. : -1.; | |
257 | momentummc = mctrack->P() * chargemc; | |
258 | transversemomentummc = mctrack->Pt() * chargemc; | |
259 | etamc = mctrack->Eta(); | |
260 | phimc = mctrack->Phi(); | |
261 | pdg = mctrack->GetPdgCode(); | |
262 | ||
263 | // Get Production Vertex in radial direction | |
264 | vx = mctrack->Xv(); | |
265 | vy = mctrack->Yv(); | |
266 | vz = mctrack->Zv(); | |
267 | eR = TMath::Sqrt(vx*vx+vy*vy); | |
268 | ||
269 | // Get Mother PDG code of the particle | |
270 | Int_t motherPdg = 0; | |
271 | Int_t motherlabel = TMath::Abs(mctrack->GetMother()); | |
272 | if(motherlabel >= 0 && motherlabel < fAODArrayMCInfo->GetEntriesFast()){ | |
273 | AliAODMCParticle *mother = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(motherlabel)); | |
274 | if(mother) motherPdg = mother->GetPdgCode(); | |
275 | } | |
276 | ||
277 | // derive source | |
278 | source = 5; | |
279 | if(fSignalCuts->IsCharmElectron(mctrack)) source = 0; | |
280 | else if(fSignalCuts->IsBeautyElectron(mctrack)) source = 1; | |
281 | else if(fSignalCuts->IsGammaElectron(mctrack)) source = 2; | |
282 | else if(fSignalCuts->IsNonHFElectron(mctrack)) source = 3; | |
283 | else if(TMath::Abs(pdg) == 11) source = 4; | |
284 | else source = 5; | |
285 | ||
286 | (*fDebugTree) << "MCDebug" | |
287 | << "centrality=" << centrality | |
288 | << "MBtrigger=" << isMBTrigger | |
289 | << "CentralTrigger=" << isCentralTrigger | |
290 | << "SemicentralTrigger=" << isSemicentralTrigger | |
291 | << "EMCALtrigger=" << isEMCALTrigger | |
292 | << "run=" << run | |
293 | << "p=" << momentummc | |
294 | << "pt=" << transversemomentummc | |
295 | << "eta=" << etamc | |
296 | << "phi=" << phimc | |
297 | << "pdg=" << pdg | |
7bdde22f | 298 | << "px=" << vx |
299 | << "py=" << vy | |
300 | << "pz=" << vz | |
959ea9d8 | 301 | << "ProductionVertex=" << eR |
302 | << "motherPdg=" << motherPdg | |
303 | << "source=" << source | |
304 | << "\n"; | |
305 | } | |
306 | } | |
76d0b522 | 307 | |
308 | // Common variables | |
959ea9d8 | 309 | Double_t charge, eta, phi, momentum, momentumTPC, transversemomentum; |
310 | ||
76d0b522 | 311 | // |
312 | // Loop on reconstructed tracks | |
313 | // | |
314 | ||
7bdde22f | 315 | TArrayI arraytrack(fInputEvent->GetNumberOfTracks()); |
959ea9d8 | 316 | Int_t counterdc=0; |
76d0b522 | 317 | |
318 | AliAODTrack *track = 0x0; | |
76d0b522 | 319 | for(Int_t itrack = 0; itrack < fInputEvent->GetNumberOfTracks(); itrack++){ |
320 | // fill the tree | |
321 | track = dynamic_cast<AliAODTrack *>(fInputEvent->GetTrack(itrack)); | |
322 | if(!track) continue; | |
323 | // Cut track (Only basic track cuts) | |
959ea9d8 | 324 | // printf("testv\n"); |
76d0b522 | 325 | if(!fTrackCuts->CheckParticleCuts(AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kStepRecKineITSTPC, track)) continue; |
326 | // | |
327 | //printf("testu\n"); | |
959ea9d8 | 328 | Double_t nSigmaTOF = pid->NumberOfSigmasTOF(track, AliPID::kElectron); |
329 | Double_t nSigmaTPC = pid->NumberOfSigmasTPC(track, AliPID::kElectron); | |
76d0b522 | 330 | Double_t tPCdEdx = track->GetDetPid() ? track->GetDetPid()->GetTPCsignal() : 0.; |
959ea9d8 | 331 | // Eta correction |
332 | copyTrack.~AliAODTrack(); | |
333 | new(©Track) AliAODTrack(*track); | |
334 | if(fTPCpid->HasCentralityCorrection()) fTPCpid->ApplyCentralityCorrection(©Track, static_cast<Double_t>(ncontrib),AliHFEpidObject::kAODanalysis); | |
335 | if(fTPCpid->HasEtaCorrection()) fTPCpid->ApplyEtaCorrection(©Track, AliHFEpidObject::kAODanalysis); | |
336 | Double_t nSigmaTPCcorr = pid->NumberOfSigmasTPC(©Track, AliPID::kElectron); | |
337 | Double_t tPCdEdxcorr = copyTrack.GetDetPid() ? copyTrack.GetDetPid()->GetTPCsignal() : 0.; | |
76d0b522 | 338 | |
339 | // Kinematics | |
959ea9d8 | 340 | charge = track->Charge() > 0 ? 1. : -1.; |
341 | eta = track->Eta(); | |
342 | phi = track->Phi(); | |
343 | momentum = track->P() * charge; | |
344 | transversemomentum = track->Pt() * charge; | |
345 | momentumTPC = track->GetDetPid() ? track->GetDetPid()->GetTPCmomentum() : track->P(); | |
76d0b522 | 346 | |
347 | // status | |
348 | ULong_t status = track->GetStatus(); | |
349 | Int_t itsrefit=0; | |
350 | if((status & AliESDtrack::kITSrefit) == AliESDtrack::kITSrefit) itsrefit = 1; | |
351 | Int_t tpcrefit=0; | |
352 | if((status & AliESDtrack::kTPCrefit) == AliESDtrack::kTPCrefit) tpcrefit = 1; | |
959ea9d8 | 353 | Int_t tofpid=0; |
354 | if((status & AliESDtrack::kTOFpid) == AliESDtrack::kTOFpid) tofpid = 1; | |
76d0b522 | 355 | |
356 | // ITS number of clusters | |
959ea9d8 | 357 | UChar_t nclustersITS = track->GetITSNcls(); |
76d0b522 | 358 | // TPC number of clusters (different definitions) |
359 | UChar_t nclustersTPCfit = track->GetTPCNcls(); | |
959ea9d8 | 360 | UChar_t nclustersTPCall = 0; |
76d0b522 | 361 | const TBits &clusterTPC = track->GetTPCClusterMap(); |
959ea9d8 | 362 | nclustersTPCall = clusterTPC.CountBits(); |
363 | UChar_t nclustersTPCPID = track->GetTPCsignalN(); | |
76d0b522 | 364 | UChar_t nfindableTPC = track->GetTPCNclsF(); |
365 | Double_t clusterRatioTPCfit = 0.0; | |
366 | if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPCfit = static_cast<Double_t>(nclustersTPCfit)/static_cast<Double_t>(nfindableTPC); | |
959ea9d8 | 367 | Double_t clusterRatioTPCall = 0.0; |
368 | if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPCall = static_cast<Double_t>(nclustersTPCall)/static_cast<Double_t>(nfindableTPC); | |
369 | UChar_t nclustersTPCshared = 0; | |
370 | Float_t ncrossedRowsTPC = track->GetTPCNCrossedRows(); | |
76d0b522 | 371 | const TBits &sharedTPC = track->GetTPCSharedMap(); |
959ea9d8 | 372 | for(Int_t ibit = 0; ibit < 160; ibit++) if(sharedTPC.TestBitNumber(ibit)) nclustersTPCshared++; |
76d0b522 | 373 | // TRD clusters and tracklets |
374 | UChar_t nclustersTRD = track->GetTRDncls(); | |
375 | UChar_t ntrackletsTRDPID = track->GetTRDntrackletsPID(); | |
959ea9d8 | 376 | Int_t nslicesTRD = track->GetDetPid()->GetTRDnSlices(); |
76d0b522 | 377 | Int_t chi2TRD = track->GetTRDchi2(); |
959ea9d8 | 378 | AliAODPid* aodpid= track->GetDetPid(); |
379 | Double_t* arraytrdsignals; | |
6736efd5 | 380 | arraytrdsignals=aodpid->GetTRDslices(); |
959ea9d8 | 381 | Int_t nslicetemp=0; |
382 | Int_t trdlayer[6]; | |
383 | for(Int_t iplane = 0; iplane < 6; iplane++){ | |
7bdde22f | 384 | trdlayer[iplane]=0; |
959ea9d8 | 385 | } |
386 | ||
387 | for(Int_t iplane = 0; iplane < 6; iplane++){ | |
7bdde22f | 388 | nslicetemp=0; |
389 | for(Int_t b=(iplane*8);b<((iplane*8)+8);b++){ | |
390 | if(ntrackletsTRDPID>0){ | |
391 | if(arraytrdsignals[b]>0.001) nslicetemp++; | |
392 | } | |
959ea9d8 | 393 | } |
7bdde22f | 394 | if(nslicetemp > 0) trdlayer[iplane]=1; |
959ea9d8 | 395 | } |
396 | ||
76d0b522 | 397 | // ITS and TRD acceptance maps |
398 | UChar_t itsPixel = track->GetITSClusterMap(); | |
959ea9d8 | 399 | Bool_t statusL0 = kFALSE; |
400 | if(TESTBIT(itsPixel, 0)) statusL0 = kTRUE; | |
401 | Bool_t statusL1 = kFALSE; | |
402 | if(TESTBIT(itsPixel, 1)) statusL1 = kTRUE; | |
76d0b522 | 403 | |
404 | // HFE DCA | |
959ea9d8 | 405 | Float_t dcaxy = -999.; |
406 | Float_t dcaz = -999.; | |
407 | fExtraCuts->GetImpactParameters((AliVTrack *)track,dcaxy,dcaz); | |
76d0b522 | 408 | |
409 | // Kink | |
410 | Int_t kink = 0; | |
411 | if(fExtraCuts->IsKinkDaughter(track)) kink = 1; | |
412 | ||
413 | // kink mother | |
414 | Int_t kinkmotherpass = 0; | |
415 | for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) { | |
416 | if(track->GetID() == listofmotherkink[kinkmother]) { | |
417 | kinkmotherpass = 1; | |
418 | continue; | |
419 | } | |
420 | } | |
421 | ||
422 | // ID track to see if negative | |
423 | Int_t id = track->GetID(); | |
424 | ||
425 | // Double counted | |
959ea9d8 | 426 | Int_t doublec = 0; |
427 | for(Int_t l=0; l < counterdc; l++){ | |
7bdde22f | 428 | Int_t iTrack2 = arraytrack.At(l); |
959ea9d8 | 429 | if(iTrack2==id) doublec=1; |
76d0b522 | 430 | } |
431 | //printf("Doublec %d\n",doublec); | |
432 | ||
433 | // Add the id at this place | |
7bdde22f | 434 | arraytrack.AddAt(id,counterdc); |
959ea9d8 | 435 | counterdc++; |
76d0b522 | 436 | |
437 | // Filter | |
438 | Int_t filter[20]; | |
439 | for(Int_t k=0; k<20; k++) { | |
440 | filter[k]=0; | |
441 | Int_t u = 1<<k; | |
442 | if((track->TestFilterBit(u))) { | |
7bdde22f | 443 | filter[k] = 1; |
76d0b522 | 444 | } |
445 | } | |
446 | Int_t filter0 = filter[0]; | |
447 | Int_t filter1 = filter[1]; | |
959ea9d8 | 448 | Int_t filter2 = filter[2]; |
76d0b522 | 449 | Int_t filter3 = filter[3]; |
959ea9d8 | 450 | Int_t filter4 = filter[4]; |
76d0b522 | 451 | Int_t filter5 = filter[5]; |
452 | Int_t filter6 = filter[6]; | |
453 | Int_t filter7 = filter[7]; | |
454 | Int_t filter8 = filter[8]; | |
455 | Int_t filter9 = filter[9]; | |
456 | Int_t filter10 = filter[10]; | |
457 | Int_t filter11 = filter[11]; | |
458 | Int_t filter12 = filter[12]; | |
459 | Int_t filter13 = filter[13]; | |
460 | Int_t filter14 = filter[14]; | |
461 | Int_t filter15 = filter[15]; | |
462 | Int_t filter16 = filter[16]; | |
463 | Int_t filter17 = filter[17]; | |
464 | Int_t filter18 = filter[18]; | |
465 | Int_t filter19 = filter[19]; | |
466 | ||
7bdde22f | 467 | // EMCAL cluster |
468 | Double_t emcalEnergyOverP = -1., | |
469 | emcalNSigma = -1., | |
470 | showershape[4] = {0.,0.,0.,0.}; | |
471 | if(track->IsEMCAL()){ | |
472 | emcalNSigma = pid->NumberOfSigmasEMCAL(track, AliPID::kElectron, emcalEnergyOverP, &showershape[0]); | |
473 | } | |
474 | ||
76d0b522 | 475 | Int_t eventnb = fEventNumber; |
476 | ||
477 | //printf("track\n"); | |
478 | ||
959ea9d8 | 479 | signal = 0; |
76d0b522 | 480 | if(mcthere){ |
481 | Int_t label = TMath::Abs(track->GetLabel()); | |
482 | if(label && label < fAODArrayMCInfo->GetEntriesFast()) | |
483 | mctrack = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(label)); | |
484 | if(!mctrack) continue; | |
959ea9d8 | 485 | if(fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mctrack)) signal = 1; |
76d0b522 | 486 | // Kinematics |
487 | chargemc = mctrack->Charge() > 0. ? 1. : -1.; | |
bca6abf5 | 488 | momentummc = mctrack->P() * chargemc; |
489 | transversemomentummc = mctrack->Pt() * chargemc; | |
76d0b522 | 490 | etamc = mctrack->Eta(); |
491 | phimc = mctrack->Phi(); | |
492 | pdg = mctrack->GetPdgCode(); | |
493 | ||
494 | // Get Production Vertex in radial direction | |
495 | vx = mctrack->Xv(); | |
496 | vy = mctrack->Yv(); | |
497 | vz = mctrack->Zv(); | |
959ea9d8 | 498 | eR = TMath::Sqrt(vx*vx+vy*vy); |
76d0b522 | 499 | |
500 | // Get Mother PDG code of the particle | |
5565ef0f | 501 | /* |
76d0b522 | 502 | Int_t motherPdg = 0; |
503 | Int_t motherlabel = TMath::Abs(mctrack->GetMother()); | |
504 | if(motherlabel >= 0 && motherlabel < fAODArrayMCInfo->GetEntriesFast()){ | |
505 | AliAODMCParticle *mother = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(motherlabel)); | |
506 | if(mother) motherPdg = mother->GetPdgCode(); | |
507 | } | |
5565ef0f | 508 | */ |
76d0b522 | 509 | |
510 | // derive source | |
959ea9d8 | 511 | source = 5; |
512 | if(fSignalCuts->IsCharmElectron(mctrack)) source = 0; | |
513 | else if(fSignalCuts->IsBeautyElectron(mctrack)) source = 1; | |
514 | else if(fSignalCuts->IsGammaElectron(mctrack)) source = 2; | |
515 | else if(fSignalCuts->IsNonHFElectron(mctrack)) source = 3; | |
516 | else if(TMath::Abs(pdg) == 11) source = 4; | |
517 | else source = 5; | |
76d0b522 | 518 | |
519 | } | |
520 | ||
521 | ||
522 | // Fill Tree | |
523 | //printf("Fill\n"); | |
959ea9d8 | 524 | (*fDebugTree) << "PIDdebug" |
525 | << "centrality=" << centrality | |
526 | << "MBtrigger=" << isMBTrigger | |
527 | << "CentralTrigger=" << isCentralTrigger | |
528 | << "SemicentralTrigger=" << isSemicentralTrigger | |
529 | << "EMCALtrigger=" << isEMCALTrigger | |
7bdde22f | 530 | << "run=" << run |
531 | << "eventnb=" << eventnb | |
532 | << "vx=" << vtx[0] | |
959ea9d8 | 533 | << "vy=" << vtx[1] |
534 | << "vz=" << vtx[2] | |
7bdde22f | 535 | << "ncontrib=" << ncontrib |
536 | << "id=" << id | |
537 | << "dc=" << doublec | |
959ea9d8 | 538 | << "p=" << momentum |
7bdde22f | 539 | << "ptpc=" << momentumTPC |
540 | << "pt=" << transversemomentum | |
541 | << "eta=" << eta | |
959ea9d8 | 542 | << "phi=" << phi |
7bdde22f | 543 | << "itsrefit=" << itsrefit |
544 | << "tpcrefit=" << tpcrefit | |
545 | << "tofpid=" << tofpid | |
546 | << "nclustersTPC=" << nclustersTPCfit | |
547 | << "nclustersTPCall=" << nclustersTPCall | |
959ea9d8 | 548 | << "nclustersTPCPID=" << nclustersTPCPID |
549 | << "nclustersTPCshared=" << nclustersTPCshared | |
550 | << "ncrossedRowsTPC=" << ncrossedRowsTPC | |
551 | << "clusterRatioTPC=" << clusterRatioTPCfit | |
7bdde22f | 552 | << "clusterRatioTPCall=" << clusterRatioTPCall |
959ea9d8 | 553 | << "nclustersITS=" << nclustersITS |
7bdde22f | 554 | << "nclustersTRD=" << nclustersTRD |
959ea9d8 | 555 | << "ntrackletsTRD=" << ntrackletsTRDPID |
7bdde22f | 556 | << "nslicesTRD=" << nslicesTRD |
959ea9d8 | 557 | << "trd0=" << trdlayer[0] |
558 | << "trd1=" << trdlayer[1] | |
559 | << "trd2=" << trdlayer[2] | |
560 | << "trd3=" << trdlayer[3] | |
561 | << "trd4=" << trdlayer[4] | |
562 | << "trd5=" << trdlayer[5] | |
563 | << "chi2TRD=" << chi2TRD | |
7bdde22f | 564 | << "statusITS0=" << statusL0 |
959ea9d8 | 565 | << "statusITS1=" << statusL1 |
7bdde22f | 566 | << "TOFsigmaEl=" << nSigmaTOF |
959ea9d8 | 567 | << "TPCsigmaEl=" << nSigmaTPC |
7bdde22f | 568 | << "TPCsigmaElcorr=" << nSigmaTPCcorr |
959ea9d8 | 569 | << "TPCdEdx=" << tPCdEdx |
570 | << "TPCdEdxcorr=" << tPCdEdxcorr | |
7bdde22f | 571 | << "dcaR=" << dcaxy |
572 | << "EMCALEOP=" << emcalEnergyOverP | |
573 | << "EMCALsigmaEl=" << emcalNSigma | |
574 | << "showershape0=" << showershape[0] | |
575 | << "showershape1=" << showershape[1] | |
576 | << "showershape2=" << showershape[2] | |
577 | << "showershape3=" << showershape[3] | |
959ea9d8 | 578 | << "dcaZ=" << dcaz |
7bdde22f | 579 | << "kinkdaughter=" << kink |
580 | << "kinkmother=" << kinkmotherpass | |
581 | << "nbofmotherkink=" << numberofmotherkink | |
582 | << "filter0=" << filter0 | |
583 | << "filter1=" << filter1 | |
584 | << "filter2=" << filter2 | |
585 | << "filter3=" << filter3 | |
586 | << "filter4=" << filter4 | |
587 | << "filter5=" << filter5 | |
588 | << "filter6=" << filter6 | |
589 | << "filter7=" << filter7 | |
590 | << "filter8=" << filter8 | |
591 | << "filter9=" << filter9 | |
592 | << "filter10=" << filter10 | |
593 | << "filter11=" << filter11 | |
594 | << "filter12=" << filter12 | |
595 | << "filter13=" << filter13 | |
596 | << "filter14=" << filter14 | |
597 | << "filter15=" << filter15 | |
598 | << "filter16=" << filter16 | |
599 | << "filter17=" << filter17 | |
600 | << "filter18=" << filter18 | |
601 | << "filter19=" << filter19 | |
602 | << "mcp=" << momentummc | |
959ea9d8 | 603 | << "mcpt=" << transversemomentummc |
7bdde22f | 604 | << "mceta=" << etamc |
959ea9d8 | 605 | << "mcphi=" << phimc |
606 | << "mcpdg=" << pdg | |
7bdde22f | 607 | << "source=" << source |
608 | << "px=" << vx | |
959ea9d8 | 609 | << "py=" << vy |
610 | << "pz=" << vz | |
7bdde22f | 611 | << "eR=" << eR |
612 | << "mccharge=" << chargemc | |
613 | << "signal=" << signal | |
614 | << "\n"; | |
959ea9d8 | 615 | |
76d0b522 | 616 | |
617 | //printf("after\n"); | |
618 | ||
619 | } | |
620 | ||
76d0b522 | 621 | fEventNumber++; |
622 | ||
623 | ||
624 | } | |
625 | ||
626 | ||
627 | void AliHFEdebugTreeTaskAOD::SetFileName(const char *filename){ fFilename = filename; } | |
628 | void AliHFEdebugTreeTaskAOD::Terminate(Option_t *){ | |
629 | ||
630 | if(fDebugTree) delete fDebugTree; | |
631 | fDebugTree=0x0; | |
632 | ||
633 | } | |
634 |