ATLAS Offline Software
TilePulseShapes.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <iostream>
7 #include <fstream>
8 #include <string>
10 
12  : m_loaded(false)
13  , m_shapes(nullptr)
14 {
15 }
16 
18 {
19  if (m_shapes) delete m_shapes;
20 }
21 
22 void
24 
25  bool debug = (log.level() <= MSG::DEBUG);
26  if(debug) log<<MSG::DEBUG<<"TilePulseShapes::load"<<endmsg;
27 
29 
30  // Read in CIS Low gain pulse shape, big cap 100 pF
32 
33  // Read in CIS Low gain derivative shape, big cap 100 pF
35 
36  // Read in CIS Low gain pulse shape, small cap 5.2 pF
38 
39  // Read in CIS Low gain derivative shape, small cap 5.2 pF
41 
42  // Read in CIS Low gain leakage 5.2 pF cap
44 
45  // Read in CIS Low gain leakage 100 pF cap
47 
48  // Read in CIS Low gain leakage Derivative 5.2 pF cap
50 
51  // Read in CIS Low gain leakage Derivative 100 pF cap
53 
54  // Read in CIS High gain pulse shape, big cap 100 pF
56 
57  // Read in CIS High gain derivative shape, big cap 100 pF
59 
60  // Read in CIS High gain pulse shape, small cap 5.2 pF
62 
63  // Read in CIS High gain derivative shape, small cap 5.2 pF
65 
66  // Read in CIS High gain leakage 5.2 pF cap
68 
69  // Read in CIS High gain leakage 100 pF cap
71 
72  // Read in CIS High gain leakage Derivative 5.2 pF cap
74 
75  // Read in CIS High gain leakage Derivative 100 pF cap
77 
78  // Read in Low gain pulse shape Physics
80 
81  // Read in Low gain pulse shape derivative for Physics
83 
84  // Read in Hi gain pulse shape Physics
86 
87  // Read in Hi gain pulse shape derivative for Physics
89 
90  // Read in Low gain pulse shape Laser
92 
93  // Read in Low gain pulse shape derivative for Laser
95 
96  // Read in Hi gain pulse shape Laser
98 
99  // Read in Hi gain pulse shape derivative for Laser
101 
102  // Read in Digitizer noise RMS as a function of channel number (1) Original noise
103  ReadFile(log,m_filenameOrigNoise,"noiseOrigLo","noiseOrigHi",m_shapes->m_noiseOrigLo,m_shapes->m_noiseOrigHi,-1);
104 
105  // (2) Noise with resistors added to PMT channels (so-called noise-killers)
106  ReadFile(log,m_filenameNkNoise,"noiseNkLo","noiseNkHi",m_shapes->m_noiseNkLo,m_shapes->m_noiseNkHi,-1);
107 
108  m_loaded = true;
109 }
110 
111 bool
112 TilePulseShapes::ReadFile(MsgStream &log, const std::string& fname, const char *xname, const char *yname,
113  std::vector<double> & x, std::vector<double> & y, int nskip)
114 {
115  bool status=false;
116  std::string fileName = PathResolver::find_file(fname, "DATAPATH");
117  std::ifstream inFile(fileName.c_str());
118 
119  if(inFile.is_open()) {
120  bool debug = (log.level() <= MSG::DEBUG);
121  bool verbose = (log.level() <= MSG::VERBOSE);
122  if(debug) log<<MSG::DEBUG<<"Reading file '"<<fname<<"'"<<endmsg;
123  std::string name;
124  for(int i=0; i<nskip && !inFile.eof(); ++i) { // skip nskip lines
125  if ((std::getline(inFile,name)).fail()) break;
126  }
127  x.reserve(100);
128  y.reserve(100);
129  int i=0;
130  double xx,yy;
131  while ( inFile>>xx>>yy ) {
132  if (nskip<0) { // skip one word
133  xx=yy;
134  inFile>>yy;
135  }
136  x.push_back(xx);
137  y.push_back(yy);
138  if(verbose)
139  log<<MSG::VERBOSE<<" i="<<(i++)
140  <<" "<<xname<<"="<<xx
141  <<" "<<yname<<"="<<yy
142  <<endmsg;
143  }
144  status=true;
145  } else {
146  log<<MSG::ERROR<<"Unable to open file '"<<fname<<"'"<<endmsg;
147  }
148  inFile.close();
149  return status;
150 }
TilePulseShapesStruct::m_yllas
std::vector< double > m_yllas
Definition: TilePulseShapes.h:63
TilePulseShapesStruct::m_ydhphys
std::vector< double > m_ydhphys
Definition: TilePulseShapes.h:97
TilePulseShapesStruct::m_tllas
std::vector< double > m_tllas
Low Gain Pulse Laser.
Definition: TilePulseShapes.h:62
TilePulseShapes::m_filenameHiPhysDer
std::string m_filenameHiPhysDer
Definition: TilePulseShapes.h:160
TilePulseShapesStruct::m_tlphys
std::vector< double > m_tlphys
Low Gain Pulse Physics.
Definition: TilePulseShapes.h:54
TilePulseShapesStruct::m_tdleakhi
std::vector< double > m_tdleakhi
Definition: TilePulseShapes.h:86
TilePulseShapes::load
void load(MsgStream &log)
Definition: TilePulseShapes.cxx:23
TilePulseShapes::m_filenameLoLas
std::string m_filenameLoLas
Definition: TilePulseShapes.h:163
TilePulseShapesStruct::m_ylphys
std::vector< double > m_ylphys
Definition: TilePulseShapes.h:55
TilePulseShapes::m_filenameLoCISDer
std::string m_filenameLoCISDer
Definition: TilePulseShapes.h:138
PlotCalibFromCool.yy
yy
Definition: PlotCalibFromCool.py:714
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
TilePulseShapes::m_filenameDLeakLo
std::string m_filenameDLeakLo
Definition: TilePulseShapes.h:150
TilePulseShapesStruct::m_tdllas
std::vector< double > m_tdllas
Low Gain Pulse Laser.
Definition: TilePulseShapes.h:100
TilePulseShapesStruct::m_ydlphys
std::vector< double > m_ydlphys
Definition: TilePulseShapes.h:93
TilePulseShapesStruct::m_dleakhi
std::vector< double > m_dleakhi
Definition: TilePulseShapes.h:87
TilePulseShapes::m_filenameLoPhys
std::string m_filenameLoPhys
Definition: TilePulseShapes.h:157
TilePulseShapes::m_filenameHiLas
std::string m_filenameHiLas
Definition: TilePulseShapes.h:164
makeTOC.inFile
string inFile
Definition: makeTOC.py:5
TilePulseShapesStruct::m_ylcis
std::vector< double > m_ylcis
Definition: TilePulseShapes.h:35
TilePulseShapesStruct::m_yhphys
std::vector< double > m_yhphys
Definition: TilePulseShapes.h:59
TilePulseShapesStruct::m_tsleaklo
std::vector< double > m_tsleaklo
Definition: TilePulseShapes.h:40
TilePulseShapesStruct::m_tdlphys
std::vector< double > m_tdlphys
Low Gain Pulse Physics.
Definition: TilePulseShapes.h:92
TilePulseShapes::m_filenameHiCISDer
std::string m_filenameHiCISDer
Definition: TilePulseShapes.h:142
TilePulseShapesStruct::m_tleakhi
std::vector< double > m_tleakhi
Definition: TilePulseShapes.h:48
TilePulseShapesStruct::m_noiseNkHi
std::vector< double > m_noiseNkHi
Definition: TilePulseShapes.h:115
TilePulseShapes::TilePulseShapes
TilePulseShapes()
Definition: TilePulseShapes.cxx:11
TilePulseShapesStruct::m_tdhcis
std::vector< double > m_tdhcis
Hi Gain Pulse CIS.
Definition: TilePulseShapes.h:82
x
#define x
TilePulseShapesStruct::m_thphys
std::vector< double > m_thphys
Hi Gain Pulse Physics.
Definition: TilePulseShapes.h:58
TilePulseShapes::m_shapes
TilePulseShapesStruct * m_shapes
Definition: TilePulseShapes.h:173
TilePulseShapesStruct::m_yhlas
std::vector< double > m_yhlas
Definition: TilePulseShapes.h:67
TilePulseShapes::m_filenameSHiCISDer
std::string m_filenameSHiCISDer
Definition: TilePulseShapes.h:144
TilePulseShapesStruct::m_tslcis
std::vector< double > m_tslcis
Definition: TilePulseShapes.h:36
TilePulseShapesStruct::m_ydlcis
std::vector< double > m_ydlcis
Definition: TilePulseShapes.h:73
TilePulseShapes::~TilePulseShapes
~TilePulseShapes()
Definition: TilePulseShapes.cxx:17
TilePulseShapesStruct::m_dsleaklo
std::vector< double > m_dsleaklo
Definition: TilePulseShapes.h:79
TilePulseShapes::m_filenameSLeakLo
std::string m_filenameSLeakLo
Definition: TilePulseShapes.h:147
TilePulseShapes::m_filenameSLeakHi
std::string m_filenameSLeakHi
Definition: TilePulseShapes.h:151
TilePulseShapes::m_filenameHiPhys
std::string m_filenameHiPhys
Definition: TilePulseShapes.h:158
TilePulseShapesStruct::m_ydslcis
std::vector< double > m_ydslcis
Definition: TilePulseShapes.h:75
TilePulseShapesStruct::m_yhcis
std::vector< double > m_yhcis
Definition: TilePulseShapes.h:45
TilePulseShapes.h
TilePulseShapes::m_filenameHiCIS
std::string m_filenameHiCIS
Definition: TilePulseShapes.h:141
TilePulseShapesStruct::m_tshcis
std::vector< double > m_tshcis
Definition: TilePulseShapes.h:46
TilePulseShapesStruct::m_dleaklo
std::vector< double > m_dleaklo
Definition: TilePulseShapes.h:77
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
TilePulseShapesStruct::m_yshcis
std::vector< double > m_yshcis
Definition: TilePulseShapes.h:47
TilePulseShapesStruct::m_ydllas
std::vector< double > m_ydllas
Definition: TilePulseShapes.h:101
TilePulseShapes::m_filenameLoPhysDer
std::string m_filenameLoPhysDer
Definition: TilePulseShapes.h:159
TilePulseShapesStruct::m_noiseNkLo
std::vector< double > m_noiseNkLo
(2) Noise with resistors added to PMT channels (so-called noise-killers)
Definition: TilePulseShapes.h:114
lumiFormat.i
int i
Definition: lumiFormat.py:85
TilePulseShapes::m_filenameSLoCIS
std::string m_filenameSLoCIS
Definition: TilePulseShapes.h:139
TilePulseShapes::m_filenameHiLasDer
std::string m_filenameHiLasDer
Definition: TilePulseShapes.h:166
TilePulseShapesStruct::m_leakhi
std::vector< double > m_leakhi
Definition: TilePulseShapes.h:49
TilePulseShapes::m_loaded
bool m_loaded
Definition: TilePulseShapes.h:172
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TilePulseShapesStruct::m_thcis
std::vector< double > m_thcis
Hi Gain Pulse CIS.
Definition: TilePulseShapes.h:44
TilePulseShapes::ReadFile
bool ReadFile(MsgStream &log, const std::string &fname, const char *xname, const char *yname, std::vector< double > &x, std::vector< double > &y, int nskip=0)
Definition: TilePulseShapes.cxx:112
TilePulseShapesStruct::m_leaklo
std::vector< double > m_leaklo
Definition: TilePulseShapes.h:39
TilePulseShapes::m_filenameNkNoise
std::string m_filenameNkNoise
Definition: TilePulseShapes.h:170
TilePulseShapesStruct::m_ydhlas
std::vector< double > m_ydhlas
Definition: TilePulseShapes.h:105
TilePulseShapesStruct::m_noiseOrigHi
std::vector< double > m_noiseOrigHi
Definition: TilePulseShapes.h:111
TilePulseShapesStruct
Definition: TilePulseShapes.h:31
TilePulseShapesStruct::m_dsleakhi
std::vector< double > m_dsleakhi
Definition: TilePulseShapes.h:89
TilePulseShapesStruct::m_tdhlas
std::vector< double > m_tdhlas
Hi Gain Pulse Laser.
Definition: TilePulseShapes.h:104
TilePulseShapesStruct::m_tdsleaklo
std::vector< double > m_tdsleaklo
Definition: TilePulseShapes.h:78
TilePulseShapesStruct::m_tdhphys
std::vector< double > m_tdhphys
Hi Gain Pulse Physics.
Definition: TilePulseShapes.h:96
TilePulseShapesStruct::m_ydshcis
std::vector< double > m_ydshcis
Definition: TilePulseShapes.h:85
PathResolver.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
TilePulseShapes::m_filenameDSLeakHi
std::string m_filenameDSLeakHi
Definition: TilePulseShapes.h:153
mc.nskip
nskip
Definition: mc.PhPy8EG_Hto4l_NNLOPS_nnlo_30_ggH125_ZZ4l.py:41
TilePulseShapes::m_filenameSLoCISDer
std::string m_filenameSLoCISDer
Definition: TilePulseShapes.h:140
TilePulseShapesStruct::m_tleaklo
std::vector< double > m_tleaklo
Definition: TilePulseShapes.h:38
TilePulseShapesStruct::m_tdshcis
std::vector< double > m_tdshcis
Definition: TilePulseShapes.h:84
TilePulseShapes::m_filenameLeakLo
std::string m_filenameLeakLo
Definition: TilePulseShapes.h:148
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
TilePulseShapes::m_filenameLeakHi
std::string m_filenameLeakHi
Definition: TilePulseShapes.h:152
TilePulseShapesStruct::m_tlcis
std::vector< double > m_tlcis
Low Gain Pulse CIS.
Definition: TilePulseShapes.h:34
TilePulseShapesStruct::m_sleaklo
std::vector< double > m_sleaklo
Definition: TilePulseShapes.h:41
TilePulseShapesStruct::m_tsleakhi
std::vector< double > m_tsleakhi
Definition: TilePulseShapes.h:50
y
#define y
TilePulseShapesStruct::m_yslcis
std::vector< double > m_yslcis
Definition: TilePulseShapes.h:37
TilePulseShapes::m_filenameSHiCIS
std::string m_filenameSHiCIS
Definition: TilePulseShapes.h:143
TilePulseShapesStruct::m_tdslcis
std::vector< double > m_tdslcis
Definition: TilePulseShapes.h:74
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
DEBUG
#define DEBUG
Definition: page_access.h:11
TilePulseShapesStruct::m_sleakhi
std::vector< double > m_sleakhi
Definition: TilePulseShapes.h:51
TilePulseShapes::m_filenameDLeakHi
std::string m_filenameDLeakHi
Definition: TilePulseShapes.h:154
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TilePulseShapes::m_filenameDSLeakLo
std::string m_filenameDSLeakLo
Definition: TilePulseShapes.h:149
TilePulseShapes::m_filenameLoLasDer
std::string m_filenameLoLasDer
Definition: TilePulseShapes.h:165
TilePulseShapes::m_filenameLoCIS
std::string m_filenameLoCIS
Definition: TilePulseShapes.h:137
TilePulseShapes::m_filenameOrigNoise
std::string m_filenameOrigNoise
Definition: TilePulseShapes.h:169
merge.status
status
Definition: merge.py:17
TilePulseShapesStruct::m_tdsleakhi
std::vector< double > m_tdsleakhi
Definition: TilePulseShapes.h:88
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
TilePulseShapesStruct::m_thlas
std::vector< double > m_thlas
Hi Gain Pulse Laser.
Definition: TilePulseShapes.h:66
TilePulseShapesStruct::m_tdlcis
std::vector< double > m_tdlcis
Low Gain Pulse CIS.
Definition: TilePulseShapes.h:72
TilePulseShapesStruct::m_tdleaklo
std::vector< double > m_tdleaklo
Definition: TilePulseShapes.h:76
beamspotman.fail
def fail(message)
Definition: beamspotman.py:201
TilePulseShapesStruct::m_ydhcis
std::vector< double > m_ydhcis
Definition: TilePulseShapes.h:83
TilePulseShapesStruct::m_noiseOrigLo
std::vector< double > m_noiseOrigLo
(1) Original noise
Definition: TilePulseShapes.h:110