DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
DDG4
src
Geant4TrackingPreAction.cpp
Go to the documentation of this file.
1
//==========================================================================
2
// AIDA Detector description implementation
3
//--------------------------------------------------------------------------
4
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5
// All rights reserved.
6
//
7
// For the licensing terms see $DD4hepINSTALL/LICENSE.
8
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9
//
10
// Author : M.Frank
11
//
12
//==========================================================================
13
14
// Framework include files
15
#include <
DD4hep/InstanceCount.h
>
16
#include <
DDG4/Geant4TrackingPreAction.h
>
17
18
// Geant4 include files
19
#include <G4TrackingManager.hh>
20
21
using namespace
dd4hep::sim
;
22
24
Geant4TrackingPreAction::Geant4TrackingPreAction
(
Geant4Context
* ctxt,
const
std::string& nam)
25
:
Geant4TrackingAction
(ctxt, nam) {
26
InstanceCount::increment
(
this
);
27
}
28
30
Geant4TrackingPreAction::~Geant4TrackingPreAction
() {
31
InstanceCount::decrement
(
this
);
32
}
33
35
void
Geant4TrackingPreAction::begin
(
const
G4Track* track) {
36
// Is the track valid? Is tracking manager valid?
37
// Does trajectory already exist?
38
if
(0 == track || 0 ==
trackMgr
() || 0 !=
trackMgr
()->GimmeTrajectory())
39
return
;
40
trackMgr
()->SetStoreTrajectory(
true
);
41
// create GaussTrajectory and inform Tracking Manager
42
G4VTrajectory* tr =
context
()->
createTrajectory
(track);
43
trackMgr
()->SetTrajectory(tr);
44
}
45
47
void
Geant4TrackingPreAction::end
(
const
G4Track*
/* track */
) {
48
}
dd4hep::sim::Geant4TrackingPreAction::Geant4TrackingPreAction
Geant4TrackingPreAction(Geant4Context *context, const std::string &name="")
Standard constructor.
Definition:
Geant4TrackingPreAction.cpp:24
dd4hep::InstanceCount::increment
static void increment(T *)
Increment count according to type information.
Definition:
InstanceCount.h:98
Geant4TrackingPreAction.h
dd4hep::sim::Geant4TrackingPreAction::begin
virtual void begin(const G4Track *track) override
Begin-of-tracking callback.
Definition:
Geant4TrackingPreAction.cpp:35
dd4hep::InstanceCount::decrement
static void decrement(T *)
Decrement count according to type information.
Definition:
InstanceCount.h:102
dd4hep::sim::Geant4TrackingAction::trackMgr
G4TrackingManager * trackMgr() const
Access the Geant4 tracking manager. Only use between tracking pre- and post action.
Definition:
Geant4TrackingAction.h:53
dd4hep::sim::Geant4Context::createTrajectory
virtual G4VTrajectory * createTrajectory(const G4Track *track) const
Create a user trajectory.
Definition:
Geant4Context.cpp:101
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition:
Geant4Output2EDM4hep.cpp:49
dd4hep::sim::Geant4TrackingAction
Default base class for all geant 4 tracking actions used in DDG4.
Definition:
Geant4TrackingAction.h:41
dd4hep::sim::Geant4TrackingPreAction::~Geant4TrackingPreAction
virtual ~Geant4TrackingPreAction()
Default destructor.
Definition:
Geant4TrackingPreAction.cpp:30
dd4hep::sim::Geant4TrackingPreAction::end
virtual void end(const G4Track *track) override
End-of-tracking callback.
Definition:
Geant4TrackingPreAction.cpp:47
InstanceCount.h
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition:
Geant4Context.h:201
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition:
Geant4Action.h:270
Generated on Tue Dec 10 2024 18:30:10 for DD4hep by
1.8.18