CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
void EndOfEventAction (const G4Event *evt)
 
 EventAction (const edm::ParameterSet &ps, SimRunInterface *, SimTrackManager *)
 
void prepareForNewPrimary ()
 
const TrackContainertrackContainer () const
 
 ~EventAction ()
 

Public Attributes

SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
 
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal
 

Private Attributes

bool m_debug
 
bool m_printRandom
 
SimRunInterfacem_runInterface
 
std::string m_stopFile
 
SimTrackManagerm_trackManager
 

Detailed Description

Definition at line 24 of file EventAction.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file EventAction.cc.

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

19  : m_runInterface(rm),
20  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:52
SimRunInterface * m_runInterface
Definition: EventAction.h:50
bool m_printRandom
Definition: EventAction.h:53
SimTrackManager * m_trackManager
Definition: EventAction.h:51
bool m_debug
Definition: EventAction.h:54
void setCollapsePrimaryVertices(bool iSet)
EventAction::~EventAction ( )

Definition at line 28 of file EventAction.cc.

28 {}

Member Function Documentation

void EventAction::abortEvent ( )

Definition at line 96 of file EventAction.cc.

References SimRunInterface::abortEvent(), and m_runInterface.

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

Definition at line 90 of file EventAction.cc.

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

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

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

Definition at line 84 of file EventAction.cc.

References SimTrackManager::addTrack(), and m_trackManager.

Referenced by TrackingAction::PostUserTrackingAction().

86 {
87  m_trackManager->addTrack(iTrack, inHistory, withAncestor);
88 }
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
SimTrackManager * m_trackManager
Definition: EventAction.h:51
void EventAction::BeginOfEventAction ( const G4Event *  evt)

Definition at line 30 of file EventAction.cc.

References SimRunInterface::abortRun(), alignCSCRings::e, m_beginOfEventSignal, m_runInterface, m_stopFile, m_trackManager, and SimTrackManager::reset().

31 {
32  if (std::ifstream(m_stopFile.c_str()))
33  {
34  edm::LogWarning("SimG4CoreApplication")
35  << "BeginOfEventAction: termination signal received at event "
36  << anEvent->GetEventID();
37  /*
38  cout << "BeginOfEventAction: termination signal received at event "
39  << anEvent->GetEventID() << endl;
40  */
41  m_runInterface->abortRun(true);
42  }
44  BeginOfEvent e(anEvent);
46 }
std::string m_stopFile
Definition: EventAction.h:52
SimRunInterface * m_runInterface
Definition: EventAction.h:50
void abortRun(bool softAbort)
SimTrackManager * m_trackManager
Definition: EventAction.h:51
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:45
void EventAction::EndOfEventAction ( const G4Event *  evt)

Definition at line 48 of file EventAction.cc.

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

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

Definition at line 43 of file EventAction.h.

References SimTrackManager::cleanTracksWithHistory(), and m_trackManager.

Referenced by TrackingAction::PreUserTrackingAction().

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

Definition at line 38 of file EventAction.h.

References m_trackManager, and SimTrackManager::trackContainer().

Referenced by TrackingAction::PostUserTrackingAction().

38  {
40  }
const TrackContainer * trackContainer() const
SimTrackManager * m_trackManager
Definition: EventAction.h:51

Member Data Documentation

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

Definition at line 54 of file EventAction.h.

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

Definition at line 53 of file EventAction.h.

Referenced by EndOfEventAction().

SimRunInterface* EventAction::m_runInterface
private

Definition at line 50 of file EventAction.h.

Referenced by abortEvent(), BeginOfEventAction(), and EndOfEventAction().

std::string EventAction::m_stopFile
private

Definition at line 52 of file EventAction.h.

Referenced by BeginOfEventAction(), and EndOfEventAction().

SimTrackManager* EventAction::m_trackManager
private