SDetector/PMT.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <sstream>
3 #include <boost/lexical_cast.hpp>
4 #include <sdet/Station.h>
5 #include <sdet/PMT.h>
6 #include <sdet/SDetector.h>
7 #include <det/Detector.h>
8 #include <utl/ErrorLogger.h>
9 #include <utl/MustFind.h>
10 
11 using namespace det;
12 using namespace std;
13 using namespace utl;
14 
15 
16 namespace sdet {
17 
18  PMT::PMT(const int pid, const int sid,
19  const int isUUB,
20  const PMTConstants::PMTType ptype) :
21  fPMTId(pid),
22  fStationId(sid),
23  fIsUUB(isUUB),
24  fType(ptype),
25  fIndexMap({
26  { "PMTId", boost::lexical_cast<string>(pid) },
27  { "stationId", boost::lexical_cast<string>(sid) },
28  { "isUUB", boost::lexical_cast<string>(isUUB) }
29  })
30  { }
31 
32 
33  PMT::~PMT()
34  {
35  delete fCollectionEfficiency;
36  delete fWorkingGain;
37  delete fQuantumEfficiency;
38  delete fPosition;
39  delete fFaceRefractionIndex;
40  delete fRTVRefractionIndex;
41  delete fDomeRefractionIndex;
43  delete fPulseShape;
44  delete fMinCharge;
45  delete fMaxCharge;
46  delete fEffectiveArea;
47  delete fVEMPeak;
48  delete fVEMCharge;
49  delete fBaselineLG;
50  delete fBaselineHG;
51  delete fBaselineLGRMS;
52  delete fBaselineHGRMS;
53  delete fGainRatio;
54  delete fGainRatioRMS;
55  delete fMultiplierLG;
56  delete fMultiplierHG;
59  delete fHighGainDelay;
60  delete fTimeOffset;
61  }
62 
63 
64  double
66  const
67  {
68  return GetPMTData(fWorkingGain, "workingGain", "PMT", "PMT working gain");
69  }
70 
71 
72  double
74  const
75  {
76  return GetPMTData(fCollectionEfficiency, "collectionEfficiency", "PMT", "collection efficiency");
77  }
78 
79 
80  const TabulatedFunction&
82  const
83  {
84  return GetPMTData(fQuantumEfficiency, "quantumEfficiency", "PMT", "quantum efficiency");
85  }
86 
87 
88  double
90  const
91  {
92  return GetPMTData(fEffectiveArea, "effectiveArea", "PMT", "effective area");
93  }
94 
95 
96  const Point&
98  const
99  {
100  if (!fPosition) {
101  // Note that the PMT position is a property of the tank (not the PMT).
102  // This seems reasonable, because the PMT position is determined by
103  // where holes are drilled in the tank. Also, the detector description
104  // currently has one PMT description that applies to all 3 PMT's in a
105  // tank, so the position cannot be a PMT property.
106 
107  vector<double>* coords = nullptr;
108  GetPMTData(coords, "PMTPosition", "tankPMTConfig", "PMT coordinates");
109 
110  // Return the PMT position in a coordinate system whose origin is at
111  // the intersection of the ground and the central axis of the tank
112 
113  const auto& cs = Detector::GetInstance().GetSDetector().GetStation(fStationId).GetLocalCoordinateSystem();
114  const auto& xyz = *coords;
115  fPosition = new Point(xyz[0], xyz[1], xyz[2], cs);
116 
117  delete coords;
118  }
119  return *fPosition;
120  }
121 
122 
123  const TabulatedFunction&
125  const
126  {
127  return GetPMTData(fFaceRefractionIndex, "faceRefractionIndex", "PMT", "index of refraction for PMT face");
128  }
129 
130 
131  const TabulatedFunction&
133  const
134  {
135  return GetPMTData(fRTVRefractionIndex, "RTVRefractionIndex", "PMT", "index of refraction for RTV");
136  }
137 
138 
139  const TabulatedFunction&
141  const
142  {
143  return GetPMTData(fDomeRefractionIndex, "domeRefractionIndex", "PMT", "index of refraction for PMT dome");
144  }
145 
146 
147  const vector<double>&
149  const
150  {
151  return GetPMTData(fChargeProbabilityDistribution, "chargeProbabilityDistribution", "PMT",
152  "probability distribution for charge at PMT base from SPEs");
153  }
154 
155 
156  const TabulatedFunction&
158  const
159  {
160  return GetPMTData(fPulseShape, "anodePulseShape", "PMT", "pulse shape at PMT base for SPE");
161  }
162 
163 
164  double
166  const
167  {
168  return GetPMTData(fMinCharge, "minCharge", "PMT", "minimum charge at PMT base from SPE");
169  }
170 
171 
172  double
174  const
175  {
176  return GetPMTData(fMaxCharge, "maxCharge", "PMT", "maximum charge at PMT base from SPE");
177  }
178 
179 
180  void
181  PMT::NotFoundAndThrow(const string& msg)
182  const
183  {
184  ostringstream err;
185  err << "Did not find requested component: '" << msg << "', "
186  "requested station = " << fIndexMap["stationId"] << ", "
187  "requested PMT = " << fIndexMap["PMTId"];
188  throw NonExistentComponentException(err.str());
189  }
190 
191 
192  double
193  PMT::GetVEMPeak(const std::string& simId)
194  const
195  {
196  return GetPMTData(fVEMPeak, "peak", simId, "VEM peak for simulated calibration");
197  }
198 
199 
200  double
201  PMT::GetCompatibilityVEMPeak(const std::string& simId)
202  const
203  {
204  return GetPMTData(fVEMPeak, "compatibilityPeak", simId, "VEM peak for simulated UUB calibration");
205  }
206 
207 
208  double
210  const
211  {
212  switch (fType) {
213  case PMTConstants::eWaterCherenkovLarge: return fIsUUB ? 150 : 50;
214  case PMTConstants::eScintillator: return fIsUUB ? 25 : 17;
215  default: return 0;
216  }
217  }
218 
219 
220  double
221  PMT::GetVEMCharge(const std::string& simId)
222  const
223  {
224  return GetPMTData(fVEMCharge, "charge", simId, "VEM charge for simulated calibration");
225  }
226 
227 
228  double
230  const
231  {
232  switch (fType) {
233  case PMTConstants::eWaterCherenkovLarge: return fIsUUB ? 1450 : 130;
234  case PMTConstants::eScintillator: return fIsUUB ? 157 : 30;
235  default: return 0;
236  }
237  }
238 
239 
240  double
242  const
243  {
244  return GetPMTData(fGainRatio, "DA", "pmtElectronics", "D/A for simulations");
245  }
246 
247 
248  double
250  const
251  {
252  return GetPMTData(fGainRatioRMS, "DARMS", "pmtElectronics", "RMS of D/A for simulated calibration");
253  }
254 
255 
256  double
258  const
259  {
260  if (channel == PMTConstants::eHighGain)
261  return GetPMTData(fMultiplierHG, "dynodeMultiplier", "pmtElectronics", "dynode multiplier");
262  else if (channel == PMTConstants::eLowGain)
263  return GetPMTData(fMultiplierLG, "anodeMultiplier", "pmtElectronics", "anode multiplier");
264  return 0;
265  }
266 
267 
268  double
270  const
271  {
272  return GetPMTData(fCurrent2VoltageMultiplier, "current2VoltageMultiplier", "pmtElectronics", "current to voltage multiplier");
273  }
274 
275 
276  double
278  const
279  {
280  return GetPMTData(fVoltage2FADCMultiplier, "voltage2FADCMultiplier", "pmtElectronics", "voltage to FADC multiplier");
281  }
282 
283 
284  double
286  const
287  {
288  return GetPMTData(fHighGainDelay, "dynode2AnodeDelay", "pmtElectronics", "dynode to anode delay time");
289  }
290 
291 
292  double
294  const
295  {
296  return GetPMTData(fTimeOffset, "timeOffset", "pmtElectronics", "time offset relative to UB large WCD PMT HG");
297  }
298 
299 
300  double
302  const
303  {
304  if (channel == PMTConstants::eHighGain)
305  return GetPMTData(fBaselineHG, "HGBaseline", "pmtElectronics", "HG baseline for simulated calibration");
306  else if (channel == PMTConstants::eLowGain)
307  return GetPMTData(fBaselineLG, "LGBaseline", "pmtElectronics", "LG baseline for simulated calibration");
308  return 0;
309  }
310 
311 
312  double
314  const
315  {
316  if (channel == PMTConstants::eHighGain)
317  return GetPMTData(fBaselineHGRMS, "HGBaselineRMS", "pmtElectronics", "HG baseline RMS for simulated calibration");
318  else if (channel == PMTConstants::eLowGain)
319  return GetPMTData(fBaselineLGRMS, "LGBaselineRMS", "pmtElectronics", "LG baseline RMS for simulated calibration");
320  return 0;
321  }
322 
323 
324  void
325  PMT::Update()
326  const
327  {
328  // Clearing variables that may change in time
329  delete fVEMPeak;
330  fVEMPeak = nullptr;
331 
332  delete fVEMCharge;
333  fVEMCharge = nullptr;
334  }
335 
336 }
double * fBaselineHG
double GetMaxCharge() const
double GetBaseline(const sdet::PMTConstants::PMTGain gain) const
Get baseline level for the PMT (for simulations)
const T & GetPMTData(T *&data, const std::string &property, const std::string &component, const std::string &errorMsg) const
double GetGainRatioRMS() const
Get RMS of dynode anode ration for the PMT (for simulations)
double GetMultiplier(const sdet::PMTConstants::PMTGain gain) const
double * fBaselineLGRMS
double GetNominalVEMPeak() const
what HV setting tries to target in HG
Point object.
Definition: Point.h:32
utl::TabulatedFunction * fFaceRefractionIndex
const utl::TabulatedFunction & GetDomeRefractionIndex() const
Refraction index for the PMT dome.
const std::vector< double > & GetChargeProbabilityDistribution() const
utl::TabulatedFunction * fPulseShape
double * fMultiplierLG
utl::TabulatedFunction * fDomeRefractionIndex
double * fGainRatio
Class to hold collection (x,y) points and provide interpolation between them.
double GetTimeOffset() const
double GetNominalVEMCharge() const
Get nominal value for the VEM charge.
double GetHighGainDelay() const
double GetCurrent2VoltageMultiplier() const
double GetMinCharge() const
Base class for exceptions trying to access non-existing components.
double * fGainRatioRMS
double GetCompatibilityVEMPeak(const std::string &simulationIdentifier) const
Get VEM peak for the PMT (for simulations)
const utl::TabulatedFunction & GetPulseShape() const
double * fWorkingGain
double GetCollectionEfficiency() const
Collection efficiency.
double GetEffectiveArea() const
const PMTConstants::PMTType fType
double * fVEMCharge
const utl::Point & GetPosition() const
PMT position.
det::VManager::IndexMap fIndexMap
utl::Point * fPosition
double * fBaselineHGRMS
double GetVEMPeak(const std::string &simulationIdentifier) const
Get VEM peak for the PMT (for simulations)
double * fEffectiveArea
double GetGainRatio() const
Get dynode to anode ratio for the PMT (for simulations)
double * fVoltage2FADCMultiplier
std::vector< double > * fChargeProbabilityDistribution
double * fMaxCharge
double * fVEMPeak
void NotFoundAndThrow(const std::string &msg) const
double GetWorkingGain() const
PMT Working Gain.
const utl::TabulatedFunction & GetQuantumEfficiency() const
Quantum efficiency.
double * fHighGainDelay
double * fTimeOffset
utl::TabulatedFunction * fRTVRefractionIndex
utl::TabulatedFunction * fQuantumEfficiency
double GetVEMCharge(const std::string &simulationIdentifier) const
Get VEM charge for the PMT (for simulations)
const utl::TabulatedFunction & GetFaceRefractionIndex() const
Refraction index for the PMT face.
double * fMinCharge
double * fMultiplierHG
double GetVoltage2FADCMultiplier() const
const utl::TabulatedFunction & GetRTVRefractionIndex() const
Refraction index for the interface between PMT face and dome (RTV)
double * fBaselineLG
void Update() const
double * fCollectionEfficiency
double GetBaselineRMS(const sdet::PMTConstants::PMTGain gain) const
Get baseline noise for the PMT (for simulations)
double * fCurrent2VoltageMultiplier

, generated on Tue Sep 26 2023.