ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
MuonGM::Tgc Class Reference

#include <Tgc.h>

Inheritance diagram for MuonGM::Tgc:
Collaboration diagram for MuonGM::Tgc:

Public Member Functions

 Tgc (const MYSQL &mysql, Component *s)
 
GeoFullPhysVol * build (StoredMaterialManager &matManager, const MYSQL &mysql, int minimalgeo)
 
GeoFullPhysVol * build (StoredMaterialManager &matManager, const MYSQL &mysql, int minimalgeo, int cutoutson, const std::vector< Cutout * > &)
 
virtual void print () const override
 
void setLogVolName (const std::string &str)
 

Public Attributes

double width {0.}
 
double length {0.}
 
double thickness {0.}
 
double longWidth {0.}
 
double irad {0.}
 
double orad {0.}
 
double dphi {0.}
 
int index {0}
 
std::string name {}
 
std::string logVolName {}
 

Private Attributes

TgcComponentm_component {nullptr}
 

Detailed Description

Definition at line 18 of file Tgc.h.

Constructor & Destructor Documentation

◆ Tgc()

MuonGM::Tgc::Tgc ( const MYSQL mysql,
Component s 
)

Definition at line 36 of file Tgc.cxx.

36  : DetectorElement(ss->name) {
37  TgcComponent *s = (TgcComponent *)ss;
38  m_component = s;
39  width = s->dx1;
40  longWidth = s->dx2;
41  length = s->dy;
42  thickness = s->GetThickness(mysql);
43  index = s->index;
44  }

Member Function Documentation

◆ build() [1/2]

GeoFullPhysVol * MuonGM::Tgc::build ( StoredMaterialManager matManager,
const MYSQL mysql,
int  minimalgeo 
)

Definition at line 46 of file Tgc.cxx.

48  {
49  std::vector<Cutout *> vcutdef;
50  int cutoutson = 0;
51  return build(matManager, mysql, minimalgeo, cutoutson, vcutdef);
52  }

◆ build() [2/2]

GeoFullPhysVol * MuonGM::Tgc::build ( StoredMaterialManager matManager,
const MYSQL mysql,
int  minimalgeo,
int  cutoutson,
const std::vector< Cutout * > &  vcutdef 
)

Definition at line 54 of file Tgc.cxx.

