Belle II Software development
TOPGeometryPar.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <top/dbobjects/TOPGeometry.h>
12#include <top/geometry/FrontEndMapper.h>
13#include <top/geometry/ChannelMapper.h>
14#include <framework/database/DBObjPtr.h>
15#include <framework/database/DBArray.h>
16#include <top/dbobjects/TOPPmtInstallation.h>
17#include <top/dbobjects/TOPPmtQE.h>
18#include <top/dbobjects/TOPNominalQE.h>
19#include <top/dbobjects/TOPCalChannelRQE.h>
20#include <top/dbobjects/TOPCalChannelThresholdEff.h>
21#include <string>
22#include <map>
23
24namespace Belle2 {
29 namespace TOP {
30
36
37 public:
38
42 virtual ~TOPGeometryPar();
43
48 static TOPGeometryPar* Instance();
49
54 void Initialize(const GearDir& content);
55
59 void Initialize();
60
65 bool isValid() const {return m_valid;}
66
71 const TOPGeometry* getGeometry() const;
72
78
84
90 {
91 switch (type) {
92 case ChannelMapper::c_IRS3B: return m_channelMapperIRS3B;
93 case ChannelMapper::c_IRSX: return m_channelMapperIRSX;
94 default: return m_channelMapperIRSX;
95 }
96 }
97
104 double getPMTEfficiencyEnvelope(double energy) const;
105
115 double getPMTEfficiency(double energy,
116 int moduleID, int pmtID, double x, double y) const;
117
122 double getRelativePixelEfficiency(int moduleID, int pixelID) const;
123
130 unsigned getPMTType(int moduleID, int pmtID) const;
131
138 const TOPNominalTTS& getTTS(int moduleID, int pmtID) const;
139
145 double getPhaseIndex(double energy) const;
146
152 double getGroupIndex(double energy) const;
153
159 double getPhaseIndexDerivative(double energy) const;
160
166 double getGroupIndexDerivative(double energy) const;
167
173 double getAbsorptionLength(double energy) const;
174
175 static const double c_hc;
177 private:
178
183 {}
184
189
194 TOPGeometry* createConfiguration(const GearDir& content);
195
202 const std::string& serialNumber);
203
210 const std::string& serialNumber);
211
217 TOPGeoPrism createPrism(const GearDir& content,
218 const std::string& serialNumber);
219
226 std::string addNumber(const std::string& str, unsigned number);
227
231 void clearCache();
232
236 void setEnvelopeQE() const;
237
241 void mapPmtQEToPositions() const;
242
246 void mapPmtTypeToPositions() const;
247
251 void prepareRelEfficiencies() const;
252
259 int getUniquePmtID(int moduleID, int pmtID) const
260 {
261 return (moduleID << 16) + pmtID;
262 }
263
270 int getUniquePixelID(int moduleID, int pixelID) const
271 {
272 return (moduleID << 16) + pixelID;
273 }
274
283 double integralOfQE(const std::vector<float>& qe, double ce,
284 double lambdaFirst, double lambdaStep) const;
285
286
292 double refractiveIndex(double lambda) const;
293
294 // Geometry
295
298 bool m_fromDB = false;
299 bool m_valid = false;
300 bool m_oldPayload = false;
301 bool m_BfieldOn = true;
303 // Mappings
304
309 // PMT database
310
316 // cache
318 mutable std::map<int, const TOPPmtQE*> m_pmts;
319 mutable std::map<int, double> m_relEfficiencies;
320 mutable std::map<int, unsigned> m_pmtTypes;
322 // Other
323
326 };
327
328 inline double TOPGeometryPar::getPhaseIndexDerivative(double energy) const
329 {
330 double dE = 0.01; // [eV]
331 return (getPhaseIndex(energy + dE / 2) - getPhaseIndex(energy - dE / 2)) / dE;
332 }
333
334 inline double TOPGeometryPar::getGroupIndexDerivative(double energy) const
335 {
336 double dE = 0.01; // [eV]
337 return (getGroupIndex(energy + dE / 2) - getGroupIndex(energy - dE / 2)) / dE;
338 }
339
340 inline double TOPGeometryPar::getAbsorptionLength(double energy) const
341 {
342 double lambda = c_hc / energy;
343 return 15100 * pow(lambda / 405, 4); // Alan Schwartz, 2013 (private comunication)
344 }
345
346 } // end of namespace TOP
348} // end of namespace Belle2
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
Optional DBArray: This class behaves the same as the DBArray except that it will not raise errors whe...
Definition: DBArray.h:97
Geometry parameters of a quartz bar segment.
Geometry parameters of a mirror segment.
Geometry parameters of prism.
Definition: TOPGeoPrism.h:27
Geometry parameters of TOP.
Definition: TOPGeometry.h:34
Nominal quantum efficiency of PMT.
Definition: TOPNominalQE.h:24
Nominal time transition spread of PMT.
Definition: TOPNominalTTS.h:23
Provides mapping between electronic channels and pixels.
Definition: ChannelMapper.h:27
EType
Enum for electornic types.
Definition: ChannelMapper.h:49
Provides mapping between electronics module position within a TOP module and SCROD ID,...
Singleton class for TOP Geometry Parameters.
double integralOfQE(const std::vector< float > &qe, double ce, double lambdaFirst, double lambdaStep) const
Returns integral of quantum efficiency over photon energies.
TOPGeoPrism createPrism(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for prism.
virtual ~TOPGeometryPar()
Destructor.
OptionalDBArray< TOPPmtQE > m_pmtQEData
quantum efficiencies
double getRelativePixelEfficiency(int moduleID, int pixelID) const
Returns relative pixel efficiency (including CE, RQE and threshold efficiency)
bool m_BfieldOn
true if B field is on
double getPMTEfficiencyEnvelope(double energy) const
Returns PMT efficiency envelope, e.g.
bool m_fromDB
parameters from database or Gearbox
const ChannelMapper & getChannelMapper(ChannelMapper::EType type) const
Returns channel mapper (mapping of channels to pixels) - Gearbox only.
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
TOPGeoMirrorSegment createMirrorSegment(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for mirror segment.
DBObjPtr< TOPGeometry > * m_geoDB
geometry parameters from database
double getGroupIndexDerivative(double energy) const
Returns the derivative (dn_g/dE) of group refractive index of quartz at given photon energy.
unsigned getPMTType(int moduleID, int pmtID) const
Returns PMT type at a given position.
double getPhaseIndexDerivative(double energy) const
Returns the derivative (dn/dE) of phase refractive index of quartz at given photon energy.
void finalizeInitialization()
finalize initialization
int getUniquePixelID(int moduleID, int pixelID) const
Returns unique pixel ID within the detector.
const ChannelMapper & getChannelMapper() const
Returns default channel mapper (mapping of channels to pixels)
void prepareRelEfficiencies() const
Prepares a map of relative pixel efficiencies.
double getPMTEfficiency(double energy, int moduleID, int pmtID, double x, double y) const
Returns PMT pixel efficiency, a product of quantum and collection efficiency.
TOPGeometry * createConfiguration(const GearDir &content)
Create a parameter object from gearbox.
bool isValid() const
check if the geometry is available
DBObjPtr< TOPCalChannelThresholdEff > m_thresholdEff
channel threshold effi.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
TOPNominalQE m_envelopeQE
envelope quantum efficiency
std::map< int, unsigned > m_pmtTypes
PMT types mapped to positions.
const FrontEndMapper & getFrontEndMapper() const
Returns front-end mapper (mapping of SCROD's to positions within TOP modules)
DBObjPtr< TOPCalChannelRQE > m_channelRQE
channel relative quantum effi.
ChannelMapper m_channelMapperIRS3B
channel-pixel mapper
FrontEndMapper m_frontEndMapper
front end electronics mapper
std::string addNumber(const std::string &str, unsigned number)
Adds number to string.
static const double c_hc
Planck constant times speed of light in [eV*nm].
double getAbsorptionLength(double energy) const
Returns bulk absorption lenght of quartz at given photon energy.
const TOPNominalTTS & getTTS(int moduleID, int pmtID) const
Returns TTS of a PMT at given position.
std::map< int, const TOPPmtQE * > m_pmts
QE data mapped to positions.
bool m_valid
true if geometry is available
void clearCache()
Clears cache for PMT dependent QE data - function is used in call backs.
ChannelMapper m_channelMapperIRSX
channel-pixel mapper
void Initialize()
Initialize from database.
TOPGeoBarSegment createBarSegment(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for bar segment.
double getPhaseIndex(double energy) const
Returns phase refractive index of quartz at given photon energy.
double refractiveIndex(double lambda) const
Quartz refractive index (SellMeier equation)
bool m_oldPayload
true if old payload found in DB
void mapPmtQEToPositions() const
Maps PMT QE data to positions within the detector.
double getGroupIndex(double energy) const
Returns group refractive index of quartz at given photon energy.
TOPGeometry * m_geo
geometry parameters from Gearbox
TOPGeometryPar()
Hidden constructor since it is a singleton class.
void setEnvelopeQE() const
Constructs envelope of quantum efficiency from PMT data.
void mapPmtTypeToPositions() const
Maps PMT type to positions within the detector.
int getUniquePmtID(int moduleID, int pmtID) const
Returns unique PMT ID within the detector.
static TOPGeometryPar * s_instance
Pointer to the class instance.
OptionalDBArray< TOPPmtInstallation > m_pmtInstalled
PMT installation data.
std::map< int, double > m_relEfficiencies
pixel relative QE
Abstract base class for different kinds of events.