Belle II Software development
BKLMGeometryPar.cc
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/* Own header. */
10#include <klm/dbobjects/bklm/BKLMGeometryPar.h>
11
12/* Basf2 headers. */
13#include <framework/gearbox/GearDir.h>
14#include <framework/logging/Logger.h>
15
16using namespace Belle2;
17
19{
20 read(content);
21}
22
24{
25}
26
27// Get BKLM geometry parameters from Gearbox (no calculations here)
28// *** This is a DIVOT ***
29void BKLMGeometryPar::read(const GearDir& content)
30{
31 if (!content) {
32 B2FATAL("The GearDir to look for BKLM geometry parameters is not valid.");
33 return;
34 }
35 char name[80] = "";
36 GearDir data(content);
37 data.append("/BKLM");
38 m_DoBeamBackgroundStudy = data.getBool("BeamBackgroundStudy");
39 m_Rotation = data.getAngle("Rotation");
40 m_OffsetZ = data.getLength("OffsetZ");
41 m_Phi = data.getLength("Phi");
42 m_NSector = data.getNumberNodes("Sectors/Forward/Sector");
43 if (m_NSector > BKLMElementNumbers::getMaximalSectorNumber()) { // array-bounds check
44 B2FATAL("BKLMGeometryPar::read(): sectors array size exceeded:"
45 << LogVar("# of sectors", m_NSector)
47 }
48 m_SolenoidOuterRadius = data.getLength("SolenoidOuterRadius");
49 m_OuterRadius = data.getLength("OuterRadius");
50 m_HalfLength = data.getLength("HalfLength");
51 m_NLayer = data.getNumberNodes("Layers/Layer");
52 if (m_NLayer > BKLMElementNumbers::getMaximalLayerNumber()) { // array-bounds check
53 B2FATAL("BKLMGeometryPar::read(): layer array size exceeded:"
54 << LogVar("# of layers", m_NLayer)
56 }
57
58 m_IronNominalHeight = data.getLength("Layers/IronNominalHeight");
59 m_IronActualHeight = data.getLength("Layers/IronActualHeight");
60 m_Gap1NominalHeight = data.getLength("Layers/Layer[@layer=\"1\"]/GapNominalHeight");
61 m_GapNominalHeight = data.getLength("Layers/GapNominalHeight");
62 m_Gap1InnerRadius = data.getLength("Layers/InnerRadius");
63 m_Gap1IronWidth = data.getLength("Layers/Layer[@layer=\"1\"]/GapIronWidth");
64 m_GapIronWidth = data.getLength("Layers/GapIronWidth");
65 m_GapLength = data.getLength("Layers/GapLength");
66
67 m_NZStrips = data.getInt("Layers/NZStrips");
68 m_NZStripsChimney = data.getInt("Layers/NZStripsChimney");
69 m_NZScints = data.getInt("Layers/NZScintillators");
70 m_NZScintsChimney = data.getInt("Layers/NZScintillatorsChimney");
71 m_NZScintsChimney = data.getInt("Layers/NZScintillatorsChimney");
72 if (m_NZScints > NZSCINT) { // array-bounds check
73 B2FATAL("BKLMGeometryPar::read(): z-scint array size exceeded:"
74 << LogVar("# of z scintillators", m_NZScints)
75 << LogVar("array size", NZSCINT));
76 }
77 if (m_NZScintsChimney > NZSCINT) { // array-bounds check
78 B2FATAL("BKLMGeometryPar::read(): chimney sector z-scint array size exceeded:"
79 << LogVar("# of z scintillators", m_NZScintsChimney)
80 << LogVar("array size", NZSCINT));
81 }
82
83 m_ModuleLength = data.getLength("Module/Length");
84 m_ModuleLengthChimney = data.getLength("Module/LengthChimney");
85 m_ModuleCoverHeight = data.getLength("Module/CoverHeight");
86 m_ModuleCopperHeight = data.getLength("Module/CopperHeight");
87 m_ModuleFoamHeight = data.getLength("Module/FoamHeight");
88 m_ModuleMylarHeight = data.getLength("Module/MylarHeight");
89 m_ModuleGlassHeight = data.getLength("Module/GlassHeight");
90 m_ModuleGasHeight = data.getLength("Module/GasHeight");
91 m_ModuleFrameWidth = data.getLength("Module/FrameWidth");
92 m_ModuleFrameThickness = data.getLength("Module/FrameThickness");
93 m_ModuleGasSpacerWidth = data.getLength("Module/SpacerWidth");
94 m_ModulePolystyreneInnerHeight = data.getLength("Module/PolystyreneInnerHeight");
95 m_ModulePolystyreneOuterHeight = data.getLength("Module/PolystyreneOuterHeight");
96 m_ScintWidth = data.getLength("Module/Scintillator/Width");
97 m_ScintHeight = data.getLength("Module/Scintillator/Height");
98 m_ScintBoreRadius = data.getLength("Module/Scintillator/BoreRadius");
99 m_ScintFiberRadius = data.getLength("Module/Scintillator/FiberRadius");
100 m_ScintTiO2ThicknessTop = data.getLength("Module/Scintillator/TiO2ThicknessTop");
101 m_ScintTiO2ThicknessSide = data.getLength("Module/Scintillator/TiO2ThicknessSide");
102
103 m_ChimneyLength = data.getLength("Chimney/Length");
104 m_ChimneyWidth = data.getLength("Chimney/Width");
105 m_ChimneyCoverThickness = data.getLength("Chimney/CoverThickness");
106 m_ChimneyHousingInnerRadius = data.getLength("Chimney/HousingInnerRadius");
107 m_ChimneyHousingOuterRadius = data.getLength("Chimney/HousingOuterRadius");
108 m_ChimneyShieldInnerRadius = data.getLength("Chimney/ShieldInnerRadius");
109 m_ChimneyShieldOuterRadius = data.getLength("Chimney/ShieldOuterRadius");
110 m_ChimneyPipeInnerRadius = data.getLength("Chimney/PipeInnerRadius");
111 m_ChimneyPipeOuterRadius = data.getLength("Chimney/PipeOuterRadius");
112
113 m_RibThickness = data.getLength("RibThickness");
114 m_CablesWidth = data.getLength("CablesWidth");
115 m_BraceWidth = data.getLength("BraceWidth");
116 m_BraceWidthChimney = data.getLength("BraceWidthChimney");
117
118 m_SupportPlateWidth = data.getLength("SupportPlateWidth");
119 m_SupportPlateHeight = data.getLength("SupportPlateHeight");
120 m_SupportPlateLength = data.getLength("SupportPlateLength");
121 m_SupportPlateLengthChimney = data.getLength("SupportPlateLengthChimney");
122
123 m_BracketWidth = data.getLength("BracketWidth");
124 m_BracketThickness = data.getLength("BracketThickness");
125 m_BracketLength = data.getLength("BracketLength");
126 m_BracketRibWidth = data.getLength("BracketRibWidth");
127 m_BracketRibThickness = data.getLength("BracketRibThickness");
128 m_BracketInnerRadius = data.getLength("BracketInnerRadius");
129 m_BracketInset = data.getLength("BracketInset");
130 m_BracketCutoutDphi = data.getAngle("BracketCutoutDphi");
131
132 m_NReadoutStation = data.getNumberNodes("Readout/Stations/Station");
133 if (m_NReadoutStation > NSTATION) { // array-bounds check
134 B2FATAL("BKLMGeometryPar::read(): readout stations array size exceeded:"
135 << LogVar("# of readout stations", m_NReadoutStation)
136 << LogVar("array size", NSTATION));
137 }
138 for (int station = 1; station <= m_NReadoutStation; ++station) {
139 sprintf(name, "/Readout/Stations/Station[@station=\"%d\"]", station);
140 GearDir stationContent = data;
141 stationContent.append(name);
142 m_ReadoutStationIsPhi[station - 1] = stationContent.getBool("IsPhi");
143 m_ReadoutStationPosition[station - 1] = stationContent.getLength("Position");
144 }
145 m_ReadoutContainerLength = data.getLength("Readout/Container/Length");
146 m_ReadoutContainerWidth = data.getLength("Readout/Container/Width");
147 m_ReadoutContainerHeight = data.getLength("Readout/Container/Height");
148 m_ReadoutCarrierLength = data.getLength("Readout/Carrier/Length");
149 m_ReadoutCarrierWidth = data.getLength("Readout/Carrier/Width");
150 m_ReadoutCarrierHeight = data.getLength("Readout/Carrier/Height");
151 m_ReadoutPreamplifierLength = data.getLength("Readout/Preamplifier/Length");
152 m_ReadoutPreamplifierWidth = data.getLength("Readout/Preamplifier/Width");
153 m_ReadoutPreamplifierHeight = data.getLength("Readout/Preamplifier/Height");
154 m_ReadoutPreamplifierPosition = data.getArray("Readout/Preamplifier/Position");
155 m_ReadoutConnectorsLength = data.getLength("Readout/Connectors/Length");
156 m_ReadoutConnectorsWidth = data.getLength("Readout/Connectors/Width");
157 m_ReadoutConnectorsHeight = data.getLength("Readout/Connectors/Height");
158 m_ReadoutConnectorsPosition = data.getLength("Readout/Connectors/Position");
159 m_MPPCHousingRadius = data.getLength("Readout/MPPC/Housing/Radius");
160 m_MPPCHousingLength = data.getLength("Readout/MPPC/Housing/Length");
161 m_MPPCLength = data.getLength("Readout/MPPC/Sensor/Length");
162 m_MPPCWidth = data.getLength("Readout/MPPC/Sensor/Width");
163 m_MPPCHeight = data.getLength("Readout/MPPC/Sensor/Height");
164
165 // by-layer values that are common for all sectors and forward/backward
166 for (int layer = 1; layer <= m_NLayer; ++layer) {
167 sprintf(name, "/Layers/Layer[@layer=\"%d\"]", layer);
168 GearDir layerContent = data;
169 layerContent.append(name);
170 m_HasRPCs[layer - 1] = layerContent.getBool("HasRPCs");
171 m_NPhiStrips[layer - 1] = layerContent.getInt("PhiStrips/NStrips");
172 m_PhiStripWidth[layer - 1] = layerContent.getLength("PhiStrips/Width");
173 m_ZStripWidth[layer - 1] = layerContent.getLength("ZStrips/Width");
174 if (layer <= NSCINTLAYER) {
175 m_ScintEnvelopeOffsetSign[layer - 1] = layerContent.getInt("ScintEnvelopeOffsetSign");
176 m_NPhiScints[layer - 1] = layerContent.getInt("PhiScintillators/NScints", 0);
177 if (m_NPhiScints[layer - 1] > NPHISCINT) { // array-bounds check
178 B2FATAL("BKLMGeometryPar::read(): phi-scint array size exceeded:"
179 << LogVar("in zero-based layer", layer - 1)
180 << LogVar("# of phi scintillators", m_NPhiScints[layer - 1])
181 << LogVar("array size", NPHISCINT));
182 }
183 for (int scint = 1; scint <= m_NZScints; ++scint) {
184 sprintf(name, "/ZScintillators/Scint[@scint=\"%d\"]", scint);
185 GearDir scintContent(layerContent);
186 scintContent.append(name);
187 m_ZScintDLength[layer - 1][scint - 1] = scintContent.getLength("DLength", 0.0);
188 }
189 }
190 }
191
192 // values that depend on fb/sector/layer
193 for (int section = 0; section <= BKLMElementNumbers::getMaximalSectionNumber(); ++section) {
194 bool isForward = (section == BKLMElementNumbers::c_ForwardSection);
195 for (int sector = 1; sector <= m_NSector; ++sector) {
196 sprintf(name, "/Sectors/%s/Sector[@sector=\"%d\"]", (isForward ? "Forward" : "Backward"), sector);
197 GearDir sectorContent(data);
198 sectorContent.append(name);
199 m_SectorRotation[section][sector - 1] = sectorContent.getAngle("Phi");
200 for (int layer = 1; layer <= m_NLayer; ++layer) {
201 GearDir layerContent(sectorContent);
202 sprintf(name, "/Layer[@layer=\"%d\"]", layer);
203 layerContent.append(name);
204 m_LocalReconstructionShiftX[section][sector - 1][layer - 1] = layerContent.getLength("ReconstructionShift/X");
205 m_LocalReconstructionShiftY[section][sector - 1][layer - 1] = layerContent.getLength("ReconstructionShift/Y");
206 m_LocalReconstructionShiftZ[section][sector - 1][layer - 1] = layerContent.getLength("ReconstructionShift/Z");
207 if (layer <= NSCINTLAYER) {
208 m_IsFlipped[section][sector - 1][layer - 1] = layerContent.getBool("Flip", false);
209 }
210 }
211 }
212 }
213
214}
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
static constexpr int getMaximalSectorNumber()
Get maximal sector number (1-based).
static constexpr int getMaximalSectionNumber()
Get maximal section number (0-based).
double m_LocalReconstructionShiftX[2][BKLMElementNumbers::getMaximalSectorNumber()][BKLMElementNumbers::getMaximalLayerNumber()]
Reconstruction dx in local system. displacement, not alignment.
double m_BracketRibWidth
Width of the innermost-module support plate's bracket's rib.
double m_ScintWidth
Width of one scintillator strip (cm), including the TiO2 coating.
double m_LocalReconstructionShiftZ[2][BKLMElementNumbers::getMaximalSectorNumber()][BKLMElementNumbers::getMaximalLayerNumber()]
Reconstruction dz in local system. displacement, not alignment.
int m_NZStripsChimney
Number of z-measuring cathode strips in a chimney-sector RPC module.
double m_ReadoutConnectorsHeight
Height of the readout connectors pair.
double m_SupportPlateLengthChimney
Length of the innermost-module support plate in the chimney sector.
bool m_HasRPCs[BKLMElementNumbers::getMaximalLayerNumber()]
Flag to indicate whether layer contains RPCs (true) or scintillators (false)
double m_ChimneyPipeInnerRadius
Inner radius of the chimney pipe.
double m_BracketLength
Length of the innermost-module support plate's bracket.
double m_ReadoutContainerHeight
Height of the readout station.
double m_ReadoutCarrierHeight
Height of the readout carrier card.
double m_ModuleLengthChimney
Length along z of the module in the chimney sector.
double m_BracketInnerRadius
Inner radius of the innermost-module support plate's bracket.
double m_BracketWidth
Width of the innermost-module support plate's bracket.
double m_BraceWidthChimney
Width of the central brace in the middle of the cable-services channel in the chimney sector.
int m_NPhiStrips[BKLMElementNumbers::getMaximalLayerNumber()]
Number of phi-readout RPC strips in each layer.
double m_ReadoutContainerLength
Length of the readout station.
double m_Gap1IronWidth
Width (at the outer radius) of the adjacent structural iron on either side of innermost gap.
double m_IronActualHeight
Actual height of a layer's structural iron.
double m_ZStripWidth[BKLMElementNumbers::getMaximalLayerNumber()]
Width of the z strips on each layer.
double m_ReadoutPreamplifierWidth
Width of the preamplifier card.
double m_IronNominalHeight
Nominal height of a layer's structural iron.
double m_ScintHeight
Height of one scintillator strip (cm), including the TiO2 coating.
double m_ChimneyHousingInnerRadius
Inner radius of the chimney housing.
double m_ModuleFoamHeight
Height of a detector module's transmission-line foam.
double m_BracketRibThickness
Thickness of the innermost-module support plate's bracket's rib.
double m_Gap1NominalHeight
Nominal height of the innermost gap.
double m_ScintFiberRadius
Radius (cm) of the central WLS fiber in the scintillator strip.
double m_MPPCLength
MPPC length.
int m_ScintEnvelopeOffsetSign[NSCINTLAYER]
Sign (+/-1) of scintillator-envelope's shift along y axis within its enclosing module for MPPC placem...
double m_SupportPlateLength
Length of the innermost-module support plate.
double m_ModuleMylarHeight
Height of a detector module's mylar insulation.
double m_ModuleFrameThickness
Thickness of a detector module's frame ("C" shape - thickness of vertical leg)
double m_ChimneyShieldInnerRadius
Inner radius of the chimney shield.
double m_Rotation
Global rotation angle about z of the BKLM.
double m_ZScintDLength[NSCINTLAYER][NZSCINT]
Shortening of the nominal length of the z scintillators for scintillator layers only
int m_NReadoutStation
Number of preamplifier readout stations.
double m_ModulePolystyreneOuterHeight
Height of the outer polystyrene-filler sheet.
double m_ChimneyLength
Length along z of the chimney hole.
double m_ReadoutContainerWidth
Width of the readout station.
double m_OffsetZ
Global offset along z of the BKLM.
double m_ModuleGasSpacerWidth
Width of a detector module's spacer.
double m_PhiStripWidth[BKLMElementNumbers::getMaximalLayerNumber()]
Width of the phi strips on each layer.
double m_OuterRadius
Radius of the circle tangent to the sides of the outer polygon.
double m_BracketThickness
Thickness of the innermost-module support plate's bracket.
double m_ModuleGlassHeight
Height of a detector module's glass electrode.
double m_RibThickness
Thickness of the radial rib that supports the solenoid / inner detectors.
double m_ScintTiO2ThicknessTop
Thickness (cm) of the TiO2 coating on the top (and bottom) of the scintillator strip.
BKLMGeometryPar()
Default constructor.
double m_ModuleLength
Length along z of the module.
double m_HalfLength
Half-length along z of the BKLM.
double m_ReadoutPreamplifierHeight
Height of the preamplifier card.
double m_ChimneyWidth
Width of the chimney hole.
double m_ChimneyShieldOuterRadius
Outer radius of the chimney shield.
int m_NZScintsChimney
Number of z-measuring scintillators in a chimney-sector scintillator module.
double m_ReadoutConnectorsLength
Length of the readout connectors pair.
double m_SupportPlateWidth
Width of the innermost-module support plate.
double m_MPPCHeight
MPPC height.
int m_NZStrips
Number of z-measuring cathode strips in a standard RPC module.
double m_SectorRotation[2][BKLMElementNumbers::getMaximalSectorNumber()]
Global rotation angle of a sector.
double m_BracketInset
Distance from support plate's end of bracket.
int m_NLayer
Number of layers in one sector.
double m_GapLength
Length along z of each gap.
double m_MPPCHousingRadius
MPPC housing radius.
double m_MPPCHousingLength
MPPC housing length.
int m_NPhiScints[NSCINTLAYER]
Number of phi-readout scintillators in each layer for scintillator layers only
double m_CablesWidth
Width of the cable-services channel at each end.
double m_ScintBoreRadius
Radius (cm) of the central bore in the scintillator strip.
double m_ReadoutCarrierLength
Length of the readout carrier card.
double m_ReadoutConnectorsWidth
Width of the readout connectors pair.
double m_GapIronWidth
Width (at the outer radius) of the adjacent structural iron on either side of a gap.
double m_ReadoutStationPosition[NSTATION]
Position of each readout station along its relevant axis.
double m_ReadoutPreamplifierLength
Length of the preamplifier card.
double m_ModuleGasHeight
Height of a detector module's gas gap.
double m_BraceWidth
Width of the central brace in the middle of the cable-services channel.
double m_ModuleFrameWidth
Width of a detector module's frame ("C" shape - width of horizontal leg)
double m_MPPCWidth
MPPC width.
double m_ChimneyHousingOuterRadius
Outer radius of the chimney housing.
double m_GapNominalHeight
Nominal height of outer gaps.
double m_ReadoutConnectorsPosition
Position of the readout connectors pair along the length of the carrier card.
double m_ModulePolystyreneInnerHeight
Height of the inner polystyrene-filler sheet.
double m_ChimneyCoverThickness
Thickness of the chimney's iron cover plate.
bool m_IsFlipped[2][BKLMElementNumbers::getMaximalSectorNumber()][NSCINTLAYER]
Flag of z-phi planes flip for scintillator layers only
double m_Phi
Starting angle of the polygon shape.
std::vector< double > m_ReadoutPreamplifierPosition
Positions of the preamplifiers along the length of the carrier card.
void read(const GearDir &)
Get geometry parameters from Gearbox.
double m_LocalReconstructionShiftY[2][BKLMElementNumbers::getMaximalSectorNumber()][BKLMElementNumbers::getMaximalLayerNumber()]
Reconstruction dy in local system. displacement, not alignment.
double m_ModuleCoverHeight
Height of a detector module's aluminum cover.
double m_Gap1InnerRadius
Radius of the inner tangent circle of the innermost gap.
double m_SolenoidOuterRadius
Outer radius of the solenoid.
int m_NSector
Number of sectors (=8 : octagonal)
bool m_DoBeamBackgroundStudy
Flag for enabling beam background study (=alternate sensitive-detector function)
double m_ChimneyPipeOuterRadius
Outer radius of the chimney pipe.
bool m_ReadoutStationIsPhi[NSTATION]
Selector for phi (true) or z (false) readout station.
double m_ReadoutCarrierWidth
Width of the readout carrier card.
double m_SupportPlateHeight
Height of the innermost-module support plate.
double m_ScintTiO2ThicknessSide
Thickness (cm) of the TiO2 coating on the left (and right) side of the scintillator strip.
double m_ModuleCopperHeight
Height of a detector module's copper readout or ground plane.
double m_BracketCutoutDphi
Angular width of the innermost-module support plate's bracket's cutout.
int m_NZScints
Number of z-measuring scintillators in a standard scintillator module.
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
void append(const std::string &path)
Append something to the current path, modifying the GearDir in place.
Definition: GearDir.h:52
double getAngle(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard angle unit.
Definition: Interface.h:299
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
Definition: Interface.h:259
bool getBool(const std::string &path="") const noexcept(false)
Get the parameter path as a bool.
Definition: Interface.cc:80
int getInt(const std::string &path="") const noexcept(false)
Get the parameter path as a int.
Definition: Interface.cc:60
Class to store variables with their name which were sent to the logging service.
Abstract base class for different kinds of events.