IOMC
ParticleGuns
src
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
10
#include "
FWCore/Framework/interface/EDProducer.h
"
11
#include "
FWCore/Framework/interface/EventSetup.h
"
12
#include "
FWCore/Framework/interface/Run.h
"
13
#include "
FWCore/ServiceRegistry/interface/Service.h
"
14
#include "
FWCore/Utilities/interface/Exception.h
"
15
#include "
FWCore/Utilities/interface/RandomNumberGenerator.h
"
16
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
17
18
#include "
SimDataFormats/GeneratorProducts/interface/HepMCProduct.h
"
19
#include "
SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h
"
20
21
#include "
SimGeneral/HepPDTRecord/interface/ParticleDataTable.h
"
22
23
#include "
IOMC/ParticleGuns/interface/BaseRandomtXiGunProducer.h
"
24
25
#include <iostream>
26
27
using namespace
edm
;
28
using namespace
std
;
29
using namespace
CLHEP
;
30
31
BaseRandomtXiGunProducer::BaseRandomtXiGunProducer
(
const
edm::ParameterSet
&
pset
) : fEvt(nullptr) {
32
Service<RandomNumberGenerator>
rng;
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
60
BaseRandomtXiGunProducer::~BaseRandomtXiGunProducer
() {}
61
62
void
BaseRandomtXiGunProducer::beginRun
(
const
edm::Run
&
r
,
const
EventSetup
& es) {
63
es.
getData
(
fPDGTable
);
64
return
;
65
}
66
67
void
BaseRandomtXiGunProducer::endRun
(
const
Run
&
run
,
const
EventSetup
& es) {}
68
void
BaseRandomtXiGunProducer::endRunProduce
(
Run
&
run
,
const
EventSetup
& es) {
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
}
edm::BaseRandomtXiGunProducer::BaseRandomtXiGunProducer
BaseRandomtXiGunProducer(const ParameterSet &)
Definition:
BaseRandomtXiGunProducer.cc:31
edm::BaseRandomtXiGunProducer::beginRun
void beginRun(const edm::Run &r, const edm::EventSetup &) override
Definition:
BaseRandomtXiGunProducer.cc:62
edm::BaseRandomtXiGunProducer::fPartIDs
std::vector< int > fPartIDs
Definition:
BaseRandomtXiGunProducer.h:41
edm::BaseRandomtXiGunProducer::fMinPhi
double fMinPhi
Definition:
BaseRandomtXiGunProducer.h:42
EDProducer.h
edm::BaseRandomtXiGunProducer::fFireForward
bool fFireForward
Definition:
BaseRandomtXiGunProducer.h:56
edm::Run
Definition:
Run.h:45
edm
HLT enums.
Definition:
AlignableModifier.h:19
RandomNumberGenerator.h
edm::BaseRandomtXiGunProducer::endRun
void endRun(const edm::Run &r, const edm::EventSetup &) override
Definition:
BaseRandomtXiGunProducer.cc:67
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
GenRunInfoProduct.h
Service.h
Run.h
edm::BaseRandomtXiGunProducer::fpEnergy
double fpEnergy
Definition:
BaseRandomtXiGunProducer.h:44
CLHEP
Definition:
CocoaGlobals.h:27
edm::ParameterSet
Definition:
ParameterSet.h:36
ParticleDataTable.h
edm::Service
Definition:
Service.h:30
edm::EventSetup
Definition:
EventSetup.h:57
edm::BaseRandomtXiGunProducer::~BaseRandomtXiGunProducer
~BaseRandomtXiGunProducer() override
Definition:
BaseRandomtXiGunProducer.cc:60
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition:
EventSetup.h:113
alignCSCRings.r
r
Definition:
alignCSCRings.py:93
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::BaseRandomtXiGunProducer::endRunProduce
void endRunProduce(edm::Run &r, const edm::EventSetup &) override
Definition:
BaseRandomtXiGunProducer.cc:68
edm::BaseRandomtXiGunProducer::fPDGTable
ESHandle< HepPDT::ParticleDataTable > fPDGTable
Definition:
BaseRandomtXiGunProducer.h:50
std
Definition:
JetResolutionObject.h:76
writedatasetfile.run
run
Definition:
writedatasetfile.py:27
Exception
Definition:
hltDiff.cc:246
EventSetup.h
Exception.h
edm::BaseRandomtXiGunProducer::fFireBackward
bool fFireBackward
Definition:
BaseRandomtXiGunProducer.h:57
ParameterSet.h
HepMCProduct.h
edm::BaseRandomtXiGunProducer::fVerbosity
int fVerbosity
Definition:
BaseRandomtXiGunProducer.h:52
edm::BaseRandomtXiGunProducer::fECMS
double fECMS
Definition:
BaseRandomtXiGunProducer.h:45
BaseRandomtXiGunProducer.h
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
edm::BaseRandomtXiGunProducer::fMaxPhi
double fMaxPhi
Definition:
BaseRandomtXiGunProducer.h:43
Generated for CMSSW Reference Manual by
1.8.16