test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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::ExpoRandomPGunProducer edm::ExpoRandomPtGunProducer edm::FlatRandomEGunProducer edm::FlatRandomOneOverPtGunProducer edm::FlatRandomPtGunProducer edm::MultiParticleInConeGunProducer

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
 
virtual ~BaseFlatGunProducer ()
 
- Public Member Functions inherited from edm::one::EDProducer< one::WatchRuns, EndRunProducer >
 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 ()
 

Protected Attributes

bool fAddAntiParticle
 
HepMC::GenEvent * fEvt
 
double fMaxEta
 
double fMaxPhi
 
double fMinEta
 
double fMinPhi
 
std::vector< int > fPartIDs
 
ESHandle
< HepPDT::ParticleDataTable
fPDGTable
 
int fVerbosity
 

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

Constructor & Destructor Documentation

BaseFlatGunProducer::BaseFlatGunProducer ( const ParameterSet pset)

Definition at line 30 of file BaseFlatGunProducer.cc.

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

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

Definition at line 81 of file BaseFlatGunProducer.cc.

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

Member Function Documentation

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

Definition at line 90 of file BaseFlatGunProducer.cc.

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

91 {
92  es.getData( fPDGTable ) ;
93  return ;
94 
95 }
void getData(T &iHolder) const
Definition: EventSetup.h:67
return((rh^lh)&mask)
ESHandle< HepPDT::ParticleDataTable > fPDGTable
void BaseFlatGunProducer::endRun ( edm::Run const &  r,
const edm::EventSetup es 
)
override

Definition at line 96 of file BaseFlatGunProducer.cc.

96  {
97 }
void BaseFlatGunProducer::endRunProduce ( edm::Run r,
const edm::EventSetup es 
)
override

Definition at line 100 of file BaseFlatGunProducer.cc.

References edm::Run::put().

101 {
102  // just create an empty product
103  // to keep the EventContent definitions happy
104  // later on we might put the info into the run info that this is a PGun
105  auto_ptr<GenRunInfoProduct> genRunInfo( new GenRunInfoProduct() );
106  run.put( genRunInfo );
107 }

Member Data Documentation

bool edm::BaseFlatGunProducer::fAddAntiParticle
protected
HepMC::GenEvent* edm::BaseFlatGunProducer::fEvt
protected
double edm::BaseFlatGunProducer::fMaxEta
protected
double edm::BaseFlatGunProducer::fMaxPhi
protected
double edm::BaseFlatGunProducer::fMinEta
protected
double edm::BaseFlatGunProducer::fMinPhi
protected
std::vector<int> edm::BaseFlatGunProducer::fPartIDs
protected
ESHandle<HepPDT::ParticleDataTable> edm::BaseFlatGunProducer::fPDGTable
protected
int edm::BaseFlatGunProducer::fVerbosity
protected