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 > >

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 Member Functions

void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
 OscarMTProducer (edm::ParameterSet const &p, const OscarMTMasterThread *)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~OscarMTProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< OscarMTMasterThread >, edm::RunCache< int > >
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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)
 

Private Attributes

Producers m_producers
 
std::unique_ptr< RunManagerMTWorkerm_runManagerWorker
 

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 
69  m_runManagerWorker.reset(new RunManagerMTWorker(p, consumesCollector()));
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  produces<edm::PCaloHitContainer>("HFNoseHits");
122 
123  //register any products
124  m_producers = m_runManagerWorker->producers();
125 
126  for(Producers::iterator itProd = m_producers.begin();
127  itProd != m_producers.end(); ++itProd) {
128 
129  (*itProd)->registerProducts(*this);
130  }
131 }
std::unique_ptr< RunManagerMTWorker > m_runManagerWorker
TRandom random
Definition: MVATrainer.cc:138
Producers m_producers
OscarMTProducer::~OscarMTProducer ( )
override

Definition at line 133 of file OscarMTProducer.cc.

134 { }

Member Function Documentation

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

Definition at line 161 of file OscarMTProducer.cc.

References random.

162 {
163  // Random number generation not allowed here
164  StaticRandomEngineSetUnset random(nullptr);
165  m_runManagerWorker->endRun();
166 }
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 143 of file OscarMTProducer.cc.

References OscarMTMasterThread::beginRun(), and random.

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

Definition at line 156 of file OscarMTProducer.cc.

References OscarMTMasterThread::stopThread().

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

Definition at line 152 of file OscarMTProducer.cc.

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

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

Definition at line 136 of file OscarMTProducer.cc.

References random.

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

Definition at line 168 of file OscarMTProducer.cc.

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

169 {
170  StaticRandomEngineSetUnset random(e.streamID());
171  LogDebug("SimG4CoreApplication")
172  << "Produce event " << e.id() << " stream " << e.streamID()
173  << " rand= " << G4UniformRand();
174 
175  std::vector<SensitiveTkDetector*>& sTk =
176  m_runManagerWorker->sensTkDetectors();
177  std::vector<SensitiveCaloDetector*>& sCalo =
178  m_runManagerWorker->sensCaloDetectors();
179 
180  try { m_runManagerWorker->produce(e, es, globalCache()->runManagerMaster()); }
181  catch ( const SimG4Exception& simg4ex ) {
182 
183  edm::LogWarning("SimG4CoreApplication") << "SimG4Exception caght! "
184  << simg4ex.what();
185 
187  << "SimG4CoreApplication exception in generation of event "
188  << e.id() << " in stream " << e.streamID() << " \n"
189  << simg4ex.what();
190  }
191 
192  std::unique_ptr<edm::SimTrackContainer>
194  std::unique_ptr<edm::SimVertexContainer>
196  G4SimEvent * evt = m_runManagerWorker->simEvent();
197  evt->load(*p1);
198  evt->load(*p2);
199 
200  e.put(std::move(p1));
201  e.put(std::move(p2));
202 
203  for (auto & tracker : sTk) {
204 
205  const std::vector<std::string>& v = tracker->getNames();
206  for (auto & name : v) {
207 
208  std::unique_ptr<edm::PSimHitContainer>
209  product(new edm::PSimHitContainer);
210  tracker->fillHits(*product,name);
211  e.put(std::move(product),name);
212  }
213  }
214  for (auto & calo : sCalo) {
215 
216  const std::vector<std::string>& v = calo->getNames();
217 
218  for (auto & name : v) {
219 
220  std::unique_ptr<edm::PCaloHitContainer>
221  product(new edm::PCaloHitContainer);
222  calo->fillHits(*product,name);
223  e.put(std::move(product),name);
224  }
225  }
226 
227  for(auto & prod : m_producers) {
228  prod.get()->produce(e,es);
229  }
230  LogDebug("SimG4CoreApplication")
231  << "Event is produced " << e.id() << " stream " << e.streamID()
232  << " rand= " << G4UniformRand();
233 }
#define LogDebug(id)
std::vector< PCaloHit > PCaloHitContainer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::unique_ptr< RunManagerMTWorker > m_runManagerWorker
TRandom random
Definition: MVATrainer.cc:138
const char * what() const override
Producers m_producers
double p2[4]
Definition: TauolaWrapper.h:90
void load(edm::SimTrackContainer &c) const
Definition: G4SimEvent.cc:40
std::vector< SimVertex > SimVertexContainer
edm::EventID id() const
Definition: EventBase.h:60
double p1[4]
Definition: TauolaWrapper.h:89
StreamID streamID() const
Definition: Event.h:96
std::vector< PSimHit > PSimHitContainer
std::vector< SimTrack > SimTrackContainer
def move(src, dest)
Definition: eostools.py:511

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.