CMS 3D CMS Logo

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

#include <BaseFlatGunProducer.h>

Inheritance diagram for edm::BaseFlatGunProducer:
edm::one::EDProducer< one::WatchRuns, EndRunProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper edm::CloseByParticleGunProducer edm::ExpoRandomPGunProducer edm::ExpoRandomPtGunProducer edm::FlatRandomEGunProducer edm::FlatRandomMultiParticlePGunProducer edm::FlatRandomOneOverPtGunProducer edm::FlatRandomPtAndDxyGunProducer edm::FlatRandomPtGunProducer edm::MultiParticleInConeGunProducer edm::RandomMultiParticlePGunProducer

Public Member Functions

 BaseFlatGunProducer (const ParameterSet &)
 
void beginRun (const edm::Run &r, const edm::EventSetup &) override
 
void endRun (edm::Run const &r, const edm::EventSetup &) override
 
void endRunProduce (edm::Run &r, const edm::EventSetup &) override
 
 ~BaseFlatGunProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer< one::WatchRuns, EndRunProducer >
 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)
 

Protected Attributes

bool fAddAntiParticle
 
HepMC::GenEventfEvt
 
double fMaxEta
 
double fMaxPhi
 
double fMinEta
 
double fMinPhi
 
std::vector< int > fPartIDs
 
ESHandle< HepPDT::ParticleDataTablefPDGTable
 
int fVerbosity
 

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 26 of file BaseFlatGunProducer.h.

Constructor & Destructor Documentation

◆ BaseFlatGunProducer()

BaseFlatGunProducer::BaseFlatGunProducer ( const ParameterSet pset)

Definition at line 29 of file BaseFlatGunProducer.cc.

30  : fEvt(nullptr)
31 // fPDGTable( new DefaultConfig::ParticleDataTable("PDG Table") )
32 {
34  if (!rng.isAvailable()) {
35  throw cms::Exception("Configuration")
36  << "The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
37  "which appears to be absent. Please add that service to your configuration\n"
38  "or remove the modules that require it.";
39  }
40 
41  ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters");
42 
43  // although there's the method ParameterSet::empty(),
44  // it looks like it's NOT even necessary to check if it is,
45  // before trying to extract parameters - if it is empty,
46  // the default values seem to be taken
47  fPartIDs = pgun_params.getParameter<vector<int> >("PartID");
48  fMinEta = pgun_params.getParameter<double>("MinEta");
49  fMaxEta = pgun_params.getParameter<double>("MaxEta");
50  fMinPhi = pgun_params.getParameter<double>("MinPhi");
51  fMaxPhi = pgun_params.getParameter<double>("MaxPhi");
52 
53  //
54  //fPDGTablePath = "/afs/cern.ch/sw/lcg/external/clhep/1.9.2.1/slc3_ia32_gcc323/data/HepPDT/" ;
55  /*
56  string HepPDTBase( std::getenv("HEPPDT_PARAM_PATH") ) ;
57  fPDGTablePath = HepPDTBase + "/data/" ;
58  fPDGTableName = "PDG_mass_width_2004.mc"; // should it be 2004 table ?
59 
60  string TableFullName = fPDGTablePath + fPDGTableName ;
61  std::ifstream PDFile( TableFullName.c_str() ) ;
62  if( !PDFile )
63  {
64  throw cms::Exception("FileNotFound", "BaseFlatGunProducer::BaseFlatGunProducer()")
65  << "File " << TableFullName << " cannot be opened.\n";
66  }
67 
68  HepPDT::TableBuilder tb(*fPDGTable) ;
69  if ( !addPDGParticles( PDFile, tb ) ) { cout << " Error reading PDG !" << endl; }
70  // the tb dtor fills fPDGTable
71 */
72 
73  fVerbosity = pset.getUntrackedParameter<int>("Verbosity", 0);
74 
75  fAddAntiParticle = pset.getParameter<bool>("AddAntiParticle");
76 
77  produces<GenRunInfoProduct, Transition::EndRun>();
78 }