57  {
58  const TGC *t = dynamic_cast<const TGC*>(mysql.GetTechnology(name));
59  thickness = t->thickness;
60 
61  // Build TGC mother volume out of G10
62  const GeoShape *strd = new GeoTrd(thickness / 2, thickness / 2, width / 2, longWidth / 2, length / 2);
63  if (cutoutson && !vcutdef.empty()) {
64  Cutout *cut = nullptr;
65  GeoShape *cutoutShape = nullptr;
66  GeoTrf::Transform3D cutTrans{GeoTrf::Transform3D::Identity()};
67  for (unsigned i = 0; i < vcutdef.size(); i++) {
68  cut = vcutdef[i];
69  cutoutShape = new GeoTrd(thickness / 2. + 1., thickness / 2. + 1., cut->widthXs / 2., cut->widthXl / 2., cut->lengthY / 2.);
70  cutTrans = GeoTrf::Translate3D(0.0, cut->dx, -length / 2 + cut->dy + cut->lengthY / 2.);
71  strd = &(strd->subtract((*cutoutShape) << cutTrans));
72  }
73  }
74 
75  const GeoMaterial *mtrd = matManager.getMaterial("std::G10");
76  GeoLogVol *ltrd = new GeoLogVol(logVolName, strd, mtrd);
77  GeoFullPhysVol *ptrd = new GeoFullPhysVol(ltrd);
78 
79  if (minimalgeo == 1)
80  return ptrd;
81 
82  double newpos = -thickness / 2.;
83  if (!skip_tgc)
84  ptrd->add(new GeoSerialIdentifier(0));
85 
86  int igl = 0;
87  int iSenLyr = 0;
88 
89  // Loop over TGC layers
90  for (int i = 0; i < t->nlayers; i++) {
91  double widthActive;
92  double longWidthActive;
93  double lengthActive;
94 
95  if (t->materials[i] == "muo::TGCGas") {
96  // sensitive volume with wire/button support
97  igl++;
98  if (!skip_tgc)
99  ptrd->add(new GeoIdentifierTag(igl));
100 
101  widthActive = width - (t->frame_ab) * 2;
102  longWidthActive = longWidth - (t->frame_ab) * 2;
103  lengthActive = length - (t->frame_h) * 2;
104 
105  const GeoShape *sGasVolume = new GeoTrd(t->tck[i] / 2, t->tck[i] / 2, widthActive / 2, longWidthActive / 2, lengthActive / 2);
106 
107  if (t->widthWireSupport != 0. && t->radiusButton != 0.) {
108  // No supports for CTB simulation since their parameters are not in the DB
109  // Build wire supports and button supports in sensitive volume
110 
111  // wire supports
112  GeoTrd *strdsup = new GeoTrd(t->tck[i] / 2, t->tck[i] / 2, t->widthWireSupport / 2, t->widthWireSupport / 2, lengthActive / 2 - 0.1 * Gaudi::Units::mm);
113  // button supports
114  GeoTube *stubesup = new GeoTube(0., t->radiusButton, t->tck[i] / 2. + 0.005 * Gaudi::Units::mm);
115  GeoTrf::RotateY3D rotY(M_PI_2 * Gaudi::Units::rad);
116 
117  int iymin = int(-(widthActive / 2. + lengthActive * tan(t->angleTilt) - t->widthWireSupport / 2. + t->offsetWireSupport[iSenLyr]) / t->distanceWireSupport);
118  int iymax = int((widthActive / 2. + lengthActive * tan(t->angleTilt) - t->widthWireSupport / 2. - t->offsetWireSupport[iSenLyr]) / t->distanceWireSupport);
119 
120  for (int isup = iymin; isup <= iymax; isup++) { // loop over wire supports
121  // place wire supports
122  double sign = 1.;
123  if (t->offsetWireSupport[iSenLyr] + t->distanceWireSupport * isup > 0.) {
124  sign = -1.;
125  } else if (t->offsetWireSupport[iSenLyr] + t->distanceWireSupport * isup == 0.) {
126  sign = 0;
127  }
128  GeoTrf::RotateX3D rotX(sign * t->angleTilt);
129  GeoTrf::Translate3D vtransWS(0., t->offsetWireSupport[iSenLyr] + t->distanceWireSupport * isup + lengthActive / 2. * tan(sign * t->angleTilt), 0.);
130 
131  sGasVolume = &(sGasVolume->subtract((*strdsup) << GeoTrf::Transform3D(vtransWS * rotX)));
132 
133  // place button supports
134  int izmin, izmax;
135  izmax = int((lengthActive / 2. - t->radiusButton) / (t->pitchButton[1] / 2.));
136  izmin = -izmax;
137 
138  int nBS = 0;
139  double yposCentre[2], angleTiltButton[2];
140  if (isup < iymax) { // button support in rectangular sensitive area
141  double yLongBase, yShortBase;
142  yLongBase =
143  ((t->offsetWireSupport[iSenLyr] + t->distanceWireSupport * (isup + 1)) + (t->offsetWireSupport[iSenLyr] + t->distanceWireSupport * isup)) / 2.;
144  if (t->offsetWireSupport[iSenLyr] + t->distanceWireSupport * (isup + 1) < 0.) {
145  yShortBase = yLongBase + lengthActive * tan(t->angleTilt);
146  } else if (t->offsetWireSupport[iSenLyr] + t->distanceWireSupport * (isup) > 0.) {
147  yShortBase = yLongBase + lengthActive * tan(-t->angleTilt);
148  } else {
149  yShortBase = yLongBase;
150  }
151 
152  nBS = 1;
153  yposCentre[0] = yLongBase;
154  angleTiltButton[0] = atan((yShortBase - yLongBase) / lengthActive);
155 
156  } else if (isup == iymax) {
157  // place extra wire supports for TGC01, TGC06 and TGC12
158  if (name == "TGC01" || name == "TGC06" || name == "TGC12") {
159  for (int iside = 0; iside < 2; iside++) {
160  int isupy;
161  if (iside == 0) {
162  isupy = iymin - 1;
163  sign = 1.;
164  } else {
165  isupy = iymax + 1;
166  sign = -1.;
167  }
168  double lengthWireSupportEx;
169  lengthWireSupportEx = lengthActive / (longWidthActive / 2. - widthActive / 2.) *
170  (longWidthActive / 2. - fabs(t->distanceWireSupport * isupy + t->offsetWireSupport[iSenLyr]));
171  GeoTrd *strdsupex = new GeoTrd(t->tck[i] / 2, t->tck[i] / 2, t->widthWireSupport / 2, t->widthWireSupport / 2,
172  lengthWireSupportEx / 2 - 0.1 * Gaudi::Units::mm);
173  GeoTrf::Translate3D vtrans(0., t->offsetWireSupport[iSenLyr] + t->distanceWireSupport * isupy + lengthActive / 2. * tan(sign * t->angleTilt),
174  (lengthActive - lengthWireSupportEx) / 2.);
175 
176  sGasVolume = &(sGasVolume->subtract((*strdsupex) << GeoTrf::Transform3D(vtrans * rotX)));
177  }
178  } // End special case for TGC01, 06, 12
179 
180  // button supports in trapezoidal sensitive area
181  double widthLeftTrd = (t->distanceWireSupport * iymin + t->offsetWireSupport[iSenLyr] + lengthActive * tan(t->angleTilt)) - (-widthActive / 2.);
182  if (widthLeftTrd > 8. * Gaudi::Units::cm) {
183  double yLongBase;
184  if ((name == "TGC01" || name == "TGC06" || name == "TGC12") &&
185  t->distanceWireSupport * (iymin - 1) + t->offsetWireSupport[iSenLyr] > -longWidthActive / 2.) {
186  yLongBase = ((t->distanceWireSupport * (iymin - 1) + t->offsetWireSupport[iSenLyr]) +
187  (t->distanceWireSupport * iymin + t->offsetWireSupport[iSenLyr])) /
188  2.;
189  } else {
190  yLongBase = ((t->distanceWireSupport * iymin + t->offsetWireSupport[iSenLyr]) + (-longWidthActive / 2.)) / 2.;
191  }
192  double yShortBase =
193  ((t->distanceWireSupport * iymin + t->offsetWireSupport[iSenLyr] + lengthActive * tan(t->angleTilt)) + (-widthActive / 2.)) / 2.;
194  yposCentre[nBS] = yLongBase;
195  angleTiltButton[nBS] = atan((yShortBase - yLongBase) / lengthActive);
196  nBS++;
197  }
198 
199  double widthRightTrd = widthActive / 2. - (t->distanceWireSupport * iymax + t->offsetWireSupport[iSenLyr] + lengthActive * tan(-t->angleTilt));
200 
201  if (widthRightTrd > 8. * Gaudi::Units::cm) {
202  double yLongBase;
203  if ((name == "TGC01" || name == "TGC06" || name == "TGC12") &&
204  t->distanceWireSupport * (iymax + 1) + t->offsetWireSupport[iSenLyr] < longWidthActive / 2.) {
205  yLongBase = ((t->distanceWireSupport * (iymax + 1) + t->offsetWireSupport[iSenLyr]) +
206  (t->distanceWireSupport * iymax + t->offsetWireSupport[iSenLyr])) /
207  2.;
208  } else {
209  yLongBase = ((t->distanceWireSupport * iymax + t->offsetWireSupport[iSenLyr]) + longWidthActive / 2.) / 2.;
210  }
211  double yShortBase = ((t->distanceWireSupport * iymax + t->offsetWireSupport[iSenLyr] + lengthActive * tan(-t->angleTilt)) + widthActive / 2.) / 2.;
212  yposCentre[nBS] = yLongBase;
213  angleTiltButton[nBS] = atan((yShortBase - yLongBase) / lengthActive);
214  nBS++;
215  }
216 
217  if (nBS == 0) { // no button support in trapezoidal sensitive area
218  break; // leave isup loop
219  }
220  } // isup, iymax
221  for (int iBS = 0; iBS < nBS; iBS++) {
222  for (int isupz = izmin; isupz <= izmax; isupz++) {
223  double yposleft = yposCentre[iBS] - t->pitchButton[0] / 2. + (lengthActive / 2. - t->pitchButton[1] / 2. * isupz) * tan(angleTiltButton[iBS]);
224  GeoTrf::Translate3D vtransBS(0., yposleft + t->pitchButton[0] * std::abs(isupz % 2), t->pitchButton[1] / 2. * isupz);
225  sGasVolume = &(sGasVolume->subtract((*stubesup) << GeoTrf::Transform3D(vtransBS * rotY)));
226  }
227  }
228  } // loop over wire supports
229  } // No supports for CTB Simulation
230 
231  if (cutoutson && !vcutdef.empty()) {
232  // Make cutout in gas volume a bit larger so that G10 of mother volume
233  // makes a gas boundary
234  Cutout *cut = nullptr;
235  GeoShape *cutoutShape = nullptr;
236  GeoTrf::Transform3D cutTrans{GeoTrf::Transform3D::Identity()};
237  for (unsigned i = 0; i < vcutdef.size(); i++) {
238  cut = vcutdef[i];
239  cutoutShape = new GeoTrd(thickness / 2. + 1., thickness / 2. + 1., cut->widthXs / 2. + t->frame_ab / 2., cut->widthXl / 2. + t->frame_ab / 2.,
240  cut->lengthY / 2. + t->frame_h / 2.);
241  cutTrans = GeoTrf::Translate3D(0.0, cut->dx, -length / 2 + cut->dy + cut->lengthY / 2.);
242  sGasVolume = &(sGasVolume->subtract((*cutoutShape) << cutTrans));
243  }
244  }
245 
246  GeoLogVol *ltrdtmp = new GeoLogVol(t->materials[i], sGasVolume, matManager.getMaterial(t->materials[i]));
247  GeoPhysVol *ptrdtmp = new GeoPhysVol(ltrdtmp);
248  GeoNameTag *ntrdtmp = new GeoNameTag(name + t->materials[i]);
249  GeoTransform *ttrdtmp = new GeoTransform(GeoTrf::TranslateX3D(newpos + (t->tck[i] / 2)));
250 
251  // Place gas volume inside G10 mother volume so that
252  // subtractions from gas volume now become G10
253  if (!skip_tgc) {
254  ptrd->add(ntrdtmp);
255  ptrd->add(ttrdtmp);
256  ptrd->add(ptrdtmp);
257  }
258 
259  iSenLyr++;
260 
261  } else if (t->materials[i] != "std:G10") {
262  // passive structure, Copper, Honeycomb,
263  // except for G10 which is material of the mother volume
264  const GeoShape *strdtmp = new GeoTrd(t->tck[i] / 2, t->tck[i] / 2, width / 2, longWidth / 2, length / 2);
265  if (cutoutson && !vcutdef.empty()) {
266  Cutout *cut = nullptr;
267  GeoShape *cutoutShape = nullptr;
268  GeoTrf::Transform3D cutTrans{GeoTrf::Transform3D::Identity()};
269  for (unsigned i = 0; i < vcutdef.size(); i++) {
270  cut = vcutdef[i];
271  cutoutShape = new GeoTrd(thickness / 2. + 1., thickness / 2. + 1., cut->widthXs / 2., cut->widthXl / 2., cut->lengthY / 2.);
272  cutTrans = GeoTrf::Translate3D(0.0, cut->dx, -length / 2 + cut->dy + cut->lengthY / 2.);
273  strdtmp = &(strdtmp->subtract((*cutoutShape) << cutTrans));
274  }
275  }
276  GeoLogVol *ltrdtmp = new GeoLogVol(t->materials[i], strdtmp, matManager.getMaterial(t->materials[i]));
277  GeoPhysVol *ptrdtmp = new GeoPhysVol(ltrdtmp);
278  GeoNameTag *ntrdtmp = new GeoNameTag(name + t->materials[i]);
279  GeoTransform *ttrdtmp = new GeoTransform(GeoTrf::TranslateX3D(newpos + (t->tck[i] / 2)));
280 
281  if (!skip_tgc) {
282  ptrd->add(ntrdtmp);
283  ptrd->add(ttrdtmp);
284  ptrd->add(ptrdtmp);
285  }
286  } // Active or passive layer
287 
288  newpos += t->tck[i];
289  } // Loop over tgc layers
290 
291  return ptrd;
292  }

