ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigAFPHypo
src
AFPProtonTransportTool.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 "
AFPProtonTransportTool.h
"
6
#include "
AFPProtonTransportPolynomial.h
"
7
#include <fstream>
8
#include <math.h>
9
10
AFPProtonTransportTool::AFPProtonTransportTool
(
const
std::string &
type
,
const
std::string & name,
const
IInterface* parent) :
AthAlgTool
(
type
, name, parent) {
11
12
declareInterface<IAFPProtonTransportTool>(
this
);
13
14
}
15
16
StatusCode
AFPProtonTransportTool::initialize
(){
17
18
ATH_MSG_INFO
(
"AFPProtonTransportTool::initialize Initializing transport tool"
);
19
20
return
StatusCode::SUCCESS;
21
}
22
23
AFPProtonTransportTool::~AFPProtonTransportTool
() { }
24
25
StatusCode
AFPProtonTransportTool::load
() {
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;
42
m_xPositionInitIP
= value;
43
}
44
else
if
(name ==
"m_yPositionInitIP"
) {
45
double
value;
46
file
>> value;
47
m_yPositionInitIP
= value;
48
}
49
else
if
(name ==
"m_zPositionInitIP"
) {
50
double
value;
51
file
>> value;
52
m_zPositionInitIP
= value;
53
}
54
else
if
(name ==
"m_xSlopeInitIP"
) {
55
double
value;
56
file
>> value;
57
m_xSlopeInitIP
= value;
58
}
59
else
if
(name ==
"m_ySlopeInitIP"
) {
60
double
value;
61
file
>> value;
62
m_ySlopeInitIP
= value;
63
}
64
else
if
(name ==
"m_detectorPosition"
) {
65
double
value;
66
file
>> value;
67
m_parametrisationPosition
= value;
68
}
69
else
if
(name ==
"m_nominalEnergy"
) {
70
double
value;
71
file
>> value;
72
m_energy
= 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
}
AFPProtonTransportPolynomial.h
AFPProtonTransportTool.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
AFPProtonTransportTool::m_yPositionInitIP
Gaudi::Property< double > m_yPositionInitIP
Proton's initial y position at the interaction point.
Definition
AFPProtonTransportTool.h:84
AFPProtonTransportTool::m_y_slope
std::unique_ptr< AFPProtonTransportParam > m_y_slope
AFPProtonTransportParam object used for the y slope.
Definition
AFPProtonTransportTool.h:75
AFPProtonTransportTool::m_xPositionInitIP
Gaudi::Property< double > m_xPositionInitIP
Proton's initial x position at the interaction point.
Definition
AFPProtonTransportTool.h:82
AFPProtonTransportTool::m_energy
Gaudi::Property< double > m_energy
Nominal beam energy.
Definition
AFPProtonTransportTool.h:88
AFPProtonTransportTool::m_xSlopeInitIP
Gaudi::Property< double > m_xSlopeInitIP
Beam crossing angle from x axis at the interaction point.
Definition
AFPProtonTransportTool.h:78
AFPProtonTransportTool::m_x_slope
std::unique_ptr< AFPProtonTransportParam > m_x_slope
AFPProtonTransportParam object used for the x slope.
Definition
AFPProtonTransportTool.h:73
AFPProtonTransportTool::initialize
virtual StatusCode initialize() override
Definition
AFPProtonTransportTool.cxx:16
AFPProtonTransportTool::m_ySlopeInitIP
Gaudi::Property< double > m_ySlopeInitIP
Beam crossing angle from y axis at the interaction point.
Definition
AFPProtonTransportTool.h:80
AFPProtonTransportTool::m_y_position
std::unique_ptr< AFPProtonTransportParam > m_y_position
AFPProtonTransportParam object used for the y position evaluation.
Definition
AFPProtonTransportTool.h:71
AFPProtonTransportTool::AFPProtonTransportTool
AFPProtonTransportTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
AFPProtonTransportTool.cxx:10
AFPProtonTransportTool::m_x_position
std::unique_ptr< AFPProtonTransportParam > m_x_position
AFPProtonTransportParam object used for the x position evaluation.
Definition
AFPProtonTransportTool.h:69
AFPProtonTransportTool::m_parametrisationPosition
Gaudi::Property< double > m_parametrisationPosition
Detector position for which the parameterisation has been done.
Definition
AFPProtonTransportTool.h:90
AFPProtonTransportTool::m_filename
Gaudi::Property< std::string > m_filename
Definition
AFPProtonTransportTool.h:92
AFPProtonTransportTool::m_zPositionInitIP
Gaudi::Property< double > m_zPositionInitIP
Proton's initial z position at the interaction point.
Definition
AFPProtonTransportTool.h:86
AFPProtonTransportTool::load
virtual StatusCode load() override
Loads parametrization file and gets the value of positions, slopes and nominal energy....
Definition
AFPProtonTransportTool.cxx:25
AFPProtonTransportTool::~AFPProtonTransportTool
virtual ~AFPProtonTransportTool()
Definition
AFPProtonTransportTool.cxx:23
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
type
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0