ATLAS Offline Software
Loading...
Searching...
No Matches
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
21
22void
23TilePulseShapes::load(MsgStream &log) {
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
31 ReadFile(log,m_filenameLoCIS, "tlcis", "ylcis", m_shapes->m_tlcis, m_shapes->m_ylcis);
32
33 // Read in CIS Low gain derivative shape, big cap 100 pF
34 ReadFile(log,m_filenameLoCISDer,"tdlcis","ydlcis",m_shapes->m_tdlcis,m_shapes->m_ydlcis);
35
36 // Read in CIS Low gain pulse shape, small cap 5.2 pF
37 ReadFile(log,m_filenameSLoCIS,"tslcis","yslcis",m_shapes->m_tslcis,m_shapes->m_yslcis);
38
39 // Read in CIS Low gain derivative shape, small cap 5.2 pF
40 ReadFile(log,m_filenameSLoCISDer,"tdslcis","ydslcis",m_shapes->m_tdslcis,m_shapes->m_ydslcis);
41
42 // Read in CIS Low gain leakage 5.2 pF cap
43 ReadFile(log,m_filenameSLeakLo,"tsleaklo","sleaklo",m_shapes->m_tsleaklo,m_shapes->m_sleaklo);
44
45 // Read in CIS Low gain leakage 100 pF cap
46 ReadFile(log,m_filenameLeakLo,"tleaklo","leaklo",m_shapes->m_tleaklo,m_shapes->m_leaklo);
47
48 // Read in CIS Low gain leakage Derivative 5.2 pF cap
49 ReadFile(log,m_filenameDSLeakLo,"tdsleaklo","dsleaklo",m_shapes->m_tdsleaklo,m_shapes->m_dsleaklo);
50
51 // Read in CIS Low gain leakage Derivative 100 pF cap
52 ReadFile(log,m_filenameDLeakLo,"tdleaklo","dleaklo",m_shapes->m_tdleaklo,m_shapes->m_dleaklo);
53
54 // Read in CIS High gain pulse shape, big cap 100 pF
55 ReadFile(log,m_filenameHiCIS,"thcis","yhcis",m_shapes->m_thcis,m_shapes->m_yhcis);
56
57 // Read in CIS High gain derivative shape, big cap 100 pF
58 ReadFile(log,m_filenameHiCISDer,"tdhcis","ydhcis",m_shapes->m_tdhcis,m_shapes->m_ydhcis);
59
60 // Read in CIS High gain pulse shape, small cap 5.2 pF
61 ReadFile(log,m_filenameSHiCIS,"tshcis","yshcis",m_shapes->m_tshcis,m_shapes->m_yshcis);
62
63 // Read in CIS High gain derivative shape, small cap 5.2 pF
64 ReadFile(log,m_filenameSHiCISDer,"tdshcis","ydshcis",m_shapes->m_tdshcis,m_shapes->m_ydshcis);
65
66 // Read in CIS High gain leakage 5.2 pF cap
67 ReadFile(log,m_filenameSLeakHi,"tsleakhi","sleakhi",m_shapes->m_tsleakhi,m_shapes->m_sleakhi);
68
69 // Read in CIS High gain leakage 100 pF cap
70 ReadFile(log,m_filenameLeakHi,"tleakhi","leakhi",m_shapes->m_tleakhi,m_shapes->m_leakhi);
71
72 // Read in CIS High gain leakage Derivative 5.2 pF cap
73 ReadFile(log,m_filenameDSLeakHi,"tdsleakhi","dsleakhi",m_shapes->m_tdsleakhi,m_shapes->m_dsleakhi);
74
75 // Read in CIS High gain leakage Derivative 100 pF cap
76 ReadFile(log,m_filenameDLeakHi,"tdleakhi","dleakhi",m_shapes->m_tdleakhi,m_shapes->m_dleakhi);
77
78 // Read in Low gain pulse shape Physics
79 ReadFile(log,m_filenameLoPhys,"tlphys","ylphys",m_shapes->m_tlphys,m_shapes->m_ylphys,4);
80
81 // Read in Low gain pulse shape derivative for Physics
82 ReadFile(log,m_filenameLoPhysDer,"tdlphys","ydlphys",m_shapes->m_tdlphys,m_shapes->m_ydlphys);
83
84 // Read in Hi gain pulse shape Physics
85 ReadFile(log,m_filenameHiPhys,"thphys","yhphys",m_shapes->m_thphys,m_shapes->m_yhphys,4);
86
87 // Read in Hi gain pulse shape derivative for Physics
88 ReadFile(log,m_filenameHiPhysDer,"tdhphys","ydhphys",m_shapes->m_tdhphys,m_shapes->m_ydhphys);
89
90 // Read in Low gain pulse shape Laser
91 ReadFile(log,m_filenameLoLas,"tllas","yllas",m_shapes->m_tllas,m_shapes->m_yllas);
92
93 // Read in Low gain pulse shape derivative for Laser
94 ReadFile(log,m_filenameLoLasDer,"tdllas","ydllas",m_shapes->m_tdllas,m_shapes->m_ydllas);
95
96 // Read in Hi gain pulse shape Laser
97 ReadFile(log,m_filenameHiLas,"thlas","yhlas",m_shapes->m_thlas,m_shapes->m_yhlas);
98
99 // Read in Hi gain pulse shape derivative for Laser
100 ReadFile(log,m_filenameHiLasDer,"tdhlas","ydhlas",m_shapes->m_tdhlas,m_shapes->m_ydhlas);
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
111bool
112TilePulseShapes::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}
#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)
TilePulseShapesStruct * m_shapes
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::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