1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 // Markus Fasel <M.Fasel@gsi.de>
24 #include "AliAnalysisManager.h"
25 #include "AliCentrality.h"
26 #include "AliESDEvent.h"
27 #include "AliESDtrack.h"
28 #include "AliESDtrackCuts.h"
29 #include "AliESDVertex.h"
30 #include "AliHFEcuts.h"
31 #include "AliHFEsignalCuts.h"
32 #include "AliInputEventHandler.h"
34 #include "AliMCEvent.h"
35 #include "AliMCEventHandler.h"
36 #include "AliMCParticle.h"
38 #include "AliPIDResponse.h"
39 #include "AliTrackReference.h"
40 #include "AliVEvent.h"
41 #include "AliHFEpidTPC.h"
42 #include "AliHFEpidTRD.h"
43 #include "AliHFEmcQA.h"
44 #include "TTreeStream.h"
46 #include "AliHFEdebugTreeTask.h"
48 ClassImp(AliHFEdebugTreeTask)
50 AliHFEdebugTreeTask::AliHFEdebugTreeTask():
60 fFilename("HFEtree.root"),
67 AliHFEdebugTreeTask::AliHFEdebugTreeTask(const char *name):
68 AliAnalysisTaskSE(name),
77 fFilename("HFEtree.root"),
81 fTRDpid = new AliHFEpidTRD("QAtrdPID");
82 fTPCpid = new AliHFEpidTPC("QAtpcPID");
85 AliHFEdebugTreeTask::~AliHFEdebugTreeTask(){
86 if(fDebugTree) delete fDebugTree;
87 if(fTRDpid) delete fTRDpid;
88 if(fTPCpid) delete fTPCpid;
91 void AliHFEdebugTreeTask::UserCreateOutputObjects(){
93 // Create debug tree, signal cuts and track cuts
95 fDebugTree = new TTreeSRedirector(fFilename.Data());
97 fSignalCuts = new AliHFEsignalCuts("HFEsignalCuts", "HFE MC Signal definition");
99 fTrackCuts = new AliHFEcuts("fTrackCuts", "Basic HFE track cuts");
100 fTrackCuts->CreateStandardCuts();
102 fTrackCuts->SetMinNClustersTPC(fNclustersTPC);
103 fTrackCuts->SetMinRatioTPCclusters(0);
104 fTrackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
105 fTrackCuts->SetMinNClustersTPCPID(fNclustersTPCPID);
106 fTrackCuts->SetMinNClustersITS(fNclustersITS);
108 fTrackCuts->SetUseMixedVertex(kTRUE);
109 fTrackCuts->SetVertexRange(10.);
110 fTrackCuts->Initialize();
112 fExtraCuts = new AliHFEextraCuts("hfeExtraCuts","HFE Extra Cuts");
116 void AliHFEdebugTreeTask::UserExec(Option_t *){
118 // User Exec: Fill debug Tree
122 AliPIDResponse *pid = NULL;
123 AliInputEventHandler *handler = dynamic_cast<AliInputEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
125 pid = handler->GetPIDResponse();
127 AliError("No Handler");
130 AliError("No PID response");
134 AliError("No Input event");
138 AliESDtrack copyTrack;
140 fTrackCuts->SetRecEvent(fInputEvent);
143 if(fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5)){
144 AliDebug(1, "Event flagged as pileup\n");
147 if(!fTrackCuts->CheckEventCuts("fCutsEvRec", fInputEvent)){
148 AliDebug(1, "Event rejected by the event cuts\n");
153 Int_t run = fInputEvent->GetRunNumber();
156 UInt_t trigger = fInputHandler->IsEventSelected();
157 Bool_t isMBTrigger = trigger & AliVEvent::kMB;
158 Bool_t isCentralTrigger = trigger & AliVEvent::kCentral;
159 Bool_t isSemicentralTrigger = trigger & AliVEvent::kSemiCentral;
160 Bool_t isEMCALTrigger = trigger & AliVEvent::kEMCEJE;
162 // Check if MC information is available
163 Bool_t mcthere = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()) != NULL;
165 fTrackCuts->SetMCEvent(fMCEvent);
166 fSignalCuts->SetMCEvent(fMCEvent);
170 AliStack* stack = 0x0;
172 stack = fMCEvent->Stack();
173 if(!stack) AliError("No Stack");
176 // Get Primary Vertex
177 const AliVVertex *vertex = fInputEvent->GetPrimaryVertex();
180 Double_t ncontrib = fInputEvent->GetPrimaryVertex()->GetNContributors();
183 Float_t centrality = -1.;
184 AliESDEvent *event = (dynamic_cast<AliESDEvent *>(fInputEvent));
186 TString beamtype = event->GetBeamType();
187 //printf("Beam type %s\n",(const char*)beamtype);
188 if(!beamtype.CompareTo("Pb-Pb") || !beamtype.CompareTo("A-A")){
190 AliDebug(1, "Heavy-Ion event\n");
191 AliCentrality *hicent = fInputEvent->GetCentrality();
192 centrality = hicent->GetCentralityPercentile("V0M");
196 fExtraCuts = new AliHFEextraCuts("hfeExtraCuts","HFE Extra Cuts");
198 fExtraCuts->SetRecEventInfo(event);
200 // Store event selection variables
201 (*fDebugTree) << "EventDebug"
202 << "Centrality=" << centrality
203 << "VertexZ=" << vtx[2]
204 << "NumberOfContributors=" << ncontrib
209 Double_t charge, eta, phi, momentum, transversemomentum;
214 AliMCParticle * mcpart;
215 for(Int_t itrk = 0; itrk < fMCEvent->GetNumberOfTracks(); itrk++){
216 mcpart = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(itrk));
217 if(!mcpart) continue;
218 if(!fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mcpart)) continue;
220 charge = mcpart->Charge() > 0. ? 1. : -1.;
221 momentum = mcpart->P() * charge;
222 transversemomentum = mcpart->Pt() * charge;
225 Int_t pdg = mcpart->Particle()->GetPdgCode();
227 // Get Production Vertex in radial direction
228 Double_t vx = mcpart->Particle()->Vx(),
229 vy = mcpart->Particle()->Vy();
230 Double_t productionVertex = TMath::Sqrt(vx*vx+vy*vy);
232 // Get Mother PDG code of the particle
234 Int_t motherlabel = mcpart->Particle()->GetFirstMother();
235 if(motherlabel >= 0 && motherlabel < fMCEvent->GetNumberOfTracks()){
236 AliMCParticle *mother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(motherlabel));
237 if(mother) motherPdg = mother->Particle()->GetPdgCode();
242 if(fSignalCuts->IsCharmElectron(mcpart)) source = 0;
243 else if(fSignalCuts->IsBeautyElectron(mcpart)) source = 1;
244 else if(fSignalCuts->IsGammaElectron(mcpart)) source = 2;
245 else if(fSignalCuts->IsNonHFElectron(mcpart)) source = 3;
246 else if(TMath::Abs(pdg) == 11) source = 4;
249 // Momemntum at the inner wall of the TPC
250 Double_t pTPC = 0., ptTPC = 0.;
251 AliTrackReference *ref = FindTrackReference(mcpart, 80, 270, AliTrackReference::kTPC);
259 (*fDebugTree) << "MCDebug"
260 << "centrality=" << centrality
261 << "MBtrigger=" << isMBTrigger
262 << "CentralTrigger=" << isCentralTrigger
263 << "SemicentralTrigger=" << isSemicentralTrigger
264 << "EMCALtrigger=" << isEMCALTrigger
267 << "pt=" << transversemomentum
271 << "ProductionVertex=" << productionVertex
272 << "motherPdg=" << motherPdg
273 << "source=" << source
279 Double_t mcp, mcpt, mcptTPC, mcpTPC; // MC Variables added to the debug tree
280 for(Int_t itrack = 0; itrack < fInputEvent->GetNumberOfTracks(); itrack++){
282 track = dynamic_cast<AliESDtrack *>(fInputEvent->GetTrack(itrack));
284 // Cut track (Only basic track cuts)
285 if(!fTrackCuts->CheckParticleCuts(AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kStepRecKineITSTPC, track)) continue;
286 // Debug streaming of PID-related quantities
287 copyTrack.~AliESDtrack();
288 new(©Track) AliESDtrack(*track);
289 if(fTPCpid->HasEtaCorrection()) fTPCpid->ApplyEtaCorrection(©Track, AliHFEpidObject::kESDanalysis); // Apply Eta Correction on copy track
290 Double_t nSigmaTOF = pid->NumberOfSigmasTOF(track, AliPID::kElectron);
291 Double_t nSigmaTPC = pid->NumberOfSigmasTPC(©Track, AliPID::kElectron);
292 //if(TMath::Abs(nSigmaTOF) > 5) continue;
293 // we are not interested in tracks which are more than 5 sigma away from the electron hypothesis in either TOF or TPC
294 Double_t tPCdEdx = copyTrack.GetTPCsignal();
295 // Signal, source and MCPID
296 Bool_t signal = kTRUE;
298 mcp = mcpt = mcpTPC = mcptTPC = 0.;
302 Double_t bgcategory = 0.;
304 Int_t mesonID = -999;
305 Double_t xr[3]={-999,-999,-999};
308 Double_t unique=-999;
309 Double_t mesonunique=-999;
310 Double_t mesonR=-999;
311 Double_t mesonZ=-999;
312 Double_t mesonMomPdg=-999;
313 Double_t mesonMomPt=-999;
314 Double_t mesonGMomPdg=-999;
315 Double_t mesonGGMomPdg=-999;
316 Double_t mesonPt = -999;
317 Double_t mceta = -999;
318 Double_t mcphi = -999;
323 AliMCParticle *mctrack;
324 if((mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(track->GetLabel()))))){
325 if(!fTrackCuts->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE;
329 if(fSignalCuts->IsCharmElectron(track)) source = 0;
330 else if(fSignalCuts->IsBeautyElectron(track)) source = 1;
331 else if(fSignalCuts->IsGammaElectron(track)) source = 2;
332 else if(fSignalCuts->IsNonHFElectron(track)) source = 3;
333 else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 11)) source = 4;
336 if(!mctrack) continue;
339 mcpt = mctrack->Pt();
341 mceta = mctrack->Eta();
342 mcphi = mctrack->Phi();
343 mcpdg = mctrack->Particle()->GetPdgCode();
345 AliTrackReference *ref = FindTrackReference(mctrack, 80, 270, AliTrackReference::kTPC);
352 TParticle *mctrack1 = mctrack->Particle();
353 mesonID=GetElecSourceMC(mctrack1);
354 if(mesonID==AliHFEmcQA::kGammaPi0 || mesonID==AliHFEmcQA::kPi0) mArr=0; //pion
355 else if(mesonID==AliHFEmcQA::kGammaEta || mesonID==AliHFEmcQA::kEta) mArr=1; //eta
356 else if(mesonID==AliHFEmcQA::kGammaOmega || mesonID==AliHFEmcQA::kOmega) mArr=2; //omega
357 else if(mesonID==AliHFEmcQA::kGammaPhi || mesonID==AliHFEmcQA::kPhi) mArr=3; //phi
358 else if(mesonID==AliHFEmcQA::kGammaEtaPrime || mesonID==AliHFEmcQA::kEtaPrime) mArr=4; //etaprime
359 else if(mesonID==AliHFEmcQA::kGammaRho0 || mesonID==AliHFEmcQA::kRho0) mArr=5; //rho
363 eR= TMath::Sqrt(xr[0]*xr[0]+xr[1]*xr[1]);
365 TParticle *mctrackt = mctrack->Particle();
366 unique=mctrackt->GetUniqueID();
368 AliMCParticle *mctrackmother = NULL;
369 AliMCParticle *mctrackmother2 = NULL;
372 if(mesonID>=AliHFEmcQA::kGammaPi0) { // conversion electron, be careful with the enum odering
373 Int_t glabel=TMath::Abs(mctrack->GetMother()); // gamma label
374 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
375 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's label
376 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
377 mesonPt = mctrackmother->Pt(); //meson pt
379 mctrackmother->XvYvZv(xr);
380 mesonR = TMath::Sqrt(xr[0]*xr[0]+xr[1]*xr[1]);
383 mctrackt = mctrackmother->Particle();
385 mesonunique = mctrackt->GetUniqueID();
388 Int_t glabel2=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
389 if((mctrackmother2 = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel2)))){
390 mesonMomPdg=mctrackmother2->PdgCode();
391 mesonMomPt=mctrackmother2->Pt();
394 if(glabel>fMCEvent->GetNumberOfPrimaries()) {
396 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
397 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
398 mesonMomPdg=mctrackmother->PdgCode();
399 mesonMomPt=mctrackmother->Pt();
400 if(TMath::Abs(mctrackmother->PdgCode())==310){
402 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother's mother
403 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
404 mesonGMomPdg=mctrackmother->PdgCode();
405 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
406 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
407 mesonGGMomPdg=mctrackmother->PdgCode();
416 else{ // nonHFE except for the conversion electron
417 Int_t glabel=TMath::Abs(mctrack->GetMother());
418 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
419 mesonPt = mctrackmother->Pt(); //meson pt
421 mctrackmother->XvYvZv(xr);
422 mesonR = TMath::Sqrt(xr[0]*xr[0]+xr[1]*xr[1]);
425 mctrackt = mctrackmother->Particle();
427 mesonunique = mctrackt->GetUniqueID();
429 if(glabel>fMCEvent->GetNumberOfPrimaries()) {
431 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
432 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
433 mesonMomPdg=mctrackmother->PdgCode();
434 mesonMomPt=mctrackmother->Pt();
435 if(TMath::Abs(mctrackmother->PdgCode())==310){
437 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother's mother
438 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
439 mesonGMomPdg=mctrackmother->PdgCode();
440 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
441 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
442 mesonGGMomPdg=mctrackmother->PdgCode();
455 // Get V0 tag (if available)
457 if(track->TestBit(BIT(14))) v0pid = AliPID::kElectron;
458 else if(track->TestBit(BIT(15))) v0pid = AliPID::kPion;
459 else if(track->TestBit(BIT(16))) v0pid = AliPID::kProton;
461 charge = track->Charge() > 0 ? 1. : -1.;
464 momentum = track->P() * charge;
465 transversemomentum = track->Pt() * charge;
466 Double_t momentumTPC = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->P() : 0.;
467 Double_t transversemomentumTPC = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->Pt() : 0.;
468 // ITS number of clusters
469 UChar_t nclustersITS = track->GetITSclusters(NULL);
470 Double_t chi2matching = track->GetChi2TPCConstrainedVsGlobal(dynamic_cast<const AliESDVertex *>(vertex));
471 Double_t chi2PerClusterITS = 0.0;
472 if (nclustersITS != 0) chi2PerClusterITS = track->GetITSchi2() / Float_t(nclustersITS);
473 // TPC number of clusters (different definitions)
474 UChar_t nclustersTPCfit = track->GetTPCNcls();
475 UChar_t nclustersTPCall = 0;
476 const TBits &clusterTPC = track->GetTPCClusterMap();
477 nclustersTPCall = clusterTPC.CountBits();
478 UChar_t nclustersTPCPID = track->GetTPCsignalN();
479 UChar_t nfindableTPC = track->GetTPCNclsF();
480 Double_t clusterRatioTPCfit = 0.0;
481 if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPCfit = static_cast<Double_t>(nclustersTPCfit)/static_cast<Double_t>(nfindableTPC);
482 Double_t clusterRatioTPCall = 0.0;
483 if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPCall = static_cast<Double_t>(nclustersTPCall)/static_cast<Double_t>(nfindableTPC);
484 UChar_t nclustersTPCshared = 0;
485 Float_t ncrossedRowsTPC = track->GetTPCCrossedRows();
486 const TBits &sharedTPC = track->GetTPCSharedMap();
487 for(Int_t ibit = 0; ibit < 160; ibit++) if(sharedTPC.TestBitNumber(ibit)) nclustersTPCshared++;
488 // TRD clusters and tracklets
489 UChar_t nclustersTRD = track->GetTRDncls();
490 UChar_t ntrackletsTRDPID = track->GetTRDntrackletsPID();
491 // ITS and TRD acceptance maps
492 UChar_t hasClusterITS[6], statusITS[6], hasTrackletTRD[6];
493 UChar_t itsPixel = track->GetITSClusterMap();
494 for(Int_t icl = 0; icl < 6; icl++){
495 hasClusterITS[icl] = TESTBIT(itsPixel, icl) ? 1 : 0;
496 if(CheckITSstatus(track, icl)) statusITS[icl] = 1;
497 else statusITS[icl] = 0;
499 Double_t trddEdxSum[6];
500 for(Int_t a=0;a<6;a++) { trddEdxSum[a]= 0.;}
501 for(Int_t itl = 0; itl < 6; itl++){
502 Int_t nSliceNonZero = 0;
503 trddEdxSum[itl] = track->GetTRDslice(itl, 0); // in new reconstruction slice 0 contains the total charge
504 for(Int_t islice = 0; islice < 8; islice++){
505 if(track->GetTRDslice(itl, islice) > 0.001) nSliceNonZero++;
507 hasTrackletTRD[itl] = nSliceNonZero ? 1 : 0;
510 Double_t pidprobs[5];
511 track->GetTRDpid(pidprobs);
512 Double_t likeEleTRD = pidprobs[0];
513 Double_t likeEleTRDn = likeEleTRD/(likeEleTRD + pidprobs[2]);
514 Double_t trdtruncmean1 = fTRDpid->GetTRDSignalV1(track, 0.6);
515 Double_t trdtruncmean2 = fTRDpid->GetTRDSignalV2(track, 0.6);
518 Float_t b[2] = {0.,0.};
519 Float_t bCov[3] = {0.,0.,0.};
520 track->GetImpactParameters(b,bCov);
521 Double_t dca = TMath::Sqrt(b[0]*b[0]+b[1]*b[1]); // impact parameter space
522 Double_t dcaSR=0, dcaSZ=0;
523 if(bCov[0]>0) dcaSR = b[0]/TMath::Sqrt(bCov[0]); // normalised impact parameter xy
524 if(bCov[2]>0) dcaSZ = b[1]/TMath::Sqrt(bCov[2]); // normalised impact parameter z
525 Double_t dcaS = AliESDtrackCuts::GetSigmaToVertex(track); // n_sigma
528 Double_t hfeb[2] = {-99.,-99.};
529 Double_t hfebCov[3] = {-999.,-999.,-999.};
530 fExtraCuts->GetHFEImpactParameters(track, hfeb, hfebCov);
532 Double_t tofdx= -999.0;
533 Double_t tofdz= -999.0;
534 tofdx=track->GetTOFsignalDx();
535 tofdz=track->GetTOFsignalDz();
539 status = track->GetStatus();
540 Bool_t hasTOFout = status&AliESDtrack::kTOFout;
541 Bool_t hasTOFtime = status&AliESDtrack::kTIME;
542 Bool_t hasTOFpid = status&AliESDtrack::kTOFpid;
543 Bool_t hasgoodTOF = kFALSE;
544 if (hasTOFout && hasTOFtime && hasTOFpid) hasgoodTOF = kTRUE;
547 Bool_t hasTRDin = status&AliESDtrack::kTRDin;
550 // TOF mismatch (particle spectra group)
551 Int_t mismatchlevel=0; // default value; in data always 0
554 track->GetTOFLabel(tofLabel);
555 if(TMath::Abs(track->GetLabel()) != TMath::Abs(tofLabel[0]) || tofLabel[1] > 0) mismatchlevel=1;
556 TParticle *matchedTrack = stack->Particle(TMath::Abs(tofLabel[0]));
557 if(TMath::Abs(matchedTrack->GetFirstMother()) == TMath::Abs(track->GetLabel()))
559 if(mismatchlevel==1) mismatchlevel=3;
560 else mismatchlevel=2;
566 (*fDebugTree) << "PIDdebug"
567 << "centrality=" << centrality
568 << "MBtrigger=" << isMBTrigger
569 << "CentralTrigger=" << isCentralTrigger
570 << "SemicentralTrigger=" << isSemicentralTrigger
571 << "EMCALtrigger=" << isEMCALTrigger
572 << "signal=" << signal
573 << "source=" << source
577 << "ptpc=" << momentumTPC
578 << "pt=" << transversemomentum
579 << "pttpc=" << transversemomentumTPC
582 << "mcpTPC=" << mcpTPC
583 << "mcptTPC=" << mcptTPC
589 << "ntracklets=" << ntrackletsTRDPID
590 << "nclustersTPC=" << nclustersTPCfit
591 << "nclustersTPCall=" << nclustersTPCall
592 << "nclustersTPCPID=" << nclustersTPCPID
593 << "nclustersTPCshared=" << nclustersTPCshared
594 << "ncrossedRowsTPC=" << ncrossedRowsTPC
595 << "clusterRatioTPC=" << clusterRatioTPCfit
596 << "clusterRatioTPCall=" << clusterRatioTPCall
597 << "nclustersITS=" << nclustersITS
598 << "nclusters=" << nclustersTRD
599 << "chi2matching=" << chi2matching
600 << "chi2PerClusterITS=" << chi2PerClusterITS
601 << "its0=" << hasClusterITS[0]
602 << "its1=" << hasClusterITS[1]
603 << "its2=" << hasClusterITS[2]
604 << "its3=" << hasClusterITS[3]
605 << "its4=" << hasClusterITS[4]
606 << "its5=" << hasClusterITS[5]
607 << "statusITS0=" << statusITS[0]
608 << "statusITS1=" << statusITS[1]
609 << "statusITS2=" << statusITS[2]
610 << "statusITS3=" << statusITS[3]
611 << "statusITS4=" << statusITS[4]
612 << "statusITS5=" << statusITS[5]
613 << "trd0=" << hasTrackletTRD[0]
614 << "trd1=" << hasTrackletTRD[1]
615 << "trd2=" << hasTrackletTRD[2]
616 << "trd3=" << hasTrackletTRD[3]
617 << "trd4=" << hasTrackletTRD[4]
618 << "trd5=" << hasTrackletTRD[5]
619 << "TRDdEdxl0=" << trddEdxSum[0]
620 << "TRDdEdxl1=" << trddEdxSum[1]
621 << "TRDdEdxl2=" << trddEdxSum[2]
622 << "TRDdEdxl3=" << trddEdxSum[3]
623 << "TRDdEdxl4=" << trddEdxSum[4]
624 << "TRDdEdxl5=" << trddEdxSum[5]
625 << "TOFsigmaEl=" << nSigmaTOF
626 << "TPCsigmaEl=" << nSigmaTPC
627 << "TPCdEdx=" << tPCdEdx
628 << "TRDlikeEl=" << likeEleTRD
629 << "TRDlikeEln=" << likeEleTRDn
630 << "trdtruncmean1=" << trdtruncmean1
631 << "trdtruncmean2=" << trdtruncmean2
638 << "hfedcaR=" << hfeb[0]
639 << "hfedcaZ=" << hfeb[1]
640 << "hfedcacovR=" << hfebCov[0]
641 << "hfedcacovZ=" << hfebCov[2]
647 << "statusTOFtracking=" << hasgoodTOF
648 << "TOFmismatchlevel=" << mismatchlevel
649 << "statusTRDtracking=" << hasTRDin
650 << "ncontrib=" << ncontrib
651 << "mesonID=" << mesonID
653 << "mesonR=" << mesonR
655 << "mesonZ=" << mesonZ
656 << "unique=" << unique
657 << "mesonunique=" << mesonunique
658 << "bgcategory=" << bgcategory
659 << "mesonpt=" << mesonPt
660 << "mesonMomPdg=" << mesonMomPdg
661 << "mesonGMomPdg=" << mesonGMomPdg
662 << "mesonGGMomPdg=" << mesonGGMomPdg
663 << "mesonMomPt=" << mesonMomPt
669 void AliHFEdebugTreeTask::SetFileName(const char *filename){ fFilename = filename; }
670 //___________________________________________________________
671 AliTrackReference *AliHFEdebugTreeTask::FindTrackReference(AliMCParticle *track, Float_t minRadius, Float_t maxRadius, Int_t detectorID)
674 // Find the track reference
676 AliTrackReference *ref = NULL, *reftmp;
678 for(Int_t iref = 0; iref < track->GetNumberOfTrackReferences(); iref++){
679 reftmp = track->GetTrackReference(iref);
680 if(reftmp->DetectorId() != detectorID) continue;
681 radius = reftmp->R();
682 if(radius >= minRadius && radius < maxRadius){
686 if(radius > maxRadius) break;
691 //__________________________________________
692 Int_t AliHFEdebugTreeTask::GetElecSourceMC(TParticle * const mcpart)
694 // decay particle's origin
697 AliDebug(1, "no mcparticle, return\n");
701 if ( abs(mcpart->GetPdgCode()) != AliHFEmcQA::kElectronPDG ) return AliHFEmcQA::kMisID;
704 Bool_t isFinalOpenCharm = kFALSE;
706 Int_t iLabel = mcpart->GetFirstMother();
708 AliDebug(1, "Stack label is negative, return\n");
712 AliMCParticle *mctrack = NULL;
714 if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(iLabel))))) return -1;
715 TParticle *partMother = mctrack->Particle();
716 TParticle *partMotherCopy = mctrack->Particle();
717 Int_t maPdgcode = partMother->GetPdgCode();
719 // if the mother is charmed hadron
720 if ( (int(abs(maPdgcode)/100.)%10) == AliHFEmcQA::kCharm || (int(abs(maPdgcode)/1000.)%10) == AliHFEmcQA::kCharm ) {
722 for (Int_t i=0; i<fNparents; i++){
723 if (abs(maPdgcode)==fParentSelect[0][i]){
724 isFinalOpenCharm = kTRUE;
727 if (!isFinalOpenCharm) return -1;
729 // iterate until you find B hadron as a mother or become top ancester
730 for (Int_t i=1; i<fgkMaxIter; i++){
732 Int_t jLabel = partMother->GetFirstMother();
734 origin = AliHFEmcQA::kDirectCharm;
737 if (jLabel < 0){ // safety protection
738 AliDebug(1, "Stack label is negative, return\n");
742 // if there is an ancester
743 if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(jLabel))))) return -1;
744 TParticle* grandMa = mctrack->Particle();
745 Int_t grandMaPDG = grandMa->GetPdgCode();
747 for (Int_t j=0; j<fNparents; j++){
748 if (abs(grandMaPDG)==fParentSelect[1][j]){
749 origin = AliHFEmcQA::kBeautyCharm;
754 partMother = grandMa;
755 } // end of iteration
757 else if ( (int(abs(maPdgcode)/100.)%10) == AliHFEmcQA::kBeauty || (int(abs(maPdgcode)/1000.)%10) == AliHFEmcQA::kBeauty ) {
758 for (Int_t i=0; i<fNparents; i++){
759 if (abs(maPdgcode)==fParentSelect[1][i]){
760 origin = AliHFEmcQA::kDirectBeauty;
765 else if ( abs(maPdgcode) == 22 ) { //conversion
767 tmpMomLabel = partMotherCopy->GetFirstMother();
768 if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tmpMomLabel))))) return -1;
769 partMother = mctrack->Particle();
770 maPdgcode = partMother->GetPdgCode();
771 if ( abs(maPdgcode) == 111 ) {
772 origin = AliHFEmcQA::kGammaPi0;
775 else if ( abs(maPdgcode) == 221 ) {
776 origin = AliHFEmcQA::kGammaEta;
779 else if ( abs(maPdgcode) == 223 ) {
780 origin = AliHFEmcQA::kGammaOmega;
783 else if ( abs(maPdgcode) == 333 ) {
784 origin = AliHFEmcQA::kGammaPhi;
787 else if ( abs(maPdgcode) == 331 ) {
788 origin = AliHFEmcQA::kGammaEtaPrime;
791 else if ( abs(maPdgcode) == 113 ) {
792 origin = AliHFEmcQA::kGammaRho0;
795 else origin = AliHFEmcQA::kElse;
796 //origin = kGamma; // finer category above
800 else if ( abs(maPdgcode) == 111 ) {
801 origin = AliHFEmcQA::kPi0;
804 else if ( abs(maPdgcode) == 221 ) {
805 origin = AliHFEmcQA::kEta;
808 else if ( abs(maPdgcode) == 223 ) {
809 origin = AliHFEmcQA::kOmega;
812 else if ( abs(maPdgcode) == 333 ) {
813 origin = AliHFEmcQA::kPhi;
816 else if ( abs(maPdgcode) == 331 ) {
817 origin = AliHFEmcQA::kEtaPrime;
820 else if ( abs(maPdgcode) == 113 ) {
821 origin = AliHFEmcQA::kRho0;
825 origin = AliHFEmcQA::kElse;
830 //______________________________________________________
831 Bool_t AliHFEdebugTreeTask::CheckITSstatus( const AliESDtrack * const esdtrack, Int_t layer) const {
833 // Check whether ITS area is dead
838 esdtrack->GetITSModuleIndexInfo(layer, det, itsStatus, xloc, zloc);
841 case 2: status = kFALSE; break;
842 case 3: status = kFALSE; break;
843 case 7: status = kFALSE; break;
844 default: status = kTRUE;