ATLAS Offline Software
SpacerBeam.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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 
26 namespace MuonGM {
27 
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 = (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
MuonGM::CbmComponent::lb_width
double lb_width
Definition: CbmComponent.h:16
MuonGM::CbmComponent::hole_pos1
double hole_pos1
Definition: CbmComponent.h:17
MuonGM::SpacerBeam::print
virtual void print() const override
Definition: SpacerBeam.cxx:141
MuonGM::MYSQL::GetTechnology
Technology * GetTechnology(const std::string &name)
Definition: MYSQL.cxx:105
MuonGM::CMI::largeness
double largeness
Definition: CMI_Technology.h:16
MuonGM::DetectorElement::name
std::string name
Definition: DetectorElement.h:17
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MuonGM::SpacerBeam::m_hole_pos1
double m_hole_pos1
Definition: SpacerBeam.h:37
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
MuonGM::CbmComponent
Definition: CbmComponent.h:12
MuonGM::SpacerBeam::largeness
double largeness
Definition: SpacerBeam.h:31
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:53
CHV_Technology.h
MuonGM::MYSQL
Definition: MYSQL.h:43
MuonGM::CRO
Definition: CRO_Technology.h:13
MuonGM::LBI
Definition: LBI_Technology.h:13
MuonGM::SpacerBeam::lowerThickness
double lowerThickness
Definition: SpacerBeam.h:28
MuonGM::DetectorElement
Definition: DetectorElement.h:15
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonGM::StandardComponent
Definition: StandardComponent.h:15
MuonGM::CbmComponent::lb_height
double lb_height
Definition: CbmComponent.h:15
MuonGM::SpacerBeam::SpacerBeam
SpacerBeam(const MYSQL &mysql, Component *s)
Definition: SpacerBeam.cxx:28
MuonGM::SpacerBeam::height
double height
Definition: SpacerBeam.h:30
MuonGM::Component
Definition: Component.h:11
MuonGM::CHV
Definition: CHV_Technology.h:13
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:88
StandardComponent.h
CbmComponent.h
MuonGM::CbmComponent::hole_pos2
double hole_pos2
Definition: CbmComponent.h:18
CRO_Technology.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonGM::SpacerBeam::thickness
double thickness
Definition: SpacerBeam.h:27
MuonGM::SpacerBeam::m_hole_pos2
double m_hole_pos2
Definition: SpacerBeam.h:38
SpacerBeam.h
MuonGM::SpacerBeam::build
GeoVPhysVol * build(StoredMaterialManager &matManager, bool)
Definition: SpacerBeam.cxx:79
MuonGM::SpacerBeam::m_cy
double m_cy
Definition: SpacerBeam.h:36
LBI_Technology.h
MuonGM::SpacerBeam::m_lb_height
double m_lb_height
Definition: SpacerBeam.h:39
MYSQL.h
MuonGM::Technology::thickness
double thickness
Definition: Technology.h:20
MuonGM::CRO::largeness
double largeness
Definition: CRO_Technology.h:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LbiComponent.h
MuonGM::SpacerBeam::width
double width
Definition: SpacerBeam.h:25
MuonGM::CMI
Definition: CMI_Technology.h:13
MuonGM::SpacerBeam::m_cross_excent
double m_cross_excent
Definition: SpacerBeam.h:41
MuonGM::SpacerBeam::excent
double excent
Definition: SpacerBeam.h:32
MuonGM::SpacerBeam::m_lb_width
double m_lb_width
Definition: SpacerBeam.h:40
MuonGM::CRO::height
double height
Definition: CRO_Technology.h:17
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
StoredMaterialManager
This class holds one or more material managers and makes them storeable, under StoreGate.
Definition: StoredMaterialManager.h:28
MuonGM::SpacerBeam::length
double length
Definition: SpacerBeam.h:26
MuonGM::SpacerBeam::longWidth
double longWidth
Definition: SpacerBeam.h:29
Technology.h
CMI_Technology.h
MuonGM::CMI::height
double height
Definition: CMI_Technology.h:17