CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BaseRandomtXiGunProducer.cc
Go to the documentation of this file.
1 /*
2  * $Date: 2010/01/19 16:17:26 $
3  * $Revision: 1.7 $
4  * \author Julia Yarba
5  */
6 
7 #include <ostream>
8 #include <memory>
9 
17 
20 
22 
24 
25 #include <iostream>
26 
27 using namespace edm;
28 using namespace std;
29 using namespace CLHEP;
30 
32  : fPDGTableToken(esConsumes<Transition::BeginRun>()), fEvt(nullptr) {
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  fMinPhi = pgun_params.getParameter<double>("MinPhi");
49  fMaxPhi = pgun_params.getParameter<double>("MaxPhi");
50  fECMS = pgun_params.getParameter<double>("ECMS");
51  fpEnergy = fECMS / 2.0;
52 
53  fVerbosity = pset.getUntrackedParameter<int>("Verbosity", 0);
54 
55  fFireBackward = pset.getParameter<bool>("FireBackward");
56  fFireForward = pset.getParameter<bool>("FireForward");
57 
58  produces<GenRunInfoProduct, Transition::EndRun>();
59 }
60 
62 
65  return;
66 }
67 
70  // just create an empty product
71  // to keep the EventContent definitions happy
72  // later on we might put the info into the run info that this is a PGun
73  run.put(std::make_unique<GenRunInfoProduct>());
74 }
T getUntrackedParameter(std::string const &, T const &) const
BaseRandomtXiGunProducer(const ParameterSet &)
void endRun(const edm::Run &r, const edm::EventSetup &) override
void beginRun(const edm::Run &r, const edm::EventSetup &) override
bool isAvailable() const
Definition: Service.h:40
const ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > fPDGTableToken
Transition
Definition: Transition.h:12
ESHandle< HepPDT::ParticleDataTable > fPDGTable
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:109
void endRunProduce(edm::Run &r, const edm::EventSetup &) override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
Definition: Run.h:45