ATLAS Offline Software
Classes | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
AFP::Parameterization Class Reference

Class representing transport parameterisation as four Equation. More...

#include <Parameterization.h>

Collaboration diagram for AFP::Parameterization:

Classes

class  Equation
 Local class for storing parameterization equation. More...
 

Public Member Functions

 Parameterization (std::string_view filename)
 Takes filename of parametrization file as argument. More...
 
double x (double x0, double y0, double z0, double sx0, double sy0, double E) const
 Evaluates value of horizontal position equation. More...
 
double y (double x0, double y0, double z0, double sx0, double sy0, double E) const
 Evaluates value of vertical position equation. More...
 
double sx (double x0, double y0, double z0, double sx0, double sy0, double E) const
 Evaluates value of horizontal slope equation. More...
 
double sy (double x0, double y0, double z0, double sx0, double sy0, double E) const
 Evaluates value of vertical slope equation. More...
 
double parametrizationPosition () const
 Returns position for which parametrization was performed. More...
 
double energy () const
 Returns nominal energy for which parametrization was performed. More...
 
const EquationgetEquation (int iEqu) const
 Returns const raw pointer to equation of number iEqu. More...
 
bool yIsUsed () const
 Returns m_yIsUsed. More...
 

Private Attributes

std::array< double, 2 > m_slopeInitIP
 Crossing angles in rad. More...
 
std::array< double, 3 > m_positionInitIP
 Initial vertex postition. More...
 
double m_energy
 Nominal beam energy. More...
 
double m_parametrizationPosition
 Position for which the parameterisation was performed. More...
 
std::vector< std::unique_ptr< Equation > > m_equation
 Vector of equations: 0 - x, 1 - y, 2 - sx, 3 - sy. More...
 
bool m_yIsUsed
 True if y measurements are used in reconstruction. More...
 

Static Private Attributes

static constexpr int m_numberOfPolynomials = 8
 Number of polynomials in equation. More...
 
static constexpr int m_numberOfEquations = 4
 Number of equations - each for one measured value. More...
 

Detailed Description

Class representing transport parameterisation as four Equation.

Definition at line 23 of file Parameterization.h.

Constructor & Destructor Documentation

◆ Parameterization()

AFP::Parameterization::Parameterization ( std::string_view  filename)

Takes filename of parametrization file as argument.

Loads parametrization file.

Definition at line 9 of file Parameterization.cxx.

10  std::cout << "Reading parameterization from file: \"" << filename << "\"" << '\n';
11 
12  std::ifstream file;
13  file.open(filename.data());
14  if(!file.is_open()) {
15  std::stringstream errorMsg;
16  errorMsg << "Parameterization::load(): \tCould not open parameterization file: \"" << filename << "\"";
17  throw std::runtime_error(errorMsg.str().data());
18  }
19 
20  while (file.peek() == '#') {
21  char ch;
22  std::string name;
23  file >> ch >> name;
24 
25  if (name == "m_xPositionInitIP") { double value; file >> value; std::cout << '\t' << name << ": " << value << '\n'; m_positionInitIP[0] = value; }
26  if (name == "m_yPositionInitIP") { double value; file >> value; std::cout << '\t' << name << ": " << value << '\n'; m_positionInitIP[1] = value; }
27  if (name == "m_zPositionInitIP") { double value; file >> value; std::cout << '\t' << name << ": " << value << '\n'; m_positionInitIP[2] = value; }
28  if (name == "m_xSlopeInitIP") { double value; file >> value; std::cout << '\t' << name << ": " << value << '\n'; m_slopeInitIP[0] = value; }
29  if (name == "m_ySlopeInitIP") { double value; file >> value; std::cout << '\t' << name << ": " << value << '\n'; m_slopeInitIP[1] = value; }
30  if (name == "m_detectorPosition") { double value; file >> value; std::cout << '\t' << name << ": " << value << '\n'; m_parametrizationPosition = value; }
31  if (name == "m_nominalEnergy") { double value; file >> value; std::cout << '\t' << name << ": " << value << '\n'; m_energy = value; }
32 
33  file.ignore(1000, '\n');
34  }
35 
36  std::vector<std::unique_ptr<TF1>> poly;
37 
38  m_yIsUsed = false;
39 
40  for (int iEqu = 0; iEqu < m_numberOfEquations; iEqu++) {
41  file.ignore(1000, '\n');
42  std::vector<double> coef;
43 
44  for (int iPoly = 0; iPoly < m_numberOfPolynomials; iPoly++) {
45  int N = 0;
46  file >> N;
47  double value;
48 
49  for (int i = 0; i <= N; i++) {
50  if (file.eof()) {
51  std::stringstream errorMsg;
52  errorMsg << "Parameterization::load(): \tFile \"" << filename
53  << "\" does not contain a correct parameterization";
54  throw std::runtime_error(errorMsg.str().data());
55  }
56 
57  file >> value;
58  coef.push_back(value);
59  }
60 
61  file.ignore(1000, '\n');
62 
63  TString name;
64  name.Form("pol%d", N);
65  auto temp = std::make_unique<TF1>(name, name);
66  for (int iCoef = 0; iCoef <= N; ++iCoef) {
67  temp->SetParameter(iCoef, coef.at(iCoef));
68  }
69 
70  // For y-dependent equation check if polynomials are non-zero order
71  if (iEqu == 1 or iEqu == 3) {
72  m_yIsUsed = m_yIsUsed or not (N == 0 and coef[0] == 0);
73  }
74 
75  poly.push_back(std::move(temp));
76  coef.clear();
77  }
78 
79  m_equation.push_back(std::make_unique<Equation>(m_energy, std::move(poly)));
80  poly.clear();
81  }
82 
83  std::cout << "Finished reading parameterization: \"" << filename << "\"\n\n";
84  }

