ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::MultipleScatteringUpdator Class Referencefinal

The Formula used is the highland formula for the projected scattering angle : More...

#include <MultipleScatteringUpdator.h>

Inheritance diagram for Trk::MultipleScatteringUpdator:
Collaboration diagram for Trk::MultipleScatteringUpdator:

Public Member Functions

 MultipleScatteringUpdator (const std::string &, const std::string &, const IInterface *)
 AlgTool like constructor.
virtual ~MultipleScatteringUpdator ()
 Virtual destructor.
virtual StatusCode initialize () override
 AlgTool initailize method.
virtual double sigmaSquare (const MaterialProperties &mat, double p, double pathcorrection, ParticleHypothesis particle=pion, double deltaE=0.) const override
 Calculate the sigma on theta introduced by multiple scattering, according to the RutherFord-Scott Formula.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
virtual void validationAction () const
 Validation Action: Can be implemented optionally, outside access to internal validation steps.

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool and IAlgTool interface methods.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

BooleanProperty m_useTrkUtils
BooleanProperty m_log_include
BooleanProperty m_gaussianMixture
BooleanProperty m_optGaussianMixtureG4
ServiceHandle< IAthRNGSvcm_rndGenSvc
 Random Generator service.
ATHRNG::RNGWrapperm_rngWrapper = nullptr
 Random engine.
StringProperty m_randomEngineName
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

The Formula used is the highland formula for the projected scattering angle :

\( \theta_{ms} = \frac{13.6MeV}{p}\cdot\sqrt{t/X_{0}}[1 + 0.038\ln(t/X_{0})] \)

What is returned is the square of the expectation value of the deflection \( < (\theta_ms)^2 > = \sigma_ms^2 \)

Definition at line 42 of file MultipleScatteringUpdator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MultipleScatteringUpdator()

Trk::MultipleScatteringUpdator::MultipleScatteringUpdator ( const std::string & t,
const std::string & n,
const IInterface * p )

AlgTool like constructor.

Definition at line 47 of file MultipleScatteringUpdator.cxx.

48 :
49 AthAlgTool(t, n, p) {
50 declareInterface<IMultipleScatteringUpdator>(this);
51}
AthAlgTool()
Default constructor:

◆ ~MultipleScatteringUpdator()

Trk::MultipleScatteringUpdator::~MultipleScatteringUpdator ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode Trk::MultipleScatteringUpdator::initialize ( )
overridevirtual

AlgTool initailize method.

Definition at line 59 of file MultipleScatteringUpdator.cxx.

59 {
60 // if Gaussian mixture is required
62 // get the random generator service
63 if (m_rndGenSvc.retrieve().isFailure()) {
64 ATH_MSG_WARNING("Could not retrieve " << m_rndGenSvc << " -> switching Gaussian mixture model off.");
65 m_gaussianMixture = false;
66 } else {
67 ATH_MSG_VERBOSE("Successfully retrieved " << m_rndGenSvc);
68 }
69
70 // Get own engine with own seeds:
71 m_rngWrapper = m_gaussianMixture ? m_rndGenSvc->getEngine(this, m_randomEngineName) : nullptr;
72 if (!m_rngWrapper) {
74 "Could not get random engine '" << m_randomEngineName << "' -> switching Gaussian mixture model off.");
75 m_gaussianMixture = false;
76 }
77 }
79 ATH_MSG_VERBOSE("Gaussian mixture model = ON ... optimised = " << m_optGaussianMixtureG4);
80 } else {
81 ATH_MSG_VERBOSE("Gaussian mixture model = OFF");
82 }
83
84 return StatusCode::SUCCESS;
85}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
ATHRNG::RNGWrapper * m_rngWrapper
Random engine.
ServiceHandle< IAthRNGSvc > m_rndGenSvc
Random Generator service.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Trk::IMultipleScatteringUpdator::interfaceID ( )
inlinestaticinherited

AlgTool and IAlgTool interface methods.

Definition at line 36 of file IMultipleScatteringUpdator.h.

