CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
EventAction Class Reference

#include <EventAction.h>

Inheritance diagram for EventAction:

Public Member Functions

void abortEvent ()
 
void BeginOfEventAction (const G4Event *evt) override
 
void EndOfEventAction (const G4Event *evt) override
 
 EventAction (const edm::ParameterSet &ps, SimRunInterface *, SimTrackManager *, CMSSteppingVerbose *)
 
TrackWithHistorygetTrackByID (unsigned int id) const
 
const TrackContainertrackContainer () const
 
 ~EventAction () override=default
 

Public Attributes

SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
 
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal
 

Private Attributes

bool m_debug
 
bool m_printRandom
 
SimRunInterfacem_runInterface
 
CMSSteppingVerbosem_SteppingVerbose
 
std::string m_stopFile
 
SimTrackManagerm_trackManager
 

Detailed Description

Definition at line 23 of file EventAction.h.

Constructor & Destructor Documentation

◆ EventAction()

EventAction::EventAction ( const edm::ParameterSet ps,
SimRunInterface rm,
SimTrackManager iManager,
CMSSteppingVerbose sv 
)
explicit

Definition at line 13 of file EventAction.cc.

References m_trackManager, AlCaHLTBitMon_ParallelJobs::p, and SimTrackManager::setCollapsePrimaryVertices().

17  : m_runInterface(rm),
18  m_trackManager(iManager),
20  m_stopFile(p.getParameter<std::string>("StopFile")),
21  m_printRandom(p.getParameter<bool>("PrintRandomSeed")),
22  m_debug(p.getUntrackedParameter<bool>("debug", false)) {
23  m_trackManager->setCollapsePrimaryVertices(p.getParameter<bool>("CollapsePrimaryVertices"));
24 }
std::string m_stopFile
Definition: EventAction.h:44
def rm(path, rec=False)
Definition: eostools.py:363
SimRunInterface * m_runInterface
Definition: EventAction.h:41
bool m_printRandom
Definition: EventAction.h:45
CMSSteppingVerbose * m_SteppingVerbose
Definition: EventAction.h:43
SimTrackManager * m_trackManager
Definition: EventAction.h:42
bool m_debug
Definition: EventAction.h:46
void setCollapsePrimaryVertices(bool iSet)

◆ ~EventAction()

EventAction::~EventAction ( )
overridedefault

Member Function Documentation

◆ abortEvent()

void EventAction::abortEvent ( )

Definition at line 70 of file EventAction.cc.

References SimRunInterface::abortEvent(), and m_runInterface.

SimRunInterface * m_runInterface
Definition: EventAction.h:41

◆ BeginOfEventAction()

void EventAction::BeginOfEventAction ( const G4Event *  evt)
override

Definition at line 26 of file EventAction.cc.

References CMSSteppingVerbose::beginOfEvent(), MillePedeFileConverter_cfg::e, m_beginOfEventSignal, m_printRandom, m_SteppingVerbose, m_trackManager, and SimTrackManager::reset().

Referenced by CMSSimEventManager::ProcessOneEvent().

26  {
28 
29  BeginOfEvent e(anEvent);
31 
32  if (m_printRandom) {
33  edm::LogVerbatim("SimG4CoreApplication")
34  << "BeginOfEvent " << anEvent->GetEventID() << " Random number: " << G4UniformRand();
35  }
36 
37  if (nullptr != m_SteppingVerbose) {
39  }
40 }
Log< level::Info, true > LogVerbatim
void beginOfEvent(const G4Event *)
bool m_printRandom
Definition: EventAction.h:45
CMSSteppingVerbose * m_SteppingVerbose
Definition: EventAction.h:43
SimTrackManager * m_trackManager
Definition: EventAction.h:42
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:37

◆ EndOfEventAction()

void EventAction::EndOfEventAction ( const G4Event *  evt)
override

Definition at line 42 of file EventAction.cc.

