1313// / \brief Implementation of FV0 geometry.
1414// /
1515// / \author Maciej Slupecki, University of Jyvaskyla, Finland
16- // / \author Andreas Molander, University of Helsinki, Finland
16+ // / \author Andreas Molander ([email protected] ) 1717
1818#include " FV0Base/Geometry.h"
1919
@@ -94,6 +94,9 @@ bool Geometry::enableComponent(const EGeoComponent component, const bool enable)
9494
9595void Geometry::buildGeometry () const
9696{
97+ if (!gGeoManager ) {
98+ LOG (fatal) << " FV0: No TGeoManager found!" ;
99+ }
97100 TGeoVolume* vALIC = gGeoManager ->GetVolume (" barrel" );
98101 if (!vALIC) {
99102 LOG (fatal) << " FV0: Could not find the top volume" ;
@@ -370,6 +373,7 @@ void Geometry::initializeNonSensVols()
370373 initializeScrewHoles ();
371374 initializeRodHoles ();
372375 initializePlasticCells ();
376+ initializePhotonFilter ();
373377 initializePmts ();
374378 initializeFibers ();
375379 initializeScrews ();
@@ -411,6 +415,118 @@ void Geometry::initializeRodHoles()
411415 new TGeoCompositeShape (sRodHolesCSName .c_str (), boolFormula.c_str ());
412416}
413417
418+ void Geometry::createCellShapeExpression (const std::string& cellType, const int ring, const float zThickness)
419+ {
420+ const float dxHoleCut = sDxHoleExtensionScintillator ; // width of extension of hole 1, 2 and 7 in the "a" cell
421+ const float xHole = sDrSeparationScint + dxHoleCut; // x-placement of holes 1, 2 and 7 in the "a" cell
422+
423+ // Sector separation gap shape
424+ const std::string secSepShapeName = sDetectorName + cellType + " SectorSeparation" ;
425+ if (!gGeoManager ->GetListOfShapes ()->Contains ((secSepShapeName.c_str ()))) {
426+ new TGeoBBox (secSepShapeName.c_str (), mRMaxScintillator .back () + sEpsilon , sDrSeparationScint , zThickness / 2 );
427+ }
428+
429+ // Sector separation gap rotations
430+ const std::string secSepRot45Name = sDetectorName + cellType + " SecSepRot45" ;
431+ const std::string secSepRot90Name = sDetectorName + cellType + " SecSepRot90" ;
432+
433+ if (!gGeoManager ->GetListOfMatrices ()->Contains ((secSepRot45Name.c_str ()))) {
434+ createAndRegisterRot (secSepRot45Name, 45 , 0 , 0 );
435+ }
436+
437+ if (!gGeoManager ->GetListOfMatrices ()->Contains ((secSepRot90Name.c_str ()))) {
438+ createAndRegisterRot (secSepRot90Name, 90 , 0 , 0 );
439+ }
440+
441+ // Hole shapes
442+ const std::string holeSmallName = sDetectorName + cellType + " HoleSmall" ;
443+ const std::string holeLargeName = sDetectorName + cellType + " HoleLarge" ;
444+ const std::string holeSmallCutName = sDetectorName + cellType + " HoleSmallCut" ;
445+ const std::string holeLargeCutName = sDetectorName + cellType + " HoleLargeCut" ;
446+
447+ if (!gGeoManager ->GetListOfShapes ()->Contains ((holeSmallName.c_str ()))) {
448+ new TGeoTube (holeSmallName.c_str (), 0 , sDrHoleSmallScintillator , zThickness / 2 );
449+ }
450+
451+ if (!gGeoManager ->GetListOfShapes ()->Contains ((holeLargeName.c_str ()))) {
452+ new TGeoTube (holeLargeName.c_str (), 0 , sDrHoleLargeScintillator , zThickness / 2 );
453+ }
454+
455+ if (!gGeoManager ->GetListOfShapes ()->Contains ((holeSmallCutName.c_str ()))) {
456+ new TGeoBBox (holeSmallCutName.c_str (), dxHoleCut, sDrHoleSmallScintillator , zThickness / 2 );
457+ }
458+
459+ if (!gGeoManager ->GetListOfShapes ()->Contains ((holeLargeCutName.c_str ()))) {
460+ new TGeoBBox (holeLargeCutName.c_str (), dxHoleCut, sDrHoleLargeScintillator , zThickness / 2 );
461+ }
462+
463+ const float rMin = mRAvgRing [ring];
464+ const float rMax = mRAvgRing [ring + 1 ];
465+ const float rMid = rMin + (rMax - rMin) / 2 ;
466+
467+ if (cellType == " a" ) {
468+ // "a"-type cell
469+ //
470+ // Initial placement:
471+ //
472+ // y
473+ // ^
474+ // | 1******
475+ // | ************5
476+ // | 7*****************
477+ // | *********************3
478+ // | *******************
479+ // | 2**************8
480+ // | 6********
481+ // | **4
482+ // |
483+ // |
484+ // | O
485+ // ------------------------> x
486+ //
487+ // * = cell volume
488+ // numbers = hole numbers (as numbered in the code below)
489+ // O = beam pipe
490+
491+ const std::string aCellName = createVolumeName (cellType + sCellName + " a" , ring);
492+
493+ // Base shape
494+ const std::string aCellShapeName = aCellName + " Shape" ;
495+
496+ // The cells in the innermost ring have a slightly shifted inner radius origin.
497+ if (ring == 0 ) {
498+ // The innermost "a"-type cell
499+ const std::string a1CellShapeFullName = aCellShapeName + " Full" ;
500+ const std::string a1CellShapeHoleCutName = aCellShapeName + " HoleCut" ;
501+ const std::string a1CellShapeHoleCutTransName = a1CellShapeHoleCutName + " Trans" ;
502+
503+ if (!gGeoManager ->GetListOfShapes ()->Contains ((a1CellShapeFullName.c_str ()))) {
504+ new TGeoTubeSeg (a1CellShapeFullName.c_str (), 0 , mRMaxScintillator [ring], zThickness / 2 - sEpsilon , 45 , 90 );
505+ }
506+
507+ if (!gGeoManager ->GetListOfShapes ()->Contains ((a1CellShapeHoleCutName.c_str ()))) {
508+ new TGeoTube (a1CellShapeHoleCutName.c_str (), 0 , mRMinScintillator [ring], zThickness);
509+ }
510+
511+ if (!gGeoManager ->GetListOfMatrices ()->Contains ((a1CellShapeHoleCutTransName.c_str ()))) {
512+ createAndRegisterTrans (a1CellShapeHoleCutTransName, sXShiftInnerRadiusScintillator , 0 , 0 );
513+ }
514+
515+ const std::string a1BoolFormula = a1CellShapeFullName + " -" + a1CellShapeHoleCutName + " :" + a1CellShapeHoleCutTransName;
516+
517+ if (!gGeoManager ->GetListOfShapes ()->Contains ((aCellShapeName.c_str ()))) {
518+ new TGeoCompositeShape (aCellShapeName.c_str (), a1BoolFormula.c_str ());
519+ }
520+ } else {
521+ // The rest of the "a"-type cells
522+ if (!gGeoManager ->GetListOfShapes ()->Contains ((aCellShapeName.c_str ()))) {
523+ new TGeoTubeSeg (aCellShapeName.c_str (), mRMinScintillator [ring], mRMaxScintillator [ring], zThickness / 2 , 45 , 90 );
524+ }
525+ }
526+
527+ }
528+ }
529+
414530void Geometry::initializeCells (const std::string& cellType, const float zThickness, const TGeoMedium* medium,
415531 const bool isSensitive)
416532{
@@ -699,7 +815,7 @@ void Geometry::initializeCells(const std::string& cellType, const float zThickne
699815 mSensitiveVolumeNames .push_back (aCell->GetName ());
700816 mSensitiveVolumeNames .push_back (bCell->GetName ());
701817 }
702- }
818+ } // for each ring
703819}
704820
705821void Geometry::initializeScintCells ()
@@ -714,6 +830,12 @@ void Geometry::initializePlasticCells()
714830 initializeCells (sPlasticName , sDzPlastic , medium, false );
715831}
716832
833+ void Geometry::initializePhotonFilter ()
834+ {
835+ const TGeoMedium* medium = gGeoManager ->GetMedium (" FV0_PhotonFilter$" );
836+ initializeCells (sPhotonFilterName , sDzPhotonFilter , medium, false );
837+ }
838+
717839void Geometry::initializePmts ()
718840{
719841 const TGeoMedium* medium = gGeoManager ->GetMedium (" FV0_PMT$" );
@@ -1048,6 +1170,9 @@ void Geometry::assembleNonSensVols(TGeoVolume* vFV0Right, TGeoVolume* vFV0Left)
10481170 if (mEnabledComponents .at (ePlastics)) {
10491171 assemblePlasticSectors (vFV0Right, vFV0Left);
10501172 }
1173+ if (mEnabledComponents .at (ePhotonFilter)) {
1174+ assemblePhotonFilters (vFV0Right, vFV0Left);
1175+ }
10511176 if (mEnabledComponents .at (ePmts)) {
10521177 assemblePmts (vFV0Right, vFV0Left);
10531178 }
@@ -1085,6 +1210,14 @@ void Geometry::assemblePlasticSectors(TGeoVolume* vFV0Right, TGeoVolume* vFV0Lef
10851210 vFV0Left->AddNode (sectors, 1 , trans);
10861211}
10871212
1213+ void Geometry::assemblePhotonFilters (TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const
1214+ {
1215+ TGeoVolumeAssembly* sectors = buildSectorAssembly (sPhotonFilterName );
1216+
1217+ vFV0Right->AddNode (sectors, 0 );
1218+ vFV0Left->AddNode (sectors, 1 );
1219+ }
1220+
10881221void Geometry::assemblePmts (TGeoVolume* vFV0Right, TGeoVolume* vFV0Left) const
10891222{
10901223 TGeoVolumeAssembly* pmts = new TGeoVolumeAssembly (createVolumeName (" PMTS" ).c_str ());
0 commit comments