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::one::EDProducer< EndRunProducer, one::WatchLuminosityBlocks > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 BeamHaloProducer (const ParameterSet &)
 Constructor. More...
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
virtual ~BeamHaloProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::one::EDProducer< EndRunProducer, one::WatchLuminosityBlocks >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginLuminosityBlock (LuminosityBlock const &, EventSetup const &) override
 
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 endLuminosityBlock (LuminosityBlock const &, EventSetup const &) override
 
virtual void endRunProduce (Run &r, const EventSetup &es) override
 
virtual void produce (Event &e, const EventSetup &es) override
 

Private Attributes

float EG_MAX_
 
float EG_MIN_
 
HepMC::GenEvent * evt
 
std::string G3FNAME_
 
int GENMOD_
 
bool isInitialized_
 
int IW_HAD_
 
int IW_MUO_
 
int LHC_B1_
 
int LHC_B2_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 23 of file BeamHaloProducer.h.

Constructor & Destructor Documentation

BeamHaloProducer::BeamHaloProducer ( const ParameterSet pset)

Constructor.

Definition at line 59 of file BeamHaloProducer.cc.

References call_bh_set_parameters(), gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

59  :
60  evt(0),
61  isInitialized_(false)
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  produces<HepMCProduct>();
87  produces<GenEventInfoProduct>();
88  produces<GenRunInfoProduct, InRun>();
89 
90  cout << "BeamHaloProducer: starting event generation ... " << endl;
91 }
T getUntrackedParameter(std::string const &, T const &) const
HepMC::GenEvent * evt
bool call_bh_set_parameters(int *ival, float *fval, const std::string cval_string)
tuple cout
Definition: gather_cfg.py:121
BeamHaloProducer::~BeamHaloProducer ( )
virtual

Destructor.

Definition at line 53 of file BeamHaloProducer.cc.

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

Member Function Documentation

void BeamHaloProducer::beginLuminosityBlock ( LuminosityBlock const &  lumi,
EventSetup const &   
)
overrideprivatevirtual

Definition at line 102 of file BeamHaloProducer.cc.

References call_ki_bhg_init(), edm::LuminosityBlock::index(), isInitialized_, and fileCollector::seed.

103 {
104  if(!isInitialized_) {
105  isInitialized_ = true;
106  RandomEngineSentry<BeamHaloProducer> randomEngineSentry(this, lumi.index());
107 
108  // -- initialisation
109  long seed = 1; // This seed is not actually used
110  call_ki_bhg_init(seed);
111  }
112 }
tuple lumi
Definition: fjr2json.py:35
bool call_ki_bhg_init(long &seed)
bool BeamHaloProducer::call_bh_set_parameters ( int *  ival,
float *  fval,
const std::string  cval_string 
)
private

Definition at line 173 of file BeamHaloProducer.cc.

References BHSETPARAM.

Referenced by BeamHaloProducer().

173  {
174  BHSETPARAM(ival,fval,cval_string.c_str(),cval_string.length());
175  return true;
176 }
#define BHSETPARAM
bool BeamHaloProducer::call_ki_bhg_fill ( int &  iret,
float &  weight 
)
private

Definition at line 183 of file BeamHaloProducer.cc.

References KI_BHG_FILL.

Referenced by produce().

183  {
184  KI_BHG_FILL(iret,weight);
185  return true;
186 }
#define KI_BHG_FILL
int weight
Definition: histoStyle.py:50
bool BeamHaloProducer::call_ki_bhg_init ( long &  seed)
private

Definition at line 178 of file BeamHaloProducer.cc.

References KI_BHG_INIT.

Referenced by beginLuminosityBlock().

178  {
179  KI_BHG_INIT(seed);
180  return true;
181 }
#define KI_BHG_INIT
bool BeamHaloProducer::call_ki_bhg_stat ( int &  iret)
private

Definition at line 188 of file BeamHaloProducer.cc.

References KI_BHG_STAT.

188  {
189  KI_BHG_STAT(iret);
190  return true;
191 }
#define KI_BHG_STAT
void BeamHaloProducer::clear ( void  )
private

Definition at line 94 of file BeamHaloProducer.cc.

95 {
96 }
virtual void edm::BeamHaloProducer::endLuminosityBlock ( LuminosityBlock const &  ,
EventSetup const &   
)
inlineoverrideprivatevirtual

Definition at line 44 of file BeamHaloProducer.h.

44 { }
void BeamHaloProducer::endRunProduce ( Run r,
const EventSetup es 
)
overrideprivatevirtual