◆ print()

void MuonGM::Tgc::print ( ) const
overridevirtual

Implements MuonGM::DetectorElement.

Definition at line 294 of file Tgc.cxx.

294  {
295  MsgStream log(Athena::getMessageSvc(), "MuGM::Tgc");
296  log << MSG::INFO << " Tgc " << name << " :" << endmsg;
297  }

◆ setLogVolName()

void MuonGM::DetectorElement::setLogVolName ( const std::string &  str)
inlineinherited

Definition at line 22 of file DetectorElement.h.

22 { logVolName = str; }

Member Data Documentation

◆ dphi

double MuonGM::Tgc::dphi {0.}

Definition at line 27 of file Tgc.h.

◆ index

int MuonGM::Tgc::index {0}

Definition at line 28 of file Tgc.h.

◆ irad

double MuonGM::Tgc::irad {0.}

Definition at line 25 of file Tgc.h.

◆ length

double MuonGM::Tgc::length {0.}

Definition at line 22 of file Tgc.h.

◆ logVolName

std::string MuonGM::DetectorElement::logVolName {}
inherited

Definition at line 18 of file DetectorElement.h.

◆ longWidth

double MuonGM::Tgc::longWidth {0.}

Definition at line 24 of file Tgc.h.

◆ m_component

TgcComponent* MuonGM::Tgc::m_component {nullptr}
private

