ATLAS Offline Software
Loading...
Searching...
No Matches
Micromegas.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
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"
27
28#include <GaudiKernel/IMessageSvc.h>
29#include <GaudiKernel/MsgStream.h>
30#include <GeoModelKernel/GeoShape.h>
31#include <string>
32
33class GeoMaterial;
34
35namespace MuonGM {
36
38 MicromegasComponent *s = static_cast<MicromegasComponent *>(ss);
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();
61 MMDetectorDescription *mm_descr = mmHelper.Get_MMDetectorSubType(m_component->subType);
62
63 MM_Technology *t = static_cast<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
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
#define endmsg
static Double_t ss
CxxUtils::LockedPointer< AGDDController > LockedController
MMDetectorDescription * Get_MMDetectorSubType(const std::string &type)
IAGDDtoGeoSvc::LockedController Get_Controller()
DetectorElement(const std::string &n)
Micromegas(Component *s)
virtual void print() const override
MicromegasComponent * m_component
Definition Micromegas.h:38
GeoFullPhysVol * build(StoredMaterialManager &matManager, int minimalgeo)
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
IMessageSvc * getMessageSvc(bool quiet=false)
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27
Definition index.py:1