ATLAS Offline Software
Csc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonGeoModel/Csc.h"
6 
8 #include "GaudiKernel/MsgStream.h"
10 #include "GeoModelKernel/GeoFullPhysVol.h"
11 #include "GeoModelKernel/GeoLogVol.h"
12 #include "GeoModelKernel/GeoShapeShift.h"
13 #include "GeoModelKernel/GeoShapeUnion.h"
14 #include "GeoModelKernel/GeoTrd.h"
15 #include "MuonGeoModel/Component.h"
19 
20 #include <GaudiKernel/IMessageSvc.h>
21 #include <GeoModelKernel/GeoDefinitions.h>
22 #include <GeoModelKernel/GeoShape.h>
23 #include <GeoModelKernel/GeoVPhysVol.h>
24 #include <string>
25 #include <utility>
26 
27 class GeoMaterial;
28 
29 #define skip_csc false
30 
31 namespace MuonGM {
32 
35  m_component = s;
36  width = s->dx1;
37  longWidth = s->dx2;
38  thickness = s->GetThickness(mysql);
39  maxwLength = s->maxwdy;
40  excent = s->excent;
41  physicalLength = s->dy;
43  double num = longWidth * (excent - physicalLength);
44  if (std::abs(num) < 1e-10) {
45  upWidth = 0;
46  } else {
47  upWidth = num / (excent - maxwLength);
48  }
49 
50  layer = std::make_unique<CscMultiLayer>(mysql, s->name);
51  layer->width = width;
52  layer->longWidth = longWidth;
53  layer->upWidth = upWidth;
54  layer->excent = excent;
55  layer->length = length;
56  layer->physicalLength = physicalLength;
57  layer->maxwLength = maxwLength;
58 
59  index = s->index;
60  }
61 
62 
63  GeoFullPhysVol *Csc::build(StoredMaterialManager& matManager,
64  const MYSQL& mysql,
65  int minimalgeo) {
66  std::vector<Cutout *> vcutdef;
67  int cutoutson = 0;
68  return build(matManager, mysql, minimalgeo, cutoutson, vcutdef);
69  }
70 
71  GeoFullPhysVol *Csc::build(StoredMaterialManager& matManager,
72  const MYSQL& mysql,
73  int minimalgeo, int cutoutson,
74  const std::vector<Cutout *>& vcutdef) {
75  GeoFullPhysVol *pcsc = nullptr;
76  GeoLogVol *lcsc = nullptr;
77  const GeoMaterial *mcsc = matManager.getMaterial("std::Air");
78 
79  if (excent == length) {
80  // CSC is a simple traezoid
81  const GeoShape *sCSS = new GeoTrd(thickness / 2., thickness / 2., width / 2., longWidth / 2., length / 2.);
82  lcsc = new GeoLogVol(logVolName, sCSS, mcsc);
83 
84  } else {
85  // CSC is a union of two trapezoids
86  GeoTrd *downTrd = new GeoTrd(thickness / 2., thickness / 2., width / 2., longWidth / 2., maxwLength / 2.);
87  GeoTrd *upTrd = new GeoTrd(thickness / 2., thickness / 2., longWidth / 2., upWidth / 2., (physicalLength - maxwLength) / 2.);
88  const GeoShape *sCSL = &((downTrd->add((*upTrd) << GeoTrf::TranslateZ3D(physicalLength / 2.))) << GeoTrf::TranslateZ3D((maxwLength - physicalLength) / 2.));
89  lcsc = new GeoLogVol(logVolName, sCSL, mcsc);
90  }
91 
92  pcsc = new GeoFullPhysVol(lcsc);
93  if (minimalgeo == 1)
94  return pcsc;
95 
96  GeoVPhysVol *lay = layer->build(matManager, mysql, cutoutson, vcutdef);
97  if (!skip_csc)
98  pcsc->add(lay);
99 
100  return pcsc;
101  }
102 
103  void Csc::print() const {
104  MsgStream log(Athena::getMessageSvc(), "MuonGM::Csc");
105  log << MSG::INFO << " Csc:: Csc " << name << " : " << endmsg;
106  }
107 
108 } // namespace MuonGM
MuonGM::Csc::print
virtual void print() const override
Definition: Csc.cxx:103
DetectorElement.h
MuonGM::Csc::Csc
Csc(const MYSQL &mysql, Component *s)
Definition: Csc.cxx:33
MuonGM::DetectorElement::name
std::string name
Definition: DetectorElement.h:17
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CscMultiLayer.h
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
CscComponent.h
index
Definition: index.py:1
skip_csc
#define skip_csc
Definition: Csc.cxx:29
MuonGM::Csc::length
double length
Definition: Csc.h:27
MuonGM::MYSQL
Definition: MYSQL.h:43
MuonGM::CscComponent
Definition: CscComponent.h:11
Csc.h
MuonGM::Csc::layer
std::unique_ptr< CscMultiLayer > layer
Definition: Csc.h:37
MuonGM::Csc::maxwLength
double maxwLength
Definition: Csc.h:32
MuonGM::DetectorElement
Definition: DetectorElement.h:15
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonGM::Component
Definition: Component.h:11
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Component.h
MuonGM::Csc::physicalLength
double physicalLength
Definition: Csc.h:31
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
MuonGM::Csc::width
double width
Definition: Csc.h:26
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
StoredMaterialManager.h
MuonGM::Csc::m_component
CscComponent * m_component
Definition: Csc.h:52
MuonGM::Csc::build
GeoFullPhysVol * build(StoredMaterialManager &matManager, const MYSQL &mysql, int minimalgeo)
Definition: Csc.cxx:63
MuonGM::Csc::longWidth
double longWidth
Definition: Csc.h:29
MuonGM::Csc::excent
double excent
Definition: Csc.h:30
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
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::Csc::upWidth
double upWidth
Definition: Csc.h:33
MuonGM::Csc::thickness
double thickness
Definition: Csc.h:28
MuonGM::DetectorElement::logVolName
std::string logVolName
Definition: DetectorElement.h:18