CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::BeamHaloProducer Class Reference

#include <BeamHaloProducer.h>

Inheritance diagram for edm::BeamHaloProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 BeamHaloProducer (const ParameterSet &)
 Constructor. More...
 
virtual ~BeamHaloProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 18 of file BeamHaloProducer.h.

Constructor & Destructor Documentation

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, edm::RandomNumberGenerator::getEngine(), edm::ParameterSet::getUntrackedParameter(), and edm::RandomNumberGenerator::mySeed().

60  :
61  evt(0)
62 {
63 
64  int iparam[8];
65  float fparam[4];
66  std::string cparam;
67  // -- from bhgctrl.inc
68  iparam[0] = pset.getUntrackedParameter<int>("GENMOD");
69  iparam[1] = pset.getUntrackedParameter<int>("LHC_B1");
70  iparam[2] = pset.getUntrackedParameter<int>("LHC_B2");
71  iparam[3] = pset.getUntrackedParameter<int>("IW_MUO");
72  iparam[4] = pset.getUntrackedParameter<int>("IW_HAD");
73  iparam[5] = 9999999;
74  iparam[6] = pset.getUntrackedParameter<int>("OFFSET",0);
75  iparam[7] = pset.getUntrackedParameter<int>("shift_bx");
76 
77  fparam[0] = (float)pset.getUntrackedParameter<double>("EG_MIN");
78  fparam[1] = (float)pset.getUntrackedParameter<double>("EG_MAX");
79 
80  fparam[2] = (float)pset.getUntrackedParameter<double>("BXNS");
81  fparam[3] = (float)pset.getUntrackedParameter<double>("W0",1.0);
82 
83  cparam = pset.getUntrackedParameter<std::string>("G3FNAME","input.txt");
84  call_bh_set_parameters(iparam,fparam,cparam);
85 
86 
87 // -- Seed for randomnumbers
90  long seed = (long)(rng->mySeed());
91 
92 
93 // -- initialisation
94  call_ki_bhg_init(seed);
95 
96 
97  produces<HepMCProduct>();
98  produces<GenEventInfoProduct>();
99  produces<GenRunInfoProduct, InRun>();
100 
101  cout << "BeamHaloProducer: starting event generation ... " << endl;
102 }
T getUntrackedParameter(std::string const &, T const &) const
CLHEP::HepRandomEngine * _BeamHalo_randomEngine
Definition: PYR.cc:3
HepMC::GenEvent * evt
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
bool call_bh_set_parameters(int *ival, float *fval, const std::string cval_string)
bool call_ki_bhg_init(long &seed)
tuple cout
Definition: gather_cfg.py:121
virtual uint32_t mySeed() const =0
Exists for backward compatibility.
BeamHaloProducer::~BeamHaloProducer ( )
virtual

Destructor.

Definition at line 54 of file BeamHaloProducer.cc.

54  {
55  int iret=0;
56  call_ki_bhg_stat(iret);
57 }
bool call_ki_bhg_stat(int &iret)

Member Function Documentation

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().

165  {
166  BHSETPARAM(ival,fval,cval_string.c_str(),cval_string.length());
167  return true;
168 }
#define BHSETPARAM
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().

175  {
176  KI_BHG_FILL(iret,weight);
177  return true;
178 }
#define KI_BHG_FILL
bool BeamHaloProducer::call_ki_bhg_init ( long &  seed)
private

Definition at line 170 of file BeamHaloProducer.cc.

References KI_BHG_INIT.

Referenced by BeamHaloProducer().

170  {
171  KI_BHG_INIT(seed);
172  return true;
173 }
#define KI_BHG_INIT
bool BeamHaloProducer::call_ki_bhg_stat ( int &  iret)
private

Definition at line 180 of file BeamHaloProducer.cc.

References KI_BHG_STAT.

180  {
181  KI_BHG_STAT(iret);
182  return true;
183 }
#define KI_BHG_STAT
void BeamHaloProducer::clear ( void  )
private

Definition at line 105 of file BeamHaloProducer.cc.

106 {
107 }
void BeamHaloProducer::endRun ( Run r,
const EventSetup es 
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 156 of file BeamHaloProducer.cc.

References edm::Run::put().

157 {
158  // just create an empty product
159  // to keep the EventContent definitions happy
160  // later on we might put the info into the run info that this is a PGun
161  auto_ptr<GenRunInfoProduct> genRunInfo( new GenRunInfoProduct() );
162  run.put( genRunInfo );
163 }
void BeamHaloProducer::produce ( Event e,
const EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 109 of file BeamHaloProducer.cc.

References call_ki_bhg_fill(), edm::EventID::event(), edm::errors::EventCorruption, evt, edm::hlt::Exception, configurableAnalysis::GenParticle, edm::EventBase::id(), AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), CommonMethods::weight(), create_public_pileup_plots::weights, and wrapper.

109  {
110  // cout << "in produce " << endl;
111 
112  // auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
113 
114  // cout << "apres autoptr " << endl;
115 
116  int iret=0;
117  float weight = 0;
118  call_ki_bhg_fill(iret, weight);
119 
120 // Throw an exception if call_ki_bhg_fill(...) fails. Use the EventCorruption
121 // exception since it maps onto SkipEvent which is what we want to do here.
122 
123  if( iret < 0 )
125  << "BeamHaloProducer: function call_ki_bhg_fill returned " << iret << endl;
126 
127  // cout << "apres fortran " << endl;
128 
129 
130  // HepMC::GenEvent* evt = conv.getGenEventfromHEPEVT();
131  // HepMC::GenEvent* evt = conv.read_next_event(); seems to be broken (?)
132  evt = new HepMC::GenEvent();
133 
134  for (int theindex = 1; theindex<=wrapper.number_entries(); theindex++) {
135  HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(wrapper.x(theindex),wrapper.y(theindex),wrapper.z(theindex),wrapper.t(theindex)));
136  HepMC::FourVector p(wrapper.px(theindex),wrapper.py(theindex),wrapper.pz(theindex),wrapper.e(theindex));
137  HepMC::GenParticle* Part =
138  new HepMC::GenParticle(p,wrapper.id(theindex),wrapper.status(theindex));
139  Vtx->add_particle_out(Part);
140  evt->add_vertex(Vtx);
141  }
142 
143  evt->set_event_number(e.id().event());
144 
145  HepMC::WeightContainer& weights = evt -> weights();
146  weights.push_back(weight);
147  // evt->print();
148  std::auto_ptr<HepMCProduct> CMProduct(new HepMCProduct());
149  if (evt) CMProduct->addHepMCData(evt);
150  e.put(CMProduct);
151 
152  auto_ptr<GenEventInfoProduct> genEventInfo(new GenEventInfoProduct(evt));
153  e.put(genEventInfo);
154 }
EventNumber_t event() const
Definition: EventID.h:44
HepMC::GenEvent * evt
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool call_ki_bhg_fill(int &iret, float &weight)
edm::EventID id() const
Definition: EventBase.h:56
static HepMC::HEPEVT_Wrapper wrapper

Member Data Documentation

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.