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 | Private Attributes
OscarProducer Class Reference

#include <OscarProducer.h>

Inheritance diagram for OscarProducer:
edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector
< std::shared_ptr< SimProducer > > 
Producers
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

virtual void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 
virtual void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
 OscarProducer (edm::ParameterSet const &p)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~OscarProducer ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

Producers m_producers
 
std::unique_ptr< RunManagerm_runManager
 
std::unique_ptr< CustomUIsessionm_UIsession
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 18 of file OscarProducer.h.

Member Typedef Documentation

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

Definition at line 21 of file OscarProducer.h.

Constructor & Destructor Documentation

OscarProducer::OscarProducer ( edm::ParameterSet const &  p)
explicit

Definition at line 61 of file OscarProducer.cc.

References edm::ParameterSet::getParameter(), edm::SharedResourceNames::kCLHEPRandomEngine, edm::SharedResourceNames::kGEANT, m_producers, m_runManager, m_UIsession, and random.

62 {
63  // Random number generation not allowed here
64  StaticRandomEngineSetUnset random(nullptr);
65 
68 
69  consumes<edm::HepMCProduct>(p.getParameter<edm::InputTag>("HepMCProductLabel"));
70  m_runManager.reset(new RunManager(p));
71  //m_runManager.reset(new RunManager(p, consumesCollector()));
72 
73  produces<edm::SimTrackContainer>().setBranchAlias("SimTracks");
74  produces<edm::SimVertexContainer>().setBranchAlias("SimVertices");
75  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelLowTof");
76  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelHighTof");
77  produces<edm::PSimHitContainer>("TrackerHitsTIBLowTof");
78  produces<edm::PSimHitContainer>("TrackerHitsTIBHighTof");
79  produces<edm::PSimHitContainer>("TrackerHitsTIDLowTof");
80  produces<edm::PSimHitContainer>("TrackerHitsTIDHighTof");
81  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapLowTof");
82  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapHighTof");
83  produces<edm::PSimHitContainer>("TrackerHitsTOBLowTof");
84  produces<edm::PSimHitContainer>("TrackerHitsTOBHighTof");
85  produces<edm::PSimHitContainer>("TrackerHitsTECLowTof");
86  produces<edm::PSimHitContainer>("TrackerHitsTECHighTof");
87 
88  produces<edm::PSimHitContainer>("TotemHitsT1");
89  produces<edm::PSimHitContainer>("TotemHitsT2Gem");
90  produces<edm::PSimHitContainer>("TotemHitsRP");
91  produces<edm::PSimHitContainer>("FP420SI");
92  produces<edm::PSimHitContainer>("BSCHits");
93  produces<edm::PSimHitContainer>("PLTHits");
94  produces<edm::PSimHitContainer>("BCM1FHits");
95  produces<edm::PSimHitContainer>("BHMHits");
96  produces<edm::PSimHitContainer>("FastTimerHits");
97 
98  produces<edm::PCaloHitContainer>("EcalHitsEB");
99  produces<edm::PCaloHitContainer>("EcalHitsEE");
100  produces<edm::PCaloHitContainer>("EcalHitsES");
101  produces<edm::PCaloHitContainer>("HcalHits");
102  produces<edm::PCaloHitContainer>("CaloHitsTk");
103  produces<edm::PCaloHitContainer>("HGCHitsEE");
104  produces<edm::PCaloHitContainer>("HGCHitsHEfront");
105  produces<edm::PCaloHitContainer>("HGCHitsHEback");
106 
107  produces<edm::PSimHitContainer>("MuonDTHits");
108  produces<edm::PSimHitContainer>("MuonCSCHits");
109  produces<edm::PSimHitContainer>("MuonRPCHits");
110  produces<edm::PSimHitContainer>("MuonGEMHits");
111  produces<edm::PSimHitContainer>("MuonME0Hits");
112 
113  produces<edm::PCaloHitContainer>("CastorPL");
114  produces<edm::PCaloHitContainer>("CastorFI");
115  produces<edm::PCaloHitContainer>("CastorBU");
116  produces<edm::PCaloHitContainer>("CastorTU");
117  produces<edm::PCaloHitContainer>("EcalTBH4BeamHits");
118  produces<edm::PCaloHitContainer>("HcalTB06BeamHits");
119  produces<edm::PCaloHitContainer>("ZDCHITS");
120  produces<edm::PCaloHitContainer>("ChamberHits");
121  produces<edm::PCaloHitContainer>("FibreHits");
122  produces<edm::PCaloHitContainer>("WedgeHits");
123 
124  //register any products
125  m_producers = m_runManager->producers();
126 
127  for(Producers::iterator itProd = m_producers.begin();
128  itProd != m_producers.end(); ++itProd) {
129 
130  (*itProd)->registerProducts(*this);
131  }
132 
133  //UIsession manager for message handling
134  m_UIsession.reset(new CustomUIsession());
135 }
Producers m_producers
Definition: OscarProducer.h:31
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:30
TRandom random
Definition: MVATrainer.cc:138
static const std::string kGEANT
static const std::string kCLHEPRandomEngine
std::unique_ptr< CustomUIsession > m_UIsession
Definition: OscarProducer.h:32
OscarProducer::~OscarProducer ( )
virtual

