Newer
Older
Markus Frank
committed
//==========================================================================
// AIDA Detector description implementation for LCD
Markus Frank
committed
//--------------------------------------------------------------------------
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
Markus Frank
committed
// All rights reserved.
Markus Frank
committed
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
Markus Frank
committed
// Author : M.Frank
//
//==========================================================================
// Framework include files
#include "DD4hep/InstanceCount.h"
#include "DDG4/Geant4EventAction.h"
// C/C++ include files
#include <stdexcept>
using namespace DD4hep::Simulation;
/// Standard constructor
Markus Frank
committed
Geant4EventAction::Geant4EventAction(Geant4Context* ctxt, const string& nam)
Markus Frank
committed
: Geant4Action(ctxt, nam) {
InstanceCount::increment(this);
}
/// Default destructor
Geant4EventAction::~Geant4EventAction() {
InstanceCount::decrement(this);
}
/// begin-of-event callback
void Geant4EventAction::begin(const G4Event*) {
void Geant4EventAction::end(const G4Event*) {
Markus Frank
committed
Geant4EventActionSequence::Geant4EventActionSequence(Geant4Context* ctxt, const string& nam)
Markus Frank
committed
: Geant4Action(ctxt, nam) {
InstanceCount::increment(this);
}
/// Default destructor
Geant4EventActionSequence::~Geant4EventActionSequence() {
m_actors(&Geant4Action::release);
m_actors.clear();
m_begin.clear();
m_end.clear();
InstanceCount::decrement(this);
}
/// Add an actor responding to all callbacks. Sequence takes ownership.
void Geant4EventActionSequence::adopt(Geant4EventAction* action) {
if (action) {
action->addRef();
m_actors.add(action);
return;
}
throw runtime_error("Geant4EventActionSequence: Attempt to add invalid actor!");
void Geant4EventActionSequence::begin(const G4Event* event) {
m_actors(&Geant4EventAction::begin, event);
m_begin(event);
}
/// Post-track action callback
void Geant4EventActionSequence::end(const G4Event* event) {
m_actors(&Geant4EventAction::end, event);