CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

EventAction Class Reference

#include <EventAction.h>

List of all members.

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, RunManager *, SimTrackManager *)
void prepareForNewPrimary ()
const TrackContainertrackContainer () const
 ~EventAction ()

Public Attributes

SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal

Private Attributes

bool m_debug
RunManagerm_runManager
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,
RunManager rm,
SimTrackManager iManager 
)

Definition at line 13 of file EventAction.cc.

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

    : m_runManager(rm),
      m_trackManager(iManager),
      m_stopFile(p.getParameter<std::string>("StopFile")),
      m_debug(p.getUntrackedParameter<bool>("debug",false))
{
  m_trackManager->setCollapsePrimaryVertices(p.getParameter<bool>("CollapsePrimaryVertices"));
}
EventAction::~EventAction ( )

Definition at line 24 of file EventAction.cc.

{}

Member Function Documentation

void EventAction::abortEvent ( )

Definition at line 81 of file EventAction.cc.

References RunManager::abortEvent(), and m_runManager.

void EventAction::addTkCaloStateInfo ( uint32_t  t,
const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &  p 
)
void EventAction::addTrack ( TrackWithHistory iTrack,
bool  inHistory,
bool  withAncestor 
)

Definition at line 70 of file EventAction.cc.

References SimTrackManager::addTrack(), and m_trackManager.

Referenced by TrackingAction::PostUserTrackingAction().

{
  m_trackManager->addTrack(iTrack, inHistory, withAncestor);
}
void EventAction::BeginOfEventAction ( const G4Event *  evt)

Definition at line 26 of file EventAction.cc.

References RunManager::abortRun(), gather_cfg::cout, alignCSCRings::e, m_beginOfEventSignal, m_runManager, m_stopFile, m_trackManager, and SimTrackManager::reset().

{
    if (std::ifstream(m_stopFile.c_str()))
    {
        cout << "BeginOfEventAction: termination signal received at event "
             << anEvent->GetEventID() << endl;
        //RunManager::instance()->abortRun(true);
        m_runManager->abortRun(true);
    }

    m_trackManager->reset();
    BeginOfEvent e(anEvent);
    m_beginOfEventSignal(&e);

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

Definition at line 42 of file EventAction.cc.

References RunManager::abortRun(), SimTrackManager::cleanTkCaloStateInfoMap(), gather_cfg::cout, SimTrackManager::deleteTracks(), alignCSCRings::e, m_endOfEventSignal, m_runManager, m_stopFile, m_trackManager, RunManager::simEvent(), and SimTrackManager::storeTracks().

{
    if (std::ifstream(m_stopFile.c_str()))
    {
        cout << "EndOfEventAction: termination signal received at event "
             << anEvent->GetEventID() << endl;
        // soft abort run
        m_runManager->abortRun(true);
    }
    if (anEvent->GetNumberOfPrimaryVertex()==0)
    {
        cout << " EndOfEventAction: event " << anEvent->GetEventID()
             << " must have failed (no G4PrimaryVertices found) and will be skipped " 
             << endl;
        return;
    }

    // m_trackManager->storeTracks(RunManager::instance()->simEvent());
    m_trackManager->storeTracks(m_runManager->simEvent());
    // dispatch now end of event, and only then delete tracks...
    EndOfEvent e(anEvent);
    m_endOfEventSignal(&e);

    m_trackManager->deleteTracks();
    m_trackManager->cleanTkCaloStateInfoMap();

}
void EventAction::prepareForNewPrimary ( ) [inline]
const TrackContainer* EventAction::trackContainer ( ) const [inline]

Member Data Documentation

Definition at line 45 of file EventAction.h.

Referenced by BeginOfEventAction(), and RunManager::initializeUserActions().

bool EventAction::m_debug [private]

Definition at line 53 of file EventAction.h.

Definition at line 46 of file EventAction.h.

Referenced by EndOfEventAction(), and RunManager::initializeUserActions().

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