// Usage in compiled mode // gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include"); // gROOT->LoadMacro("test.C+"); // test() #if !defined(__CINT__) || defined(__MAKECINT__) // Root include files #include #include #include #include #include #include #include // AliRoot include files #include "AliESDEvent.h" #include "AliRunLoader.h" #include "AliRun.h" #include "AliStack.h" #endif void test() { TStopwatch timer; timer.Start(); TString name; // Signal file, tree, and branch name = "AliESDs.root"; TFile * fSig = TFile::Open(name.Data()); TTree * tSig = (TTree*)fSig->Get("esdTree"); AliESDEvent * esdSig = new AliESDEvent; // The signal ESD object is put here esdSig->ReadFromTree(tSig); // Run loader name = "galice.root"; AliRunLoader* rlSig = AliRunLoader::Open(name.Data()); // gAlice rlSig->LoadgAlice(); gAlice = rlSig->GetAliRun(); // Now load kinematics and event header rlSig->LoadKinematics(); rlSig->LoadHeader(); // Loop on events Long64_t nevSig = rlSig->GetNumberOfEvents(); cout << nevSig << " events" << endl; for (Int_t iev=0; ievGetEntry(iev); // Get MC rlSig->GetEvent(iev); // Particle stack AliStack * stackSig = rlSig->Stack(); Int_t nrec = esdSig->GetNumberOfTracks(); //------------------------------------------------------------------------------------------------- Int_t nstack = stackSig->GetNtrack(); for(Int_t istack=0; istack < nstack; istack++){ TParticle * part = stackSig->Particle(istack); // Loop on particles: check if the D* decay products are reconstructed if(!part) continue; if(TMath::Abs(part->GetPdgCode())== 413){ cout<<"particle "<< istack << " is D*"<GetFirstDaughter(); //id of the Daughter = D^0 if( iDaughter1<0) continue; TParticle* daughter1 = stackSig->Particle(iDaughter1); if(!daughter1) continue; cout<<"first daughter: "<GetPdgCode()<GetLastDaughter(); //id of the Daughter = pi+ if( iDaughter2<0) continue; TParticle* daughter2 = stackSig->Particle(iDaughter2); if(!daughter2) continue; cout<<"last daughter: "<GetPdgCode()<GetPdgCode())== 421){ iD0=iDaughter1; iPi=iDaughter2; } else if(TMath::Abs(daughter2->GetPdgCode())== 421){ iD0=iDaughter2; iPi=iDaughter1; } if (iD0<0) continue; TParticle* secondmother = stackSig->Particle(iD0); Int_t iD0Daughter1 = secondmother->GetFirstDaughter(); TParticle* D0Daughter1 = stackSig->Particle(iD0Daughter1); Int_t iD0Daughter2 = secondmother->GetLastDaughter(); TParticle* D0Daughter2 = stackSig->Particle(iD0Daughter2); for(Int_t irec=0; irecGetTrack(irec); UInt_t label = TMath::Abs(track->GetLabel()); if(label<10000000) { if(label == iPi) cout<Close(); timer.Stop(); timer.Print(); }