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 addTkCaloStateInfo (uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
 
void addTrack (TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
 
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
 
void prepareForNewPrimary ()
 
const TrackContainertrackContainer () const
 
bool trackExists (unsigned int id) const
 
 ~EventAction () override
 

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:53
def rm(path, rec=False)
Definition: eostools.py:363
SimRunInterface * m_runInterface
Definition: EventAction.h:50
bool m_printRandom
Definition: EventAction.h:54
CMSSteppingVerbose * m_SteppingVerbose
Definition: EventAction.h:52
SimTrackManager * m_trackManager
Definition: EventAction.h:51
bool m_debug
Definition: EventAction.h:55
void setCollapsePrimaryVertices(bool iSet)

◆ ~EventAction()

EventAction::~EventAction ( )
override

Definition at line 26 of file EventAction.cc.

26 {}

Member Function Documentation

◆ abortEvent()

void EventAction::abortEvent ( )

Definition at line 75 of file EventAction.cc.

References SimRunInterface::abortEvent(), and m_runInterface.

SimRunInterface * m_runInterface
Definition: EventAction.h:50

◆ addTkCaloStateInfo()

void EventAction::addTkCaloStateInfo ( uint32_t  t,
const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &  p 
)

Definition at line 71 of file EventAction.cc.

References SimTrackManager::addTkCaloStateInfo(), m_trackManager, AlCaHLTBitMon_ParallelJobs::p, and submitPVValidationJobs::t.

Referenced by TrackingAction::PostUserTrackingAction(), and SteppingAction::UserSteppingAction().

71  {
73 }
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
SimTrackManager * m_trackManager
Definition: EventAction.h:51

◆ addTrack()

void EventAction::addTrack ( TrackWithHistory iTrack,
bool  inHistory,
bool  withAncestor 
)
inline

Definition at line 35 of file EventAction.h.

References SimTrackManager::addTrack(), and m_trackManager.

Referenced by TrackingAction::PostUserTrackingAction().

35  {
36  m_trackManager->addTrack(iTrack, inHistory, withAncestor);
37  }
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
SimTrackManager * m_trackManager
Definition: EventAction.h:51

◆ BeginOfEventAction()

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

Definition at line 28 of file EventAction.cc.

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

28  {
30 
31  BeginOfEvent e(anEvent);
33 
34  if (m_printRandom) {
35  edm::LogVerbatim("SimG4CoreApplication")
36  << "BeginOfEvent " << anEvent->GetEventID() << " Random number: " << G4UniformRand();
37  }
38 
39  if (nullptr != m_SteppingVerbose) {
41  }
42 }
Log< level::Info, true > LogVerbatim
bool m_printRandom
Definition: EventAction.h:54
CMSSteppingVerbose * m_SteppingVerbose
Definition: EventAction.h:52
void BeginOfEvent(const G4Event *)
SimTrackManager * m_trackManager
Definition: EventAction.h:51
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:46

◆ EndOfEventAction()

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

Definition at line 44 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().

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

◆ getTrackByID()

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

Definition at line 40 of file EventAction.h.

References SimTrackManager::getTrackByID(), and m_trackManager.

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

◆ prepareForNewPrimary()

void EventAction::prepareForNewPrimary ( )
inline

Definition at line 44 of file EventAction.h.

References SimTrackManager::cleanTracksWithHistory(), and m_trackManager.

Referenced by TrackingAction::PreUserTrackingAction().

void cleanTracksWithHistory()
SimTrackManager * m_trackManager
Definition: EventAction.h:51

◆ 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:51

◆ trackExists()

bool EventAction::trackExists ( unsigned int  id) const
inline

Definition at line 39 of file EventAction.h.

References m_trackManager, and SimTrackManager::trackExists().

39 { return m_trackManager->trackExists(id); }
bool trackExists(unsigned int i) const
SimTrackManager * m_trackManager
Definition: EventAction.h:51

Member Data Documentation

◆ m_beginOfEventSignal

SimActivityRegistry::BeginOfEventSignal EventAction::m_beginOfEventSignal

Definition at line 46 of file EventAction.h.

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

◆ m_debug

bool EventAction::m_debug
private

Definition at line 55 of file EventAction.h.

◆ m_endOfEventSignal

SimActivityRegistry::EndOfEventSignal EventAction::m_endOfEventSignal

Definition at line 47 of file EventAction.h.

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

◆ m_printRandom

bool EventAction::m_printRandom
private

Definition at line 54 of file EventAction.h.

Referenced by BeginOfEventAction(), and EndOfEventAction().

◆ m_runInterface

SimRunInterface* EventAction::m_runInterface
private

Definition at line 50 of file EventAction.h.

Referenced by abortEvent(), and EndOfEventAction().

◆ m_SteppingVerbose

CMSSteppingVerbose* EventAction::m_SteppingVerbose
private

Definition at line 52 of file EventAction.h.

Referenced by BeginOfEventAction().

◆ m_stopFile

std::string EventAction::m_stopFile
private

Definition at line 53 of file EventAction.h.

Referenced by EndOfEventAction().

◆ m_trackManager

SimTrackManager* EventAction::m_trackManager
private