CMS 3D CMS Logo

RunManagerMTWorker.cc
Go to the documentation of this file.
13 
21 
29 
35 
39 
42 
44 
46 
50 
51 #include "G4Event.hh"
52 #include "G4Run.hh"
53 #include "G4SystemOfUnits.hh"
54 #include "G4Threading.hh"
55 #include "G4UImanager.hh"
56 #include "G4WorkerThread.hh"
57 #include "G4WorkerRunManagerKernel.hh"
58 #include "G4StateManager.hh"
59 #include "G4TransportationManager.hh"
60 
61 #include <atomic>
62 #include <thread>
63 #include <sstream>
64 #include <vector>
65 
66 // from https://hypernews.cern.ch/HyperNews/CMS/get/edmFramework/3302/2.html
67 namespace {
68  std::atomic<int> thread_counter{ 0 };
69 
70  int get_new_thread_index() {
71  return thread_counter++;
72  }
73 
74  thread_local int s_thread_index = get_new_thread_index();
75 
76  int getThreadIndex() { return s_thread_index; }
77 
78  void createWatchers(const edm::ParameterSet& iP,
79  SimActivityRegistry* iReg,
80  std::vector<std::shared_ptr<SimWatcher> >& oWatchers,
81  std::vector<std::shared_ptr<SimProducer> >& oProds,
82  int thisThreadID
83  )
84  {
85  if(!iP.exists("Watchers")) { return; }
86 
87  std::vector<edm::ParameterSet> watchers =
88  iP.getParameter<std::vector<edm::ParameterSet> >("Watchers");
89 
90  for(auto & watcher : watchers) {
91  std::unique_ptr<SimWatcherMakerBase> maker(
92  SimWatcherFactory::get()->create(watcher.getParameter<std::string>("type"))
93  );
94  if(maker==nullptr) {
96  << "Unable to find the requested Watcher <"
97  << watcher.getParameter<std::string>("type");
98  }
99  std::shared_ptr<SimWatcher> watcherTemp;
100  std::shared_ptr<SimProducer> producerTemp;
101  maker->make(watcher,*(iReg),watcherTemp,producerTemp);
102  oWatchers.push_back(watcherTemp);
103  if(producerTemp) {
104  oProds.push_back(producerTemp);
105  }
106  }
107  }
108 
109  std::atomic<int> active_tlsdata{0};
110  std::atomic<bool> tls_shutdown_timeout{false};
111  std::atomic<int> n_tls_shutdown_task{0};
112 }
113 
115  std::unique_ptr<G4RunManagerKernel> kernel; //must be deleted last
116  std::unique_ptr<CustomUIsession> UIsession;
117  std::unique_ptr<RunAction> userRunAction;
118  std::unique_ptr<SimRunInterface> runInterface;
119  std::unique_ptr<SimActivityRegistry> registry;
120  std::unique_ptr<SimTrackManager> trackManager;
121  std::vector<SensitiveTkDetector*> sensTkDets;
122  std::vector<SensitiveCaloDetector*> sensCaloDets;
123  std::vector<std::shared_ptr<SimWatcher> > watchers;
124  std::vector<std::shared_ptr<SimProducer> > producers;
125  //G4Run can only be deleted if there is a G4RunManager
126  // on the thread where the G4Run is being deleted,
127  // else it causes a segmentation fault
128  G4Run* currentRun = nullptr;
129  std::unique_ptr<G4Event> currentEvent;
131  bool threadInitialized = false;
132  bool runTerminated = false;
133 
135  ++active_tlsdata;
136  }
137 
139  --active_tlsdata;
140  }
141 };
142 
143 //This can not be a smart pointer since we must delete some of the members
144 // before leaving main() else we get a segmentation fault caused by accessing
145 // other 'singletons' after those singletons have been deleted. Instead we
146 // atempt to delete all TLS at RunManagerMTWorker destructor. If that fails for
147 // some reason, it is better to leak than cause a crash.
149 
151  m_generator(iConfig.getParameter<edm::ParameterSet>("Generator")),
152  m_InToken(iC.consumes<edm::HepMCProduct>(iConfig.getParameter<edm::ParameterSet>("Generator").getParameter<edm::InputTag>("HepMCProductLabel"))),
153  m_theLHCTlinkToken(iC.consumes<edm::LHCTransportLinkContainer>(iConfig.getParameter<edm::InputTag>("theLHCTlinkTag"))),
154  m_nonBeam(iConfig.getParameter<bool>("NonBeamEvent")),
155  m_pUseMagneticField(iConfig.getParameter<bool>("UseMagneticField")),
156  m_EvtMgrVerbosity(iConfig.getUntrackedParameter<int>("G4EventManagerVerbosity",0)),
157  m_pField(iConfig.getParameter<edm::ParameterSet>("MagneticField")),
158  m_pRunAction(iConfig.getParameter<edm::ParameterSet>("RunAction")),
159  m_pEventAction(iConfig.getParameter<edm::ParameterSet>("EventAction")),
160  m_pStackingAction(iConfig.getParameter<edm::ParameterSet>("StackingAction")),
161  m_pTrackingAction(iConfig.getParameter<edm::ParameterSet>("TrackingAction")),
162  m_pSteppingAction(iConfig.getParameter<edm::ParameterSet>("SteppingAction")),
163  m_pCustomUIsession(iConfig.getUntrackedParameter<edm::ParameterSet>("CustomUIsession")),
164  m_p(iConfig),
167 {
168  std::vector<edm::ParameterSet> watchers =
169  iConfig.getParameter<std::vector<edm::ParameterSet> >("Watchers");
170  m_hasWatchers = (watchers.empty()) ? false : true;
171  initializeTLS();
172 }
173 
175  if(m_tls && !m_tls->runTerminated) { terminateRun(); }
176 
177  ++n_tls_shutdown_task;
178  resetTLS();
179 
180  {
181  //make sure all tasks are done before continuing
182  timespec s;
183  s.tv_sec=0;
184  s.tv_nsec=10000;
185  while(n_tls_shutdown_task != 0) { nanosleep(&s,nullptr); }
186  }
187 }
188 
190  delete m_tls;
191  m_tls=nullptr;
192 
193  if(active_tlsdata != 0 and not tls_shutdown_timeout) {
194  ++n_tls_shutdown_task;
195  //need to run tasks on each thread which has set the tls
196  auto task = edm::make_functor_task(tbb::task::allocate_root(), [] () {
197  resetTLS();
198  });
199  tbb::task::enqueue(*task);
200  timespec s;
201  s.tv_sec=0;
202  s.tv_nsec=10000;
203  //we do not want this thread to be used for a new task since it
204  // has already cleared its structures. In order to fill all TBB
205  // threads we wait for all TLSes to clear
206  int count = 0;
207  while(active_tlsdata.load() != 0 and ++count < 1000) { nanosleep(&s,nullptr);}
208  if(count >= 1000) {
209  tls_shutdown_timeout=true;
210  }
211  }
212  --n_tls_shutdown_task;
213 }
214 
216  terminateRun();
217 }
218 
220  if(m_tls) { return; }
221 
222  m_tls = new TLSData() ;
223  m_tls->registry.reset(new SimActivityRegistry());
224 
225  edm::Service<SimActivityRegistry> otherRegistry;
226  //Look for an outside SimActivityRegistry
227  // this is used by the visualization code
228  int thisID = getThreadIndex();
229  if(otherRegistry){
230  m_tls->registry->connect(*otherRegistry);
231  if(thisID > 0) {
232  throw edm::Exception(edm::errors::Configuration) << "SimActivityRegistry service (i.e. visualization) is not supported for more than 1 thread. If this use case is needed, RunManagerMTWorker has to be updated.";
233  }
234  }
235  if(m_hasWatchers) {
237  }
238 }
239 
241  // I guess everything initialized here should be in thread_local storage
242  initializeTLS();
243 
244  int thisID = getThreadIndex();
245 
246  edm::LogVerbatim("SimG4CoreApplication")
247  << "RunManagerMTWorker::initializeThread " << thisID;
248 
249  // Initialize per-thread output
250  G4Threading::G4SetThreadId( thisID );
251  G4UImanager::GetUIpointer()->SetUpForAThread( thisID );
253  if(uitype == "MessageLogger") {
254  m_tls->UIsession.reset(new CustomUIsession());
255  }
256  else if(uitype == "MessageLoggerThreadPrefix") {
258  }
259  else if(uitype == "FilePerThread") {
261  }
262  else {
264  << "Invalid value of CustomUIsession.Type '" << uitype
265  << "', valid are MessageLogger, MessageLoggerThreadPrefix, FilePerThread";
266  }
267 
268  // Initialize worker part of shared resources (geometry, physics)
269  G4WorkerThread::BuildGeometryAndPhysicsVector();
270 
271  // Create worker run manager
272  m_tls->kernel.reset(G4WorkerRunManagerKernel::GetRunManagerKernel());
273  if(!m_tls->kernel) { m_tls->kernel.reset(new G4WorkerRunManagerKernel()); }
274 
275  // Define G4 exception handler
276  G4StateManager::GetStateManager()->SetExceptionHandler(new ExceptionHandler());
277 
278  // Set the geometry for the worker, share from master
280 
281  // we need the track manager now
282  m_tls->trackManager.reset(new SimTrackManager());
283 
284  // Get DDCompactView, or would it be better to get the object from
285  // runManagerMaster instead of EventSetup in here?
287  es.get<IdealGeometryRecord>().get(pDD);
288 
289  // setup the magnetic field
291  {
292  const GlobalPoint g(0.,0.,0.);
293 
295  es.get<IdealMagneticFieldRecord>().get(pMF);
296 
297  sim::FieldBuilder fieldBuilder(pMF.product(), m_pField);
298  CMSFieldManager* fieldManager = new CMSFieldManager();
299  G4TransportationManager * tM =
300  G4TransportationManager::GetTransportationManager();
301  tM->SetFieldManager(fieldManager);
302  fieldBuilder.build( fieldManager, tM->GetPropagatorInField());
303  }
304 
305  // attach sensitive detector
306  AttachSD attach;
307  auto sensDets =
308  attach.create(*pDD, runManagerMaster.catalog(), m_p,
309  m_tls->trackManager.get(),
310  *(m_tls->registry.get()));
311 
312  m_tls->sensTkDets.swap(sensDets.first);
313  m_tls->sensCaloDets.swap(sensDets.second);
314 
315  edm::LogVerbatim("SimG4CoreApplication")
316  << " RunManagerMTWorker: Sensitive Detector building finished; found "
317  << m_tls->sensTkDets.size() << " Tk type Producers, and "
318  << m_tls->sensCaloDets.size() << " Calo type producers ";
319 
320  // Set the physics list for the worker, share from master
321  PhysicsList *physicsList = runManagerMaster.physicsListForWorker();
322 
323  edm::LogVerbatim("SimG4CoreApplication")
324  << "RunManagerMTWorker: start initialisation of PhysicsList for the thread";
325 
326  // Geant4 UI commands in PreInit state
327  if(!runManagerMaster.G4Commands().empty()) {
328  G4cout << "RunManagerMTWorker: Requested UI commands: " << G4endl;
329  for(const std::string& command: runManagerMaster.G4Commands()) {
330  G4cout << " " << command << G4endl;
331  G4UImanager::GetUIpointer()->ApplyCommand(command);
332  }
333  }
334  G4StateManager::GetStateManager()->SetNewState(G4State_Init);
335 
336  physicsList->InitializeWorker();
337  m_tls->kernel->SetPhysics(physicsList);
338  m_tls->kernel->InitializePhysics();
339 
340  const bool kernelInit = m_tls->kernel->RunInitialization();
341  if(!kernelInit) {
343  << "RunManagerMTWorker: Geant4 kernel initialization failed";
344  }
345  //tell all interesting parties that we are beginning the job
346  BeginOfJob aBeginOfJob(&es);
347  m_tls->registry->beginOfJobSignal_(&aBeginOfJob);
348 
349  G4int sv = m_p.getParameter<int>("SteppingVerbosity");
350  G4double elim = m_p.getParameter<double>("StepVerboseThreshold")*CLHEP::GeV;
351  std::vector<int> ve = m_p.getParameter<std::vector<int> >("VerboseEvents");
352  std::vector<int> vn = m_p.getParameter<std::vector<int> >("VertexNumber");
353  std::vector<int> vt = m_p.getParameter<std::vector<int> >("VerboseTracks");
354 
355  if(sv > 0) {
356  m_sVerbose.reset(new CMSSteppingVerbose(sv, elim, ve, vn, vt));
357  }
359 
360  edm::LogVerbatim("SimG4CoreApplication")
361  << "RunManagerMTWorker::initializeThread done for the thread " << thisID;
362 
363  G4StateManager::GetStateManager()->SetNewState(G4State_Idle);
364 }
365 
367  m_tls->runInterface.reset(new SimRunInterface(this, false));
369  m_tls->runInterface.get(),false));
370  m_tls->userRunAction->SetMaster(false);
371  Connect(m_tls->userRunAction.get());
372 
373  G4EventManager * eventManager = m_tls->kernel->GetEventManager();
374  eventManager->SetVerboseLevel(m_EvtMgrVerbosity);
375 
376  EventAction * userEventAction =
378  m_tls->trackManager.get(), m_sVerbose.get());
379  Connect(userEventAction);
380  eventManager->SetUserAction(userEventAction);
381 
382  TrackingAction* userTrackingAction =
383  new TrackingAction(userEventAction, m_pTrackingAction, m_sVerbose.get());
384  Connect(userTrackingAction);
385  eventManager->SetUserAction(userTrackingAction);
386 
387  SteppingAction* userSteppingAction =
388  new SteppingAction(userEventAction,m_pSteppingAction,m_sVerbose.get(),m_hasWatchers);
389  Connect(userSteppingAction);
390  eventManager->SetUserAction(userSteppingAction);
391 
392  eventManager->SetUserAction(new StackingAction(userTrackingAction,
394 
395 }
396 
398 {
399  runAction->m_beginOfRunSignal.connect(m_tls->registry->beginOfRunSignal_);
400  runAction->m_endOfRunSignal.connect(m_tls->registry->endOfRunSignal_);
401 }
402 
404 {
405  eventAction->m_beginOfEventSignal.connect(m_tls->registry->beginOfEventSignal_);
406  eventAction->m_endOfEventSignal.connect(m_tls->registry->endOfEventSignal_);
407 }
408 
410 {
411  trackingAction->m_beginOfTrackSignal.connect(m_tls->registry->beginOfTrackSignal_);
412  trackingAction->m_endOfTrackSignal.connect(m_tls->registry->endOfTrackSignal_);
413 }
414 
416 {
417  steppingAction->m_g4StepSignal.connect(m_tls->registry->g4StepSignal_);
418 }
419 
421  initializeTLS();
422  return m_tls->trackManager.get();
423 }
424 std::vector<SensitiveTkDetector*>& RunManagerMTWorker::sensTkDetectors() {
425  initializeTLS();
426  return m_tls->sensTkDets;
427 }
428 std::vector<SensitiveCaloDetector*>& RunManagerMTWorker::sensCaloDetectors() {
429  initializeTLS();
430  return m_tls->sensCaloDets;
431 }
432 std::vector<std::shared_ptr<SimProducer> > RunManagerMTWorker::producers() {
433  initializeTLS();
434  return m_tls->producers;
435 }
436 
438  m_tls->currentRun = new G4Run();
439  G4StateManager::GetStateManager()->SetNewState(G4State_GeomClosed);
440  if (m_tls->userRunAction) { m_tls->userRunAction->BeginOfRunAction(m_tls->currentRun); }
441 }
442 
444  if(!m_tls || m_tls->runTerminated) { return; }
445  if(m_tls->userRunAction) {
446  m_tls->userRunAction->EndOfRunAction(m_tls->currentRun);
447  m_tls->userRunAction.reset();
448  }
449  m_tls->currentEvent.reset();
450  m_simEvent=nullptr;
451 
452  if(m_tls->kernel) {
453  m_tls->kernel->RunTermination();
454  }
455 
456  m_tls->runTerminated = true;
457 }
458 
459 std::unique_ptr<G4SimEvent>
461  RunManagerMT& runManagerMaster) {
462  // The initialization and begin/end run is a bit convoluted due to
463  // - Geant4 deals per-thread
464  // - OscarMTProducer deals per-stream
465  // and framework/TBB is free to schedule work in streams to the
466  // threads as it likes.
467  //
468  // We have to do the per-thread initialization, and per-thread
469  // per-run initialization here by ourselves.
470 
471  if(!(m_tls && m_tls->threadInitialized)) {
472  LogDebug("SimG4CoreApplication")
473  << "RunManagerMTWorker::produce(): stream "
474  << inpevt.streamID() << " thread " << getThreadIndex() << " initializing";
475  initializeThread(runManagerMaster, es);
476  m_tls->threadInitialized = true;
477  }
478  // Initialize run
479  if(inpevt.id().run() != m_tls->currentRunNumber) {
480  if(m_tls->currentRunNumber != 0 && !m_tls->runTerminated) {
481  // If previous run in this thread was not terminated via endRun() call, terminate it now
482  terminateRun();
483  }
484  initializeRun();
485  m_tls->currentRunNumber = inpevt.id().run();
486  }
487  m_tls->runInterface->setRunManagerMTWorker(this); // For UserActions
488 
489  m_tls->currentEvent.reset(generateEvent(inpevt));
490 
491  auto simEvent =std::make_unique<G4SimEvent>();
492  m_simEvent = simEvent.get();
493  m_simEvent->hepEvent(m_generator.genEvent());
494  m_simEvent->weight(m_generator.eventWeight());
495  if (m_generator.genVertex() != nullptr ) {
496  auto genVertex = m_generator.genVertex();
497  m_simEvent->collisionPoint(
498  math::XYZTLorentzVectorD(genVertex->x()/centimeter,
499  genVertex->y()/centimeter,
500  genVertex->z()/centimeter,
501  genVertex->t()/second));
502  }
503  if (m_tls->currentEvent->GetNumberOfPrimaryVertex()==0) {
504  std::stringstream ss;
505  ss << "RunManagerMTWorker::produce(): event " << inpevt.id().event()
506  << " with no G4PrimaryVertices \n" ;
507  throw SimG4Exception(ss.str());
508 
509  } else {
510  if(!m_tls->kernel) {
511  std::stringstream ss;
512  ss << " RunManagerMT::produce(): "
513  << " no G4WorkerRunManagerKernel yet for thread index"
514  << getThreadIndex() << ", id " << std::hex
515  << std::this_thread::get_id() << " \n";
516  throw SimG4Exception(ss.str());
517  }
518 
519  edm::LogVerbatim("SimG4CoreApplication")
520  << " RunManagerMTWorker::produce: start Event " << inpevt.id().event()
521  << " stream id " << inpevt.streamID()
522  << " thread index " << getThreadIndex()
523  << " of weight " << m_simEvent->weight()
524  << " with " << m_simEvent->nTracks() << " tracks and "
525  << m_simEvent->nVertices()
526  << " vertices, generated by " << m_simEvent->nGenParts() << " particles ";
527 
528  m_tls->kernel->GetEventManager()->ProcessOneEvent(m_tls->currentEvent.get());
529 
530  edm::LogVerbatim("SimG4CoreApplication")
531  << " RunManagerMTWorker::produce: ended Event " << inpevt.id().event();
532  }
533 
534  //remove memory only needed during event processing
535  m_tls->currentEvent.reset();
536 
537  for(auto& sd: m_tls->sensCaloDets ) {
538  sd->reset();
539  }
540 
541  m_simEvent=nullptr;
542  return simEvent;
543 }
544 
546  if(m_tls->runTerminated) { return; }
547  G4Track* t = m_tls->kernel->GetEventManager()->GetTrackingManager()->GetTrack();
548  t->SetTrackStatus(fStopAndKill) ;
549 
550  // CMS-specific act
551  //
552  TrackingAction* uta =
553  static_cast<TrackingAction *>(m_tls->kernel->GetEventManager()->GetUserTrackingAction());
554  uta->PostUserTrackingAction(t) ;
555 
556  m_tls->currentEvent->SetEventAborted();
557  m_tls->kernel->GetEventManager()->GetStackManager()->clear();
558  m_tls->kernel->GetEventManager()->GetTrackingManager()->EventAborted();
559 }
560 
561 void RunManagerMTWorker::abortRun(bool softAbort) {
562  if (!softAbort) { abortEvent(); }
563  m_tls->currentRun = nullptr;
564  terminateRun();
565 }
566 
568  m_tls->currentEvent.reset();
569  m_simEvent=nullptr;
570 
571  // 64 bits event ID in CMSSW converted into Geant4 event ID
572  G4int evtid = (G4int)inpevt.id().event();
573  G4Event * evt = new G4Event(evtid);
574 
576 
577  inpevt.getByToken(m_InToken, HepMCEvt);
578 
579  m_generator.setGenEvent(HepMCEvt->GetEvent());
580 
581  // required to reset the GenParticle Id for particles transported
582  // along the beam pipe
583  // to their original value for SimTrack creation
584  resetGenParticleId( inpevt );
585 
586  if (!m_nonBeam)
587  {
588  m_generator.HepMC2G4(HepMCEvt->GetEvent(),evt);
589  }
590  else
591  {
592  m_generator.nonBeamEvent2G4(HepMCEvt->GetEvent(),evt);
593  }
594 
595  return evt;
596 }
597 
599 {
601  inpevt.getByToken( m_theLHCTlinkToken, theLHCTlink );
602  if ( theLHCTlink.isValid() ) {
603  m_tls->trackManager->setLHCTransportLink( theLHCTlink.product() );
604  }
605 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
edm::ParameterSet m_pSteppingAction
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
std::vector< std::shared_ptr< SimWatcher > > watchers
const SensitiveDetectorCatalog & catalog() const
Definition: RunManagerMT.h:77
T getUntrackedParameter(std::string const &, T const &) const
virtual const math::XYZTLorentzVector * genVertex() const
Definition: Generator.h:31
const double GeV
Definition: MathUtil.h:16
std::unique_ptr< G4Event > currentEvent
virtual const double eventWeight() const
Definition: Generator.h:32
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
def create(alignables, pedeDump, additionalData, outputFile, config)
virtual const HepMC::GenEvent * genEvent() const
Definition: Generator.h:30
SimActivityRegistry::G4StepSignal m_g4StepSignal
SimTrackManager * GetSimTrackManager()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
FunctorTask< F > * make_functor_task(ALLOC &&iAlloc, F f)
Definition: FunctorTask.h:47
void HepMC2G4(const HepMC::GenEvent *g, G4Event *e)
Definition: Generator.cc:101
std::unique_ptr< SimRunInterface > runInterface
std::unique_ptr< CMSSteppingVerbose > m_sVerbose
#define nullptr
SimActivityRegistry::EndOfRunSignal m_endOfRunSignal
Definition: RunAction.h:25
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< SensitiveTkDetector * > sensTkDets
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal
Definition: EventAction.h:51
static void createWatchers(const edm::ParameterSet &iP, SimActivityRegistry &iReg, std::vector< std::shared_ptr< SimWatcher > > &oWatchers, std::vector< std::shared_ptr< SimProducer > > &oProds)
Definition: RunManager.cc:86
edm::EDGetTokenT< edm::HepMCProduct > m_InToken
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
std::unique_ptr< G4RunManagerKernel > kernel
U second(std::pair< T, U > const &p)
G4SimEvent * simEvent()
std::unique_ptr< SimActivityRegistry > registry
edm::ParameterSet m_pEventAction
const DDDWorld & world() const
Definition: RunManagerMT.h:73
RunAction
list of unwanted particles (gluons and quarks)
std::unique_ptr< SimTrackManager > trackManager
std::unique_ptr< CustomUIsession > UIsession
static thread_local TLSData * m_tls
edm::ParameterSet m_pRunAction
std::vector< SensitiveCaloDetector * > sensCaloDets
std::vector< SensitiveTkDetector * > & sensTkDetectors()
void resetGenParticleId(const edm::Event &inpevt)
std::unique_ptr< G4SimEvent > produce(const edm::Event &inpevt, const edm::EventSetup &es, RunManagerMT &runManagerMaster)
std::unique_ptr< RunAction > userRunAction
void initializeThread(RunManagerMT &runManagerMaster, const edm::EventSetup &es)
void hepEvent(const HepMC::GenEvent *r)
Definition: G4SimEvent.h:23
void setGenEvent(const HepMC::GenEvent *inpevt)
Definition: Generator.h:24
SimActivityRegistry::EndOfTrackSignal m_endOfTrackSignal
bool isValid() const
Definition: HandleBase.h:74
std::vector< std::shared_ptr< SimProducer > > producers
void abortRun(bool softAbort=false)
RunManagerMTWorker(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&i)
void connect(Observer< const T * > *iObs)
does not take ownership of memory
Definition: Signaler.h:55
PhysicsList * physicsListForWorker() const
Definition: RunManagerMT.h:88
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
std::pair< std::vector< SensitiveTkDetector * >, std::vector< SensitiveCaloDetector * > > create(const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *, SimActivityRegistry &reg) const
Definition: AttachSD.cc:17
T const * product() const
Definition: Handle.h:74
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
edm::ParameterSet m_pTrackingAction
double sd
edm::ParameterSet m_pField
G4VPhysicalVolume * GetWorldVolumeForWorker() const
Definition: DDDWorld.h:22
G4Event * generateEvent(const edm::Event &inpevt)
edm::EDGetTokenT< edm::LHCTransportLinkContainer > m_theLHCTlinkToken
void nonBeamEvent2G4(const HepMC::GenEvent *g, G4Event *e)
Definition: Generator.cc:530
list command
Definition: mps_check.py:25
static void WorkerSetAsWorld(G4VPhysicalVolume *pv)
Definition: DDDWorld.cc:39
SimActivityRegistry::BeginOfRunSignal m_beginOfRunSignal
Definition: RunAction.h:24
const std::vector< std::string > & G4Commands() const
Definition: RunManagerMT.h:81
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
edm::ParameterSet m_pCustomUIsession
std::vector< std::shared_ptr< SimProducer > > producers()
T get() const
Definition: EventSetup.h:71
StreamID streamID() const
Definition: Event.h:95
std::vector< LHCTransportLink > LHCTransportLinkContainer
void PostUserTrackingAction(const G4Track *aTrack) override
unsigned int RunNumber_t
edm::ParameterSet m_p
T const * product() const
Definition: ESHandle.h:86
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:50
T get(const Candidate &c)
Definition: component.h:55
edm::ParameterSet m_pStackingAction
void Connect(RunAction *)
SimActivityRegistry::BeginOfTrackSignal m_beginOfTrackSignal