Member Function Documentation

◆ energy()

double AFP::Parameterization::energy ( ) const
inline

Returns nominal energy for which parametrization was performed.

Definition at line 66 of file Parameterization.h.

66 { return m_energy; }

◆ getEquation()

const Equation* AFP::Parameterization::getEquation ( int  iEqu) const
inline

Returns const raw pointer to equation of number iEqu.

Definition at line 69 of file Parameterization.h.

69 { return m_equation.at(iEqu).get(); }

◆ parametrizationPosition()

double AFP::Parameterization::parametrizationPosition ( ) const
inline

Returns position for which parametrization was performed.

Definition at line 63 of file Parameterization.h.

63 { return m_parametrizationPosition; }

◆ sx()

double AFP::Parameterization::sx ( double  x0,
double  y0,
double  z0,
double  sx0,
double  sy0,
double  E 
) const

Evaluates value of horizontal slope equation.

Definition at line 94 of file Parameterization.cxx.

94  {
95  return getEquation(2)->evaluate(x0 + m_positionInitIP.at(0), y0 + m_positionInitIP.at(1), z0 + m_positionInitIP.at(2), sx0 + m_slopeInitIP.at(0), sy0 + m_slopeInitIP.at(1), E);
96  }

◆ sy()

double AFP::Parameterization::sy ( double  x0,
double  y0,
double  z0,
double  sx0,
double  sy0,
double  E 
) const

Evaluates value of vertical slope equation.

Definition at line 98 of file Parameterization.cxx.

98  {
99  return getEquation(3)->evaluate(x0 + m_positionInitIP.at(0), y0 + m_positionInitIP.at(1), z0 + m_positionInitIP.at(2), sx0 + m_slopeInitIP.at(0), sy0 + m_slopeInitIP.at(1), E);
100  }

◆ x()

double AFP::Parameterization::x ( double  x0,
double  y0,
double  z0,
double  sx0,
double  sy0,
double  E 
) const

Evaluates value of horizontal position equation.

Definition at line 86 of file Parameterization.cxx.

86  {
87  return getEquation(0)->evaluate(x0 + m_positionInitIP.at(0), y0 + m_positionInitIP.at(1), z0 + m_positionInitIP.at(2), sx0 + m_slopeInitIP.at(0), sy0 + m_slopeInitIP.at(1), E);
88  }

◆ y()

double AFP::Parameterization::y ( double  x0,
double  y0,
double  z0,
double  sx0,
double  sy0,
double  E 
) const

Evaluates value of vertical position equation.

Definition at line 90 of file Parameterization.cxx.

