#include <BeamHaloProducer.h>
Public Member Functions | |
BeamHaloProducer (const ParameterSet &) | |
Constructor. | |
virtual | ~BeamHaloProducer () |
Destructor. | |
Private Member Functions | |
bool | call_bh_set_parameters (int *ival, float *fval, const std::string cval_string) |
bool | call_ki_bhg_fill (int &iret, float &weight) |
bool | call_ki_bhg_init (long &seed) |
bool | call_ki_bhg_stat (int &iret) |
void | clear () |
virtual void | endRun (Run &r, const EventSetup &es) |
virtual void | produce (Event &e, const EventSetup &es) |
Private Attributes | |
float | EG_MAX_ |
float | EG_MIN_ |
HepMC::GenEvent * | evt |
std::string | G3FNAME_ |
int | GENMOD_ |
int | IW_HAD_ |
int | IW_MUO_ |
int | LHC_B1_ |
int | LHC_B2_ |
Definition at line 18 of file BeamHaloProducer.h.
BeamHaloProducer::BeamHaloProducer | ( | const ParameterSet & | pset | ) |
Constructor.
Definition at line 60 of file BeamHaloProducer.cc.
References _BeamHalo_randomEngine, call_bh_set_parameters(), call_ki_bhg_init(), gather_cfg::cout, and edm::ParameterSet::getUntrackedParameter().
: evt(0) { int iparam[8]; float fparam[4]; std::string cparam; // -- from bhgctrl.inc iparam[0] = pset.getUntrackedParameter<int>("GENMOD"); iparam[1] = pset.getUntrackedParameter<int>("LHC_B1"); iparam[2] = pset.getUntrackedParameter<int>("LHC_B2"); iparam[3] = pset.getUntrackedParameter<int>("IW_MUO"); iparam[4] = pset.getUntrackedParameter<int>("IW_HAD"); iparam[5] = 9999999; iparam[6] = pset.getUntrackedParameter<int>("OFFSET",0); iparam[7] = pset.getUntrackedParameter<int>("shift_bx"); fparam[0] = (float)pset.getUntrackedParameter<double>("EG_MIN"); fparam[1] = (float)pset.getUntrackedParameter<double>("EG_MAX"); fparam[2] = (float)pset.getUntrackedParameter<double>("BXNS"); fparam[3] = (float)pset.getUntrackedParameter<double>("W0",1.0); cparam = pset.getUntrackedParameter<std::string>("G3FNAME","input.txt"); call_bh_set_parameters(iparam,fparam,cparam); // -- Seed for randomnumbers Service<RandomNumberGenerator> rng; _BeamHalo_randomEngine = &(rng->getEngine()); long seed = (long)(rng->mySeed()); // -- initialisation call_ki_bhg_init(seed); produces<HepMCProduct>(); produces<GenEventInfoProduct>(); produces<GenRunInfoProduct, InRun>(); cout << "BeamHaloProducer: starting event generation ... " << endl; }
BeamHaloProducer::~BeamHaloProducer | ( | ) | [virtual] |
Destructor.
Definition at line 54 of file BeamHaloProducer.cc.
{ int iret=0; call_ki_bhg_stat(iret); }
bool BeamHaloProducer::call_bh_set_parameters | ( | int * | ival, |
float * | fval, | ||
const std::string | cval_string | ||
) | [private] |
Definition at line 165 of file BeamHaloProducer.cc.
References BHSETPARAM.
Referenced by BeamHaloProducer().
{ BHSETPARAM(ival,fval,cval_string.c_str(),cval_string.length()); return true; }
bool BeamHaloProducer::call_ki_bhg_fill | ( | int & | iret, |
float & | weight | ||
) | [private] |
Definition at line 175 of file BeamHaloProducer.cc.
References KI_BHG_FILL.
Referenced by produce().
{ KI_BHG_FILL(iret,weight); return true; }
bool BeamHaloProducer::call_ki_bhg_init | ( | long & | seed | ) | [private] |
Definition at line 170 of file BeamHaloProducer.cc.
References KI_BHG_INIT.
Referenced by BeamHaloProducer().
{ KI_BHG_INIT(seed); return true; }
bool BeamHaloProducer::call_ki_bhg_stat | ( | int & | iret | ) | [private] |
Definition at line 180 of file BeamHaloProducer.cc.
References KI_BHG_STAT.
{ KI_BHG_STAT(iret); return true; }
void BeamHaloProducer::clear | ( | void | ) | [private] |
Definition at line 105 of file BeamHaloProducer.cc.
{ }
void BeamHaloProducer::endRun | ( | Run & | r, |
const EventSetup & | es | ||
) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 156 of file BeamHaloProducer.cc.
References edm::Run::put().
{ // just create an empty product // to keep the EventContent definitions happy // later on we might put the info into the run info that this is a PGun auto_ptr<GenRunInfoProduct> genRunInfo( new GenRunInfoProduct() ); run.put( genRunInfo ); }
void BeamHaloProducer::produce | ( | Event & | e, |
const EventSetup & | es | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 109 of file BeamHaloProducer.cc.
References call_ki_bhg_fill(), edm::EventID::event(), edm::errors::EventCorruption, evt, Exception, configurableAnalysis::GenParticle, edm::EventBase::id(), AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), CommonMethods::weight(), create_public_pileup_plots::weights, and wrapper.
{ // cout << "in produce " << endl; // auto_ptr<HepMCProduct> bare_product(new HepMCProduct()); // cout << "apres autoptr " << endl; int iret=0; float weight = 0; call_ki_bhg_fill(iret, weight); // Throw an exception if call_ki_bhg_fill(...) fails. Use the EventCorruption // exception since it maps onto SkipEvent which is what we want to do here. if( iret < 0 ) throw edm::Exception(edm::errors::EventCorruption) << "BeamHaloProducer: function call_ki_bhg_fill returned " << iret << endl; // cout << "apres fortran " << endl; // HepMC::GenEvent* evt = conv.getGenEventfromHEPEVT(); // HepMC::GenEvent* evt = conv.read_next_event(); seems to be broken (?) evt = new HepMC::GenEvent(); for (int theindex = 1; theindex<=wrapper.number_entries(); theindex++) { HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(wrapper.x(theindex),wrapper.y(theindex),wrapper.z(theindex),wrapper.t(theindex))); HepMC::FourVector p(wrapper.px(theindex),wrapper.py(theindex),wrapper.pz(theindex),wrapper.e(theindex)); HepMC::GenParticle* Part = new HepMC::GenParticle(p,wrapper.id(theindex),wrapper.status(theindex)); Vtx->add_particle_out(Part); evt->add_vertex(Vtx); } evt->set_event_number(e.id().event()); HepMC::WeightContainer& weights = evt -> weights(); weights.push_back(weight); // evt->print(); std::auto_ptr<HepMCProduct> CMProduct(new HepMCProduct()); if (evt) CMProduct->addHepMCData(evt); e.put(CMProduct); auto_ptr<GenEventInfoProduct> genEventInfo(new GenEventInfoProduct(evt)); e.put(genEventInfo); }
float edm::BeamHaloProducer::EG_MAX_ [private] |
Definition at line 47 of file BeamHaloProducer.h.
float edm::BeamHaloProducer::EG_MIN_ [private] |
Definition at line 46 of file BeamHaloProducer.h.
HepMC::GenEvent* edm::BeamHaloProducer::evt [private] |
Definition at line 39 of file BeamHaloProducer.h.
Referenced by produce().
std::string edm::BeamHaloProducer::G3FNAME_ [private] |
Definition at line 48 of file BeamHaloProducer.h.
int edm::BeamHaloProducer::GENMOD_ [private] |
Definition at line 41 of file BeamHaloProducer.h.
int edm::BeamHaloProducer::IW_HAD_ [private] |
Definition at line 45 of file BeamHaloProducer.h.
int edm::BeamHaloProducer::IW_MUO_ [private] |
Definition at line 44 of file BeamHaloProducer.h.
int edm::BeamHaloProducer::LHC_B1_ [private] |
Definition at line 42 of file BeamHaloProducer.h.
int edm::BeamHaloProducer::LHC_B2_ [private] |
Definition at line 43 of file BeamHaloProducer.h.