Definition at line 164 of file BeamHaloProducer.cc.

References edm::Run::put().

165 {
166  // just create an empty product
167  // to keep the EventContent definitions happy
168  // later on we might put the info into the run info that this is a PGun
169  auto_ptr<GenRunInfoProduct> genRunInfo( new GenRunInfoProduct() );
170  run.put( genRunInfo );
171 }
void BeamHaloProducer::produce ( Event e,
const EventSetup es 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 114 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(), edm::Event::streamID(), histoStyle::weight, create_public_pileup_plots::weights, and wrapper.

114  {
115 
116  RandomEngineSentry<BeamHaloProducer> randomEngineSentry(this, e.streamID());
117 
118  // cout << "in produce " << endl;
119 
120  // auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
121 
122  // cout << "apres autoptr " << endl;
123 
124  int iret=0;
125  float weight = 0;
126  call_ki_bhg_fill(iret, weight);
127 
128 // Throw an exception if call_ki_bhg_fill(...) fails. Use the EventCorruption
129 // exception since it maps onto SkipEvent which is what we want to do here.
130 
131  if( iret < 0 )
133  << "BeamHaloProducer: function call_ki_bhg_fill returned " << iret << endl;
134 
135  // cout << "apres fortran " << endl;
136 
137 
138  // HepMC::GenEvent* evt = conv.getGenEventfromHEPEVT();
139  // HepMC::GenEvent* evt = conv.read_next_event(); seems to be broken (?)
140  evt = new HepMC::GenEvent();
141 
142  for (int theindex = 1; theindex<=wrapper.number_entries(); theindex++) {
143  HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(wrapper.x(theindex),wrapper.y(theindex),wrapper.z(theindex),wrapper.t(theindex)));
144  HepMC::FourVector p(wrapper.px(theindex),wrapper.py(theindex),wrapper.pz(theindex),wrapper.e(theindex));
145  HepMC::GenParticle* Part =
146  new HepMC::GenParticle(p,wrapper.id(theindex),wrapper.status(theindex));
147  Vtx->add_particle_out(Part);
148  evt->add_vertex(Vtx);
149  }
150 
151  evt->set_event_number(e.id().event());
152 
153  HepMC::WeightContainer& weights = evt -> weights();
154  weights.push_back(weight);
155  // evt->print();
156  std::auto_ptr<HepMCProduct> CMProduct(new HepMCProduct());
157  if (evt) CMProduct->addHepMCData(evt);
158  e.put(CMProduct);
159 
160  auto_ptr<GenEventInfoProduct> genEventInfo(new GenEventInfoProduct(evt));
161  e.put(genEventInfo);
162 }
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:116
bool call_ki_bhg_fill(int &iret, float &weight)
edm::EventID id() const
Definition: EventBase.h:56
StreamID streamID() const
Definition: Event.h:75
int weight
Definition: histoStyle.py:50
static HepMC::HEPEVT_Wrapper wrapper
void BeamHaloProducer::setRandomEngine ( CLHEP::HepRandomEngine *  v)

Definition at line 98 of file BeamHaloProducer.cc.

References _BeamHalo_randomEngine, and findQualityFiles::v.

98  {
100 }
CLHEP::HepRandomEngine * _BeamHalo_randomEngine
Definition: PYR.cc:3

Member Data Documentation

float edm::BeamHaloProducer::EG_MAX_
private

Definition at line 56 of file BeamHaloProducer.h.

float edm::BeamHaloProducer::EG_MIN_
private

Definition at line 55 of file BeamHaloProducer.h.

HepMC::GenEvent* edm::BeamHaloProducer::evt
private

Definition at line 48 of file BeamHaloProducer.h.

Referenced by produce().

std::string edm::BeamHaloProducer::G3FNAME_
private

Definition at line 57 of file BeamHaloProducer.h.

int edm::BeamHaloProducer::GENMOD_
private

Definition at line 50 of file BeamHaloProducer.h.

bool edm::BeamHaloProducer::isInitialized_
private

Definition at line 59 of file BeamHaloProducer.h.

Referenced by beginLuminosityBlock().

int edm::BeamHaloProducer::IW_HAD_
private

Definition at line 54 of file BeamHaloProducer.h.

int edm::BeamHaloProducer::IW_MUO_
private

Definition at line 53 of file BeamHaloProducer.h.

int edm::BeamHaloProducer::LHC_B1_
private

Definition at line 51 of file BeamHaloProducer.h.

int edm::BeamHaloProducer::LHC_B2_
private

Definition at line 52 of file BeamHaloProducer.h.