23 #include "Randomize.hh"
52 class StaticRandomEngineSetUnset {
55 explicit StaticRandomEngineSetUnset(CLHEP::HepRandomEngine* engine);
56 ~StaticRandomEngineSetUnset();
59 CLHEP::HepRandomEngine* m_currentEngine;
60 CLHEP::HepRandomEngine* m_previousEngine;
66 StaticRandomEngineSetUnset random(
nullptr);
71 consumes<edm::HepMCProduct>(
p.getParameter<
edm::InputTag>(
"HepMCProductLabel"));
74 produces<edm::SimTrackContainer>().setBranchAlias(
"SimTracks");
75 produces<edm::SimVertexContainer>().setBranchAlias(
"SimVertices");
76 produces<edm::PSimHitContainer>(
"TrackerHitsPixelBarrelLowTof");
77 produces<edm::PSimHitContainer>(
"TrackerHitsPixelBarrelHighTof");
78 produces<edm::PSimHitContainer>(
"TrackerHitsTIBLowTof");
79 produces<edm::PSimHitContainer>(
"TrackerHitsTIBHighTof");
80 produces<edm::PSimHitContainer>(
"TrackerHitsTIDLowTof");
81 produces<edm::PSimHitContainer>(
"TrackerHitsTIDHighTof");
82 produces<edm::PSimHitContainer>(
"TrackerHitsPixelEndcapLowTof");
83 produces<edm::PSimHitContainer>(
"TrackerHitsPixelEndcapHighTof");
84 produces<edm::PSimHitContainer>(
"TrackerHitsTOBLowTof");
85 produces<edm::PSimHitContainer>(
"TrackerHitsTOBHighTof");
86 produces<edm::PSimHitContainer>(
"TrackerHitsTECLowTof");
87 produces<edm::PSimHitContainer>(
"TrackerHitsTECHighTof");
89 produces<edm::PSimHitContainer>(
"TotemHitsT1");
90 produces<edm::PSimHitContainer>(
"TotemHitsT2Gem");
91 produces<edm::PSimHitContainer>(
"TotemHitsRP");
92 produces<edm::PSimHitContainer>(
"CTPPSPixelHits");
93 produces<edm::PSimHitContainer>(
"CTPPSTimingHits");
94 produces<edm::PSimHitContainer>(
"FP420SI");
95 produces<edm::PSimHitContainer>(
"BSCHits");
96 produces<edm::PSimHitContainer>(
"PLTHits");
97 produces<edm::PSimHitContainer>(
"BCM1FHits");
98 produces<edm::PSimHitContainer>(
"BHMHits");
99 produces<edm::PSimHitContainer>(
"FastTimerHitsBarrel");
100 produces<edm::PSimHitContainer>(
"FastTimerHitsEndcap");
102 produces<edm::PCaloHitContainer>(
"EcalHitsEB");
103 produces<edm::PCaloHitContainer>(
"EcalHitsEE");
104 produces<edm::PCaloHitContainer>(
"EcalHitsES");
105 produces<edm::PCaloHitContainer>(
"HcalHits");
106 produces<edm::PCaloHitContainer>(
"CaloHitsTk");
107 produces<edm::PCaloHitContainer>(
"HGCHitsEE");
108 produces<edm::PCaloHitContainer>(
"HGCHitsHEfront");
109 produces<edm::PCaloHitContainer>(
"HGCHitsHEback");
111 produces<edm::PSimHitContainer>(
"MuonDTHits");
112 produces<edm::PSimHitContainer>(
"MuonCSCHits");
113 produces<edm::PSimHitContainer>(
"MuonRPCHits");
114 produces<edm::PSimHitContainer>(
"MuonGEMHits");
115 produces<edm::PSimHitContainer>(
"MuonME0Hits");
117 produces<edm::PCaloHitContainer>(
"CastorPL");
118 produces<edm::PCaloHitContainer>(
"CastorFI");
119 produces<edm::PCaloHitContainer>(
"CastorBU");
120 produces<edm::PCaloHitContainer>(
"CastorTU");
121 produces<edm::PCaloHitContainer>(
"EcalTBH4BeamHits");
122 produces<edm::PCaloHitContainer>(
"HcalTB06BeamHits");
123 produces<edm::PCaloHitContainer>(
"ZDCHITS");
124 produces<edm::PCaloHitContainer>(
"ChamberHits");
125 produces<edm::PCaloHitContainer>(
"FibreHits");
126 produces<edm::PCaloHitContainer>(
"WedgeHits");
127 produces<edm::PCaloHitContainer>(
"HFNoseHits");
128 produces<edm::PCaloHitContainer>(
"TotemHitsT2Scint");
145 StaticRandomEngineSetUnset random(
nullptr);
152 StaticRandomEngineSetUnset random(
e.streamID());
160 edm::LogInfo(
"SimG4CoreApplication") <<
"SimG4Exception caght! " << simg4ex.
what();
164 <<
"SimG4CoreApplication exception in generation of event " <<
e.id() <<
" in stream " <<
e.streamID() <<
" \n"
178 const std::vector<std::string>&
v =
tracker->getNames();
179 for (
auto&
name :
v) {
185 for (
auto&
calo : sCalo) {
186 const std::vector<std::string>&
v =
calo->getNames();
188 for (
auto&
name :
v) {
196 prod.get()->produce(
e, es);
200 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(
edm::StreamID const& streamID) {
204 <<
"The OscarProducer module requires the RandomNumberGeneratorService\n"
205 "which is not present in the configuration file. You must add the service\n"
206 "in the configuration file if you want to run OscarProducer";
208 m_currentEngine = &(rng->
getEngine(streamID));
214 m_previousEngine = G4Random::getTheEngine();
215 G4Random::setTheEngine(m_currentEngine);
218 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(CLHEP::HepRandomEngine* engine) {
219 m_currentEngine = engine;
220 m_previousEngine = G4Random::getTheEngine();
221 G4Random::setTheEngine(m_currentEngine);
224 StaticRandomEngineSetUnset::~StaticRandomEngineSetUnset() { G4Random::setTheEngine(m_previousEngine); }