ATLAS Offline Software
MdtStationT0Container.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <TString.h> // for Form
8 
9 #include <cstdlib>
10 #include <fstream>
11 #include <iostream>
12 
13 using namespace MuonCalib;
14 
15 //*****************************************************************************
16 
17 //:::::::::::::::
18 //:: METHOD t0 ::
19 //:::::::::::::::
20 
21 double MdtStationT0Container::t0(const unsigned int& ml, const unsigned int& ly, const unsigned int& tb) const {
22  if (!m_t0_loaded) return 9e9;
23  return m_t0[ml - 1][ly - 1][tb - 1];
24 }
25 
26 //*****************************************************************************
27 
28 //:::::::::::::::
29 //:: METHOD adc ::
30 //:::::::::::::::
31 
32 double MdtStationT0Container::adc(const unsigned int& ml, const unsigned int& ly, const unsigned int& tb) const {
33  if (!m_t0_loaded) return 9e9;
34  return m_adc[ml - 1][ly - 1][tb - 1];
35 }
36 
37 //*****************************************************************************
38 
39 //::::::::::::::::::
40 //:: METHOD Sett0 ::
41 //::::::::::::::::::
42 
43 bool MdtStationT0Container::Sett0(const unsigned int& ml, const unsigned int& ly, const unsigned int& tb, double t0, double adc) {
44  m_t0[ml - 1][ly - 1][tb - 1] = t0;
45  m_adc[ml - 1][ly - 1][tb - 1] = adc;
46  m_t0_loaded = true;
47 
48  return m_t0_loaded;
49 }
50 
51 //*****************************************************************************
52 
53 //:::::::::::::::::::::::
54 //:: METHOD readT0File ::
55 //:::::::::::::::::::::::
56 
57 void MdtStationT0Container::readT0File(const std::string& file_name) {
59  // VARIABLES //
61 
62  std::string sdummy; // auxiliary string for file reading
63  int idummy; // auxiliary integer for file reading
64  double dummy; // auxiliary double for file reading
65  int ml, ly, tb; // multilayer, layer, tube
66  std::ifstream infile; // t0 file
67 
69  // OPEN t0 file //
71 
72  infile.open(file_name.c_str());
73  if (infile.fail()) {
74  throw std::runtime_error(
75  Form("File: %s, Line: %d\nMdtStationT0Container::readT0File - Could not open file %s!", __FILE__, __LINE__, file_name.c_str()));
76  }
77 
79  // READ THE t0 FILE //
81 
82  // ignore the first line //
83  getline(infile, sdummy);
84 
85  // read the t0 look-up table //
86  while (!infile.eof()) {
87  // station name //
88  infile >> sdummy;
89  if (infile.eof()) { break; }
90 
91  // eta, phi, technology index //
92  infile >> idummy >> idummy >> idummy;
93 
94  // multilayer, layer, tube //
95  infile >> ml >> ly >> tb;
96 
97  // t0 //
98  infile >> m_t0[ml - 1][ly - 1][tb - 1];
99  infile >> m_adc[ml - 1][ly - 1][tb - 1];
100 
101  if (infile.fail()) return;
102 
103  // the rest of the line //
104  for (unsigned k = 0; k < 10; k++) { infile >> dummy; }
105  }
106  m_t0_loaded = true;
107  return;
108 }
MuonCalib::MdtStationT0Container::t0
double t0(const unsigned int &ml, const unsigned int &ly, const unsigned int &tb) const
get the t0 value of the tube tb in layer ly of multilayer ml; tb, ly, ml>0
Definition: MdtStationT0Container.cxx:21
MuonCalib::MdtStationT0Container::Sett0
bool Sett0(const unsigned int &ml, const unsigned int &ly, const unsigned int &tb, double t0, double adc=0)
set t0 value of the tube tb in layer ly of multilayer ml; tb, ly, ml>0
Definition: MdtStationT0Container.cxx:43
run.infile
string infile
Definition: run.py:13
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
MdtStationT0Container.h
MuonCalib::MdtStationT0Container::adc
double adc(const unsigned int &ml, const unsigned int &ly, const unsigned int &tb) const
get the t0 value of the tube tb in layer ly of multilayer ml; tb, ly, ml>0
Definition: MdtStationT0Container.cxx:32
physics_parameters.file_name
string file_name
Definition: physics_parameters.py:32
Execution.tb
tb
Definition: Execution.py:15
MuonCalib::MdtStationT0Container::readT0File
void readT0File(const std::string &file_name)
read the t0s stored in the file "file_name"
Definition: MdtStationT0Container.cxx:57
MuonCalib::MdtStationT0Container::m_t0
std::vector< std::vector< std::vector< double > > > m_t0
Definition: MdtStationT0Container.h:68
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
python.xAODType.dummy
dummy
Definition: xAODType.py:4
MuonCalib::MdtStationT0Container::m_adc
std::vector< std::vector< std::vector< double > > > m_adc
Definition: MdtStationT0Container.h:69
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
MuonCalib::MdtStationT0Container::m_t0_loaded
bool m_t0_loaded
Definition: MdtStationT0Container.h:75
fitman.k
k
Definition: fitman.py:528