21 #include "CLHEP/Random/Random.h"
38 class StaticRandomEngineSetUnset {
40 StaticRandomEngineSetUnset();
41 explicit StaticRandomEngineSetUnset(CLHEP::HepRandomEngine * engine);
42 ~StaticRandomEngineSetUnset();
43 CLHEP::HepRandomEngine* getEngine()
const;
45 CLHEP::HepRandomEngine* m_currentEngine;
46 CLHEP::HepRandomEngine* m_previousEngine;
52 StaticRandomEngineSetUnset
random;
55 produces<edm::SimTrackContainer>().setBranchAlias(
"SimTracks");
56 produces<edm::SimVertexContainer>().setBranchAlias(
"SimVertices");
57 produces<edm::PSimHitContainer>(
"TrackerHitsPixelBarrelLowTof");
58 produces<edm::PSimHitContainer>(
"TrackerHitsPixelBarrelHighTof");
59 produces<edm::PSimHitContainer>(
"TrackerHitsTIBLowTof");
60 produces<edm::PSimHitContainer>(
"TrackerHitsTIBHighTof");
61 produces<edm::PSimHitContainer>(
"TrackerHitsTIDLowTof");
62 produces<edm::PSimHitContainer>(
"TrackerHitsTIDHighTof");
63 produces<edm::PSimHitContainer>(
"TrackerHitsPixelEndcapLowTof");
64 produces<edm::PSimHitContainer>(
"TrackerHitsPixelEndcapHighTof");
65 produces<edm::PSimHitContainer>(
"TrackerHitsTOBLowTof");
66 produces<edm::PSimHitContainer>(
"TrackerHitsTOBHighTof");
67 produces<edm::PSimHitContainer>(
"TrackerHitsTECLowTof");
68 produces<edm::PSimHitContainer>(
"TrackerHitsTECHighTof");
70 produces<edm::PSimHitContainer>(
"TotemHitsT1");
71 produces<edm::PSimHitContainer>(
"TotemHitsT2Gem");
72 produces<edm::PSimHitContainer>(
"TotemHitsRP");
73 produces<edm::PSimHitContainer>(
"FP420SI");
74 produces<edm::PSimHitContainer>(
"BSCHits");
75 produces<edm::PSimHitContainer>(
"PLTHits");
77 produces<edm::PCaloHitContainer>(
"EcalHitsEB");
78 produces<edm::PCaloHitContainer>(
"EcalHitsEE");
79 produces<edm::PCaloHitContainer>(
"EcalHitsES");
80 produces<edm::PCaloHitContainer>(
"HcalHits");
81 produces<edm::PCaloHitContainer>(
"CaloHitsTk");
82 produces<edm::PSimHitContainer>(
"MuonDTHits");
83 produces<edm::PSimHitContainer>(
"MuonCSCHits");
84 produces<edm::PSimHitContainer>(
"MuonRPCHits");
85 produces<edm::PSimHitContainer>(
"MuonGEMHits");
86 produces<edm::PCaloHitContainer>(
"CastorPL");
87 produces<edm::PCaloHitContainer>(
"CastorFI");
88 produces<edm::PCaloHitContainer>(
"CastorBU");
89 produces<edm::PCaloHitContainer>(
"CastorTU");
90 produces<edm::PCaloHitContainer>(
"EcalTBH4BeamHits");
91 produces<edm::PCaloHitContainer>(
"HcalTB06BeamHits");
92 produces<edm::PCaloHitContainer>(
"ZDCHITS");
93 produces<edm::PCaloHitContainer>(
"ChamberHits");
94 produces<edm::PCaloHitContainer>(
"FibreHits");
95 produces<edm::PCaloHitContainer>(
"WedgeHits");
103 for(Producers::iterator itProd =
m_producers.begin();
106 (*itProd)->registerProducts(*
this);
156 for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin(); it != sTk.end(); it++)
158 std::vector<std::string>
v = (*it)->getNames();
159 for (std::vector<std::string>::iterator
in = v.begin();
in!= v.end();
in++)
162 (*it)->fillHits(*product,*
in);
166 for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin(); it != sCalo.end(); it++)
168 std::vector<std::string>
v = (*it)->getNames();
169 for (std::vector<std::string>::iterator
in = v.begin();
in!= v.end();
in++)
172 (*it)->fillHits(*product,*
in);
177 for(Producers::iterator itProd =
m_producers.begin();
180 (*itProd)->produce(e,es);
186 edm::LogInfo(
"SimG4CoreApplication") <<
" SimG4Exception caght !" << simg4ex.
what() << std::endl ;
194 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset() {
199 if ( ! rng.isAvailable()) {
201 <<
"The OscarProducer module requires the RandomNumberGeneratorService\n"
202 "which is not present in the configuration file. You must add the service\n"
203 "in the configuration file if you want to run OscarProducer";
205 m_currentEngine = &(rng->getEngine());
207 m_previousEngine = CLHEP::HepRandom::getTheEngine();
208 CLHEP::HepRandom::setTheEngine(m_currentEngine);
211 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(CLHEP::HepRandomEngine * engine) {
213 m_currentEngine = engine;
215 m_previousEngine = CLHEP::HepRandom::getTheEngine();
216 CLHEP::HepRandom::setTheEngine(m_currentEngine);
219 StaticRandomEngineSetUnset::~StaticRandomEngineSetUnset() {
220 CLHEP::HepRandom::setTheEngine(m_previousEngine);
223 CLHEP::HepRandomEngine*
224 StaticRandomEngineSetUnset::getEngine()
const {
return m_currentEngine; }
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
std::vector< PCaloHit > PCaloHitContainer
CLHEP::HepRandomEngine * m_engine
OscarProducer(edm::ParameterSet const &p)
#define DEFINE_FWK_MODULE(type)
std::vector< SensitiveTkDetector * > & sensTkDetectors()
virtual void beginRun(const edm::Run &r, const edm::EventSetup &c) override
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
virtual const char * what() const
RunManager * m_runManager
void load(edm::SimTrackContainer &c) const
CustomUIsession * m_UIsession
std::vector< SimVertex > SimVertexContainer
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer
void initG4(const edm::EventSetup &es)
void produce(edm::Event &inpevt, const edm::EventSetup &es)