ATLAS Offline Software
Loading...
Searching...
No Matches
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
13using namespace MuonCalib;
14
15//*****************************************************************************
16
17//:::::::::::::::
18//:: METHOD t0 ::
19//:::::::::::::::
20
21double 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
32double 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
43bool 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
57void 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}
std::vector< std::vector< std::vector< double > > > m_adc
void readT0File(const std::string &file_name)
read the t0s stored in the file "file_name"
std::vector< std::vector< std::vector< double > > > m_t0
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
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
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
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.