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