CMS 3D CMS Logo

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

Public Member Functions

 BeamHaloProducer (const ParameterSet &)
 Constructor. More...
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
 ~BeamHaloProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::one::EDProducer< EndRunProducer, one::WatchLuminosityBlocks, one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

float EG_MAX_
 
float EG_MIN_
 
HepMC::GenEventevt
 
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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 22 of file BeamHaloProducer.h.

Constructor & Destructor Documentation

◆ BeamHaloProducer()

BeamHaloProducer::BeamHaloProducer ( const ParameterSet pset)

Constructor.

Definition at line 55 of file BeamHaloProducer.cc.

55  : evt(nullptr), isInitialized_(false) {
56  int iparam[8];
57  float fparam[4];
58  std::string cparam;
59  // -- from bhgctrl.inc
60  iparam[0] = pset.getUntrackedParameter<int>("GENMOD");
61  iparam[1] = pset.getUntrackedParameter<int>("LHC_B1");
62  iparam[2] = pset.getUntrackedParameter<int>("LHC_B2");
63  iparam[3] = pset.getUntrackedParameter<int>("IW_MUO");
64  iparam[4] = pset.getUntrackedParameter<int>("IW_HAD");
65  iparam[5] = 9999999;
66  iparam[6] = pset.getUntrackedParameter<int>("OFFSET", 0);
67  iparam[7] = pset.getUntrackedParameter<int>("shift_bx");
68 
69  fparam[0] = (float)pset.getUntrackedParameter<double>("EG_MIN");
70  fparam[1] = (float)pset.getUntrackedParameter<double>("EG_MAX");
71 
72  fparam[2] = (float)pset.getUntrackedParameter<double>("BXNS");
73  fparam[3] = (float)pset.getUntrackedParameter<double>("W0", 1.0);
74 
75  cparam = pset.getUntrackedParameter<std::string>("G3FNAME", "input.txt");
76  call_bh_set_parameters(iparam, fparam, cparam);
77 
78  produces<HepMCProduct>("unsmeared");
79  produces<GenEventInfoProduct>();
80  produces<GenRunInfoProduct, Transition::EndRun>();
81 
82  usesResource("BeamHaloProducer");
83 
84  cout << "BeamHaloProducer: starting event generation ... " << endl;
85 }

References call_bh_set_parameters(), gather_cfg::cout, dqmMemoryStats::float, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~BeamHaloProducer()

BeamHaloProducer::~BeamHaloProducer ( )
override

Destructor.

Definition at line 50 of file BeamHaloProducer.cc.

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

Member Function Documentation

◆ beginLuminosityBlock()

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

Definition at line 91 of file BeamHaloProducer.cc.

91  {
92  if (!isInitialized_) {
93  isInitialized_ = true;
94  RandomEngineSentry<BeamHaloProducer> randomEngineSentry(this, lumi.index());
95 
96  // -- initialisation
97  long seed = 1; // This seed is not actually used
99  }
100 }

References call_ki_bhg_init(), isInitialized_, and SurveyInfoScenario_cff::seed.

◆ call_bh_set_parameters()

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

Definition at line 159 of file BeamHaloProducer.cc.

159  {
160  BHSETPARAM(ival, fval, cval_string.c_str(), cval_string.length());
161  return true;
162 }

References BHSETPARAM.

Referenced by BeamHaloProducer().

◆ call_ki_bhg_fill()

bool BeamHaloProducer::call_ki_bhg_fill ( int &  iret,
float &  weight 
)
private

Definition at line 169 of file BeamHaloProducer.cc.

169  {
170  KI_BHG_FILL(iret, weight);
171  return true;
172 }

References KI_BHG_FILL.

Referenced by produce().

◆ call_ki_bhg_init()

bool BeamHaloProducer::call_ki_bhg_init ( long &  seed)
private

Definition at line 164 of file BeamHaloProducer.cc.

164  {
165  KI_BHG_INIT(seed);
166  return true;
167 }

