ATLAS Offline Software
Loading...
Searching...
No Matches
TilePulseShapes.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <iostream>
7#include <fstream>
8#include <string>
10
15
19
20void
21TilePulseShapes::load(MsgStream &log) {
22
23 bool debug = (log.level() <= MSG::DEBUG);
24 if(debug) log<<MSG::DEBUG<<"TilePulseShapes::load"<<endmsg;
25
26 m_shapes = std::make_unique<TilePulseShapesStruct>();
27
28 // Read in CIS Low gain pulse shape, big cap 100 pF
29 ReadFile(log,m_filenameLoCIS, "tlcis", "ylcis", m_shapes->m_tlcis, m_shapes->m_ylcis);
30
31 // Read in CIS Low gain derivative shape, big cap 100 pF
32 ReadFile(log,m_filenameLoCISDer,"tdlcis","ydlcis",m_shapes->m_tdlcis,m_shapes->m_ydlcis);
33
34 // Read in CIS Low gain pulse shape, small cap 5.2 pF
35 ReadFile(log,m_filenameSLoCIS,"tslcis","yslcis",m_shapes->m_tslcis,m_shapes->m_yslcis);
36
37 // Read in CIS Low gain derivative shape, small cap 5.2 pF
38 ReadFile(log,m_filenameSLoCISDer,"tdslcis","ydslcis",m_shapes->m_tdslcis,m_shapes->m_ydslcis);
39
40 // Read in CIS Low gain leakage 5.2 pF cap
41 ReadFile(log,m_filenameSLeakLo,"tsleaklo","sleaklo",m_shapes->m_tsleaklo,m_shapes->m_sleaklo);
42
43 // Read in CIS Low gain leakage 100 pF cap
44 ReadFile(log,m_filenameLeakLo,"tleaklo","leaklo",m_shapes->m_tleaklo,m_shapes->m_leaklo);
45
46 // Read in CIS Low gain leakage Derivative 5.2 pF cap
47 ReadFile(log,m_filenameDSLeakLo,"tdsleaklo","dsleaklo",m_shapes->m_tdsleaklo,m_shapes->m_dsleaklo);
48
49 // Read in CIS Low gain leakage Derivative 100 pF cap
50 ReadFile(log,m_filenameDLeakLo,"tdleaklo","dleaklo",m_shapes->m_tdleaklo,m_shapes->m_dleaklo);
51
52 // Read in CIS High gain pulse shape, big cap 100 pF
53 ReadFile(log,m_filenameHiCIS,"thcis","yhcis",m_shapes->m_thcis,m_shapes->m_yhcis);
54
55 // Read in CIS High gain derivative shape, big cap 100 pF
56 ReadFile(log,m_filenameHiCISDer,"tdhcis","ydhcis",m_shapes->m_tdhcis,m_shapes->m_ydhcis);
57
58 // Read in CIS High gain pulse shape, small cap 5.2 pF
59 ReadFile(log,m_filenameSHiCIS,"tshcis","yshcis",m_shapes->m_tshcis,m_shapes->m_yshcis);
60
61 // Read in CIS High gain derivative shape, small cap 5.2 pF
62 ReadFile(log,m_filenameSHiCISDer,"tdshcis","ydshcis",m_shapes->m_tdshcis,m_shapes->m_ydshcis);
63
64 // Read in CIS High gain leakage 5.2 pF cap
65 ReadFile(log,m_filenameSLeakHi,"tsleakhi","sleakhi",m_shapes->m_tsleakhi,m_shapes->m_sleakhi);
66
67 // Read in CIS High gain leakage 100 pF cap
68 ReadFile(log,m_filenameLeakHi,"tleakhi","leakhi",m_shapes->m_tleakhi,m_shapes->m_leakhi);
69
70 // Read in CIS High gain leakage Derivative 5.2 pF cap
71 ReadFile(log,m_filenameDSLeakHi,"tdsleakhi","dsleakhi",m_shapes->m_tdsleakhi,m_shapes->m_dsleakhi);
72
73 // Read in CIS High gain leakage Derivative 100 pF cap
74 ReadFile(log,m_filenameDLeakHi,"tdleakhi","dleakhi",m_shapes->m_tdleakhi,m_shapes->m_dleakhi);
75
76 // Read in Low gain pulse shape Physics
77 ReadFile(log,m_filenameLoPhys,"tlphys","ylphys",m_shapes->m_tlphys,m_shapes->m_ylphys,4);
78
79 // Read in Low gain pulse shape derivative for Physics
80 ReadFile(log,m_filenameLoPhysDer,"tdlphys","ydlphys",m_shapes->m_tdlphys,m_shapes->m_ydlphys);
81
82 // Read in Hi gain pulse shape Physics
83 ReadFile(log,m_filenameHiPhys,"thphys","yhphys",m_shapes->m_thphys,m_shapes->m_yhphys,4);
84
85 // Read in Hi gain pulse shape derivative for Physics
86 ReadFile(log,m_filenameHiPhysDer,"tdhphys","ydhphys",m_shapes->m_tdhphys,m_shapes->m_ydhphys);
87
88 // Read in Low gain pulse shape Laser
89 ReadFile(log,m_filenameLoLas,"tllas","yllas",m_shapes->m_tllas,m_shapes->m_yllas);
90
91 // Read in Low gain pulse shape derivative for Laser
92 ReadFile(log,m_filenameLoLasDer,"tdllas","ydllas",m_shapes->m_tdllas,m_shapes->m_ydllas);
93
94 // Read in Hi gain pulse shape Laser
95 ReadFile(log,m_filenameHiLas,"thlas","yhlas",m_shapes->m_thlas,m_shapes->m_yhlas);
96
97 // Read in Hi gain pulse shape derivative for Laser
98 ReadFile(log,m_filenameHiLasDer,"tdhlas","ydhlas",m_shapes->m_tdhlas,m_shapes->m_ydhlas);
99
100 // Read in Digitizer noise RMS as a function of channel number (1) Original noise
101 ReadFile(log,m_filenameOrigNoise,"noiseOrigLo","noiseOrigHi",m_shapes->m_noiseOrigLo,m_shapes->m_noiseOrigHi,-1);
102
103 // (2) Noise with resistors added to PMT channels (so-called noise-killers)
104 ReadFile(log,m_filenameNkNoise,"noiseNkLo","noiseNkHi",m_shapes->m_noiseNkLo,m_shapes->m_noiseNkHi,-1);
105
106 m_loaded = true;
107}
108
109bool
110TilePulseShapes::ReadFile(MsgStream &log, const std::string& fname, const char *xname, const char *yname,
111 std::vector<double> & x, std::vector<double> & y, int nskip)
112{
113 bool status=false;
114 std::string fileName = PathResolver::find_file(fname, "DATAPATH");
115 std::ifstream inFile(fileName.c_str());
116
117 if(inFile.is_open()) {
118 bool debug = (log.level() <= MSG::DEBUG);
119 bool verbose = (log.level() <= MSG::VERBOSE);
120 if(debug) log<<MSG::DEBUG<<"Reading file '"<<fname<<"'"<<endmsg;
121 std::string name;
122 for(int i=0; i<nskip && !inFile.eof(); ++i) { // skip nskip lines
123 if ((std::getline(inFile,name)).fail()) break;
124 }
125 x.reserve(100);
126 y.reserve(100);
127 int i=0;
128 double xx,yy;
129 while ( inFile>>xx>>yy ) {
130 if (nskip<0) { // skip one word
131 xx=yy;
132 inFile>>yy;
133 }
134 x.push_back(xx);
135 y.push_back(yy);
136 if(verbose)
137 log<<MSG::VERBOSE<<" i="<<(i++)
138 <<" "<<xname<<"="<<xx
139 <<" "<<yname<<"="<<yy
140 <<endmsg;
141 }
142 status=true;
143 } else {
144 log<<MSG::ERROR<<"Unable to open file '"<<fname<<"'"<<endmsg;
145 }
146 inFile.close();
147 return status;
148}
#define endmsg
const bool debug
#define y
#define x
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
std::string m_filenameDSLeakHi
std::string m_filenameHiCIS
std::string m_filenameHiCISDer
std::string m_filenameLeakLo
std::string m_filenameLoCIS
std::string m_filenameLoPhys
std::string m_filenameSLoCISDer
std::string m_filenameLeakHi
std::string m_filenameHiLasDer
std::string m_filenameSLoCIS
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)
void load(MsgStream &log)
std::string m_filenameSLeakLo
std::string m_filenameHiPhysDer
std::string m_filenameDLeakLo
std::string m_filenameSHiCISDer
std::string m_filenameDLeakHi
std::string m_filenameOrigNoise
std::string m_filenameLoPhysDer
std::string m_filenameSHiCIS
std::unique_ptr< TilePulseShapesStruct > m_shapes
std::string m_filenameLoLas
std::string m_filenameSLeakHi
std::string m_filenameDSLeakLo
std::string m_filenameNkNoise
std::string m_filenameHiPhys
std::string m_filenameHiLas
std::string m_filenameLoCISDer
std::string m_filenameLoLasDer
bool verbose
Definition hcg.cxx:73