void Output_Delphes::AnalyseEvent (ExRootTreeBranch *branch,const HepMC::GenEvent& evt, const Long64_t eventNumber,const double weight) { TRootLHEFEvent *element; element = static_cast<TRootLHEFEvent*>(branch->NewEntry()); element->Number = eventNumber; element->Nparticles = evt.particles_size(); element->ProcessID = evt.signal_process_id(); element->Weight = weight; element->ScalePDF = evt.event_scale(); element->CouplingQED = evt.alphaQED(); element->CouplingQCD = evt.alphaQCD(); }
void Output_Delphes::AnalyseParticles(ExRootTreeBranch *branch, const HepMC::GenEvent& evt) { TRootC::GenParticle *element; TLorentzVector momentum; Double_t signPz; ReadStats(); for(int n=1; n<=evt.particles_size(); n++) { int mo1, mo2, da1, da2, status, pid; getStatsFromTuple(mo1,mo2,da1,da2,status,pid,n); element = static_cast<TRootC::GenParticle*>(branch->NewEntry()); element->PID = pid; element->Status = status; element->M1 = mo1 - 1; // added -1 as the numbering in the tree starts from 0 element->M2 = mo2 - 1; element->D1 = da1 - 1; element->D2 = da2 - 1; element->E = index_to_particle[n]->momentum().e(); element->Px = index_to_particle[n]->momentum().px(); element->Py = index_to_particle[n]->momentum().py(); element->Pz = index_to_particle[n]->momentum().pz(); element->PT = sqrt(pow(element->Px,2)+pow(element->Py,2)); momentum.SetPxPyPzE(element->Px, element->Py, element->Pz, element->E); signPz = (element->Pz >= 0.0) ? 1.0 : -1.0; element->Eta = element->PT < 1e-6 ? signPz*999.9 : momentum.Eta(); element->Phi = index_to_particle[n]->momentum().phi(); HepMC::GenVertex* vrtI = (index_to_particle[n])->production_vertex(); HepMC::GenVertex::particles_in_const_iterator partI; if(vrtI) { element->T = vrtI->position().t(); element->X = vrtI->position().x(); element->Y = vrtI->position().y(); element->Z = vrtI->position().z(); } else { element->T = 0.; element->X = 0.; element->Y = 0.; element->Z = 0.; } } }