21 #include "CLHEP/Random/Random.h"
49 class StaticRandomEngineSetUnset {
52 explicit StaticRandomEngineSetUnset(CLHEP::HepRandomEngine * engine);
53 ~StaticRandomEngineSetUnset();
54 CLHEP::HepRandomEngine* getEngine()
const;
56 CLHEP::HepRandomEngine* m_currentEngine;
57 CLHEP::HepRandomEngine* m_previousEngine;
64 StaticRandomEngineSetUnset
random(
nullptr);
73 produces<edm::SimTrackContainer>().setBranchAlias(
"SimTracks");
74 produces<edm::SimVertexContainer>().setBranchAlias(
"SimVertices");
75 produces<edm::PSimHitContainer>(
"TrackerHitsPixelBarrelLowTof");
76 produces<edm::PSimHitContainer>(
"TrackerHitsPixelBarrelHighTof");
77 produces<edm::PSimHitContainer>(
"TrackerHitsTIBLowTof");
78 produces<edm::PSimHitContainer>(
"TrackerHitsTIBHighTof");
79 produces<edm::PSimHitContainer>(
"TrackerHitsTIDLowTof");
80 produces<edm::PSimHitContainer>(
"TrackerHitsTIDHighTof");
81 produces<edm::PSimHitContainer>(
"TrackerHitsPixelEndcapLowTof");
82 produces<edm::PSimHitContainer>(
"TrackerHitsPixelEndcapHighTof");
83 produces<edm::PSimHitContainer>(
"TrackerHitsTOBLowTof");
84 produces<edm::PSimHitContainer>(
"TrackerHitsTOBHighTof");
85 produces<edm::PSimHitContainer>(
"TrackerHitsTECLowTof");
86 produces<edm::PSimHitContainer>(
"TrackerHitsTECHighTof");
88 produces<edm::PSimHitContainer>(
"TotemHitsT1");
89 produces<edm::PSimHitContainer>(
"TotemHitsT2Gem");
90 produces<edm::PSimHitContainer>(
"TotemHitsRP");
91 produces<edm::PSimHitContainer>(
"FP420SI");
92 produces<edm::PSimHitContainer>(
"BSCHits");
93 produces<edm::PSimHitContainer>(
"PLTHits");
94 produces<edm::PSimHitContainer>(
"BCM1FHits");
96 produces<edm::PCaloHitContainer>(
"EcalHitsEB");
97 produces<edm::PCaloHitContainer>(
"EcalHitsEE");
98 produces<edm::PCaloHitContainer>(
"EcalHitsES");
99 produces<edm::PCaloHitContainer>(
"HcalHits");
100 produces<edm::PCaloHitContainer>(
"CaloHitsTk");
101 produces<edm::PSimHitContainer>(
"MuonDTHits");
102 produces<edm::PSimHitContainer>(
"MuonCSCHits");
103 produces<edm::PSimHitContainer>(
"MuonRPCHits");
104 produces<edm::PSimHitContainer>(
"MuonGEMHits");
105 produces<edm::PCaloHitContainer>(
"CastorPL");
106 produces<edm::PCaloHitContainer>(
"CastorFI");
107 produces<edm::PCaloHitContainer>(
"CastorBU");
108 produces<edm::PCaloHitContainer>(
"CastorTU");
109 produces<edm::PCaloHitContainer>(
"EcalTBH4BeamHits");
110 produces<edm::PCaloHitContainer>(
"HcalTB06BeamHits");
111 produces<edm::PCaloHitContainer>(
"ZDCHITS");
112 produces<edm::PCaloHitContainer>(
"ChamberHits");
113 produces<edm::PCaloHitContainer>(
"FibreHits");
114 produces<edm::PCaloHitContainer>(
"WedgeHits");
119 for(Producers::iterator itProd = m_producers.begin();
120 itProd != m_producers.end(); ++itProd) {
122 (*itProd)->registerProducts(*
this);
136 StaticRandomEngineSetUnset
random(
nullptr);
150 std::vector<SensitiveTkDetector*>& sTk =
152 std::vector<SensitiveCaloDetector*>& sCalo =
159 std::auto_ptr<edm::SimTrackContainer>
161 std::auto_ptr<edm::SimVertexContainer>
170 for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin();
171 it != sTk.end(); ++it) {
173 std::vector<std::string>
v = (*it)->getNames();
174 for (std::vector<std::string>::iterator
in = v.begin();
175 in!= v.end(); ++
in) {
177 std::auto_ptr<edm::PSimHitContainer>
179 (*it)->fillHits(*product,*
in);
183 for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin();
184 it != sCalo.end(); ++it) {
186 std::vector<std::string>
v = (*it)->getNames();
188 for (std::vector<std::string>::iterator
in = v.begin();
189 in!= v.end();
in++) {
191 std::auto_ptr<edm::PCaloHitContainer>
193 (*it)->fillHits(*product,*
in);
198 for(Producers::iterator itProd =
m_producers.begin();
201 (*itProd)->produce(e,es);
206 edm::LogInfo(
"SimG4CoreApplication") <<
" SimG4Exception caght !"
214 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(
220 <<
"The OscarProducer module requires the RandomNumberGeneratorService\n"
221 "which is not present in the configuration file. You must add the service\n"
222 "in the configuration file if you want to run OscarProducer";
224 m_currentEngine = &(rng->
getEngine(streamID));
226 m_previousEngine = CLHEP::HepRandom::getTheEngine();
227 CLHEP::HepRandom::setTheEngine(m_currentEngine);
230 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(
231 CLHEP::HepRandomEngine * engine)
233 m_currentEngine = engine;
234 m_previousEngine = CLHEP::HepRandom::getTheEngine();
235 CLHEP::HepRandom::setTheEngine(m_currentEngine);
238 StaticRandomEngineSetUnset::~StaticRandomEngineSetUnset()
240 CLHEP::HepRandom::setTheEngine(m_previousEngine);
243 CLHEP::HepRandomEngine* StaticRandomEngineSetUnset::getEngine()
const
245 return m_currentEngine;
T getParameter(std::string const &) const
std::unique_ptr< RunManager > m_runManager
std::vector< PCaloHit > PCaloHitContainer
virtual void endRun(const edm::Run &r, const edm::EventSetup &c) override
OscarProducer(edm::ParameterSet const &p)
#define DEFINE_FWK_MODULE(type)
virtual void beginRun(const edm::Run &r, const edm::EventSetup &c) override
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
static const std::string kGEANT
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
static const std::string kCLHEPRandomEngine
virtual const char * what() const
void load(edm::SimTrackContainer &c) const
std::vector< SimVertex > SimVertexContainer
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
StreamID streamID() const
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer
std::unique_ptr< CustomUIsession > m_UIsession