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::BeamHaloSource Class Reference

#include <BeamHaloSource.h>

Inheritance diagram for edm::BeamHaloSource:
edm::GeneratedInputSource edm::ConfigurableInputSource edm::InputSource edm::ProductRegistryHelper

Public Member Functions

 BeamHaloSource (const ParameterSet &, const InputSourceDescription &)
 Constructor. More...
 
virtual ~BeamHaloSource ()
 Destructor. More...
 
- Public Member Functions inherited from edm::GeneratedInputSource
 GeneratedInputSource (ParameterSet const &pset, InputSourceDescription const &desc)
 
virtual ~GeneratedInputSource ()
 
- Public Member Functions inherited from edm::ConfigurableInputSource
 ConfigurableInputSource (ParameterSet const &pset, InputSourceDescription const &desc, bool realData=true)
 
EventNumber_t event () const
 
unsigned int eventCreationDelay () const
 
LuminosityBlockNumber_t luminosityBlock () const
 
unsigned int numberEventsInLumi () const
 
unsigned int numberEventsInRun () const
 
unsigned int numberEventsInThisLumi () const
 
unsigned int numberEventsInThisRun () const
 
TimeValue_t presentTime () const
 
RunNumber_t run () const
 
unsigned int timeBetweenEvents () const
 
virtual ~ConfigurableInputSource ()
 
- Public Member Functions inherited from edm::InputSource
boost::shared_ptr
< ActivityRegistry
actReg () const
 Accessor for Activity Registry. More...
 
void closeFile (boost::shared_ptr< FileBlock >)
 close current file More...
 
void doBeginJob ()
 Called by framework at beginning of job. More...
 
void doBeginLumi (LuminosityBlockPrincipal &lbp)
 Called by framework at beginning of lumi block. More...
 
void doBeginRun (RunPrincipal &rp)
 Called by framework at beginning of run. More...
 
void doEndJob ()
 Called by framework at end of job. More...
 
void doEndLumi (LuminosityBlockPrincipal &lbp)
 Called by framework at end of lumi block. More...
 
void doEndRun (RunPrincipal &rp)
 Called by framework at end of run. More...
 
void doPostForkReacquireResources (boost::shared_ptr< multicore::MessageReceiverForSource >)
 
void doPreForkReleaseResources ()
 Called by the framework before forking the process. More...
 
ProcessingController::ForwardState forwardState () const
 
bool goToEvent (EventID const &eventID)
 
 InputSource (ParameterSet const &, InputSourceDescription const &)
 Constructor. More...
 
void issueReports (EventID const &eventID)
 issue an event report More...
 
LuminosityBlockNumber_t luminosityBlock () const
 Accessor for current luminosity block number. More...
 
boost::shared_ptr
< LuminosityBlockAuxiliary
luminosityBlockAuxiliary () const
 Called by the framework to merge or insert lumi in principal cache. More...
 
int markLumi ()
 Mark lumi as read. More...
 
int markRun ()
 Mark run as read. More...
 
int maxEvents () const
 
int maxLuminosityBlocks () const
 
ModuleDescription const & moduleDescription () const
 Accessor for 'module' description. More...
 
ItemType nextItemType ()
 
bool const primary () const
 Accessor for primary input source flag. More...
 
ProcessConfiguration const & processConfiguration () const
 Accessor for Process Configuration. More...
 
std::string const & processGUID () const
 Accessor for global process identifier. More...
 
ProcessHistoryID const & processHistoryID () const
 Accessor for the input process history ID of the current run. More...
 
ProcessingMode processingMode () const
 RunsLumisAndEvents (default), RunsAndLumis, or Runs. More...
 
boost::shared_ptr
< ProductRegistry const > 
productRegistry () const
 Accessor for product registry. More...
 
bool randomAccess () const
 
void readAndCacheLumi ()
 Read next luminosity block. More...
 
void readAndCacheRun ()
 Read next run. More...
 
EventPrincipalreadEvent (boost::shared_ptr< LuminosityBlockPrincipal > lbCache)
 
EventPrincipalreadEvent (EventID const &)
 Read a specific event. More...
 
boost::shared_ptr< FileBlockreadFile ()
 Read next file. More...
 
boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary ()
 Read next luminosity block Auxilary. More...
 
boost::shared_ptr< RunAuxiliaryreadRunAuxiliary ()
 Read next run Auxiliary. More...
 
void registerProducts ()
 Register any produced products. More...
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void repeat ()
 Reset the remaining number of events/lumis to the maximum number. More...
 
ProcessingController::ReverseState reverseState () const
 
void rewind ()
 Begin again at the first event. More...
 
RunNumber_t run () const
 Accessor for current run number. More...
 
boost::shared_ptr< RunAuxiliaryrunAuxiliary () const
 Called by the framework to merge or insert run in principal cache. More...
 
