Belle II Software development
GeoTOPCreator.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#include <top/geometry/GeoTOPCreator.h>
10#include <top/geometry/TOPGeometryPar.h>
11
12#include <geometry/Materials.h>
13#include <geometry/CreatorFactory.h>
14#include <geometry/utilities.h>
15#include <framework/gearbox/GearDir.h>
16#include <framework/gearbox/Unit.h>
17#include <framework/logging/Logger.h>
18#include <framework/database/Database.h>
19#include <framework/database/IntervalOfValidity.h>
20#include <framework/database/DBImportObjPtr.h>
21#include <framework/database/DBObjPtr.h>
22#include <top/simulation/SensitivePMT.h>
23#include <top/simulation/SensitiveBar.h>
24#include <simulation/background/BkgSensitiveDetector.h>
25#include <simulation/kernel/RunManager.h>
26
27#include <cmath>
28
29#include <G4LogicalVolume.hh>
30#include <G4PVPlacement.hh>
31#include <G4AssemblyVolume.hh>
32#include <G4LogicalSkinSurface.hh>
33#include <G4OpticalSurface.hh>
34
35#include <G4Box.hh>
36#include <G4UserLimits.hh>
37#include <G4Material.hh>
38#include <G4ExtrudedSolid.hh>
39#include <G4UnionSolid.hh>
40#include <G4Sphere.hh>
41#include <G4IntersectionSolid.hh>
42#include <G4SubtractionSolid.hh>
43#include <G4Region.hh>
44#include <G4Colour.hh>
45#include <G4TwoVector.hh>
46#include <G4ThreeVector.hh>
47
48#include <sstream>
49
50using namespace std;
51
52namespace Belle2 {
58 using namespace geometry;
59
60 namespace TOP {
61
63 geometry::CreatorFactory<GeoTOPCreator> GeoTOPFactory("TOPCreator");
64
65
67 {}
68
69
71 {
76 G4LogicalSkinSurface::CleanSurfaceTable();
77 }
78
79
80 void GeoTOPCreator::create(const GearDir& content, G4LogicalVolume& topVolume,
82 {
83
84 m_isBeamBkgStudy = content.getInt("BeamBackgroundStudy");
85
86 m_topgp->Initialize(content);
87 if (!m_topgp->isValid()) {
88 B2ERROR("TOP: geometry or mappers not valid (gearbox) - geometry not created");
89 return;
90 }
91
92 const auto* geo = m_topgp->getGeometry();
93 createGeometry(*geo, topVolume, type);
94
95 }
96
97
99 const IntervalOfValidity& iov)
100 {
101 m_topgp->Initialize(content);
102 if (!m_topgp->isValid()) {
103 B2ERROR("TOP: geometry or mappers not valid (gearbox) - no payloads imported");
104 return;
105 }
106
108 const auto* geo = m_topgp->getGeometry();
109 importObj.construct(*geo);
110 importObj.import(iov);
111
114
115 B2RESULT("TOP: geometry and mappers imported to database");
116
117 }
118
119
120 void GeoTOPCreator::createFromDB(const std::string& name, G4LogicalVolume& topVolume,
122 {
123
125 if (!m_topgp->isValid()) {
126 B2ERROR("Cannot create Geometry from Database: no configuration found for "
127 << name);
128 return;
129 }
130
131 const auto* geo = m_topgp->getGeometry();
132 createGeometry(*geo, topVolume, type);
133
134 }
135
136
138 G4LogicalVolume& topVolume,
140 {
143
146
147 geo.useGeantUnits();
148
149 double backwardLength = geo.getQBB().getPrismEnclosure().getLength();
150 double prismPosition = geo.getQBB().getPrismPosition();
151
152 G4Region* aRegion = 0;
153
154 for (const auto& geoModule : geo.getModules()) {
155 int moduleID = geoModule.getModuleID();
156 double barLength = geoModule.getBarLength();
157
158 // go to local (bar) frame
159
160 G4Transform3D T1 =
161 G4TranslateZ3D(backwardLength / 2 - prismPosition - barLength / 2);
162
163 // displaced geometry
164
165 const auto& displacement = geoModule.getModuleDisplacement();
166 G4Transform3D dRx = G4RotateX3D(displacement.getAlpha());
167 G4Transform3D dRy = G4RotateY3D(displacement.getBeta());
168 G4Transform3D dRz = G4RotateZ3D(displacement.getGamma());
169 G4Transform3D dtr = G4Translate3D(displacement.getX(),
170 displacement.getY(),
171 displacement.getZ());
172 G4Transform3D D = dtr * dRz * dRy * dRx;
173
174 // position the module
175
176 double radius = geoModule.getRadius();
177 double backwardZ = geoModule.getBackwardZ();
178 G4Transform3D tr = G4Translate3D(0, radius, barLength / 2 + backwardZ);
179 double phi = geoModule.getPhi() - M_PI / 2;
180 G4Transform3D Rz = G4RotateZ3D(phi);
181 G4Transform3D T = Rz * tr * D * T1;
182 auto* module = createModule(geo, moduleID);
183 std::string name = geoModule.getName();
184
185 // Set up region for production cuts
186 if (not aRegion) aRegion = new G4Region("TOPEnvelope"); // allocation moved inside the loop to prevent memory leak warning
187 module->SetRegion(aRegion);
188 aRegion->AddRootLogicalVolume(module);
189
190 new G4PVPlacement(T, module, name, &topVolume, false, moduleID);
191 }
192
193 if (m_numDecoupledPMTs > 0) B2WARNING("GeoTOPCreator, " << m_numDecoupledPMTs
194 << " PMT's are optically decoupled");
195 if (m_numBrokenGlues > 0) B2WARNING("GeoTOPCreator, " << m_numBrokenGlues
196 << " broken glues");
197 if (m_numPeelOffRegions > 0) B2WARNING("GeoTOPCreator, " << m_numPeelOffRegions
198 << " peel-off cookie regions");
199 }
200
201
202 G4LogicalVolume* GeoTOPCreator::createModule(const TOPGeometry& geo, int moduleID)
203 {
204 // note: z = 0 is at center of backward envelope
205
206 G4ThreeVector move;
207 G4RotationMatrix rot;
208
209 // create module envelope volume
210
211 const auto& geoQBB = geo.getQBB();
212 auto* module = createModuleEnvelope(geoQBB, moduleID);
213
214 // add quartz optics together with PMT array
215
216 const auto& geoModule = geo.getModule(moduleID);
217 auto* optics = assembleOptics(geoModule);
218
219 move.setZ(geoQBB.getPrismPosition() - geoQBB.getPrismEnclosure().getLength() / 2);
220 optics->MakeImprint(module, move, &rot);
221
222 // add front-end electronics
223
224 if (!m_frontEnd) {
226 }
227 double Lprism = geoModule.getPrism().getFullLength();
228 double Larray = geoModule.getPMTArray().getSizeZ();
229 move.setZ(move.z() - Lprism - Larray);
230 m_frontEnd->MakeImprint(module, move, &rot);
231
232 // add QBB
233
234 if (!m_qbb) m_qbb = assembleQBB(geoQBB);
235 move.setZ(0);
236 m_qbb->MakeImprint(module, move, &rot);
237
238 return module;
239 }
240
241
243 int moduleID)
244 {
245 // note: z = 0 is at center of backward envelope
246
247 if (!m_moduleEnvelope) {
248 double backwardLength = geo.getPrismEnclosure().getLength();
249 double forwardLength = geo.getLength() - backwardLength;
250 std::vector<G4TwoVector> polygon;
251 for (auto& point : geo.getBackwardContour()) {
252 polygon.push_back(G4TwoVector(point.first, point.second));
253 }
254 auto* backward = new G4ExtrudedSolid("backwardEnvelope",
255 polygon, backwardLength / 2,
256 G4TwoVector(), 1, G4TwoVector(), 1);
257 polygon.clear();
258 for (auto& point : geo.getForwardContour()) {
259 polygon.push_back(G4TwoVector(point.first, point.second));
260 }
261 auto* forward = new G4ExtrudedSolid("forwardEnvelope",
262 polygon, forwardLength / 2,
263 G4TwoVector(), 1, G4TwoVector(), 1);
264
265 G4Transform3D move = G4TranslateZ3D((backwardLength + forwardLength) / 2);
266 m_moduleEnvelope = new G4UnionSolid("moduleEnvelope", backward, forward, move);
267 }
268
269 G4Material* material = Materials::get(geo.getMaterial());
270 if (!material) B2FATAL("Material '" << geo.getMaterial() << "' not found");
271
272 std::string name = addNumber("TOPEnvelopeModule", moduleID);
273 return new G4LogicalVolume(m_moduleEnvelope, material, name);
274
275 }
276
277
278 G4AssemblyVolume* GeoTOPCreator::assembleFrontEnd(const TOPGeoFrontEnd& geo, int N)
279 {
280 auto* frontEnd = new G4AssemblyVolume();
282
283 G4ThreeVector move;
284
285 // front board
286
287 double Z = -geo.getFrontBoardGap();
288 double length = geo.getFrontBoardThickness();
289 auto* frontBoard = createBox("TOPFrontBoard",
290 geo.getFrontBoardWidth(),
292 length,
294 if (m_isBeamBkgStudy) {
296 frontBoard->SetSensitiveDetector(m_sensitivePCB1);
297 }
298 move.setZ(Z - length / 2);
299 move.setY(geo.getFrontBoardY());
300 frontEnd->AddPlacedVolume(frontBoard, move, 0);
301 Z -= length;
302
303 // HV board
304
305 length = geo.getHVBoardLength();
306 auto* HVBoard = createBox("TOPHVBoard",
307 geo.getHVBoardWidth(),
309 length,
310 geo.getHVBoardMaterial());
311 if (m_isBeamBkgStudy) {
313 HVBoard->SetSensitiveDetector(m_sensitivePCB2);
314 }
315 move.setZ(Z - geo.getHVBoardGap() - length / 2);
316 move.setY(geo.getHVBoardY());
317 frontEnd->AddPlacedVolume(HVBoard, move, 0);
318
319 // board stack
320
321 length = geo.getBoardStackLength();
322 move.setZ(Z - geo.getBoardStackGap() - length / 2);
323 move.setY(geo.getBoardStackY());
324 auto* boardStack = createBoardStack(geo, N);
325 frontEnd->AddPlacedVolume(boardStack, move, 0);
326
327 return frontEnd;
328 }
329
330
331 G4LogicalVolume* GeoTOPCreator::createBoardStack(const TOPGeoFrontEnd& geo, int N)
332 {
333 double width = geo.getBoardStackWidth();
334 double fullWidth = width * N;
335 std::string name = "TOPBoardStack";
336 auto* boardStack = createBox(name,
337 fullWidth,
341
342 double spacerWidth = geo.getSpacerWidth();
343 std::string name1 = name + "Spacer";
344 auto* spacer = createBox(name1,
345 spacerWidth,
348 geo.getSpacerMaterial());
349
350 std::string name2 = name + "TwoSpacers";
351 auto* twoSpacers = createBox(name2,
352 spacerWidth * 2,
355 geo.getSpacerMaterial());
356
357 G4Transform3D move;
358 move = G4TranslateX3D(-(fullWidth - spacerWidth) / 2);
359 new G4PVPlacement(move, spacer, name1, boardStack, false, 1);
360 move = G4TranslateX3D((fullWidth - spacerWidth) / 2);
361 new G4PVPlacement(move, spacer, name1, boardStack, false, 2);
362
363 int n = N - 1;
364 for (int i = 0; i < n; i++) {
365 move = G4TranslateX3D(width * (2 * i - n + 1) / 2.0);
366 new G4PVPlacement(move, twoSpacers, name2, boardStack, false, i + 1);
367 }
368
369 return boardStack;
370 }
371
372
373 G4AssemblyVolume* GeoTOPCreator::assembleQBB(const TOPGeoQBB& geo)
374 {
375 auto* qbb = new G4AssemblyVolume();
377
378 double Zback = -geo.getPrismEnclosure().getLength() / 2;
379 double Zfront = Zback + geo.getLength() - geo.getForwardEndPlate().getThickness();
380
381 G4ThreeVector move;
382
383 // outer panel
384
385 auto* outerPanel = createHoneycombPanel(geo, c_Outer);
386 move.setZ(Zfront - geo.getOuterPanel().getLength() / 2);
387 qbb->AddPlacedVolume(outerPanel, move, 0);
388
389 // inner panel
390
391 auto* innerPanel = createHoneycombPanel(geo, c_Inner);
392 move.setZ(Zfront - geo.getInnerPanel().getLength() / 2);
393 qbb->AddPlacedVolume(innerPanel, move, 0);
394
395 // forward end plate
396
397 double length = geo.getForwardEndPlate().getThickness();
398 auto* forwardEndPlate = createBox(geo.getForwardEndPlate().getName(),
399 geo.getWidth(),
401 length,
403 move.setZ(Zfront + length / 2);
404 qbb->AddPlacedVolume(forwardEndPlate, move, 0);
405
406 // prism enclosure box
407
408 std::string name = geo.getPrismEnclosure().getName();
409 double Z = Zback;
410 length = geo.getPrismEnclosure().getBackThickness();
411 auto* backPlate = createExtrudedSolid(name + "BackPlate",
413 length,
415 move.setZ(Z + length / 2);
416 qbb->AddPlacedVolume(backPlate, move, 0);
417 Z += length;
418
419 length = geo.getPrismEnclosure().getBodyLength();
420 auto* prismEnclosure = createExtrudedSolid(name + "Body",
422 length,
424 move.setZ(Z + length / 2);
425 qbb->AddPlacedVolume(prismEnclosure, move, 0);
426 Z += length;
427
428 length = geo.getPrismEnclosure().getFrontThickness();
429 auto* frontPlate = createExtrudedSolid(name + "FrontPlate",
431 length,
433 move.setZ(Z + length / 2);
434 qbb->AddPlacedVolume(frontPlate, move, 0);
435 Z += length;
436
437 length = Zfront - Z - geo.getInnerPanel().getLength();
438 if (length > 0) {
439 double height = geo.getPrismEnclosure().getExtensionThickness();
440 auto* extPlate = createBox(name + "ExtensionPlate",
441 geo.getPanelWidth(),
442 height,
443 length,
445
446 G4ThreeVector movePlate;
447 movePlate.setZ(Z + length / 2);
448 movePlate.setY((height - geo.getSideRails().getHeight()) / 2);
449 qbb->AddPlacedVolume(extPlate, movePlate, 0);
450 }
451
452 // side rails
453
454 auto* leftRail = createSideRail(geo, c_Left);
455 move.setZ(Zfront - geo.getSideRailsLength() / 2);
456 move.setY(geo.getOuterPanel().getY() + geo.getOuterPanel().getMinThickness() -
457 geo.getSideRails().getHeight() / 2);
458 move.setX(-(geo.getWidth() - geo.getSideRails().getThickness()) / 2);
459 qbb->AddPlacedVolume(leftRail, move, 0);
460
461 auto* rightRail = createSideRail(geo, c_Right);
462 move.setX((geo.getWidth() - geo.getSideRails().getThickness()) / 2);
463 qbb->AddPlacedVolume(rightRail, move, 0);
464
465 // cold plate
466
467 length = geo.getLength() - geo.getPrismEnclosure().getBackThickness() -
469 auto* coldPlateBase = createBox(geo.getColdPlate().getName() + "Base",
470 geo.getPanelWidth(),
472 length,
474 move.setZ(Zback + geo.getPrismEnclosure().getBackThickness() + length / 2);
475 move.setY(geo.getOuterPanel().getY() + geo.getOuterPanel().getMinThickness() -
476 geo.getColdPlate().getBaseThickness() / 2);
477 move.setX(0);
478 qbb->AddPlacedVolume(coldPlateBase, move, 0);
479
480 auto* coldPlateCool = createBox(geo.getColdPlate().getName() + "Cooler",
483 length,
485 move.setY(geo.getOuterPanel().getY() + geo.getOuterPanel().getMinThickness() +
486 geo.getColdPlate().getCoolThickness() / 2);
487 qbb->AddPlacedVolume(coldPlateCool, move, 0);
488
489 return qbb;
490 }
491
492
494 EPanelType type)
495 {
496 G4Transform3D move;
497
498 TOPGeoHoneycombPanel geoPanel;
499 Polygon contour;
500 double sideEdgeHeight = 0;
501 double sideEdgeY = 0;
502
503 if (type == c_Inner) {
504 geoPanel = geo.getInnerPanel();
505 contour = geo.getInnerPanelContour();
506 sideEdgeHeight = geoPanel.getMaxThickness();
507 sideEdgeY = geoPanel.getY() - sideEdgeHeight / 2;
508 } else {
509 geoPanel = geo.getOuterPanel();
510 contour = geo.getOuterPanelContour();
511 sideEdgeHeight = geoPanel.getMinThickness();
512 sideEdgeY = geoPanel.getY() + sideEdgeHeight / 2;
513 }
514
515 // honeycomb panel
516
517 auto* panel = createExtrudedSolid(geoPanel.getName(),
518 contour,
519 geoPanel.getLength(),
520 geoPanel.getMaterial());
521
522 // reinforced faces
523
524 std::string faceEdgeName = geoPanel.getName() + "ReinforcedFace";
525 auto* faceEdge = createExtrudedSolid(faceEdgeName,
526 contour,
527 geoPanel.getEdgeWidth(),
528 geoPanel.getEdgeMaterial());
529
530 move = G4TranslateZ3D((geoPanel.getLength() - geoPanel.getEdgeWidth()) / 2);
531 new G4PVPlacement(move, faceEdge, faceEdgeName, panel, false, 1);
532 move = G4TranslateZ3D(-(geoPanel.getLength() - geoPanel.getEdgeWidth()) / 2);
533 new G4PVPlacement(move, faceEdge, faceEdgeName, panel, false, 2);
534
535 // reinforced sides
536
537 double width = geo.getPanelWidth();
538 double sideEdgeWidth = geoPanel.getEdgeWidth() + (width - geoPanel.getWidth()) / 2;
539 std::string sideEdgeName = geoPanel.getName() + "ReinforcedSide";
540 auto* sideEdge = createBox(sideEdgeName,
541 sideEdgeWidth,
542 sideEdgeHeight,
543 geoPanel.getLength() - 2 * geoPanel.getEdgeWidth(),
544 geoPanel.getEdgeMaterial());
545
546
547 move = G4Translate3D((width - sideEdgeWidth) / 2, sideEdgeY, 0);
548 new G4PVPlacement(move, sideEdge, sideEdgeName, panel, false, 1);
549 move = G4Translate3D(-(width - sideEdgeWidth) / 2, sideEdgeY, 0);
550 new G4PVPlacement(move, sideEdge, sideEdgeName, panel, false, 2);
551
552 return panel;
553 }
554
555
556 G4LogicalVolume* GeoTOPCreator::createSideRail(const TOPGeoQBB& geo,
557 ESideRailType type)
558 {
559 double A = geo.getSideRails().getThickness();
560 double B = geo.getSideRails().getHeight();
561 double C = geo.getSideRailsLength();
562 double a = A - geo.getSideRails().getReducedThickness();
563 double b = B - geo.getColdPlate().getBaseThickness();
564 double c = geo.getPrismEnclosure().getLength() -
566
567 auto* box = new G4Box("box", A / 2, B / 2, C / 2);
568 auto* subtrBox = new G4Box("subtrBox", a / 2, b / 2, c / 2);
569 double x = 0;
570 if (type == c_Left) {
571 x = (A - a) / 2;
572 } else {
573 x = -(A - a) / 2;
574 }
575 G4Transform3D move = G4Translate3D(x, -(B - b) / 2, -(C - c) / 2);
576 auto* solid = new G4SubtractionSolid("sideRail", box, subtrBox, move);
577
578 G4Material* material = Materials::get(geo.getSideRails().getMaterial());
579 if (!material) B2FATAL("Material '" << geo.getSideRails().getMaterial() <<
580 "' not found");
581
582 std::string name = geo.getSideRails().getName();
583 if (type == c_Left) {
584 name += "Left";
585 } else {
586 name += "Rigth";
587 }
588
589 return new G4LogicalVolume(solid, material, name);
590 }
591
592
593 G4AssemblyVolume* GeoTOPCreator::assembleOptics(const TOPGeoModule& geo)
594 {
595 auto* optics = new G4AssemblyVolume();
597
598 const double Lm = geo.getMirrorSegment().getFullLength();
599 const double L1 = geo.getBarSegment1().getFullLength();
600 const double L2 = geo.getBarSegment2().getFullLength();
601 const double Lp = geo.getPrism().getFullLength();
602 const double La = geo.getPMTArray().getSizeZ();
603
604 // note: z = 0 is at prism-bar joint
605
606 auto* pmtArray = createPMTArray(geo.getPMTArray(), geo.getModuleID());
607 double Dy = (geo.getPrism().getThickness() - geo.getPrism().getExitThickness()) / 2;
608 G4ThreeVector moveArray(geo.getPMTArrayDisplacement().getX(),
609 geo.getPMTArrayDisplacement().getY() + Dy,
610 -(Lp + La / 2));
611 G4RotationMatrix rotArray;
612 rotArray.rotateZ(geo.getPMTArrayDisplacement().getAlpha());
613 optics->AddPlacedVolume(pmtArray, moveArray, &rotArray);
614
615 G4ThreeVector move;
616 G4RotationMatrix rot;
617
618 auto* prism = createPrism(geo.getPrism(), geo.getModuleID());
619 move.setZ(0);
620 rot.rotateY(M_PI / 2);
621 optics->AddPlacedVolume(prism, move, &rot);
622
623 auto* barSegment2 = createBarSegment(geo.getBarSegment2(), geo.getModuleID());
624 move.setZ(L2 / 2);
625 optics->AddPlacedVolume(barSegment2, move, 0);
626
627 auto* barSegment1 = createBarSegment(geo.getBarSegment1(), geo.getModuleID());
628 move.setZ(L2 + L1 / 2);
629 optics->AddPlacedVolume(barSegment1, move, 0);
630
631 auto* mirrorSegment = createMirrorSegment(geo.getMirrorSegment(),
632 geo.getModuleID());
633 move.setZ(L2 + L1 + Lm / 2);
634 optics->AddPlacedVolume(mirrorSegment, move, 0);
635
636 // peek frame approximation (in order to shadow total reflection at prism end)
637 // a call to getFilterThickness is added for backward compatibility
638 const double length = geo.getPrism().getFilterThickness() + 3.5; //mm
639 const double thickness = 1.0; //mm
640 const double width = geo.getPrism().getWidth();
641 const double Yup = geo.getPrism().getThickness() / 2;
642 const double Ydn = Yup - geo.getPrism().getExitThickness();
643
644 auto* peekFrameAbove = createBox("PeekFrameAbove", width, thickness, length, "Al");
645 move.setZ(-(Lp - length / 2));
646 move.setY(Yup + thickness / 2);
647 optics->AddPlacedVolume(peekFrameAbove, move, 0);
648
649 auto* peekFrameBelow = createBox("PeekFrameBelow", width, thickness, length, "Al");
650 move.setZ(-(Lp - length / 2));
651 move.setY(Ydn - thickness / 2);
652 optics->AddPlacedVolume(peekFrameBelow, move, 0);
653
654 return optics;
655 }
656
657
659 int moduleID)
660 {
661 G4Transform3D move;
662
663 // mother volume
664 auto* bar = createBox(geo.getName(),
665 geo.getWidth(), geo.getThickness(), geo.getFullLength(),
666 geo.getMaterial());
667 // glue
668 auto* glue = createBox(geo.getName() + "Glue",
669 geo.getWidth(), geo.getThickness(), geo.getGlueThickness(),
670 geo.getGlueMaterial());
671 if (geo.getBrokenGlueFraction() > 0) {
672 auto* brokenGlue = createExtrudedSolid(geo.getName() + "BrokenGlue",
674 geo.getGlueThickness(),
676 G4Transform3D fix;
677 new G4PVPlacement(fix, brokenGlue, geo.getName() + "BrokenGlue", glue, false, 1);
678 B2RESULT("GeoTOPCreator, broken glue at " << geo.getName()
679 << addNumber(" of Slot", moduleID));
681 }
682
683 // place glue to -z side
684 move = G4TranslateZ3D(-(geo.getFullLength() - geo.getGlueThickness()) / 2);
685 new G4PVPlacement(move, glue, geo.getName() + "Glue", bar, false, 1);
686
687 // optical surface
688 auto& materials = Materials::getInstance();
689 auto* optSurf = materials.createOpticalSurface(geo.getSurface());
690 optSurf->SetSigmaAlpha(geo.getSigmaAlpha());
691 new G4LogicalSkinSurface("opticalSurface", bar, optSurf);
692
693 // Activate sensitive volume
694 bar->SetSensitiveDetector(m_sensitiveBar);
695
696 return bar;
697 }
698
699
701 int moduleID)
702 {
703 G4Transform3D move;
704
705 // box of the bar
706 auto* box = new G4Box(geo.getName(),
707 geo.getWidth() / 2, geo.getThickness() / 2,
708 geo.getFullLength() / 2);
709
710 // mother volume
711 auto* bar = createBoxSphereIntersection(geo.getName(),
712 box,
713 0, geo.getOuterRadius(),
714 geo.getXc(), geo.getYc(), geo.getZc(),
715 geo.getMaterial());
716
717 // glue
718 auto* glue = createBox(geo.getName() + "Glue",
719 geo.getWidth(), geo.getThickness(), geo.getGlueThickness(),
720 geo.getGlueMaterial());
721 if (geo.getBrokenGlueFraction() > 0) {
722 auto* brokenGlue = createExtrudedSolid(geo.getName() + "BrokenGlue",
724 geo.getGlueThickness(),
726 G4Transform3D fix;
727 new G4PVPlacement(fix, brokenGlue, geo.getName() + "BrokenGlue", glue, false, 1);
728 B2RESULT("GeoTOPCreator, broken glue at " << geo.getName()
729 << addNumber(" of Slot", moduleID));
731 }
732
733 // place glue to -z side
734 move = G4TranslateZ3D(-(geo.getFullLength() - geo.getGlueThickness()) / 2);
735 new G4PVPlacement(move, glue, geo.getName() + "Glue", bar, false, 1);
736
737 // bar optical surface
738 auto& materials = Materials::getInstance();
739 auto* optSurf = materials.createOpticalSurface(geo.getSurface());
740 optSurf->SetSigmaAlpha(geo.getSigmaAlpha());
741 new G4LogicalSkinSurface("opticalSurface", bar, optSurf);
742
743 // mirror reflective coating
744 auto* mirror = createBoxSphereIntersection(geo.getName() + "ReflectiveCoating",
745 box,
746 geo.getRadius(), geo.getOuterRadius(),
747 geo.getXc(), geo.getYc(), geo.getZc(),
748 geo.getCoatingMaterial());
749
750 // mirror optical surface
751 auto* mirrorSurf = materials.createOpticalSurface(geo.getCoatingSurface());
752 new G4LogicalSkinSurface("mirrorSurface", mirror, mirrorSurf);
753
754 // place reflective coating
755 move = G4TranslateZ3D(0);
756 new G4PVPlacement(move, mirror, geo.getName() + "ReflectiveCoating", bar, false, 1);
757
758 // Activate sensitive volume
759 bar->SetSensitiveDetector(m_sensitiveBar);
760
761 return bar;
762 }
763
764
765 G4LogicalVolume* GeoTOPCreator::createPrism(const TOPGeoPrism& geo, int moduleID)
766
767 {
768 G4Transform3D move;
769
770 // mother volume
771
772 std::vector<G4TwoVector> polygon;
773 polygon.push_back(G4TwoVector(0, geo.getThickness() / 2));
774 polygon.push_back(G4TwoVector(geo.getFullLength(), geo.getThickness() / 2));
775 polygon.push_back(G4TwoVector(geo.getFullLength(),
776 geo.getThickness() / 2 - geo.getExitThickness()));
777 polygon.push_back(G4TwoVector(geo.getLength() - geo.getFlatLength(),
778 geo.getThickness() / 2 - geo.getExitThickness()));
779 polygon.push_back(G4TwoVector(0, -geo.getThickness() / 2));
780
781 auto* volume = new G4ExtrudedSolid(geo.getName(), polygon, geo.getWidth() / 2,
782 G4TwoVector(), 1, G4TwoVector(), 1);
783 G4Material* material = Materials::get(geo.getMaterial());
784 if (!material) B2FATAL("Material '" << geo.getMaterial() << "' not found");
785 auto* prism = new G4LogicalVolume(volume, material, geo.getName());
786
787 // wavelenght filter (old payload) and peel-off regions (if defined)
788 // new payload: wavelength filter is a part of PMT array
789
790 if (geo.getFilterThickness() > 0 or !geo.getPeelOffRegions().empty()) {
791 double filterThickness = geo.getFilterThickness();
792 std::string filterMaterial;
793 if (filterThickness > 0) { // old payload, put wavelength filter into prism
794 filterMaterial = geo.getFilterMaterial();
795 } else { // new payload, make a dummy volume in which to put peel-off regions
796 filterThickness = geo.getPeelOffThickness();
797 filterMaterial = geo.getMaterial();
798 }
799 auto* filter = createBox(geo.getName() + "Filter",
800 filterThickness,
801 geo.getExitThickness(),
802 geo.getWidth(),
803 filterMaterial);
804 // place peel-off regions (if any) into filter
805 int numRegions = 0;
806 std::string message = addNumber("peel-off cookie regions of Slot", moduleID) + ":";
807 for (const auto& region : geo.getPeelOffRegions()) {
808 if (region.fraction <= 0) continue;
809 std::string name = addNumber(geo.getName() + "PeelOff", region.ID);
810 double thickness = geo.getPeelOffThickness();
811 auto* peelOff = createExtrudedSolid(name,
812 geo.getPeelOffContour(region),
813 thickness,
814 geo.getPeelOffMaterial());
815 G4Transform3D T = G4Translate3D((geo.getFilterThickness() - thickness) / 2,
816 0,
817 geo.getPeelOffCenter(region));
818 G4Transform3D R = G4RotateY3D(-M_PI / 2);
819 G4Transform3D moveRegion = T * R;
820 new G4PVPlacement(moveRegion, peelOff, name, filter, false, 1);
821 message += addNumber(" ", region.ID);
822 numRegions++;
823 }
824 if (numRegions > 0) B2RESULT("GeoTOPCreator, " << message);
825 m_numPeelOffRegions += numRegions;
826
827 // place filter to +x side
828 move = G4Translate3D(geo.getFullLength() - geo.getFilterThickness() / 2,
829 (geo.getThickness() - geo.getExitThickness()) / 2,
830 0);
831 new G4PVPlacement(move, filter, geo.getName() + "Filter", prism, false, 1);
832 }
833
834 // optical surface
835
836 auto& materials = Materials::getInstance();
837 auto* optSurf = materials.createOpticalSurface(geo.getSurface());
838 optSurf->SetSigmaAlpha(geo.getSigmaAlpha());
839 new G4LogicalSkinSurface("opticalSurface", prism, optSurf);
840
841 // Activate sensitive volume
842
843 prism->SetSensitiveDetector(m_sensitiveBar);
844
845 return prism;
846 }
847
848
850 int moduleID)
851 {
852 // mother volume
853 auto* pmtArray = createBox(geo.getName(),
854 geo.getSizeX(), geo.getSizeY(),
855 geo.getSizeZ(),
856 geo.getMaterial());
857
858 // single PMT
859 auto* pmt = createPMT(geo.getPMT());
860
861 // place PMT's
862 std::string message = addNumber("optically decoupled PMT's of Slot", moduleID) + ":";
863 for (unsigned row = 1; row <= geo.getNumRows(); row++) {
864 for (unsigned col = 1; col <= geo.getNumColumns(); col++) {
865 auto id = geo.getPmtID(row, col);
866 double z = geo.getAirGap();
867 if (geo.isPMTDecoupled(id)) {
868 z = 0;
869 message += addNumber(" ", id);
871 }
872 z -= (geo.getSizeZ() - geo.getPMT().getSizeZ()) / 2;
873 G4Transform3D move = G4Translate3D(geo.getX(col), geo.getY(row), z);
874 new G4PVPlacement(move, pmt, addNumber(geo.getPMT().getName(), id), pmtArray,
875 false, id);
876 }
877 }
878
879 // wavelenght filter and silicone cookies (new payload)
880 if (geo.getFilterThickness() > 0) { // new payload
881 double fullThickness = geo.getFilterThickness() + geo.getCookieThickness();
882 auto* filter = createBox(geo.getName() + "Filter+Cookie",
883 geo.getSizeX(), geo.getSizeY(),
884 fullThickness,
885 geo.getFilterMaterial());
886 double cookieThickness = geo.getCookieThickness();
887 auto* cookie = createBox(geo.getName() + "Cookie",
888 geo.getSizeX(), geo.getSizeY(),
889 cookieThickness,
890 geo.getCookieMaterial());
891 G4Transform3D move = G4Translate3D(0, 0, (fullThickness - cookieThickness) / 2);
892 new G4PVPlacement(move, cookie, geo.getName() + "Cookie", filter, false, 1);
893
894 move = G4Translate3D(0, 0, (geo.getSizeZ() - fullThickness) / 2);
895 new G4PVPlacement(move, filter, geo.getName() + "Filter+Cookie", pmtArray,
896 false, 1);
897 }
898
899 if (!geo.getDecoupledPMTs().empty()) B2RESULT("GeoTOPCreator, " << message);
900
901 return pmtArray;
902 }
903
904
905 G4LogicalVolume* GeoTOPCreator::createPMT(const TOPGeoPMT& geo)
906 {
907 G4Transform3D move;
908
909 // mother volume
910 auto* pmt = createBox(geo.getName(),
911 geo.getSizeX(), geo.getSizeY(), geo.getSizeZ(),
912 geo.getWallMaterial());
913
914 // window + photocathode + reflective edge
915 double winThickness = geo.getWinThickness() + geo.getReflEdgeThickness();
916 auto* window = createBox(geo.getName() + "Window",
917 geo.getSizeX(), geo.getSizeY(),
918 winThickness,
919 geo.getWinMaterial());
920 auto* photoCathode = createBox(geo.getName() + "PhotoCathode",
921 geo.getSensSizeX(), geo.getSensSizeY(),
922 geo.getSensThickness(),
923 geo.getSensMaterial());
924 photoCathode->SetSensitiveDetector(m_sensitivePMT); // Activate sensitive area
925
926 move = G4TranslateZ3D(-(winThickness - geo.getSensThickness()) / 2
927 + geo.getReflEdgeThickness());
928 new G4PVPlacement(move, photoCathode, geo.getName() + "PhotoCathode", window,
929 false, 1);
930
931 auto* reflEdge = createBox(geo.getName() + "ReflectiveEdge",
932 geo.getSizeX(), geo.getSizeY(),
934 geo.getWallMaterial());
935 double holeSizeX = geo.getSizeX() - 2 * geo.getReflEdgeWidth();
936 double holeSizeY = geo.getSizeY() - 2 * geo.getReflEdgeWidth();
937 if (holeSizeX > 0 and holeSizeY > 0) {
938 auto* hole = createBox(geo.getName() + "ReflectiveEdgeHole",
939 holeSizeX, holeSizeY,
941 geo.getFillMaterial());
942 move = G4TranslateZ3D(0.0);
943 new G4PVPlacement(move, hole, geo.getName() + "ReflectiveEdgeHole", reflEdge,
944 false, 1);
945 }
946
947 auto& materials = Materials::getInstance();
948 auto* optSurf = materials.createOpticalSurface(geo.getReflEdgeSurface());
949 new G4LogicalSkinSurface("reflectiveEdgeSurface", reflEdge, optSurf);
950
951 move = G4TranslateZ3D(-(winThickness - geo.getReflEdgeThickness()) / 2);
952 new G4PVPlacement(move, reflEdge, geo.getName() + "ReflectiveEdge", window,
953 false, 1);
954
955 move = G4TranslateZ3D((geo.getSizeZ() - winThickness) / 2);
956 new G4PVPlacement(move, window, geo.getName() + "Window", pmt, false, 1);
957
958 // bottom
959 if (geo.getBotMaterial() != geo.getWallMaterial()) {
960 auto* bottom = createBox(geo.getName() + "Bottom",
961 geo.getSizeX(), geo.getSizeY(), geo.getBotThickness(),
962 geo.getBotMaterial());
963 move = G4TranslateZ3D(-(geo.getSizeZ() - geo.getBotThickness()) / 2);
964 new G4PVPlacement(move, bottom, geo.getName() + "Bottom", pmt, false, 1);
965 }
966
967 // interior
968 double interiorSizeZ = geo.getSizeZ() - winThickness - geo.getBotThickness();
969 auto* interior = createBox(geo.getName() + "Interior",
970 geo.getSizeX() - 2 * geo.getWallThickness(),
971 geo.getSizeY() - 2 * geo.getWallThickness(),
972 interiorSizeZ,
973 geo.getBotMaterial());
974 move = G4TranslateZ3D(-(geo.getSizeZ() - interiorSizeZ) / 2
975 + geo.getBotThickness());
976 new G4PVPlacement(move, interior, geo.getName() + "Interior", pmt, false, 1);
977
978 return pmt;
979 }
980
981
982 G4LogicalVolume* GeoTOPCreator::createBox(const std::string& name,
983 double A, double B, double C,
984 const std::string& materialName)
985 {
986 G4Box* box = new G4Box(name, A / 2, B / 2, C / 2);
987 G4Material* material = Materials::get(materialName);
988 if (!material) B2FATAL("Material '" << materialName << "' not found");
989 return new G4LogicalVolume(box, material, name);
990 }
991
992
993 G4LogicalVolume*
995 G4Box* box,
996 double Rmin,
997 double Rmax,
998 double xc,
999 double yc,
1000 double zc,
1001 const std::string& materialName)
1002 {
1003 // determine max theta - note: not valid generically!
1004 double x = box->GetXHalfLength();
1005 double y = box->GetYHalfLength();
1006 double z = box->GetZHalfLength();
1007 double dx = fmax(fabs(-x - xc), fabs(x - xc));
1008 double dy = fmax(fabs(-y - yc), fabs(y - yc));
1009 double dz = fmin(-z - zc, z - zc);
1010 double theta = atan(sqrt(dx * dx + dy * dy) / dz);
1011
1012 auto* sphere = new G4Sphere(name + "Sphere",
1013 Rmin, Rmax, 0, 2 * M_PI, 0, theta);
1014 G4Translate3D move(xc, yc, zc);
1015 auto* shape = new G4IntersectionSolid(name, box, sphere, move);
1016
1017 G4Material* material = Materials::get(materialName);
1018 if (!material) B2FATAL("Material '" << materialName << "' not found");
1019 return new G4LogicalVolume(shape, material, name);
1020 }
1021
1022
1023 G4LogicalVolume* GeoTOPCreator::createExtrudedSolid(const std::string& name,
1024 const Polygon& shape,
1025 double length,
1026 const std::string& materialName)
1027 {
1028 std::vector<G4TwoVector> polygon;
1029 for (auto& point : shape) {
1030 polygon.push_back(G4TwoVector(point.first, point.second));
1031 }
1032 G4ExtrudedSolid* solid = new G4ExtrudedSolid(name, polygon, length / 2,
1033 G4TwoVector(), 1, G4TwoVector(), 1);
1034 G4Material* material = Materials::get(materialName);
1035 if (!material) B2FATAL("Material '" << materialName << "' not found");
1036 return new G4LogicalVolume(solid, material, name);
1037 }
1038
1039
1040 std::string GeoTOPCreator::addNumber(const std::string& str, unsigned number)
1041 {
1042 stringstream ss;
1043 if (number < 10) {
1044 ss << "0" << number;
1045 } else {
1046 ss << number;
1047 }
1048 string out;
1049 ss >> out;
1050 return str + out;
1051 }
1052
1053 } // name space TOP
1055} // name space Belle2
double R
typedef autogenerated by FFTW
The Class for BeamBackground Sensitive Detector.
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:36
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
A class that describes the interval of experiments/runs for which an object in the database is valid.
void addAssemblyVolume(G4AssemblyVolume *vol)
Register a G4AssemblyVolume.
Definition: RunManager.h:68
static RunManager & Instance()
Static method to get a reference to the RunManager instance.
Definition: RunManager.cc:29
Geometry parameters of a quartz bar segment.
double getWidth() const
Returns bar segment width.
const std::string & getGlueMaterial() const
Returns glue material name (glue on -z side)
double getFullLength() const
Returns bar segment length including glue.
double getThickness() const
Returns bar segment thickness.
double getSigmaAlpha() const
Returns geant4 parameter describing surface roughness.
double getBrokenGlueFraction() const
Returns fraction of the delaminated surface.
const std::string & getMaterial() const
Returns bar segment material name.
const GeoOpticalSurface & getSurface() const
Returns optical surface.
double getLength() const
Returns bar segment length.
virtual double getGlueThickness() const
Returns glue thickness (glue on -z side)
const std::string & getBrokenGlueMaterial() const
Returns material name which represents broken glue.
const std::string & getName() const
Returns object name.
Definition: TOPGeoBase.h:51
const std::string & getCoolMaterial() const
Returns cooling plate material name.
double getCoolWidth() const
Returns cooling plate width.
const std::string & getBaseMaterial() const
Returns base plate material name.
double getCoolThickness() const
Returns cooling plate thickness.
double getBaseThickness() const
Returns base plate thickness.
double getHeight() const
Returns height.
double getThickness() const
Returns thickness.
const std::string & getMaterial() const
Returns material name.
Geometry parameters of board stack (front-end electronic module)
double getHVBoardGap() const
Returns gap between HV board and front board.
const std::string & getHVBoardMaterial() const
Returns HV board material.
double getFrontBoardGap() const
Returns gap between front board and PMT array.
double getHVBoardThickness() const
Returns HV board thickness.
double getFrontBoardThickness() const
Returns front board thickness.
double getHVBoardLength() const
Returns HV board length.
const std::string & getBoardStackMaterial() const
Returns board stack material.
double getBoardStackLength() const
Returns board stack length.
double getBoardStackY() const
Returns position of board stack center in bar frame.
double getBoardStackWidth() const
Returns board stack width.
double getFrontBoardWidth() const
Returns front board width.
const std::string & getFrontBoardMaterial() const
Returns front board material.
double getBoardStackHeight() const
Returns board stack height.
double getBoardStackGap() const
Returns gap between board stack and front board.
double getHVBoardY() const
Returns position of HV board center in bar frame.
double getHVBoardWidth() const
Returns HV board width.
double getFrontBoardY() const
Returns position of front board center in bar frame.
double getFrontBoardHeight() const
Returns front board height.
const std::string & getSpacerMaterial() const
Returns board stack spacer material.
double getSpacerWidth() const
Returns board stack spacer width.
Geometry parameters of honeycomb panel.
double getWidth() const
Returns panel width.
double getMaxThickness() const
Returns panel maximal thickness.
const std::string & getEdgeMaterial() const
Returns material name of reinforced edge.
double getMinThickness() const
Returns panel minimal thickness.
double getY() const
Returns y position of the flat surface in local (bar) frame.
const std::string & getMaterial() const
Returns material name.
double getEdgeWidth() const
Returns width of the reinforced edge.
double getLength() const
Returns panel length.
Geometry parameters of a mirror segment.
double getYc() const
Returns spherical mirror center of curvature in y.
double getOuterRadius() const
Returns spherical mirror outer radius of curvature.
const std::string & getCoatingMaterial() const
Returns reflective coating material.
double getRadius() const
Returns spherical mirror radius of curvature.
const GeoOpticalSurface & getCoatingSurface() const
Returns reflective coating optical surface.
double getXc() const
Returns spherical mirror center of curvature in x.
Geometry parameters of a module (optical components + positioning)
Definition: TOPGeoModule.h:31
const TOPGeoMirrorSegment & getMirrorSegment() const
Returns mirror segment.
Definition: TOPGeoModule.h:212
const TOPGeoBarSegment & getBarSegment1() const
Returns bar segment No.1 (forward bar)
Definition: TOPGeoModule.h:200
const TOPGeoPMTArray & getPMTArray() const
Returns PMT array.
Definition: TOPGeoModule.h:224
int getModuleID() const
Returns module ID.
Definition: TOPGeoModule.h:170
const TOPGeoPMTArrayDisplacement & getPMTArrayDisplacement() const
Returns PMT array displacement.
Definition: TOPGeoModule.h:230
const TOPGeoPrism & getPrism() const
Returns prism.
Definition: TOPGeoModule.h:218
const TOPGeoBarSegment & getBarSegment2() const
Returns bar segment No.2 (backward bar)
Definition: TOPGeoModule.h:206
double getX() const
Returns translation in x.
double getAlpha() const
Returns rotation angle (around z)
double getY() const
Returns translation in y.
Geometry parameters of MCP-PMT array.
const std::string & getCookieMaterial() const
Returns silicone cookie material.
double getSizeZ() const
Returns array volume dimension in z.
unsigned getNumColumns() const
Returns number of array columns.
double getX(unsigned col) const
Returns x coordinate of column center.
double getY(unsigned row) const
Returns the y coordinate of row center.
double getFilterThickness() const
Returns wavelength filter thickness.
double getSizeX() const
Returns array volume dimension in x.
const std::string & getFilterMaterial() const
Returns wavelenght filter material.
const TOPGeoPMT & getPMT() const
Returns PMT geometry parameters.
double getSizeY() const
Returns array volume dimension in y.
const std::string & getMaterial() const
Returns material name into which PMT's are inserted.
unsigned getNumRows() const
Returns number of array rows.
double getCookieThickness() const
Returns silicone cookie thickness.
double getAirGap() const
Returns air gap.
const std::vector< unsigned > & getDecoupledPMTs() const
Returns ID's of optically decoupled PMT's.
Geometry parameters of MCP-PMT.
Definition: TOPGeoPMT.h:24
double getSizeZ() const
Returns full size in z.
Definition: TOPGeoPMT.h:141
double getReflEdgeThickness() const
Returns reflective edge thickness.
Definition: TOPGeoPMT.h:237
const std::string & getSensMaterial() const
Returns sensitive material name.
Definition: TOPGeoPMT.h:201
const GeoOpticalSurface & getReflEdgeSurface() const
Returns reflective edge optical surface.
Definition: TOPGeoPMT.h:243
double getWinThickness() const
Returns entrance window thickness.
Definition: TOPGeoPMT.h:207
double getBotThickness() const
Returns bottom thickness.
Definition: TOPGeoPMT.h:219
const std::string & getWallMaterial() const
Returns wall (casing) material name.
Definition: TOPGeoPMT.h:153
double getReflEdgeWidth() const
Returns reflective edge width.
Definition: TOPGeoPMT.h:231
const std::string & getFillMaterial() const
Returns fill (inside) material name.
Definition: TOPGeoPMT.h:159
double getSensSizeX() const
Returns sensitive volume (photo-cathode) size in x.
Definition: TOPGeoPMT.h:165
double getSizeX() const
Returns full size in x.
Definition: TOPGeoPMT.h:129
double getSizeY() const
Returns full size in y.
Definition: TOPGeoPMT.h:135
double getWallThickness() const
Returns wall thickness.
Definition: TOPGeoPMT.h:147
double getSensThickness() const
Returns sensitive volume (photo-cathode) thickness.
Definition: TOPGeoPMT.h:177
const std::string & getWinMaterial() const
Returns entrance window material name.
Definition: TOPGeoPMT.h:213
const std::string & getBotMaterial() const
Returns bottom material name.
Definition: TOPGeoPMT.h:225
double getSensSizeY() const
Returns sensitive volume (photo-cathode) size in y.
Definition: TOPGeoPMT.h:171
double getBackThickness() const
Returns back wall thickness.
double getBodyLength() const
Returns length w/o back and front plates.
const std::string & getMaterial() const
Returns material name.
double getExtensionThickness() const
Returns extension plate thickness.
double getFrontThickness() const
Returns front wall thickness.
double getLength() const
Returns full length.
Geometry parameters of prism.
Definition: TOPGeoPrism.h:27
const std::string & getPeelOffMaterial() const
Returns peel-off material.
Definition: TOPGeoPrism.h:185
double getPeelOffCenter(const PeelOffRegion &region) const
Returns peel-off offset in x of the given region.
Definition: TOPGeoPrism.h:198
double getFilterThickness() const
Returns wavelength filter thickness (filter on -z side).
Definition: TOPGeoPrism.h:154
const std::vector< PeelOffRegion > & getPeelOffRegions() const
Returns peel-off cookie regions.
Definition: TOPGeoPrism.h:191
double getExitThickness() const
Returns prism thickness at PMT side.
Definition: TOPGeoPrism.h:126
double getPeelOffThickness() const
Returns peel-off thickness.
Definition: TOPGeoPrism.h:179
const std::string & getFilterMaterial() const
Returns wavelength filter material name (filter on -z side) For backward compatibility,...
Definition: TOPGeoPrism.h:161
double getFlatLength() const
Returns the length of a flat surface at prism bottom.
Definition: TOPGeoPrism.h:132
Geometry parameters of Quartz Bar Box (mother class)
Definition: TOPGeoQBB.h:30
double getWidth() const
Returns full width.
Definition: TOPGeoQBB.h:102
const TOPGeoSideRails & getSideRails() const
Returns side rails.
Definition: TOPGeoQBB.h:156
const TOPGeoHoneycombPanel & getOuterPanel() const
Returns outer honeycomb panel.
Definition: TOPGeoQBB.h:150
double getSideRailsLength() const
Returns side rails length.
Definition: TOPGeoQBB.h:123
const TOPGeoEndPlate & getForwardEndPlate() const
Returns forward end plate.
Definition: TOPGeoQBB.h:168
const TOPGeoColdPlate & getColdPlate() const
Returns cold plate.
Definition: TOPGeoQBB.h:174
const TOPGeoPrismEnclosure & getPrismEnclosure() const
Returns prism enclosure.
Definition: TOPGeoQBB.h:162
double getPrismPosition() const
Returns the position of prism-bar joint wrt QBB back.
Definition: TOPGeoQBB.h:132
const std::string & getMaterial() const
Returns the name of material inside QBB.
Definition: TOPGeoQBB.h:138
const TOPGeoHoneycombPanel & getInnerPanel() const
Returns inner honeycomb panel.
Definition: TOPGeoQBB.h:144
double getLength() const
Returns full length.
Definition: TOPGeoQBB.h:117
double getPanelWidth() const
Returns panel width used in x-y contours of honeycomb panels.
Definition: TOPGeoQBB.h:108
double getHeight() const
Returns height.
double getThickness() const
Returns thickness.
const std::string & getMaterial() const
Returns material name.
double getReducedThickness() const
Returns thickness at prism enclosure.
Geometry parameters of TOP.
Definition: TOPGeometry.h:34
unsigned getNumBoardStacks() const
Returns number of boardstacks per module.
Definition: TOPGeometry.h:168
static void useGeantUnits()
Use Geant units when returning geometry parameters.
Definition: TOPGeometry.h:58
const TOPGeoQBB & getQBB() const
Returns quartz bar box.
Definition: TOPGeometry.h:174
const std::vector< TOPGeoModule > & getModules() const
Returns all modules.
Definition: TOPGeometry.h:149
const TOPGeoFrontEnd & getFrontEnd() const
Returns front-end.
Definition: TOPGeometry.h:162
void importPayload(const IntervalOfValidity &iov) const
import mappings to database
void importPayload(const IntervalOfValidity &iov) const
import mappings to database
int m_numPeelOffRegions
number of peel-off regions
virtual ~GeoTOPCreator()
Destructor.
int m_numBrokenGlues
number of broken glues
void createGeometry(const TOPGeometry &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
G4UnionSolid * m_moduleEnvelope
module envelope solid
G4AssemblyVolume * assembleFrontEnd(const TOPGeoFrontEnd &geo, int N)
Assembles front-end electronics.
int m_numDecoupledPMTs
number of optically decoupled PMT's
G4LogicalVolume * createPMTArray(const TOPGeoPMTArray &geo, int moduleID)
Creates PMT array.
G4AssemblyVolume * assembleQBB(const TOPGeoQBB &geo)
Assembles QBB.
G4AssemblyVolume * m_frontEnd
front-end electronics assembly volume
G4LogicalVolume * createMirrorSegment(const TOPGeoMirrorSegment &geo, int moduleID)
Creates quartz segment with spherical mirror.
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creation of the detector geometry from database.
G4LogicalVolume * createSideRail(const TOPGeoQBB &geo, ESideRailType type)
Creates side rail.
G4AssemblyVolume * m_qbb
QBB assembly volume.
G4LogicalVolume * createHoneycombPanel(const TOPGeoQBB &geo, EPanelType type)
Creates honeycomb panel.
std::string addNumber(const std::string &str, unsigned number)
Adds number to string.
SensitiveBar * m_sensitiveBar
Sensitive vol.
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Creation of payloads.
G4LogicalVolume * createBoardStack(const TOPGeoFrontEnd &geo, int N)
Creates board stack.
BkgSensitiveDetector * m_sensitivePCB2
PCB sensitive for BG studies.
TOPGeometryPar * m_topgp
singleton class
G4LogicalVolume * createExtrudedSolid(const std::string &name, const Polygon &shape, double length, const std::string &materialName)
Creates material extruded solid.
G4LogicalVolume * createPMT(const TOPGeoPMT &geo)
Creates single PMT.
G4LogicalVolume * createModule(const TOPGeometry &geo, int moduleID)
Creates single module.
G4LogicalVolume * createBarSegment(const TOPGeoBarSegment &geo, int moduleID)
Creates quartz bar segment.
G4LogicalVolume * createPrism(const TOPGeoPrism &geo, int moduleID)
Creates quartz prism.
BkgSensitiveDetector * m_sensitivePCB1
PCB sensitive for BG studies.
ESideRailType
Side rail types.
Definition: GeoTOPCreator.h:91
G4AssemblyVolume * assembleOptics(const TOPGeoModule &geo)
Assembles optical components (PMT array, prism and bar segments) along z.
G4LogicalVolume * createBox(const std::string &name, double A, double B, double C, const std::string &materialName)
Creates material box.
int m_isBeamBkgStudy
flag for beam backgound simulation
SensitivePMT * m_sensitivePMT
Sensitive vol.
G4LogicalVolume * createBoxSphereIntersection(const std::string &name, G4Box *box, double Rmin, double Rmax, double xc, double yc, double zc, const std::string &materialName)
Creates material volume that is intersection of box and half-sphere shell (z > 0)
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creation of the detector geometry from Gearbox (XML).
G4LogicalVolume * createModuleEnvelope(const TOPGeoQBB &geo, int moduleID)
Creates module envelope.
EPanelType
Honeycomb panel types.
Definition: GeoTOPCreator.h:86
Class providing information on MCParticles hitting the bars.
Definition: SensitiveBar.h:31
void setReplicaDepth(int depth)
Sets replica depth of module volume.
Definition: SensitiveBar.h:51
Class providing SimHits.
Definition: SensitivePMT.h:30
void setModuleReplicaDepth(int depth)
Sets replica depth of module volume.
Definition: SensitivePMT.h:56
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
const ChannelMapper & getChannelMapper() const
Returns default channel mapper (mapping of channels to pixels)
bool isValid() const
check if the geometry is available
const FrontEndMapper & getFrontEndMapper() const
Returns front-end mapper (mapping of SCROD's to positions within TOP modules)
void Initialize(const GearDir &content)
Initialize from Gearbox (XML)
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63
static Materials & getInstance()
Get a reference to the singleton instance.
Definition: Materials.cc:85
double atan(double a)
atan for double
Definition: beamHelpers.h:34
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
std::vector< std::pair< double, double > > getBackPlateContour() const
Returns prism enclosure back plate x-y contour.
Definition: TOPGeoQBB.cc:174
std::vector< std::pair< double, double > > getPrismEnclosureContour() const
Returns prism enclosure wall x-y contour.
Definition: TOPGeoQBB.cc:139
std::vector< std::pair< double, double > > getPeelOffContour(const PeelOffRegion &region) const
Returns the x-y contour of the peel-off region.
Definition: TOPGeoPrism.cc:118
double getZc() const
Returns spherical mirror center of curvature in z (in local frame of this segment)
bool isPMTDecoupled(unsigned pmtID) const
Checks if PMT is optically decoupled.
const TOPGeoModule & getModule(int moduleID) const
Returns module.
Definition: TOPGeometry.cc:42
std::vector< std::pair< double, double > > getFrontPlateContour() const
Returns prism enclosure front plate x-y contour.
Definition: TOPGeoQBB.cc:203
std::vector< std::pair< double, double > > getOuterPanelContour() const
Returns outer honeycomb panel x-y contour.
Definition: TOPGeoQBB.cc:80
std::vector< std::pair< double, double > > getForwardContour() const
Returns forward x-y contour.
Definition: TOPGeoQBB.cc:21
std::vector< std::pair< double, double > > getBrokenGlueContour() const
Returns the x-y contour of broken glue.
unsigned getPmtID(unsigned row, unsigned col) const
Converts row and column numbers to PMT ID (1-based)
std::vector< std::pair< double, double > > getBackwardContour() const
Returns backward x-y contour.
Definition: TOPGeoQBB.cc:106
std::vector< std::pair< double, double > > getInnerPanelContour() const
Returns inner honeycomb panel x-y contour.
Definition: TOPGeoQBB.cc:54
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double > > &runs, double cut, std::map< ExpRun, std::pair< double, double > > &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition: Splitter.cc:38
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.
STL namespace.