20 using namespace DD4hep::Simulation;
23 Geant4PhaseAction::Geant4PhaseAction(
Geant4Context* ctxt,
const std::string& nam)
37 return Callback(
this).
make(&Geant4PhaseAction::operator());
42 const type_info& arg_type1,
const type_info& arg_type2)
53 (*i).first->release();
61 m_members.push_back(make_pair(action,callback));
70 (*i).first->release();
78 if ( (*i).first == action && (*i).second.par == callback.
par) {
79 (*i).first->release();
90 (*i).second.execute((
const void**) &argument);
94 class G4HCofThisEvent;
95 class G4TouchableHistory;
102 namespace Simulation {
108 template <>
void Geant4ActionPhase::call<const G4Run*>(
const G4Run* run) {
109 this->execute((
const void**) &run);
112 template <>
void Geant4ActionPhase::call<G4Event*>(G4Event* event) {
113 this->execute((
const void**) &event);
116 template <>
void Geant4ActionPhase::call<const G4Event*>(
const G4Event* event) {
117 this->execute((
const void**) &event);
120 template <>
void Geant4ActionPhase::call<const G4Track*>(
const G4Track* track) {
121 this->execute((
const void**) &track);
124 template <>
void Geant4ActionPhase::call<const G4Step*>(
const G4Step* step) {
125 this->execute((
const void**) &step);
128 template <>
void Geant4ActionPhase::call<const G4Step*, G4SteppingManager*>(
const G4Step* step, G4SteppingManager* mgr) {
129 const void * args[] = { step, mgr };
133 template <>
void Geant4ActionPhase::call<G4HCofThisEvent*>(G4HCofThisEvent* hce) {
134 this->execute((
const void**) &hce);
137 template <>
void Geant4ActionPhase::call<G4Step*, G4TouchableHistory*>(G4Step* step, G4TouchableHistory* history) {
138 const void * args[] = { step, history };
const std::type_info * m_argTypes[3]
Type information of the argument type of the callback.
static void decrement(T *)
Decrement count according to type information.
Members m_members
Phase members (actions) being called for a particular phase.
void execute(void *argument)
Execute all members in the phase context.
virtual Callback callback()
Create bound callback to operator()()
virtual ~Geant4ActionPhase()
Default destructor.
long addRef()
Increase reference count.
const Callback & make(R(T::*pmf)())
Callback setup function for Callbacks with member functions with explicit return type taking no argum...
Definition of the generic callback structure for member functions.
static T::const_iterator find(const T &c, const string &s)
void call()
Create action to execute phase members.
Geant4ActionPhase(Geant4Context *context, const std::string &name, const std::type_info &arg_type0, const std::type_info &arg_type1, const std::type_info &arg_type2)
Standard constructor.
virtual void operator()()
Callback to generate primary particles.
virtual bool remove(Geant4Action *action, Callback callback)
Remove an existing member from the phase. If not existing returns false.
virtual ~Geant4PhaseAction()
Default destructor.
static void increment(T *)
Increment count according to type information.
Generic context to extend user, run and event information.
virtual bool add(Geant4Action *action, Callback callback)
Add a new member to the phase.
Default base class for all Geant 4 actions and derivates thereof.