1 /**************************************************************************
2 * Copyright(c) 1998-2009, 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 **************************************************************************/
16 //-----------------------------------------------------------------------
17 // Class for DStar corrections:
19 // The D0 cutting varibles position in the container and container
20 // binning method from a C.Zampolli example
21 // In this way a simple comparison between D0 and D0 from D* is possible.
23 //-----------------------------------------------------------------------
24 // Author : A.Grelli, Utrecht University
27 //-----------------------------------------------------------------------
30 #include <TParticle.h>
31 #include <TDatabasePDG.h>
36 #include "AliCFTaskForDStarAnalysis.h"
38 #include "AliMCEvent.h"
39 #include "AliCFManager.h"
40 #include "AliCFContainer.h"
42 #include "AliAnalysisManager.h"
43 #include "AliAODHandler.h"
44 #include "AliAODEvent.h"
45 #include "AliAODRecoDecay.h"
46 #include "AliAODRecoDecayHF.h"
47 #include "AliAODRecoCascadeHF.h"
48 #include "AliAODRecoDecayHF2Prong.h"
49 #include "AliAODMCParticle.h"
50 #include "AliAODMCHeader.h"
51 #include "AliESDtrack.h"
53 #include "THnSparse.h"
56 //__________________________________________________________________________
57 AliCFTaskForDStarAnalysis::AliCFTaskForDStarAnalysis() :
60 fHistEventsProcessed(0x0),
62 fCountRecoDStarSel(0),
65 fMinITSClustersSoft(4),
72 //___________________________________________________________________________
73 AliCFTaskForDStarAnalysis::AliCFTaskForDStarAnalysis(const Char_t* name) :
74 AliAnalysisTaskSE(name),
76 fHistEventsProcessed(0x0),
78 fCountRecoDStarSel(0),
81 fMinITSClustersSoft(4),
85 // Constructor. Initialization of Inputs and Outputs
87 Info("AliCFTaskForDStarAnalysis","Calling Constructor");
89 DefineOutput(1,TH1I::Class());
90 DefineOutput(2,AliCFContainer::Class());
91 DefineOutput(3,THnSparseD::Class());
94 //___________________________________________________________________________
95 AliCFTaskForDStarAnalysis& AliCFTaskForDStarAnalysis::operator=(const AliCFTaskForDStarAnalysis& c)
98 // Assignment operator
101 AliAnalysisTaskSE::operator=(c) ;
102 fCFManager = c.fCFManager;
103 fHistEventsProcessed = c.fHistEventsProcessed;
108 //___________________________________________________________________________
109 AliCFTaskForDStarAnalysis::AliCFTaskForDStarAnalysis(const AliCFTaskForDStarAnalysis& c) :
110 AliAnalysisTaskSE(c),
111 fCFManager(c.fCFManager),
112 fHistEventsProcessed(c.fHistEventsProcessed),
113 fCorrelation(c.fCorrelation),
114 fCountRecoDStarSel(c.fCountRecoDStarSel),
116 fMinITSClusters(c.fMinITSClusters),
117 fMinITSClustersSoft(c.fMinITSClustersSoft),
118 fAcceptanceUnf(c.fAcceptanceUnf)
125 //___________________________________________________________________________
126 AliCFTaskForDStarAnalysis::~AliCFTaskForDStarAnalysis() {
130 if (fCFManager) delete fCFManager ;
131 if (fHistEventsProcessed) delete fHistEventsProcessed ;
132 if (fCorrelation) delete fCorrelation ;
135 //_________________________________________________
136 void AliCFTaskForDStarAnalysis::UserExec(Option_t *)
139 // Main loop function
143 Error("UserExec","NO EVENT FOUND!");
149 if (fEvents%10000 ==0) AliDebug(2,Form("Event %d",fEvents));
150 AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
152 TClonesArray *arrayDStartoD0pi=0;
154 if(!aodEvent && AODEvent() && IsStandardAOD()) {
155 // In case there is an AOD handler writing a standard AOD, use the AOD
156 // event in memory rather than the input (ESD) event.
157 aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
158 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
159 // have to taken from the AOD event hold by the AliAODExtension
160 AliAODHandler* aodHandler = (AliAODHandler*)
161 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
162 if(aodHandler->GetExtensions()) {
163 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
164 AliAODEvent *aodFromExt = ext->GetAOD();
165 arrayDStartoD0pi=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
168 arrayDStartoD0pi=(TClonesArray*)aodEvent->GetList()->FindObject("Dstar");
171 if (!arrayDStartoD0pi) {
172 AliError("Could not find array of HF vertices");
176 fCFManager->SetRecEventInfo(aodEvent);
177 fCFManager->SetMCEventInfo(aodEvent);
180 Double_t containerInput[14] ;
181 Double_t containerInputMC[14] ;
183 //loop on the MC event
185 TClonesArray* mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
187 AliError("Could not find Monte-Carlo in AOD");
191 AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
193 AliError("Could not find MC Header in AOD");
197 // AOD primary vertex
198 AliAODVertex *vtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
199 Double_t zPrimVertex = vtx1->GetZ();
200 Double_t zMCVertex = mcHeader->GetVtxZ();
201 Bool_t vtxFlag = kTRUE;
202 TString title=vtx1->GetTitle();
203 if(!title.Contains("VertexerTracks")) vtxFlag=kFALSE;
205 for (Int_t iPart=0; iPart<mcArray->GetEntriesFast(); iPart++) {
206 AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(mcArray->At(iPart));
208 AliWarning("MC Particle not found in tree, skipping");
212 // check the MC-level cuts
213 if (!fCFManager->CheckParticleCuts(0, mcPart)) continue; // 0 stands for MC level
215 // fill the container for Gen-level selection
216 Double_t vectorMC[9] = {9999.,9999.,9999.,9999.,9999.,9999.,9999.,9999.,9999.};
218 if (GetDStarMCParticle(mcPart, mcArray, vectorMC)){
220 containerInputMC[0] = vectorMC[0];
221 containerInputMC[1] = vectorMC[1] ;
222 containerInputMC[2] = vectorMC[2] ;
223 containerInputMC[3] = vectorMC[3] ;
224 containerInputMC[4] = vectorMC[4] ;
225 containerInputMC[5] = vectorMC[5] ;
226 containerInputMC[6] = 0.;
227 containerInputMC[7] = 0.;
228 containerInputMC[8] = 0.;
229 containerInputMC[9] = -100000.;
230 containerInputMC[10] = 1.01;
231 containerInputMC[11] = vectorMC[6];
232 containerInputMC[12] = zMCVertex; // z vertex
233 containerInputMC[13] = vectorMC[7]; // pt D0 pion
234 containerInputMC[14] = vectorMC[8]; // pt D0 kaon
236 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepGenerated);
238 // check the MC-Acceptance level cuts
239 // since standard CF functions are not applicable, using Kine Cuts on daughters
241 Int_t daughter0 = mcPart->GetDaughter(0);
242 Int_t daughter1 = mcPart->GetDaughter(1);
244 AliDebug(2, Form("daughter0 = %d and daughter1 = %d",daughter0,daughter1));
247 AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughter0));
249 AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughter1));
251 // Acceptance variables for the soft pion
252 Double_t eta1 = mcPartDaughter1->Eta();
253 Double_t pt1 = mcPartDaughter1->Pt();
258 // Just to be sure to take the right particles
259 if(TMath::Abs(mcPartDaughter0->GetPdgCode())==421){
260 daughD00 = mcPartDaughter0->GetDaughter(0);
261 daughD01 = mcPartDaughter0->GetDaughter(1);
263 daughD00 = mcPartDaughter1->GetDaughter(0);
264 daughD01 = mcPartDaughter1->GetDaughter(1);
268 AliAODMCParticle* mcD0PartDaughter0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughD00));
269 AliAODMCParticle* mcD0PartDaughter1 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughD01));
271 if (!mcD0PartDaughter0 || !mcD0PartDaughter1) {
272 AliWarning("At least one D0 Daughter Particle not found in tree, but it should be, this check was already done...");
275 // D0 daughters - needed for acceptance
276 Double_t theD0pt0 = mcD0PartDaughter0->Pt();
277 Double_t theD0pt1 = mcD0PartDaughter1->Pt();
278 Double_t theD0eta0 = mcD0PartDaughter0->Eta();
279 Double_t theD0eta1 = mcD0PartDaughter1->Eta();
281 // ACCEPTANCE REQUESTS ---------
284 Bool_t daught1inAcceptance = (TMath::Abs(eta1) <= 0.9 && pt1 >= 0.05);
286 Bool_t D0daught0inAcceptance = (TMath::Abs(theD0eta0) <= 0.9 && theD0pt0 >= 0.1);
287 Bool_t D0daught1inAcceptance = (TMath::Abs(theD0eta1) <= 0.9 && theD0pt1 >= 0.1);
289 if (daught1inAcceptance && D0daught0inAcceptance && D0daught1inAcceptance) {
291 AliDebug(2, "D* Daughter particles in acceptance");
293 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepAcceptance);
295 // check on the vertex
297 // filling the container if the vertex is ok
298 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepVertex) ;
300 Bool_t refitFlag = kTRUE;
301 for (Int_t iaod =0; iaod<aodEvent->GetNumberOfTracks(); iaod++){
302 AliAODTrack *track = (AliAODTrack*)aodEvent->GetTrack(iaod);
304 // refit only for D0 daughters
305 if ((track->GetLabel() == daughD00) || (track->GetLabel() == daughD01)) {
306 if(!(track->GetStatus()&AliESDtrack::kTPCrefit) || !(track->GetStatus()&AliESDtrack::kITSrefit)) {
311 if (refitFlag){ // refit
313 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepRefit);
317 } //end of acceptance
320 AliDebug(3,"Problems in filling the container");
326 AliDebug(2, Form("Found %d D* candidates",arrayDStartoD0pi->GetEntriesFast()));
328 //D* and D0 prongs needed to MatchToMC method
329 Int_t pdgDgDStartoD0pi[2]={421,211};
330 Int_t pdgDgD0toKpi[2]={321,211};
332 for (Int_t iDStartoD0pi = 0; iDStartoD0pi<arrayDStartoD0pi->GetEntriesFast(); iDStartoD0pi++) {
335 AliAODRecoCascadeHF* dstarD0pi = (AliAODRecoCascadeHF*)arrayDStartoD0pi->At(iDStartoD0pi);
337 // D0 from the reco cascade
338 AliAODRecoDecayHF2Prong* D0particle = (AliAODRecoDecayHF2Prong*)dstarD0pi->Get2Prong();
339 Bool_t unsetvtx=kFALSE;
341 // needed for pointing angle
342 if(!D0particle->GetOwnPrimaryVtx()) {
343 D0particle->SetOwnPrimaryVtx(vtx1);
347 // find associated MC particle for D* ->D0toKpi
348 Int_t mcLabel = dstarD0pi->MatchToMC(413,421,pdgDgDStartoD0pi,pdgDgD0toKpi,mcArray);
350 // find D0->Kpi ... needed in the following
351 Int_t mcD0Label = D0particle->MatchToMC(421,mcArray,2,pdgDgD0toKpi);
353 if (mcLabel == -1 || mcD0Label ==-1)
355 AliDebug(2,"No MC particle found");
359 // the D* and the D0 in MC
360 AliAODMCParticle* mcVtxHFDStar = (AliAODMCParticle*)mcArray->At(mcLabel);
361 AliAODMCParticle* mcVtxHFD0Kpi = (AliAODMCParticle*)mcArray->At(mcD0Label);
363 if (!mcVtxHFD0Kpi || !mcVtxHFDStar) {
364 AliWarning("Could not find associated MC D0 and/or D* in AOD MC tree");
369 AliAODTrack *track2 = (AliAODTrack*)dstarD0pi->GetBachelor();
372 AliAODTrack *track0 = (AliAODTrack*)D0particle->GetDaughter(0);
373 AliAODTrack *track1 = (AliAODTrack*)D0particle->GetDaughter(1);
375 // check if associated MC v0 passes the cuts
376 if (!fCFManager->CheckParticleCuts(0 ,mcVtxHFDStar)) {
377 AliDebug(2, "Skipping the particles due to cuts");
381 // fill the container...
382 Double_t pt = TMath::Sqrt(TMath::Power(D0particle->Pt(),2)+TMath::Power(track2->Pt(),2));
383 Double_t rapidity = dstarD0pi->YDstar();
384 Double_t cosThetaStar = 9999.;
387 Double_t dca = (D0particle->GetDCA())*1E4;
390 Double_t d0xd0 = (D0particle->Prodd0d0())*1E8;
391 Double_t cosPointingAngle = D0particle->CosPointingAngle();
392 Double_t phi = D0particle->Phi();
394 // Select D0 cutting variables
395 Int_t pdgCode = mcVtxHFD0Kpi->GetPdgCode();
397 // D0 related variables
400 cosThetaStar = D0particle->CosThetaStarD0();
401 pTpi = D0particle->PtProng(0);
402 pTK = D0particle->PtProng(1);
403 d0pi = (D0particle->Getd0Prong(0))*1E4;
404 d0K = (D0particle->Getd0Prong(1))*1E4;
409 cosThetaStar = D0particle->CosThetaStarD0bar();
410 pTpi = D0particle->PtProng(1);
411 pTK = D0particle->PtProng(0);
412 d0pi = (D0particle->Getd0Prong(1))*1E4;
413 d0K = (D0particle->Getd0Prong(0))*1E4;
417 // ct of the D0 from D*
418 Double_t cT = D0particle->CtD0();
420 containerInput[0] = pt;
421 containerInput[1] = rapidity;
422 containerInput[2] = cosThetaStar;
423 containerInput[3] = track2->Pt();
424 containerInput[4] = D0particle->Pt();
425 containerInput[5] = cT*1.E4; // in micron
426 containerInput[6] = dca; // in micron
427 containerInput[7] = d0pi; // in micron
428 containerInput[8] = d0K; // in micron
429 containerInput[9] = d0xd0; // in micron^2
430 containerInput[10] = cosPointingAngle; // in micron
431 containerInput[11] = phi;
432 containerInput[12] = zPrimVertex; // z of reconstructed of primary vertex
433 containerInput[13] = pTpi; // D0 pion
434 containerInput[14] = pTK; // D0 kaon
436 fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed) ;
438 // refit in ITS and TPC for D0 daughters
439 if((!(track0->GetStatus()&AliESDtrack::kTPCrefit)) || (!(track1->GetStatus()&AliESDtrack::kTPCrefit)) || (!(track0->GetStatus()&AliESDtrack::kITSrefit)) || (!(track1->GetStatus()&AliESDtrack::kITSrefit))) {
443 // reft in ITS for soft pion
444 if((!(track2->GetStatus()&AliESDtrack::kITSrefit))) {
448 // cut in acceptance for the soft pion and for the D0 daughters
449 Bool_t acceptanceProng0 = (TMath::Abs(D0particle->EtaProng(0))<= 0.9 && D0particle->PtProng(0) >= 0.1);
450 Bool_t acceptanceProng1 = (TMath::Abs(D0particle->EtaProng(1))<= 0.9 && D0particle->PtProng(1) >= 0.1);
452 // soft pion acceptance ... is it fine 0.9?????
453 Bool_t acceptanceProng2 = (TMath::Abs(track2->Eta())<= 0.9 && track2->Pt() >= 0.05);
455 if (acceptanceProng0 && acceptanceProng1 && acceptanceProng2) {
456 AliDebug(2,"D* reco daughters in acceptance");
457 fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoAcceptance) ;
460 Double_t fill[4]; //fill response matrix
462 // dimensions 0&1 : pt,eta (Rec)
465 // dimensions 2&3 : pt,eta (MC)
466 fill[2] = mcVtxHFDStar->Pt();
467 fill[3] = mcVtxHFDStar->Y();
468 fCorrelation->Fill(fill);
471 // cut on the min n. of clusters in ITS for the D0 and soft pion
472 Int_t ncls0=0,ncls1=0,ncls2=0;
473 for(Int_t l=0;l<6;l++) {
474 if(TESTBIT(track0->GetITSClusterMap(),l)) ncls0++;
475 if(TESTBIT(track1->GetITSClusterMap(),l)) ncls1++;
476 if(TESTBIT(track2->GetITSClusterMap(),l)) ncls2++;
478 // see AddTask for soft pion ITS clusters request
479 AliDebug(2, Form("n clusters = %d", ncls0));
481 if (ncls0 >= fMinITSClusters && ncls1 >= fMinITSClusters && ncls2>= fMinITSClustersSoft) {
482 fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoITSClusters) ;
484 // D0 cuts optimized for D* analysis
485 Double_t cuts[7] = {9999999., 1.1, 0., 9999999., 9999999., 0.,0.027};
488 Double_t theD0pt = D0particle->Pt();
490 if (theD0pt <= 1){ // first bin not optimized
499 else if (theD0pt > 1 && theD0pt <= 2){
508 else if (theD0pt > 2 && theD0pt <= 3){
517 else if (theD0pt > 3 && theD0pt <= 5){
526 else if (theD0pt > 5){
536 && TMath::Abs(cosThetaStar) < cuts[1]
539 && TMath::Abs(d0pi) < cuts[3]
540 && TMath::Abs(d0K) < cuts[4]
542 && cosPointingAngle > cuts[6]
545 AliDebug(2,"Particle passed D* selection cuts");
546 fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoCuts) ;
548 if(!fAcceptanceUnf){ // unfolding
550 Double_t fill[4]; //fill response matrix
552 // dimensions 0&1 : pt,eta (Rec)
555 // dimensions 2&3 : pt,eta (MC)
556 fill[2] = mcVtxHFDStar->Pt();
557 fill[3] = mcVtxHFDStar->Y();
559 fCorrelation->Fill(fill);
565 if(unsetvtx) D0particle->UnsetOwnPrimaryVtx();
566 } // end loop on D*->Kpipi
568 fHistEventsProcessed->Fill(0);
570 PostData(1,fHistEventsProcessed) ;
571 PostData(2,fCFManager->GetParticleContainer()) ;
572 PostData(3,fCorrelation) ;
576 //___________________________________________________________________________
577 void AliCFTaskForDStarAnalysis::Terminate(Option_t*)
580 AliAnalysisTaskSE::Terminate();
582 // draw correlation matrix
583 AliCFContainer *cont= dynamic_cast<AliCFContainer*> (GetOutputData(2));
585 printf("CONTAINER NOT FOUND\n");
590 //___________________________________________________________________________
591 void AliCFTaskForDStarAnalysis::UserCreateOutputObjects() {
597 Info("UserCreateOutputObjects","CreateOutputObjects of task %s\n", GetName());
601 fHistEventsProcessed = new TH1I("CFDSchist0","",1,0,1) ;
604 //________________________________________________________________________________
605 Bool_t AliCFTaskForDStarAnalysis::GetDStarMCParticle(AliAODMCParticle* mcPart, TClonesArray* mcArray, Double_t* vectorMC)const {
608 // fill the D* and D0 MC container
611 Bool_t isDStar = kFALSE;
613 if(TMath::Abs(mcPart->GetPdgCode())!=413) return isDStar;
615 // getting the daughters
616 Int_t daughter0 = mcPart->GetDaughter(0);
617 Int_t daughter1 = mcPart->GetDaughter(1);
619 AliDebug(2, Form("daughter0 = %d and daughter1 = %d",daughter0,daughter1));
620 if (daughter0 == 0 || daughter1 == 0) {
621 AliDebug(2, "Error! the D* MC doesn't have correct daughters!!");
625 if (TMath::Abs(daughter1 - daughter0) != 1) { // should be everytime true - see PDGdatabooklet
626 AliDebug(2, "The D* MC doesn't come from a 2-prong decay, skipping!!");
630 AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughter0));
631 AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughter1));
632 if (!mcPartDaughter0 || !mcPartDaughter1) {
633 AliWarning("D*: At least one Daughter Particle not found in tree, skipping");
637 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==421 &&
638 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
639 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
640 TMath::Abs(mcPartDaughter1->GetPdgCode())==421)) {
641 AliDebug(2, "The D* MC doesn't come from a Kpi decay, skipping!!");
645 Double_t vtx2daughter0[3] = {0,0,0}; // secondary vertex from daughter 0
646 Double_t vtx2daughter1[3] = {0,0,0}; // secondary vertex from daughter 1
648 // getting vertex from daughters
649 mcPartDaughter0->XvYvZv(vtx2daughter0);
650 mcPartDaughter1->XvYvZv(vtx2daughter1);
652 // check if the secondary vertex is the same for both
653 if (vtx2daughter0[0] != vtx2daughter1[0] && vtx2daughter0[1] != vtx2daughter1[1] && vtx2daughter0[2] != vtx2daughter1[2]) {
654 AliError("The D* daughters have different secondary vertex, skipping the track");
658 AliAODMCParticle* neutralDaugh = mcPartDaughter0;
660 Double_t VectorD0[2] ={0.,0.};
662 if (!EvaluateIfD0toKpi(neutralDaugh,mcArray,VectorD0)) {
663 AliDebug(2, "Error! the D0 MC doesn't have correct daughters!!");
666 // get the pT of the daughters
671 if (TMath::Abs(mcPartDaughter0->GetPdgCode()) == 211) {
672 pTpi = mcPartDaughter0->Pt();
673 pTD0 = mcPartDaughter1->Pt();
676 pTpi = mcPartDaughter1->Pt();
677 pTD0 = mcPartDaughter0->Pt();
680 vectorMC[0] = mcPart->Pt();
681 vectorMC[1] = mcPart->Y() ;
686 vectorMC[6] = mcPart->Phi() ;
687 vectorMC[7] = VectorD0[0] ;
688 vectorMC[8] = VectorD0[1] ;
694 //________________________________________________________________________________________________
696 Bool_t AliCFTaskForDStarAnalysis::EvaluateIfD0toKpi(AliAODMCParticle* neutralDaugh, TClonesArray* mcArray, Double_t* VectorD0)const{
699 // chack wether D0 is decaing into kpi
702 Bool_t isHadronic = kFALSE;
704 Int_t daughterD00 = neutralDaugh->GetDaughter(0);
705 Int_t daughterD01 = neutralDaugh->GetDaughter(1);
707 AliDebug(2, Form("daughter0 = %d and daughter1 = %d",daughterD00,daughterD01));
708 if (daughterD00 == 0 || daughterD01 == 0) {
709 AliDebug(2, "Error! the D0 MC doesn't have correct daughters!!");
713 if (TMath::Abs(daughterD01 - daughterD00) != 1) { // should be everytime true - see PDGdatabooklet
714 AliDebug(2, "The D0 MC doesn't come from a 2-prong decay, skipping!!");
718 AliAODMCParticle* mcPartDaughterD00 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughterD00));
719 AliAODMCParticle* mcPartDaughterD01 = dynamic_cast<AliAODMCParticle*>(mcArray->At(daughterD01));
720 if (!mcPartDaughterD00 || !mcPartDaughterD01) {
721 AliWarning("D0 MC analysis: At least one Daughter Particle not found in tree, skipping");
725 if (!(TMath::Abs(mcPartDaughterD00->GetPdgCode())==321 &&
726 TMath::Abs(mcPartDaughterD01->GetPdgCode())==211) &&
727 !(TMath::Abs(mcPartDaughterD00->GetPdgCode())==211 &&
728 TMath::Abs(mcPartDaughterD01->GetPdgCode())==321)) {
729 AliDebug(2, "The D0 MC doesn't come from a Kpi decay, skipping!!");
737 if (TMath::Abs(mcPartDaughterD00->GetPdgCode()) == 211) {
738 pTD0pi = mcPartDaughterD00->Pt();
739 pTD0K = mcPartDaughterD01->Pt();
742 pTD0pi = mcPartDaughterD01->Pt();
743 pTD0K = mcPartDaughterD00->Pt();
748 VectorD0[0] = pTD0pi;