Belle II Software  release-06-00-14
GeometryPar.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/bklm/geometry/GeometryPar.h>
11 
12 /* KLM headers. */
13 #include <klm/dataobjects/bklm/BKLMElementNumbers.h>
14 #include <klm/dataobjects/KLMChannelIndex.h>
15 #include <klm/dbobjects/bklm/BKLMAlignment.h>
16 
17 /* Belle 2 headers. */
18 #include <framework/gearbox/GearDir.h>
19 #include <framework/logging/Logger.h>
20 #include <framework/database/DBObjPtr.h>
21 #include <simulation/background/BkgSensitiveDetector.h>
22 
23 using namespace std;
24 using namespace Belle2::bklm;
25 
26 GeometryPar* GeometryPar::m_Instance = nullptr;
27 
28 GeometryPar* GeometryPar::instance(void)
29 {
30  if (m_Instance)
31  return m_Instance;
32  B2FATAL("instance() called without initialization");
33  return nullptr; // never reached
34 }
35 
36 GeometryPar* GeometryPar::instance(const GearDir& content)
37 {
38  if (!m_Instance)
39  m_Instance = new GeometryPar(content);
40  return m_Instance;
41 }
42 
43 GeometryPar* GeometryPar::instance(const BKLMGeometryPar& element)
44 {
45  if (!m_Instance)
46  m_Instance = new GeometryPar(element);
47  return m_Instance;
48 }
49 
50 GeometryPar::GeometryPar(const GearDir& content) :
51  m_DoBeamBackgroundStudy(false),
52  m_BkgSensitiveDetector(nullptr),
53  m_NSector(BKLMElementNumbers::getMaximalSectorNumber()),
54  m_NLayer(BKLMElementNumbers::getMaximalLayerNumber())
55 {
56  clear();
57  read(content);
58  calculate();
59 }
60 
62  m_DoBeamBackgroundStudy(false),
63  m_BkgSensitiveDetector(nullptr),
64  m_NSector(BKLMElementNumbers::getMaximalSectorNumber()),
65  m_NLayer(BKLMElementNumbers::getMaximalLayerNumber())
66 {
67  clear();
68  readFromDB(element);
69  calculate();
70 }
71 
73 {
74  clear();
75 }
76 
78 {
79  for (std::map<int, Module*>::iterator m = m_Modules.begin(); m != m_Modules.end(); ++m) { delete m->second; }
80  m_Modules.clear();
81 
82  m_Alignments.clear();
83  m_Displacements.clear();
84 }
85 
86 // Get BKLM geometry parameters from Gearbox (no calculations here)
87 void GeometryPar::read(const GearDir& content)
88 {
89 
90  char name[80] = "";
91  m_DoBeamBackgroundStudy = content.getBool("BeamBackgroundStudy");
92  m_Rotation = content.getAngle("Rotation");
93  m_OffsetZ = content.getLength("OffsetZ");
94  m_Phi = content.getLength("Phi");
95  m_NSector = content.getNumberNodes("Sectors/Forward/Sector");
96  if (m_NSector > BKLMElementNumbers::getMaximalSectorNumber()) { // array-bounds check
97  B2FATAL("BKLM GeometryPar::read(): sector array size exceeded:"
98  << LogVar("# of sectors", m_NSector)
100  }
101  m_SolenoidOuterRadius = content.getLength("SolenoidOuterRadius");
102  m_OuterRadius = content.getLength("OuterRadius");
103  m_HalfLength = content.getLength("HalfLength");
104  m_NLayer = content.getNumberNodes("Layers/Layer");
105  if (m_NLayer > BKLMElementNumbers::getMaximalLayerNumber()) { // array-bounds check
106  B2FATAL("BKLM GeometryPar::read(): layer array size exceeded:"
107  << LogVar("# of layers", m_NLayer)
109  }
110 
111  m_IronNominalHeight = content.getLength("Layers/IronNominalHeight");
112  m_IronActualHeight = content.getLength("Layers/IronActualHeight");
113  m_Gap1NominalHeight = content.getLength("Layers/Layer[@layer=\"1\"]/GapNominalHeight");
114  m_GapNominalHeight = content.getLength("Layers/GapNominalHeight");
115  m_Gap1InnerRadius = content.getLength("Layers/InnerRadius");
116  m_Gap1IronWidth = content.getLength("Layers/Layer[@layer=\"1\"]/GapIronWidth");
117  m_GapIronWidth = content.getLength("Layers/GapIronWidth");
118  m_GapLength = content.getLength("Layers/GapLength");
119 
120  m_NZStrips = content.getInt("Layers/NZStrips");
121  m_NZStripsChimney = content.getInt("Layers/NZStripsChimney");
122  m_NZScints = content.getInt("Layers/NZScintillators");
123  m_NZScintsChimney = content.getInt("Layers/NZScintillatorsChimney");
124  if (m_NZScints > NZSCINT) { // array-bounds check
125  B2FATAL("BKLM GeometryPar::read(): z-scint array size exceeded:"
126  << LogVar("# of z scintillators", m_NZScints)
127  << LogVar("array size", NZSCINT));
128  }
129  if (m_NZScintsChimney > NZSCINT) { // array-bounds check
130  B2FATAL("BKLM GeometryPar::read(): chimney sector z-scint array size exceeded:"
131  << LogVar("# of z scintillators", m_NZScintsChimney)
132  << LogVar("array size", NZSCINT));
133  }
134 
135  m_ModuleLength = content.getLength("Module/Length");
136  m_ModuleLengthChimney = content.getLength("Module/LengthChimney");
137  m_ModuleCoverHeight = content.getLength("Module/CoverHeight");
138  m_ModuleCopperHeight = content.getLength("Module/CopperHeight");
139  m_ModuleFoamHeight = content.getLength("Module/FoamHeight");
140  m_ModuleMylarHeight = content.getLength("Module/MylarHeight");
141  m_ModuleGlassHeight = content.getLength("Module/GlassHeight");
142  m_ModuleGasHeight = content.getLength("Module/GasHeight");
143  m_ModuleFrameWidth = content.getLength("Module/FrameWidth");
144  m_ModuleFrameThickness = content.getLength("Module/FrameThickness");
145  m_ModuleGasSpacerWidth = content.getLength("Module/SpacerWidth");
146  m_ModulePolystyreneInnerHeight = content.getLength("Module/PolystyreneInnerHeight");
147  m_ModulePolystyreneOuterHeight = content.getLength("Module/PolystyreneOuterHeight");
148  m_ScintWidth = content.getLength("Module/Scintillator/Width");
149  m_ScintHeight = content.getLength("Module/Scintillator/Height");
150  m_ScintBoreRadius = content.getLength("Module/Scintillator/BoreRadius");
151  m_ScintFiberRadius = content.getLength("Module/Scintillator/FiberRadius");
152  m_ScintTiO2ThicknessTop = content.getLength("Module/Scintillator/TiO2ThicknessTop");
153  m_ScintTiO2ThicknessSide = content.getLength("Module/Scintillator/TiO2ThicknessSide");
154 
155  m_ChimneyLength = content.getLength("Chimney/Length");
156  m_ChimneyWidth = content.getLength("Chimney/Width");
157  m_ChimneyCoverThickness = content.getLength("Chimney/CoverThickness");
158  m_ChimneyHousingInnerRadius = content.getLength("Chimney/HousingInnerRadius");
159  m_ChimneyHousingOuterRadius = content.getLength("Chimney/HousingOuterRadius");
160  m_ChimneyShieldInnerRadius = content.getLength("Chimney/ShieldInnerRadius");
161  m_ChimneyShieldOuterRadius = content.getLength("Chimney/ShieldOuterRadius");
162  m_ChimneyPipeInnerRadius = content.getLength("Chimney/PipeInnerRadius");
163  m_ChimneyPipeOuterRadius = content.getLength("Chimney/PipeOuterRadius");
164 
165  m_RibThickness = content.getLength("RibThickness");
166  m_CablesWidth = content.getLength("CablesWidth");
167  m_BraceWidth = content.getLength("BraceWidth");
168  m_BraceWidthChimney = content.getLength("BraceWidthChimney");
169 
170  m_SupportPlateWidth = content.getLength("SupportPlateWidth");
171  m_SupportPlateHeight = content.getLength("SupportPlateHeight");
172  m_SupportPlateLength = content.getLength("SupportPlateLength");
173  m_SupportPlateLengthChimney = content.getLength("SupportPlateLengthChimney");
174 
175  m_BracketWidth = content.getLength("BracketWidth");
176  m_BracketThickness = content.getLength("BracketThickness");
177  m_BracketLength = content.getLength("BracketLength");
178  m_BracketRibWidth = content.getLength("BracketRibWidth");
179  m_BracketRibThickness = content.getLength("BracketRibThickness");
180  m_BracketInnerRadius = content.getLength("BracketInnerRadius");
181  m_BracketInset = content.getLength("BracketInset");
182  m_BracketCutoutDphi = content.getAngle("BracketCutoutDphi");
183 
184  m_NReadoutStation = content.getNumberNodes("Readout/Stations/Station");
185  if (m_NReadoutStation > NSTATION) { // array-bounds check
186  B2FATAL("BKLM GeometryPar::read(): readout stations array size exceeded:"
187  << LogVar("# of readout stations", m_NReadoutStation)
188  << LogVar("array size", NSTATION));
189  }
190  for (int station = 1; station <= m_NReadoutStation; ++station) {
191  sprintf(name, "/Readout/Stations/Station[@station=\"%d\"]", station);
192  GearDir stationContent = content;
193  stationContent.append(name);
194  m_ReadoutStationIsPhi[station - 1] = stationContent.getBool("IsPhi");
195  m_ReadoutStationPosition[station - 1] = stationContent.getLength("Position");
196  }
197  m_ReadoutContainerLength = content.getLength("Readout/Container/Length");
198  m_ReadoutContainerWidth = content.getLength("Readout/Container/Width");
199  m_ReadoutContainerHeight = content.getLength("Readout/Container/Height");
200  m_ReadoutCarrierLength = content.getLength("Readout/Carrier/Length");
201  m_ReadoutCarrierWidth = content.getLength("Readout/Carrier/Width");
202  m_ReadoutCarrierHeight = content.getLength("Readout/Carrier/Height");
203  m_ReadoutPreamplifierLength = content.getLength("Readout/Preamplifier/Length");
204  m_ReadoutPreamplifierWidth = content.getLength("Readout/Preamplifier/Width");
205  m_ReadoutPreamplifierHeight = content.getLength("Readout/Preamplifier/Height");
206  m_ReadoutPreamplifierPosition = content.getArray("Readout/Preamplifier/Position");
207  m_ReadoutConnectorsLength = content.getLength("Readout/Connectors/Length");
208  m_ReadoutConnectorsWidth = content.getLength("Readout/Connectors/Width");
209  m_ReadoutConnectorsHeight = content.getLength("Readout/Connectors/Height");
210  m_ReadoutConnectorsPosition = content.getLength("Readout/Connectors/Position");
211  m_MPPCHousingRadius = content.getLength("Readout/MPPC/Housing/Radius");
212  m_MPPCHousingLength = content.getLength("Readout/MPPC/Housing/Length");
213  m_MPPCLength = content.getLength("Readout/MPPC/Sensor/Length");
214  m_MPPCWidth = content.getLength("Readout/MPPC/Sensor/Width");
215  m_MPPCHeight = content.getLength("Readout/MPPC/Sensor/Height");
216  // by-layer values that are common for all sectors and forward/backward
217  for (int layer = 1; layer <= m_NLayer; ++layer) {
218  sprintf(name, "/Layers/Layer[@layer=\"%d\"]", layer);
219  GearDir layerContent = content;
220  layerContent.append(name);
221  m_HasRPCs[layer - 1] = layerContent.getBool("HasRPCs");
222  m_NPhiStrips[layer - 1] = layerContent.getInt("PhiStrips/NStrips");
223  m_PhiStripWidth[layer - 1] = layerContent.getLength("PhiStrips/Width");
224  m_ZStripWidth[layer - 1] = layerContent.getLength("ZStrips/Width");
225  m_ScintEnvelopeOffsetSign[layer - 1] = layerContent.getInt("ScintEnvelopeOffsetSign");
226  m_NPhiScints[layer - 1] = layerContent.getInt("PhiScintillators/NScints", 0);
227  if (m_NPhiScints[layer - 1] > NPHISCINT) { // array-bounds check
228  B2FATAL("BKLM GeometryPar::read(): phi-scint array size exceeded:"
229  << LogVar("in zero-based layer", layer - 1)
230  << LogVar("# phi scintillators", m_NPhiScints[layer - 1])
231  << LogVar("array size", NPHISCINT));
232  }
233  for (int scint = 1; scint <= m_NZScints; ++scint) {
234  sprintf(name, "/ZScintillators/Scint[@scint=\"%d\"]", scint);
235  GearDir scintContent(layerContent);
236  scintContent.append(name);
237  m_ZScintDLength[layer - 1][scint - 1] = scintContent.getLength("DLength", 0.0);
238  }
239  }
240  // values that depend on fb/sector/layer
241  for (int section = 0; section <= BKLMElementNumbers::getMaximalSectionNumber(); ++section) {
242  bool isForward = (section == BKLMElementNumbers::c_ForwardSection);
243  for (int sector = 1; sector <= m_NSector; ++sector) {
244  sprintf(name, "/Sectors/%s/Sector[@sector=\"%d\"]", (isForward ? "Forward" : "Backward"), sector);
245  GearDir sectorContent(content);
246  sectorContent.append(name);
247  m_SectorRotation[section][sector - 1] = sectorContent.getAngle("Phi");
248  for (int layer = 1; layer <= m_NLayer; ++layer) {
249  GearDir layerContent(sectorContent);
250  sprintf(name, "/Layer[@layer=\"%d\"]", layer);
251  layerContent.append(name);
252  m_LocalReconstructionShiftX[section][sector - 1][layer - 1] = layerContent.getLength("ReconstructionShift/X");
253  m_LocalReconstructionShiftY[section][sector - 1][layer - 1] = layerContent.getLength("ReconstructionShift/Y");
254  m_LocalReconstructionShiftZ[section][sector - 1][layer - 1] = layerContent.getLength("ReconstructionShift/Z");
255  m_IsFlipped[section][sector - 1][layer - 1] = layerContent.getBool("Flip", false);
256  }
257  }
258  }
259 }
260 
261 // Get BKLM geometry parameters from dbobject (no calculations here)
263 {
264 
265  m_DoBeamBackgroundStudy = element.doBeamBackgroundStudy();
266  m_Rotation = element.getRotation();
267  m_OffsetZ = element.getOffsetZ();
268  m_Phi = element.getPhi();
269  m_NSector = element.getNSector(); // array-bounds check has already been done
270  m_SolenoidOuterRadius = element.getSolenoidOuterRadius();
271  m_OuterRadius = element.getOuterRadius();
272  m_HalfLength = element.getHalfLength();
273  m_NLayer = element.getNLayer(); // array-bounds check has already been done
274 
275  m_IronNominalHeight = element.getIronNominalHeight();
276  m_IronActualHeight = element.getIronActualHeight();
277  m_Gap1NominalHeight = element.getGap1NominalHeight();
278  m_GapNominalHeight = element.getGapNominalHeight();
279  m_Gap1InnerRadius = element.getGap1InnerRadius();
280  m_Gap1IronWidth = element.getGap1IronWidth();
281  m_GapIronWidth = element.getGapIronWidth();
282  m_GapLength = element.getGapLength();
283 
284  m_NZStrips = element.getNZStrips();
285  m_NZStripsChimney = element.getNZStripsChimney();
286  m_NZScints = element.getNZScints(); // array-bounds check has already been done
287  m_NZScintsChimney = element.getNZScintsChimney(); // array-bounds check has already been done
288 
289  m_ModuleLength = element.getModuleLength();
290  m_ModuleLengthChimney = element.getModuleLengthChimney();
291  m_ModuleCoverHeight = element.getModuleCoverHeight();
292  m_ModuleCopperHeight = element.getModuleCopperHeight();
293  m_ModuleFoamHeight = element.getModuleFoamHeight();
294  m_ModuleMylarHeight = element.getModuleMylarHeight();
295  m_ModuleGlassHeight = element.getModuleGlassHeight();
296  m_ModuleGasHeight = element.getModuleGasHeight();
297  m_ModuleFrameWidth = element.getModuleFrameWidth();
298  m_ModuleFrameThickness = element.getModuleFrameThickness();
299  m_ModuleGasSpacerWidth = element.getModuleGasSpacerWidth();
300  m_ModulePolystyreneInnerHeight = element.getModulePolystyreneInnerHeight();
301  m_ModulePolystyreneOuterHeight = element.getModulePolystyreneOuterHeight();
302  m_ScintWidth = element.getScintWidth();
303  m_ScintHeight = element.getScintHeight();
304  m_ScintBoreRadius = element.getScintBoreRadius();
305  m_ScintFiberRadius = element.getScintFiberRadius();
306  m_ScintTiO2ThicknessTop = element.getScintTiO2ThicknessTop();
307  m_ScintTiO2ThicknessSide = element.getScintTiO2ThicknessSide();
308 
309  m_ChimneyLength = element.getChimneyLength();
310  m_ChimneyWidth = element.getChimneyWidth();
311  m_ChimneyCoverThickness = element.getChimneyCoverThickness();
312  m_ChimneyHousingInnerRadius = element.getChimneyHousingInnerRadius();
313  m_ChimneyHousingOuterRadius = element.getChimneyHousingOuterRadius();
314  m_ChimneyShieldInnerRadius = element.getChimneyShieldInnerRadius();
315  m_ChimneyShieldOuterRadius = element.getChimneyShieldOuterRadius();
316  m_ChimneyPipeInnerRadius = element.getChimneyPipeInnerRadius();
317  m_ChimneyPipeOuterRadius = element.getChimneyPipeOuterRadius();
318 
319  m_RibThickness = element.getRibThickness();
320  m_CablesWidth = element.getCablesWidth();
321  m_BraceWidth = element.getBraceWidth();
322  m_BraceWidthChimney = element.getBraceWidthChimney();
323 
324  m_SupportPlateWidth = element.getSupportPlateWidth();
325  m_SupportPlateHeight = element.getSupportPlateHeight();
326  m_SupportPlateLength = element.getSupportPlateLength();
327  m_SupportPlateLengthChimney = element.getSupportPlateLengthChimney();
328 
329  m_BracketWidth = element.getBracketWidth();
330  m_BracketThickness = element.getBracketThickness();
331  m_BracketLength = element.getBracketLength();
332  m_BracketRibWidth = element.getBracketRibWidth();
333  m_BracketRibThickness = element.getBracketRibThickness();
334  m_BracketInnerRadius = element.getBracketInnerRadius();
335  m_BracketInset = element.getBracketInset();
336  m_BracketCutoutDphi = element.getBracketCutoutDphi();
337 
338  m_NReadoutStation = element.getNReadoutStation(); // array-bounds check has already been done
339  for (int station = 1; station <= m_NReadoutStation; ++station) {
340  m_ReadoutStationIsPhi[station - 1] = element.getReadoutStationIsPhi(station);
341  m_ReadoutStationPosition[station - 1] = element.getReadoutStationPosition(station);
342  }
343  m_ReadoutContainerLength = element.getReadoutContainerLength();
344  m_ReadoutContainerWidth = element.getReadoutContainerWidth();
345  m_ReadoutContainerHeight = element.getReadoutContainerHeight();
346  m_ReadoutCarrierLength = element.getReadoutCarrierLength();
347  m_ReadoutCarrierWidth = element.getReadoutCarrierWidth();
348  m_ReadoutCarrierHeight = element.getReadoutCarrierHeight();
349  m_ReadoutPreamplifierLength = element.getReadoutPreamplifierLength();
350  m_ReadoutPreamplifierWidth = element.getReadoutPreamplifierWidth();
351  m_ReadoutPreamplifierHeight = element.getReadoutPreamplifierHeight();
352  for (int preamp = 1; preamp <= element.getNReadoutPreamplifierPosition(); ++preamp) {
353  m_ReadoutPreamplifierPosition.push_back(element.getReadoutPreamplifierPosition(preamp));
354  }
355  m_ReadoutConnectorsLength = element.getReadoutConnectorsLength();
356  m_ReadoutConnectorsWidth = element.getReadoutConnectorsWidth();
357  m_ReadoutConnectorsHeight = element.getReadoutConnectorsHeight();
358  m_ReadoutConnectorsPosition = element.getReadoutConnectorsPosition();
359  m_MPPCHousingRadius = element.getMPPCHousingRadius();
360  m_MPPCHousingLength = element.getMPPCHousingLength();
361  m_MPPCLength = element.getMPPCLength();
362  m_MPPCWidth = element.getMPPCWidth();
363  m_MPPCHeight = element.getMPPCHeight();
364 
365  // by-layer values that are common for all sectors and forward/backward
366  for (int layer = 1; layer <= m_NLayer; ++layer) {
367  m_HasRPCs[layer - 1] = element.hasRPCs(layer);
368  m_NPhiStrips[layer - 1] = element.getNPhiStrips(layer);
369  m_PhiStripWidth[layer - 1] = element.getPhiStripWidth(layer);
370  m_ZStripWidth[layer - 1] = element.getZStripWidth(layer);
371  m_NPhiScints[layer - 1] = (m_HasRPCs[layer - 1] ? 0 : element.getNPhiScints(layer)); // array-bounds check has already been done
372  m_ScintEnvelopeOffsetSign[layer - 1] = (m_HasRPCs[layer - 1] ? 0 : element.getScintEnvelopeOffsetSign(layer));
373  for (int scint = 1; scint <= m_NZScints; ++scint) {
374  m_ZScintDLength[layer - 1][scint - 1] = (m_HasRPCs[layer - 1] ? 0.0 : element.getZScintDLength(layer, scint));
375  }
376  }
377  // values that depend on fb/sector/layer
378  for (int section = 0; section <= BKLMElementNumbers::getMaximalSectionNumber(); ++section) {
379  for (int sector = 1; sector <= m_NSector; ++sector) {
380  m_SectorRotation[section][sector - 1] = element.getSectorRotation(section, sector);
381  for (int layer = 1; layer <= m_NLayer; ++layer) {
382  m_LocalReconstructionShiftX[section][sector - 1][layer - 1] = element.getLocalReconstructionShiftX(section, sector, layer);
383  m_LocalReconstructionShiftY[section][sector - 1][layer - 1] = element.getLocalReconstructionShiftY(section, sector, layer);
384  m_LocalReconstructionShiftZ[section][sector - 1][layer - 1] = element.getLocalReconstructionShiftZ(section, sector, layer);
385  m_IsFlipped[section][sector - 1][layer - 1] = false;
386  if (layer <= NSCINTLAYER) {
387  m_IsFlipped[section][sector - 1][layer - 1] = element.isFlipped(section, sector, layer);
388  }
389  }
390  }
391  }
392 
393 
394 }
395 
396 // Calculate derived quantities from the database-defined values
398 {
400  B2INFO("BKLM::GeometryPar: DoBeamBackgroundStudy is enabled");
402  } else {
403  B2DEBUG(20, "BKLM::GeometryPar: DoBeamBackgroundStudy is disabled");
404  }
412 
413  // set up displaced geometry
415  // set up ReconstructionAlignment, so that those information can pass to Modules
417 
418  for (int section = 0; section <= BKLMElementNumbers::getMaximalSectionNumber(); ++section) {
419  bool isForward = (section == BKLMElementNumbers::c_ForwardSection);
420  for (int sector = 1; sector <= m_NSector; ++sector) {
421  bool hasChimney = (!isForward) && (sector == BKLMElementNumbers::c_ChimneySector);
422  int nZStrips = (hasChimney ? m_NZStripsChimney : m_NZStrips);
423  int nZScints = (hasChimney ? m_NZScintsChimney : m_NZScints);
424  CLHEP::HepRotation rotation;
425  if (!isForward)
426  rotation.rotateX(M_PI);
427  rotation.rotateZ(m_SectorRotation[section][sector - 1]);
428  for (int layer = 1; layer <= m_NLayer; ++layer) {
429  bool isFlipped = m_IsFlipped[section][sector - 1][layer - 1];
430  CLHEP::Hep3Vector localReconstructionShift(m_LocalReconstructionShiftX[section][sector - 1][layer - 1],
431  m_LocalReconstructionShiftY[section][sector - 1][layer - 1],
432  m_LocalReconstructionShiftZ[section][sector - 1][layer - 1]);
433  double dx = getActiveMiddleRadius(section, sector, layer);
434  double dz = getModuleHalfSize(layer, hasChimney).z() - getModuleInteriorHalfSize2(layer, hasChimney).z();
435  CLHEP::Hep3Vector localOrigin(dx, 0.0, dz);
436  int moduleID = BKLMElementNumbers::moduleNumber(
437  section, sector, layer);
438  if (m_HasRPCs[layer - 1]) {
439  localOrigin.setZ(localOrigin.z() + getModuleInteriorHalfSize1(layer, hasChimney).z() - getGasHalfSize(layer, hasChimney).z());
440  Module* pModule = new Module(m_PhiStripWidth[layer - 1],
441  (layer == 1 ? 2 : 1),
442  m_NPhiStrips[layer - 1] - (layer == 1 ? 1 : 0),
443  m_ZStripWidth[layer - 1],
444  nZStrips,
445  CLHEP::Hep3Vector(0.0, 0.0, m_OffsetZ) + rotation(localOrigin),
446  localReconstructionShift,
447  rotation
448  );
449  pModule->setDisplacedGeo(getModuleDisplacedGeo(section, sector, layer));
450  pModule->setAlignment(getModuleAlignment(section, sector, layer));
451  m_Modules.insert(std::pair<int, Module*>(moduleID, pModule));
452  } else {
453  double dy = getScintEnvelopeOffset(layer, hasChimney).y() * getScintEnvelopeOffsetSign(layer) * (isFlipped ? -1.0 : 1.0);
454  localOrigin.setY(dy);
455  Module* pModule = new Module(m_ScintWidth,
456  m_NPhiScints[layer - 1],
458  nZScints,
459  CLHEP::Hep3Vector(0.0, 0.0, m_OffsetZ) + rotation(localOrigin),
460  localReconstructionShift,
461  rotation,
462  isFlipped
463  );
464  pModule->setDisplacedGeo(getModuleDisplacedGeo(section, sector, layer));
465  pModule->setAlignment(getModuleAlignment(section, sector, layer));
466  m_Modules.insert(std::pair<int, Module*>(moduleID, pModule));
467  double base = -0.5 * (m_NPhiScints[layer - 1] + 1) * m_ScintWidth;
468  for (int scint = 1; scint <= m_NPhiScints[layer - 1]; ++scint) {
469  double length = nZScints * m_ScintWidth;
470  if (length > m_MaximalPhiStripLength)
471  m_MaximalPhiStripLength = length;
472  pModule->addPhiScint(scint,
473  length,
474  0.0,
475  base + scint * m_ScintWidth
476  );
477  }
478  base = -0.5 * (nZScints + 1) * m_ScintWidth;
479  for (int scint = 1; scint <= nZScints; ++scint) {
480  int scint0 = m_NZScints - getNZScints(hasChimney);
481  double dLength = m_ZScintDLength[layer - 1][scint0 + scint - 1];
482  double length = m_NPhiScints[layer - 1] * m_ScintWidth + dLength;
483  if (length > m_MaximalZStripLength)
484  m_MaximalZStripLength = length;
485  pModule->addZScint(scint,
486  length,
487  -0.5 * dLength,
488  base + scint * m_ScintWidth
489  );
490  }
491  }
492  }
493  }
494  }
495 
496 }
497 
498 double GeometryPar::getLayerInnerRadius(int layer) const
499 {
500  if (layer == 1) {
501  return m_Gap1InnerRadius;
502  }
503  if (layer > m_NLayer) {
504  return m_OuterRadius;
505  }
506  return m_GapInnerRadius - (m_IronNominalHeight - m_IronActualHeight) / 2.0 + m_LayerHeight * (layer - 1);
507 }
508 
509 double GeometryPar::getLayerOuterRadius(int layer) const
510 {
511  return getLayerInnerRadius(layer + 1);
512 }
513 
514 const CLHEP::Hep3Vector GeometryPar::getGapHalfSize(int layer, bool hasChimney) const
515 {
516  double r, ds, dx;
517  if (layer == 1) {
519  ds = m_Gap1IronWidth;
520  dx = 0.5 * m_Gap1ActualHeight;
521  } else {
522  r = m_GapInnerRadius + m_GapNominalHeight + m_LayerHeight * (layer - 1);
523  ds = m_GapIronWidth;
524  dx = 0.5 * m_GapActualHeight;
525  }
526  double dz = 0.5 * (hasChimney ? m_GapLength - m_ChimneyLength : m_GapLength);
527  return CLHEP::Hep3Vector(dx, r * tan(M_PI / m_NSector) - ds, dz);
528 
529 }
530 
531 const CLHEP::Hep3Vector GeometryPar::getModuleHalfSize(int layer, bool hasChimney) const
532 {
533  CLHEP::Hep3Vector size = getGapHalfSize(layer, hasChimney);
534  size.setX(0.5 * m_ModuleHeight);
535  size.setZ(0.5 * (hasChimney ? m_ModuleLengthChimney : m_ModuleLength));
536  return size;
537 }
538 
539 const CLHEP::Hep3Vector GeometryPar::getModuleInteriorHalfSize1(int layer, bool hasChimney) const
540 {
541  CLHEP::Hep3Vector size = getModuleHalfSize(layer, hasChimney);
542  size.setX(size.x() - m_ModuleCoverHeight);
543  size.setY(size.y() - m_ModuleFrameWidth);
544  size.setZ(size.z() - m_ModuleFrameWidth);
545  return size;
546 }
547 
548 const CLHEP::Hep3Vector GeometryPar::getModuleInteriorHalfSize2(int layer, bool hasChimney) const
549 {
550  CLHEP::Hep3Vector size = getModuleHalfSize(layer, hasChimney);
551  size.setX(size.x() - m_ModuleFrameThickness - m_ModuleCoverHeight);
552  size.setY(size.y() - m_ModuleFrameThickness);
553  size.setZ(size.z() - m_ModuleFrameThickness);
554  return size;
555 }
556 
557 const CLHEP::Hep3Vector GeometryPar::getElectrodeHalfSize(int layer, bool hasChimney) const
558 {
559  CLHEP::Hep3Vector size = getModuleInteriorHalfSize1(layer, hasChimney);
560  size.setX(2.0 * m_ModuleGlassHeight + m_ModuleGasHeight);
561  return size;
562 }
563 
564 const CLHEP::Hep3Vector GeometryPar::getGasHalfSize(int layer, bool hasChimney) const
565 {
566  CLHEP::Hep3Vector size = getElectrodeHalfSize(layer, hasChimney);
567  size.setX(0.5 * m_ModuleGasHeight);
568  size.setY(size.y() - m_ModuleGasSpacerWidth);
569  size.setZ(size.z() - m_ModuleGasSpacerWidth);
570  return size;
571 }
572 
573 const CLHEP::Hep3Vector GeometryPar::getAirHalfSize(int layer, bool hasChimney) const
574 {
575  CLHEP::Hep3Vector size = getModuleInteriorHalfSize2(layer, hasChimney);
576  size.setX(m_ScintHeight);
577  return size;
578 }
579 
580 const CLHEP::Hep3Vector GeometryPar::getScintEnvelopeHalfSize(int layer, bool hasChimney) const
581 {
582  return CLHEP::Hep3Vector(0.5 * m_ScintHeight,
583  0.5 * m_ScintWidth * getNPhiScints(layer),
584  0.5 * m_ScintWidth * getNZScints(hasChimney)
585  );
586 }
587 
588 int GeometryPar::getNPhiScints(int layer) const
589 {
590  if ((layer <= 0) || (layer > m_NLayer))
591  return 0;
592  return m_NPhiScints[layer - 1];
593 }
594 
596 {
598 }
599 
600 double GeometryPar::getGapMiddleRadius(int layer) const
601 {
602  if (layer == 1) {
603  return m_Gap1InnerRadius + 0.5 * m_Gap1ActualHeight;
604  }
605  return m_GapInnerRadius + 0.5 * m_GapActualHeight + m_LayerHeight * (layer - 1);
606 }
607 
608 double GeometryPar::getModuleMiddleRadius(int layer) const
609 {
610  if (layer == 1) {
611  return m_Gap1InnerRadius + 0.5 * m_Gap1NominalHeight;
612  }
613  return m_GapInnerRadius + 0.5 * m_GapNominalHeight + m_LayerHeight * (layer - 1);
614 }
615 
616 double GeometryPar::getActiveMiddleRadius(int section, int sector, int layer) const
617 {
618  // place the active radius midway between the two readout planes
619  // (same as positioning in GeoBKLMCreator.cc)
620  double dx = getModuleMiddleRadius(layer) - getGapMiddleRadius(layer);
621  int s1 = sector - 1;
622  int s2 = m_NSector / 2;
623  if (s1 % s2 == 0) {
624  dx = 0.0;
625  } else if (s1 > s2) {
626  dx = -dx;
627  }
628  double r = getGapMiddleRadius(layer) + dx;
629  if (!hasRPCs(layer)) {
630  if (m_IsFlipped[section][sector - 1][layer - 1]) {
631  r -= getPolystyreneOffsetX();
632  } else {
633  r += getPolystyreneOffsetX();
634  }
635  }
636  return r;
637 }
638 
639 const CLHEP::Hep3Vector GeometryPar::getScintEnvelopeOffset(int layer, bool hasChimney) const
640 {
641  CLHEP::Hep3Vector airHalfSize = getAirHalfSize(layer, hasChimney);
642  CLHEP::Hep3Vector envelopeHalfSize = getScintEnvelopeHalfSize(layer, hasChimney);
643  CLHEP::Hep3Vector offset((airHalfSize.x() - envelopeHalfSize.x()),
644  (airHalfSize.y() - envelopeHalfSize.y()),
645  -(airHalfSize.z() - envelopeHalfSize.z()));
646  return offset;
647 }
648 
649 const CLHEP::Hep3Vector GeometryPar::getChimneyHalfSize(int layer) const
650 {
651  return CLHEP::Hep3Vector(0.5 * (getLayerOuterRadius(layer) - getLayerInnerRadius(layer)),
652  0.5 * m_ChimneyWidth,
654 }
655 
656 const CLHEP::Hep3Vector GeometryPar::getChimneyPosition(int layer) const
657 {
658  return CLHEP::Hep3Vector(0.5 * (getLayerOuterRadius(layer) + getLayerInnerRadius(layer)),
659  0.0,
661 }
662 
663 const CLHEP::Hep3Vector GeometryPar::getSupportPlateHalfSize(bool hasChimney) const
664 {
665  CLHEP::Hep3Vector size;
666  size.setX(0.5 * m_SupportPlateHeight);
667  size.setY(0.5 * m_SupportPlateWidth);
668  if (hasChimney) {
669  size.setZ(0.5 * m_SupportPlateLengthChimney);
670  } else {
671  size.setZ(0.5 * m_SupportPlateLength);
672  }
673  return size;
674 }
675 
676 double GeometryPar::getBracketZPosition(int bracket, bool hasChimney) const
677 {
678  double z = m_BracketInset - 0.5 * m_GapLength;
679  if (bracket == 0)
680  return z;
681  if (hasChimney) {
683  } else {
684  return (bracket == 1 ? 0.0 : -z);
685  }
686 }
687 
688 const CLHEP::Hep3Vector GeometryPar::getReadoutContainerHalfSize(void) const
689 {
690  return CLHEP::Hep3Vector(0.5 * m_ReadoutContainerWidth,
693  );
694 }
695 
696 const CLHEP::Hep3Vector GeometryPar::getReadoutCarrierHalfSize(void) const
697 {
698  return CLHEP::Hep3Vector(0.5 * m_ReadoutCarrierWidth,
701  );
702 }
703 
704 const CLHEP::Hep3Vector GeometryPar::getReadoutPreamplifierHalfSize(void) const
705 {
706  return CLHEP::Hep3Vector(0.5 * m_ReadoutPreamplifierWidth,
709  );
710 }
711 
712 const CLHEP::Hep3Vector GeometryPar::getReadoutConnectorsHalfSize(void) const
713 {
714  return CLHEP::Hep3Vector(0.5 * m_ReadoutConnectorsWidth,
717  );
718 }
719 
720 bool GeometryPar::hasRPCs(int layer) const
721 {
722  if ((layer <= 0) || (layer > m_NLayer))
723  return false;
724  return m_HasRPCs[layer - 1];
725 }
726 
727 const Module* GeometryPar::findModule(int section, int sector, int layer) const
728 {
729  int moduleID = BKLMElementNumbers::moduleNumber(section, sector, layer);
730  map<int, Module*>::const_iterator iM = m_Modules.find(moduleID);
731  return (iM == m_Modules.end() ? nullptr : iM->second);
732 }
733 
734 const HepGeom::Transform3D GeometryPar::getModuleAlignment(int section, int sector, int layer) const
735 {
736  int moduleID = BKLMElementNumbers::moduleNumber(section, sector, layer);
737  map<int, HepGeom::Transform3D>::const_iterator iA = m_Alignments.find(moduleID);
738  return (iA == m_Alignments.end() ? HepGeom::Transform3D() : iA->second);
739 }
740 
741 const HepGeom::Transform3D GeometryPar::getModuleDisplacedGeo(int section, int sector, int layer) const
742 {
743  int moduleID = BKLMElementNumbers::moduleNumber(section, sector, layer);
744  map<int, HepGeom::Transform3D>::const_iterator iDis = m_Displacements.find(moduleID);
745  return (iDis == m_Displacements.end() ? HepGeom::Transform3D() : iDis->second);
746 }
747 
749 {
750  DBObjPtr<BKLMAlignment> bklmAlignment;
751  if (!bklmAlignment.isValid())
752  B2FATAL("No BKLM alignment data.");
754  for (KLMChannelIndex bklmModule = bklmModules.beginBKLM();
755  bklmModule != bklmModules.endBKLM(); ++bklmModule) {
756  KLMModuleNumber module = bklmModule.getKLMModuleNumber();
757  const KLMAlignmentData* alignmentData =
758  bklmAlignment->getModuleAlignment(module);
759  if (alignmentData == nullptr)
760  B2FATAL("Incomplete BKLM alignment data.");
761  HepGeom::Transform3D alignment;
763  alignmentData->getDeltaU(),
764  alignmentData->getDeltaV(),
765  alignmentData->getDeltaW(),
766  alignmentData->getDeltaAlpha(),
767  alignmentData->getDeltaBeta(),
768  alignmentData->getDeltaGamma());
769  int moduleID = BKLMElementNumbers::moduleNumber(
770  bklmModule.getSection(), bklmModule.getSector(),
771  bklmModule.getLayer());
772  m_Alignments.insert(std::pair<int, HepGeom::Transform3D>(moduleID, alignment));
773  }
774  // Add callback to itself.
775  bklmAlignment.addCallback(this, &bklm::GeometryPar::readAlignmentFromDB);
776 }
777 
779 {
780  DBObjPtr<BKLMAlignment> bklmDisplacement("BKLMDisplacement");
781  if (!bklmDisplacement.isValid())
782  B2FATAL("No BKLM displaced geometry data in database!");
784  for (KLMChannelIndex bklmModule = bklmModules.beginBKLM();
785  bklmModule != bklmModules.endBKLM(); ++bklmModule) {
786  KLMModuleNumber module = bklmModule.getKLMModuleNumber();
787  const KLMAlignmentData* displacementData =
788  bklmDisplacement->getModuleAlignment(module);
789  if (displacementData == nullptr)
790  B2FATAL("Incomplete BKLM displacement data.");
791  HepGeom::Transform3D displacement;
792  displacement = getTransformFromRigidBodyParams(
793  displacementData->getDeltaU(),
794  displacementData->getDeltaV(),
795  displacementData->getDeltaW(),
796  displacementData->getDeltaAlpha(),
797  displacementData->getDeltaBeta(),
798  displacementData->getDeltaGamma());
799  int moduleID = BKLMElementNumbers::moduleNumber(
800  bklmModule.getSection(), bklmModule.getSector(),
801  bklmModule.getLayer());
802  m_Displacements.insert(std::pair<int, HepGeom::Transform3D>(moduleID, displacement));
803  }
804  // Add callback to itself.
806 }
807 
808 HepGeom::Transform3D GeometryPar::getTransformFromRigidBodyParams(double dU, double dV, double dW, double dAlpha, double dBeta,
809  double dGamma)
810 {
811 
812  CLHEP::HepRotation dy = CLHEP::HepRotationY(-dAlpha);
813  CLHEP::HepRotation dz = CLHEP::HepRotationZ(-dBeta);
814  CLHEP::HepRotation dx = CLHEP::HepRotationX(-dGamma);
815  CLHEP::Hep3Vector shift(dW, dU, dV);
816 
817  //we do dx-->dz-->dy ( local w-->v-->u), because angles are definded as intrinsic rotations u-->v'-->w''
818  //the equivalent one is extrinsic rotation with the order w (gamma)--> v(beta) --> u (alpha)
819  //and then we map it to global rotation x -> z -> y axis
820  return HepGeom::Transform3D(dy * dz * dx, shift);
821 }
BKLM element numbers.
@ c_ChimneySector
Chimney sector: BB3 in 1-based notation; BB2 in 0-based notation.
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
static constexpr int getMaximalSectorNumber()
Get maximal sector number (1-based).
static KLMModuleNumber moduleNumber(int section, int sector, int layer, bool fatalError=true)
Get module number.
static constexpr int getMaximalSectionNumber()
Get maximal section number (0-based).
The Class for BKLM geometry.
The Class for BeamBackground Sensitive Detector.
void addCallback(std::function< void(const std::string &)> callback, bool onDestruction=false)
Add a callback method.
bool isValid() const
Check whether a valid object was obtained from the database.
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
void append(const std::string &path)
Append something to the current path, modifying the GearDir in place.
Definition: GearDir.h:52
KLM Alignment data.
float getDeltaU() const
Get shift in U.
float getDeltaV() const
Get shift in V.
float getDeltaW() const
Get shift in W.
float getDeltaGamma() const
Get rotation in alpha.
float getDeltaAlpha() const
Get rotation in alpha.
float getDeltaBeta() const
Get rotation in alpha.
KLM channel index.
KLMChannelIndex beginBKLM()
First channel for BKLM.
KLMChannelIndex & endBKLM()
Last channel for BKLM.
Provides BKLM geometry parameters for simulation, reconstruction etc (from Gearbox or DataBase)
Definition: GeometryPar.h:38
double m_LocalReconstructionShiftX[2][BKLMElementNumbers::getMaximalSectorNumber()][BKLMElementNumbers::getMaximalLayerNumber()]
Reconstruction dx in local system. displacement, not alignment.
Definition: GeometryPar.h:953
double m_GapInnerRadius
Radius of the inner tangent circle of virtual gap 0 (assuming equal-height layers)
Definition: GeometryPar.h:703
double m_BracketRibWidth
width of the innermost-module support plate's bracket's rib
Definition: GeometryPar.h:869
double m_ScintWidth
width of one scintillator strip (cm), including the TiO2 coating
Definition: GeometryPar.h:791
double m_LocalReconstructionShiftZ[2][BKLMElementNumbers::getMaximalSectorNumber()][BKLMElementNumbers::getMaximalLayerNumber()]
Reconstruction dz in local system. displacement, not alignment.
Definition: GeometryPar.h:959
int m_NZStripsChimney
number of z-measuring cathode strips in a chimney-sector RPC module
Definition: GeometryPar.h:715
double m_ReadoutConnectorsHeight
Height of the readout connectors pair.
Definition: GeometryPar.h:929
~GeometryPar()
Hidden destructor.
Definition: GeometryPar.cc:72
double m_SupportPlateLengthChimney
length of the innermost-module support plate in the chimney sector
Definition: GeometryPar.h:857
bool m_HasRPCs[BKLMElementNumbers::getMaximalLayerNumber()]
Flag to indicate whether layer contains RPCs (true) or scintillators (false)
Definition: GeometryPar.h:950
double m_ChimneyPipeInnerRadius
inner radius of the chimney pipe
Definition: GeometryPar.h:830
double m_BracketLength
length of the innermost-module support plate's bracket
Definition: GeometryPar.h:866
double m_MaximalZStripLength
maximal Z strip length (for scintillators).
Definition: GeometryPar.h:740
double m_ReadoutContainerHeight
Height of the readout station's container.
Definition: GeometryPar.h:899
double m_ReadoutCarrierHeight
Height of the readout carrier card.
Definition: GeometryPar.h:908
double m_ModuleLengthChimney
length along z of the module in the chimney sector
Definition: GeometryPar.h:746
const CLHEP::Hep3Vector getReadoutContainerHalfSize(void) const
Get the size (dx,dy,dz) of the readout container.
Definition: GeometryPar.cc:688
void readDisplacedGeoFromDB()
Initialize and Updates displacements parameters from DB for geometry constructor, registers itself fo...
Definition: GeometryPar.cc:778
double m_BracketInnerRadius
inner radius of the innermost-module support plate's bracket
Definition: GeometryPar.h:878
double m_BracketWidth
width of the innermost-module support plate's bracket
Definition: GeometryPar.h:860
double m_BraceWidthChimney
width of the central brace in the middle of the cable-services channel in the chimney sector
Definition: GeometryPar.h:845
int m_NPhiStrips[BKLMElementNumbers::getMaximalLayerNumber()]
Number of phi-readout RPC strips in each layer.
Definition: GeometryPar.h:706
double m_ReadoutContainerLength
Length of the readout station's container.
Definition: GeometryPar.h:893
double m_Gap1IronWidth
Width (at the outer radius) of the adjacent structural iron on either side of innermost gap.
Definition: GeometryPar.h:688
double getLayerOuterRadius(int layer) const
Get the outer radius of specified layer.
Definition: GeometryPar.cc:509
const CLHEP::Hep3Vector getModuleHalfSize(int layer, bool hasChimney) const
Get the size (dx,dy,dz) of the detector module of specified layer.
Definition: GeometryPar.cc:531
double m_IronActualHeight
Actual height of a layer's stuctural iron.
Definition: GeometryPar.h:670
double m_ZStripWidth[BKLMElementNumbers::getMaximalLayerNumber()]
Width of the z strips on each layer.
Definition: GeometryPar.h:731
double m_ReadoutPreamplifierWidth
Width of the preamplifier card.
Definition: GeometryPar.h:914
double m_IronNominalHeight
Nominal height of a layer's structural iron.
Definition: GeometryPar.h:667
const HepGeom::Transform3D getModuleAlignment(int section, int sector, int layer) const
Get the alignment transformation of a module.
Definition: GeometryPar.cc:734
const CLHEP::Hep3Vector getModuleInteriorHalfSize1(int layer, bool hasChimney) const
Get the size (dx,dy,dz) of the detector module's interior volume 1.
Definition: GeometryPar.cc:539
const Module * findModule(int section, int sector, int layer) const
Get the pointer to the definition of a module.
Definition: GeometryPar.cc:727
double m_ScintHeight
height of one scintillator strip (cm), including the TiO2 coating
Definition: GeometryPar.h:794
double m_ChimneyHousingInnerRadius
inner radius of the chimney housing
Definition: GeometryPar.h:818
double m_ModuleFoamHeight
height of a detector module's transmission-line foam
Definition: GeometryPar.h:755
std::map< int, Module * > m_Modules
map of <volumeIDs, pointers to defined modules>
Definition: GeometryPar.h:965
int m_ScintEnvelopeOffsetSign[BKLMElementNumbers::getMaximalLayerNumber()]
Sign (+/-1) of scintillator-envelope's shift along y axis within its enclosing module for MPPC placem...
Definition: GeometryPar.h:725
double m_BracketRibThickness
thickness of the innermost-module support plate's bracket's rib
Definition: GeometryPar.h:872
double m_Gap1NominalHeight
Nominal height of the innermost gap.
Definition: GeometryPar.h:676
int getNPhiScints(int layer) const
Get the number of phi-measuring scintillators in a scintillator module.
Definition: GeometryPar.cc:588
const CLHEP::Hep3Vector getScintEnvelopeOffset(int layer, bool hasChimney) const
Get the shift (dx,dy,dz) of the scintillator detector module's scintillator envelope within its enclo...
Definition: GeometryPar.cc:639
bool hasRPCs(int layer) const
Determine if the sensitive detectors in a given layer are RPCs (=true) or scintillators (=false)
Definition: GeometryPar.cc:720
double m_ScintFiberRadius
radius (cm) of the central WLS fiber in the scintillator strip
Definition: GeometryPar.h:800
double m_ZScintDLength[BKLMElementNumbers::getMaximalLayerNumber()][NZSCINT]
Shortening of the nominal length of the z scintillators.
Definition: GeometryPar.h:734
double m_MPPCLength
MPPC length.
Definition: GeometryPar.h:941
double m_SupportPlateLength
length of the innermost-module support plate
Definition: GeometryPar.h:854
const CLHEP::Hep3Vector getScintEnvelopeHalfSize(int layer, bool hasChimney) const
Get the size (dx,dy,dz) of the scintillator detector module's scintillator envelope.
Definition: GeometryPar.cc:580
double m_ModuleMylarHeight
height of a detector module's mylar insulation
Definition: GeometryPar.h:758
const CLHEP::Hep3Vector getChimneyPosition(int layer) const
Get the position of the chimney hole in the specified layer.
Definition: GeometryPar.cc:656
double m_ModuleFrameThickness
thickness of a detector module's frame ("C" shape - thickness of vertical leg)
Definition: GeometryPar.h:776
int m_NPhiScints[BKLMElementNumbers::getMaximalLayerNumber()]
Number of phi-readout scintillators in each layer.
Definition: GeometryPar.h:709
double m_ChimneyShieldInnerRadius
inner radius of the chimney shield
Definition: GeometryPar.h:824
std::map< int, HepGeom::Transform3D > m_Displacements
map of <volumeIDs, displacement Transform3D>
Definition: GeometryPar.h:971
double m_Rotation
Global rotation about z of the BKLM.
Definition: GeometryPar.h:640
int m_NReadoutStation
Number of preamplifier readout stations.
Definition: GeometryPar.h:884
double getBracketZPosition(int, bool) const
Get the position of a layer-0 support plate's bracket.
Definition: GeometryPar.cc:676
double m_ModulePolystyreneOuterHeight
height of the outer polystyrene-filler sheet
Definition: GeometryPar.h:788
const CLHEP::Hep3Vector getReadoutPreamplifierHalfSize(void) const
Get the size (dx,dy,dz) of the preamplifier card.
Definition: GeometryPar.cc:704
int getNZScints(bool isChimney) const
Get the number of z-measuring scintillators in a scintillator module.
Definition: GeometryPar.h:281
double m_ChimneyLength
length along z of the chimney hole
Definition: GeometryPar.h:809
double getPolystyreneOffsetX(void) const
Get the radial offset of the scintillator detector module's active envelope due to difference in poly...
Definition: GeometryPar.cc:595
double m_ReadoutContainerWidth
Width of the readout station's container.
Definition: GeometryPar.h:896
double m_OffsetZ
Global offset along z of the BKLM.
Definition: GeometryPar.h:646
double m_ModuleGasSpacerWidth
width of a detector module's spacer
Definition: GeometryPar.h:779
double m_PhiStripWidth[BKLMElementNumbers::getMaximalLayerNumber()]
Width of the phi strips on each layer.
Definition: GeometryPar.h:728
const CLHEP::Hep3Vector getReadoutConnectorsHalfSize(void) const
Get the size (dx,dy,dz) of the readout connectors pair.
Definition: GeometryPar.cc:712
double m_OuterRadius
Radius of the circle tangent to the sides of the outer polygon.
Definition: GeometryPar.h:658
double m_BracketThickness
thickness of the innermost-module support plate's bracket
Definition: GeometryPar.h:863
double m_ModuleGlassHeight
height of a detector module's glass electrode
Definition: GeometryPar.h:764
const CLHEP::Hep3Vector getModuleInteriorHalfSize2(int layer, bool hasChimney) const
Get the size (dx,dy,dz) of the scintillator detector module's polystyrene filler.
Definition: GeometryPar.cc:548
double m_MaximalPhiStripLength
Maximal phi strip length (for scintillators).
Definition: GeometryPar.h:737
GeometryPar(const GearDir &)
Hidden constructor.
Definition: GeometryPar.cc:50
double m_RibThickness
thickness of the radial rib that supports the solenoid / inner detectors
Definition: GeometryPar.h:836
double m_ScintTiO2ThicknessTop
thickness (cm) of the TiO2 coating on the top (and bottom) of the scintillator strip
Definition: GeometryPar.h:803
double m_ModuleReadoutHeight
height of a detector module's readout
Definition: GeometryPar.h:761
const CLHEP::Hep3Vector getGapHalfSize(int layer, bool hasChimney) const
Get the size (dx,dy,dz) of the gap [=slot] of specified layer.
Definition: GeometryPar.cc:514
double m_ModuleLength
length along z of the module
Definition: GeometryPar.h:743
double m_HalfLength
Half-length along z of the BKLM.
Definition: GeometryPar.h:661
double m_ReadoutPreamplifierHeight
Height of the preamplifier card.
Definition: GeometryPar.h:917
double m_ChimneyWidth
width of the chimney hole
Definition: GeometryPar.h:812
double m_LayerHeight
Height of a layer: internal use only.
Definition: GeometryPar.h:685
double m_ChimneyShieldOuterRadius
outer radius of the chimney shield
Definition: GeometryPar.h:827
int m_NZScintsChimney
number of z-measuring scintillators in a chimney-sector scintillator module
Definition: GeometryPar.h:721
double m_ReadoutConnectorsLength
Length of the readout connectors pair.
Definition: GeometryPar.h:923
double m_SupportPlateWidth
width of the innermost-module support plate
Definition: GeometryPar.h:848
double m_Layer1Height
Height of layer 0: internal use only.
Definition: GeometryPar.h:682
double m_MPPCHeight
MPPC height.
Definition: GeometryPar.h:947
std::map< int, HepGeom::Transform3D > m_Alignments
map of <volumeIDs, alignment Transform3D>
Definition: GeometryPar.h:968
void readAlignmentFromDB()
Initialize and Updates alignment parameters from DB for reconstruction, that is for Module constructi...
Definition: GeometryPar.cc:748
int m_NZStrips
number of z-measuring cathode strips in a standard RPC module
Definition: GeometryPar.h:712
double m_SectorRotation[2][BKLMElementNumbers::getMaximalSectorNumber()]
Global rotation angle of a sector.
Definition: GeometryPar.h:643
double m_BracketInset
distance from support plate's end of bracket
Definition: GeometryPar.h:875
int m_NLayer
Number of layers in one sector.
Definition: GeometryPar.h:664
const CLHEP::Hep3Vector getSupportPlateHalfSize(bool) const
Get the size of the layer-0 support plate.
Definition: GeometryPar.cc:663
double m_GapLength
Length along z of each gap.
Definition: GeometryPar.h:691
double m_MPPCHousingRadius
MPPC housing radius.
Definition: GeometryPar.h:935
double m_MPPCHousingLength
MPPC housing length.
Definition: GeometryPar.h:938
double m_CablesWidth
width of the cable-services channel at each end
Definition: GeometryPar.h:839
double m_ScintBoreRadius
radius (cm) of the central bore in the scintillator strip
Definition: GeometryPar.h:797
double m_ReadoutCarrierLength
Length of the readout carrier card.
Definition: GeometryPar.h:902
double m_ReadoutConnectorsWidth
Width of the readout connectors pair.
Definition: GeometryPar.h:926
double m_GapIronWidth
Width (at the outer radius) of the adjacent structural iron on either side of a gap.
Definition: GeometryPar.h:700
double m_ReadoutStationPosition[NSTATION]
Position of each readout station along its relevant axis.
Definition: GeometryPar.h:890
double m_ReadoutPreamplifierLength
Length of the preamplifier card.
Definition: GeometryPar.h:911
double m_ModuleGasHeight
height of a detector module's gas gap
Definition: GeometryPar.h:767
double getActiveMiddleRadius(int section, int sector, int layer) const
Get the radial midpoint of the detector module's active volume of specified layer.
Definition: GeometryPar.cc:616
double m_BraceWidth
width of the central brace in the middle of the cable-services channel
Definition: GeometryPar.h:842
const CLHEP::Hep3Vector getChimneyHalfSize(int layer) const
Get the size of the chimney hole in the specified layer.
Definition: GeometryPar.cc:649
BkgSensitiveDetector * m_BkgSensitiveDetector
Pointer to object that creates BeamBkgHits for BKLM.
Definition: GeometryPar.h:637
double m_ModuleFrameWidth
width of a detector module's frame ("C" shape - width of horizontal leg)
Definition: GeometryPar.h:773
double m_MPPCWidth
MPPC width.
Definition: GeometryPar.h:944
double m_ChimneyHousingOuterRadius
outer radius of the chimney housing
Definition: GeometryPar.h:821
double getGapMiddleRadius(int layer) const
Get the radial midpoint of the gap of specified layer.
Definition: GeometryPar.cc:600
double m_GapNominalHeight
Nominal height of outer gaps.
Definition: GeometryPar.h:694
double m_ReadoutConnectorsPosition
Position of the readout connectors pair along the length of the carrier card.
Definition: GeometryPar.h:932
double m_ModulePolystyreneInnerHeight
height of the inner polystyrene-filler sheet
Definition: GeometryPar.h:785
double m_ChimneyCoverThickness
thickness of the chimney's iron cover plate
Definition: GeometryPar.h:815
void readFromDB(const BKLMGeometryPar &)
Get geometry parameters from Conditions Database.
Definition: GeometryPar.cc:262
void clear()
Clear all geometry parameters.
Definition: GeometryPar.cc:77
double m_Phi
Starting angle of the polygon shape.
Definition: GeometryPar.h:649
double m_Gap1ActualHeight
Actual height of the innermost gap.
Definition: GeometryPar.h:679
std::vector< double > m_ReadoutPreamplifierPosition
Positions of the preamplifiers along the length of the carrier card.
Definition: GeometryPar.h:920
double m_ModuleHeight
height of a detector module
Definition: GeometryPar.h:770
const CLHEP::Hep3Vector getReadoutCarrierHalfSize(void) const
Get the size (dx,dy,dz) of the carrier card.
Definition: GeometryPar.cc:696
void read(const GearDir &)
Get geometry parameters from Gearbox.
Definition: GeometryPar.cc:87
const CLHEP::Hep3Vector getGasHalfSize(int layer, bool hasChimney) const
Get the size (dx,dy,dz) of the detector module's gas gaps of specified layer.
Definition: GeometryPar.cc:564
double m_GapActualHeight
Actual height of outer gaps.
Definition: GeometryPar.h:697
const CLHEP::Hep3Vector getElectrodeHalfSize(int layer, bool hasChimney) const
Get the size (dx,dy,dz) of the detector module's electrode of specified layer.
Definition: GeometryPar.cc:557
double m_LocalReconstructionShiftY[2][BKLMElementNumbers::getMaximalSectorNumber()][BKLMElementNumbers::getMaximalLayerNumber()]
Reconstruction dy in local system. displacement, not alignment.
Definition: GeometryPar.h:956
double m_ModuleCoverHeight
height of a detector module's aluminum cover
Definition: GeometryPar.h:749
double m_Gap1InnerRadius
Radius of the inner tangent circle of the innermost gap.
Definition: GeometryPar.h:673
int getScintEnvelopeOffsetSign(int layer) const
Get the sign (+/-1) of scintillator-envelope's shift along y axis within its enclosing module for MPP...
Definition: GeometryPar.h:98
double m_SolenoidOuterRadius
Outer radius of the solenoid.
Definition: GeometryPar.h:655
double getModuleMiddleRadius(int layer) const
Get the radial midpoint of the detector module of specified layer.
Definition: GeometryPar.cc:608
int m_NSector
Number of sectors (=8 : octagonal)
Definition: GeometryPar.h:652
bool m_DoBeamBackgroundStudy
Flag for enabling beam background study (=use bkg sensitive-detector function too)
Definition: GeometryPar.h:634
double m_ChimneyPipeOuterRadius
outer radius of the chimney pipe
Definition: GeometryPar.h:833
const HepGeom::Transform3D getModuleDisplacedGeo(int section, int sector, int layer) const
Get the displacement transformation of a module.
Definition: GeometryPar.cc:741
double getLayerInnerRadius(int layer) const
Get the inner radius of specified layer.
Definition: GeometryPar.cc:498
bool m_ReadoutStationIsPhi[NSTATION]
Selector for phi (true) or z (false) readout station.
Definition: GeometryPar.h:887
double m_ReadoutCarrierWidth
Width of the readout carrier card.
Definition: GeometryPar.h:905
double m_SupportPlateHeight
height of the innermost-module support plate
Definition: GeometryPar.h:851
double m_ScintTiO2ThicknessSide
thickness (cm) of the TiO2 coating on the left (and right) side of the scintillator strip
Definition: GeometryPar.h:806
double m_ModuleCopperHeight
height of a detector module's copper readout or ground plane
Definition: GeometryPar.h:752
bool m_IsFlipped[2][BKLMElementNumbers::getMaximalSectorNumber()][BKLMElementNumbers::getMaximalLayerNumber()]
Flag to indicate whether a module is flipped (true) or not (false) by 180 degrees about the z axis.
Definition: GeometryPar.h:962
double m_BracketCutoutDphi
angular width of the innermost-module support plate's bracket's cutout
Definition: GeometryPar.h:881
HepGeom::Transform3D getTransformFromRigidBodyParams(double dU, double dV, double dW, double dAlpha, double dBeta, double dGamma)
Convert 6 rigid body params (alignment/displacement) to corresponding Transform3D Angles in radians,...
Definition: GeometryPar.cc:808
const CLHEP::Hep3Vector getAirHalfSize(int layer, bool hasChimney) const
Get the size (dx,dy,dz) of the scintillator detector module's air filler.
Definition: GeometryPar.cc:573
void calculate()
Calculate additional geometry parameters.
Definition: GeometryPar.cc:397
int m_NZScints
number of z-measuring scintillators in a standard scintillator module
Definition: GeometryPar.h:718
Define the geometry of a BKLM module Each sector [octant] contains Modules.
Definition: Module.h:76
void addZScint(int scint, double length, double offset, double position)
Add one z-measuring scintillator strip to the module.
Definition: Module.cc:244
void setDisplacedGeo(const HepGeom::Transform3D &moduleDisplacedGeo)
Set the displaced geometry Transformation.
Definition: Module.cc:375
void addPhiScint(int scint, double length, double offset, double position)
Add one phi-measuring scintillator strip to the module.
Definition: Module.cc:232
void setAlignment(const HepGeom::Transform3D &moduleAlignment)
Set the alignment Transformation.
Definition: Module.cc:366
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.
uint16_t KLMModuleNumber
Module number.