References SimRunInterface::abortRun(), SimTrackManager::cleanTkCaloStateInfoMap(), SimTrackManager::deleteTracks(), MillePedeFileConverter_cfg::e, m_endOfEventSignal, m_printRandom, m_runInterface, m_stopFile, m_trackManager, SimRunInterface::simEvent(), and SimTrackManager::storeTracks().

Referenced by CMSSimEventManager::ProcessOneEvent().

42  {
43  if (m_printRandom) {
44  edm::LogVerbatim("SimG4CoreApplication")
45  << " EndOfEvent " << anEvent->GetEventID() << " Random number: " << G4UniformRand();
46  }
47  if (!m_stopFile.empty() && std::ifstream(m_stopFile.c_str())) {
48  edm::LogWarning("SimG4CoreApplication")
49  << "EndOfEventAction: termination signal received at event " << anEvent->GetEventID();
50  // soft abort run
51  m_runInterface->abortRun(true);
52  }
53  if (anEvent->GetNumberOfPrimaryVertex() == 0) {
54  edm::LogWarning("SimG4CoreApplication") << "EndOfEventAction: event " << anEvent->GetEventID()
55  << " must have failed (no G4PrimaryVertices found) and will be skipped ";
56  return;
57  }
58 
60 
61  // dispatch now end of event
62  EndOfEvent e(anEvent);
64 
65  // delete transient objects
68 }
Log< level::Info, true > LogVerbatim
std::string m_stopFile
Definition: EventAction.h:44
SimRunInterface * m_runInterface
Definition: EventAction.h:41
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal
Definition: EventAction.h:38
bool m_printRandom
Definition: EventAction.h:45
G4SimEvent * simEvent()
void cleanTkCaloStateInfoMap()
void abortRun(bool softAbort)
void storeTracks(G4SimEvent *simEvent)
SimTrackManager * m_trackManager
Definition: EventAction.h:42
Log< level::Warning, false > LogWarning

◆ getTrackByID()

TrackWithHistory* EventAction::getTrackByID ( unsigned int  id) const
inline

Definition at line 35 of file EventAction.h.

References SimTrackManager::getTrackByID(), and m_trackManager.

35 { return m_trackManager->getTrackByID(id); }
TrackWithHistory * getTrackByID(unsigned int trackID, bool strict=false) const
SimTrackManager * m_trackManager
Definition: EventAction.h:42

◆ trackContainer()

const TrackContainer* EventAction::trackContainer ( ) const
inline

Definition at line 33 of file EventAction.h.

References m_trackManager, and SimTrackManager::trackContainer().

33 { return m_trackManager->trackContainer(); }
const TrackContainer * trackContainer() const
SimTrackManager * m_trackManager
Definition: EventAction.h:42

Member Data Documentation

◆ m_beginOfEventSignal

SimActivityRegistry::BeginOfEventSignal EventAction::m_beginOfEventSignal

Definition at line 37 of file EventAction.h.

Referenced by BeginOfEventAction(), and RunManagerMTWorker::Connect().

◆ m_debug

bool EventAction::m_debug
private

Definition at line 46 of file EventAction.h.

◆ m_endOfEventSignal

SimActivityRegistry::EndOfEventSignal EventAction::m_endOfEventSignal

Definition at line 38 of file EventAction.h.

Referenced by RunManagerMTWorker::Connect(), and EndOfEventAction().

◆ m_printRandom

bool EventAction::m_printRandom
private

Definition at line 45 of file EventAction.h.

Referenced by BeginOfEventAction(), and EndOfEventAction().

◆ m_runInterface

SimRunInterface* EventAction::m_runInterface
private

Definition at line 41 of file EventAction.h.

Referenced by abortEvent(), and EndOfEventAction().

◆ m_SteppingVerbose

CMSSteppingVerbose* EventAction::m_SteppingVerbose
private

Definition at line 43 of file EventAction.h.

Referenced by BeginOfEventAction().

◆ m_stopFile

std::string EventAction::m_stopFile
private

Definition at line 44 of file EventAction.h.

Referenced by EndOfEventAction().

◆ m_trackManager

SimTrackManager* EventAction::m_trackManager
private