References KI_BHG_INIT, and SurveyInfoScenario_cff::seed.

Referenced by beginLuminosityBlock().

◆ call_ki_bhg_stat()

bool BeamHaloProducer::call_ki_bhg_stat ( int &  iret)
private

Definition at line 174 of file BeamHaloProducer.cc.

174  {
175  KI_BHG_STAT(iret);
176  return true;
177 }

References KI_BHG_STAT.

◆ clear()

void BeamHaloProducer::clear ( void  )
private

Definition at line 87 of file BeamHaloProducer.cc.

87 {}

◆ endLuminosityBlock()

void edm::BeamHaloProducer::endLuminosityBlock ( LuminosityBlock const &  ,
EventSetup const &   
)
inlineoverrideprivate

Definition at line 41 of file BeamHaloProducer.h.

41 {}

◆ endRunProduce()

void BeamHaloProducer::endRunProduce ( Run r,
const EventSetup es 
)
overrideprivate

Definition at line 151 of file BeamHaloProducer.cc.

151  {
152  // just create an empty product
153  // to keep the EventContent definitions happy
154  // later on we might put the info into the run info that this is a PGun
155  unique_ptr<GenRunInfoProduct> genRunInfo(new GenRunInfoProduct());
156  run.put(std::move(genRunInfo));
157 }

References eostools::move(), and writedatasetfile::run.

◆ produce()

