ATLAS Offline Software
Micromegas.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
11 #include "GeoModelKernel/GeoDefinitions.h"
12 #include "GeoModelKernel/GeoFullPhysVol.h"
13 #include "GeoModelKernel/GeoIdentifierTag.h"
14 #include "GeoModelKernel/GeoLogVol.h"
15 #include "GeoModelKernel/GeoNameTag.h"
16 #include "GeoModelKernel/GeoPhysVol.h"
17 #include "GeoModelKernel/GeoSerialIdentifier.h"
18 #include "GeoModelKernel/GeoShapeShift.h"
19 #include "GeoModelKernel/GeoShapeSubtraction.h"
20 #include "GeoModelKernel/GeoTransform.h"
21 #include "GeoModelKernel/GeoTrd.h"
25 #include "MuonGeoModel/Component.h"
27 
28 #include <GaudiKernel/IMessageSvc.h>
29 #include <GaudiKernel/MsgStream.h>
30 #include <GeoModelKernel/GeoShape.h>
31 #include <string>
32 
33 class GeoMaterial;
34 
35 namespace MuonGM {
36 
39  m_component = s;
40  width = s->dx1;
41  longWidth = s->dx2;
42  length = s->dy;
43  name = s->name;
44  index = s->index;
45  }
46 
47  GeoFullPhysVol *Micromegas::build(StoredMaterialManager& matManager,
48  int minimalgeo) {
49  std::vector<Cutout *> vcutdef;
50  int cutoutson = 0;
51  return build(matManager, minimalgeo, cutoutson, vcutdef);
52  }
53 
54  GeoFullPhysVol *Micromegas::build(StoredMaterialManager& matManager,
55  int minimalgeo, int,
56  const std::vector<Cutout *>&)
57  {
58  MMDetectorHelper mmHelper;
60  AGDDDetectorStore& ds = c->GetDetectorStore();
62 
63  MM_Technology *t = (MM_Technology *)ds.GetTechnology(name);
64  thickness = t->Thickness();
65  double gasTck = t->gasThickness;
66  double pcbTck = t->pcbThickness;
67  double roTck = t->roThickness;
68  double f1 = mm_descr->ylFrame();
69  double f2 = mm_descr->ysFrame();
70  double f3 = mm_descr->xFrame();
71 
72  minimalgeo = t->geoLevel;
73 
74  // Build Micromegas mother volume out of G10
75  const GeoShape *strd = new GeoTrd(thickness / 2, thickness / 2, width / 2, longWidth / 2, length / 2);
76 
77  logVolName = name;
78  if (!(m_component->subType).empty())
79  logVolName += ("-" + m_component->subType);
80  // std::FR4 is not always available. Fallback to sct::PCB
81  const GeoMaterial *mtrd = matManager.getMaterial("std::FR4") != nullptr ?
82  matManager.getMaterial("std::FR4") : matManager.getMaterial("sct::PCB");
83  GeoLogVol *ltrd = new GeoLogVol(logVolName, strd, mtrd);
84  GeoFullPhysVol *ptrd = new GeoFullPhysVol(ltrd);
85 
86  if (!minimalgeo)
87  return ptrd;
88 
89  double newpos = -thickness / 2.;
90  ptrd->add(new GeoSerialIdentifier(0));
91 
92  int igl = 0;
93 
94  // Loop over Micromegas layers
95  for (int i = 0; i < t->nlayers; i++) {
96  // std::cout<<"loop over layers"<<std::endl;
97  double widthActive;
98  double longWidthActive;
99  double lengthActive;
100 
101  // sensitive volume
102  igl++;
103  ptrd->add(new GeoIdentifierTag(igl));
104 
105  widthActive = width;
106  longWidthActive = longWidth;
107  lengthActive = length;
108 
109  if (i == 0)
110  newpos += gasTck / 2.;
111  else
112  newpos += gasTck;
113  if ((i + 1) % 2)
114  newpos += pcbTck;
115  else
116  newpos += roTck;
117  double newXPos = newpos;
118 
119  const GeoShape *sGasVolume = new GeoTrd(gasTck / 2, gasTck / 2, widthActive / 2, longWidthActive / 2, lengthActive / 2);
120 
121  GeoLogVol *ltrdtmp = new GeoLogVol("MM_Sensitive", sGasVolume, matManager.getMaterial("muo::ArCO2"));
122  GeoPhysVol *ptrdtmp = new GeoPhysVol(ltrdtmp);
123  GeoNameTag *ntrdtmp = new GeoNameTag(name + "muo::ArCO2");
124  GeoTransform *ttrdtmp = new GeoTransform(GeoTrf::TranslateX3D(newXPos));
125 
126  // Place gas volume inside G10 mother volume so that
127  // subtractions from gas volume now become G10
128 
129  ptrd->add(ntrdtmp);
130  ptrd->add(ttrdtmp);
131  ptrd->add(ptrdtmp);
132 
133  double lW = longWidth / 2. - ((longWidth - width) / 2.) * f1 / length;
134  double W = width / 2. + ((longWidth - width) / 2.) * f2 / length;
135  const GeoShape *trd1 = new GeoTrd(gasTck / 2, gasTck / 2, width / 2, longWidth / 2, length / 2);
136  const GeoShape *trd2 = new GeoTrd(gasTck, gasTck, W - f3, lW - f3, length / 2 - (f1 + f2) / 2.);
137  GeoTrf::Translate3D c(0, 0, (f2 - f1) / 2.);
138  trd1 = &(trd1->subtract((*trd2) << c));
139  GeoLogVol *ltrdframe = new GeoLogVol("MM_Frame", trd1, matManager.getMaterial("std::Aluminium"));
140  GeoPhysVol *ptrdframe = new GeoPhysVol(ltrdframe);
141 
142  ptrdtmp->add(ptrdframe);
143 
144  } // Loop over tgc layers
145 
146  return ptrd;
147  }
148 
149  void Micromegas::print() const {
150  MsgStream log(Athena::getMessageSvc(), "MuonGM::Micromegas");
151  log << MSG::INFO << " Micromegas " << name << " :" << endmsg;
152  }
153 
154 } // namespace MuonGM
AGDDController.h
AGDDDetectorStore.h
MuonGM::DetectorElement::name
std::string name
Definition: DetectorElement.h:17
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:257
MicromegasComponent.h
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MMDetectorDescription.h
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
CxxUtils::LockedPointer
A pointer together with a movable lock.
Definition: LockedPointer.h:35
Micromegas.h
MuonGM::MM_Technology
Definition: MuonAGDDDescription/MuonAGDDDescription/MM_Technology.h:16
index
Definition: index.py:1
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
MuonGM::Micromegas::m_component
MicromegasComponent * m_component
Definition: Micromegas.h:38
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonGM::DetectorElement
Definition: DetectorElement.h:15
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
read_hist_ntuple.f2
f2
Definition: read_hist_ntuple.py:20
xAOD::EgammaParameters::f3
@ f3
fraction of energy reconstructed in 3rd sampling
Definition: EgammaEnums.h:54
MMDetectorHelper::Get_Controller
IAGDDtoGeoSvc::LockedController Get_Controller()
Definition: MMDetectorHelper.cxx:126
MuonGM::Component
Definition: Component.h:11
MMDetectorDescription
Definition: MMDetectorDescription.h:45
lumiFormat.i
int i
Definition: lumiFormat.py:92
MuonGM::Micromegas::Micromegas
Micromegas(Component *s)
Definition: Micromegas.cxx:37
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonGM::Micromegas::build
GeoFullPhysVol * build(StoredMaterialManager &matManager, int minimalgeo)
Definition: Micromegas.cxx:47
MuonGM::MicromegasComponent
Definition: MicromegasComponent.h:15
Component.h
MuonGM::Micromegas::width
double width
Definition: Micromegas.h:23
MMDetectorDescription::ysFrame
void ysFrame(double y)
Definition: MMDetectorDescription.h:59
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
StoredMaterialManager.h
MuonGM::MicromegasComponent::subType
std::string subType
Definition: MicromegasComponent.h:21
AGDDDetectorStore
Definition: AGDDDetectorStore.h:18
MM_Technology.h
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::Micromegas::longWidth
double longWidth
Definition: Micromegas.h:26
MuonGM::DetectorElement::logVolName
std::string logVolName
Definition: DetectorElement.h:18
MMDetectorHelper::Get_MMDetectorSubType
MMDetectorDescription * Get_MMDetectorSubType(const std::string &type)
Definition: MMDetectorHelper.cxx:119
MMDetectorHelper
Definition: MMDetectorHelper.h:24
MMDetectorDescription::ylFrame
void ylFrame(double y)
Definition: MMDetectorDescription.h:62
MuonGM::Micromegas::length
double length
Definition: Micromegas.h:24
MuonGM::Micromegas::print
virtual void print() const override
Definition: Micromegas.cxx:149
MuonGM::Micromegas::thickness
double thickness
Definition: Micromegas.h:25
MMDetectorHelper.h
python.compressB64.c
def c
Definition: compressB64.py:93
MMDetectorDescription::xFrame
void xFrame(double y)
Definition: MMDetectorDescription.h:56
read_hist_ntuple.f1
f1
Definition: read_hist_ntuple.py:4