CMS 3D CMS Logo

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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 
void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
 OscarProducer (edm::ParameterSet const &p)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~OscarProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 16 of file OscarProducer.h.

Member Typedef Documentation

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

Definition at line 19 of file OscarProducer.h.

Constructor & Destructor Documentation

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

Definition at line 62 of file OscarProducer.cc.

References g4SimHits_cfi::CustomUIsession, edm::ParameterSet::getParameter(), edm::SharedResourceNames::kCLHEPRandomEngine, edm::SharedResourceNames::kGEANT, and random.

63 {
64  // Random number generation not allowed here
65  StaticRandomEngineSetUnset random(nullptr);
66 
69 
70  consumes<edm::HepMCProduct>(p.getParameter<edm::InputTag>("HepMCProductLabel"));
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>("FastTimerHitsBarrel");
97  produces<edm::PSimHitContainer>("FastTimerHitsEndcap");
98 
99  produces<edm::PCaloHitContainer>("EcalHitsEB");
100  produces<edm::PCaloHitContainer>("EcalHitsEE");
101  produces<edm::PCaloHitContainer>("EcalHitsES");
102  produces<edm::PCaloHitContainer>("HcalHits");
103  produces<edm::PCaloHitContainer>("CaloHitsTk");
104  produces<edm::PCaloHitContainer>("HGCHitsEE");
105  produces<edm::PCaloHitContainer>("HGCHitsHEfront");
106  produces<edm::PCaloHitContainer>("HGCHitsHEback");
107 
108  produces<edm::PSimHitContainer>("MuonDTHits");
109  produces<edm::PSimHitContainer>("MuonCSCHits");
110  produces<edm::PSimHitContainer>("MuonRPCHits");
111  produces<edm::PSimHitContainer>("MuonGEMHits");
112  produces<edm::PSimHitContainer>("MuonME0Hits");
113 
114  produces<edm::PCaloHitContainer>("CastorPL");
115  produces<edm::PCaloHitContainer>("CastorFI");
116  produces<edm::PCaloHitContainer>("CastorBU");
117  produces<edm::PCaloHitContainer>("CastorTU");
118  produces<edm::PCaloHitContainer>("EcalTBH4BeamHits");
119  produces<edm::PCaloHitContainer>("HcalTB06BeamHits");
120  produces<edm::PCaloHitContainer>("ZDCHITS");
121  produces<edm::PCaloHitContainer>("ChamberHits");
122  produces<edm::PCaloHitContainer>("FibreHits");
123  produces<edm::PCaloHitContainer>("WedgeHits");
124  produces<edm::PCaloHitContainer>("HFNoseHits");
125 
126  //register any products
127  m_producers = m_runManager->producers();
128 
129  for(Producers::iterator itProd = m_producers.begin();
130  itProd != m_producers.end(); ++itProd) {
131 
132  (*itProd)->registerProducts(*this);
133  }
134 
135  //UIsession manager for message handling
136  m_UIsession.reset(new CustomUIsession());
137 }
Producers m_producers
Definition: OscarProducer.h:29
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:28
TRandom random
Definition: MVATrainer.cc:138
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static const std::string kGEANT
static const std::string kCLHEPRandomEngine
std::unique_ptr< CustomUIsession > m_UIsession
Definition: OscarProducer.h:30
OscarProducer::~OscarProducer ( )
override

Definition at line 139 of file OscarProducer.cc.

140 { }

Member Function Documentation

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

Definition at line 143 of file OscarProducer.cc.

References random.

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

Definition at line 151 of file OscarProducer.cc.

152 {
153  m_runManager->stopG4();
154 }
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:28
void OscarProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 156 of file OscarProducer.cc.

References DEFINE_FWK_MODULE, edm::errors::EventCorruption, Exception, edm::RandomNumberGenerator::getEngine(), edm::EventBase::id(), edm::Service< T >::isAvailable(), G4SimEvent::load(), eostools::move(), dataset::name, p1, p2, parseEventContent::prod, edm::Event::put(), random, edm::Event::streamID(), trackingTruthProducer_cfi::tracker, findQualityFiles::v, and SimG4Exception::what().

157 {
158  StaticRandomEngineSetUnset random(e.streamID());
159 
160  auto& sTk =
161  m_runManager->sensTkDetectors();
162  auto& sCalo =
163  m_runManager->sensCaloDetectors();
164 
165  try { m_runManager->produce(e, es); }
166  catch ( const SimG4Exception& simg4ex ) {
167 
168  edm::LogInfo("SimG4CoreApplication") << "SimG4Exception caght! "
169  << simg4ex.what();
170  m_runManager->stopG4();
171 
173  << "SimG4CoreApplication exception in generation of event "
174  << e.id() << " in stream " << e.streamID() << " \n"
175  << simg4ex.what();
176  }
177 
178  std::unique_ptr<edm::SimTrackContainer>
180  std::unique_ptr<edm::SimVertexContainer>
182  G4SimEvent * evt = m_runManager->simEvent();
183  evt->load(*p1);
184  evt->load(*p2);
185 
186  e.put(std::move(p1));
187  e.put(std::move(p2));
188 
189  for (auto & tracker : sTk) {
190 
191  const std::vector<std::string>& v = tracker->getNames();
192  for (auto & name : v) {
193 
194  std::unique_ptr<edm::PSimHitContainer>
195  product(new edm::PSimHitContainer);
196  tracker->fillHits(*product,name);
197  e.put(std::move(product),name);
198  }
199  }
200  for (auto & calo : sCalo) {
201 
202  const std::vector<std::string>& v = calo->getNames();
203 
204  for (auto & name : v) {
205 
206  std::unique_ptr<edm::PCaloHitContainer>
207  product(new edm::PCaloHitContainer);
208  calo->fillHits(*product,name);
209  e.put(std::move(product),name);
210  }
211  }
212 
213  for(auto & prod : m_producers) {
214  prod.get()->produce(e,es);
215  }
216 }
Producers m_producers
Definition: OscarProducer.h:29
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:28
std::vector< PCaloHit > PCaloHitContainer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
TRandom random
Definition: MVATrainer.cc:138
const char * what() const override
double p2[4]
Definition: TauolaWrapper.h:90
void load(edm::SimTrackContainer &c) const
Definition: G4SimEvent.cc:37
std::vector< SimVertex > SimVertexContainer
edm::EventID id() const
Definition: EventBase.h:59
double p1[4]
Definition: TauolaWrapper.h:89
StreamID streamID() const
Definition: Event.h:95
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

Producers OscarProducer::m_producers
private

Definition at line 29 of file OscarProducer.h.

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

Definition at line 28 of file OscarProducer.h.

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

Definition at line 30 of file OscarProducer.h.