void BeamHaloProducer::produce ( Event e,
const EventSetup es 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 102 of file BeamHaloProducer.cc.

102  {
103  RandomEngineSentry<BeamHaloProducer> randomEngineSentry(this, e.streamID());
104 
105  // cout << "in produce " << endl;
106 
107  // unique_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  // Throw an exception if call_ki_bhg_fill(...) fails. Use the EventCorruption
116  // exception since it maps onto SkipEvent which is what we want to do here.
117 
118  if (iret < 0)
120  << "BeamHaloProducer: function call_ki_bhg_fill returned " << iret << endl;
121 
122  // cout << "apres fortran " << endl;
123 
124  // HepMC::GenEvent* evt = conv.getGenEventfromHEPEVT();
125  // HepMC::GenEvent* evt = conv.read_next_event(); seems to be broken (?)
126  evt = new HepMC::GenEvent();
127 
128  for (int theindex = 1; theindex <= wrapper.number_entries(); theindex++) {
129  HepMC::GenVertex* Vtx = new HepMC::GenVertex(
130  HepMC::FourVector(wrapper.x(theindex), wrapper.y(theindex), wrapper.z(theindex), wrapper.t(theindex)));
131  HepMC::FourVector p(wrapper.px(theindex), wrapper.py(theindex), wrapper.pz(theindex), wrapper.e(theindex));
132  HepMC::GenParticle* Part = new HepMC::GenParticle(p, wrapper.id(theindex), wrapper.status(theindex));
133  Vtx->add_particle_out(Part);
134  evt->add_vertex(Vtx);
135  }
136 
137  evt->set_event_number(e.id().event());
138 
139  HepMC::WeightContainer& weights = evt->weights();
140  weights.push_back(weight);
141  // evt->print();
142  std::unique_ptr<HepMCProduct> CMProduct(new HepMCProduct());
143  if (evt)
144  CMProduct->addHepMCData(evt);
145  e.put(std::move(CMProduct), "unsmeared");
146 
147  unique_ptr<GenEventInfoProduct> genEventInfo(new GenEventInfoProduct(evt));
148  e.put(std::move(genEventInfo));
149 }

References call_ki_bhg_fill(), MillePedeFileConverter_cfg::e, edm::errors::EventCorruption, evt, Exception, genParticles2HepMC_cfi::genEventInfo, GenParticle::GenParticle, ZgammaFilter_cfi::HepMCProduct, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, HLT_2018_cff::weights, and wrapper.

◆ setRandomEngine()

void BeamHaloProducer::setRandomEngine ( CLHEP::HepRandomEngine *  v)

Definition at line 89 of file BeamHaloProducer.cc.

References _BeamHalo_randomEngine, and findQualityFiles::v.

Member Data Documentation

◆ EG_MAX_

float edm::BeamHaloProducer::EG_MAX_
private

Definition at line 53 of file BeamHaloProducer.h.

◆ EG_MIN_

float edm::BeamHaloProducer::EG_MIN_
private

Definition at line 52 of file BeamHaloProducer.h.

◆ evt

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

Definition at line 45 of file BeamHaloProducer.h.

Referenced by produce().

◆ G3FNAME_

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

Definition at line 54 of file BeamHaloProducer.h.

◆ GENMOD_

int edm::BeamHaloProducer::GENMOD_
private

Definition at line 47 of file BeamHaloProducer.h.

◆ isInitialized_

bool edm::BeamHaloProducer::isInitialized_
private

Definition at line 56 of file BeamHaloProducer.h.

Referenced by beginLuminosityBlock().

◆ IW_HAD_

int edm::BeamHaloProducer::IW_HAD_
private

Definition at line 51 of file BeamHaloProducer.h.

◆ IW_MUO_

int edm::BeamHaloProducer::IW_MUO_
private

Definition at line 50 of file BeamHaloProducer.h.

◆ LHC_B1_

int edm::BeamHaloProducer::LHC_B1_
private

Definition at line 48 of file BeamHaloProducer.h.

◆ LHC_B2_

int edm::BeamHaloProducer::LHC_B2_
private

Definition at line 49 of file BeamHaloProducer.h.

GenEventInfoProduct
Definition: GenEventInfoProduct.h:17
HLT_2018_cff.weights
weights
Definition: HLT_2018_cff.py:87167
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ZgammaFilter_cfi.HepMCProduct
HepMCProduct
Definition: ZgammaFilter_cfi.py:9
KI_BHG_INIT
#define KI_BHG_INIT
Definition: BeamHaloProducer.cc:25
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::errors::EventCorruption
Definition: EDMException.h:43
wrapper
static HepMC::HEPEVT_Wrapper wrapper
Definition: BeamHaloProducer.cc:47
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
KI_BHG_FILL
#define KI_BHG_FILL
Definition: BeamHaloProducer.cc:35
GenRunInfoProduct
Definition: GenRunInfoProduct.h:8
edm::BeamHaloProducer::evt
HepMC::GenEvent * evt
Definition: BeamHaloProducer.h:45
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::BeamHaloProducer::call_bh_set_parameters
bool call_bh_set_parameters(int *ival, float *fval, const std::string cval_string)
Definition: BeamHaloProducer.cc:159
BHSETPARAM
#define BHSETPARAM
Definition: BeamHaloProducer.cc:30
_BeamHalo_randomEngine
CLHEP::HepRandomEngine * _BeamHalo_randomEngine
Definition: PYR.cc:3
edm::BeamHaloProducer::call_ki_bhg_fill
bool call_ki_bhg_fill(int &iret, float &weight)
Definition: BeamHaloProducer.cc:169
edm::BeamHaloProducer::call_ki_bhg_init
bool call_ki_bhg_init(long &seed)
Definition: BeamHaloProducer.cc:164
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
genParticles2HepMC_cfi.genEventInfo
genEventInfo
Definition: genParticles2HepMC_cfi.py:6
edm::RandomEngineSentry
Definition: RandomEngineSentry.h:28
KI_BHG_STAT
#define KI_BHG_STAT
Definition: BeamHaloProducer.cc:40
Exception
Definition: hltDiff.cc:246
edm::BeamHaloProducer::call_ki_bhg_stat
bool call_ki_bhg_stat(int &iret)
Definition: BeamHaloProducer.cc:174
lumi
Definition: LumiSectionData.h:20
edm::BeamHaloProducer::isInitialized_
bool isInitialized_
Definition: BeamHaloProducer.h:56
weight
Definition: weight.py:1
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37