Belle II Software  release-05-02-19
TOPGeometryPar.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Petric, Marko Staric *
7  * Major revision: 2016 *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <top/dbobjects/TOPGeometry.h>
15 #include <top/geometry/FrontEndMapper.h>
16 #include <top/geometry/ChannelMapper.h>
17 #include <framework/database/DBObjPtr.h>
18 #include <framework/database/DBArray.h>
19 #include <top/dbobjects/TOPPmtInstallation.h>
20 #include <top/dbobjects/TOPPmtQE.h>
21 #include <top/dbobjects/TOPNominalQE.h>
22 #include <top/dbobjects/TOPCalChannelRQE.h>
23 #include <top/dbobjects/TOPCalChannelThresholdEff.h>
24 #include <string>
25 #include <map>
26 
27 namespace Belle2 {
32  namespace TOP {
33 
38  class TOPGeometryPar {
39 
40  public:
41 
45  virtual ~TOPGeometryPar();
46 
51  static TOPGeometryPar* Instance();
52 
57  void Initialize(const GearDir& content);
58 
62  void Initialize();
63 
68  bool isValid() const {return m_valid;}
69 
74  const TOPGeometry* getGeometry() const;
75 
80  const FrontEndMapper& getFrontEndMapper() const {return m_frontEndMapper;}
81 
86  const ChannelMapper& getChannelMapper() const {return m_channelMapperIRSX;}
87 
92  const ChannelMapper& getChannelMapper(ChannelMapper::EType type) const
93  {
94  switch (type) {
95  case ChannelMapper::c_IRS3B: return m_channelMapperIRS3B;
96  case ChannelMapper::c_IRSX: return m_channelMapperIRSX;
97  default: return m_channelMapperIRSX;
98  }
99  }
100 
107  double getPMTEfficiencyEnvelope(double energy) const;
108 
118  double getPMTEfficiency(double energy,
119  int moduleID, int pmtID, double x, double y) const;
120 
125  double getRelativePixelEfficiency(int moduleID, int pixelID) const;
126 
133  unsigned getPMTType(int moduleID, int pmtID) const;
134 
141  const TOPNominalTTS& getTTS(int moduleID, int pmtID) const;
142 
143  static const double c_hc;
145  private:
146 
151  {}
152 
156  void finalizeInitialization();
157 
162  TOPGeometry* createConfiguration(const GearDir& content);
163 
170  const std::string& serialNumber);
171 
178  const std::string& serialNumber);
179 
185  TOPGeoPrism createPrism(const GearDir& content,
186  const std::string& serialNumber);
187 
194  std::string addNumber(const std::string& str, unsigned number);
195 
199  void clearCache();
200 
204  void setEnvelopeQE() const;
205 
209  void mapPmtQEToPositions() const;
210 
214  void mapPmtTypeToPositions() const;
215 
219  void prepareRelEfficiencies() const;
220 
227  int getUniquePmtID(int moduleID, int pmtID) const
228  {
229  return (moduleID << 16) + pmtID;
230  }
231 
238  int getUniquePixelID(int moduleID, int pixelID) const
239  {
240  return (moduleID << 16) + pixelID;
241  }
242 
251  double integralOfQE(const std::vector<float>& qe, double ce,
252  double lambdaFirst, double lambdaStep) const;
253 
254  // Geometry
255 
256  TOPGeometry* m_geo = 0;
258  bool m_fromDB = false;
259  bool m_valid = false;
260  bool m_oldPayload = false;
261  bool m_BfieldOn = true;
263  // Mappings
264 
269  // PMT database
270 
276  // cache
277  mutable TOPNominalQE m_envelopeQE;
278  mutable std::map<int, const TOPPmtQE*> m_pmts;
279  mutable std::map<int, double> m_relEfficiencies;
280  mutable std::map<int, unsigned> m_pmtTypes;
282  // Other
283 
284  static TOPGeometryPar* s_instance;
286  };
287 
288  } // end of namespace TOP
290 } // end of namespace Belle2
Belle2::TOP::TOPGeometryPar::integralOfQE
double integralOfQE(const std::vector< float > &qe, double ce, double lambdaFirst, double lambdaStep) const
Returns integral of quantum efficiency over photon energies.
Definition: TOPGeometryPar.cc:421
Belle2::TOP::TOPGeometryPar::getUniquePmtID
int getUniquePmtID(int moduleID, int pmtID) const
Returns unique PMT ID within the detector.
Definition: TOPGeometryPar.h:236
Belle2::TOPNominalTTS
Nominal time transition spread of PMT.
Definition: TOPNominalTTS.h:33
Belle2::TOPGeoPrism
Geometry parameters of prism.
Definition: TOPGeoPrism.h:36
Belle2::TOPGeometry
Geometry parameters of TOP.
Definition: TOPGeometry.h:44
Belle2::TOP::ChannelMapper
Provides mapping between electronic channels and pixels.
Definition: ChannelMapper.h:37
Belle2::TOP::TOPGeometryPar::m_thresholdEff
DBObjPtr< TOPCalChannelThresholdEff > m_thresholdEff
channel threshold effi.
Definition: TOPGeometryPar.h:283
Belle2::TOPGeoBarSegment
Geometry parameters of a quartz bar segment.
Definition: TOPGeoBarSegment.h:37
Belle2::TOP::TOPGeometryPar::m_valid
bool m_valid
true if geometry is available
Definition: TOPGeometryPar.h:268
Belle2::TOP::TOPGeometryPar::clearCache
void clearCache()
Clears cache for PMT dependent QE data - function is used in call backs.
Definition: TOPGeometryPar.cc:159
Belle2::TOP::ChannelMapper::EType
EType
Enum for electornic types.
Definition: ChannelMapper.h:59
Belle2::TOP::FrontEndMapper
Provides mapping between electronics module position within a TOP module and SCROD ID,...
Definition: FrontEndMapper.h:41
Belle2::TOPNominalQE
Nominal quantum efficiency of PMT.
Definition: TOPNominalQE.h:33
Belle2::TOP::TOPGeometryPar::finalizeInitialization
void finalizeInitialization()
finalize initialization
Definition: TOPGeometryPar.cc:137
Belle2::TOP::TOPGeometryPar::m_channelMapperIRSX
ChannelMapper m_channelMapperIRSX
channel-pixel mapper
Definition: TOPGeometryPar.h:276
Belle2::TOP::TOPGeometryPar::m_pmtInstalled
OptionalDBArray< TOPPmtInstallation > m_pmtInstalled
PMT installation data.
Definition: TOPGeometryPar.h:280
Belle2::TOP::TOPGeometryPar::s_instance
static TOPGeometryPar * s_instance
Pointer to the class instance.
Definition: TOPGeometryPar.h:293
Belle2::TOP::TOPGeometryPar::~TOPGeometryPar
virtual ~TOPGeometryPar()
Destructor.
Definition: TOPGeometryPar.cc:37
Belle2::TOP::TOPGeometryPar::addNumber
std::string addNumber(const std::string &str, unsigned number)
Adds number to string.
Definition: TOPGeometryPar.cc:948
Belle2::TOP::TOPGeometryPar::getPMTEfficiencyEnvelope
double getPMTEfficiencyEnvelope(double energy) const
Returns PMT efficiency envelope, e.g.
Definition: TOPGeometryPar.cc:179
Belle2::TOP::TOPGeometryPar::TOPGeometryPar
TOPGeometryPar()
Hidden constructor since it is a singleton class.
Definition: TOPGeometryPar.h:159
Belle2::TOP::TOPGeometryPar::m_channelMapperIRS3B
ChannelMapper m_channelMapperIRS3B
channel-pixel mapper
Definition: TOPGeometryPar.h:275
Belle2::TOP::TOPGeometryPar::m_fromDB
bool m_fromDB
parameters from database or Gearbox
Definition: TOPGeometryPar.h:267
Belle2::TOP::TOPGeometryPar::m_channelRQE
DBObjPtr< TOPCalChannelRQE > m_channelRQE
channel relative quantum effi.
Definition: TOPGeometryPar.h:282
Belle2::TOP::TOPGeometryPar::getUniquePixelID
int getUniquePixelID(int moduleID, int pixelID) const
Returns unique pixel ID within the detector.
Definition: TOPGeometryPar.h:247
Belle2::TOP::TOPGeometryPar::Initialize
void Initialize()
Initialize from database.
Definition: TOPGeometryPar.cc:91
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::TOP::TOPGeometryPar::mapPmtQEToPositions
void mapPmtQEToPositions() const
Maps PMT QE data to positions within the detector.
Definition: TOPGeometryPar.cc:342
Belle2::TOP::TOPGeometryPar::Instance
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
Definition: TOPGeometryPar.cc:45
Belle2::TOP::TOPGeometryPar::m_pmts
std::map< int, const TOPPmtQE * > m_pmts
QE data mapped to positions.
Definition: TOPGeometryPar.h:287
Belle2::TOP::TOPGeometryPar::createConfiguration
TOPGeometry * createConfiguration(const GearDir &content)
Create a parameter object from gearbox.
Definition: TOPGeometryPar.cc:439
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::GearDir
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:41
Belle2::OptionalDBArray
Optional DBArray: This class behaves the same as the DBArray except that it will not raise errors whe...
Definition: DBArray.h:107
Belle2::TOP::TOPGeometryPar::m_geoDB
DBObjPtr< TOPGeometry > * m_geoDB
geometry parameters from database
Definition: TOPGeometryPar.h:266
Belle2::TOP::TOPGeometryPar::getPMTType
unsigned getPMTType(int moduleID, int pmtID) const
Returns PMT type at a given position.
Definition: TOPGeometryPar.cc:248
Belle2::TOP::TOPGeometryPar::c_hc
static const double c_hc
Planck constant times speed of light in [eV*nm].
Definition: TOPGeometryPar.h:152
Belle2::TOP::TOPGeometryPar::createPrism
TOPGeoPrism createPrism(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for prism.
Definition: TOPGeometryPar.cc:923
Belle2::TOP::TOPGeometryPar::getRelativePixelEfficiency
double getRelativePixelEfficiency(int moduleID, int pixelID) const
Returns relative pixel efficiency (including CE, RQE and threshold efficiency)
Definition: TOPGeometryPar.cc:225
Belle2::TOPGeoMirrorSegment
Geometry parameters of a mirror segment.
Definition: TOPGeoMirrorSegment.h:32
Belle2::TOP::TOPGeometryPar::m_envelopeQE
TOPNominalQE m_envelopeQE
envelope quantum efficiency
Definition: TOPGeometryPar.h:286
Belle2::TOP::TOPGeometryPar::m_BfieldOn
bool m_BfieldOn
true if B field is on
Definition: TOPGeometryPar.h:270
Belle2::TOP::TOPGeometryPar::m_relEfficiencies
std::map< int, double > m_relEfficiencies
pixel relative QE
Definition: TOPGeometryPar.h:288
Belle2::TOP::TOPGeometryPar::getGeometry
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using Basf2 units.
Definition: TOPGeometryPar.cc:167
Belle2::TOP::TOPGeometryPar::createBarSegment
TOPGeoBarSegment createBarSegment(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for bar segment.
Definition: TOPGeometryPar.cc:870
Belle2::TOP::TOPGeometryPar::m_pmtTypes
std::map< int, unsigned > m_pmtTypes
PMT types mapped to positions.
Definition: TOPGeometryPar.h:289
Belle2::TOP::TOPGeometryPar::setEnvelopeQE
void setEnvelopeQE() const
Constructs envelope of quantum efficiency from PMT data.
Definition: TOPGeometryPar.cc:264
Belle2::TOP::TOPGeometryPar::m_frontEndMapper
FrontEndMapper m_frontEndMapper
front end electronics mapper
Definition: TOPGeometryPar.h:274
Belle2::TOP::TOPGeometryPar::m_geo
TOPGeometry * m_geo
geometry parameters from Gearbox
Definition: TOPGeometryPar.h:265
Belle2::TOP::TOPGeometryPar::prepareRelEfficiencies
void prepareRelEfficiencies() const
Prepares a map of relative pixel efficiencies.
Definition: TOPGeometryPar.cc:385
Belle2::TOP::TOPGeometryPar::createMirrorSegment
TOPGeoMirrorSegment createMirrorSegment(const GearDir &content, const std::string &serialNumber)
Create a parameter object from gearbox for mirror segment.
Definition: TOPGeometryPar.cc:893
Belle2::TOP::TOPGeometryPar
Singleton class for TOP Geometry Parameters.
Definition: TOPGeometryPar.h:47
Belle2::TOP::TOPGeometryPar::getPMTEfficiency
double getPMTEfficiency(double energy, int moduleID, int pmtID, double x, double y) const
Returns PMT pixel efficiency, a product of quantum and collection efficiency.
Definition: TOPGeometryPar.cc:191
Belle2::TOP::TOPGeometryPar::getChannelMapper
const ChannelMapper & getChannelMapper() const
Returns default channel mapper (mapping of channels to pixels)
Definition: TOPGeometryPar.h:95
Belle2::TOP::TOPGeometryPar::mapPmtTypeToPositions
void mapPmtTypeToPositions() const
Maps PMT type to positions within the detector.
Definition: TOPGeometryPar.cc:359
Belle2::TOP::TOPGeometryPar::m_pmtQEData
OptionalDBArray< TOPPmtQE > m_pmtQEData
quantum efficiencies
Definition: TOPGeometryPar.h:281
Belle2::TOP::TOPGeometryPar::isValid
bool isValid() const
check if the geometry is available
Definition: TOPGeometryPar.h:77
Belle2::TOP::TOPGeometryPar::m_oldPayload
bool m_oldPayload
true if old payload found in DB
Definition: TOPGeometryPar.h:269
Belle2::TOP::TOPGeometryPar::getFrontEndMapper
const FrontEndMapper & getFrontEndMapper() const
Returns front-end mapper (mapping of SCROD's to positions within TOP modules)
Definition: TOPGeometryPar.h:89
Belle2::TOP::TOPGeometryPar::getTTS
const TOPNominalTTS & getTTS(int moduleID, int pmtID) const
Returns TTS of a PMT at given position.
Definition: TOPGeometryPar.cc:257