void setLuminosityBlockNumber_t (LuminosityBlockNumber_t lb)
 Set the luminosity block ID. More...
 
void setRunNumber (RunNumber_t r)
 Set the run number. More...
 
void skipEvents (int offset)
 
Timestamp const & timestamp () const
 Accessor for the current time, as seen by the input source. More...
 
void wakeUp ()
 Wake up the input source. More...
 
virtual ~InputSource ()
 Destructor. More...
 

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 bool produce (Event &e)
 

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::InputSource
enum  ItemType {
  IsInvalid, IsStop, IsFile, IsRun,
  IsLumi, IsEvent, IsRepeat
}
 
enum  ProcessingMode { Runs, RunsAndLumis, RunsLumisAndEvents }
 
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::ConfigurableInputSource
static void fillDescription (ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::InputSource
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ConfigurableInputSource
void reallyReadEvent ()
 
void setEventNumber (EventNumber_t e)
 
void setTime (TimeValue_t t)
 
- Protected Member Functions inherited from edm::InputSource
void decreaseRemainingEventsBy (int iSkipped)
 
EventPrincipal *const eventPrincipalCache ()
 
boost::shared_ptr
< LuminosityBlockPrincipal >
const 
luminosityBlockPrincipal () const
 
PrincipalCache const & principalCache () const
 
PrincipalCacheprincipalCache ()
 
ProductRegistryproductRegistryUpdate () const
 
void reset () const
 
void resetLuminosityBlockAuxiliary () const
 
void resetRunAuxiliary () const
 
boost::shared_ptr
< RunPrincipal > const 
runPrincipal () const
 
void setLuminosityBlockAuxiliary (LuminosityBlockAuxiliary *lbp)
 
void setLumiPrematurelyRead ()
 
void setRunAuxiliary (RunAuxiliary *rp)
 
void setRunPrematurelyRead ()
 
void setTimestamp (Timestamp const &theTime)
 To set the current time, as seen by the input source. More...
 
ItemType state () const
 

Detailed Description

Definition at line 22 of file BeamHaloSource.h.

Constructor & Destructor Documentation

BeamHaloSource::BeamHaloSource ( const ParameterSet pset,
const InputSourceDescription desc 
)

Constructor.

Definition at line 56 of file BeamHaloSource.cc.

References _BeamHalo_randomEngine, call_bh_set_parameters(), call_ki_bhg_init(), gather_cfg::cout, edm::RandomNumberGenerator::getEngine(), edm::ParameterSet::getUntrackedParameter(), edm::RandomNumberGenerator::mySeed(), and edm::ConfigurableInputSource::numberEventsInRun().

57  :
58  GeneratedInputSource(pset, desc), evt(0)
59 {
60 
61  int iparam[8];
62  float fparam[4];
63  std::string cparam;
64  // -- from bhgctrl.inc
65  iparam[0] = pset.getUntrackedParameter<int>("GENMOD");
66  iparam[1] = pset.getUntrackedParameter<int>("LHC_B1");
67  iparam[2] = pset.getUntrackedParameter<int>("LHC_B2");
68  iparam[3] = pset.getUntrackedParameter<int>("IW_MUO");
69  iparam[4] = pset.getUntrackedParameter<int>("IW_HAD");
70  iparam[5] = numberEventsInRun();
71  iparam[6] = pset.getUntrackedParameter<int>("OFFSET",0);
72  iparam[7] = pset.getUntrackedParameter<int>("shift_bx");
73 
74  fparam[0] = (float)pset.getUntrackedParameter<double>("EG_MIN");
75  fparam[1] = (float)pset.getUntrackedParameter<double>("EG_MAX");
76 
77  fparam[2] = (float)pset.getUntrackedParameter<double>("BXNS");
78  fparam[3] = (float)pset.getUntrackedParameter<double>("W0",1.0);
79 
80  cparam = pset.getUntrackedParameter<std::string>("G3FNAME","input.txt");
81  call_bh_set_parameters(iparam,fparam,cparam);
82 
83 
84 // -- Seed for randomnumbers
87  long seed = (long)(rng->mySeed());
88 
89 
90 // -- initialisation
91  call_ki_bhg_init(seed);
92 
93 
94  produces<HepMCProduct>();
95  cout << "BeamHaloSource: starting event generation ... " << endl;
96 
97 }
T getUntrackedParameter(std::string const &, T const &) const
CLHEP::HepRandomEngine * _BeamHalo_randomEngine
Definition: PYR.cc:3
GeneratedInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
bool call_bh_set_parameters(int *ival, float *fval, const std::string cval_string)
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...
unsigned int numberEventsInRun() const
bool call_ki_bhg_init(long &seed)
tuple cout
Definition: gather_cfg.py:41
virtual uint32_t mySeed() const =0
Exists for backward compatibility.
BeamHaloSource::~BeamHaloSource ( )
virtual

Destructor.

Definition at line 50 of file BeamHaloSource.cc.

50  {
51  int iret=0;
52  call_ki_bhg_stat(iret);
53 }
bool call_ki_bhg_stat(int &iret)

Member Function Documentation

bool BeamHaloSource::call_bh_set_parameters ( int *  ival,
float *  fval,
const std::string  cval_string 
)
private

Definition at line 147 of file BeamHaloSource.cc.

References BHSETPARAM.

Referenced by BeamHaloSource().

147  {
148  BHSETPARAM(ival,fval,cval_string.c_str(),cval_string.length());
149  return true;
150 }
#define BHSETPARAM
bool BeamHaloSource::call_ki_bhg_fill ( int &  iret,
float &  weight 
)
private

Definition at line 157 of file BeamHaloSource.cc.

References KI_BHG_FILL.

Referenced by produce().

157  {
158  KI_BHG_FILL(iret,weight);
159  return true;
160 }
#define KI_BHG_FILL
bool BeamHaloSource::call_ki_bhg_init ( long &  seed)
private

Definition at line 152 of file BeamHaloSource.cc.

References KI_BHG_INIT.

Referenced by BeamHaloSource().

152  {
153  KI_BHG_INIT(seed);
154  return true;
155 }
#define KI_BHG_INIT
bool BeamHaloSource::call_ki_bhg_stat ( int &  iret)
private

Definition at line 162 of file BeamHaloSource.cc.

References KI_BHG_STAT.

162  {
163  KI_BHG_STAT(iret);
164  return true;
165 }
#define KI_BHG_STAT
void BeamHaloSource::clear ( void  )
private
bool BeamHaloSource::produce ( Event e)
privatevirtual

Implements edm::ConfigurableInputSource.

Definition at line 104 of file BeamHaloSource.cc.

References call_ki_bhg_fill(), edm::ConfigurableInputSource::event(), evt, configurableAnalysis::GenParticle, L1TEmulatorMonitor_cff::p, edm::Event::put(), CommonMethods::weight(), ExpressReco_HICollisions_FallBack::weights, and wrapper.

104  {
105  // cout << "in produce " << endl;
106 
107  // auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
108 
109  // cout << "apres autoptr " << endl;
110 
111  int iret=0;
112  float weight = 0;
113  call_ki_bhg_fill(iret, weight);
114 
115  if( iret < 0 ) return false;
116 
117  // cout << "apres fortran " << endl;
118 
119 
120  // HepMC::GenEvent* evt = conv.getGenEventfromHEPEVT();
121  // HepMC::GenEvent* evt = conv.read_next_event(); seems to be broken (?)
122  evt = new HepMC::GenEvent();
123 
124  for (int theindex = 1; theindex<=wrapper.number_entries(); theindex++) {
125  HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(wrapper.x(theindex),wrapper.y(theindex),wrapper.z(theindex),wrapper.t(theindex)));
126  HepMC::FourVector p(wrapper.px(theindex),wrapper.py(theindex),wrapper.pz(theindex),wrapper.e(theindex));
127  HepMC::GenParticle* Part =
128  new HepMC::GenParticle(p,wrapper.id(theindex),wrapper.status(theindex));
129  Vtx->add_particle_out(Part);
130  evt->add_vertex(Vtx);
131  }
132 
133  evt->set_event_number(event());
134 
135  HepMC::WeightContainer& weights = evt -> weights();
136  weights.push_back(weight);
137  // evt->print();
138  std::auto_ptr<HepMCProduct> CMProduct(new HepMCProduct());
139  if (evt) CMProduct->addHepMCData(evt );
140  e.put(CMProduct);
141 
142  return true;
143 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool call_ki_bhg_fill(int &iret, float &weight)
HepMC::GenEvent * evt
static HepMC::HEPEVT_Wrapper wrapper

Member Data Documentation

float edm::BeamHaloSource::EG_MAX_
private

Definition at line 49 of file BeamHaloSource.h.

float edm::BeamHaloSource::EG_MIN_
private

Definition at line 48 of file BeamHaloSource.h.

HepMC::GenEvent* edm::BeamHaloSource::evt
private

Definition at line 41 of file BeamHaloSource.h.

Referenced by produce().

std::string edm::BeamHaloSource::G3FNAME_
private

Definition at line 50 of file BeamHaloSource.h.

int edm::BeamHaloSource::GENMOD_
private

Definition at line 43 of file BeamHaloSource.h.

int edm::BeamHaloSource::IW_HAD_
private

Definition at line 47 of file BeamHaloSource.h.

int edm::BeamHaloSource::IW_MUO_
private

Definition at line 46 of file BeamHaloSource.h.

int edm::BeamHaloSource::LHC_B1_
private

Definition at line 44 of file BeamHaloSource.h.

int edm::BeamHaloSource::LHC_B2_
private

Definition at line 45 of file BeamHaloSource.h.