Definition at line 137 of file OscarProducer.cc.

138 { }

Member Function Documentation

void OscarProducer::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Definition at line 141 of file OscarProducer.cc.

References m_runManager, and random.

142 {
143  // Random number generation not allowed here
144  StaticRandomEngineSetUnset random(nullptr);
145  m_runManager->initG4(es);
146 }
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:30
TRandom random
Definition: MVATrainer.cc:138
void OscarProducer::endRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Definition at line 149 of file OscarProducer.cc.

References m_runManager.

150 {
151  m_runManager->stopG4();
152 }
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:30
void OscarProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDProducerBase.

Definition at line 154 of file OscarProducer.cc.

References edm::errors::EventCorruption, Exception, recoMuon::in, G4SimEvent::load(), m_producers, m_runManager, p1, p2, edm::Event::put(), random, edm::Event::streamID(), findQualityFiles::v, and SimG4Exception::what().

155 {
156  StaticRandomEngineSetUnset random(e.streamID());
157 
158  std::vector<SensitiveTkDetector*>& sTk =
159  m_runManager->sensTkDetectors();
160  std::vector<SensitiveCaloDetector*>& sCalo =
161  m_runManager->sensCaloDetectors();
162 
163  try {
164 
165  m_runManager->produce(e, es);
166 
167  std::auto_ptr<edm::SimTrackContainer>
169  std::auto_ptr<edm::SimVertexContainer>
171  G4SimEvent * evt = m_runManager->simEvent();
172  evt->load(*p1);
173  evt->load(*p2);
174 
175  e.put(p1);
176  e.put(p2);
177 
178  for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin();
179  it != sTk.end(); ++it) {
180 
181  std::vector<std::string> v = (*it)->getNames();
182  for (std::vector<std::string>::iterator in = v.begin();
183  in!= v.end(); ++in) {
184 
185  std::auto_ptr<edm::PSimHitContainer>
186  product(new edm::PSimHitContainer);
187  (*it)->fillHits(*product,*in);
188  e.put(product,*in);
189  }
190  }
191  for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin();
192  it != sCalo.end(); ++it) {
193 
194  std::vector<std::string> v = (*it)->getNames();
195 
196  for (std::vector<std::string>::iterator in = v.begin();
197  in!= v.end(); in++) {
198 
199  std::auto_ptr<edm::PCaloHitContainer>
200  product(new edm::PCaloHitContainer);
201  (*it)->fillHits(*product,*in);
202  e.put(product,*in);
203  }
204  }
205 
206  for(Producers::iterator itProd = m_producers.begin();
207  itProd != m_producers.end(); ++itProd) {
208 
209  (*itProd)->produce(e,es);
210  }
211 
212  } catch ( const SimG4Exception& simg4ex ) {
213 
214  edm::LogInfo("SimG4CoreApplication") << " SimG4Exception caght !"
215  << simg4ex.what();
216 
217  m_runManager->abortEvent();
219  }
220 }
Producers m_producers
Definition: OscarProducer.h:31
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:30
std::vector< PCaloHit > PCaloHitContainer
TRandom random
Definition: MVATrainer.cc:138
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
virtual const char * what() const
double p2[4]
Definition: TauolaWrapper.h:90
void load(edm::SimTrackContainer &c) const
Definition: G4SimEvent.cc:55
std::vector< SimVertex > SimVertexContainer
double p1[4]
Definition: TauolaWrapper.h:89
StreamID streamID() const
Definition: Event.h:79
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer

Member Data Documentation

Producers OscarProducer::m_producers
private

Definition at line 31 of file OscarProducer.h.

Referenced by OscarProducer(), and produce().

std::unique_ptr<RunManager> OscarProducer::m_runManager
private

Definition at line 30 of file OscarProducer.h.

Referenced by beginRun(), endRun(), OscarProducer(), and produce().

std::unique_ptr<CustomUIsession> OscarProducer::m_UIsession
private

Definition at line 32 of file OscarProducer.h.

Referenced by OscarProducer().