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

Definition at line 14 of file EventAction.cc.

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  m_trackManager->setCollapsePrimaryVertices(p.getParameter<bool>("CollapsePrimaryVertices"));
25 }

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

◆ ~EventAction()

EventAction::~EventAction ( )
override

Definition at line 27 of file EventAction.cc.

27 {}

Member Function Documentation

◆ abortEvent()

void EventAction::abortEvent ( )

Definition at line 76 of file EventAction.cc.

References SimRunInterface::abortEvent(), and m_runInterface.

◆ addTkCaloStateInfo()

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

◆ addTrack()

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

Definition at line 35 of file EventAction.h.

35  {
36  m_trackManager->addTrack(iTrack, inHistory, withAncestor);
37  }

References SimTrackManager::addTrack(), and m_trackManager.

Referenced by TrackingAction::PostUserTrackingAction().

◆ BeginOfEventAction()

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

Definition at line 29 of file EventAction.cc.

29  {
31 
32  BeginOfEvent e(anEvent);
34 
35  if (m_printRandom) {
36  edm::LogVerbatim("SimG4CoreApplication")
37  << "BeginOfEvent " << anEvent->GetEventID() << " Random number: " << G4UniformRand();
38  }
39 
40  if (nullptr != m_SteppingVerbose) {
42  }
43 }

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

◆ EndOfEventAction()

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

Definition at line 45 of file EventAction.cc.

45  {
46  if (m_printRandom) {
47  edm::LogVerbatim("SimG4CoreApplication")
48  << " EndOfEvent " << anEvent->GetEventID() << " Random number: " << G4UniformRand();
49  }
50  if (!m_stopFile.empty() && std::ifstream(m_stopFile.c_str())) {
51  edm::LogWarning("SimG4CoreApplication")
52  << "EndOfEventAction: termination signal received at event " << anEvent->GetEventID();
53  // soft abort run
54  m_runInterface->abortRun(true);
55  }
56  if (anEvent->GetNumberOfPrimaryVertex() == 0) {
57  edm::LogWarning("SimG4CoreApplication") << "EndOfEventAction: event " << anEvent->GetEventID()
58  << " must have failed (no G4PrimaryVertices found) and will be skipped ";
59  return;
60  }
61 
63 
64  // dispatch now end of event, and only then delete tracks...
65  EndOfEvent e(anEvent);
67 
70 }

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().

◆ prepareForNewPrimary()

void EventAction::prepareForNewPrimary ( )
inline

◆ trackContainer()

const TrackContainer* EventAction::trackContainer ( ) const
inline

Definition at line 33 of file EventAction.h.

33 { return m_trackManager->trackContainer(); }

References m_trackManager, and SimTrackManager::trackContainer().

Referenced by TrackingAction::PostUserTrackingAction().

Member Data Documentation

◆ m_beginOfEventSignal

SimActivityRegistry::BeginOfEventSignal EventAction::m_beginOfEventSignal

◆ m_debug

bool EventAction::m_debug
private

Definition at line 52 of file EventAction.h.

◆ m_endOfEventSignal

SimActivityRegistry::EndOfEventSignal EventAction::m_endOfEventSignal

◆ m_printRandom

bool EventAction::m_printRandom
private

Definition at line 51 of file EventAction.h.

Referenced by BeginOfEventAction(), and EndOfEventAction().

◆ m_runInterface

SimRunInterface* EventAction::m_runInterface
private

Definition at line 47 of file EventAction.h.

Referenced by abortEvent(), and EndOfEventAction().

◆ m_SteppingVerbose

CMSSteppingVerbose* EventAction::m_SteppingVerbose
private

Definition at line 49 of file EventAction.h.

Referenced by BeginOfEventAction().

◆ m_stopFile

std::string EventAction::m_stopFile
private

Definition at line 50 of file EventAction.h.

Referenced by EndOfEventAction().

◆ m_trackManager

SimTrackManager* EventAction::m_trackManager
private
SimTrackManager::storeTracks
void storeTracks(G4SimEvent *simEvent)
Definition: SimTrackManager.cc:91
SimTrackManager::reset
void reset()
Definition: SimTrackManager.cc:44
EventAction::m_beginOfEventSignal
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:43
EventAction::m_endOfEventSignal
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal
Definition: EventAction.h:44
SimRunInterface::abortRun
void abortRun(bool softAbort)
Definition: SimRunInterface.cc:90
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
EventAction::m_runInterface
SimRunInterface * m_runInterface
Definition: EventAction.h:47
SimTrackManager::setCollapsePrimaryVertices
void setCollapsePrimaryVertices(bool iSet)
Definition: SimTrackManager.h:83
EventAction::m_printRandom
bool m_printRandom
Definition: EventAction.h:51
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:226
SimTrackManager::deleteTracks
void deleteTracks()
Definition: SimTrackManager.cc:62
submit.rm
rm
Definition: submit.py:77
SimTrackManager::addTkCaloStateInfo
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
Definition: SimTrackManager.h:75
OrderedSet.t
t
Definition: OrderedSet.py:90
EndOfEvent
Definition: EndOfEvent.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
SimTrackManager::cleanTkCaloStateInfoMap
void cleanTkCaloStateInfoMap()
Definition: SimTrackManager.cc:195
EventAction::m_SteppingVerbose
CMSSteppingVerbose * m_SteppingVerbose
Definition: EventAction.h:49
SimTrackManager::addTrack
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
Definition: SimTrackManager.h:63
SimTrackManager::cleanTracksWithHistory
void cleanTracksWithHistory()
Definition: SimTrackManager.cc:291
edm::LogVerbatim
Definition: MessageLogger.h:297
BeginOfEvent
Definition: BeginOfEvent.h:6
EventAction::m_debug
bool m_debug
Definition: EventAction.h:52
SimRunInterface::abortEvent
void abortEvent()
Definition: SimRunInterface.cc:82
EventAction::m_trackManager
SimTrackManager * m_trackManager
Definition: EventAction.h:48
SimRunInterface::simEvent
G4SimEvent * simEvent()
Definition: SimRunInterface.cc:98
CMSSteppingVerbose::BeginOfEvent
void BeginOfEvent(const G4Event *)
Definition: CMSSteppingVerbose.cc:34
EventAction::m_stopFile
std::string m_stopFile
Definition: EventAction.h:50
SimTrackManager::trackContainer
const TrackContainer * trackContainer() const
Definition: SimTrackManager.h:52
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37