static const InterfaceID IID_IMultipleScatteringUpdator("IMultipleScatteringUpdator", 1, 0)
Interface ID for IMultipleScatteringUpdator.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sigmaSquare()

double Trk::MultipleScatteringUpdator::sigmaSquare ( const MaterialProperties & mat,
double p,
double pathcorrection,
ParticleHypothesis particle = pion,
double deltaE = 0. ) const
overridevirtual

Calculate the sigma on theta introduced by multiple scattering, according to the RutherFord-Scott Formula.

Implements Trk::IMultipleScatteringUpdator.

Definition at line 88 of file MultipleScatteringUpdator.cxx.

92 {
93 if (mat.thicknessInX0() <= 0. || particle == Trk::geantino) {
94 return 0.;
95 }
96
97 // make sure the path correction is positive to avoid a floating point exception
98 pathcorrection *= pathcorrection < 0. ? (-1.) : (1);
99
100 // scale the path length to the radiation length
101 double t = pathcorrection * mat.thicknessInX0();
102
103 // kinematics (relativistic)
105 double E = sqrt(p * p + m * m);
106 double beta = p / E;
107
108 double sigma2(0.);
109
110 double sigma = Trk::MaterialInteraction::sigmaMS(t, p, beta);
111 sigma2 = sigma * sigma;
112
113 if (m_useTrkUtils && particle != Trk::electron) {
114 return sigma2;
115 }
116
117// Code below will not be used if the parameterization of TrkUtils is used
118
119
120 if (particle != Trk::electron) {
121 if (auto denom = beta * p; not close_to_zero(denom)){
122 // the highland formula
123 sigma2 = s_main_RutherfordScott / denom;
124 }
125
126 if (m_log_include) {
127 sigma2 *= (1. + s_log_RutherfordScott * std::log(t));
128 }
129
130 sigma2 *= (sigma2 * t);
131 }else {
132 // Electron multiple scattering effects - see Highland NIM 129 (1975) p497-499
133 // (Highland extension to the Rossi-Greisen formulation)
134 // NOTE: The formula can be extended by replacing the momentum^2 term with pi * pf
135 sigma2 = s_main_RossiGreisen / (beta * p);
136 sigma2 *= (sigma2 * t);
137
138 if (m_log_include) {
139 double factor = 1. + s_log_RossiGreisen * std::log10(10. * t);
140 factor *= factor;
141 sigma2 *= factor;
142 }
143 }
144
145 // use the Gaussian mixture model
146 if (m_gaussianMixture) {
147 // Reseed the RNG if needed.
148 const EventContext& ctx = Gaudi::Hive::currentContext();
149 if (m_rngWrapper->evtSeeded(ctx) != ctx.evt()) {
150 // Ok, the wrappers are unique to this algorithm and a given slot,
151 // so cannot be accessed concurrently.
152 ATHRNG::RNGWrapper* wrapper_nc ATLAS_THREAD_SAFE = m_rngWrapper;
153 wrapper_nc->setSeed (this->name(), ctx);
154 }
155 CLHEP::HepRandomEngine* engine = m_rngWrapper->getEngine (ctx);
156 // d_0'
157 double dprime{};
158 if (auto denom = beta * beta; not close_to_zero(denom)){
159 dprime = t / denom;
160 } else {
161 ATH_MSG_WARNING("Trk::MultipleScatteringUpdator::sigmaSquare: beta close to zero");
162 return 0.;
163 }
164 double log_dprime = std::log(dprime);
165 // d_0''
166 double log_dprimeprime = std::log(std::pow(mat.averageZ(), 2.0 / 3.0) * dprime);
167 // get epsilon
168 double epsilon = log_dprimeprime < 0.5 ?
169 s_gausMixEpsilon_a0 + s_gausMixEpsilon_a1 * log_dprimeprime + s_gausMixEpsilon_a2 *
170 log_dprimeprime * log_dprimeprime :
171 s_gausMixEpsilon_b0 + s_gausMixEpsilon_b1 * log_dprimeprime + s_gausMixEpsilon_b2 *
172 log_dprimeprime * log_dprimeprime;
173 // the standard sigma
174 double sigma1square = s_gausMixSigma1_a0 + s_gausMixSigma1_a1 * log_dprime + s_gausMixSigma1_a2 * log_dprime *
175 log_dprime;
176 // G4 optimised / native double Gaussian model
178 if (auto denom = p * p;not close_to_zero(denom)){
179 sigma2 = 225. * dprime / (p * p);
180 } else {
181 ATH_MSG_WARNING("Trk::MultipleScatteringUpdator::sigmaSquare: p close to zero");
182 }
183 }
184 // throw the random number core/tail
185 if (CLHEP::RandFlat::shoot(engine) < epsilon) {
186 sigma2 *= (1. - (1. - epsilon) * sigma1square) / epsilon;
187 }
188 }
189
190 return sigma2;
191}
bool close_to_zero(T value, T eps=std::numeric_limits< T >::epsilon())
#define ATLAS_THREAD_SAFE
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
static double sigmaMS(double dInX0, double p, double beta)
multiple scattering as function of dInX0

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ validationAction()

