Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
6 
7 // CLHEP
8 #include "CLHEP/Random/RandFlat.h"
9 
10 //Geant4
11 #include "G4Track.hh"
12 #include "G4TrackVector.hh"
13 
14 PunchThroughSimWrapper::PunchThroughSimWrapper(const std::string& type, const std::string& name, const IInterface* parent)
15  : base_class(type,name,parent)
16 {
17 }
18 
20 {
21  return StatusCode::SUCCESS;
22 }
23 
25 {
26  return StatusCode::SUCCESS;
27 }
28 
29 void PunchThroughSimWrapper::DoPunchThroughSim(G4ParticleTable &ptable, ATHRNG::RNGWrapper* rngWrapper, const double simE, std::vector<double> simEfrac, const G4FastTrack& fastTrack, G4FastStep& fastStep)
30 {
31  // Get Geant4 primary track
32  const G4Track* G4PrimaryTrack = fastTrack.GetPrimaryTrack();
33 
34  // Get calo-ms variables
35  std::vector<double> caloMSVars = m_PunchThroughG4Tool->getCaloMSVars();
36 
37  // Declare array holders
38  std::vector<std::map<std::string, double>> secKinematicsMapVect;
39 
40  // Create output particle (secondaries) collection
41  auto secTrackCont = std::make_unique<G4TrackVector>();
42 
43  // Draw flat random number to compare punchthrough probability
44  double punchThroughClassifierRand = CLHEP::RandFlat::shoot(*rngWrapper);
45 
46  // Calculate probability of punch through using punchThroughClassifier
47  double punchThroughProbability = m_PunchThroughG4Classifier->computePunchThroughProbability(fastTrack, simE, simEfrac);
48 
49  // Safety condition
50  if( punchThroughProbability > punchThroughClassifierRand){
51  secKinematicsMapVect = m_PunchThroughG4Tool->computePunchThroughParticles(fastTrack, *rngWrapper, punchThroughProbability, punchThroughClassifierRand);
52 
53  // Create secondary tracks
54  if(secKinematicsMapVect.size()!=0){
55  // Now create all secondary tracks after all consistency checks (conservation of energy etc):
56  m_PunchThroughG4Tool->createAllSecondaryTracks(ptable, fastStep, *G4PrimaryTrack, secKinematicsMapVect, *secTrackCont, caloMSVars);
57  }
58  }
59  // done punchthrough procedure
60 }
PunchThroughSimWrapper::m_PunchThroughG4Tool
PublicToolHandle< IPunchThroughG4Tool > m_PunchThroughG4Tool
Definition: PunchThroughSimWrapper.h:55
PunchThroughSimWrapper.h
PunchThroughSimWrapper::PunchThroughSimWrapper
PunchThroughSimWrapper(const std::string &, const std::string &, const IInterface *)
Constructor.
Definition: PunchThroughSimWrapper.cxx:14
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PunchThroughSimWrapper::m_PunchThroughG4Classifier
PublicToolHandle< IPunchThroughG4Classifier > m_PunchThroughG4Classifier
Definition: PunchThroughSimWrapper.h:56
test_pyathena.parent
parent
Definition: test_pyathena.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PunchThroughSimWrapper::initialize
virtual StatusCode initialize()
AlgTool initialize method.
Definition: PunchThroughSimWrapper.cxx:19
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
PunchThroughSimWrapper::DoPunchThroughSim
virtual void DoPunchThroughSim(G4ParticleTable &ptable, ATHRNG::RNGWrapper *rngWrapper, const double simE, std::vector< double > simEfrac, const G4FastTrack &fastTrack, G4FastStep &fastStep)
Definition: PunchThroughSimWrapper.cxx:29
PunchThroughSimWrapper::finalize
virtual StatusCode finalize()
AlgTool finalize method.
Definition: PunchThroughSimWrapper.cxx:24