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");
37 AliESDEvent * esdSig = new AliESDEvent; // The signal ESD object is put here
38 esdSig->ReadFromTree(tSig);
42 AliRunLoader* rlSig = AliRunLoader::Open(name.Data());
46 gAlice = rlSig->GetAliRun();
48 // Now load kinematics and event header
49 rlSig->LoadKinematics();
53 Long64_t nevSig = rlSig->GetNumberOfEvents();
55 cout << nevSig << " events" << endl;
57 for (Int_t iev=0; iev<nevSig; iev++) {
58 cout << "Signal event " << iev << endl;
67 AliStack * stackSig = rlSig->Stack();
69 Int_t nrec = esdSig->GetNumberOfTracks();
71 //-------------------------------------------------------------------------------------------------
72 Int_t nstack = stackSig->GetNtrack();
73 for(Int_t istack=0; istack < nstack; istack++){
75 TParticle * part = stackSig->Particle(istack);
77 // Loop on particles: check if the D* decay products are reconstructed
81 if(TMath::Abs(part->GetPdgCode())== 413){
82 cout<<"particle "<< istack << " is D*"<<endl;
85 Int_t iDaughter1 = part->GetFirstDaughter(); //id of the Daughter = D^0
86 if( iDaughter1<0) continue;
87 TParticle* daughter1 = stackSig->Particle(iDaughter1);
88 if(!daughter1) continue;
89 cout<<"first daughter: "<<daughter1->GetPdgCode()<<endl;
91 Int_t iDaughter2 = part->GetLastDaughter(); //id of the Daughter = pi+
92 if( iDaughter2<0) continue;
93 TParticle* daughter2 = stackSig->Particle(iDaughter2);
94 if(!daughter2) continue;
95 cout<<"last daughter: "<<daughter2->GetPdgCode()<<endl;
100 if(TMath::Abs(daughter1->GetPdgCode())== 421){
104 else if(TMath::Abs(daughter2->GetPdgCode())== 421){
111 TParticle* secondmother = stackSig->Particle(iD0);
113 Int_t iD0Daughter1 = secondmother->GetFirstDaughter();
114 TParticle* D0Daughter1 = stackSig->Particle(iD0Daughter1);
115 Int_t iD0Daughter2 = secondmother->GetLastDaughter();
116 TParticle* D0Daughter2 = stackSig->Particle(iD0Daughter2);
118 for(Int_t irec=0; irec<nrec; irec++) {//loop on the ESDTree;
119 AliESDtrack * track = esdSig->GetTrack(irec);
120 UInt_t label = TMath::Abs(track->GetLabel());
122 if(label == iPi) cout<<label<< " We found the Pi from the D* decay"<<endl;
123 if(label == iD0Daughter1) cout<<label<<" We found the K from the D0 decay"<<endl;
124 if(label == iD0Daughter2) cout<<label<<" We found the Pi from the D0 decay"<<endl;
131 // end loop on kine tree