Definition at line 41 of file Tgc.h.

◆ name

std::string MuonGM::DetectorElement::name {}
inherited

Definition at line 17 of file DetectorElement.h.

◆ orad

double MuonGM::Tgc::orad {0.}

Definition at line 26 of file Tgc.h.

◆ thickness

double MuonGM::Tgc::thickness {0.}

Definition at line 23 of file Tgc.h.

◆ width

double MuonGM::Tgc::width {0.}

Definition at line 21 of file Tgc.h.


The documentation for this class was generated from the following files:
MuonGM::DetectorElement::name
std::string name
Definition: DetectorElement.h:17
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
MuonGM::Tgc::thickness
double thickness
Definition: Tgc.h:23
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
index
Definition: index.py:1
skip_tgc
#define skip_tgc
Definition: Tgc.cxx:32
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
MuonGM::Tgc::width
double width
Definition: Tgc.h:21
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
MuonGM::Tgc::m_component
TgcComponent * m_component
Definition: Tgc.h:41
lumiFormat.i
int i
Definition: lumiFormat.py:85
TGC
Definition: TgcBase.h:6
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonGM::Tgc::longWidth
double longWidth
Definition: Tgc.h:24
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
MuonGM::Tgc::length
double length
Definition: Tgc.h:22
MuonGM::Tgc::build
GeoFullPhysVol * build(StoredMaterialManager &matManager, const MYSQL &mysql, int minimalgeo)
Definition: Tgc.cxx:46
MuonGM::DetectorElement::logVolName
std::string logVolName
Definition: DetectorElement.h:18
MuonGM::DetectorElement::DetectorElement
DetectorElement(const std::string &n)
Definition: DetectorElement.h:20
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111