- return fFiMin[i+nbinsM_min];
- }
-
-//______________________________________________________________________________________
-Bool_t AliPtMothFromPtDaugh::ReadKinematics(const char *pathFileName)
- {
- /*Read the kinematic to create the Ntupla and store it in the file DecayKine.root:
- if it is already created read it from the file DecayKine.root. Input: path of the
- file galice.root.
- TNtupla contains: pdg of Mothers
- px "
- py "
- pz "
- rapidity "
- eta "
- pdg of Daughter
- px "
- py "
- pz "
- rapidity "
- eta " */
- if(fReadKine)
- {
- TFile *f = new TFile("DecayKine.root","READ");
- if(!f) {AliWarning("File DecayKine.root with TNtupla doesn't exist!"); return kFALSE;}
- fDecayKine=(TNtuple*)gDirectory->Get("DecayKine");
- if(!fDecayKine) { AliWarning("The TNtupla doesn't exist!\n"); return kFALSE;}
- return kTRUE;
- }
- if(!fMothers) { AliWarning("Set Pdg codes for mothers before to call ReadKinematic!\n"); return kFALSE;}
- if(!fDaughter) { AliWarning("Set Pdg codes for daughter before to call ReadKinematic!\n"); return kFALSE;}
- //declare the out file in which is stored the Ntupla
- TFile *out = new TFile("DecayKine.root","RECREATE");
- //create the TNtupla
- if(fDecayKine) {delete fDecayKine; fDecayKine = 0;}
- fDecayKine=new TNtuple("DecayKine","Decay kinematics",
- "pdgM:pxM:pyM:pzM:yM:etaM:pdgD:pxD:pyD:pzD:yD:etaD");
- AliRunLoader *RunLoader = AliRunLoader::Open(pathFileName);
- if(!RunLoader) { AliWarning("File galice.root not found!\n"); return kFALSE;}
- AliStack *stack=NULL;
- RunLoader->LoadHeader();
- RunLoader->LoadKinematics();
- float *inf = new float[12];
- Int_t pdg;
- Int_t nEvents = RunLoader->GetNumberOfEvents();
- //event loop
- for(Int_t iEvent = 0; iEvent < nEvents; ++iEvent){
- RunLoader->GetEvent(iEvent);
- stack = RunLoader->Stack();
- Int_t nPrims = stack->GetNprimary();
- for (Int_t iTrack = 0; iTrack < nPrims; ++iTrack) {
- TParticle *part = stack->Particle(iTrack);
- pdg=TMath::Abs(part->GetPdgCode());
- Double_t y,y2;
- //check if particle is in mothers list
- Int_t labelDaugh;
- if(IsMothers(pdg))
- {
- //check if mother particle has a selected daugh
- if(!IsSelectedDaugh(part,labelDaugh,stack)) continue;
- TParticle *pDaugh=stack->Particle(labelDaugh);
- Rapidity(part,y);
- Rapidity(pDaugh,y2);
-
- inf[0]=part->GetPdgCode();
- inf[1]=part->Px();
- inf[2]=part->Py();
- inf[3]=part->Pz();
- inf[4]=y;
- inf[5]=part->Eta();
- inf[6]=pDaugh->GetPdgCode();
- inf[7]=pDaugh->Px();
- inf[8]=pDaugh->Py();
- inf[9]=pDaugh->Pz();
- inf[10]=y2;
- inf[11]=pDaugh->Eta();
-
- fDecayKine->Fill(inf);
- }//close if statement for mothers particles
- }//end of tracks loop
- }//end of events loop
-
- RunLoader->UnloadHeader();
- RunLoader->UnloadKinematics();
- RunLoader->UnloadTrigger();
- RunLoader->UnloadTrackRefs();
- delete RunLoader;
- out->cd();
- fDecayKine->Write();
- return kTRUE;