ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Atlas
G4AtlasTools
src
PunchThroughSimWrapper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PunchThroughSimWrapper.h
"
6
7
// CLHEP
8
#include "CLHEP/Random/RandFlat.h"
9
#include "CLHEP/Random/RandomEngine.h"
10
11
//Geant4
12
#include "G4Track.hh"
13
#include "G4TrackVector.hh"
14
15
PunchThroughSimWrapper::PunchThroughSimWrapper
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent)
16
: base_class(
type
,name,parent)
17
{
18
}
19
20
StatusCode
PunchThroughSimWrapper::initialize
()
21
{
22
return
StatusCode::SUCCESS;
23
}
24
25
StatusCode
PunchThroughSimWrapper::finalize
()
26
{
27
return
StatusCode::SUCCESS;
28
}
29
30
void
PunchThroughSimWrapper::DoPunchThroughSim
(G4ParticleTable &ptable, CLHEP::HepRandomEngine* rng,
const
double
simE, std::vector<double> simEfrac,
const
G4FastTrack& fastTrack, G4FastStep& fastStep)
31
{
32
// Get Geant4 primary track
33
const
G4Track* G4PrimaryTrack = fastTrack.GetPrimaryTrack();
34
35
// Get calo-ms variables
36
std::vector<double> caloMSVars =
m_PunchThroughG4Tool
->getCaloMSVars();
37
38
// Declare array holders
39
std::vector<std::map<std::string, double>> secKinematicsMapVect;
40
41
// Create output particle (secondaries) collection
42
auto
secTrackCont = std::make_unique<G4TrackVector>();
43
44
// Draw flat random number to compare punchthrough probability
45
double
punchThroughClassifierRand = CLHEP::RandFlat::shoot(rng);
46
47
// Calculate probability of punch through using punchThroughClassifier
48
double
punchThroughProbability =
m_PunchThroughG4Classifier
->computePunchThroughProbability(fastTrack, simE, simEfrac);
49
50
// Safety condition
51
if
( punchThroughProbability > punchThroughClassifierRand){
52
secKinematicsMapVect =
m_PunchThroughG4Tool
->computePunchThroughParticles(fastTrack, rng, punchThroughProbability, punchThroughClassifierRand);
53
54
// Create secondary tracks
55
if
(secKinematicsMapVect.size()!=0){
56
// Now create all secondary tracks after all consistency checks (conservation of energy etc):
57
m_PunchThroughG4Tool
->createAllSecondaryTracks(ptable, fastStep, *G4PrimaryTrack, secKinematicsMapVect, *secTrackCont, caloMSVars);
58
}
59
}
60
// done punchthrough procedure
61
}
PunchThroughSimWrapper.h
PunchThroughSimWrapper::PunchThroughSimWrapper
PunchThroughSimWrapper(const std::string &, const std::string &, const IInterface *)
Constructor.
Definition
PunchThroughSimWrapper.cxx:15
PunchThroughSimWrapper::m_PunchThroughG4Tool
PublicToolHandle< IPunchThroughG4Tool > m_PunchThroughG4Tool
Definition
PunchThroughSimWrapper.h:52
PunchThroughSimWrapper::initialize
virtual StatusCode initialize()
AlgTool initialize method.
Definition
PunchThroughSimWrapper.cxx:20
PunchThroughSimWrapper::m_PunchThroughG4Classifier
PublicToolHandle< IPunchThroughG4Classifier > m_PunchThroughG4Classifier
Definition
PunchThroughSimWrapper.h:53
PunchThroughSimWrapper::finalize
virtual StatusCode finalize()
AlgTool finalize method.
Definition
PunchThroughSimWrapper.cxx:25
PunchThroughSimWrapper::DoPunchThroughSim
virtual void DoPunchThroughSim(G4ParticleTable &ptable, CLHEP::HepRandomEngine *rng, const double simE, std::vector< double > simEfrac, const G4FastTrack &fastTrack, G4FastStep &fastStep)
Definition
PunchThroughSimWrapper.cxx:30
type
Generated on
for ATLAS Offline Software by
1.17.0