CMS 3D CMS Logo

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 
16 
19 
21 
23 
24 #include <iostream>
25 
26 using namespace edm;
27 using namespace std;
28 using namespace CLHEP;
29 
31  : fPDGTableToken(esConsumes<Transition::BeginRun>()), fEvt(nullptr) {
33  if (!rng.isAvailable()) {
34  throw cms::Exception("Configuration")
35  << "The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
36  "which appears to be absent. Please add that service to your configuration\n"
37  "or remove the modules that require it.";
38  }
39 
40  ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters");
41 
42  // although there's the method ParameterSet::empty(),
43  // it looks like it's NOT even necessary to check if it is,
44  // before trying to extract parameters - if it is empty,
45  // the default values seem to be taken
46  fPartIDs = pgun_params.getParameter<vector<int> >("PartID");
47  fMinPhi = pgun_params.getParameter<double>("MinPhi");
48  fMaxPhi = pgun_params.getParameter<double>("MaxPhi");
49  fECMS = pgun_params.getParameter<double>("ECMS");
50  fpEnergy = fECMS / 2.0;
51 
52  fVerbosity = pset.getUntrackedParameter<int>("Verbosity", 0);
53 
54  fFireBackward = pset.getParameter<bool>("FireBackward");
55  fFireForward = pset.getParameter<bool>("FireForward");
56 
57  produces<GenRunInfoProduct, Transition::EndRun>();
58 }
59 
61 
64  return;
65 }
66 
69  // just create an empty product
70  // to keep the EventContent definitions happy
71  // later on we might put the info into the run info that this is a PGun
72  run.put(std::make_unique<GenRunInfoProduct>());
73 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BaseRandomtXiGunProducer(const ParameterSet &)
void endRun(const edm::Run &r, const edm::EventSetup &) override
void beginRun(const edm::Run &r, const edm::EventSetup &) override
const ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > fPDGTableToken
Transition
Definition: Transition.h:12
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
ESHandle< HepPDT::ParticleDataTable > fPDGTable
void endRunProduce(edm::Run &r, const edm::EventSetup &) override
HLT enums.
bool isAvailable() const
Definition: Service.h:40
Definition: Run.h:45