A tool which transports particles through the Geant4 geometry.
More...
#include <G4CaloTransportTool.h>
|
| G4VPhysicalVolume * | m_worldVolume {} |
| |
| Gaudi::Property< bool > | m_useSimplifiedGeo {this, "UseSimplifiedGeo", true, "Use simplified geometry for particle transport"} |
| |
| Gaudi::Property< std::string > | m_simplifiedWorldLogName {this, "SimplifiedWorldLogName", "Name of the logical volume of the simplified world"} |
| |
| Gaudi::Property< std::string > | m_transportLimitVolume {this, "TransportLimitVolume", "Name of the volume until which the particle is transported"} |
| |
| Gaudi::Property< unsigned int > | m_maxSteps {this, "MaxSteps", 100, "Maximum number of steps in particle transport"} |
| |
A tool which transports particles through the Geant4 geometry.
- Author
- Joshua Falco Beirer joshu.nosp@m.a.fa.nosp@m.lco.b.nosp@m.eire.nosp@m.r@cer.nosp@m.n.ch
Definition at line 24 of file G4CaloTransportTool.h.
◆ G4CaloTransportTool()
| G4CaloTransportTool::G4CaloTransportTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ doStep()
| void G4CaloTransportTool::doStep |
( |
G4FieldTrack & |
fieldTrack | ) |
|
|
private |
Definition at line 115 of file G4CaloTransportTool.cxx.
118 auto navigator =
s_propagator->GetNavigatorForPropagating();
120 G4double retSafety = -1.0;
121 G4double currentMinimumStep = 10.0 *
CLHEP::m;
123 G4VPhysicalVolume* currentPhysVol =
124 navigator->LocateGlobalPointAndSetup(fieldTrack.GetPosition(),
nullptr);
126 G4ThreeVector direction = fieldTrack.GetMomentumDirection();
128 navigator->LocateGlobalPointAndSetup(fieldTrack.GetPosition(), &direction);
130 if (fieldTrack.GetCharge() == 0) {
134 G4double stepLength = navigator->ComputeStep(
135 fieldTrack.GetPosition(), fieldTrack.GetMomentumDirection(),
136 currentMinimumStep, retSafety);
139 fieldTrack.SetPosition(fieldTrack.GetPosition() +
141 fieldTrack.GetMomentumDirection().unit());
145 s_propagator->ComputeStep(fieldTrack, currentMinimumStep, retSafety,
◆ finalize()
| StatusCode G4CaloTransportTool::finalize |
( |
| ) |
|
|
finaloverridevirtual |
◆ getWorldVolume()
| G4VPhysicalVolume * G4CaloTransportTool::getWorldVolume |
( |
| ) |
|
|
private |
Definition at line 73 of file G4CaloTransportTool.cxx.
77 ATH_MSG_INFO(
"Creating simplified world volume for particle transport");
79 G4LogicalVolume* logVol = G4LogicalVolumeStore::GetInstance()->GetVolume(
83 return new G4PVPlacement(
85 G4ThreeVector(0, 0, 0),
87 "simplifiedWorldPhysVol",
94 ATH_MSG_INFO(
"Using full geometry for particle transport");
95 return G4TransportationManager::GetTransportationManager()
96 ->GetNavigatorForTracking()
◆ initializePropagator()
| StatusCode G4CaloTransportTool::initializePropagator |
( |
| ) |
|
|
finaloverride |
Definition at line 39 of file G4CaloTransportTool.cxx.
40 ATH_MSG_INFO(
"Initializing G4PropagatorInField for thread "
41 << G4Threading::G4GetThreadId());
48 G4Exception(
"G4CaloTransportTool",
"FailedToGetWorldVolume",
50 "G4CaloTransportTool: Failed to get world volume.");
56 ATH_MSG_INFO(
"Maximum allowed number of steps in particle transport: "
66 "G4CaloTransportTool::initializePropagator() Propagator already "
70 return StatusCode::SUCCESS;
◆ makePropagator()
| G4PropagatorInField * G4CaloTransportTool::makePropagator |
( |
| ) |
|
|
private |
Definition at line 101 of file G4CaloTransportTool.cxx.
103 G4Navigator* navigator =
new G4Navigator();
107 G4FieldManager* fieldMgr =
108 G4TransportationManager::GetTransportationManager()->GetFieldManager();
110 G4PropagatorInField* propagator =
111 new G4PropagatorInField(navigator, fieldMgr);
◆ transport()
| std::vector< G4FieldTrack > G4CaloTransportTool::transport |
( |
const G4Track & |
G4InputTrack | ) |
|
|
finaloverridevirtual |
Definition at line 152 of file G4CaloTransportTool.cxx.
156 int pdgId = G4InputTrack.GetDefinition()->GetPDGEncoding();
159 auto navigator =
s_propagator->GetNavigatorForPropagating();
162 std::vector<G4FieldTrack> outputStepVector;
165 G4FieldTrack tmpFieldTrack(
'0');
166 G4FieldTrackUpdator::Update(&tmpFieldTrack, &G4InputTrack);
168 outputStepVector.push_back(tmpFieldTrack);
171 for (
unsigned int iStep = 0; iStep <
m_maxSteps; iStep++) {
173 G4ThreeVector preStepPos = tmpFieldTrack.GetPosition();
174 G4ThreeVector preStepMom = tmpFieldTrack.GetMomentum();
180 outputStepVector.push_back(tmpFieldTrack);
183 auto volume = navigator->LocateGlobalPointAndSetup(
184 tmpFieldTrack.GetPosition(),
nullptr);
186 if (volume !=
nullptr) {
188 std::string volName = volume->GetName();
197 <<
"Transport failure for particle PID: " <<
pdgId <<
" at step "
199 <<
" - PreStep position: " << preStepPos << G4endl
200 <<
" - PreStep momentum: " << preStepMom << G4endl
201 <<
" - PostStep position: " << tmpFieldTrack.GetPosition() << G4endl
202 <<
" - PostStep momentum: " << tmpFieldTrack.GetMomentum() << G4endl
203 <<
"Possible cause: The transport is likely outside the world volume."
205 <<
"Check if an envelope volume is defined and properly set up."
206 << G4endl <<
"This issue should not occur during normal operation.";
207 G4Exception(
"G4CaloTransportTool::transport",
208 "LocateGlobalPointAndSetup failed: Particle may be "
209 "transported outside the world volume.",
215 return outputStepVector;
◆ m_maxSteps
| Gaudi::Property<unsigned int> G4CaloTransportTool::m_maxSteps {this, "MaxSteps", 100, "Maximum number of steps in particle transport"} |
|
private |
◆ m_simplifiedWorldLogName
| Gaudi::Property<std::string> G4CaloTransportTool::m_simplifiedWorldLogName {this, "SimplifiedWorldLogName", "Name of the logical volume of the simplified world"} |
|
private |
◆ m_transportLimitVolume
| Gaudi::Property<std::string> G4CaloTransportTool::m_transportLimitVolume {this, "TransportLimitVolume", "Name of the volume until which the particle is transported"} |
|
private |
◆ m_useSimplifiedGeo
| Gaudi::Property<bool> G4CaloTransportTool::m_useSimplifiedGeo {this, "UseSimplifiedGeo", true, "Use simplified geometry for particle transport"} |
|
private |
◆ m_worldVolume
| G4VPhysicalVolume* G4CaloTransportTool::m_worldVolume {} |
|
private |
◆ s_propagator
The documentation for this class was generated from the following files: