ATLAS Offline Software
MuonChamberLite.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 #include "GaudiKernel/MsgStream.h"
7 //
9 #include "MuonGeoModel/Csc.h"
10 #include "MuonGeoModel/Cutout.h"
11 #include "MuonGeoModel/Ded.h"
12 #include "MuonGeoModel/Mdt.h"
14 #include "MuonGeoModel/Position.h"
15 #include "MuonGeoModel/Rpc.h"
16 #include "MuonGeoModel/Spacer.h"
18 #include "MuonGeoModel/Station.h"
19 #include "MuonGeoModel/Tgc.h"
22 //
35 
36 // just to check subtype, cutout:
40 #include "MuonGeoModel/MYSQL.h"
43 //
48 //
49 #include "GaudiKernel/SystemOfUnits.h"
50 #include "GeoModelKernel/GeoDefinitions.h"
51 
52 
53 #include <fstream>
54 #include <iomanip>
55 #include <vector>
56 #include <stdexcept>
57 #include <set>
58 
59 #define RPCON true
60 #define useAssemblies false
61 namespace {
62  // const maps holding the y/z translation for BIS RPCs (since they cannot be parsed by amdb)
63  const std::map<std::string, float> rpcYTrans = {
64  std::make_pair<std::string, float>("RPC26", -9.1), // big RPC7
65  std::make_pair<std::string, float>("RPC27", -9.1), // small RPC7
66  std::make_pair<std::string, float>("RPC28", -27.7), // big RPC8
67  std::make_pair<std::string, float>("RPC29", -8.8), // small RPC8
68  };
69  const std::map<std::string, float> rpcZTrans = {
70  std::make_pair<std::string, float>("RPC26", 3.22), // big RPC7
71  std::make_pair<std::string, float>("RPC27", 3.06), // small RPC7
72  std::make_pair<std::string, float>("RPC28", 3.11), // big RPC8
73  std::make_pair<std::string, float>("RPC29", 3.11), // small RPC8
74  };
75 } // namespace
76 
77 
78 
79 namespace MuonGM {
80 
81  // cutouts for BMS at eta=+-1 and phi=4 (RPC/DED/MDT) ok //16 tubes shorter + entire RPC and DED (of dbz1) narrower
82 
84  std::map<std::string, GeoFullPhysVol*> * mapFPV,
85  std::map<std::string, GeoAlignableTransform *> *mapAXF) :
86  DetectorElement(s->GetName()),
87  AthMessaging{"MuonchamberLite"},
88  m_mapFPV(mapFPV),
89  m_mapAXF(mapAXF)
90  {
91  width = s->GetWidth1();
92  longWidth = s->GetWidth2();
93  thickness = s->GetThickness(mysql);
94  length = s->GetLength();
95  m_station = s;
96 
97  // CSL envelope is too small for its components - enlarge it slightly
98  std::string stname(m_station->GetName(), 0, 3);
99  if (stname == "CSL")
100  longWidth *= 1.015;
101 
102 
103  }
104 
106  const MYSQL& mysql,
107  MuonDetectorManager *manager, int zi, int fi, bool is_mirrored, bool &isAssembly) {
108 
109 
110 
111  ATH_MSG_VERBOSE( " Building a MuonChamberLite for m_station " << m_station->GetName() << " at zi, fi " << zi << " " << fi + 1 << " is_mirrored " << is_mirrored
112  << " is assembly = " << isAssembly );
113 
114  std::string stname(m_station->GetName(), 0, 3);
115 
116  double halfpitch = m_station->mdtHalfPitch(mysql);
117  const std::string stName = m_station->GetName();
118 
119  const MdtIdHelper *mdt_id = manager->mdtIdHelper();
120  int stationType = mdt_id->stationNameIndex(stName.substr(0, 3));
121 
122  double extratop = m_station->GetExtraTopThickness();
123  double extrabottom = m_station->GetExtraBottomThickness();
124  double totthick = thickness + extratop + extrabottom;
125 
126 
127  double amdbOrigine_along_length = m_station->getAmdbOrigine_along_length();
128  double amdbOrigine_along_thickness = m_station->getAmdbOrigine_along_thickness(mysql);
129 
130 
131  // This will allow the MDT tube structure to be mirrored w.r.t. the chamber at z>0
132  // and to correctly place any other component in the m_station
133  if (zi < 0 && !is_mirrored && stName[0] == 'B') {
134  if (m_station->hasMdts()) {
135  amdbOrigine_along_length += halfpitch;
136  }
137  }
138  ATH_MSG_VERBOSE( "amdb origine: in the length direction = "
139  << amdbOrigine_along_length << " in the thickness direction = " << amdbOrigine_along_thickness);
140 
141  if (isAssembly) {
142  ATH_MSG_DEBUG("Station " << stName << " at zi, fi " << zi << " " << fi + 1 << " will be described as Assembly" );
143 
144  }
145 
146  // for BOG in layout Q we will have to shorten CHV, CMI as these
147  // are not shortened in AMDB
148 
149 
150  // if this is a BOG, we want to make cutouts in the MOTHER VOLUME
151  if (stName.compare(0, 3, "BOG") == 0 && (manager->IncludeCutoutsBogFlag() || manager->IncludeCutoutsFlag())) {
152 
153  ATH_MSG_VERBOSE( "amdb org: length= " << amdbOrigine_along_length << " thickness= " << amdbOrigine_along_thickness );
154 
155  std::string statType = stName.substr(0, 3);
156  if (m_station->GetNrOfCutouts() > 0) {
157  ATH_MSG_DEBUG( "Station " << stName << " at zi, fi " << zi << " " << fi + 1 << " has components with cutouts " );
158  isAssembly = true;
159 
160  // look for FIRST component with cutouts and loop over all of the cutouts:
161  bool foundCutouts = false;
162  for (int j = 0; j < m_station->GetNrOfComponents(); j++) {
164 
165  if (!foundCutouts) {
166  for (int ii = 0; ii < m_station->GetNrOfCutouts(); ii++) {
167  Cutout *cut = m_station->GetCutout(ii);
168  // if this is a BOG in layout Q, set the CP param:
169  // (both cuts have same length so ok to reset it)
170  // also do here some tweaking to prevent undershoot
171  // of the cutouts wrt mother volume:
172  if (std::abs(cut->dx - 600.7) < 0.1) {
173  cut->dx = cut->dx + 10. * Gaudi::Units::mm;
174  cut->widthXs = cut->widthXs + 20. * Gaudi::Units::mm;
175  cut->widthXl = cut->widthXl + 20. * Gaudi::Units::mm;
176  }
177  if (std::abs(cut->dx + 600.7) < 0.1) {
178  cut->dx = cut->dx - 10. * Gaudi::Units::mm;
179  cut->widthXs = cut->widthXs + 20. * Gaudi::Units::mm;
180  cut->widthXl = cut->widthXl + 20. * Gaudi::Units::mm;
181  }
182  if (std::abs(cut->lengthY - 180.2) < 0.001) {
183  cut->lengthY = cut->lengthY + (0.010) * Gaudi::Units::mm;
184  }
185  if (std::abs(cut->dy - 1019.8) < 0.001) {
186  cut->dy = 1216.4185 - cut->lengthY;
187  }
188  // create the cutout with the full thickness of the STATION
189  cut->setThickness(totthick * 1.01); // extra to be sure
190  if ((cut->subtype == mysql.allocPosFindSubtype(std::string(statType), fi, zi)) && (cut->icut == mysql.allocPosFindCutout(std::string(statType), fi, zi)) &&
191  (cut->ijob == c->index)) {
192 
193  foundCutouts = true;
194  }
195  } // Loop over cutouts
196  } // If no cutouts
197  } // Loop over components
198  }
199  } // end of special loop just for cutouts
200 
201 
202 
203  double ypos{0.}, zpos{0.}, xpos{0.}, irad{0.};
204  std::array<int, 2 > ndbz{0, 0};
205 
206  // Compute how many RPC modules there are in the m_station
207  int nDoubletR{0}, nRpc{0}, nTgc{0}, nCsc{0}, nMdt{0};
208  double previous_depth = 0.;
209 
210  ATH_MSG_VERBOSE( " Station Name = " << stName << " fi/zi " << fi << "/" << zi << " defining the n. of DoubletR to " );
211 
212 
213  for (int j = 0; j < m_station->GetNrOfComponents(); j++) {
215  std::string_view cn = std::string_view(d->name).substr(0, 3);
216  if (cn == "RPC") {
217  nRpc++;
218  if (nRpc == 1)
219  nDoubletR++;
220  double depth = -thickness / 2. + d->posz + d->GetThickness(mysql) / 2.;
221  // BI RPC Chambers have one one doubletR
222  if (!(stname.compare(0, 2, "BI") == 0) && nDoubletR == 1 && nRpc > 1 && depth * previous_depth < 0)
223  nDoubletR++;
224 
225  previous_depth = depth;
226  }
227  else if (cn == "CSC") {
228  nCsc++;
229  }
230  else if (cn == "TGC") {
231  nTgc++;
232  }
233  else if (cn == "MDT") {
234  nMdt++;
235  }
236  }
237  ATH_MSG_DEBUG( "nDoubletR: " << nDoubletR<<" nMdt/Rpc/Tgc/Csc " << nMdt << "/" << nRpc << "/" << nTgc << "/" << nCsc );
238 
239  // Get location and dimensions of long beams and pass them to cross beams
240  // in order to make holes
241  int numLB = -1;
242  double LBheight{0.}, LBwidth{0.};
243  std::array<double, 2> LBpos{-1, -1};
244  for (int i = 0; i < m_station->GetNrOfComponents(); i++) {
246  std::string_view cname = std::string_view(c->name).substr(0, 2);
247  if (cname == "LB") {
248  const LBI *lb = dynamic_cast<const LBI *>(mysql.GetTechnology(c->name));
249  numLB++;
250  LBpos[numLB] = c->posy + c->dy / 2.;
251  LBheight = lb->height;
252  LBwidth = c->dy;
253  }
254  if (numLB > 0)
255  break; // only 2 LBs per chamber
256  }
257 
258  for (int i = 0; i < m_station->GetNrOfComponents(); i++) {
260  std::string_view cname = std::string_view(c->name).substr(0, 3);
261  if (cname == "CRO" || cname == "CMI" || cname == "CHV") {
262  CbmComponent *ccbm = (CbmComponent *)c;
263  ccbm->lb_height = LBheight;
264  ccbm->lb_width = LBwidth;
265  ccbm->hole_pos1 = LBpos[0];
266  ccbm->hole_pos2 = LBpos[1];
267  }
268  }
269 
270  // Look for the subtype of the CMI in the chamber to let LB know ...
271  std::string CMIcomponentNumber = "";
272  for (int j = 0; j < m_station->GetNrOfComponents(); j++) {
274  std::string_view cn = std::string_view(d->name).substr(0, 3);
275  if (cn == "CMI") {
276  CMIcomponentNumber = (d->name).substr(3, 2);
277  break;
278  }
279  }
280 
281  for (int j = 0; j < m_station->GetNrOfComponents(); j++) {
283  std::string_view cn = std::string_view(d->name).substr(0, 2);
284  if (cn == "LB") {
285  LbiComponent *lbic = (LbiComponent *)d;
286  if (lbic) {
287  lbic->associated_CMIsubtype = CMIcomponentNumber;
288  } else
289  ATH_MSG_ERROR( "MuonChamberLite :: cannot associate a CMI subtype to the LB component " );
290  }
291  }
292 
293  // Build the MuonStation(readout-geometry) corresponding to this MuonChamberLite(raw-geometry)
294  MuonStation *mstat;
295  if (stName.compare(0, 1, "B") == 0) {
296  mstat = new MuonStation(stName.substr(0, 3), width, totthick, length, longWidth, totthick, length, zi, fi + 1,
297  (zi < 0 && !is_mirrored));
298  } else {
299  mstat = new MuonStation(stName.substr(0, 3), width, length, totthick, longWidth, length, totthick, zi, fi + 1,
300  (zi < 0 && !is_mirrored));
301  }
302 
303  manager->addMuonStation(std::unique_ptr<MuonStation>(mstat));
304  ATH_MSG_DEBUG( " Building a MuonStation for this MuonChamberLite " << m_station->GetName()
305  << " at zi, fi " << zi << " " << fi + 1 << " is_mirrored " << is_mirrored);
306 
307  GeoFullPhysVol *ptrd=(*m_mapFPV)[std::string(stName)+"_Station"+"_"+std::to_string(zi)+"_"+std::to_string(fi)];
308  mstat->setPhysVol(ptrd);
309  // here the big loop over the components !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
310  for (int i = 0; i < m_station->GetNrOfComponents(); i++) {
312  ATH_MSG_VERBOSE( " Component index " << c->index << " in loop for " << stName << " " << stationType << " at zi, fi " << zi << " " << fi + 1 << " cName "
313  << c->name << " thickness " << c->GetThickness(mysql) << " length " << c->dy << " w, lw " << c->dx1 << " " << c->dx2 );
314  ATH_MSG_VERBOSE( " Component local (amdb) coords " << c->posx << " " << c->posy << " " << c->posz );
315 
316  ypos = -thickness / 2. + c->posz + c->GetThickness(mysql) / 2.;
317  zpos = 0.;
318  xpos = 0.;
319 
320  ypos = -thickness / 2. + (c->posz + amdbOrigine_along_thickness) + c->GetThickness(mysql) / 2.;
321  zpos = -length / 2. + amdbOrigine_along_length + c->posy + c->dy / 2.;
322  xpos = c->posx;
323 
324  const std::string &techname = c->name;
325  std::string_view type = std::string_view(techname).substr(0, 3);
326 
327 
328 
329  GeoFullPhysVol *lvm = nullptr;
330  GeoFullPhysVol *lvr = nullptr;
331  GeoFullPhysVol *lvt = nullptr;
332  GeoFullPhysVol *lvc = nullptr;
333 
334 
335 
336  // Are there cutouts?
337  std::string statType = stName.substr(0, 3);
338  double cthickness = c->GetThickness(mysql);
339  int ncutouts = 0;
340  std::vector<Cutout *> vcutdef;
341  std::vector<std::unique_ptr<Cutout>> vcutdef_todel;
342  for (int ii = 0; ii < m_station->GetNrOfCutouts(); ii++) {
343  Cutout *cut = m_station->GetCutout(ii);
344  cut->setThickness(cthickness * 1.01); // extra thickness to be sure
345 
346  if ((cut->subtype == mysql.allocPosFindSubtype(std::string(statType), fi, zi)) && (cut->icut == mysql.allocPosFindCutout(std::string(statType), fi, zi)) && (cut->ijob == c->index)) {
347 
348  double tempdx = cut->dx;
349  double tempdy = cut->dy;
350  double templengthY = cut->lengthY;
351  cut->dx = 0.;
352  cut->dy = 0.;
353 
354  if (stName.compare(0, 3, "BOG") == 0) {
355  // make the cutouts a bit longer
356  cut->lengthY = templengthY + 31.;
357  }
358 
359  cut->dx = tempdx;
360  cut->dy = tempdy;
361 
362  if (std::abs(cut->dead1) > 1. && techname == "MDT03")
363  cut->dy = cut->dy + 15.0 * cos(cut->dead1 * Gaudi::Units::deg);
364  // should compensate for the dy position defined in amdb at the bottom of the foam in ML 1 of EMS1,3 and BOS 6
365  // can be applied only for layout >=r.04.04 in rel 15.6.X.Y due to the frozen Tier0 policy
366 
367  cut->lengthY = templengthY;
368  // in thickness, cutout will coincide with component
369  // not needed (DHW) double xposcut = 0.; // rel. to component thickness
370  ncutouts++;
371  ATH_MSG_VERBOSE( "A new cutout for this component " );
372  ATH_MSG_VERBOSE( *cut );
373 
374  // Corrected cutout values for BMS7, BMS14
375  if (stName.compare(0, 3, "BMS") == 0) {
376  if (fi == 3) { // stationPhi = 4
377  if (std::abs(zi) == 1) { // stationEta = +-1
378  double margin = 1.0; // make cutout a little bigger to avoid coincident boundaries
379 
380  if (type == "RPC" || type == "DED") {
381  cut->widthXl += 2 * margin;
382  cut->widthXs += 2 * margin;
383  cut->dx += margin;
384  cut->lengthY += 2 * margin;
385 
386  if (zi > 0)
387  cut->dy = -margin;
388  }
389  }
390 
391  if (zi == -1) {
392  if (type == "MDT")
393  cut->dy = 0.;
394  }
395  }
396  }
397 
398  // the following is a fine tuning ----- MUST CHECK for a better solution
399  if (stName.compare(0, 3,"BOS") == 0 && zi == -6 && type == "MDT") {
400  cut->dy = c->dy - cut->dy - cut->lengthY - halfpitch;
401  cut->dead1 = 30.; // why this is not 30. or -30. already ?????
402  if (techname == "MDT03")
403  cut->dy = cut->dy + 30.0; // *cos(cut->dead1*Gaudi::Units::deg);
404  ATH_MSG_VERBOSE( "Cut dead1 for BOS 6 on C side is " << cut->dead1 );
405 
406  }
407 
408  // this mirroring of the cutout is necessary only for barrel MDT chambers; for EC the cutout will be automatically mirrored
409  // this fix cannot be applied in 15.6.X.Y for layout < r.04.04 due to the frozen tier0 policy
410 
411  if (type == "MDT" && (is_mirrored || zi < 0) && stName.compare(0, 1, "B") == 0) {
412  // MDT in chambers explicitly described at z<0 have to be
413  // rotated by 180deg to adj. tube staggering
414  // reverse the position (x amdb) of the cutout if the m_station is mirrored
415  Cutout *cutmirr = new Cutout(*cut);
416  cutmirr->dx = -cutmirr->dx;
417  // this way, after the rotation by 180 Gaudi::Units::deg, the cut will be at the same global phi
418  // it has for the m_station at z>0
419  vcutdef.push_back(cutmirr);
420  vcutdef_todel.emplace_back(cutmirr);
421  ATH_MSG_VERBOSE( "adding for application mirrored cut \n" << *cutmirr );
422 
423  } else if (type == "RPC" || type == "DED") {
424  Cutout *cutRpcType = new Cutout(*cut);
425  // temporary for testing fixes to r.03.09
426  if (stName.compare(0, 3, "BMS") == 0 && zi == 4 && (c->index == 20 || c->index == 21 || c->index == 24 || c->index == 25)) {
427  cutRpcType->dy = 1102.5;
428  }
429 
430  if (stName.compare(0, 3, "BOS") == 0 && zi == 6 && type == "DED")
431  cutRpcType->dy = 706.;
432 
433  cutRpcType->dy = cutRpcType->dy - c->posy;
434  cutRpcType->dx = cutRpcType->dx - c->posx;
435 
436  if (type == "RPC") {
438  if (rp->iswap == -1) {
439  cutRpcType->dy = c->dy - (cutRpcType->dy + cutRpcType->lengthY);
440  }
441  }
442 
443  ATH_MSG_VERBOSE( " Rpc or ded cutout redefined as follows \n" << *cutRpcType );
444  vcutdef.push_back(cutRpcType);
445  vcutdef_todel.emplace_back(cutRpcType);
446  } else if (type == "TGC") {
447  // In AMDB, y coordinates of cutout and component are given by
448  // radius from detector z-axis. To get standard y value of cutout,
449  // subtract radius of component from radius of cutout
450  Cutout *tgccut = new Cutout(*cut);
451  tgccut->dy -= c->posy; //
452 
453  ATH_MSG_VERBOSE( " Tgc cutout redefined as follows \n" << *tgccut );
454  vcutdef.push_back(tgccut);
455  vcutdef_todel.emplace_back(tgccut);
456  } else {
457  vcutdef.push_back(cut);
458  }
459  }
460  } // Loop over cutouts in m_station
461 
462  if (ncutouts > 0) {
463  ATH_MSG_DEBUG( c->name << " of station " << stName << " at fi/zi " << fi + 1 << "/" << zi << " has " << ncutouts << " cutouts " );
464  }
465  // define here the total transform that will be applied to component:
466  GeoTrf::Transform3D htcomponent(GeoTrf::Transform3D::Identity());
467  GeoAlignableTransform *xfaligncomponent{nullptr};
468  // for RPCs we need a vector of transforms for M28 geometry...
469 
470  if (type == "CRO") {
471  if (stName.compare(0, 1, "B") != 0 && is_mirrored)
472  mstat->setxAmdbCRO(-xpos);
473  else
474  mstat->setxAmdbCRO(xpos);
475  }
476 
477  if (type == "MDT") {
478  MdtComponent *md= (MdtComponent *) c;
479  htcomponent = GeoTrf::TranslateX3D(ypos) * GeoTrf::TranslateZ3D(zpos) * GeoTrf::TranslateY3D(xpos);
480 
481  if (zi < 0 && !is_mirrored && stName[0] == 'B') {
482  // this (rotation + shift of halfpitch) will mirror the tube structure w.r.t. the chamber at z>0
483  htcomponent = htcomponent * GeoTrf::RotateX3D(180. * Gaudi::Units::deg);
484  htcomponent = htcomponent * GeoTrf::TranslateZ3D(halfpitch);
485  }
486 
487  // ss - 24-05-2006 I don't really understand if this is needed at all
488  // it was introduced by Isabel T.
489  if (zi < 0 && stName.compare(0, 3, "BOG") == 0 && is_mirrored) {
490  // htcomponent = htcomponent*GeoTrf::RotateX3D(180.*Gaudi::Units::deg);
491  // tubes OK but chambers wrong
492  // htcomponent = GeoTrf::RotateX3D(180.*Gaudi::Units::deg)*htcomponent;
493  // chambers OK but tubes wrong
494  htcomponent = GeoTrf::RotateX3D(180. * Gaudi::Units::deg) * htcomponent * GeoTrf::RotateX3D(180. * Gaudi::Units::deg); // turn chambers but go back for tubes
495  } // ss - 24-05-2006 I don't really understand if this is needed at all
496 
497  std::string key =std::string( stName) + techname;
498  xfaligncomponent = (*m_mapAXF)[key+"_"+std::to_string(zi)+"_"+std::to_string(fi)+"_"+std::to_string(md->index)];
499 
500  // for cutouts:
501  // MDT cutouts for BOS1,5, BMS7,14, (problem with BMS4,10), EMS, BMG and BIS MDT14
502  bool mdtCutoutFlag = ((stname == "BOS" && std::abs(zi) == 6) || stname == "BMG" || techname == "MDT14" || (stname == "BMS" && (std::abs(zi) == 1 && fi == 3)) ||
503  (stname == "EMS" && (std::abs(zi) == 1 || std::abs(zi) == 3)));
504  if (((manager->IncludeCutoutsFlag() && mdtCutoutFlag) || (manager->IncludeCutoutsBogFlag() && stName.compare(0, 3, "BOG") == 0)) && zi >= 0) {
505  key += "p" + buildString(mysql.allocPosFindSubtype(statType, fi, zi), 0) + "_" + buildString(mysql.allocPosFindCutout(statType, fi, zi), 0);
506  } else if (((manager->IncludeCutoutsFlag() && mdtCutoutFlag) || (manager->IncludeCutoutsBogFlag() && stName.compare(0, 3, "BOG")) == 0) && zi < 0) {
507  key += "m" + buildString(mysql.allocPosFindSubtype(statType, fi, zi), 0) + "_" + buildString(mysql.allocPosFindCutout(statType, fi, zi), 0);
508  }
509  if (m_keySet->find(key)==m_keySet->end()) {
510  std::unique_ptr<Mdt> r = std::make_unique<Mdt>(mysql, c, stName + techname);
511  if ((manager->IncludeCutoutsFlag() && mdtCutoutFlag) || (manager->IncludeCutoutsBogFlag() && stName.compare(0, 3, "BOG") == 0)) {
512  if (!vcutdef.empty()) r->processCutouts(vcutdef);
513  }
514  m_keySet->insert(key);
515  }
516  lvm = (*m_mapFPV)[key+"_"+std::to_string(zi)+"_"+std::to_string(fi)+"_"+std::to_string(md->index)];
517 
518  } else if (type == "RPC") {
519  // position stuff needed for cutout, used to be below:
521  int ndivy = rp->ndivy;
522  int ndivz = rp->ndivz;
523 
524  if (ndivz != 1 || ndivy != 1) {
525  ATH_MSG_ERROR( " RPC segmentation z,y " << ndivz << " " << ndivy );
526  }
527 
528  double xpos = c->posx;
529  // implement really the mirror symmetry
530  if (is_mirrored)
531  xpos = -xpos;
532 
533  ATH_MSG_VERBOSE( " In station " << stName << " with " << nDoubletR << " doubletR,"
534  << " RPC " << (c->name).substr(3, 2) << " has swap flag = " << rp->iswap << " ypos, zpos " << ypos << " " << zpos << " " );
535 
536  htcomponent = GeoTrf::TranslateX3D(ypos) * GeoTrf::TranslateY3D(xpos) * GeoTrf::TranslateZ3D(zpos);
537  if (rp->iswap == -1) { // this is like amdb iswap
538  htcomponent = htcomponent * GeoTrf::RotateY3D(180 * Gaudi::Units::deg);
539  }
540 
541  // end of position stuff
542 
543  bool rpcCutoutFlag = (stname == "BOS" && std::abs(zi) == 6) || (stname == "BMS" && (std::abs(zi) == 2 || std::abs(zi) == 4 || std::abs(zi) == 6)) ||
544  (stname == "BMS" && std::abs(zi) == 1 && fi == 3);
545  std::string key = stName + techname;
546  if (((manager->IncludeCutoutsFlag() && rpcCutoutFlag) || (manager->IncludeCutoutsBogFlag() && stName.compare(0, 3, "BOG") == 0)) && zi >= 0) {
547  key += "p" + buildString(mysql.allocPosFindSubtype(statType, fi, zi), 0) + "_" + buildString(mysql.allocPosFindCutout(statType, fi, zi), 0) + "_" +
548  buildString(vcutdef.size(), 0) + "_" + buildString(rp->iswap, 0);
549  } else if (((manager->IncludeCutoutsFlag() && rpcCutoutFlag) || (manager->IncludeCutoutsBogFlag() && stName.compare(0, 3, "BOG") == 0)) && zi < 0) {
550  key += "m" + buildString(mysql.allocPosFindSubtype(statType, fi, zi), 0) + "_" + buildString(mysql.allocPosFindCutout(statType, fi, zi), 0) + "_" +
551  buildString(vcutdef.size(), 0) + "_" + buildString(rp->iswap, 0);
552  }
553  xfaligncomponent = (*m_mapAXF)[key+"_"+std::to_string(zi)+"_"+std::to_string(fi)+"_"+std::to_string(rp->index)];
554  lvr = (*m_mapFPV)[key+"_"+std::to_string(zi)+"_"+std::to_string(fi)+"_"+std::to_string(rp->index)];
555  } else if (type == "TGC") {
558  irad = tgInner->posy;
560  double orad = tgOuter->posy + tgOuter->dy;
561  double start = -(orad - irad) / 2. + (tg->posy - irad) + tg->dy / 2;
562  double xstart = -thickness / 2. + tg->GetThickness(mysql) / 2.;
563  htcomponent = GeoTrf::TranslateX3D(xstart + tg->posz) * GeoTrf::TranslateZ3D(start);
564 
565  // Define key for this TGC component
566  std::string key = std::string(stName) + techname;
567  if (manager->IncludeCutoutsFlag()) {
568  if (mysql.allocPosFindCutout(statType, fi, zi) > 0) {
569  // If there is a cutout for this chamber, give it a special key
570  if (zi >= 0) {
571  key += "p" + buildString(mysql.allocPosFindSubtype(statType, fi, zi), 0) + "_" + buildString(mysql.allocPosFindCutout(statType, fi, zi), 0);
572  } else if (zi < 0) {
573  key += "m" + buildString(mysql.allocPosFindSubtype(statType, fi, zi), 0) + "_" + buildString(mysql.allocPosFindCutout(statType, fi, zi), 0);
574  }
575  }
576  }
577 
578  char chswidth[32];
579  sprintf(chswidth, "%i", int(10 * c->dx1));
580  key += chswidth;
581  xfaligncomponent = (*m_mapAXF)[key+"_"+std::to_string(zi)+"_"+std::to_string(fi)];
582 
583  lvt = (*m_mapFPV)[key+"_"+std::to_string(zi)+"_"+std::to_string(fi)];
584 
585  } else if (type == "CSC") {
586  htcomponent = GeoTrf::TranslateX3D(ypos) * GeoTrf::TranslateZ3D(zpos);
587  // Here define the key for this CSC component
588  std::string key = std::string(stName) + techname;
589  if (manager->IncludeCutoutsFlag() && zi >= 0) {
590  key += "p" + buildString(mysql.allocPosFindSubtype(statType, fi, zi), 0) + "_" + buildString(mysql.allocPosFindCutout(statType, fi, zi), 0);
591  } else if (manager->IncludeCutoutsFlag() && zi < 0) {
592  key += "m" + buildString(mysql.allocPosFindSubtype(statType, fi, zi), 0) + "_" + buildString(mysql.allocPosFindCutout(statType, fi, zi), 0);
593  }
594 
595  xfaligncomponent = (*m_mapAXF)[key+"_"+std::to_string(zi)+"_"+std::to_string(fi)];
596  lvc=(*m_mapFPV)[key+"_"+std::to_string(zi)+"_"+std::to_string(fi)];
597  } else {
598  if (type != "MDT" && type != "RPC" && type != "TGC" && type != "SUP" && type != "DED" && type != "SPA" && type != "CHV" && type != "CRO" && type != "CMI" &&
599  type != "LB0" && type != "LBI") {
600  ATH_MSG_WARNING("Unknown component " << type );
601  }
602  }
603 
604  // Place components in chamber envelope
605  if (lvm && manager->mdtIdHelper()) {
606  int stationEta = zi;
607  int stationPhi = fi + 1;
608  int ml = 1;
609  int tubel = 1;
610  int tube = 1;
611  if (ypos > 5.)
612  ml = 2; // Need >5 instead of >0 because BIS78 is not perfectly centered
613 
614 
615  const MdtIdHelper *mdt_id = manager->mdtIdHelper();
616  std::unique_ptr<MdtReadoutElement> det = std::make_unique<MdtReadoutElement>(lvm, stName, manager);
617  Position ip = mysql.GetStationPosition(stName.substr(0, 3), fi, zi);
618  setMdtReadoutGeom(mysql, det.get(), (MdtComponent *)c, ip);
619  det->setHasCutouts(ncutouts > 0);
620  det->setNMdtInStation(nMdt);
621  Identifier id = mdt_id->channelID(stationType, stationEta, stationPhi, ml, tubel, tube);
622  det->setIdentifier(id);
623  det->setMultilayer(ml);
624  det->setParentStationPV(PVConstLink(ptrd));
625  det->setParentMuonStation(mstat);
626  det->geoInitDone();
627 
628  if (ml == 1) {
629  // set fixed point for MDT deformations: s0,z0,t0 for the point at lowest t,z (z,y amdb) and s=x=0
630  mstat->setBlineFixedPointInAmdbLRS(c->posx, c->posy, c->posz);
631  } else {
632  const Amg::Vector3D b0 = mstat->getBlineFixedPointInAmdbLRS();
633  if (c->posy < b0.y())
634  mstat->setBlineFixedPointInAmdbLRS(b0.x(), c->posy, b0.z());
635  }
636 
637  int jobIndex = c->index;
638 
639  mstat->addMuonReadoutElementWithAlTransf(det.get(), xfaligncomponent, jobIndex);
640  manager->addMdtReadoutElement(std::move(det));
641  }
642 
643  if (lvc && manager->cscIdHelper()) {
645  int stationEta = zi;
646  int stationPhi = fi + 1;
647  int chamberLayer = 1;
648  if (ypos > 0.)
649  chamberLayer = 2;
650 
651  std::unique_ptr<CscReadoutElement> det = std::make_unique<CscReadoutElement>(lvc, stName, manager);
652  Position ip = mysql.GetStationPosition(stName.substr(0, 3), fi, zi);
653  setCscReadoutGeom(mysql, det.get(), cs, ip);
654 
655  const CscIdHelper *csc_id = manager->cscIdHelper();
656  det->setHasCutouts(ncutouts > 0);
657  Identifier id = csc_id->channelID(stationType, stationEta, stationPhi, chamberLayer, 1, 0, 1);
658  det->setIdentifier(id);
659 
660  det->setChamberLayer(chamberLayer);
661  det->setParentStationPV(PVConstLink(ptrd));
662  det->setParentMuonStation(mstat);
663 
664  int jobIndex = c->index;
665  //
666  mstat->addMuonReadoutElementWithAlTransf(det.get(), xfaligncomponent, jobIndex);
667 
668 
669 
670  // set alignment parameters for the wire layers
671  manager->addCscReadoutElement(std::move(det));
672  }
673 
674  if (lvt && manager->tgcIdHelper()) {
675 
676  ATH_MSG_DEBUG( " Adding a TGC chamber to the tree zi,fi, is_mirrored " << zi << " " << fi + 1 << " " << is_mirrored );
677 
678 
680 
681  ATH_MSG_VERBOSE( "There's a TGC named " << techname << " of thickness " << tg->GetThickness(mysql) );
682 
683  const TgcIdHelper *tgc_id = manager->tgcIdHelper();
684  int stationEta = 0;
685  stationEta = tg->index;
686  if (zi < 0)
687  stationEta = -stationEta;
688  int stationPhi = 0;
689  stationPhi = stationPhiTGC(stName, fi + 1,zi);
690 
691  std::unique_ptr<TgcReadoutElement> det = std::make_unique<TgcReadoutElement>(lvt, stName, manager);
692  Position ip = mysql.GetStationPosition(stName.substr(0, 3), fi, zi);
693  setTgcReadoutGeom(mysql, det.get(), tg, ip, stName);
694  det->setHasCutouts(ncutouts > 0);
695  Identifier id = tgc_id->channelID(stationType, stationEta, stationPhi, 1, false, 1);
696  det->setIdentifier(id);
697  det->setParentStationPV(PVConstLink(ptrd));
698  det->setParentMuonStation(mstat);
699 
700  int jobIndex = c->index;
701 
702  mstat->addMuonReadoutElementWithAlTransf(det.get(), xfaligncomponent, jobIndex);
703 
704  manager->addTgcReadoutElement(std::move(det));
705  }
706  if (lvr && RPCON && manager->rpcIdHelper()) {
708  int ndivy = rp->ndivy;
709  int ndivz = rp->ndivz;
710 
711  if (ndivz != 1 || ndivy != 1) {
712  ATH_MSG_ERROR( " RPC segmentation z,y " << ndivz << " " << ndivy );
713  }
714 
715  double zpos = -length / 2. + c->posy + c->dy / 2.;
716  double xpos = c->posx;
717 
718  // implement really the mirror symmetry
719  if (is_mirrored)
720  xpos = -xpos;
721  // ... putting back to here!
722 
723  const RpcIdHelper *rpc_id = manager->rpcIdHelper();
724  int stationEta = zi;
725  int stationPhi = fi + 1;
726  int doubletR = 1;
727  int doubletZ = 1;
728 
729  if (nRpc > 1 && nDoubletR == 2 && ypos > 0.)
730  doubletR = 2;
731  ndbz[doubletR - 1]++;
732 
733  // the BI RPCs are 3-gap RPCs mounted inside of the BI (s)MDTs
734  if (stname.find("BI") != std::string::npos) {
735  if (stname.find("BIS") != std::string::npos) {
736  // for BIS78, there is a second RPC doubletZ at amdb-y (MuonGeoModel-z)=144mm inside the station
737  if (std::abs(stationEta)>= 7){
738  ATH_MSG_DEBUG("BIS78 station eta: "<<stationEta<<" phi: "<<stationPhi<<" dR: "<<doubletR<<" dZ:"<< doubletZ <<" rp: "<<rp->posz);
739  }
740  if (std::abs(stationEta) >= 7 && rp->posz > 80)
741  doubletZ = 2;
742  else
743  doubletZ = 1;
744  } else {
745  // for BIL/BIM/BIR, we have 10 RPCs put on 6 MDT stations, thus, need to exploit doubletZ as additional variable on top of stationEta
746  // only for BIL, there are sometimes 2 RPCs per 1 MDT station, namely for stationEta 1,3,4,6
747  if (stname.find("BIL") != std::string::npos && std::abs(stationEta) < 7 && std::abs(stationEta) != 2 && std::abs(stationEta) != 5) {
748  if (rp->posy > 1)
749  doubletZ = 2; // put the chamber with positive amdb-z to doubletZ=2
750  } else
751  doubletZ = 1;
752  }
753  } else {
754  if (zi <= 0 && !is_mirrored) {
755  if (zpos < -100 * Gaudi::Units::mm)
756  doubletZ = 2;
757  } else {
758  if (zpos > 100 * Gaudi::Units::mm)
759  doubletZ = 2;
760  }
761  }
762 
763  // BMS (BOG) RPCs can have |xpos|=950 (|xpos|=350)
764  if (std::abs(xpos) > 100. * Gaudi::Units::mm) {
765  if (ndbz[doubletR - 1] > 2) {
766  doubletZ = 3;
767  }
768  ndbz[doubletR - 1]--;
769  }
770 
771  int dbphi = 1;
772 
773  // this special patch is needed for BMS in the ribs where xpos is ~950mm;
774  // the theshold to 100mm (too low) caused a bug
775  // in BOG at eta +/-4 and stationEta 7 (not 6) ==>> 28 Jan 2016 raising the threshold to 400.mm
776  // doublet phi not aware of pos. in space !!!
777  if (xpos > 400. * Gaudi::Units::mm)
778  dbphi = 2;
779 
780  int doubletPhi = dbphi;
781  //
782  if (zi < 0 && is_mirrored && doubletZ == 3) {
783  doubletPhi++;
784  if (doubletPhi > 2)
785  doubletPhi = 1;
786  } else if (zi < 0 && is_mirrored && doubletZ == 2 && doubletR == 1 && stName == "BMS6") {
787  doubletPhi++;
788  if (doubletPhi > 2)
789  doubletPhi = 1;
790  }
791  // never defined fields: set to the lower limit
792  int gasGap = 1;
793  int measuresPhi = 0;
794  int strip = 1;
795 
796  int tag = doubletZ + doubletR * 100 + dbphi * 1000;
797  if (rp->iswap == -1)
798  tag = -1 * tag;
799  if (useAssemblies || isAssembly) {
800  //
801  } else {
802  int tag = rp->index + doubletR * 100 + dbphi * 1000;
803  if (rp->iswap == -1)
804  tag = -1 * tag;
805 
806  }
807 
808 
809  std::unique_ptr<RpcReadoutElement> det = std::make_unique<RpcReadoutElement>(lvr, stName, zi, fi + 1, is_mirrored, manager);
810  Position ip = mysql.GetStationPosition(stName.substr(0, 3), fi, zi);
811  setRpcReadoutGeom(mysql, det.get(), rp, ip);
812  det->setHasCutouts(ncutouts > 0);
813  Identifier id = rpc_id->channelID(stationType, stationEta, stationPhi, doubletR, doubletZ, doubletPhi, gasGap, measuresPhi, strip);
814  det->setIdentifier(id);
815  det->setDoubletR(doubletR);
816  det->setDoubletZ(doubletZ);
817  det->setDoubletPhi(doubletPhi);
818  if (stName.find("BI") != std::string::npos)
819  det->setNumberOfLayers(3); // all BI RPCs always have 3 gas gaps
820  det->setParentStationPV(PVConstLink(ptrd));
821  det->setParentMuonStation(mstat);
822 
823  int jobIndex = c->index;
824 
825  mstat->addMuonReadoutElementWithAlTransf(det.get(), xfaligncomponent, jobIndex);
826 
827 
828 
829  if (stName.find("BI") != std::string::npos) {
830  std::map<std::string, float>::const_iterator yItr = rpcYTrans.find(techname);
831  if (yItr != rpcYTrans.end())
832  det->setYTranslation(yItr->second);
833  std::map<std::string, float>::const_iterator zItr = rpcZTrans.find(techname);
834  if (zItr != rpcZTrans.end())
835  det->setZTranslation(zItr->second);
836  }
837 
838  det->fillCache(); // fill temporary cache (global position on known yet)
839  det->initDesign();
840  det->clearCache(); // clear temporary cache
841  manager->addRpcReadoutElement(std::move(det));
842 
843  } // if (lvr && RPCON && manager->rpcIdHelper()) {
844 
845  } // End big loop over components
847 
848  return ptrd;
849  }
850 
852  CscReadoutElement *re, const CscComponent *cc, const Position &ip) {
853 
854  re->m_Ssize = cc->dx1;
855  re->m_LongSsize = cc->dx2;
856  re->m_Rsize = cc->dy;
857  re->m_LongRsize = cc->dy;
858  re->m_Zsize = cc->GetThickness(mysql);
859  re->m_LongZsize = cc->GetThickness(mysql);
860  re->m_RlengthUpToMaxWidth = cc->maxwdy;
861  re->m_excent = cc->excent;
862 
863  // Csc features specific to this readout element
864  std::string tname = cc->name;
865  re->setTechnologyName(tname);
866 
867  if (ip.isAssigned) {
868  re->setStationS(ip.shift);
869  } else {
870  throw std::runtime_error(" MuonChamberLite::setCscReadoutGeom: position not found ");
871  }
872 
873  const CSC *thisc = dynamic_cast<const CSC*>(mysql.GetTechnology(tname));
874  re->m_anodecathode_distance = thisc->anocathodist;
875  re->m_ngasgaps = thisc->numOfLayers;
876  re->m_nstriplayers = thisc->numOfLayers;
877  re->m_nwirelayers = thisc->numOfLayers;
878  re->m_roxacellwidth = thisc->roxacellwith;
879  re->m_nEtastripsperlayer = thisc->nEtastrips;
880  re->m_nPhistripsperlayer = thisc->nPhistrips;
881  re->m_Etastrippitch = thisc->cathreadoutpitch;
882  re->m_Phistrippitch = thisc->phireadoutpitch;
883  re->m_Etastripwidth = re->m_Etastrippitch;
884  re->m_Phistripwidth = re->m_Phistrippitch;
885  }
886 
888  MdtReadoutElement *re, const MdtComponent *cc, const Position &ip) {
889  re->m_Ssize = cc->dx1;
890  re->m_LongSsize = cc->dx2;
891 
892  if (re->m_inBarrel) {
893  re->m_Rsize = cc->GetThickness(mysql);
894  re->m_LongRsize = cc->GetThickness(mysql);
895  re->m_Zsize = cc->dy;
896  re->m_LongZsize = cc->dy;
897  } else {
898  re->m_Rsize = cc->dy;
899  re->m_LongRsize = cc->dy;
900  re->m_Zsize = cc->GetThickness(mysql);
901  re->m_LongZsize = cc->GetThickness(mysql);
902  }
903 
904  re->m_cutoutShift = cc->cutoutTubeXShift;
905  re->m_tubelenStepSize = cc->tubelenStepSize;
906 
907  if (ip.isAssigned) {
908  re->setStationS(ip.shift);
909  } else {
910  throw std::runtime_error(" MuonChamberLite::setMdtReadoutGeom: position not found ");
911  }
912 
913  std::string tname = cc->name;
914  re->setTechnologyName(tname);
915  const MDT *thism = dynamic_cast<const MDT*>(mysql.GetTechnology(tname));
916  re->m_nlayers = thism->numOfLayers;
917  re->m_tubepitch = thism->pitch;
918  re->m_tubelayerpitch = thism->y[1] - thism->y[0];
919  re->m_endpluglength = thism->tubeEndPlugLength;
920  re->m_deadlength = cc->deadx; // thism->tubeDeadLength;
921  re->m_innerRadius = thism->innerRadius;
922  re->m_tubeWallThickness = thism->tubeWallThickness;
923 
924  if (re->m_inBarrel) {
925  re->m_ntubesperlayer = int(re->m_Zsize / re->m_tubepitch);
926  re->m_nsteps = 1; // all tubes have the same length
927  re->m_ntubesinastep = re->m_ntubesperlayer;
928  re->m_tubelength[0] = re->m_Ssize;
929  } else {
930  re->m_ntubesperlayer = int(re->m_Rsize / re->m_tubepitch);
931  re->m_nsteps = int(re->m_Rsize / re->m_tubelenStepSize);
932  re->m_ntubesinastep = int(re->m_tubelenStepSize / re->m_tubepitch);
933  re->m_tubelength[0] = re->m_Ssize;
934  double diff = (re->m_LongSsize - re->m_Ssize) * (re->m_LongRsize - re->m_tubepitch / 2.) / re->m_LongRsize;
935  for (int is = 0; is < re->m_nsteps; ++is) {
936  double len = re->m_Ssize + is * diff / re->m_nsteps;
937  re->m_tubelength[is] = len;
938  }
939  }
940 
941  for (int tl = 0; tl < re->m_nlayers; ++tl) {
942  re->m_firstwire_x[tl] = thism->x[tl];
943  re->m_firstwire_y[tl] = thism->y[tl];
944  }
945  }
946 
949  const RpcComponent *cc,
950  const Position &ip) {
951 
952  re->m_Ssize = cc->dx1;
953  re->m_LongSsize = cc->dx2;
954  re->m_Rsize = cc->GetThickness(mysql);
955  re->m_LongRsize = cc->GetThickness(mysql);
956  re->m_Zsize = cc->dy;
957  re->m_LongZsize = cc->dy;
958 
959  re->m_hasDEDontop = true;
960  if (cc->iswap == -1)
961  re->m_hasDEDontop = false;
962 
963  if (ip.isAssigned) {
964  re->setStationS(ip.shift);
965  } else {
966  ATH_MSG_ERROR( " MuonChamber::setRpcReadoutGeom: position not found " );
967  assert(0);
968  }
969 
970  std::string tname = cc->name;
971  re->setTechnologyName(tname);
972  const RPC *thisr = dynamic_cast<const RPC*>(mysql.GetTechnology(tname));
973  re->m_nphigasgaps = thisr->NGasGaps_in_s;
974  re->m_gasgapssize = re->m_Ssize / re->m_nphigasgaps - 2. * thisr->bakeliteframesize;
975  re->m_gasgapzsize = re->m_Zsize - 2. * thisr->bakeliteframesize;
976  re->m_nphistrippanels = thisr->NstripPanels_in_s;
977  re->m_phistrippitch = thisr->stripPitchS;
978  re->m_etastrippitch = thisr->stripPitchZ;
979 
980  if (re->getStationName().find("BI") != std::string::npos) {
981  re->setNumberOfLayers(3); // all BI RPCs always have 3 gas gaps
982 
983  }
984  const RPC* genericRpc = dynamic_cast<const RPC*>(mysql.GetATechnology("RPC0"));
985 
986  if (re->numberOfLayers() == 3) {
987  constexpr double rpc3GapLayerThickness = 11.8; // gas vol. + ( bakelite + graphite + PET )x2
988  for (int gasGap =1 ; gasGap <= re->numberOfLayers(); ++gasGap) {
991  re->m_gasGap_xPos[gasGap -1] = (gasGap - 2) * rpc3GapLayerThickness - 0.74;
992  }
993  } else {
994  re->m_gasGap_xPos[0] = -re->m_Rsize / 2. + thisr->externalSupPanelThickness + genericRpc->stripPanelThickness
995  + genericRpc->GasGapThickness / 2;
996  re->m_gasGap_xPos[1] = re->m_gasGap_xPos[0] + genericRpc->rpcLayerThickness +
997  genericRpc->centralSupPanelThickness;
998  if (!re->m_hasDEDontop) {
999  std::swap(re->m_gasGap_xPos[0], re->m_gasGap_xPos[1]);
1000  }
1001  }
1002 
1003  re->m_phistripwidth = re->m_phistrippitch - genericRpc->stripSeparation;
1004  re->m_etastripwidth = re->m_etastrippitch - genericRpc->stripSeparation;
1005  re->m_nphistripsperpanel = int((re->m_Ssize / re->m_nphistrippanels) / re->m_phistrippitch);
1006  if (re->getStationName().compare(0, 3, "BME") != 0) {
1007  re->m_nphistripsperpanel-=(re->m_nphistripsperpanel % 8) ;
1008  }
1009  re->m_netastripsperpanel = int((re->m_Zsize) / re->m_etastrippitch);
1010  re->m_netastripsperpanel -= (re->m_netastripsperpanel % 8);
1011 
1012  re->m_phipaneldead = re->m_Ssize / re->m_nphistrippanels -
1013  re->m_nphistripsperpanel * re->m_phistrippitch +
1014  genericRpc->stripSeparation;
1015  re->m_phipaneldead = re->m_phipaneldead / 2.;
1016  re->m_etapaneldead = re->m_Zsize - re->m_netastripsperpanel * re->m_etastrippitch + genericRpc->stripSeparation;
1017  re->m_etapaneldead = re->m_etapaneldead / 2.;
1018  re->m_phistriplength = re->m_LongZsize;
1019  re->m_etastriplength = re->m_LongSsize / re->m_nphistrippanels;
1020 
1021  re->m_first_phistrip_s[0] = -re->m_Ssize / 2. + re->m_phipaneldead + re->m_phistripwidth / 2.;
1022  if (re->m_nphistrippanels == 2) {
1023  re->m_first_phistrip_s[1] = re->m_phipaneldead + re->m_phistripwidth / 2.;
1024  }
1025 
1026  double offset = 0.;
1027  re->m_phistrip_z = -re->m_Zsize / 2. + offset + re->m_phistriplength / 2.;
1028 
1029  // first strip position on each eta panel
1030  re->m_first_etastrip_z = -re->m_Zsize / 2. + re->m_etapaneldead + re->m_etastripwidth / 2.;
1031  re->m_etastrip_s[0] = -re->m_Ssize / 2. + offset + re->m_etastriplength / 2.;
1032  if (re->m_nphistrippanels == 2) {
1033  re->m_etastrip_s[1] = re->m_Ssize / 2. - offset - re->m_etastriplength / 2.;
1034  }
1035 
1036  }
1037 
1040  const TgcComponent *cc,
1041  const Position &ip,
1042  const std::string& stName) {
1043 
1044  re->setSsize(cc->dx1);
1045  re->setLongSsize(cc->dx2);
1046  re->setRsize(cc->dy);
1047  re->setLongRsize(cc->dy);
1048  re->setZsize(cc->GetThickness(mysql));
1049  re->setLongZsize(cc->GetThickness(mysql));
1050 
1051 
1052  const TGC *genericTgc = dynamic_cast<const TGC*>(mysql.GetATechnology("TGC0"));
1053  re->setFrameThickness(genericTgc->frame_h,
1054  genericTgc->frame_ab);
1055 
1056 
1057  const std::string &tname = cc->name;
1058  int tname_index = MuonGM::strtoint(tname, 3, 2);
1059  re->setTechnologyName(tname);
1060 
1061  if (ip.isAssigned) {
1062  re->setStationS(ip.shift);
1063  } else {
1064  throw std::runtime_error(" MuonChamberLite::setTgcReadoutGeom position not found ");
1065  }
1066 
1067  char index[2];
1068  sprintf(index, "%i", cc->index);
1069 
1070  re->setReadOutName(stName.substr(0, 4) + '_' + index);
1071  re->setReadOutParams(mysql.GetTgcRPars(tname_index));
1072 
1073  const TGC *thist = dynamic_cast<const TGC*>(mysql.GetTechnology(tname));
1074  const std::size_t ncomp = (thist->materials).size();
1075 
1076  unsigned int gasGap{0};
1077  for (std::size_t i = 0; i < ncomp; ++i) {
1078  double newpos = -re->getZsize() / 2. + thist->positions[i] + thist->tck[i] / 2.;
1079 
1080  if ( thist->materials[i].find("TGCGas") != std::string::npos) {
1081  re->setPlaneZ(newpos, ++gasGap);
1082  }
1083  }
1084  }
1085 
1086  void MuonChamberLite::print() const {
1087  ATH_MSG_INFO("MuonChamberLite " << name << " :" );
1088  }
1089 } // namespace MuonGM
CscIdHelper.h
MuonGM::CbmComponent::lb_width
double lb_width
Definition: CbmComponent.h:16
MuonGM::CbmComponent::hole_pos1
double hole_pos1
Definition: CbmComponent.h:17
MuonGM::Station::hasMdts
bool hasMdts() const
Definition: Station.h:88
MuonIdHelper::stationNameIndex
int stationNameIndex(const std::string &name) const
Definition: MuonIdHelper.cxx:842
beamspotman.r
def r
Definition: beamspotman.py:676
MuonGM::RPC::bakeliteframesize
double bakeliteframesize
Definition: RPC_Technology.h:47
MuonGM::MYSQL::GetTechnology
Technology * GetTechnology(const std::string &name)
Definition: MYSQL.cxx:105
MdtReadoutElement.h
MuonGM::TGC::materials
std::vector< std::string > materials
Definition: TGC_Technology.h:20
MuonGM::StandardComponent::index
int index
Definition: StandardComponent.h:27
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
MuonGM::DetectorElement::name
std::string name
Definition: DetectorElement.h:17
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
MuonGM::MuonChamberLite::m_station
Station * m_station
Definition: MuonChamberLite.h:59
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MuonGM::TgcComponent
Definition: TgcComponent.h:14
MuonGM::CSC::phireadoutpitch
double phireadoutpitch
Definition: CSC_Technology.h:38
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CscComponent.h
MuonGM::Station::GetExtraBottomThickness
double GetExtraBottomThickness() const
Definition: Station.cxx:155
MuonGM::MuonChamberLite::print
virtual void print() const override
Definition: MuonChamberLite.cxx:1086
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MuonGM::CbmComponent
Definition: CbmComponent.h:12
MuonGM::MYSQL::allocPosFindSubtype
int allocPosFindSubtype(const std::string &statType, int fi, int zi) const
Definition: MYSQL.cxx:196
RPCON
#define RPCON
Definition: MuonChamberLite.cxx:59
MuonGM::TGC::frame_ab
double frame_ab
Definition: TGC_Technology.h:19
MuonGM::MuonChamberLite::longWidth
double longWidth
Definition: MuonChamberLite.h:37
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
TgcIdHelper
Definition: TgcIdHelper.h:50
MuonGM::Station::getAmdbOrigine_along_thickness
double getAmdbOrigine_along_thickness(const MYSQL &mysql) const
Definition: Station.cxx:558
MuonGM::StandardComponent::GetThickness
double GetThickness(const MYSQL &mysql) const
Definition: StandardComponent.cxx:27
index
Definition: index.py:1
hist_file_dump.d
d
Definition: hist_file_dump.py:137
MuonGM::TGC::tck
std::vector< double > tck
Definition: TGC_Technology.h:22
Rpc.h
Spacer.h
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
MuonGM::Cutout::dx
double dx
Definition: Cutout.h:23
MuonGM::Station
Definition: Station.h:40
MuonGM::MuonChamberLite::width
double width
Definition: MuonChamberLite.h:34
MuonGM::MuonStation::setBlineFixedPointInAmdbLRS
void setBlineFixedPointInAmdbLRS(double s0, double z0, double t0)
Definition: MuonStation.cxx:65
createCablingJSON.doubletR
int doubletR
Definition: createCablingJSON.py:10
MuonGM::MDT::tubeEndPlugLength
double tubeEndPlugLength
Definition: MDT_Technology.h:22
MuonGM::RPC::stripPitchS
double stripPitchS
Definition: RPC_Technology.h:64
deg
#define deg
Definition: SbPolyhedron.cxx:17
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
MuonGM::MDT::numOfLayers
int numOfLayers
Definition: MDT_Technology.h:17
MuonGM::MuonChamberLite::m_keySet
std::set< std::string > * m_keySet
Definition: MuonChamberLite.h:63
MuonGM::MYSQL
Definition: MYSQL.h:43
MuonGM::CscComponent
Definition: CscComponent.h:11
MuonGM::RPC::NGasGaps_in_s
int NGasGaps_in_s
Definition: RPC_Technology.h:43
MuonGM::RpcReadoutElement
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h:55
Csc.h
MuonGM::MDT::tubeWallThickness
double tubeWallThickness
Definition: MDT_Technology.h:23
MuonGM::MuonStation::updateBlineFixedPointInAmdbLRS
void updateBlineFixedPointInAmdbLRS()
Definition: MuonStation.cxx:86
MuonGM::CscReadoutElement
Definition: CscReadoutElement.h:56
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonGM::MYSQL::allocPosFindCutout
int allocPosFindCutout(const std::string &statType, int fi, int zi) const
Definition: MYSQL.cxx:201
RpcIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
Definition: RpcIdHelper.cxx:939
MuonGM::LBI
Definition: LBI_Technology.h:13
MuonGM::MYSQL::GetStationPosition
Position GetStationPosition(const std::string &nameType, int fi, int zi) const
Definition: MYSQL.cxx:71
MuonGM::CSC::roxacellwith
double roxacellwith
Definition: CSC_Technology.h:29
RpcIdHelper
Definition: RpcIdHelper.h:51
MuonGM::DetectorElement
Definition: DetectorElement.h:15
MuonGM::StandardComponent
Definition: StandardComponent.h:15
RpcIdHelper.h
MuonGM::CbmComponent::lb_height
double lb_height
Definition: CbmComponent.h:15
Ded.h
Station.h
MuonGM::CSC
Definition: CSC_Technology.h:13
MuonGM::CSC::anocathodist
double anocathodist
Definition: CSC_Technology.h:23
MuonGM::CSC::nEtastrips
int nEtastrips
Definition: CSC_Technology.h:39
MuonGM::RPC::GasGapThickness
double GasGapThickness
Definition: RPC_Technology.h:45
MuonGM::MDT
Definition: MDT_Technology.h:15
MuonGM::MuonChamberLite::setCscReadoutGeom
void setCscReadoutGeom(const MYSQL &mysql, CscReadoutElement *re, const CscComponent *cc, const Position &p)
Definition: MuonChamberLite.cxx:851
TgcComponent.h
MuonGM::TGC::frame_h
double frame_h
Definition: TGC_Technology.h:18
MuonGM::MuonChamberLite::setRpcReadoutGeom
void setRpcReadoutGeom(const MYSQL &mysql, RpcReadoutElement *re, const RpcComponent *cc, const Position &p)
Definition: MuonChamberLite.cxx:947
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
GeoPrimitives.h
MuonGM::MdtComponent
Definition: MdtComponent.h:12
MuonGM::Component::dy
double dy
Definition: Component.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:88
useAssemblies
#define useAssemblies
Definition: MuonChamberLite.cxx:60
MuonGM::MuonChamberLite::addReadoutLayers
GeoVPhysVol * addReadoutLayers(const MYSQL &mysql, MuonDetectorManager *manager, int ieta, int iphi, bool is_mirrored, bool &isAssembly)
Definition: MuonChamberLite.cxx:105
MuonGM::Position
Definition: Position.h:11
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
StandardComponent.h
CbmComponent.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonGM::LbiComponent
Definition: LbiComponent.h:12
TGC
Definition: TgcBase.h:6
MuonGM::CbmComponent::hole_pos2
double hole_pos2
Definition: CbmComponent.h:18
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonGM::MDT::y
std::array< double, 4 > y
Definition: MDT_Technology.h:25
MuonGM::RpcComponent
Definition: RpcComponent.h:12
Cutout.h
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
RPC_Technology.h
MuonGM::MuonStation
Definition: MuonStation.h:51
MuonGM::Station::getAmdbOrigine_along_length
double getAmdbOrigine_along_length() const
Definition: Station.cxx:553
CscReadoutElement.h
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
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
MuonGM::Cutout::dy
double dy
Definition: Cutout.h:24
MdtIdHelper
Definition: MdtIdHelper.h:61
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
MdtIdHelper.h
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
MuonGM::Station::GetExtraTopThickness
double GetExtraTopThickness() const
Definition: Station.cxx:151
SpacerBeam.h
MuonGM::CSC::cathreadoutpitch
double cathreadoutpitch
Definition: CSC_Technology.h:37
MuonGM::RPC::centralSupPanelThickness
double centralSupPanelThickness
Definition: RPC_Technology.h:28
MuonGM::MDT::innerRadius
double innerRadius
Definition: MDT_Technology.h:19
CSC_Technology.h
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
LBI_Technology.h
MYSQL.h
MuonGM::StandardComponent::posy
double posy
Definition: StandardComponent.h:20
MuonGM::TGC::positions
std::vector< double > positions
Definition: TGC_Technology.h:21
CscIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
Definition: CscIdHelper.cxx:706
MuonGM::MuonChamberLite::length
double length
Definition: MuonChamberLite.h:35
MdtIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Definition: MdtIdHelper.cxx:659
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
MuonGM::MuonChamberLite::thickness
double thickness
Definition: MuonChamberLite.h:36
MuonGM::CSC::numOfLayers
int numOfLayers
Definition: CSC_Technology.h:16
LbiComponent.h
MuonGM::MDT::x
std::array< double, 4 > x
Definition: MDT_Technology.h:26
MuonGM::MuonStation::setPhysVol
void setPhysVol(const PVLink &vol)
Definition: MuonStation.cxx:380
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonDetectorManager.h
MuonGM::MuonStation::addMuonReadoutElementWithAlTransf
void addMuonReadoutElementWithAlTransf(MuonReadoutElement *a, GeoAlignableTransform *ptrsf, int jobIndex)
Definition: MuonStation.cxx:178
MDT_Technology.h
MuonGM::RPC::stripPitchZ
double stripPitchZ
Definition: RPC_Technology.h:65
MuonGM::Station::GetNrOfCutouts
int GetNrOfCutouts() const
Definition: Station.cxx:324
MuonGM::strtoint
int strtoint(std::string_view str, unsigned int istart, unsigned int length)
Definition: GlobalUtilities.cxx:37
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
Position.h
MuonGM::RPC::externalSupPanelThickness
double externalSupPanelThickness
Definition: RPC_Technology.h:19
Mdt.h
MuonChamberLite.h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
MuonGM::Station::GetNrOfComponents
int GetNrOfComponents() const
Definition: Station.cxx:322
MuonGM::RPC::rpcLayerThickness
double rpcLayerThickness
Definition: RPC_Technology.h:34
CscIdHelper
Definition: CscIdHelper.h:52
MuonGM::MuonChamberLite::setMdtReadoutGeom
void setMdtReadoutGeom(const MYSQL &mysql, MdtReadoutElement *re, const MdtComponent *cc, const Position &p)
Definition: MuonChamberLite.cxx:887
MuonGM::RPC::stripPanelThickness
double stripPanelThickness
Definition: RPC_Technology.h:67
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
re
const boost::regex re(r_e)
MuonGM::MYSQL::GetATechnology
const Technology * GetATechnology(const std::string &name) const
Definition: MYSQL.cxx:162
MuonGM::RPC
Definition: RPC_Technology.h:14
MuonGM::stationPhiTGC
int stationPhiTGC(std::string_view stName, int fi, int zi_input)
Converts the AMDB phi index to the Identifier phi Index.
Definition: GlobalUtilities.cxx:44
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
MuonGM::Cutout::lengthY
double lengthY
Definition: Cutout.h:27
checkFileSG.fi
fi
Definition: checkFileSG.py:65
MuonGM::Station::GetCutout
Cutout * GetCutout(int i) const
Definition: Station.cxx:85
MuonGM::MYSQL::GetTgcRPars
GeoModel::TransientConstSharedPtr< TgcReadoutParams > GetTgcRPars(const std::string &name) const
Definition: MYSQL.cxx:88
createCablingJSON.doubletPhi
int doubletPhi
Definition: createCablingJSON.py:11
TgcIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
Definition: TgcIdHelper.cxx:583
TgcReadoutElement.h
TgcIdHelper.h
MuonGM::RPC::NstripPanels_in_s
int NstripPanels_in_s
Definition: RPC_Technology.h:60
python.Logging.manager
manager
Definition: PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/Logging.py:92
RpcComponent.h
dqt_zlumi_alleff_HIST.tl
tl
Definition: dqt_zlumi_alleff_HIST.py:73
TGC_Technology.h
MdtComponent.h
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
rp
ReadCards * rp
Definition: IReadCards.cxx:26
MuonGM::MDT::pitch
double pitch
Definition: MDT_Technology.h:18
MuonGM::MuonStation::getBlineFixedPointInAmdbLRS
const Amg::Vector3D & getBlineFixedPointInAmdbLRS() const
Definition: MuonStation.cxx:81
MuonStation.h
MuonGM::Cutout
Definition: Cutout.h:14
MuonGM::buildString
std::string buildString(int i, int ncha)
Definition: GlobalUtilities.cxx:23
MuonGM::Station::GetComponent
Component * GetComponent(int i) const
Definition: Station.cxx:83
MuonGM::Station::GetName
const std::string & GetName() const
Definition: Station.cxx:110
MuonGM::Station::mdtHalfPitch
double mdtHalfPitch(const MYSQL &mysql) const
Definition: Station.cxx:343
MuonGM::RPC::stripSeparation
double stripSeparation
Definition: RPC_Technology.h:66
python.compressB64.c
def c
Definition: compressB64.py:93
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
MuonGM::LbiComponent::associated_CMIsubtype
std::string associated_CMIsubtype
Definition: LbiComponent.h:14
SupComponent.h
calibdata.tube
tube
Definition: calibdata.py:31
Tgc.h
MuonGM::MuonStation::setxAmdbCRO
void setxAmdbCRO(double xpos)
Definition: MuonStation.cxx:52
python.handimod.cc
int cc
Definition: handimod.py:523
MuonGM::MuonChamberLite::MuonChamberLite
MuonChamberLite(const MYSQL &mysql, Station *s, std::map< std::string, GeoFullPhysVol * > *mapFPV, std::map< std::string, GeoAlignableTransform * > *mapAXF)
Definition: MuonChamberLite.cxx:83
MuonGM::CSC::nPhistrips
int nPhistrips
Definition: CSC_Technology.h:40
MuonGM::MuonChamberLite::setTgcReadoutGeom
void setTgcReadoutGeom(const MYSQL &mysql, TgcReadoutElement *re, const TgcComponent *cc, const Position &p, const std::string &statname)
Definition: MuonChamberLite.cxx:1038
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
MuonGM::StandardComponent::posz
double posz
Definition: StandardComponent.h:21
RpcReadoutElement.h
Identifier
Definition: IdentifierFieldParser.cxx:14