CMS 3D CMS Logo

BaseFlatGunProducer.cc
Go to the documentation of this file.
1 /*
2  * \author Julia Yarba
3  */
4 
5 #include <ostream>
6 #include <memory>
7 
15 
18 
20 
22 
23 #include <iostream>
24 
25 using namespace edm;
26 using namespace std;
27 using namespace CLHEP;
28 
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 }
79 
81  // no need to cleanup GenEvent memory - done in HepMCProduct
82  // if (fEvt != NULL) delete fEvt ; // double check
83  // delete fPDGTable;
84 }
85 
87  es.getData(fPDGTable);
88  return;
89 }
90 void BaseFlatGunProducer::endRun(const Run& run, const EventSetup& es) {}
91 
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 }
edm::BaseFlatGunProducer::fMaxPhi
double fMaxPhi
Definition: BaseFlatGunProducer.h:45
edm::BaseFlatGunProducer::fAddAntiParticle
bool fAddAntiParticle
Definition: BaseFlatGunProducer.h:61
EDProducer.h
edm::Run
Definition: Run.h:45
edm::BaseFlatGunProducer::fMaxEta
double fMaxEta
Definition: BaseFlatGunProducer.h:43
edm
HLT enums.
Definition: AlignableModifier.h:19
RandomNumberGenerator.h
edm::BaseFlatGunProducer::fMinPhi
double fMinPhi
Definition: BaseFlatGunProducer.h:44
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
GenRunInfoProduct.h
edm::BaseFlatGunProducer::BaseFlatGunProducer
BaseFlatGunProducer(const ParameterSet &)
Definition: BaseFlatGunProducer.cc:29
edm::BaseFlatGunProducer::fPartIDs
std::vector< int > fPartIDs
Definition: BaseFlatGunProducer.h:41
BaseFlatGunProducer.h
Service.h
Run.h
GenRunInfoProduct
Definition: GenRunInfoProduct.h:8
CLHEP
Definition: CocoaGlobals.h:27
edm::BaseFlatGunProducer::beginRun
void beginRun(const edm::Run &r, const edm::EventSetup &) override
Definition: BaseFlatGunProducer.cc:86
edm::ParameterSet
Definition: ParameterSet.h:47
ParticleDataTable.h
edm::BaseFlatGunProducer::~BaseFlatGunProducer
~BaseFlatGunProducer() override
Definition: BaseFlatGunProducer.cc:80
edm::Service
Definition: Service.h:30
edm::EventSetup
Definition: EventSetup.h:57
edm::BaseFlatGunProducer::fPDGTable
ESHandle< HepPDT::ParticleDataTable > fPDGTable
Definition: BaseFlatGunProducer.h:57
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
alignCSCRings.r
r
Definition: alignCSCRings.py:93
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:246
EventSetup.h
edm::BaseFlatGunProducer::fVerbosity
int fVerbosity
Definition: BaseFlatGunProducer.h:59
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
ParameterSet.h
HepMCProduct.h
edm::BaseFlatGunProducer::endRun
void endRun(edm::Run const &r, const edm::EventSetup &) override
Definition: BaseFlatGunProducer.cc:90
edm::BaseFlatGunProducer::endRunProduce
void endRunProduce(edm::Run &r, const edm::EventSetup &) override
Definition: BaseFlatGunProducer.cc:92
edm::BaseFlatGunProducer::fMinEta
double fMinEta
Definition: BaseFlatGunProducer.h:42
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27