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 | 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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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)
 
 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 ()
 

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
< OscarMTMasterThread
initializeGlobalCache (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
< RunManagerMTWorker
m_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 20 of file OscarMTProducer.h.

Member Typedef Documentation

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

Definition at line 26 of file OscarMTProducer.h.

Constructor & Destructor Documentation

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

Definition at line 65 of file OscarMTProducer.cc.

References edm::EDConsumerBase::consumesCollector(), m_producers, m_runManagerWorker, and random.

66 {
67  // Random number generation not allowed here
68  StaticRandomEngineSetUnset random(nullptr);
69 
71 
72  produces<edm::SimTrackContainer>().setBranchAlias("SimTracks");
73  produces<edm::SimVertexContainer>().setBranchAlias("SimVertices");
74  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelLowTof");
75  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelHighTof");
76  produces<edm::PSimHitContainer>("TrackerHitsTIBLowTof");
77  produces<edm::PSimHitContainer>("TrackerHitsTIBHighTof");
78  produces<edm::PSimHitContainer>("TrackerHitsTIDLowTof");
79  produces<edm::PSimHitContainer>("TrackerHitsTIDHighTof");
80  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapLowTof");
81  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapHighTof");
82  produces<edm::PSimHitContainer>("TrackerHitsTOBLowTof");
83  produces<edm::PSimHitContainer>("TrackerHitsTOBHighTof");
84  produces<edm::PSimHitContainer>("TrackerHitsTECLowTof");
85  produces<edm::PSimHitContainer>("TrackerHitsTECHighTof");
86 
87  produces<edm::PSimHitContainer>("TotemHitsT1");
88  produces<edm::PSimHitContainer>("TotemHitsT2Gem");
89  produces<edm::PSimHitContainer>("TotemHitsRP");
90  produces<edm::PSimHitContainer>("FP420SI");
91  produces<edm::PSimHitContainer>("BSCHits");
92  produces<edm::PSimHitContainer>("PLTHits");
93  produces<edm::PSimHitContainer>("BCM1FHits");
94 
95  produces<edm::PCaloHitContainer>("EcalHitsEB");
96  produces<edm::PCaloHitContainer>("EcalHitsEE");
97  produces<edm::PCaloHitContainer>("EcalHitsES");
98  produces<edm::PCaloHitContainer>("HcalHits");
99  produces<edm::PCaloHitContainer>("CaloHitsTk");
100  produces<edm::PSimHitContainer>("MuonDTHits");
101  produces<edm::PSimHitContainer>("MuonCSCHits");
102  produces<edm::PSimHitContainer>("MuonRPCHits");
103  produces<edm::PSimHitContainer>("MuonGEMHits");
104  produces<edm::PSimHitContainer>("MuonME0Hits");
105  produces<edm::PCaloHitContainer>("CastorPL");
106  produces<edm::PCaloHitContainer>("CastorFI");
107  produces<edm::PCaloHitContainer>("CastorBU");
108  produces<edm::PCaloHitContainer>("CastorTU");
109  produces<edm::PCaloHitContainer>("EcalTBH4BeamHits");
110  produces<edm::PCaloHitContainer>("HcalTB06BeamHits");
111  produces<edm::PCaloHitContainer>("ZDCHITS");
112  produces<edm::PCaloHitContainer>("ChamberHits");
113  produces<edm::PCaloHitContainer>("FibreHits");
114  produces<edm::PCaloHitContainer>("WedgeHits");
115 
116  //register any products
117  m_producers = m_runManagerWorker->producers();
118 
119  for(Producers::iterator itProd = m_producers.begin();
120  itProd != m_producers.end(); ++itProd) {
121 
122  (*itProd)->registerProducts(*this);
123  }
124 }
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 126 of file OscarMTProducer.cc.

127 { }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 154 of file OscarMTProducer.cc.

References m_runManagerWorker, and random.

155 {
156  // Random number generation not allowed here
157  StaticRandomEngineSetUnset random(nullptr);
158  m_runManagerWorker->endRun();
159 }
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 136 of file OscarMTProducer.cc.

References OscarMTMasterThread::beginRun(), and random.

136  {
137  // Random number generation not allowed here
138  StaticRandomEngineSetUnset random(nullptr);
139 
140  masterThread->beginRun(iSetup);
141 
142  return std::shared_ptr<int>();
143 }
TRandom random
Definition: MVATrainer.cc:138
void beginRun(const edm::EventSetup &iSetup) const
void OscarMTProducer::globalEndJob ( OscarMTMasterThread masterThread)
static

Definition at line 149 of file OscarMTProducer.cc.

References OscarMTMasterThread::stopThread().

149  {
150  masterThread->stopThread();
151 }
void OscarMTProducer::globalEndRun ( const edm::Run iRun,
const edm::EventSetup iSetup,
const RunContext iContext 
)
static

Definition at line 145 of file OscarMTProducer.cc.

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

145  {
146  iContext->global()->endRun();
147 }
std::unique_ptr< OscarMTMasterThread > OscarMTProducer::initializeGlobalCache ( const edm::ParameterSet iConfig)
static

Definition at line 129 of file OscarMTProducer.cc.

References random.

129  {
130  // Random number generation not allowed here
131  StaticRandomEngineSetUnset random(nullptr);
132 
133  return std::unique_ptr<OscarMTMasterThread>(new OscarMTMasterThread(iConfig));
134 }
TRandom random
Definition: MVATrainer.cc:138
void OscarMTProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 161 of file OscarMTProducer.cc.

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

162 {
163  StaticRandomEngineSetUnset random(e.streamID());
164 
165  std::vector<SensitiveTkDetector*>& sTk =
166  m_runManagerWorker->sensTkDetectors();
167  std::vector<SensitiveCaloDetector*>& sCalo =
168  m_runManagerWorker->sensCaloDetectors();
169 
170  try {
171  m_runManagerWorker->produce(e, es, globalCache()->runManagerMaster());
172 
173  std::auto_ptr<edm::SimTrackContainer>
175  std::auto_ptr<edm::SimVertexContainer>
177  G4SimEvent * evt = m_runManagerWorker->simEvent();
178  evt->load(*p1);
179  evt->load(*p2);
180 
181  e.put(p1);
182  e.put(p2);
183 
184  for (std::vector<SensitiveTkDetector*>::iterator it = sTk.begin();
185  it != sTk.end(); ++it) {
186 
187  std::vector<std::string> v = (*it)->getNames();
188  for (std::vector<std::string>::iterator in = v.begin();
189  in!= v.end(); ++in) {
190 
191  std::auto_ptr<edm::PSimHitContainer>
192  product(new edm::PSimHitContainer);
193  (*it)->fillHits(*product,*in);
194  e.put(product,*in);
195  }
196  }
197  for (std::vector<SensitiveCaloDetector*>::iterator it = sCalo.begin();
198  it != sCalo.end(); ++it) {
199 
200  std::vector<std::string> v = (*it)->getNames();
201 
202  for (std::vector<std::string>::iterator in = v.begin();
203  in!= v.end(); in++) {
204 
205  std::auto_ptr<edm::PCaloHitContainer>
206  product(new edm::PCaloHitContainer);
207  (*it)->fillHits(*product,*in);
208  e.put(product,*in);
209  }
210  }
211 
212  for(Producers::iterator itProd = m_producers.begin();
213  itProd != m_producers.end(); ++itProd) {
214 
215  (*itProd)->produce(e,es);
216  }
217  } catch ( const SimG4Exception& simg4ex ) {
218 
219  edm::LogInfo("SimG4CoreApplication") << " SimG4Exception caght !"
220  << simg4ex.what();
221 
222  m_runManagerWorker->abortEvent();
224  }
225 
226 }
std::vector< PCaloHit > PCaloHitContainer
std::unique_ptr< RunManagerMTWorker > m_runManagerWorker
TRandom random
Definition: MVATrainer.cc:138
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
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
double p1[4]
Definition: TauolaWrapper.h:89
StreamID streamID() const
Definition: Event.h:74
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer

Member Data Documentation

Producers OscarMTProducer::m_producers
private

Definition at line 41 of file OscarMTProducer.h.

Referenced by OscarMTProducer(), and produce().

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

Definition at line 42 of file OscarMTProducer.h.

Referenced by endRun(), OscarMTProducer(), and produce().