ATLAS Offline Software
ProcessSamplingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // class header
6 #include "ProcessSamplingTool.h"
7 
8 // Tracking
11 
13 // CLHEP
14 #include "CLHEP/Units/SystemOfUnits.h"
15 #include "CLHEP/Random/RandFlat.h"
16 
17 //
18 
19 #include <iostream>
20 
21 /*=========================================================================
22  * DESCRIPTION OF FUNCTION:
23  * ==> see headerfile
24  *=======================================================================*/
26  const std::string& n,
27  const IInterface* p )
28  : base_class(t,n,p)
29 {
30 }
31 
32 
34 {
35  int process=0;
36  double x0Max = -1.;
37 
38  if ( particle == Trk::electron && charge<0. ) return Trk::PathLimit(x0Max,process);
39 
41 
42  double rndx = CLHEP::RandFlat::shoot(randomEngine);
43 
44  if ( particle == Trk::photon ) {
45 
46  // conversion (14), compton effect (13), photo-effect (12)
47 
48  double p0 = -7.01612e-03;
49  double p1 = 7.69040e-02;
50  double p2 = -6.07682e-01;
51  // calculate xi
52  double xi = p0 + p1*pow(momentum/1000.,p2);
53  double attenuation = -7.777e-01*(1.-xi);
54 
55  x0Max = log(rndx)/attenuation ;
56 
57  // comment additional interactions till properly implemented
58  /*
59  // first estimate : compton ~ 4% , use attenuation factor as for conversion (till parameterized )
60  double rndp = CLHEP::RandFlat::shoot(randomEngine);
61 
62  if ( rndp > 0.96 ) { // do Compton scattering
63  process = 13;
64  } else if (rndp < 5.53/pow(momentum,1.184) ) {
65  process = 12;
66  attenuation = -0.378;
67  x0Max = log(rndx)/attenuation *momentum ;
68  } else {
69  process = 14;
70  //x0Max *= 0.5;
71  }
72  */
73 
74  process = 14;
75 
76  return Trk::PathLimit(x0Max,process);
77  }
78 
79  if ( particle == Trk::electron && charge>0. ) { // positron
80 
82  double gamma = momentum/mass;
83 
84  // annihilation
85  // energy dependent factor
86  double fpa = log(2*gamma)/gamma;
87  // material dependent factor - use Al(Z=13) for the moment
88  double fza = 13.;
89  double attenuation = -fpa*fza; // adjust
90 
91  x0Max = log(rndx)/attenuation ;
92  process = 5;
93 
94  return Trk::PathLimit(x0Max,process);
95 
96  }
97 
98  // presumably here we are left with hadrons only
99  if (m_hadInt) {
100 
101  // sample free path in terms of nuclear interaction length
102  double al = 1.; // scaling here
103 
104  /*
105 
106  if ( particle == Trk::pion || particle == Trk::kaon || particle == Trk::pi0 || particle == Trk::k0) {
107  al *= 1./(1.+ exp(-0.5*(momentum-270.)*(momentum-270.)/60./60.));
108  }
109  if ( particle == Trk::proton || particle == Trk::neutron ) al *=0.7;
110  if ( particle == Trk::pion || particle == Trk::pi0) al *=0.9;
111  */
112 
113  x0Max = -log(rndx)*al ;
114 
115  process = 121;
116 
117  //std::cout <<"hadronic path limit:"<<momentum<<","<<al<<","<< x0Max << std::endl;
118  return Trk::PathLimit(x0Max,process);
119  }
120 
121 
122  return Trk::PathLimit(x0Max,process);
123 
124 }
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
iFatras::ProcessSamplingTool::sampleProcess
Trk::PathLimit sampleProcess(CLHEP::HepRandomEngine *randomEngine, double mom, double charge, Trk::ParticleHypothesis pHypothesis) const
Process pre-sampling : to be moved into material updators eventually.
Definition: ProcessSamplingTool.cxx:33
TrackParameters.h
iFatras::ProcessSamplingTool::ProcessSamplingTool
ProcessSamplingTool(const std::string &, const std::string &, const IInterface *)
Constructor.
Definition: ProcessSamplingTool.cxx:25
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
dqt_zlumi_pandas.mass
mass
Definition: dqt_zlumi_pandas.py:170
RunExEngineTest.PathLimit
PathLimit
Definition: RunExEngineTest.py:61
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
ProcessSamplingTool.h
HelperStructs.h
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
TrigVtx::gamma
@ gamma
Definition: TrigParticleTable.h:26
beamspotman.n
n
Definition: beamspotman.py:731
Trk::electron
@ electron
Definition: ParticleHypothesis.h:27
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
Trk::ParticleMasses::mass
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:53
MagicNumbers.h
charge
double charge(const T &p)
Definition: AtlasPID.h:494
Trk::PathLimit
Definition: HelperStructs.h:34
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Trk::photon
@ photon
Definition: ParticleHypothesis.h:32
Trk::nonInteractingMuon
@ nonInteractingMuon
Definition: ParticleHypothesis.h:36