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 
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
Producers m_producers
OscarMTProducer::~OscarMTProducer ( )
override

Definition at line 132 of file OscarMTProducer.cc.

133 { }

Member Function Documentation

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

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

Definition at line 167 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(), mixOne_simraw_on_sim_cfi::tracker, findQualityFiles::v, and SimG4Exception::what().

168 {
169  StaticRandomEngineSetUnset random(e.streamID());
170  LogDebug("SimG4CoreApplication")
171  << "Produce event " << e.id() << " stream " << e.streamID()
172  << " rand= " << G4UniformRand();
173 
174  std::vector<SensitiveTkDetector*>& sTk =
175  m_runManagerWorker->sensTkDetectors();
176  std::vector<SensitiveCaloDetector*>& sCalo =
177  m_runManagerWorker->sensCaloDetectors();
178 
179  try { m_runManagerWorker->produce(e, es, globalCache()->runManagerMaster()); }
180  catch ( const SimG4Exception& simg4ex ) {
181 
182  edm::LogWarning("SimG4CoreApplication") << "SimG4Exception caght! "
183  << simg4ex.what();
184 
186  << "SimG4CoreApplication exception in generation of event "
187  << e.id() << " in stream " << e.streamID() << " \n"
188  << simg4ex.what();
189  }
190 
191  std::unique_ptr<edm::SimTrackContainer>
193  std::unique_ptr<edm::SimVertexContainer>
195  G4SimEvent * evt = m_runManagerWorker->simEvent();
196  evt->load(*p1);
197  evt->load(*p2);
198 
199  e.put(std::move(p1));
200  e.put(std::move(p2));
201 
202  for (auto & tracker : sTk) {
203 
204  const std::vector<std::string>& v = tracker->getNames();
205  for (auto & name : v) {
206 
207  std::unique_ptr<edm::PSimHitContainer>
208  product(new edm::PSimHitContainer);
209  tracker->fillHits(*product,name);
210  e.put(std::move(product),name);
211  }
212  }
213  for (auto & calo : sCalo) {
214 
215  const std::vector<std::string>& v = calo->getNames();
216 
217  for (auto & name : v) {
218 
219  std::unique_ptr<edm::PCaloHitContainer>
220  product(new edm::PCaloHitContainer);
221  calo->fillHits(*product,name);
222  e.put(std::move(product),name);
223  }
224  }
225 
226  for(auto & prod : m_producers) {
227  prod.get()->produce(e,es);
228  }
229  LogDebug("SimG4CoreApplication")
230  << "Event is produced " << e.id() << " stream " << e.streamID()
231  << " rand= " << G4UniformRand();
232 }
#define LogDebug(id)
std::vector< PCaloHit > PCaloHitContainer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
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:55
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:95
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.