References Exception, fAddAntiParticle, fMaxEta, fMaxPhi, fMinEta, fMinPhi, fPartIDs, fVerbosity, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), and muonDTDigis_cfi::pset.

◆ ~BaseFlatGunProducer()

BaseFlatGunProducer::~BaseFlatGunProducer ( )
override

Definition at line 80 of file BaseFlatGunProducer.cc.

80  {
81  // no need to cleanup GenEvent memory - done in HepMCProduct
82  // if (fEvt != NULL) delete fEvt ; // double check
83  // delete fPDGTable;
84 }

Member Function Documentation

◆ beginRun()

void BaseFlatGunProducer::beginRun ( const edm::Run r,
const edm::EventSetup es 
)
override

Definition at line 86 of file BaseFlatGunProducer.cc.

86  {
87  es.getData(fPDGTable);
88  return;
89 }

References fPDGTable, and edm::EventSetup::getData().

◆ endRun()

void BaseFlatGunProducer::endRun ( edm::Run const &  r,
const edm::EventSetup es 
)
override

Definition at line 90 of file BaseFlatGunProducer.cc.

90 {}

◆ endRunProduce()

void BaseFlatGunProducer::endRunProduce ( edm::Run r,
const edm::EventSetup es 
)
override

Definition at line 92 of file BaseFlatGunProducer.cc.

92  {
93  // just create an empty product
94  // to keep the EventContent definitions happy
95  // later on we might put the info into the run info that this is a PGun
96  unique_ptr<GenRunInfoProduct> genRunInfo(new GenRunInfoProduct());
97  run.put(std::move(genRunInfo));
98 }

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

Member Data Documentation

◆ fAddAntiParticle

bool edm::BaseFlatGunProducer::fAddAntiParticle
protected

◆ fEvt

HepMC::GenEvent* edm::BaseFlatGunProducer::fEvt
protected

◆ fMaxEta

double edm::BaseFlatGunProducer::fMaxEta
protected

◆ fMaxPhi

double edm::BaseFlatGunProducer::fMaxPhi
protected

◆ fMinEta

double edm::BaseFlatGunProducer::fMinEta
protected

◆ fMinPhi

double edm::BaseFlatGunProducer::fMinPhi
protected

◆ fPartIDs

std::vector<int> edm::BaseFlatGunProducer::fPartIDs
protected

◆ fPDGTable

ESHandle<HepPDT::ParticleDataTable> edm::BaseFlatGunProducer::fPDGTable
protected

◆ fVerbosity

int edm::BaseFlatGunProducer::fVerbosity
protected
edm::BaseFlatGunProducer::fMaxPhi
double fMaxPhi
Definition: BaseFlatGunProducer.h:45
edm::BaseFlatGunProducer::fAddAntiParticle
bool fAddAntiParticle
Definition: BaseFlatGunProducer.h:61
edm::BaseFlatGunProducer::fMaxEta
double fMaxEta
Definition: BaseFlatGunProducer.h:43
edm::BaseFlatGunProducer::fEvt
HepMC::GenEvent * fEvt
Definition: BaseFlatGunProducer.h:48
edm::BaseFlatGunProducer::fMinPhi
double fMinPhi
Definition: BaseFlatGunProducer.h:44
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
edm::BaseFlatGunProducer::fPartIDs
std::vector< int > fPartIDs
Definition: BaseFlatGunProducer.h:41
GenRunInfoProduct
Definition: GenRunInfoProduct.h:8
edm::ParameterSet
Definition: ParameterSet.h:36
edm::Service
Definition: Service.h:30
edm::BaseFlatGunProducer::fPDGTable
ESHandle< HepPDT::ParticleDataTable > fPDGTable
Definition: BaseFlatGunProducer.h:57
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:246
edm::BaseFlatGunProducer::fVerbosity
int fVerbosity
Definition: BaseFlatGunProducer.h:59
edm::BaseFlatGunProducer::fMinEta
double fMinEta
Definition: BaseFlatGunProducer.h:42
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27