1 // Usage in compiled mode
2 // gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include");
3 // gROOT->LoadMacro("test.C+");
6 #if !defined(__CINT__) || defined(__MAKECINT__)
13 #include <TStopwatch.h>
15 #include <TParticle.h>
17 // AliRoot include files
19 #include "AliRunLoader.h"
32 // Signal file, tree, and branch
33 name = "AliESDs.root";
34 TFile * fSig = TFile::Open(name.Data());
35 TTree * tSig = (TTree*)fSig->Get("esdTree");
36 TBranch * bSig = tSig->GetBranch("ESD");
38 AliESD * esdSig = 0; // The signal ESD object is put here
39 bSig->SetAddress(&esdSig);
43 AliRunLoader* rlSig = AliRunLoader::Open(name.Data());
47 gAlice = rlSig->GetAliRun();
49 // Now load kinematics and event header
50 rlSig->LoadKinematics();
54 Long64_t nevSig = rlSig->GetNumberOfEvents();
56 cout << nevSig << " events" << endl;
58 for (Int_t iev=0; iev<nevSig; iev++) {
59 cout << "Signal event " << iev << endl;
68 AliStack * stackSig = rlSig->Stack();
70 Int_t nrec = esdSig->GetNumberOfTracks();
72 //-------------------------------------------------------------------------------------------------
73 Int_t nstack = stackSig->GetNtrack();
74 for(Int_t istack=0; istack < nstack; istack++){
76 TParticle * part = stackSig->Particle(istack);
78 // Loop on particles: check if the D* decay products are reconstructed
82 if(TMath::Abs(part->GetPdgCode())== 413){
83 cout<<"particle "<< istack << " is D*"<<endl;
86 Int_t iDaughter1 = part->GetFirstDaughter(); //id of the Daughter = D^0
87 if( iDaughter1<0) continue;
88 TParticle* daughter1 = stackSig->Particle(iDaughter1);
89 if(!daughter1) continue;
90 cout<<"first daughter: "<<daughter1->GetPdgCode()<<endl;
92 Int_t iDaughter2 = part->GetLastDaughter(); //id of the Daughter = pi+
93 if( iDaughter2<0) continue;
94 TParticle* daughter2 = stackSig->Particle(iDaughter2);
95 if(!daughter2) continue;
96 cout<<"last daughter: "<<daughter2->GetPdgCode()<<endl;
101 if(TMath::Abs(daughter1->GetPdgCode())== 421){
105 else if(TMath::Abs(daughter2->GetPdgCode())== 421){
112 TParticle* secondmother = stackSig->Particle(iD0);
114 Int_t iD0Daughter1 = secondmother->GetFirstDaughter();
115 TParticle* D0Daughter1 = stackSig->Particle(iD0Daughter1);
116 Int_t iD0Daughter2 = secondmother->GetLastDaughter();
117 TParticle* D0Daughter2 = stackSig->Particle(iD0Daughter2);
119 for(Int_t irec=0; irec<nrec; irec++) {//loop on the ESDTree;
120 AliESDtrack * track = esdSig->GetTrack(irec);
121 UInt_t label = TMath::Abs(track->GetLabel());
123 if(label == iPi) cout<<label<< " We found the Pi from the D* decay"<<endl;
124 if(label == iD0Daughter1) cout<<label<<" We found the K from the D0 decay"<<endl;
125 if(label == iD0Daughter2) cout<<label<<" We found the Pi from the D0 decay"<<endl;
132 // end loop on kine tree