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::PCaloHitContainer>(
"CastorPL");
86 produces<edm::PCaloHitContainer>(
"CastorFI");
87 produces<edm::PCaloHitContainer>(
"CastorBU");
88 produces<edm::PCaloHitContainer>(
"CastorTU");
89 produces<edm::PCaloHitContainer>(
"EcalTBH4BeamHits");
90 produces<edm::PCaloHitContainer>(
"HcalTB06BeamHits");
91 produces<edm::PCaloHitContainer>(
"ZDCHITS");
92 produces<edm::PCaloHitContainer>(
"ChamberHits");
93 produces<edm::PCaloHitContainer>(
"FibreHits");
94 produces<edm::PCaloHitContainer>(
"WedgeHits");
102 for(Producers::iterator itProd =
m_producers.begin();
105 (*itProd)->registerProducts(*
this);
155 for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin(); it != sTk.end(); it++)
157 std::vector<std::string>
v = (*it)->getNames();
158 for (std::vector<std::string>::iterator
in = v.begin();
in!= v.end();
in++)
161 (*it)->fillHits(*product,*
in);
165 for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin(); it != sCalo.end(); it++)
167 std::vector<std::string>
v = (*it)->getNames();
168 for (std::vector<std::string>::iterator
in = v.begin();
in!= v.end();
in++)
171 (*it)->fillHits(*product,*
in);
176 for(Producers::iterator itProd =
m_producers.begin();
179 (*itProd)->produce(e,es);
185 edm::LogInfo(
"SimG4CoreApplication") <<
" SimG4Exception caght !" << simg4ex.
what() << std::endl ;
193 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset() {
198 if ( ! rng.isAvailable()) {
200 <<
"The OscarProducer module requires the RandomNumberGeneratorService\n"
201 "which is not present in the configuration file. You must add the service\n"
202 "in the configuration file if you want to run OscarProducer";
204 m_currentEngine = &(rng->getEngine());
206 m_previousEngine = CLHEP::HepRandom::getTheEngine();
207 CLHEP::HepRandom::setTheEngine(m_currentEngine);
210 StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(CLHEP::HepRandomEngine * engine) {
212 m_currentEngine = engine;
214 m_previousEngine = CLHEP::HepRandom::getTheEngine();
215 CLHEP::HepRandom::setTheEngine(m_currentEngine);
218 StaticRandomEngineSetUnset::~StaticRandomEngineSetUnset() {
219 CLHEP::HepRandom::setTheEngine(m_previousEngine);
222 CLHEP::HepRandomEngine*
223 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(edm::Run &r, const edm::EventSetup &c)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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)
virtual void produce(edm::Event &e, const edm::EventSetup &c)
void produce(edm::Event &inpevt, const edm::EventSetup &es)