CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
OscarMTProducer Class Reference

#include <OscarMTProducer.h>

Inheritance diagram for OscarMTProducer:
edm::stream::EDProducer< edm::GlobalCache< OscarMTMasterThread >, edm::RunCache< int > > edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< std::shared_ptr< SimProducer > > Producers
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< OscarMTMasterThread >, edm::RunCache< int > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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 endRun (const edm::Run &r, const edm::EventSetup &c) override
 
 OscarMTProducer (edm::ParameterSet const &p, const OscarMTMasterThread *)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~OscarMTProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< OscarMTMasterThread >, edm::RunCache< int > >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static std::shared_ptr< int > globalBeginRun (const edm::Run &iRun, const edm::EventSetup &iSetup, const OscarMTMasterThread *masterThread)
 
static void globalEndJob (OscarMTMasterThread *masterThread)
 
static void globalEndRun (const edm::Run &iRun, const edm::EventSetup &iSetup, const RunContext *iContext)
 
static std::unique_ptr< OscarMTMasterThreadinitializeGlobalCache (const edm::ParameterSet &iConfig)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

Producers m_producers
 
std::unique_ptr< RunManagerMTWorkerm_runManagerWorker
 

Additional Inherited Members

- 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 OscarMTProducer.h.

Member Typedef Documentation

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

Definition at line 24 of file OscarMTProducer.h.

Constructor & Destructor Documentation

OscarMTProducer::OscarMTProducer ( edm::ParameterSet const &  p,
const OscarMTMasterThread  
)
explicit

Definition at line 64 of file OscarMTProducer.cc.

References random.

65 {
66  // Random number generation not allowed here
67  StaticRandomEngineSetUnset random(nullptr);
68 
70 
71  produces<edm::SimTrackContainer>().setBranchAlias("SimTracks");
72  produces<edm::SimVertexContainer>().setBranchAlias("SimVertices");
73  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelLowTof");
74  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelHighTof");
75  produces<edm::PSimHitContainer>("TrackerHitsTIBLowTof");
76  produces<edm::PSimHitContainer>("TrackerHitsTIBHighTof");
77  produces<edm::PSimHitContainer>("TrackerHitsTIDLowTof");
78  produces<edm::PSimHitContainer>("TrackerHitsTIDHighTof");
79  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapLowTof");
80  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapHighTof");
81  produces<edm::PSimHitContainer>("TrackerHitsTOBLowTof");
82  produces<edm::PSimHitContainer>("TrackerHitsTOBHighTof");
83  produces<edm::PSimHitContainer>("TrackerHitsTECLowTof");
84  produces<edm::PSimHitContainer>("TrackerHitsTECHighTof");
85 
86  produces<edm::PSimHitContainer>("TotemHitsT1");
87  produces<edm::PSimHitContainer>("TotemHitsT2Gem");
88  produces<edm::PSimHitContainer>("TotemHitsRP");
89  produces<edm::PSimHitContainer>("FP420SI");
90  produces<edm::PSimHitContainer>("BSCHits");
91  produces<edm::PSimHitContainer>("PLTHits");
92  produces<edm::PSimHitContainer>("BCM1FHits");
93  produces<edm::PSimHitContainer>("BHMHits");
94  produces<edm::PSimHitContainer>("FastTimerHitsBarrel");
95  produces<edm::PSimHitContainer>("FastTimerHitsEndcap");
96 
97  produces<edm::PCaloHitContainer>("EcalHitsEB");
98  produces<edm::PCaloHitContainer>("EcalHitsEE");
99  produces<edm::PCaloHitContainer>("EcalHitsES");
100  produces<edm::PCaloHitContainer>("HcalHits");
101  produces<edm::PCaloHitContainer>("CaloHitsTk");
102  produces<edm::PCaloHitContainer>("HGCHitsEE");
103  produces<edm::PCaloHitContainer>("HGCHitsHEfront");
104  produces<edm::PCaloHitContainer>("HGCHitsHEback");
105 
106  produces<edm::PSimHitContainer>("MuonDTHits");
107  produces<edm::PSimHitContainer>("MuonCSCHits");
108  produces<edm::PSimHitContainer>("MuonRPCHits");
109  produces<edm::PSimHitContainer>("MuonGEMHits");
110  produces<edm::PSimHitContainer>("MuonME0Hits");
111  produces<edm::PCaloHitContainer>("CastorPL");
112  produces<edm::PCaloHitContainer>("CastorFI");
113  produces<edm::PCaloHitContainer>("CastorBU");
114  produces<edm::PCaloHitContainer>("CastorTU");
115  produces<edm::PCaloHitContainer>("EcalTBH4BeamHits");
116  produces<edm::PCaloHitContainer>("HcalTB06BeamHits");
117  produces<edm::PCaloHitContainer>("ZDCHITS");
118  produces<edm::PCaloHitContainer>("ChamberHits");
119  produces<edm::PCaloHitContainer>("FibreHits");
120  produces<edm::PCaloHitContainer>("WedgeHits");
121 
122  //register any products
123  m_producers = m_runManagerWorker->producers();
124 
125  for(Producers::iterator itProd = m_producers.begin();
126  itProd != m_producers.end(); ++itProd) {
127 
128  (*itProd)->registerProducts(*this);
129  }
130 }
std::unique_ptr< RunManagerMTWorker > m_runManagerWorker
TRandom random
Definition: MVATrainer.cc:138
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Producers m_producers
OscarMTProducer::~OscarMTProducer ( )
virtual

