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