ATLAS Offline Software
Loading...
Searching...
No Matches
SpacerBeam.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8#include "GeoModelKernel/GeoBox.h"
9#include "GeoModelKernel/GeoDefinitions.h"
10#include "GeoModelKernel/GeoLogVol.h"
11#include "GeoModelKernel/GeoMaterial.h"
12#include "GeoModelKernel/GeoPhysVol.h"
13#include "GeoModelKernel/GeoShapeShift.h"
14#include "GeoModelKernel/GeoShapeSubtraction.h"
15#include "GeoModelKernel/GeoVPhysVol.h"
22#include "MuonGeoModel/MYSQL.h"
25
26namespace MuonGM {
27
29 Component *ss) : DetectorElement(ss->name) {
30 StandardComponent *s = static_cast<StandardComponent *>(ss);
31 std::string_view componentType = std::string_view(s->name).substr(0, 3);
32
33 double tol = 1.e-4;
34
35 width = s->dx1;
36 longWidth = s->dx2;
37 length = s->dy - tol;
38 excent = s->excent;
39
40 m_cy = s->posy;
41 if (componentType == "CRO" || componentType == "CMI" || componentType == "CHV") {
42 CbmComponent *ccbm = static_cast<CbmComponent *>(s);
43 m_hole_pos1 = ccbm->hole_pos1 - length / 2. - m_cy - tol / 2.;
44 m_hole_pos2 = ccbm->hole_pos2 - length / 2. - m_cy - tol / 2.;
45 m_lb_height = ccbm->lb_height;
46 m_lb_width = ccbm->lb_width;
47 }
48
49 lowerThickness = 0.;
50
51 if (componentType == "CHV") {
52 const CHV *ch = dynamic_cast<const CHV*>(mysql.GetTechnology(s->name));
53 thickness = ch->thickness;
54 largeness = ch->largeness;
55 height = ch->height - tol;
56
57 } else if (componentType == "CRO") {
58 const CRO *cr = dynamic_cast<const CRO*>(mysql.GetTechnology(s->name));
59 thickness = cr->thickness;
60 largeness = cr->largeness;
61 height = cr->height - tol;
62
63 } else if (componentType == "CMI") {
64 const CMI *cn = dynamic_cast<const CMI*>(mysql.GetTechnology(s->name));
65 thickness = cn->thickness;
66 largeness = cn->largeness;
67 height = cn->height - tol;
68
69 } else if (componentType.substr(0, 2) == "LB") {
70 const LBI *lb = dynamic_cast<const LBI*>(mysql.GetTechnology(s->name));
71 thickness = lb->thickness;
72 lowerThickness = lb->lowerThickness;
74 height = lb->height;
75 m_cross_excent = 0; // Place holder
76 }
77 }
78
79 GeoVPhysVol *SpacerBeam::build(StoredMaterialManager& matManager,
80 bool is_barrel) {
81 int cutoutson = 0;
82 return build(matManager, cutoutson, is_barrel);
83 }
84
85 GeoVPhysVol *SpacerBeam::build(StoredMaterialManager& matManager,
86 int /*cutoutson*/, bool is_barrel) {
87 GeoPhysVol *pvol = nullptr;
88 GeoLogVol *lvol = nullptr;
89 const GeoMaterial *mat = matManager.getMaterial("std::Aluminium");
90 if (name.compare(0, 3, "CHV") == 0 || name.compare(0, 3, "CRO") == 0 || name.compare(0, 3, "CMI") == 0) {
91 double sinexc = 0.;
92 double cosexc = 1.;
93 double volumelargeness = largeness;
94 if ((name.compare(0, 3, "CHV") == 0 || name.compare(0, 3, "CRO") == 0) && !is_barrel) {
95 double ltemp = std::sqrt(length * length + excent * excent);
96 sinexc = std::abs(excent) / ltemp;
97 cosexc = length / ltemp;
98 length = ltemp - largeness * std::abs(excent) / length;
99 }
100
101 if (thickness > 0.) {
102 // I-beam shape
103 volumelargeness = largeness;
104 const GeoShape *IBeamShape = new GeoBox(height / 2, volumelargeness / 2, length / 2);
105 GeoBox *sideBox = new GeoBox(height / 2. - thickness, volumelargeness / 4., length / 2 + 1.);
106 double yshift = volumelargeness / 4. + thickness / 2.;
107 IBeamShape = &(IBeamShape->subtract((*sideBox) << GeoTrf::TranslateY3D(yshift)));
108 IBeamShape = &(IBeamShape->subtract((*sideBox) << GeoTrf::TranslateY3D(-yshift)));
109
110 // Cut holes for LB
111 GeoBox *holeBox = new GeoBox(m_lb_height / 2. + 1., thickness / 2. + 1., m_lb_width / cosexc / 2. + thickness * sinexc / cosexc + 6.);
112 IBeamShape = &(IBeamShape->subtract((*holeBox) << GeoTrf::TranslateZ3D(m_hole_pos1 / cosexc)));
113 IBeamShape = &(IBeamShape->subtract((*holeBox) << GeoTrf::TranslateZ3D(m_hole_pos2 / cosexc)));
114 lvol = new GeoLogVol(name, IBeamShape, mat);
115 pvol = new GeoPhysVol(lvol);
116
117 } else {
118 // Box shape
119
120 volumelargeness = width;
121 const GeoBox *Cbox = new GeoBox(height / 2, volumelargeness / 2, length / 2);
122 lvol = new GeoLogVol(name, Cbox, mat);
123 pvol = new GeoPhysVol(lvol);
124 }
125 return pvol;
126
127 } else if (name.compare(0, 2, "LB") == 0) {
128 const GeoShape *LBbox = new GeoBox(height / 2., (width - length / 4.) / 2., length / 2.);
129 // (width - length/4) is temporary until excent parameter is put into LbiComponent
130 GeoBox *innerBox = new GeoBox(height / 2. - thickness, width / 2. + 1., length / 2. - lowerThickness);
131 LBbox = &(LBbox->subtract((*innerBox)));
132 lvol = new GeoLogVol(name, LBbox, mat);
133 pvol = new GeoPhysVol(lvol);
134 return pvol;
135
136 } else {
137 return nullptr;
138 }
139 }
140
141 void SpacerBeam::print() const {
142 MsgStream log(Athena::getMessageSvc(), "MuGM::SpacerBeam");
143 log << MSG::INFO << " SpacerBeam " << name << " :" << endmsg;
144 }
145
146} // namespace MuonGM
#define endmsg
DetectorElement(const std::string &n)
Technology * GetTechnology(const std::string &name)
Definition MYSQL.cxx:105
virtual void print() const override
SpacerBeam(const MYSQL &mysql, Component *s)
GeoVPhysVol * build(StoredMaterialManager &matManager, bool)
This class holds one or more material managers and makes them storeable, under StoreGate.
virtual const GeoMaterial * getMaterial(const std::string &name)=0
singleton-like access to IMessageSvc via open function and helper
int lb
Definition globals.cxx:23
IMessageSvc * getMessageSvc(bool quiet=false)
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27