90  {
91  return getEquation(1)->evaluate(x0 + m_positionInitIP.at(0), y0 + m_positionInitIP.at(1), z0 + m_positionInitIP.at(2), sx0 + m_slopeInitIP.at(0), sy0 + m_slopeInitIP.at(1), E);
92  }

◆ yIsUsed()

bool AFP::Parameterization::yIsUsed ( ) const
inline

Returns m_yIsUsed.

Definition at line 72 of file Parameterization.h.

72 { return m_yIsUsed; }

Member Data Documentation

◆ m_energy

double AFP::Parameterization::m_energy
private

Nominal beam energy.

Definition at line 88 of file Parameterization.h.

◆ m_equation

std::vector<std::unique_ptr<Equation> > AFP::Parameterization::m_equation
private

Vector of equations: 0 - x, 1 - y, 2 - sx, 3 - sy.

Definition at line 94 of file Parameterization.h.

◆ m_numberOfEquations

constexpr int AFP::Parameterization::m_numberOfEquations = 4
staticconstexprprivate

Number of equations - each for one measured value.

Definition at line 79 of file Parameterization.h.

◆ m_numberOfPolynomials

constexpr int AFP::Parameterization::m_numberOfPolynomials = 8
staticconstexprprivate

Number of polynomials in equation.

Definition at line 76 of file Parameterization.h.

◆ m_parametrizationPosition

double AFP::Parameterization::m_parametrizationPosition
private

Position for which the parameterisation was performed.

Definition at line 91 of file Parameterization.h.

◆ m_positionInitIP

std::array<double, 3> AFP::Parameterization::m_positionInitIP
private

Initial vertex postition.

Definition at line 85 of file Parameterization.h.

◆ m_slopeInitIP

std::array<double, 2> AFP::Parameterization::m_slopeInitIP
private

Crossing angles in rad.

Definition at line 82 of file Parameterization.h.

◆ m_yIsUsed

bool AFP::Parameterization::m_yIsUsed
private

True if y measurements are used in reconstruction.

Definition at line 97 of file Parameterization.h.


The documentation for this class was generated from the following files:
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
DeMoUpdate.errorMsg
string errorMsg
Definition: DeMoUpdate.py:897
athena.value
value
Definition: athena.py:124
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
AFP::Parameterization::m_yIsUsed
bool m_yIsUsed
True if y measurements are used in reconstruction.
Definition: Parameterization.h:97
AFP::Parameterization::getEquation
const Equation * getEquation(int iEqu) const
Returns const raw pointer to equation of number iEqu.
Definition: Parameterization.h:69
AFP::Parameterization::m_parametrizationPosition
double m_parametrizationPosition
Position for which the parameterisation was performed.
Definition: Parameterization.h:91
AFP::Parameterization::m_equation
std::vector< std::unique_ptr< Equation > > m_equation
Vector of equations: 0 - x, 1 - y, 2 - sx, 3 - sy.
Definition: Parameterization.h:94
AFP::Parameterization::m_slopeInitIP
std::array< double, 2 > m_slopeInitIP
Crossing angles in rad.
Definition: Parameterization.h:82
MuonCalib::Legendre::poly
constexpr double poly(const double x)
Definition: LegendrePoly.h:116
lumiFormat.i
int i
Definition: lumiFormat.py:85
file
TFile * file
Definition: tile_monitor.h:29
AFP::Parameterization::m_energy
double m_energy
Nominal beam energy.
Definition: Parameterization.h:88
AFP::Parameterization::Equation::evaluate
double evaluate(double x, double y, double z, double sx, double sy, double E) const
Evaluates value of function with given initial positions, slopes and energy.
Definition: Parameterization.cxx:102
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
AFP::Parameterization::m_positionInitIP
std::array< double, 3 > m_positionInitIP
Initial vertex postition.
Definition: Parameterization.h:85
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
AFP::Parameterization::m_numberOfEquations
static constexpr int m_numberOfEquations
Number of equations - each for one measured value.
Definition: Parameterization.h:79
AFP::Parameterization::m_numberOfPolynomials
static constexpr int m_numberOfPolynomials
Number of polynomials in equation.
Definition: Parameterization.h:76
WriteCalibToCool.coef
coef
Definition: WriteCalibToCool.py:582