Definition at line 132 of file OscarMTProducer.cc.

133 { }

Member Function Documentation

void OscarMTProducer::endRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Definition at line 160 of file OscarMTProducer.cc.

References random.

161 {
162  // Random number generation not allowed here
163  StaticRandomEngineSetUnset random(nullptr);
164  m_runManagerWorker->endRun();
165 }
std::unique_ptr< RunManagerMTWorker > m_runManagerWorker
TRandom random
Definition: MVATrainer.cc:138
std::shared_ptr< int > OscarMTProducer::globalBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup,
const OscarMTMasterThread masterThread 
)
static

Definition at line 142 of file OscarMTProducer.cc.

References OscarMTMasterThread::beginRun(), and random.

142  {
143  // Random number generation not allowed here
144  StaticRandomEngineSetUnset random(nullptr);
145 
146  masterThread->beginRun(iSetup);
147 
148  return std::shared_ptr<int>();
149 }
TRandom random
Definition: MVATrainer.cc:138
void beginRun(const edm::EventSetup &iSetup) const
void OscarMTProducer::globalEndJob ( OscarMTMasterThread masterThread)
static

Definition at line 155 of file OscarMTProducer.cc.

References OscarMTMasterThread::stopThread().

155  {
156  masterThread->stopThread();
157 }
void OscarMTProducer::globalEndRun ( const edm::Run iRun,
const edm::EventSetup iSetup,
const RunContext iContext 
)
static

Definition at line 151 of file OscarMTProducer.cc.

References edm::stream::RunContextT< R, G >::global().

151  {
152  iContext->global()->endRun();
153 }
std::unique_ptr< OscarMTMasterThread > OscarMTProducer::initializeGlobalCache ( const edm::ParameterSet iConfig)
static

Definition at line 135 of file OscarMTProducer.cc.

References random.

135  {
136  // Random number generation not allowed here
137  StaticRandomEngineSetUnset random(nullptr);
138 
139  return std::unique_ptr<OscarMTMasterThread>(new OscarMTMasterThread(iConfig));
140 }
TRandom random
Definition: MVATrainer.cc:138
void OscarMTProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Definition at line 167 of file OscarMTProducer.cc.

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

168 {
169  StaticRandomEngineSetUnset random(e.streamID());
170 
171  std::vector<SensitiveTkDetector*>& sTk =
172  m_runManagerWorker->sensTkDetectors();
173  std::vector<SensitiveCaloDetector*>& sCalo =
174  m_runManagerWorker->sensCaloDetectors();
175 
176  try {
177  m_runManagerWorker->produce(e, es, globalCache()->runManagerMaster());
178 
179  std::unique_ptr<edm::SimTrackContainer>
181  std::unique_ptr<edm::SimVertexContainer>
183  G4SimEvent * evt = m_runManagerWorker->simEvent();
184  evt->load(*p1);
185  evt->load(*p2);
186 
187  e.put(std::move(p1));
188  e.put(std::move(p2));
189 
190  for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin();
191  it != sTk.end(); ++it) {
192 
193  std::vector<std::string> v = (*it)->getNames();
194  for (std::vector<std::string>::iterator in = v.begin();
195  in!= v.end(); ++in) {
196 
197  std::unique_ptr<edm::PSimHitContainer>
198  product(new edm::PSimHitContainer);
199  (*it)->fillHits(*product,*in);
200  e.put(std::move(product),*in);
201  }
202  }
203  for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin();
204  it != sCalo.end(); ++it) {
205 
206  std::vector<std::string> v = (*it)->getNames();
207 
208  for (std::vector<std::string>::iterator in = v.begin();
209  in!= v.end(); in++) {
210 
211  std::unique_ptr<edm::PCaloHitContainer>
212  product(new edm::PCaloHitContainer);
213  (*it)->fillHits(*product,*in);
214  e.put(std::move(product),*in);
215  }
216  }
217 
218  for(Producers::iterator itProd = m_producers.begin();
219  itProd != m_producers.end(); ++itProd) {
220 
221  (*itProd)->produce(e,es);
222  }
223  } catch ( const SimG4Exception& simg4ex ) {
224 
225  edm::LogInfo("SimG4CoreApplication") << "SimG4Exception caght! "
226  << simg4ex.what();
227 
229  << "SimG4CoreApplication exception in generation of event "
230  << e.id() << " in stream " << e.streamID() << " \n"
231  << simg4ex.what();
232  }
233 }
std::vector< PCaloHit > PCaloHitContainer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::unique_ptr< RunManagerMTWorker > m_runManagerWorker
TRandom random
Definition: MVATrainer.cc:138
Producers m_producers
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
edm::EventID id() const
Definition: EventBase.h:58
double p1[4]
Definition: TauolaWrapper.h:89
StreamID streamID() const
Definition: Event.h:81
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

Producers OscarMTProducer::m_producers
private

Definition at line 38 of file OscarMTProducer.h.

std::unique_ptr<RunManagerMTWorker> OscarMTProducer::m_runManagerWorker
private

Definition at line 39 of file OscarMTProducer.h.