#include <yetkin/GenHIEventProducer/src/GenHIEventProducer.cc>
Public Member Functions | |
GenHIEventProducer (const edm::ParameterSet &) | |
~GenHIEventProducer () | |
Private Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
bool | doParticleInfo_ |
std::vector< std::string > | hepmcSrc_ |
edm::ESHandle< ParticleDataTable > | pdt |
double | ptCut_ |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 49 of file GenHIEventProducer.cc.
GenHIEventProducer::GenHIEventProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 75 of file GenHIEventProducer.cc.
References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().
{ produces<edm::GenHIEvent>(); hepmcSrc_ = iConfig.getParameter<std::vector<std::string> >("generators"); doParticleInfo_ = iConfig.getUntrackedParameter<bool>("doParticleInfo",false); if(doParticleInfo_){ ptCut_ = iConfig.getUntrackedParameter<double> ("ptCut",1.); } }
GenHIEventProducer::~GenHIEventProducer | ( | ) |
Definition at line 86 of file GenHIEventProducer.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void GenHIEventProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 101 of file GenHIEventProducer.cc.
References b, begin, DeDxDiscriminatorTools::charge(), end, relval_parameters_module::energy, eta, edm::Event::getByLabel(), edm::EventSetup::getData(), reco::tau::helpers::nCharged(), np, npart, phi, and edm::Event::put().
{ using namespace edm; if(!(pdt.isValid())) iSetup.getData(pdt); double b = -1; int npart = -1; int ncoll = 0; int nhard = 0; double phi = 0; double ecc = -1; int nCharged = 0; int nChargedMR = 0; int nChargedPtCut = 0; // NchargedPtCut bym int nChargedPtCutMR = 0; // NchargedPtCutMR bym double meanPt = 0; double meanPtMR = 0; double EtMR = 0; // Normalized of total energy bym double TotEnergy = 0; // Total energy bym for(size_t ihep = 0; ihep < hepmcSrc_.size(); ++ihep){ Handle<edm::HepMCProduct> hepmc; iEvent.getByLabel(hepmcSrc_[ihep],hepmc); const HepMC::GenEvent* evt = hepmc->GetEvent(); if(doParticleInfo_){ HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin(); HepMC::GenEvent::particle_const_iterator end = evt->particles_end(); for(HepMC::GenEvent::particle_const_iterator it = begin; it != end; ++it){ if((*it)->status() != 1) continue; int pdg_id = (*it)->pdg_id(); const ParticleData * part = pdt->particle(pdg_id ); int charge = static_cast<int>(part->charge()); if(charge == 0) continue; float pt = (*it)->momentum().perp(); float eta = (*it)->momentum().eta(); float energy = (*it)->momentum().e(); // energy bym //float energy = (*it)->momentum().energy(); // energy bym nCharged++; meanPt += pt; // Get the total energy bym if(fabs(eta)<1.0){ TotEnergy += energy; } if(pt>ptCut_){ nChargedPtCut++; if(fabs(eta)<0.5){ nChargedPtCutMR++; } } // end bym if(fabs(eta) > 0.5) continue; nChargedMR++; meanPtMR += pt; } } const HepMC::HeavyIon* hi = evt->heavy_ion(); if(hi){ ncoll = ncoll + hi->Ncoll(); nhard = nhard + hi->Ncoll_hard(); int np = hi->Npart_proj() + hi->Npart_targ(); if(np >= 0){ npart = np; b = hi->impact_parameter(); phi = hi->event_plane_angle(); ecc = hi->eccentricity(); } } } // Get the normalized total energy bym if(TotEnergy != 0){ EtMR = TotEnergy/2; } if(nChargedMR != 0){ meanPtMR /= nChargedMR; } if(nCharged != 0){ meanPt /= nCharged; } std::auto_ptr<edm::GenHIEvent> pGenHI(new edm::GenHIEvent(b, npart, ncoll, nhard, phi, ecc, nCharged, nChargedMR, meanPt, meanPtMR, EtMR, nChargedPtCut, nChargedPtCutMR )); iEvent.put(pGenHI); }
bool GenHIEventProducer::doParticleInfo_ [private] |
Definition at line 60 of file GenHIEventProducer.cc.
std::vector<std::string> GenHIEventProducer::hepmcSrc_ [private] |
Definition at line 56 of file GenHIEventProducer.cc.
edm::ESHandle< ParticleDataTable > GenHIEventProducer::pdt [private] |
Definition at line 57 of file GenHIEventProducer.cc.
double GenHIEventProducer::ptCut_ [private] |
Definition at line 59 of file GenHIEventProducer.cc.