virtual void Trk::IMultipleScatteringUpdator::validationAction ( ) const
inlinevirtualinherited

Validation Action: Can be implemented optionally, outside access to internal validation steps.

Definition at line 48 of file IMultipleScatteringUpdator.h.

48{}

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_gaussianMixture

BooleanProperty Trk::MultipleScatteringUpdator::m_gaussianMixture
private
Initial value:
{this, "GaussianMixtureModel", false,
"mainly for Fatras"}

Definition at line 71 of file MultipleScatteringUpdator.h.

71 {this, "GaussianMixtureModel", false,
72 "mainly for Fatras"};

◆ m_log_include

BooleanProperty Trk::MultipleScatteringUpdator::m_log_include
private
Initial value:
{this, "MultipleScatteringLogarithmicTermOn", true,
"boolean switch to include log term"}

Definition at line 69 of file MultipleScatteringUpdator.h.

69 {this, "MultipleScatteringLogarithmicTermOn", true,
70 "boolean switch to include log term"};

◆ m_optGaussianMixtureG4

BooleanProperty Trk::MultipleScatteringUpdator::m_optGaussianMixtureG4
private
Initial value:
{this, "G4OptimisedGaussianMixtureModel", true,
"modifies the Fruehwirth/Regler model to fit with G4"}

Definition at line 73 of file MultipleScatteringUpdator.h.

73 {this, "G4OptimisedGaussianMixtureModel", true,
74 "modifies the Fruehwirth/Regler model to fit with G4"};

◆ m_randomEngineName

StringProperty Trk::MultipleScatteringUpdator::m_randomEngineName
private
Initial value:
{this, "RandomStreamName", "TrkExRnd",
"Name of the random number stream"}

Definition at line 82 of file MultipleScatteringUpdator.h.

82 {this, "RandomStreamName", "TrkExRnd",
83 "Name of the random number stream"};

◆ m_rndGenSvc

ServiceHandle<IAthRNGSvc> Trk::MultipleScatteringUpdator::m_rndGenSvc
private
Initial value:
{this, "RandomNumberService", "AthRNGSvc",
"Name of the random number service"}

Random Generator service.

Definition at line 78 of file MultipleScatteringUpdator.h.

78 {this, "RandomNumberService", "AthRNGSvc",
79 "Name of the random number service"};

◆ m_rngWrapper

ATHRNG::RNGWrapper* Trk::MultipleScatteringUpdator::m_rngWrapper = nullptr
private

Random engine.

Definition at line 81 of file MultipleScatteringUpdator.h.

◆ m_useTrkUtils

BooleanProperty Trk::MultipleScatteringUpdator::m_useTrkUtils
private
Initial value:
{this, "UseTrkUtils", true,
"use eloss parametrisation from TrkUtils MaterialInterAction.h"}

Definition at line 67 of file MultipleScatteringUpdator.h.

67 {this, "UseTrkUtils", true,
68 "use eloss parametrisation from TrkUtils MaterialInterAction.h"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: