ATLAS Offline Software
Loading...
Searching...
No Matches
AFPProtonTransportTool Class Reference

Class for the tool that parameterizes proton transport. More...

#include <AFPProtonTransportTool.h>

Inheritance diagram for AFPProtonTransportTool:
Collaboration diagram for AFPProtonTransportTool:

Public Member Functions

 AFPProtonTransportTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~AFPProtonTransportTool ()
virtual StatusCode initialize () override
virtual StatusCode load () override
 Loads parametrization file and gets the value of positions, slopes and nominal energy. It takes as argument the path to the txt file containing this information.
virtual void setParamFile (const std::string &paramFile) override
virtual double x (double x0, double y0, double z0, double sx0, double sy0, double E) const override
 Evaluates value of the horizontal position equation. It takes as arguments the initial position, slope and nominal beam energy.
double y (double x0, double y0, double z0, double sx0, double sy0, double E) const
 Evaluates value of vertical position equation. It takes as arguments the initial position, slope and nominal beam energy.
double sx (double x0, double y0, double z0, double sx0, double sy0, double E) const
 Evaluates value of horizontal slope equation. It takes as arguments the initial position, slope and nominal beam energy.
double sy (double x0, double y0, double z0, double sx0, double sy0, double E) const
 Evaluates value of vertical slope equation. It takes as arguments the initial position, slope and nominal beam energy.
double parametrisationPosition () const
 Returns the detector position for which parametrization was performed.
double energy () const
 Returns nominal beam energy for which parametrization was performed.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()

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

std::unique_ptr< AFPProtonTransportParamm_x_position
 AFPProtonTransportParam object used for the x position evaluation.
std::unique_ptr< AFPProtonTransportParamm_y_position
 AFPProtonTransportParam object used for the y position evaluation.
std::unique_ptr< AFPProtonTransportParamm_x_slope
 AFPProtonTransportParam object used for the x slope.
std::unique_ptr< AFPProtonTransportParamm_y_slope
 AFPProtonTransportParam object used for the y slope.
Gaudi::Property< double > m_xSlopeInitIP {this, "xSlopeInitIp", 0, "Initial x slope at IP"}
 Beam crossing angle from x axis at the interaction point.
Gaudi::Property< double > m_ySlopeInitIP {this, "ySlopeInitIp", 0, "Initial y slope at IP"}
 Beam crossing angle from y axis at the interaction point.
Gaudi::Property< double > m_xPositionInitIP {this, "xPositionInitIp", 0, "Initial x position at IP"}
 Proton's initial x position at the interaction point.
Gaudi::Property< double > m_yPositionInitIP {this, "yPositionInitIp", 0, "Initial y position at IP"}
 Proton's initial y position at the interaction point.
Gaudi::Property< double > m_zPositionInitIP {this, "zPositionInitIp", 0, "Initial z position at IP"}
 Proton's initial z position at the interaction point.
Gaudi::Property< double > m_energy {this, "beamEnergy", 0, "Nominal beam energy"}
 Nominal beam energy.
Gaudi::Property< double > m_parametrisationPosition {this, "parameterisationPosition", 0, "Detector position for which parameterisation was derived"}
 Detector position for which the parameterisation has been done.
Gaudi::Property< std::string > m_filename {this, "filename", "", "Parameterisation file"}
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

Class for the tool that parameterizes proton transport.

This tool does the transport of the proton from ATLAS to the AFP detector, using a parameterization loaded from a txt file. Given as input the initial x, y and z components of the proton position and the initial x, y and z components of the proton momentum it returns the predicted position of the proton with respect to the AFP near station

Definition at line 25 of file AFPProtonTransportTool.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

◆ AFPProtonTransportTool()

AFPProtonTransportTool::AFPProtonTransportTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 10 of file AFPProtonTransportTool.cxx.

10 : AthAlgTool(type, name, parent) {
11
12 declareInterface<IAFPProtonTransportTool>(this);
13
14}
AthAlgTool()
Default constructor:

◆ ~AFPProtonTransportTool()

AFPProtonTransportTool::~AFPProtonTransportTool ( )
virtual

Definition at line 23 of file AFPProtonTransportTool.cxx.

23{ }

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.

◆ energy()

double AFPProtonTransportTool::energy ( ) const
inline

Returns nominal beam energy for which parametrization was performed.

Definition at line 65 of file AFPProtonTransportTool.h.

65{return m_energy;};
Gaudi::Property< double > m_energy
Nominal beam energy.

◆ 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 AFPProtonTransportTool::initialize ( )
overridevirtual

Definition at line 16 of file AFPProtonTransportTool.cxx.

16 {
17
18 ATH_MSG_INFO("AFPProtonTransportTool::initialize Initializing transport tool");
19
20 return StatusCode::SUCCESS;
21}
#define ATH_MSG_INFO(x)

◆ 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 & IAFPProtonTransportTool::interfaceID ( )
inlinestaticinherited

Definition at line 13 of file IAFPProtonTransportTool.h.

13 {
14 static const InterfaceID id("IAFPProtonTransportTool", 1 , 0);
15 return id;
16 }

◆ load()

StatusCode AFPProtonTransportTool::load ( )
overridevirtual

Loads parametrization file and gets the value of positions, slopes and nominal energy. It takes as argument the path to the txt file containing this information.

Implements IAFPProtonTransportTool.

Definition at line 25 of file AFPProtonTransportTool.cxx.

25 {
26 std::ifstream file;
27 file.open(m_filename);
28 ATH_MSG_INFO("AFPProtonTransportTool::load "<<m_filename);
29 if (!file.is_open()) return StatusCode::FAILURE;
30
31 std::unique_ptr<AFPProtonTransportPolynomial> pol[4][8];
32
33 while (file.peek() == '#') {
34 char ch;
35 std::string name;
36 file >> ch >> name;
37
38 //Fetching variable values from the txt file
39 if (name == "m_xPositionInitIP") {
40 double value;
41 file >> value;
43 }
44 else if (name == "m_yPositionInitIP") {
45 double value;
46 file >> value;
48 }
49 else if (name == "m_zPositionInitIP") {
50 double value;
51 file >> value;
53 }
54 else if (name == "m_xSlopeInitIP") {
55 double value;
56 file >> value;
58 }
59 else if (name == "m_ySlopeInitIP") {
60 double value;
61 file >> value;
63 }
64 else if (name == "m_detectorPosition") {
65 double value;
66 file >> value;
68 }
69 else if (name == "m_nominalEnergy") {
70 double value;
71 file >> value;
73 }
74
75 file.ignore(1000, '\n');
76 }
77
78 //Fetching the polynomial coeficients
79 for (int iEqu = 0; iEqu < 4; iEqu++) {
80 file.ignore(1000, '\n');
81 for (int iPoly = 0; iPoly < 8; iPoly++) {
82 int N = 0;
83 file >> N;
84 double ch[10];
85 for (int i = 0; i < 10; i++) {
86 if (i <= N) file >> ch[i];
87 else ch[i] = 0;
88 }
89 file.ignore(1000, '\n');
90
91 //Create polynomial object with the coeficients loaded from the file
92 pol[iEqu][iPoly] =
93 std::make_unique<AFPProtonTransportPolynomial>(N, ch[0], ch[1], ch[2], ch[3], ch[4], ch[5], ch[6], ch[7], ch[8], ch[9]);
94 }
95 }
96 file.close();
97
98 //Creating the Parameterization objects with the polynomials created
99 m_x_position = std::make_unique<AFPProtonTransportParam>(m_energy, pol[0]);
100 m_y_position = std::make_unique<AFPProtonTransportParam>(m_energy, pol[1]);
101 m_x_slope = std::make_unique<AFPProtonTransportParam>(m_energy, pol[2]);
102 m_y_slope = std::make_unique<AFPProtonTransportParam>(m_energy, pol[3]);
103
104 return StatusCode::SUCCESS;
105}
Gaudi::Property< double > m_yPositionInitIP
Proton's initial y position at the interaction point.
std::unique_ptr< AFPProtonTransportParam > m_y_slope
AFPProtonTransportParam object used for the y slope.
Gaudi::Property< double > m_xPositionInitIP
Proton's initial x position at the interaction point.
Gaudi::Property< double > m_xSlopeInitIP
Beam crossing angle from x axis at the interaction point.
std::unique_ptr< AFPProtonTransportParam > m_x_slope
AFPProtonTransportParam object used for the x slope.
Gaudi::Property< double > m_ySlopeInitIP
Beam crossing angle from y axis at the interaction point.
std::unique_ptr< AFPProtonTransportParam > m_y_position
AFPProtonTransportParam object used for the y position evaluation.
std::unique_ptr< AFPProtonTransportParam > m_x_position
AFPProtonTransportParam object used for the x position evaluation.
Gaudi::Property< double > m_parametrisationPosition
Detector position for which the parameterisation has been done.
Gaudi::Property< std::string > m_filename
Gaudi::Property< double > m_zPositionInitIP
Proton's initial z position at the interaction point.
TFile * file

◆ 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.

◆ parametrisationPosition()

double AFPProtonTransportTool::parametrisationPosition ( ) const
inline

Returns the detector position for which parametrization was performed.

Definition at line 62 of file AFPProtonTransportTool.h.

◆ 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 }

◆ setParamFile()

virtual void AFPProtonTransportTool::setParamFile ( const std::string & paramFile)
inlineoverridevirtual

Implements IAFPProtonTransportTool.

Definition at line 36 of file AFPProtonTransportTool.h.

◆ sx()

double AFPProtonTransportTool::sx ( double x0,
double y0,
double z0,
double sx0,
double sy0,
double E ) const
inline

Evaluates value of horizontal slope equation. It takes as arguments the initial position, slope and nominal beam energy.

Definition at line 51 of file AFPProtonTransportTool.h.

51 {
52 return m_x_slope->evaluate(x0 + m_xPositionInitIP, y0 + m_yPositionInitIP, z0 + m_zPositionInitIP, sx0 + m_xSlopeInitIP,
53 sy0 + m_ySlopeInitIP, E);
54 }

◆ sy()

double AFPProtonTransportTool::sy ( double x0,
double y0,
double z0,
double sx0,
double sy0,
double E ) const
inline

Evaluates value of vertical slope equation. It takes as arguments the initial position, slope and nominal beam energy.

Definition at line 57 of file AFPProtonTransportTool.h.

57 {
58 return m_y_slope->evaluate(x0 + m_xPositionInitIP, y0 + m_yPositionInitIP, z0 + m_zPositionInitIP, sx0 + m_xSlopeInitIP, sy0 + m_ySlopeInitIP, E);
59 }

◆ 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

◆ x()

virtual double AFPProtonTransportTool::x ( double x0,
double y0,
double z0,
double sx0,
double sy0,
double E ) const
inlineoverridevirtual

Evaluates value of the horizontal position equation. It takes as arguments the initial position, slope and nominal beam energy.

Implements IAFPProtonTransportTool.

Definition at line 39 of file AFPProtonTransportTool.h.

39 {
41 sy0 + m_ySlopeInitIP, E);
42 }

◆ y()

double AFPProtonTransportTool::y ( double x0,
double y0,
double z0,
double sx0,
double sy0,
double E ) const
inline

Evaluates value of vertical position equation. It takes as arguments the initial position, slope and nominal beam energy.

Definition at line 45 of file AFPProtonTransportTool.h.

45 {
47 sy0 + m_ySlopeInitIP, E);
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_energy

