#include <OscarProducer.h>
Public Types | |
typedef std::vector < boost::shared_ptr < SimProducer > > | Producers |
Public Member Functions | |
virtual void | beginJob () |
virtual void | beginRun (const edm::Run &r, const edm::EventSetup &c) override |
virtual void | endJob () |
OscarProducer (edm::ParameterSet const &p) | |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) override |
virtual | ~OscarProducer () |
Protected Attributes | |
Producers | m_producers |
RunManager * | m_runManager |
CustomUIsession * | m_UIsession |
Private Attributes | |
CLHEP::HepRandomEngine * | m_engine |
Definition at line 20 of file OscarProducer.h.
typedef std::vector<boost::shared_ptr<SimProducer> > OscarProducer::Producers |
Definition at line 23 of file OscarProducer.h.
OscarProducer::OscarProducer | ( | edm::ParameterSet const & | p | ) | [explicit] |
Definition at line 50 of file OscarProducer.cc.
References m_engine, m_producers, m_runManager, m_UIsession, and random.
{ StaticRandomEngineSetUnset random; m_engine = random.getEngine(); produces<edm::SimTrackContainer>().setBranchAlias("SimTracks"); produces<edm::SimVertexContainer>().setBranchAlias("SimVertices"); produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelLowTof"); produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelHighTof"); produces<edm::PSimHitContainer>("TrackerHitsTIBLowTof"); produces<edm::PSimHitContainer>("TrackerHitsTIBHighTof"); produces<edm::PSimHitContainer>("TrackerHitsTIDLowTof"); produces<edm::PSimHitContainer>("TrackerHitsTIDHighTof"); produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapLowTof"); produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapHighTof"); produces<edm::PSimHitContainer>("TrackerHitsTOBLowTof"); produces<edm::PSimHitContainer>("TrackerHitsTOBHighTof"); produces<edm::PSimHitContainer>("TrackerHitsTECLowTof"); produces<edm::PSimHitContainer>("TrackerHitsTECHighTof"); produces<edm::PSimHitContainer>("TotemHitsT1"); produces<edm::PSimHitContainer>("TotemHitsT2Gem"); produces<edm::PSimHitContainer>("TotemHitsRP"); produces<edm::PSimHitContainer>("FP420SI"); produces<edm::PSimHitContainer>("BSCHits"); produces<edm::PSimHitContainer>("PLTHits"); produces<edm::PCaloHitContainer>("EcalHitsEB"); produces<edm::PCaloHitContainer>("EcalHitsEE"); produces<edm::PCaloHitContainer>("EcalHitsES"); produces<edm::PCaloHitContainer>("HcalHits"); produces<edm::PCaloHitContainer>("CaloHitsTk"); produces<edm::PSimHitContainer>("MuonDTHits"); produces<edm::PSimHitContainer>("MuonCSCHits"); produces<edm::PSimHitContainer>("MuonRPCHits"); produces<edm::PSimHitContainer>("MuonGEMHits"); produces<edm::PCaloHitContainer>("CastorPL"); produces<edm::PCaloHitContainer>("CastorFI"); produces<edm::PCaloHitContainer>("CastorBU"); produces<edm::PCaloHitContainer>("CastorTU"); produces<edm::PCaloHitContainer>("EcalTBH4BeamHits"); produces<edm::PCaloHitContainer>("HcalTB06BeamHits"); produces<edm::PCaloHitContainer>("ZDCHITS"); produces<edm::PCaloHitContainer>("ChamberHits"); produces<edm::PCaloHitContainer>("FibreHits"); produces<edm::PCaloHitContainer>("WedgeHits"); //m_runManager = RunManager::init(p); m_runManager = new RunManager(p); //register any products m_producers= m_runManager->producers(); for(Producers::iterator itProd = m_producers.begin(); itProd != m_producers.end(); ++itProd) { (*itProd)->registerProducts(*this); } //UIsession manager for message handling m_UIsession = new CustomUIsession(); }
OscarProducer::~OscarProducer | ( | ) | [virtual] |
Definition at line 114 of file OscarProducer.cc.
References m_runManager, and m_UIsession.
{ //this is causing a seg fault when an exception occurs while constructing // an HcalSD. Need to check for memory problems. if (m_runManager!=0) delete m_runManager; if (m_UIsession!=0) delete m_UIsession; }
void OscarProducer::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 129 of file OscarProducer.cc.
void OscarProducer::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [override, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 123 of file OscarProducer.cc.
References RunManager::initG4(), and m_runManager.
{ m_runManager->initG4(es); }
void OscarProducer::endJob | ( | void | ) | [virtual] |
void OscarProducer::produce | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [override, virtual] |
Implements edm::EDProducer.
Definition at line 136 of file OscarProducer.cc.
References RunManager::abortEvent(), edm::errors::EventCorruption, Exception, recoMuon::in, G4SimEvent::load(), m_engine, m_producers, m_runManager, p1, p2, RunManager::produce(), edm::Event::put(), random, RunManager::sensCaloDetectors(), RunManager::sensTkDetectors(), RunManager::simEvent(), findQualityFiles::v, and SimG4Exception::what().
{ StaticRandomEngineSetUnset random(m_engine); std::vector<SensitiveTkDetector*>& sTk = m_runManager->sensTkDetectors(); std::vector<SensitiveCaloDetector*>& sCalo = m_runManager->sensCaloDetectors(); try { m_runManager->produce(e,es); std::auto_ptr<edm::SimTrackContainer> p1(new edm::SimTrackContainer); std::auto_ptr<edm::SimVertexContainer> p2(new edm::SimVertexContainer); G4SimEvent * evt = m_runManager->simEvent(); evt->load(*p1); evt->load(*p2); e.put(p1); e.put(p2); for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin(); it != sTk.end(); it++) { std::vector<std::string> v = (*it)->getNames(); for (std::vector<std::string>::iterator in = v.begin(); in!= v.end(); in++) { std::auto_ptr<edm::PSimHitContainer> product(new edm::PSimHitContainer); (*it)->fillHits(*product,*in); e.put(product,*in); } } for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin(); it != sCalo.end(); it++) { std::vector<std::string> v = (*it)->getNames(); for (std::vector<std::string>::iterator in = v.begin(); in!= v.end(); in++) { std::auto_ptr<edm::PCaloHitContainer> product(new edm::PCaloHitContainer); (*it)->fillHits(*product,*in); e.put(product,*in); } } for(Producers::iterator itProd = m_producers.begin(); itProd != m_producers.end(); ++itProd) { (*itProd)->produce(e,es); } } catch ( const SimG4Exception& simg4ex ) { edm::LogInfo("SimG4CoreApplication") << " SimG4Exception caght !" << simg4ex.what() << std::endl ; m_runManager->abortEvent() ; throw edm::Exception( edm::errors::EventCorruption ) ; } }
CLHEP::HepRandomEngine* OscarProducer::m_engine [private] |
Definition at line 37 of file OscarProducer.h.
Referenced by beginJob(), OscarProducer(), and produce().
Producers OscarProducer::m_producers [protected] |
Definition at line 33 of file OscarProducer.h.
Referenced by OscarProducer(), and produce().
RunManager* OscarProducer::m_runManager [protected] |
Definition at line 32 of file OscarProducer.h.
Referenced by beginRun(), OscarProducer(), produce(), and ~OscarProducer().
CustomUIsession* OscarProducer::m_UIsession [protected] |
Definition at line 34 of file OscarProducer.h.
Referenced by OscarProducer(), and ~OscarProducer().