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::EDConsumerBase 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 (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 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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::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");
96 
97  //m_runManager = RunManager::init(p);
98  m_runManager = new RunManager(p);
99 
100  //register any products
101  m_producers= m_runManager->producers();
102 
103  for(Producers::iterator itProd = m_producers.begin();
104  itProd != m_producers.end();
105  ++itProd) {
106  (*itProd)->registerProducts(*this);
107  }
108 
109  //UIsession manager for message handling
111 
112 }
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 114 of file OscarProducer.cc.

References m_runManager, and m_UIsession.

115 {
116  //this is causing a seg fault when an exception occurs while constructing
117  // an HcalSD. Need to check for memory problems.
118  if (m_runManager!=0) delete m_runManager;
119  if (m_UIsession!=0) delete m_UIsession;
120 
121 }
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 129 of file OscarProducer.cc.

References m_engine, and random.

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

Reimplemented from edm::EDProducer.

Definition at line 123 of file OscarProducer.cc.

References RunManager::initG4(), and m_runManager.

124 {
125  m_runManager->initG4(es);
126 }
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 134 of file OscarProducer.cc.

134 { }
void OscarProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 136 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(), findQualityFiles::v, and SimG4Exception::what().

137 {
138  StaticRandomEngineSetUnset random(m_engine);
139 
140  std::vector<SensitiveTkDetector*>& sTk = m_runManager->sensTkDetectors();
141  std::vector<SensitiveCaloDetector*>& sCalo = m_runManager->sensCaloDetectors();
142 
143  try
144  {
145  m_runManager->produce(e,es);
146 
147  std::auto_ptr<edm::SimTrackContainer> p1(new edm::SimTrackContainer);
148  std::auto_ptr<edm::SimVertexContainer> p2(new edm::SimVertexContainer);
149  G4SimEvent * evt = m_runManager->simEvent();
150  evt->load(*p1);
151  evt->load(*p2);
152 
153  e.put(p1);
154  e.put(p2);
155 
156  for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin(); it != sTk.end(); it++)
157  {
158  std::vector<std::string> v = (*it)->getNames();
159  for (std::vector<std::string>::iterator in = v.begin(); in!= v.end(); in++)
160  {
161  std::auto_ptr<edm::PSimHitContainer> product(new edm::PSimHitContainer);
162  (*it)->fillHits(*product,*in);
163  e.put(product,*in);
164  }
165  }
166  for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin(); it != sCalo.end(); it++)
167  {
168  std::vector<std::string> v = (*it)->getNames();
169  for (std::vector<std::string>::iterator in = v.begin(); in!= v.end(); in++)
170  {
171  std::auto_ptr<edm::PCaloHitContainer> product(new edm::PCaloHitContainer);
172  (*it)->fillHits(*product,*in);
173  e.put(product,*in);
174  }
175  }
176 
177  for(Producers::iterator itProd = m_producers.begin();
178  itProd != m_producers.end();
179  ++itProd) {
180  (*itProd)->produce(e,es);
181  }
182  }
183  catch ( const SimG4Exception& simg4ex )
184  {
185 
186  edm::LogInfo("SimG4CoreApplication") << " SimG4Exception caght !" << simg4ex.what() << std::endl ;
187 
190  }
191 }
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
Definition: RunManager.h:72
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:71
void abortEvent()
Definition: RunManager.cc:375
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
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:70
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer
void produce(edm::Event &inpevt, const edm::EventSetup &es)
Definition: RunManager.cc:299

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