Gaudi::Property<double> AFPProtonTransportTool::m_energy {this, "beamEnergy", 0, "Nominal beam energy"}
private

Nominal beam energy.

Definition at line 88 of file AFPProtonTransportTool.h.

88{this, "beamEnergy", 0, "Nominal beam energy"};

◆ 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_filename

Gaudi::Property<std::string> AFPProtonTransportTool::m_filename {this, "filename", "", "Parameterisation file"}
private

Definition at line 92 of file AFPProtonTransportTool.h.

92{this, "filename", "", "Parameterisation file"};

◆ m_parametrisationPosition

Gaudi::Property<double> AFPProtonTransportTool::m_parametrisationPosition {this, "parameterisationPosition", 0, "Detector position for which parameterisation was derived"}
private

Detector position for which the parameterisation has been done.

Definition at line 90 of file AFPProtonTransportTool.h.

90{this, "parameterisationPosition", 0, "Detector position for which parameterisation was derived"};

◆ 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.

◆ m_x_position

std::unique_ptr<AFPProtonTransportParam> AFPProtonTransportTool::m_x_position
private

AFPProtonTransportParam object used for the x position evaluation.

Definition at line 69 of file AFPProtonTransportTool.h.

◆ m_x_slope

std::unique_ptr<AFPProtonTransportParam> AFPProtonTransportTool::m_x_slope
private

AFPProtonTransportParam object used for the x slope.

Definition at line 73 of file AFPProtonTransportTool.h.

◆ m_xPositionInitIP

Gaudi::Property<double> AFPProtonTransportTool::m_xPositionInitIP {this, "xPositionInitIp", 0, "Initial x position at IP"}
private

Proton's initial x position at the interaction point.

Definition at line 82 of file AFPProtonTransportTool.h.

82{this, "xPositionInitIp", 0, "Initial x position at IP"};

◆ m_xSlopeInitIP

Gaudi::Property<double> AFPProtonTransportTool::m_xSlopeInitIP {this, "xSlopeInitIp", 0, "Initial x slope at IP"}
private

Beam crossing angle from x axis at the interaction point.

Definition at line 78 of file AFPProtonTransportTool.h.

78{this, "xSlopeInitIp", 0, "Initial x slope at IP"};

◆ m_y_position

std::unique_ptr<AFPProtonTransportParam> AFPProtonTransportTool::m_y_position
private

AFPProtonTransportParam object used for the y position evaluation.

Definition at line 71 of file AFPProtonTransportTool.h.

◆ m_y_slope

std::unique_ptr<AFPProtonTransportParam> AFPProtonTransportTool::m_y_slope
private

AFPProtonTransportParam object used for the y slope.

Definition at line 75 of file AFPProtonTransportTool.h.

◆ m_yPositionInitIP

Gaudi::Property<double> AFPProtonTransportTool::m_yPositionInitIP {this, "yPositionInitIp", 0, "Initial y position at IP"}
private

Proton's initial y position at the interaction point.

Definition at line 84 of file AFPProtonTransportTool.h.

84{this, "yPositionInitIp", 0, "Initial y position at IP"};

◆ m_ySlopeInitIP

Gaudi::Property<double> AFPProtonTransportTool::m_ySlopeInitIP {this, "ySlopeInitIp", 0, "Initial y slope at IP"}
private

Beam crossing angle from y axis at the interaction point.

Definition at line 80 of file AFPProtonTransportTool.h.

80{this, "ySlopeInitIp", 0, "Initial y slope at IP"};

◆ m_zPositionInitIP

Gaudi::Property<double> AFPProtonTransportTool::m_zPositionInitIP {this, "zPositionInitIp", 0, "Initial z position at IP"}
private

Proton's initial z position at the interaction point.

Definition at line 86 of file AFPProtonTransportTool.h.

86{this, "zPositionInitIp", 0, "Initial z position at IP"};

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