ATLAS Offline Software
AFPProtonTransportTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3  */
4 
7 #include <string>
8 #include <fstream>
9 #include <math.h>
10 
11 AFPProtonTransportTool::AFPProtonTransportTool(const std::string & type, const std::string & name, const IInterface* parent) : AthAlgTool(type, name, parent) {
12 
13  declareInterface<IAFPProtonTransportTool>(this);
14 
15 }
16 
18 
19  ATH_MSG_INFO("AFPProtonTransportTool::initialize Initializing transport tool");
20 
21  return StatusCode::SUCCESS;
22 }
23 
25 
27  std::ifstream file;
28  file.open(m_filename);
29  ATH_MSG_INFO("AFPProtonTransportTool::load "<<m_filename);
30  if (!file.is_open()) return StatusCode::FAILURE;
31 
33 
34  while (file.peek() == '#') {
35  char ch;
36  std::string name;
37  file >> ch >> name;
38 
39  //Fetching variable values from the txt file
40  if (name == "m_xPositionInitIP") {
41  double value;
42  file >> value;
44  }
45  if (name == "m_yPositionInitIP") {
46  double value;
47  file >> value;
49  }
50  if (name == "m_zPositionInitIP") {
51  double value;
52  file >> value;
54  }
55  if (name == "m_xSlopeInitIP") {
56  double value;
57  file >> value;
59  }
60  if (name == "m_ySlopeInitIP") {
61  double value;
62  file >> value;
64  }
65  if (name == "m_detectorPosition") {
66  double value;
67  file >> value;
69  }
70  if (name == "m_nominalEnergy") {
71  double value;
72  file >> value;
73  m_energy = value;
74  }
75 
76  file.ignore(1000, '\n');
77  }
78 
79  //Fetching the polynomial coeficients
80  for (int iEqu = 0; iEqu < 4; iEqu++) {
81  file.ignore(1000, '\n');
82  for (int iPoly = 0; iPoly < 8; iPoly++) {
83  int N = 0;
84  file >> N;
85  double ch[10];
86  for (int i = 0; i < 10; i++) {
87  if (i <= N) file >> ch[i];
88  else ch[i] = 0;
89  }
90  file.ignore(1000, '\n');
91 
92  //Create polynomial object with the coeficients loaded from the file
93  pol[iEqu][iPoly] =
94  new AFPProtonTransportPolynomial(N, ch[0], ch[1], ch[2], ch[3], ch[4], ch[5], ch[6], ch[7], ch[8], ch[9]);
95  }
96  }
97  //Creating the Parameterization objects with the polynomials created
102 
103  return StatusCode::SUCCESS;
104 }
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AFPProtonTransportTool::m_parametrisationPosition
Gaudi::Property< double > m_parametrisationPosition
Detector position for which the parameterisation has been done.
Definition: AFPProtonTransportTool.h:89
AFPProtonTransportTool::m_ySlopeInitIP
Gaudi::Property< double > m_ySlopeInitIP
Beam crossing angle from y axis at the interaction point.
Definition: AFPProtonTransportTool.h:79
athena.value
value
Definition: athena.py:122
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
AFPProtonTransportPolynomial.h
AFPProtonTransportTool::m_x_position
AFPProtonTransportParam * m_x_position
AFPProtonTransportParam object used for the x position evaluation.
Definition: AFPProtonTransportTool.h:68
lumiFormat.i
int i
Definition: lumiFormat.py:92
AFPProtonTransportTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AFPProtonTransportTool::m_yPositionInitIP
Gaudi::Property< double > m_yPositionInitIP
Proton's initial y position at the interaction point.
Definition: AFPProtonTransportTool.h:83
file
TFile * file
Definition: tile_monitor.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AFPProtonTransportPolynomial
Definition: AFPProtonTransportPolynomial.h:8
AFPProtonTransportTool::m_xSlopeInitIP
Gaudi::Property< double > m_xSlopeInitIP
Beam crossing angle from x axis at the interaction point.
Definition: AFPProtonTransportTool.h:77
AFPProtonTransportTool::~AFPProtonTransportTool
virtual ~AFPProtonTransportTool()
Definition: AFPProtonTransportTool.cxx:24
AFPProtonTransportTool::m_filename
Gaudi::Property< std::string > m_filename
Definition: AFPProtonTransportTool.h:91
AFPProtonTransportTool::m_y_slope
AFPProtonTransportParam * m_y_slope
AFPProtonTransportParam object used for the y slope.
Definition: AFPProtonTransportTool.h:74
AFPProtonTransportTool::m_y_position
AFPProtonTransportParam * m_y_position
AFPProtonTransportParam object used for the y position evaluation.
Definition: AFPProtonTransportTool.h:70
AFPProtonTransportParam
Class for the parameterization used by the proton transport tool.
Definition: AFPProtonTransportParam.h:16
AFPProtonTransportTool::AFPProtonTransportTool
AFPProtonTransportTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: AFPProtonTransportTool.cxx:11
AFPProtonTransportTool::initialize
virtual StatusCode initialize() override
Definition: AFPProtonTransportTool.cxx:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AFPProtonTransportTool::m_x_slope
AFPProtonTransportParam * m_x_slope
AFPProtonTransportParam object used for the x slope.
Definition: AFPProtonTransportTool.h:72
AFPProtonTransportTool::m_energy
Gaudi::Property< double > m_energy
Nominal beam energy.
Definition: AFPProtonTransportTool.h:87
AFPProtonTransportTool::m_zPositionInitIP
Gaudi::Property< double > m_zPositionInitIP
Proton's initial z position at the interaction point.
Definition: AFPProtonTransportTool.h:85
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AFPProtonTransportTool::load
virtual StatusCode load() override
Loads parametrization file and gets the value of positions, slopes and nominal energy....
Definition: AFPProtonTransportTool.cxx:26
AthAlgTool
Definition: AthAlgTool.h:26
AFPProtonTransportTool::m_xPositionInitIP
Gaudi::Property< double > m_xPositionInitIP
Proton's initial x position at the interaction point.
Definition: AFPProtonTransportTool.h:81