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::EDProducer edm::ProducerBase edm::ProductRegistryHelper edm::ExpoRandomPtGunProducer edm::FlatRandomEGunProducer edm::FlatRandomOneOverPtGunProducer edm::FlatRandomPtGunProducer edm::MultiParticleInConeGunProducer

Public Member Functions

 BaseFlatGunProducer (const ParameterSet &)
 
void beginRun (edm::Run &r, const edm::EventSetup &)
 
void endRun (edm::Run &r, const edm::EventSetup &)
 
virtual ~BaseFlatGunProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Protected Attributes

bool fAddAntiParticle
 
HepMC::GenEvent * fEvt
 
double fMaxEta
 
double fMaxPhi
 
double fMinEta
 
double fMinPhi
 
std::vector< int > fPartIDs
 
ESHandle
< HepPDT::ParticleDataTable
fPDGTable
 
CLHEP::HepRandomEngine & fRandomEngine
 
CLHEP::RandFlat * fRandomGenerator
 
int fVerbosity
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 31 of file BaseFlatGunProducer.h.

Constructor & Destructor Documentation

BaseFlatGunProducer::BaseFlatGunProducer ( const ParameterSet pset)

Definition at line 49 of file BaseFlatGunProducer.cc.

References fAddAntiParticle, fMaxEta, fMaxPhi, fMinEta, fMinPhi, fPartIDs, fRandomEngine, fRandomGenerator, fVerbosity, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

49  :
50  fEvt(0),
53  // fPDGTable( new DefaultConfig::ParticleDataTable("PDG Table") )
54 {
55 
56  ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters") ;
57 
58  // although there's the method ParameterSet::empty(),
59  // it looks like it's NOT even necessary to check if it is,
60  // before trying to extract parameters - if it is empty,
61  // the default values seem to be taken
62  fPartIDs = pgun_params.getParameter< vector<int> >("PartID");
63  fMinEta = pgun_params.getParameter<double>("MinEta");
64  fMaxEta = pgun_params.getParameter<double>("MaxEta");
65  fMinPhi = pgun_params.getParameter<double>("MinPhi");
66  fMaxPhi = pgun_params.getParameter<double>("MaxPhi");
67 
68  //
69  //fPDGTablePath = "/afs/cern.ch/sw/lcg/external/clhep/1.9.2.1/slc3_ia32_gcc323/data/HepPDT/" ;
70 /*
71  string HepPDTBase( getenv("HEPPDT_PARAM_PATH") ) ;
72  fPDGTablePath = HepPDTBase + "/data/" ;
73  fPDGTableName = "PDG_mass_width_2004.mc"; // should it be 2004 table ?
74 
75  string TableFullName = fPDGTablePath + fPDGTableName ;
76  ifstream PDFile( TableFullName.c_str() ) ;
77  if( !PDFile )
78  {
79  throw cms::Exception("FileNotFound", "BaseFlatGunProducer::BaseFlatGunProducer()")
80  << "File " << TableFullName << " cannot be opened.\n";
81  }
82 
83  HepPDT::TableBuilder tb(*fPDGTable) ;
84  if ( !addPDGParticles( PDFile, tb ) ) { cout << " Error reading PDG !" << endl; }
85  // the tb dtor fills fPDGTable
86 */
87 
88  fVerbosity = pset.getUntrackedParameter<int>( "Verbosity",0 ) ;
89 
90 // The Service has already instantiated an engine. Use it.
91  fRandomGenerator = new CLHEP::RandFlat(fRandomEngine) ;
92  fAddAntiParticle = pset.getParameter<bool>("AddAntiParticle") ;
93 
94  produces<GenRunInfoProduct, InRun>();
95 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CLHEP::HepRandomEngine & fRandomEngine
CLHEP::HepRandomEngine & getEngineReference()
CLHEP::RandFlat * fRandomGenerator
std::vector< int > fPartIDs
BaseFlatGunProducer::~BaseFlatGunProducer ( )
virtual

Definition at line 97 of file BaseFlatGunProducer.cc.

98 {
99 
100 //if ( fRandomGenerator != NULL ) delete fRandomGenerator;
101  // do I need to delete the Engine, too ?
102 
103  // no need to cleanup GenEvent memory - done in HepMCProduct
104  // if (fEvt != NULL) delete fEvt ; // double check
105  // delete fPDGTable;
106 
107 }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 110 of file BaseFlatGunProducer.cc.

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

111 {
112  es.getData( fPDGTable ) ;
113  return ;
114 
115 }
void getData(T &iHolder) const
Definition: EventSetup.h:67
ESHandle< HepPDT::ParticleDataTable > fPDGTable
void BaseFlatGunProducer::endRun ( edm::Run r,
const edm::EventSetup es 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 118 of file BaseFlatGunProducer.cc.

References edm::Run::put().

119 {
120  // just create an empty product
121  // to keep the EventContent definitions happy
122  // later on we might put the info into the run info that this is a PGun
123  auto_ptr<GenRunInfoProduct> genRunInfo( new GenRunInfoProduct() );
124  run.put( genRunInfo );
125 }

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
CLHEP::HepRandomEngine& edm::BaseFlatGunProducer::fRandomEngine
protected
CLHEP::RandFlat* edm::BaseFlatGunProducer::fRandomGenerator
protected
int edm::BaseFlatGunProducer::fVerbosity
protected