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 *)
 
void prepareForNewPrimary ()
 
const TrackContainertrackContainer () 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 ( const edm::ParameterSet ps,
SimRunInterface rm,
SimTrackManager iManager,
CMSSteppingVerbose sv 
)
explicit

Definition at line 14 of file EventAction.cc.

References edm::ParameterSet::getParameter(), m_trackManager, and SimTrackManager::setCollapsePrimaryVertices().

18  : m_runInterface(rm),
19  m_trackManager(iManager),
21  m_stopFile(p.getParameter<std::string>("StopFile")),
22  m_printRandom(p.getParameter<bool>("PrintRandomSeed")),
23  m_debug(p.getUntrackedParameter<bool>("debug",false))
24 {
25  m_trackManager->setCollapsePrimaryVertices(p.getParameter<bool>("CollapsePrimaryVertices"));
26 }
std::string m_stopFile
Definition: EventAction.h:58
SimRunInterface * m_runInterface
Definition: EventAction.h:55
bool m_printRandom
Definition: EventAction.h:59
CMSSteppingVerbose * m_SteppingVerbose
Definition: EventAction.h:57
SimTrackManager * m_trackManager
Definition: EventAction.h:56
bool m_debug
Definition: EventAction.h:60
void setCollapsePrimaryVertices(bool iSet)
EventAction::~EventAction ( )
override

Definition at line 28 of file EventAction.cc.

28 {}

Member Function Documentation

void EventAction::abortEvent ( )

Definition at line 87 of file EventAction.cc.

References SimRunInterface::abortEvent(), and m_runInterface.

88 {
90 }
SimRunInterface * m_runInterface
Definition: EventAction.h:55
void EventAction::addTkCaloStateInfo ( uint32_t  t,
const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &  p 
)

Definition at line 81 of file EventAction.cc.

References SimTrackManager::addTkCaloStateInfo(), and m_trackManager.

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

83 {
85 }
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
SimTrackManager * m_trackManager
Definition: EventAction.h:56
void EventAction::addTrack ( TrackWithHistory iTrack,
bool  inHistory,
bool  withAncestor 
)
inline

Definition at line 41 of file EventAction.h.

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

Referenced by TrackingAction::PostUserTrackingAction().

41  {
42  m_trackManager->addTrack(iTrack, inHistory, withAncestor);
43  }
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
SimTrackManager * m_trackManager
Definition: EventAction.h:56
void EventAction::BeginOfEventAction ( const G4Event *  evt)
override

Definition at line 30 of file EventAction.cc.

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

31 {
33 
34  BeginOfEvent e(anEvent);
36 
37  if(m_printRandom)
38  {
39  edm::LogVerbatim("SimG4CoreApplication")
40  << "BeginOfEvent " << anEvent->GetEventID()
41  << " Random number: " << G4UniformRand();
42  }
43 
44  if(nullptr != m_SteppingVerbose) { m_SteppingVerbose->BeginOfEvent(anEvent); }
45 }
bool m_printRandom
Definition: EventAction.h:59
CMSSteppingVerbose * m_SteppingVerbose
Definition: EventAction.h:57
void BeginOfEvent(const G4Event *)
SimTrackManager * m_trackManager
Definition: EventAction.h:56
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:50
void EventAction::EndOfEventAction ( const G4Event *  evt)
override

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

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

Definition at line 48 of file EventAction.h.

References SimTrackManager::cleanTracksWithHistory(), and m_trackManager.

Referenced by TrackingAction::PreUserTrackingAction().

void cleanTracksWithHistory()
SimTrackManager * m_trackManager
Definition: EventAction.h:56
const TrackContainer* EventAction::trackContainer ( ) const
inline

Definition at line 37 of file EventAction.h.

References m_trackManager, and SimTrackManager::trackContainer().

Referenced by TrackingAction::PostUserTrackingAction().

37  {
39  }
const TrackContainer * trackContainer() const
SimTrackManager * m_trackManager
Definition: EventAction.h:56

Member Data Documentation

SimActivityRegistry::BeginOfEventSignal EventAction::m_beginOfEventSignal
bool EventAction::m_debug
private

Definition at line 60 of file EventAction.h.

SimActivityRegistry::EndOfEventSignal EventAction::m_endOfEventSignal
bool EventAction::m_printRandom
private

Definition at line 59 of file EventAction.h.

Referenced by BeginOfEventAction(), and EndOfEventAction().

SimRunInterface* EventAction::m_runInterface
private

Definition at line 55 of file EventAction.h.

Referenced by abortEvent(), and EndOfEventAction().

CMSSteppingVerbose* EventAction::m_SteppingVerbose
private

Definition at line 57 of file EventAction.h.

Referenced by BeginOfEventAction().

std::string EventAction::m_stopFile
private

Definition at line 58 of file EventAction.h.

Referenced by EndOfEventAction().

SimTrackManager* EventAction::m_trackManager
private