26 #include "Randomize.hh"
53 class StaticRandomEngineSetUnset {
56 explicit StaticRandomEngineSetUnset(CLHEP::HepRandomEngine* engine);
57 ~StaticRandomEngineSetUnset();
60 CLHEP::HepRandomEngine* m_currentEngine;
61 CLHEP::HepRandomEngine* m_previousEngine;
67 StaticRandomEngineSetUnset random(
nullptr);
71 produces<edm::SimTrackContainer>().setBranchAlias(
"SimTracks");
72 produces<edm::SimVertexContainer>().setBranchAlias(
"SimVertices");
73 produces<edm::PSimHitContainer>(
"TrackerHitsPixelBarrelLowTof");
74 produces<edm::PSimHitContainer>(
"TrackerHitsPixelBarrelHighTof");
75 produces<edm::PSimHitContainer>(
"TrackerHitsTIBLowTof");
76 produces<edm::PSimHitContainer>(
"TrackerHitsTIBHighTof");
77 produces<edm::PSimHitContainer>(
"TrackerHitsTIDLowTof");
78 produces<edm::PSimHitContainer>(
"TrackerHitsTIDHighTof");
79 produces<edm::PSimHitContainer>(
"TrackerHitsPixelEndcapLowTof");
80 produces<edm::PSimHitContainer>(
"TrackerHitsPixelEndcapHighTof");
81 produces<edm::PSimHitContainer>(
"TrackerHitsTOBLowTof");
82 produces<edm::PSimHitContainer>(
"TrackerHitsTOBHighTof");
83 produces<edm::PSimHitContainer>(
"TrackerHitsTECLowTof");
84 produces<edm::PSimHitContainer>(
"TrackerHitsTECHighTof");
86 produces<edm::PSimHitContainer>(
"TotemHitsT1");
87 produces<edm::PSimHitContainer>(
"TotemHitsT2Gem");
88 produces<edm::PSimHitContainer>(
"TotemHitsRP");
89 produces<edm::PSimHitContainer>(
"CTPPSPixelHits");
90 produces<edm::PSimHitContainer>(
"CTPPSTimingHits");
91 produces<edm::PSimHitContainer>(
"FP420SI");
92 produces<edm::PSimHitContainer>(
"BSCHits");
93 produces<edm::PSimHitContainer>(
"PLTHits");
94 produces<edm::PSimHitContainer>(
"BCM1FHits");
95 produces<edm::PSimHitContainer>(
"BHMHits");
96 produces<edm::PSimHitContainer>(
"FastTimerHitsBarrel");
97 produces<edm::PSimHitContainer>(
"FastTimerHitsEndcap");
99 produces<edm::PCaloHitContainer>(
"EcalHitsEB");
100 produces<edm::PCaloHitContainer>(
"EcalHitsEE");
101 produces<edm::PCaloHitContainer>(
"EcalHitsES");
102 produces<edm::PCaloHitContainer>(
"HcalHits");
103 produces<edm::PCaloHitContainer>(
"CaloHitsTk");
104 produces<edm::PCaloHitContainer>(
"HGCHitsEE");
105 produces<edm::PCaloHitContainer>(
"HGCHitsHEfront");
106 produces<edm::PCaloHitContainer>(
"HGCHitsHEback");
108 produces<edm::PSimHitContainer>(
"MuonDTHits");
109 produces<edm::PSimHitContainer>(
"MuonCSCHits");
110 produces<edm::PSimHitContainer>(
"MuonRPCHits");
111 produces<edm::PSimHitContainer>(
"MuonGEMHits");
112 produces<edm::PSimHitContainer>(
"MuonME0Hits");
113 produces<edm::PCaloHitContainer>(
"CastorPL");
114 produces<edm::PCaloHitContainer>(
"CastorFI");
115 produces<edm::PCaloHitContainer>(
"CastorBU");
116 produces<edm::PCaloHitContainer>(
"CastorTU");
117 produces<edm::PCaloHitContainer>(
"EcalTBH4BeamHits");
118 produces<edm::PCaloHitContainer>(
"HcalTB06BeamHits");
119 produces<edm::PCaloHitContainer>(
"ZDCHITS");
120 produces<edm::PCaloHitContainer>(
"ChamberHits");
121 produces<edm::PCaloHitContainer>(
"FibreHits");
122 produces<edm::PCaloHitContainer>(
"WedgeHits");
123 produces<edm::PCaloHitContainer>(
"HFNoseHits");
124 produces<edm::PCaloHitContainer>(
"TotemHitsT2Scint");
129 for (Producers::iterator itProd =
producers.begin(); itProd !=
producers.end(); ++itProd) {
130 (*itProd)->registerProducts(producesCollector());
138 StaticRandomEngineSetUnset random(
nullptr);
147 StaticRandomEngineSetUnset random(
nullptr);
151 return std::shared_ptr<int>();
155 iContext->
global()->endRun();
162 StaticRandomEngineSetUnset random(
nullptr);
167 StaticRandomEngineSetUnset random(
e.streamID());
168 LogDebug(
"SimG4CoreApplication") <<
"Produce event " <<
e.id() <<
" stream " <<
e.streamID()
169 <<
" rand= " << G4UniformRand();
174 std::unique_ptr<G4SimEvent> evt;
181 <<
"SimG4CoreApplication exception in generation of event " <<
e.id() <<
" in stream " <<
e.streamID() <<
" \n"
194 const std::vector<std::string>&
v =
tracker->getNames();
195 for (
auto&
name :
v) {
201 for (
auto&
calo : sCalo) {
202 const std::vector<std::string>&
v =
calo->getNames();
204 for (
auto&
name :
v) {
213 prod.get()->produce(
e, es);
215 LogDebug(
"SimG4CoreApplication") <<
"Event is produced " <<
e.id() <<
" stream " <<
e.streamID()
216 <<
" rand= " << G4UniformRand();
219 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(
edm::StreamID const& streamID) {
223 <<
"The OscarMTProducer module requires the RandomNumberGeneratorService\n"
224 "which is not present in the configuration file. You must add the service\n"
225 "in the configuration file if you want to run OscarMTProducer";
227 m_currentEngine = &(rng->
getEngine(streamID));
229 m_previousEngine = G4Random::getTheEngine();
230 G4Random::setTheEngine(m_currentEngine);
233 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(CLHEP::HepRandomEngine* engine) {
234 m_currentEngine = engine;
235 m_previousEngine = G4Random::getTheEngine();
236 G4Random::setTheEngine(m_currentEngine);
239 StaticRandomEngineSetUnset::~StaticRandomEngineSetUnset() { G4Random::setTheEngine(m_previousEngine); }