CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Attributes | Private Attributes
OscarProducer Class Reference

#include <OscarProducer.h>

Inheritance diagram for OscarProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Types

typedef std::vector
< boost::shared_ptr
< SimProducer > > 
Producers
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

virtual void beginJob ()
 
virtual void beginRun (edm::Run &r, const edm::EventSetup &c)
 
virtual void endJob ()
 
 OscarProducer (edm::ParameterSet const &p)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~OscarProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Protected Attributes

Producers m_producers
 
RunManagerm_runManager
 
CustomUIsessionm_UIsession
 

Private Attributes

CLHEP::HepRandomEngine * m_engine
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 20 of file OscarProducer.h.

Member Typedef Documentation

typedef std::vector<boost::shared_ptr<SimProducer> > OscarProducer::Producers

Definition at line 23 of file OscarProducer.h.

Constructor & Destructor Documentation

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.

51 {
52  StaticRandomEngineSetUnset random;
53  m_engine = random.getEngine();
54 
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");
69 
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");
76 
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");
95 
96  //m_runManager = RunManager::init(p);
97  m_runManager = new RunManager(p);
98 
99  //register any products
100  m_producers= m_runManager->producers();
101 
102  for(Producers::iterator itProd = m_producers.begin();
103  itProd != m_producers.end();
104  ++itProd) {
105  (*itProd)->registerProducts(*this);
106  }
107 
108  //UIsession manager for message handling
110 
111 }
Producers m_producers
Definition: OscarProducer.h:33
CLHEP::HepRandomEngine * m_engine
Definition: OscarProducer.h:37
TRandom random
Definition: MVATrainer.cc:138
RunManager * m_runManager
Definition: OscarProducer.h:32
CustomUIsession * m_UIsession
Definition: OscarProducer.h:34
OscarProducer::~OscarProducer ( )
virtual

Definition at line 113 of file OscarProducer.cc.

References m_runManager, and m_UIsession.

114 {
115  //this is causing a seg fault when an exception occurs while constructing
116  // an HcalSD. Need to check for memory problems.
117  if (m_runManager!=0) delete m_runManager;
118  if (m_UIsession!=0) delete m_UIsession;
119 
120 }
RunManager * m_runManager
Definition: OscarProducer.h:32
CustomUIsession * m_UIsession
Definition: OscarProducer.h:34

Member Function Documentation

void OscarProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 128 of file OscarProducer.cc.

References m_engine, and random.

129 {
130  StaticRandomEngineSetUnset random(m_engine);
131 }
CLHEP::HepRandomEngine * m_engine
Definition: OscarProducer.h:37
TRandom random
Definition: MVATrainer.cc:138
void OscarProducer::beginRun ( edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 122 of file OscarProducer.cc.

References RunManager::initG4(), and m_runManager.

123 {
124  m_runManager->initG4(es);
125 }
RunManager * m_runManager
Definition: OscarProducer.h:32
void initG4(const edm::EventSetup &es)
Definition: RunManager.cc:167
void OscarProducer::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 133 of file OscarProducer.cc.

133 { }
void OscarProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 135 of file OscarProducer.cc.

References RunManager::abortEvent(), edm::errors::EventCorruption, edm::hlt::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(), v, and SimG4Exception::what().

136 {
137  StaticRandomEngineSetUnset random(m_engine);
138 
139  std::vector<SensitiveTkDetector*>& sTk = m_runManager->sensTkDetectors();
140  std::vector<SensitiveCaloDetector*>& sCalo = m_runManager->sensCaloDetectors();
141 
142  try
143  {
144  m_runManager->produce(e,es);
145 
146  std::auto_ptr<edm::SimTrackContainer> p1(new edm::SimTrackContainer);
147  std::auto_ptr<edm::SimVertexContainer> p2(new edm::SimVertexContainer);
148  G4SimEvent * evt = m_runManager->simEvent();
149  evt->load(*p1);
150  evt->load(*p2);
151 
152  e.put(p1);
153  e.put(p2);
154 
155  for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin(); it != sTk.end(); it++)
156  {
157  std::vector<std::string> v = (*it)->getNames();
158  for (std::vector<std::string>::iterator in = v.begin(); in!= v.end(); in++)
159  {
160  std::auto_ptr<edm::PSimHitContainer> product(new edm::PSimHitContainer);
161  (*it)->fillHits(*product,*in);
162  e.put(product,*in);
163  }
164  }
165  for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin(); it != sCalo.end(); it++)
166  {
167  std::vector<std::string> v = (*it)->getNames();
168  for (std::vector<std::string>::iterator in = v.begin(); in!= v.end(); in++)
169  {
170  std::auto_ptr<edm::PCaloHitContainer> product(new edm::PCaloHitContainer);
171  (*it)->fillHits(*product,*in);
172  e.put(product,*in);
173  }
174  }
175 
176  for(Producers::iterator itProd = m_producers.begin();
177  itProd != m_producers.end();
178  ++itProd) {
179  (*itProd)->produce(e,es);
180  }
181  }
182  catch ( const SimG4Exception& simg4ex )
183  {
184 
185  edm::LogInfo("SimG4CoreApplication") << " SimG4Exception caght !" << simg4ex.what() << std::endl ;
186 
189  }
190 }
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
Definition: RunManager.h:71
Producers m_producers
Definition: OscarProducer.h:33
std::vector< PCaloHit > PCaloHitContainer
CLHEP::HepRandomEngine * m_engine
Definition: OscarProducer.h:37
TRandom random
Definition: MVATrainer.cc:138
std::vector< SensitiveTkDetector * > & sensTkDetectors()
Definition: RunManager.h:70
void abortEvent()
Definition: RunManager.cc:361
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
virtual const char * what() const
double p2[4]
Definition: TauolaWrapper.h:90
RunManager * m_runManager
Definition: OscarProducer.h:32
void load(edm::SimTrackContainer &c) const
Definition: G4SimEvent.cc:55
std::vector< SimVertex > SimVertexContainer
double p1[4]
Definition: TauolaWrapper.h:89
G4SimEvent * simEvent()
Definition: RunManager.h:69
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer
mathSSE::Vec4< T > v
void produce(edm::Event &inpevt, const edm::EventSetup &es)
Definition: RunManager.cc:285

Member Data Documentation

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().