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"
37 #include "AliPIDResponse.h"
38 #include "AliTrackReference.h"
39 #include "AliVEvent.h"
40 #include "AliHFEpidTPC.h"
41 #include "AliHFEpidTRD.h"
42 #include "AliHFEmcQA.h"
43 #include "TTreeStream.h"
45 #include "AliHFEdebugTreeTask.h"
47 ClassImp(AliHFEdebugTreeTask)
49 AliHFEdebugTreeTask::AliHFEdebugTreeTask():
59 fFilename("HFEtree.root"),
66 AliHFEdebugTreeTask::AliHFEdebugTreeTask(const char *name):
67 AliAnalysisTaskSE(name),
76 fFilename("HFEtree.root"),
80 fTRDpid = new AliHFEpidTRD("QAtrdPID");
81 fTPCpid = new AliHFEpidTPC("QAtpcPID");
84 AliHFEdebugTreeTask::~AliHFEdebugTreeTask(){
85 if(fDebugTree) delete fDebugTree;
86 if(fTRDpid) delete fTRDpid;
87 if(fTPCpid) delete fTPCpid;
90 void AliHFEdebugTreeTask::UserCreateOutputObjects(){
92 // Create debug tree, signal cuts and track cuts
94 fDebugTree = new TTreeSRedirector(fFilename.Data());
96 fSignalCuts = new AliHFEsignalCuts("HFEsignalCuts", "HFE MC Signal definition");
98 fTrackCuts = new AliHFEcuts("fTrackCuts", "Basic HFE track cuts");
99 fTrackCuts->CreateStandardCuts();
101 fTrackCuts->SetMinNClustersTPC(fNclustersTPC);
102 fTrackCuts->SetMinRatioTPCclusters(0);
103 fTrackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
104 fTrackCuts->SetMinNClustersTPCPID(fNclustersTPCPID);
105 fTrackCuts->SetMinNClustersITS(fNclustersITS);
107 fTrackCuts->SetUseMixedVertex(kTRUE);
108 fTrackCuts->SetVertexRange(10.);
109 fTrackCuts->Initialize();
111 fExtraCuts = new AliHFEextraCuts("hfeExtraCuts","HFE Extra Cuts");
115 void AliHFEdebugTreeTask::UserExec(Option_t *){
117 // User Exec: Fill debug Tree
121 AliPIDResponse *pid = NULL;
122 AliInputEventHandler *handler = dynamic_cast<AliInputEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
124 pid = handler->GetPIDResponse();
126 AliError("No Handler");
129 AliError("No PID response");
133 AliError("No Input event");
137 AliESDtrack copyTrack;
139 fTrackCuts->SetRecEvent(fInputEvent);
142 if(fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5)){
143 AliDebug(1, "Event flagged as pileup\n");
146 if(!fTrackCuts->CheckEventCuts("fCutsEvRec", fInputEvent)){
147 AliDebug(1, "Event rejected by the event cuts\n");
152 Int_t run = fInputEvent->GetRunNumber();
155 UInt_t trigger = fInputHandler->IsEventSelected();
156 Bool_t isMBTrigger = trigger & AliVEvent::kMB;
157 Bool_t isCentralTrigger = trigger & AliVEvent::kCentral;
158 Bool_t isSemicentralTrigger = trigger & AliVEvent::kSemiCentral;
159 Bool_t isEMCALTrigger = trigger & AliVEvent::kEMCEJE;
161 // Check if MC information is available
162 Bool_t mcthere = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()) != NULL;
164 fTrackCuts->SetMCEvent(fMCEvent);
165 fSignalCuts->SetMCEvent(fMCEvent);
168 // Get Primary Vertex
169 const AliVVertex *vertex = fInputEvent->GetPrimaryVertex();
172 Double_t ncontrib = fInputEvent->GetPrimaryVertex()->GetNContributors();
175 Float_t centrality = -1.;
176 AliESDEvent *event = (dynamic_cast<AliESDEvent *>(fInputEvent));
178 TString beamtype = event->GetBeamType();
179 //printf("Beam type %s\n",(const char*)beamtype);
180 if(!beamtype.CompareTo("Pb-Pb") || !beamtype.CompareTo("A-A")){
182 AliDebug(1, "Heavy-Ion event\n");
183 AliCentrality *hicent = fInputEvent->GetCentrality();
184 centrality = hicent->GetCentralityPercentile("V0M");
188 fExtraCuts = new AliHFEextraCuts("hfeExtraCuts","HFE Extra Cuts");
190 fExtraCuts->SetRecEventInfo(event);
192 // Store event selection variables
193 (*fDebugTree) << "EventDebug"
194 << "Centrality=" << centrality
195 << "VertexZ=" << vtx[2]
196 << "NumberOfContributors=" << ncontrib
201 Double_t charge, eta, phi, momentum, transversemomentum;
206 AliMCParticle * mcpart;
207 for(Int_t itrk = 0; itrk < fMCEvent->GetNumberOfTracks(); itrk++){
208 mcpart = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(itrk));
209 if(!mcpart) continue;
210 if(!fTrackCuts->CheckParticleCuts(static_cast<UInt_t>(AliHFEcuts::kStepMCGenerated), mcpart)) continue;
212 charge = mcpart->Charge() > 0. ? 1. : -1.;
213 momentum = mcpart->P() * charge;
214 transversemomentum = mcpart->Pt() * charge;
217 Int_t pdg = mcpart->Particle()->GetPdgCode();
219 // Get Production Vertex in radial direction
220 Double_t vx = mcpart->Particle()->Vx(),
221 vy = mcpart->Particle()->Vy();
222 Double_t productionVertex = TMath::Sqrt(vx*vx+vy*vy);
224 // Get Mother PDG code of the particle
226 Int_t motherlabel = mcpart->Particle()->GetFirstMother();
227 if(motherlabel >= 0 && motherlabel < fMCEvent->GetNumberOfTracks()){
228 AliMCParticle *mother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(motherlabel));
229 if(mother) motherPdg = mother->Particle()->GetPdgCode();
234 if(fSignalCuts->IsCharmElectron(mcpart)) source = 0;
235 else if(fSignalCuts->IsBeautyElectron(mcpart)) source = 1;
236 else if(fSignalCuts->IsGammaElectron(mcpart)) source = 2;
237 else if(fSignalCuts->IsNonHFElectron(mcpart)) source = 3;
238 else if(TMath::Abs(pdg) == 11) source = 4;
241 // Momemntum at the inner wall of the TPC
242 Double_t pTPC = 0., ptTPC = 0.;
243 AliTrackReference *ref = FindTrackReference(mcpart, 80, 270, AliTrackReference::kTPC);
251 (*fDebugTree) << "MCDebug"
252 << "centrality=" << centrality
253 << "MBtrigger=" << isMBTrigger
254 << "CentralTrigger=" << isCentralTrigger
255 << "SemicentralTrigger=" << isSemicentralTrigger
256 << "EMCALtrigger=" << isEMCALTrigger
259 << "pt=" << transversemomentum
263 << "ProductionVertex=" << productionVertex
264 << "motherPdg=" << motherPdg
265 << "source=" << source
271 Double_t mcp, mcpt, mcptTPC, mcpTPC; // MC Variables added to the debug tree
272 for(Int_t itrack = 0; itrack < fInputEvent->GetNumberOfTracks(); itrack++){
274 track = dynamic_cast<AliESDtrack *>(fInputEvent->GetTrack(itrack));
276 // Cut track (Only basic track cuts)
277 if(!fTrackCuts->CheckParticleCuts(AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kStepRecKineITSTPC, track)) continue;
278 // Debug streaming of PID-related quantities
279 copyTrack.~AliESDtrack();
280 new(©Track) AliESDtrack(*track);
281 if(fTPCpid->HasEtaCorrection()) fTPCpid->ApplyEtaCorrection(©Track, AliHFEpidObject::kESDanalysis); // Apply Eta Correction on copy track
282 Double_t nSigmaTOF = pid->NumberOfSigmasTOF(track, AliPID::kElectron);
283 Double_t nSigmaTPC = pid->NumberOfSigmasTPC(©Track, AliPID::kElectron);
284 //if(TMath::Abs(nSigmaTOF) > 5) continue;
285 // we are not interested in tracks which are more than 5 sigma away from the electron hypothesis in either TOF or TPC
286 Double_t tPCdEdx = copyTrack.GetTPCsignal();
287 // Signal, source and MCPID
288 Bool_t signal = kTRUE;
290 mcp = mcpt = mcpTPC = mcptTPC = 0.;
294 Double_t bgcategory = 0.;
296 Int_t mesonID = -999;
297 Double_t xr[3]={-999,-999,-999};
300 Double_t unique=-999;
301 Double_t mesonunique=-999;
302 Double_t mesonR=-999;
303 Double_t mesonZ=-999;
304 Double_t mesonMomPdg=-999;
305 Double_t mesonMomPt=-999;
306 Double_t mesonGMomPdg=-999;
307 Double_t mesonGGMomPdg=-999;
308 Double_t mesonPt = -999;
309 Double_t mceta = -999;
310 Double_t mcphi = -999;
315 AliMCParticle *mctrack;
316 if((mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(track->GetLabel()))))){
317 if(!fTrackCuts->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE;
321 if(fSignalCuts->IsCharmElectron(track)) source = 0;
322 else if(fSignalCuts->IsBeautyElectron(track)) source = 1;
323 else if(fSignalCuts->IsGammaElectron(track)) source = 2;
324 else if(fSignalCuts->IsNonHFElectron(track)) source = 3;
325 else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 11)) source = 4;
328 if(!mctrack) continue;
331 mcpt = mctrack->Pt();
333 mceta = mctrack->Eta();
334 mcphi = mctrack->Phi();
335 mcpdg = mctrack->Particle()->GetPdgCode();
337 AliTrackReference *ref = FindTrackReference(mctrack, 80, 270, AliTrackReference::kTPC);
344 TParticle *mctrack1 = mctrack->Particle();
345 mesonID=GetElecSourceMC(mctrack1);
346 if(mesonID==AliHFEmcQA::kGammaPi0 || mesonID==AliHFEmcQA::kPi0) mArr=0; //pion
347 else if(mesonID==AliHFEmcQA::kGammaEta || mesonID==AliHFEmcQA::kEta) mArr=1; //eta
348 else if(mesonID==AliHFEmcQA::kGammaOmega || mesonID==AliHFEmcQA::kOmega) mArr=2; //omega
349 else if(mesonID==AliHFEmcQA::kGammaPhi || mesonID==AliHFEmcQA::kPhi) mArr=3; //phi
350 else if(mesonID==AliHFEmcQA::kGammaEtaPrime || mesonID==AliHFEmcQA::kEtaPrime) mArr=4; //etaprime
351 else if(mesonID==AliHFEmcQA::kGammaRho0 || mesonID==AliHFEmcQA::kRho0) mArr=5; //rho
355 eR= TMath::Sqrt(xr[0]*xr[0]+xr[1]*xr[1]);
357 TParticle *mctrackt = mctrack->Particle();
358 unique=mctrackt->GetUniqueID();
360 AliMCParticle *mctrackmother = NULL;
361 AliMCParticle *mctrackmother2 = NULL;
364 if(mesonID>=AliHFEmcQA::kGammaPi0) { // conversion electron, be careful with the enum odering
365 Int_t glabel=TMath::Abs(mctrack->GetMother()); // gamma label
366 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
367 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's label
368 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
369 mesonPt = mctrackmother->Pt(); //meson pt
371 mctrackmother->XvYvZv(xr);
372 mesonR = TMath::Sqrt(xr[0]*xr[0]+xr[1]*xr[1]);
375 mctrackt = mctrackmother->Particle();
377 mesonunique = mctrackt->GetUniqueID();
380 Int_t glabel2=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
381 if((mctrackmother2 = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel2)))){
382 mesonMomPdg=mctrackmother2->PdgCode();
383 mesonMomPt=mctrackmother2->Pt();
386 if(glabel>fMCEvent->GetNumberOfPrimaries()) {
388 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
389 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
390 mesonMomPdg=mctrackmother->PdgCode();
391 mesonMomPt=mctrackmother->Pt();
392 if(TMath::Abs(mctrackmother->PdgCode())==310){
394 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother's mother
395 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
396 mesonGMomPdg=mctrackmother->PdgCode();
397 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
398 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
399 mesonGGMomPdg=mctrackmother->PdgCode();
408 else{ // nonHFE except for the conversion electron
409 Int_t glabel=TMath::Abs(mctrack->GetMother());
410 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
411 mesonPt = mctrackmother->Pt(); //meson pt
413 mctrackmother->XvYvZv(xr);
414 mesonR = TMath::Sqrt(xr[0]*xr[0]+xr[1]*xr[1]);
417 mctrackt = mctrackmother->Particle();
419 mesonunique = mctrackt->GetUniqueID();
421 if(glabel>fMCEvent->GetNumberOfPrimaries()) {
423 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
424 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
425 mesonMomPdg=mctrackmother->PdgCode();
426 mesonMomPt=mctrackmother->Pt();
427 if(TMath::Abs(mctrackmother->PdgCode())==310){
429 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother's mother
430 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
431 mesonGMomPdg=mctrackmother->PdgCode();
432 glabel=TMath::Abs(mctrackmother->GetMother()); // gamma's mother's mother
433 if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){
434 mesonGGMomPdg=mctrackmother->PdgCode();
447 // Get V0 tag (if available)
449 if(track->TestBit(BIT(14))) v0pid = AliPID::kElectron;
450 else if(track->TestBit(BIT(15))) v0pid = AliPID::kPion;
451 else if(track->TestBit(BIT(16))) v0pid = AliPID::kProton;
453 charge = track->Charge() > 0 ? 1. : -1.;
456 momentum = track->P() * charge;
457 transversemomentum = track->Pt() * charge;
458 Double_t momentumTPC = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->P() : 0.;
459 Double_t transversemomentumTPC = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->Pt() : 0.;
460 // ITS number of clusters
461 UChar_t nclustersITS = track->GetITSclusters(NULL);
462 Double_t chi2matching = track->GetChi2TPCConstrainedVsGlobal(dynamic_cast<const AliESDVertex *>(vertex));
463 Double_t chi2PerClusterITS = 0.0;
464 if (nclustersITS != 0) chi2PerClusterITS = track->GetITSchi2() / Float_t(nclustersITS);
465 // TPC number of clusters (different definitions)
466 UChar_t nclustersTPCfit = track->GetTPCNcls();
467 UChar_t nclustersTPCall = 0;
468 const TBits &clusterTPC = track->GetTPCClusterMap();
469 nclustersTPCall = clusterTPC.CountBits();
470 UChar_t nclustersTPCPID = track->GetTPCsignalN();
471 UChar_t nfindableTPC = track->GetTPCNclsF();
472 Double_t clusterRatioTPCfit = 0.0;
473 if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPCfit = static_cast<Double_t>(nclustersTPCfit)/static_cast<Double_t>(nfindableTPC);
474 Double_t clusterRatioTPCall = 0.0;
475 if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPCall = static_cast<Double_t>(nclustersTPCall)/static_cast<Double_t>(nfindableTPC);
476 UChar_t nclustersTPCshared = 0;
477 Float_t ncrossedRowsTPC = track->GetTPCCrossedRows();
478 const TBits &sharedTPC = track->GetTPCSharedMap();
479 for(Int_t ibit = 0; ibit < 160; ibit++) if(sharedTPC.TestBitNumber(ibit)) nclustersTPCshared++;
480 // TRD clusters and tracklets
481 UChar_t nclustersTRD = track->GetTRDncls();
482 UChar_t ntrackletsTRDPID = track->GetTRDntrackletsPID();
483 // ITS and TRD acceptance maps
484 UChar_t hasClusterITS[6], statusITS[6], hasTrackletTRD[6];
485 UChar_t itsPixel = track->GetITSClusterMap();
486 for(Int_t icl = 0; icl < 6; icl++){
487 hasClusterITS[icl] = TESTBIT(itsPixel, icl) ? 1 : 0;
488 if(CheckITSstatus(track, icl)) statusITS[icl] = 1;
489 else statusITS[icl] = 0;
491 Double_t trddEdxSum[6];
492 for(Int_t a=0;a<6;a++) { trddEdxSum[a]= 0.;}
493 for(Int_t itl = 0; itl < 6; itl++){
494 Int_t nSliceNonZero = 0;
495 trddEdxSum[itl] = track->GetTRDslice(itl, 0); // in new reconstruction slice 0 contains the total charge
496 for(Int_t islice = 0; islice < 8; islice++){
497 if(track->GetTRDslice(itl, islice) > 0.001) nSliceNonZero++;
499 hasTrackletTRD[itl] = nSliceNonZero ? 1 : 0;
502 Double_t pidprobs[5];
503 track->GetTRDpid(pidprobs);
504 Double_t likeEleTRD = pidprobs[0];
505 Double_t likeEleTRDn = likeEleTRD/(likeEleTRD + pidprobs[2]);
506 Double_t trdtruncmean1 = fTRDpid->GetTRDSignalV1(track, 0.6);
507 Double_t trdtruncmean2 = fTRDpid->GetTRDSignalV2(track, 0.6);
510 Float_t b[2] = {0.,0.};
511 Float_t bCov[3] = {0.,0.,0.};
512 track->GetImpactParameters(b,bCov);
513 Double_t dca = TMath::Sqrt(b[0]*b[0]+b[1]*b[1]); // impact parameter space
514 Double_t dcaSR=0, dcaSZ=0;
515 if(bCov[0]>0) dcaSR = b[0]/TMath::Sqrt(bCov[0]); // normalised impact parameter xy
516 if(bCov[2]>0) dcaSZ = b[1]/TMath::Sqrt(bCov[2]); // normalised impact parameter z
517 Double_t dcaS = AliESDtrackCuts::GetSigmaToVertex(track); // n_sigma
520 Double_t hfeb[2] = {-99.,-99.};
521 Double_t hfebCov[3] = {-999.,-999.,-999.};
522 fExtraCuts->GetHFEImpactParameters(track, hfeb, hfebCov);
524 Double_t tofdx= -999.0;
525 Double_t tofdz= -999.0;
526 tofdx=track->GetTOFsignalDx();
527 tofdz=track->GetTOFsignalDz();
530 (*fDebugTree) << "PIDdebug"
531 << "centrality=" << centrality
532 << "MBtrigger=" << isMBTrigger
533 << "CentralTrigger=" << isCentralTrigger
534 << "SemicentralTrigger=" << isSemicentralTrigger
535 << "EMCALtrigger=" << isEMCALTrigger
536 << "signal=" << signal
537 << "source=" << source
541 << "ptpc=" << momentumTPC
542 << "pt=" << transversemomentum
543 << "pttpc=" << transversemomentumTPC
546 << "mcpTPC=" << mcpTPC
547 << "mcptTPC=" << mcptTPC
553 << "ntracklets=" << ntrackletsTRDPID
554 << "nclustersTPC=" << nclustersTPCfit
555 << "nclustersTPCall=" << nclustersTPCall
556 << "nclustersTPCPID=" << nclustersTPCPID
557 << "nclustersTPCshared=" << nclustersTPCshared
558 << "ncrossedRowsTPC=" << ncrossedRowsTPC
559 << "clusterRatioTPC=" << clusterRatioTPCfit
560 << "clusterRatioTPCall=" << clusterRatioTPCall
561 << "nclustersITS=" << nclustersITS
562 << "nclusters=" << nclustersTRD
563 << "chi2matching=" << chi2matching
564 << "chi2PerClusterITS=" << chi2PerClusterITS
565 << "its0=" << hasClusterITS[0]
566 << "its1=" << hasClusterITS[1]
567 << "its2=" << hasClusterITS[2]
568 << "its3=" << hasClusterITS[3]
569 << "its4=" << hasClusterITS[4]
570 << "its5=" << hasClusterITS[5]
571 << "statusITS0=" << statusITS[0]
572 << "statusITS1=" << statusITS[1]
573 << "statusITS2=" << statusITS[2]
574 << "statusITS3=" << statusITS[3]
575 << "statusITS4=" << statusITS[4]
576 << "statusITS5=" << statusITS[5]
577 << "trd0=" << hasTrackletTRD[0]
578 << "trd1=" << hasTrackletTRD[1]
579 << "trd2=" << hasTrackletTRD[2]
580 << "trd3=" << hasTrackletTRD[3]
581 << "trd4=" << hasTrackletTRD[4]
582 << "trd5=" << hasTrackletTRD[5]
583 << "TRDdEdxl0=" << trddEdxSum[0]
584 << "TRDdEdxl1=" << trddEdxSum[1]
585 << "TRDdEdxl2=" << trddEdxSum[2]
586 << "TRDdEdxl3=" << trddEdxSum[3]
587 << "TRDdEdxl4=" << trddEdxSum[4]
588 << "TRDdEdxl5=" << trddEdxSum[5]
589 << "TOFsigmaEl=" << nSigmaTOF
590 << "TPCsigmaEl=" << nSigmaTPC
591 << "TPCdEdx=" << tPCdEdx
592 << "TRDlikeEl=" << likeEleTRD
593 << "TRDlikeEln=" << likeEleTRDn
594 << "trdtruncmean1=" << trdtruncmean1
595 << "trdtruncmean2=" << trdtruncmean2
602 << "hfedcaR=" << hfeb[0]
603 << "hfedcaZ=" << hfeb[1]
604 << "hfedcacovR=" << hfebCov[0]
605 << "hfedcacovZ=" << hfebCov[2]
611 << "ncontrib=" << ncontrib
612 << "mesonID=" << mesonID
614 << "mesonR=" << mesonR
616 << "mesonZ=" << mesonZ
617 << "unique=" << unique
618 << "mesonunique=" << mesonunique
619 << "bgcategory=" << bgcategory
620 << "mesonpt=" << mesonPt
621 << "mesonMomPdg=" << mesonMomPdg
622 << "mesonGMomPdg=" << mesonGMomPdg
623 << "mesonGGMomPdg=" << mesonGGMomPdg
624 << "mesonMomPt=" << mesonMomPt
630 void AliHFEdebugTreeTask::SetFileName(const char *filename){ fFilename = filename; }
631 //___________________________________________________________
632 AliTrackReference *AliHFEdebugTreeTask::FindTrackReference(AliMCParticle *track, Float_t minRadius, Float_t maxRadius, Int_t detectorID)
635 // Find the track reference
637 AliTrackReference *ref = NULL, *reftmp;
639 for(Int_t iref = 0; iref < track->GetNumberOfTrackReferences(); iref++){
640 reftmp = track->GetTrackReference(iref);
641 if(reftmp->DetectorId() != detectorID) continue;
642 radius = reftmp->R();
643 if(radius >= minRadius && radius < maxRadius){
647 if(radius > maxRadius) break;
652 //__________________________________________
653 Int_t AliHFEdebugTreeTask::GetElecSourceMC(TParticle * const mcpart)
655 // decay particle's origin
658 AliDebug(1, "no mcparticle, return\n");
662 if ( abs(mcpart->GetPdgCode()) != AliHFEmcQA::kElectronPDG ) return AliHFEmcQA::kMisID;
665 Bool_t isFinalOpenCharm = kFALSE;
667 Int_t iLabel = mcpart->GetFirstMother();
669 AliDebug(1, "Stack label is negative, return\n");
673 AliMCParticle *mctrack = NULL;
675 if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(iLabel))))) return -1;
676 TParticle *partMother = mctrack->Particle();
677 TParticle *partMotherCopy = mctrack->Particle();
678 Int_t maPdgcode = partMother->GetPdgCode();
680 // if the mother is charmed hadron
681 if ( (int(abs(maPdgcode)/100.)%10) == AliHFEmcQA::kCharm || (int(abs(maPdgcode)/1000.)%10) == AliHFEmcQA::kCharm ) {
683 for (Int_t i=0; i<fNparents; i++){
684 if (abs(maPdgcode)==fParentSelect[0][i]){
685 isFinalOpenCharm = kTRUE;
688 if (!isFinalOpenCharm) return -1;
690 // iterate until you find B hadron as a mother or become top ancester
691 for (Int_t i=1; i<fgkMaxIter; i++){
693 Int_t jLabel = partMother->GetFirstMother();
695 origin = AliHFEmcQA::kDirectCharm;
698 if (jLabel < 0){ // safety protection
699 AliDebug(1, "Stack label is negative, return\n");
703 // if there is an ancester
704 if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(jLabel))))) return -1;
705 TParticle* grandMa = mctrack->Particle();
706 Int_t grandMaPDG = grandMa->GetPdgCode();
708 for (Int_t j=0; j<fNparents; j++){
709 if (abs(grandMaPDG)==fParentSelect[1][j]){
710 origin = AliHFEmcQA::kBeautyCharm;
715 partMother = grandMa;
716 } // end of iteration
718 else if ( (int(abs(maPdgcode)/100.)%10) == AliHFEmcQA::kBeauty || (int(abs(maPdgcode)/1000.)%10) == AliHFEmcQA::kBeauty ) {
719 for (Int_t i=0; i<fNparents; i++){
720 if (abs(maPdgcode)==fParentSelect[1][i]){
721 origin = AliHFEmcQA::kDirectBeauty;
726 else if ( abs(maPdgcode) == 22 ) { //conversion
728 tmpMomLabel = partMotherCopy->GetFirstMother();
729 if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tmpMomLabel))))) return -1;
730 partMother = mctrack->Particle();
731 maPdgcode = partMother->GetPdgCode();
732 if ( abs(maPdgcode) == 111 ) {
733 origin = AliHFEmcQA::kGammaPi0;
736 else if ( abs(maPdgcode) == 221 ) {
737 origin = AliHFEmcQA::kGammaEta;
740 else if ( abs(maPdgcode) == 223 ) {
741 origin = AliHFEmcQA::kGammaOmega;
744 else if ( abs(maPdgcode) == 333 ) {
745 origin = AliHFEmcQA::kGammaPhi;
748 else if ( abs(maPdgcode) == 331 ) {
749 origin = AliHFEmcQA::kGammaEtaPrime;
752 else if ( abs(maPdgcode) == 113 ) {
753 origin = AliHFEmcQA::kGammaRho0;
756 else origin = AliHFEmcQA::kElse;
757 //origin = kGamma; // finer category above
761 else if ( abs(maPdgcode) == 111 ) {
762 origin = AliHFEmcQA::kPi0;
765 else if ( abs(maPdgcode) == 221 ) {
766 origin = AliHFEmcQA::kEta;
769 else if ( abs(maPdgcode) == 223 ) {
770 origin = AliHFEmcQA::kOmega;
773 else if ( abs(maPdgcode) == 333 ) {
774 origin = AliHFEmcQA::kPhi;
777 else if ( abs(maPdgcode) == 331 ) {
778 origin = AliHFEmcQA::kEtaPrime;
781 else if ( abs(maPdgcode) == 113 ) {
782 origin = AliHFEmcQA::kRho0;
786 origin = AliHFEmcQA::kElse;
791 //______________________________________________________
792 Bool_t AliHFEdebugTreeTask::CheckITSstatus( const AliESDtrack * const esdtrack, Int_t layer) const {
794 // Check whether ITS area is dead
799 esdtrack->GetITSModuleIndexInfo(layer, det, itsStatus, xloc, zloc);
802 case 2: status = kFALSE; break;
803 case 3: status = kFALSE; break;
804 case 7: status = kFALSE; break;
805 default: status = kTRUE;