ATLAS Offline Software
TRTDetectorFactory_Full.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
15 
16 #include "InDetIdentifier/TRT_ID.h"
17 
18 #include "ArrayFunction.h"
19 
23 
24 #include "GeoModelKernel/GeoTube.h"
25 #include "GeoModelKernel/GeoTrd.h"
26 #include "GeoModelKernel/GeoLogVol.h"
27 #include "GeoModelKernel/GeoNameTag.h"
28 #include "GeoModelKernel/GeoPhysVol.h"
29 #include "GeoModelKernel/GeoFullPhysVol.h"
30 #include "GeoModelKernel/GeoTransform.h"
31 #include "GeoModelKernel/GeoAlignableTransform.h"
32 #include "GeoModelKernel/GeoSerialDenominator.h"
33 #include "GeoModelKernel/GeoSerialTransformer.h"
34 #include "GeoModelKernel/GeoShapeShift.h"
35 #include "GeoModelKernel/GeoShapeUnion.h"
36 #include "GeoModelKernel/GeoIdentifierTag.h"
37 #include "GeoModelKernel/GeoSerialIdentifier.h"
38 #include "GeoModelKernel/GeoMaterial.h"
39 #include "GeoModelKernel/GeoDefinitions.h"
40 #include "GeoModelKernel/Units.h"
41 
42 #include "GeoGenericFunctions/AbsFunction.h"
43 #include "GeoGenericFunctions/Variable.h"
44 #include "GeoGenericFunctions/Sin.h"
45 #include "GeoGenericFunctions/Cos.h"
46 
47 #include "StoreGate/StoreGateSvc.h"
48 
49 #include <vector>
50 #include <sstream>
51 #include <cmath>
52 
53 //TK: get rid of these and use GeoGenfun:: and GeoXF:: instead
54 using namespace GeoGenfun;
55 using namespace GeoXF;
56 
57 // Helper functions. Temporarily here (hopefully)
58 inline void rotate(double angler, GeoTrf::Vector2D& vector)
59 {
60  double s1 = std::sin(angler);
61  double c = std::cos(angler);
62  double xx = vector.x();
63  double yy = vector.y();
64  vector.x() = c*xx - s1*yy;
65  vector.y() = s1*xx + c*yy;
66 }
67 
68 inline double angle(const GeoTrf::Vector2D& a, const GeoTrf::Vector2D& b)
69 {
70  double ptot2 = a.mag2()*b.mag2();
71  return ptot2 <= 0.0 ? 0.0 : std::acos(a.dot(b)/std::sqrt(ptot2));
72 }
73 
74 inline double magn(GeoTrf::Vector2D& vector)
75 {
76  return std::sqrt(vector.x()*vector.x() + vector.y()*vector.y());
77 }
79 //
81  const ITRT_StrawStatusSummaryTool* sumTool, // added for Argon
82  bool useOldActiveGasMixture,
83  bool DC2CompatibleBarrelCoordinates,
84  bool alignable,
85  bool doArgon,
86  bool doKrypton,
87  bool useDynamicAlignmentFolders)
88  : InDetDD::DetectorFactoryBase(athenaComps),
89  m_useOldActiveGasMixture(useOldActiveGasMixture),
90  m_DC2CompatibleBarrelCoordinates(DC2CompatibleBarrelCoordinates),
91  m_alignable(alignable),
92  m_sumTool(sumTool),
93  m_strawsvcavailable(0),
94  m_doArgon(doArgon),
95  m_doKrypton(doKrypton),
96  m_useDynamicAlignFolders(useDynamicAlignmentFolders)
97 {
98 }
100 
101 
103 //
104 // The method that actually returns the TRT_DetectorManager, which was created
105 // and filled by the create() method
106 //
108 {
109  //TK: Maybe check that m_detectorManager!=0 ?
110  return m_detectorManager;
111 }
113 
114 
115 
117 //
118 // This is where the actual building of the geometry is performed.
119 //
120 // The purpose of this is to create a new TRT_DetectorManager and fill it with
121 // all the information relevant for detector description.
122 //
123 // The TRT_DetectorManager itself, along with helper classes, descriptors, etc.
124 // is located in InDetDetDescr/InDetReadoutGeometry.
125 //
126 void TRTDetectorFactory_Full::create(GeoPhysVol *world)
127 {
128  // Create a new detectormanager.
130 
131  //---------------------- Initialize the parameter interface ------------------------//
132 
133  ATH_MSG_DEBUG( " Getting primary numbers from the Detector Description Database " );
135  m_data.reset(parameterInterface);
136 
137  //---------------------- Initialize the InnerDetector material manager ------------------------//
138 
139  m_materialManager = std::make_unique<InDetMaterialManager>("TRT_MaterialManager", getAthenaComps());
140  m_materialManager->addScalingTable(parameterInterface->scalingTable());
141 
142  //---------------------- Check if the folder TRT/Cond/StatusHT is in place ------------------------//
143  m_strawsvcavailable = false;
144  if (m_doArgon || m_doKrypton){
145  m_strawsvcavailable = detStore()->contains<TRTCond::StrawStatusMultChanContainer>("/TRT/Cond/StatusHT") &&
146  m_sumTool->getStrawStatusHTContainer() != nullptr;
147  }
148  // --------------------- In a normal reconstruction or digitization job, the folder will not be available at this point. No reason for warnings here.
149  ATH_MSG_INFO( "The folder of /TRT/Cond/StatusHT is available? " << m_strawsvcavailable) ;
150  if (!m_strawsvcavailable) ATH_MSG_DEBUG("The folder of /TRT/Cond/StatusHT is NOT available, WHOLE TRT RUNNING XENON" );
151  if (!m_doArgon ) ATH_MSG_DEBUG("Tool setup will force to NOT to use ARGON. Ignore this warning if you are running RECONSTRUCTION or DIGI, but cross-check if you are running SIMULATION");
152  if (!m_doKrypton) ATH_MSG_DEBUG( "Tool setup will force to NOT to use KRYPTON. Ignore this warning if you are running RECONSTRUCTION or DIGI, but cross-check if you are running SIMULATION");
153 
154 
155  //---------------------- Initialize ID Helper ------------------------------------//
156 
157  // Initialize the ID helper:
158 // bool idHelperInitialized=false;
159 
160  const TRT_ID *idHelper = nullptr;
161 
162  if (detStore()->retrieve(idHelper, "TRT_ID").isFailure()) {
163  ATH_MSG_ERROR( "Could not retrieve TRT ID Helper");
164  }
165 
166  m_detectorManager->setIdHelper(idHelper,false);
167 
168  //---------------------- Set and Print Version Information ------------------------------------//
169 
170  //Set active gas type information.
173 
174  // Set Version information
175  // Some of these get overwritten for new configurations.
176  std::string versionTag = m_data->versionTag;
177  std::string versionName = "DC2";
178  std::string layout = "Final";
179  std::string description = "DC2 Geometry";
180  int versionMajorNumber = 2;
181  int versionMinorNumber = 1;
182  int versionPatchNumber = 0;
183 
184  if (m_data->initialLayout) layout = "Initial";
185  //In principle we dont need to let the minor number reflect the
186  //gastype anymore, but it doesn't hurt:
187  if (m_useOldActiveGasMixture) versionMinorNumber = 0;
189  versionMajorNumber = 3;
190  versionName = "Rome";
191  description = "Geometry for Rome 2005";
192  }
193 
194  if (m_data->isCosmicRun) {
195  layout = "SR1";
196  description = "Geometry for SR1";
197  }
198 
199 
200  // If new configuration we get the version information from the database.
201  // The version numbers can be incremented as one sees fit.
202  // In principle they should be changed whenever there are any code changes.
203  if (!m_data->oldConfiguration) {
204  versionName = m_data->versionName;
205  layout = m_data->layout;
206  description = m_data->versionDescription;
207  versionMajorNumber = 4;
208  versionMinorNumber = 1;
209  versionPatchNumber = 1;
210  }
211 
212  InDetDD::Version version(versionTag,
213  versionName,
214  layout,
215  description,
216  versionMajorNumber,
217  versionMinorNumber,
218  versionPatchNumber);
219 
221 
222 
223  // Print version information.
224  ATH_MSG_INFO( "In TRT Detector Factory (For DC2 and later geometries)" );
225  ATH_MSG_INFO( " " << version.fullDescription() );
226 
227 
228  //---------- Set flags for which parts of the detector are built -----------//
229 
230  std::string barrelLabel = "Barrel";
231  std::string endcapA_WheelAB_Label = "EndcapA_WheelAB";
232  std::string endcapC_WheelAB_Label = "EndcapC_WheelAB";
233  std::string endcapA_WheelC_Label = "EndcapA_WheelC";
234  std::string endcapC_WheelC_Label = "EndcapC_WheelC";
235 
236  // Check if old naming scheme (which was a bit confusing with endcap C label)
237  if (m_data->partPresent("EndcapAB_Plus")) {
238  barrelLabel = "Barrel";
239  endcapA_WheelAB_Label = "EndcapAB_Plus";
240  endcapC_WheelAB_Label = "EndcapAB_Minus";
241  endcapA_WheelC_Label = "EndcapC_Plus";
242  endcapC_WheelC_Label = "EndcapC_Minus";
243  }
244 
245 
246  bool barrelPresent = m_data->partPresent(barrelLabel);
247  bool endcapABPlusPresent = m_data->partPresent(endcapA_WheelAB_Label);
248  bool endcapABMinusPresent = m_data->partPresent(endcapC_WheelAB_Label);
249  bool endcapCPlusPresent = m_data->partPresent(endcapA_WheelC_Label);
250  bool endcapCMinusPresent = m_data->partPresent(endcapC_WheelC_Label);
251  // Overall transform (probably will always be identifty - but just in case)
252  GeoTrf::Transform3D trtTransform = m_data->partTransform("TRT");
253 
254  // For old configurations we need to set which parts are present.
255  //
256  if (m_data->oldConfiguration) {
257  if (m_data->isCosmicRun) {
258  endcapABPlusPresent = false;
259  endcapABMinusPresent = false;
260  endcapCPlusPresent = false;
261  endcapCMinusPresent = false;
262  }
263  if (m_data->initialLayout) {
264  endcapCPlusPresent = false;
265  endcapCMinusPresent = false;
266  }
267  }
268 
269 
270  //---------- Alignmnent and Conditions -----------//
271 
272 
273  // Register the channels for alignment constants
274  // and the level corresponding to the channel.
275  // Not the levels are an internal definition . They are not the same as
276  // the usual alignment levels
277  const int AlignmentLevelSubWheel = 1; // Level 2 in endcap. Not used in barrel
278  const int AlignmentLevelModule = 2; // Level 2 in barrel. Deprecated (wheel level) in endcap.
279  const int AlignmentLevelTop = 3; // Level 1
280 
281  if (m_alignable) {
282 
285  m_detectorManager->addFolder("/TRT/Align");
286  m_detectorManager->addChannel("/TRT/Align/TRT", AlignmentLevelTop, InDetDD::global);
287 
288  if (barrelPresent) {
289  m_detectorManager->addChannel("/TRT/Align/B0", AlignmentLevelModule, InDetDD::global);
290  m_detectorManager->addChannel("/TRT/Align/B1", AlignmentLevelModule, InDetDD::global);
291  m_detectorManager->addChannel("/TRT/Align/B2", AlignmentLevelModule, InDetDD::global);
292  }
293  if (endcapABPlusPresent) { // EndcapA
294  m_detectorManager->addChannel("/TRT/Align/L2A", AlignmentLevelSubWheel, InDetDD::global);
295  }
296  if (endcapABMinusPresent) {// EndcapC
297  m_detectorManager->addChannel("/TRT/Align/L2C", AlignmentLevelSubWheel, InDetDD::global);
298  }
299  }
300 
301  else {
303 
304  m_detectorManager->addGlobalFolder("/TRT/AlignL1/TRT");
305  m_detectorManager->addChannel("/TRT/AlignL1/TRT", AlignmentLevelTop, InDetDD::global);
306  m_detectorManager->addFolder("/TRT/AlignL2");
307 
308  if (barrelPresent) {
309  m_detectorManager->addChannel("/TRT/AlignL2/B0", AlignmentLevelModule, InDetDD::global);
310  m_detectorManager->addChannel("/TRT/AlignL2/B1", AlignmentLevelModule, InDetDD::global);
311  m_detectorManager->addChannel("/TRT/AlignL2/B2", AlignmentLevelModule, InDetDD::global);
312  }
313 
314  if (endcapABPlusPresent) { // EndcapA
315  m_detectorManager->addChannel("/TRT/AlignL2/L2A", AlignmentLevelSubWheel, InDetDD::global);
316  }
317  if (endcapABMinusPresent) {// EndcapC
318  m_detectorManager->addChannel("/TRT/AlignL2/L2C", AlignmentLevelSubWheel, InDetDD::global);
319  }
320  }
321 
322  // Unchanged in Run1 and new Run2 schema
323  m_detectorManager->addSpecialFolder("/TRT/Calib/DX");
324  }
325 
326 
327 
328  //Uncomment for testing:
329  // m_data->ShowValues();
330 
331  //----------------------Initialize the numerology------------------------//
332 
333  for (unsigned int m=0;m<m_data->nBarrelRings;m++) {
334  m_detectorManager->getNumerology()->setNBarrelLayers(m, m_data->barrelNumberOfStrawLayersInModule[m]);
335  }
336 
338  //Note: This next line is now consistent with TRT_TestBeamDetDescr.
339  m_detectorManager->getNumerology()->setNBarrelPhi(m_data->nBarrelModulesUsed);
340 
341  unsigned int nEndcapWheels = 0;
342  if (endcapABPlusPresent||endcapABMinusPresent) nEndcapWheels += m_data->endcapNumberOfAWheels + m_data->endcapNumberOfBWheels;
343  if (endcapCPlusPresent||endcapCMinusPresent) nEndcapWheels += m_data->endcapNumberOfCWheels;
344 
347 
348  for (unsigned int w=0;w<m_detectorManager->getNumerology()->getNEndcapWheels();w++) {
349  unsigned int nlayers;
350  if ( w < m_data->endcapNumberOfAWheels )
351  nlayers = m_data->endCapNumberOfStrawLayersPerWheelA;
352  else if ( w < ( m_data->endcapNumberOfAWheels + m_data->endcapNumberOfBWheels ) )
353  nlayers = m_data->endCapNumberOfStrawLayersPerWheelB;
354  else
355  nlayers = m_data->endCapNumberOfStrawLayersPerWheelC;
357  }
358 
359  //---------------------- Top level volumes ------------------------//
360 
361  GeoNodePtr<GeoNameTag> topLevelNameTag(new GeoNameTag("TRT"));
362  // The top level volumes
363  GeoFullPhysVol *pBarrelVol = nullptr;
364  GeoFullPhysVol *pEndCapABPlus = nullptr;
365  GeoFullPhysVol *pEndCapCPlus = nullptr;
366  GeoFullPhysVol *pEndCapABMinus = nullptr;
367  GeoFullPhysVol *pEndCapCMinus = nullptr;
368 
369 
370 
371  //
372  // Barrel volume:
373  //
374 
375  if (barrelPresent) {
376  GeoTube* sBarrelVol = new GeoTube( m_data->virtualBarrelInnerRadius,
377  m_data->virtualBarrelOuterRadius,
378  m_data->virtualBarrelVolumeLength );
379 
380 
381  GeoLogVol *lBarrelVol = new GeoLogVol("TRTBarrel", sBarrelVol, m_materialManager->getMaterial("trt::CO2"));
382  pBarrelVol = new GeoFullPhysVol(lBarrelVol);
383 
384  ATH_MSG_DEBUG( "Virtual TRT Barrel volume defined by RMin = "<<m_data->virtualBarrelInnerRadius
385  <<", Rmax = "<<m_data->virtualBarrelOuterRadius<<" Zmax = "<<m_data->virtualBarrelVolumeLength );
386 
387  // Common Endcap volumes (one for forward, one for backward):
388  //GeoPhysVol *pCommonEndcapVolume[2];
389 
390  GeoAlignableTransform * barrelTransform =
391  new GeoAlignableTransform(trtTransform * m_data->partTransform(barrelLabel));
392 
393  world->add(topLevelNameTag);
394  world->add(barrelTransform);
395  world->add(pBarrelVol);
396  m_detectorManager->addTreeTop(pBarrelVol);
397  // Use barrel_ec_id = -1 (+ve and -ve barrel is treated as one alignable object)
398  Identifier id = idHelper->barrel_ec_id(-1);
399  m_detectorManager->addAlignableTransform(AlignmentLevelTop, id, barrelTransform, pBarrelVol); // global if other selected
400 
401  }
402 
403  //
404  // End-cap volume AB:
405  //
406  GeoLogVol * lEndCapVolumeAB = nullptr;
407  if (endcapABPlusPresent || endcapABMinusPresent) {
408  GeoTube * sEndCapVolumeAB_unshifted = new GeoTube (m_data->innerRadiusOfEndCapVolumeAB,
409  m_data->outerRadiusOfEndCapVolumeAB,
410  m_data->lengthOfEndCapVolumeAB/2.);
411  const GeoShape & sEndCapVolumeAB
412  = ( *sEndCapVolumeAB_unshifted << GeoTrf::TranslateZ3D(m_data->positionOfEndCapVolumeAB));
413 
414  lEndCapVolumeAB = new GeoLogVol("TRTEndcapWheelAB", &sEndCapVolumeAB, m_materialManager->getMaterial("trt::CO2"));
415  }
416 
417  if (endcapABPlusPresent) {
418  pEndCapABPlus = new GeoFullPhysVol(lEndCapVolumeAB);
419 
420  GeoAlignableTransform * transform =
421  new GeoAlignableTransform(trtTransform * m_data->partTransform(endcapA_WheelAB_Label));
422 
423  world->add(topLevelNameTag);
424  world->add(transform);
425  world->add(new GeoIdentifierTag(0));
426  world->add(pEndCapABPlus);
427  m_detectorManager->addTreeTop(pEndCapABPlus);
428  Identifier id = idHelper->barrel_ec_id(2);
429  m_detectorManager->addAlignableTransform(AlignmentLevelTop, id, transform, pEndCapABPlus); // global if other selected
430  }
431 
432  if (endcapABMinusPresent) {
433  pEndCapABMinus = new GeoFullPhysVol(lEndCapVolumeAB);
434 
435  GeoAlignableTransform * transform =
436  new GeoAlignableTransform(trtTransform * m_data->partTransform(endcapC_WheelAB_Label) * GeoTrf::RotateY3D(180*GeoModelKernelUnits::deg));
437 
438  world->add(topLevelNameTag);
439  world->add(transform);
440  world->add(new GeoIdentifierTag(1));
441  world->add(pEndCapABMinus);
442  m_detectorManager->addTreeTop(pEndCapABMinus);
443  Identifier id = idHelper->barrel_ec_id(-2);
444  m_detectorManager->addAlignableTransform(AlignmentLevelTop, id, transform, pEndCapABMinus); // global if other selected
445  }
446 
447  //
448  // End-cap volume C:
449  //
450  GeoLogVol * lEndCapVolumeC = nullptr;
451  if (endcapCPlusPresent || endcapCMinusPresent) {
452  GeoTube * sEndCapVolumeC_unshifted = new GeoTube (m_data->innerRadiusOfEndCapVolumeC,
453  m_data->outerRadiusOfEndCapVolumeC,
454  m_data->lengthOfEndCapVolumeC/2.);
455  const GeoShape & sEndCapVolumeC
456  = ( *sEndCapVolumeC_unshifted << GeoTrf::TranslateZ3D(m_data->positionOfEndCapVolumeC));
457 
458  lEndCapVolumeC = new GeoLogVol("TRTEndcapWheelC", &sEndCapVolumeC, m_materialManager->getMaterial("trt::CO2"));
459  }
460 
461  if (endcapCPlusPresent) {
462  pEndCapCPlus = new GeoFullPhysVol(lEndCapVolumeC);
463 
464  GeoAlignableTransform * transform =
465  new GeoAlignableTransform(trtTransform * m_data->partTransform(endcapA_WheelC_Label));
466 
467  world->add(topLevelNameTag);
468  world->add(transform);
469  world->add(new GeoIdentifierTag(0));
470  world->add(pEndCapCPlus);
471  m_detectorManager->addTreeTop(pEndCapCPlus);
472  }
473 
474  if (endcapCMinusPresent) {
475  pEndCapCMinus = new GeoFullPhysVol(lEndCapVolumeC);
476 
477  GeoAlignableTransform * transform =
478  new GeoAlignableTransform(trtTransform * m_data->partTransform(endcapC_WheelC_Label) * GeoTrf::RotateY3D(180*GeoModelKernelUnits::deg));
479 
480  world->add(topLevelNameTag);
481  world->add(transform);
482  world->add(new GeoIdentifierTag(0));
483  world->add(pEndCapCMinus);
484  m_detectorManager->addTreeTop(pEndCapCMinus);
485  }
486 
487  // Pointers to the Endcap volumes (index 0: for forward, index 1: for backward):
488  GeoFullPhysVol *pCommonEndcapAB[2];
489  GeoFullPhysVol *pCommonEndcapC[2];
490 
491  pCommonEndcapAB[0] = pEndCapABPlus;
492  pCommonEndcapAB[1] = pEndCapABMinus;
493  pCommonEndcapC[0] = pEndCapCPlus;
494  pCommonEndcapC[1] = pEndCapCMinus;
495 
496 
497  //-----------------------------------------------------------------------//
498  // //
499  // Extra Material //
500  // //
501  //-----------------------------------------------------------------------//
502  if (pBarrelVol) {
503  InDetDD::ExtraMaterial xMat(m_data->distortedMatManager());
504  xMat.add(pBarrelVol, "TRTBarrel");
505  }
506  if (pEndCapABPlus) {
507  InDetDD::ExtraMaterial xMat(m_data->distortedMatManager());
508  xMat.add(pEndCapABPlus, "TRTEndcap");
509  xMat.add(pEndCapABPlus, "TRTEndcapA");
510  }
511  if (pEndCapABMinus) {
512  InDetDD::ExtraMaterial xMat(m_data->distortedMatManager());
513  xMat.add(pEndCapABMinus, "TRTEndcap");
514  xMat.add(pEndCapABMinus, "TRTEndcapC");
515  }
516 
517  // Just for completeness
518  if (pEndCapCPlus) {
519  InDetDD::ExtraMaterial xMat(m_data->distortedMatManager());
520  xMat.add(pEndCapCPlus, "TRTEndcap_WheelC");
521  xMat.add(pEndCapCPlus, "TRTEndcapA_WheelC");
522  }
523  if (pEndCapCMinus) {
524  InDetDD::ExtraMaterial xMat(m_data->distortedMatManager());
525  xMat.add(pEndCapCMinus, "TRTEndcap_WheelC");
526  xMat.add(pEndCapCMinus, "TRTEndcapC_WheelC");
527  }
528 
529 
530 
531  //-----------------------------------------------------------------------//
532  // //
533  // Barrel //
534  // //
535  //-----------------------------------------------------------------------//
536 
537 
538  if (pBarrelVol) {
539  //-----------------------------------------------------------------------//
540  // //
541  // Barrel Outer and Inner Supports //
542  // //
543  //-----------------------------------------------------------------------//
544  // Barrel inner support:
545  GeoTube *sBarrelInnerSupport = new GeoTube(m_data->innerRadiusOfBarrelVolume,
546  m_data->innerRadiusOfBarrelVolume + m_data->thicknessOfBarrelInnerSupport,
547  m_data->lengthOfBarrelVolume/2);
548 
549  //ugly, but necessary check due to changes in database.
550  GeoLogVol *lBarrelInnerSupport = new GeoLogVol("BarrelInnerSupport", sBarrelInnerSupport,
551  m_materialManager->getMaterial("trt::BarrelInnerSupport") ?
552  m_materialManager->getMaterial("trt::BarrelInnerSupport") :
553  m_materialManager->getMaterial("trt::BarrelSupport") );
554 
555 
556  GeoPhysVol *pBarrelInnerSupport = new GeoPhysVol(lBarrelInnerSupport);
557  pBarrelVol->add(pBarrelInnerSupport);
558 
559  // Barrel outer support:
560  GeoTube *sBarrelOuterSupport = new GeoTube(m_data->outerRadiusOfBarrelVolume - m_data->thicknessOfBarrelOuterSupport,
561  m_data->outerRadiusOfBarrelVolume, m_data->lengthOfBarrelVolume/2);
562 
563  GeoLogVol *lBarrelOuterSupport = new GeoLogVol("BarrelOuterSupport", sBarrelOuterSupport,
564  m_materialManager->getMaterial("trt::BarrelOuterSupport") ?
565  m_materialManager->getMaterial("trt::BarrelOuterSupport") :
566  m_materialManager->getMaterial("trt::BarrelSupport") );
567 
568 
569  GeoPhysVol *pBarrelOuterSupport = new GeoPhysVol(lBarrelOuterSupport);
570  pBarrelVol->add(pBarrelOuterSupport);
571 
572 
573 
574  if (m_data->includeBarServiceAndFlange) {
575 
576  //-----------------------------------------------------------------------//
577  // //
578  // Barrel End Flange region //
579  // //
580  //-----------------------------------------------------------------------//
581 
582 
583  GeoTube *sEndFlangeRegion = new GeoTube(m_data->barFlangeRMin, m_data->barFlangeRMax,
584  (m_data->barFlangeZMax - m_data->barFlangeZMin)/2);
585  GeoLogVol *lEndFlangeRegion = new GeoLogVol("EndFlangeRegion", sEndFlangeRegion,
586  m_materialManager->getMaterial("trt::EndFlangeRegion") );
587 
588  GeoPhysVol *pEndFlangeRegion = new GeoPhysVol(lEndFlangeRegion);
589 
590  double zPosEndFlange = (m_data->barFlangeZMin+m_data->barFlangeZMax)/2;
591  GeoTransform *xfEndFlangeRegionPlus = new GeoTransform(GeoTrf::TranslateZ3D(zPosEndFlange));
592  GeoTransform *xfEndFlangeRegionMinus = new GeoTransform(GeoTrf::TranslateZ3D(-zPosEndFlange));
593 
594  pBarrelVol->add(xfEndFlangeRegionPlus);
595  pBarrelVol->add(pEndFlangeRegion);
596  pBarrelVol->add(xfEndFlangeRegionMinus);
597  pBarrelVol->add(pEndFlangeRegion);
598 
599 
600  //-----------------------------------------------------------------------//
601  // //
602  // Barrel service region //
603  // //
604  //-----------------------------------------------------------------------//
605 
606  GeoTube *sServices = new GeoTube(m_data->barServicesRMin, m_data->barServicesRMax,
607  (m_data->barServicesZMax - m_data->barServicesZMin)/2);
608  GeoLogVol *lServices = new GeoLogVol("Services", sServices,
609  m_materialManager->getMaterial("trt::Services") );
610 
611  GeoPhysVol *pServices = new GeoPhysVol(lServices);
612 
613  double zPosServices = (m_data->barServicesZMin+m_data->barServicesZMax)/2;
614  GeoTransform *xfServicesPlus = new GeoTransform(GeoTrf::TranslateZ3D(zPosServices));
615  GeoTransform *xfServicesMinus = new GeoTransform(GeoTrf::TranslateZ3D(-zPosServices));
616 
617  pBarrelVol->add(xfServicesPlus);
618  pBarrelVol->add(pServices);
619  pBarrelVol->add(xfServicesMinus);
620  pBarrelVol->add(pServices);
621 
622  }
623 
624 
625 
626  //-----------------------------------------------------------------------//
627  // //
628  // Barrel Modules //
629  // //
630  //-----------------------------------------------------------------------//
631 
632  std::vector<InDetDD::TRT_BarrelDescriptor *> bDescriptor;
633 
634  // Create some shared stuff to stick into each module.
635 
636  // The cooling tube:
637  GeoTube *sCoolingTube = new GeoTube(0, m_data->barrelOuterRadiusOfCoolingTube, m_data->lengthOfBarrelVolume/2.0);
638  GeoLogVol *lCoolingTube = new GeoLogVol("CoolingTube",sCoolingTube,m_materialManager->getMaterial("trt::CoolingTube"));
639  GeoPhysVol *pCoolingTube = new GeoPhysVol(lCoolingTube);
640 
641  GeoTube *sCoolingFluid = new GeoTube(0, m_data->barrelInnerRadiusOfCoolingTube, m_data->lengthOfBarrelVolume/2.0);
642  GeoLogVol *lCoolingFluid = new GeoLogVol("CoolingFluid",sCoolingFluid,m_materialManager->getMaterial("trt::CoolingFluid"));
643  GeoPhysVol*pCoolingFluid = new GeoPhysVol(lCoolingFluid);
644 
645  pCoolingTube->add(pCoolingFluid);
646 
647  double lengthOfInnerDeadRegion= m_data->lengthOfDeadRegion;
648  double lengthOfActiveGas = (m_data->barrelLengthOfStraw-m_data->barrelLengthOfTwister)/2.0 - m_data->lengthOfDeadRegion - lengthOfInnerDeadRegion;
649  double activeGasZPositionNormalStraws = (lengthOfActiveGas + m_data->barrelLengthOfTwister) / 2. + lengthOfInnerDeadRegion;
650 
651  lengthOfInnerDeadRegion = m_data->barrelLengthOfLargeDeadRegion;
652  lengthOfActiveGas = (m_data->barrelLengthOfStraw-m_data->barrelLengthOfTwister)/2.0 - m_data->lengthOfDeadRegion - lengthOfInnerDeadRegion;
653  double activeGasZPositionStrawsWithLargeDeadRegion = (lengthOfActiveGas + m_data->barrelLengthOfTwister) / 2. + lengthOfInnerDeadRegion;
654 
655  // The modules themselves.
656  for (size_t iABC=0;iABC<m_data->nBarrelRings;iABC++) {
657 
658  // Create a shape for the modules of each layer (shell)
659  // STS: Initialize raditator and shell LogVol
660  GeoLogVol *lRad = nullptr;
661  GeoLogVol *lShell = nullptr;
662 
663  // The shell volume:
664  std::ostringstream shellstream;
665  shellstream << "Shell" << iABC;
666  GeoTrf::Vector2D shellCorner1(m_data->shellCornerXPosition[iABC][0],m_data->shellCornerYPosition[iABC][0]);
667  GeoTrf::Vector2D shellCorner2(m_data->shellCornerXPosition[iABC][1],m_data->shellCornerYPosition[iABC][1]);
668  GeoTrf::Vector2D shellCorner3(m_data->shellCornerXPosition[iABC][2],m_data->shellCornerYPosition[iABC][2]);
669  GeoTrf::Vector2D shellCorner4(m_data->shellCornerXPosition[iABC][3],m_data->shellCornerYPosition[iABC][3]);
670  GeoTrf::Transform3D shellPosition(GeoTrf::Transform3D::Identity());
671  if ( shellCorner1.y() <= 0 ) { ATH_MSG_DEBUG( "shellCorner1 is <= 0 (" << shellCorner1 << ")"); }
672  if ( shellCorner2.y() <= 0 ) { ATH_MSG_DEBUG( "shellCorner2 is <= 0 (" << shellCorner2 << ")"); }
673  if ( shellCorner3.y() <= 0 ) { ATH_MSG_DEBUG( "shellCorner3 is <= 0 (" << shellCorner3 << ")" ); }
674  if ( shellCorner4.y() <= 0 ) { ATH_MSG_DEBUG( "shellCorner4 is <= 0 (" << shellCorner4 << ")"); }
675  const GeoShape * sShell = makeModule(m_data->lengthOfBarrelVolume,
676  shellCorner1,shellCorner2,shellCorner3,shellCorner4,shellPosition);
677 
678  // STS: We have three different shellmodules and radiators densities.
679  std::ostringstream layerstr;
680  layerstr << iABC;
681 
682  std::string shellMatName = "trt::ModuleShell"+layerstr.str();
683  std::string shellName = "ModuleShell"+layerstr.str();
684 
685  const GeoMaterial * shellMat = m_materialManager->getMaterial(shellMatName);
686  if (!shellMat) shellMat = m_materialManager->getMaterial("trt::ModuleShell");
687  lShell = new GeoLogVol(shellName, sShell, shellMat);
688 
689  //---------------------------------------------------------------------------------------------------------------
690  // Some shared stuff for all of the modules within a layer:
691 
692  // Make a Radiator
693  GeoTrf::Transform3D radAbsolutePosition(GeoTrf::Transform3D::Identity());
694  const GeoShape * sRad = makeModule(m_data->lengthOfBarrelVolume,
695  shellCorner1,shellCorner2,shellCorner3,shellCorner4,
696  radAbsolutePosition,m_data->barrelThicknessOfModuleWalls);
697 
698  // FibreRadiator will have three different densities for each type of module
699  std::string radMatName = "trt::FibreRadiator"+layerstr.str();
700  std::string radName = "FibreRadiator"+layerstr.str();
701 
702  const GeoMaterial * radMat = m_materialManager->getMaterial(radMatName);
703  if (!radMat) radMat = m_materialManager->getMaterial("trt::FibreRadiator");
704 
705  lRad = new GeoLogVol(radName, sRad, radMat);
706 
707  //---------------------------------------------------------------------------------------------------------------
708  // Place the cooling tubes in the Radiator
709  GeoTransform *xCool1 = new GeoTransform(shellPosition.inverse()
710  *GeoTrf::Translate3D(m_data->barrelXOfCoolingTube[iABC][0],m_data->barrelYOfCoolingTube[iABC][0],0));
711  GeoTransform *xCool2 = new GeoTransform(shellPosition.inverse()
712  *GeoTrf::Translate3D(m_data->barrelXOfCoolingTube[iABC][1],m_data->barrelYOfCoolingTube[iABC][1],0));
713 
714  //----------------------------------------------------------------------------------------------------------------
715  // Parameterize all of the straws and put them within the radiator.
716 
717  // Figure out how many straws have a large dead region
718  size_t nStrawsWithLargeDeadRegion = 0;
719  if (iABC==0) {
720  for (size_t iLayer = 0; iLayer<m_data->barrelNumberOfLayersWithLargeDeadRegion; iLayer++) {
721  nStrawsWithLargeDeadRegion += m_data->barrelNumberOfStrawsInStrawLayer[iABC][iLayer];
722  }
723  }
724 
725  // Generators:
726  GeoTrf::TranslateX3D Xx(1.0);
727  GeoTrf::TranslateY3D Xy(1.0);
728 
729  GENFUNCTION fx = ArrayFunction(&m_data->strawXPosition[iABC][0+nStrawsWithLargeDeadRegion],
730  &m_data->strawXPosition[iABC][0]+m_data->barrelNumberOfStrawsInModule[iABC]);
731  //TK: why ..[0]+n and not ..[n] ?
732  GENFUNCTION fy = ArrayFunction(&m_data->strawYPosition[iABC][0+nStrawsWithLargeDeadRegion],
733  &m_data->strawYPosition[iABC][0]+m_data->barrelNumberOfStrawsInModule[iABC]);
734  TRANSFUNCTION tx1 = Pow(Xx,fx)*Pow(Xy,fy);
735 
736  //Functions for straw with large dead regions
737  GENFUNCTION fxDead = ArrayFunction(&m_data->strawXPosition[iABC][0], &m_data->strawXPosition[iABC][0+nStrawsWithLargeDeadRegion]);
738  GENFUNCTION fyDead = ArrayFunction(&m_data->strawYPosition[iABC][0], &m_data->strawYPosition[iABC][0+nStrawsWithLargeDeadRegion]);
739  TRANSFUNCTION tx1Dead = Pow(Xx,fxDead)*Pow(Xy,fyDead);
740 
741  //TK: Quick fix, might waste a few KB of memory.
742  //TK: only use when iABC==0
743  GENFUNCTION fxAll = ArrayFunction(&m_data->strawXPosition[iABC][0], &m_data->strawXPosition[iABC][0]+m_data->barrelNumberOfStrawsInModule[iABC]);
744  GENFUNCTION fyAll = ArrayFunction(&m_data->strawYPosition[iABC][0], &m_data->strawYPosition[iABC][0]+m_data->barrelNumberOfStrawsInModule[iABC]);
745  TRANSFUNCTION tx1All = Pow(Xx,fxAll)*Pow(Xy,fyAll);
746 
747 
749  //Calculation of needed transforms
750  //First get the global and local positions of the two alignment straws:
751  //USE HEP2VECTORS!!!
752 
753  GeoTrf::Vector3D Align1Global(m_data->barrelXOfFirstGlobalAlignmentStraw[iABC], m_data->barrelYOfFirstGlobalAlignmentStraw[iABC], 0);
754  GeoTrf::Vector3D Align2Global(m_data->barrelXOfSecondGlobalAlignmentStraw[iABC], m_data->barrelYOfSecondGlobalAlignmentStraw[iABC],0);
755  GeoTrf::Vector3D Align1Local(m_data->strawXPosition[iABC][0],m_data->strawYPosition[iABC][0],0);
756  GeoTrf::Vector3D Align2Local(m_data->strawXPosition[iABC][m_data->barrelIndexOfSecondGlobalAlignmentStraw[iABC]],
757  m_data->strawYPosition[iABC][m_data->barrelIndexOfSecondGlobalAlignmentStraw[iABC]],0);
758 
759  //We need to make first a translation which puts the first alignment straw into place:
760 
761  //And we need to make a rotation which puts the second one on its position:
762 
763  GeoTrf::Vector2D local12((Align2Local - Align1Local).x(),(Align2Local - Align1Local).y());
764  GeoTrf::Vector2D global12((Align2Global - Align1Global).x(),(Align2Global - Align1Global).y());
765  double zrotang = global12.phi()-local12.phi();
766 
767  //Here we combine these two into a GeoTrf::Transform3D:
768 
769  GeoTrf::Transform3D absStrawXForm = GeoTrf::Translate3D(Align1Global.x(),Align1Global.y(),Align1Global.z())
770  *GeoTrf::RotateZ3D( zrotang )
771  *GeoTrf::Translate3D(-Align1Local.x(),-Align1Local.y(),-Align1Local.z());
772 
773  //
775 
776  //Why not use radiator instead of shell?
777  TRANSFUNCTION tx2=shellPosition.inverse()*absStrawXForm*tx1;
778  TRANSFUNCTION tx2Dead=shellPosition.inverse()*absStrawXForm*tx1Dead;
779  TRANSFUNCTION tx2All=shellPosition.inverse()*absStrawXForm*tx1All;
780  if (iABC==0) {
781  //TK: move rest of ...All stuff here?
782  m_detectorManager->setBarrelTransformField(iABC,tx2All.clone());
783  } else {
784  m_detectorManager->setBarrelTransformField(iABC,tx2.clone());
785  }
786 
787  // Adds one straw from each layer (reformulate..) (should be done via m_data from database)
788  double oldx=-999*GeoModelKernelUnits::cm, oldz=-999*GeoModelKernelUnits::cm;
789  unsigned int c=0;
790  size_t iLayer=0;
791  while (c< m_data->barrelNumberOfStrawsInModule[iABC] ) {
792 
793  GeoTrf::Vector3D p(0,0,0);
794  if (iABC==0)
795  p = tx2All(c)*p;
796  else
797  p = tx2(c)*p;
798 
799  double x = p.x();
800  double z = p.z();
801 
802  //TK: use arrays!! update this...
803  if (sqrt((x-oldx)*(x-oldx)+ (z-oldz)*(z-oldz))> 5*GeoModelKernelUnits::cm) {
804  iLayer++;
805  bDescriptor.push_back(new InDetDD::TRT_BarrelDescriptor());
806  m_detectorManager->setBarrelDescriptor(bDescriptor.back());
807  bDescriptor.back()->setStrawTransformField(m_detectorManager->barrelTransformField(iABC),c);
808 
809  //TK: Next, we are providing information about the Z
810  //dimensions of the active gas, to be used for reconstruction
811  //purposes. Personally I find "strawZDead" to be a slightly
812  //confusing choice of name for that method.
813 
814  if((iABC==0)&&(iLayer<=m_data->barrelNumberOfLayersWithLargeDeadRegion )) {
815  //TK: these things should come back from makestraw...
816  double lengthOfActiveGas=
817  (m_data->barrelLengthOfStraw-m_data->barrelLengthOfTwister)/2.0 - m_data->lengthOfDeadRegion-m_data->barrelLengthOfLargeDeadRegion;
818  double startZOfActiveGas=activeGasZPositionStrawsWithLargeDeadRegion-lengthOfActiveGas/2.0;
819  bDescriptor.back()->strawZPos(activeGasZPositionStrawsWithLargeDeadRegion);
820  bDescriptor.back()->strawZDead(startZOfActiveGas);
821  bDescriptor.back()->strawLength(lengthOfActiveGas);
822  } else {
823  double lengthOfActiveGas=(m_data->barrelLengthOfStraw-m_data->barrelLengthOfTwister)/2.0 - 2*m_data->lengthOfDeadRegion;
824  double startZOfActiveGas=activeGasZPositionNormalStraws-lengthOfActiveGas/2.0;
825  bDescriptor.back()->strawZPos(activeGasZPositionNormalStraws);
826  bDescriptor.back()->strawZDead(startZOfActiveGas);
827  bDescriptor.back()->strawLength(lengthOfActiveGas);
828  }
829 
830  }
831  bDescriptor.back()->addStraw(z,x);
832  oldx=x; oldz=z;
833  c++;
834 
835  }
836 
837 
838 
839  // Now create m_data->nBarrelModulesUsed unique modules within each layer.
840  pBarrelVol->add(new GeoSerialIdentifier(0));
841  for (size_t iMod = 0; iMod<m_data->nBarrelModulesUsed;iMod++) {
842  double delta = iMod*360*GeoModelKernelUnits::deg/m_data->nBarrelModules;
843 
844 
845 
846 
847  GeoFullPhysVol * pShell = new GeoFullPhysVol(lShell);
848 
849  // This is where the shell is pushed out to its place
850  //GeoTransform * xfx1 = new GeoTransform(GeoTrf::RotateZ3D(delta)*shellPosition);
851  GeoAlignableTransform * xfx1 = new GeoAlignableTransform(GeoTrf::RotateZ3D(delta)*shellPosition);
852  pBarrelVol->add(xfx1);
853  pBarrelVol->add(pShell);
854 
855  // Register the alignable transfrom to the manager
856  // +ve and -ve are part of the same barrel. We use barrel_ec = -1.
857  Identifier idModule = idHelper->module_id(-1, iMod, iABC);
858  // In barrel frame (generally the same as the global frame)
859  m_detectorManager->addAlignableTransform(AlignmentLevelModule, idModule, xfx1, pShell, pBarrelVol);
860 
861  // Add the substructure here:
862  pShell->add(new GeoIdentifierTag(iABC));
863  Identifier TRT_Identifier = idHelper->straw_id(1, iMod, iABC, 1, 1);
864  int strawStatusHT = TRTCond::StrawStatus::Good;
865  if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier, Gaudi::Hive::currentContext());
866  ActiveGasMixture agm = DecideGasMixture(strawStatusHT);
867 
868  // Make a radiator
869  GeoNodePtr<GeoPhysVol> pRad(new GeoPhysVol(lRad));
870  pRad->add(xCool1);
871  pRad->add(pCoolingTube);
872  pRad->add(xCool2);
873  pRad->add(pCoolingTube);
874  pRad->add(new GeoSerialIdentifier(0));
875 
876  GeoNodePtr<GeoPhysVol> pHoleForMixedStraw;
877  GeoNodePtr<GeoPhysVol> pHoleForMixedStrawWithLargeDeadRegion;
878 
879  switch (agm)
880  {
881  case GM_ARGON:
882  ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t"
883  << idHelper->print_to_string(TRT_Identifier));
884  pHoleForMixedStraw = makeStraw(false, GM_ARGON);
885  pHoleForMixedStrawWithLargeDeadRegion = makeStraw(true, GM_ARGON);
886  break;
887  case GM_KRYPTON:
888  ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t"
889  << idHelper->print_to_string(TRT_Identifier));
890  pHoleForMixedStraw = makeStraw(false, GM_KRYPTON);
891  pHoleForMixedStrawWithLargeDeadRegion = makeStraw(true, GM_KRYPTON);
892  break;
893  case GM_XENON:
894  ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t"
895  << idHelper->print_to_string(TRT_Identifier) );
896  pHoleForMixedStraw = makeStraw();
897  pHoleForMixedStrawWithLargeDeadRegion = makeStraw(true);
898  break;
899  default:
900  ATH_MSG_FATAL( "Unexpected gas mixture: " << agm );
901  throw std::runtime_error("Unexpected gas mixture");
902  return;
903  }
904 
905  GeoNodePtr<GeoSerialTransformer> serialTransformer = new GeoSerialTransformer(pHoleForMixedStraw
906  , &tx2
907  , m_data->barrelNumberOfStrawsInModule[iABC]-nStrawsWithLargeDeadRegion);
908 
909  if (iABC==0) {
910  GeoNodePtr<GeoSerialTransformer> serialTransformerDead = new GeoSerialTransformer(pHoleForMixedStrawWithLargeDeadRegion
911  , &tx2Dead
912  , nStrawsWithLargeDeadRegion);
913  pRad->add(serialTransformerDead);
914  }
915  pRad->add(serialTransformer);
916 
917  pShell->add(pRad);
918 
919  //-------------------------------------------------------------------//
920  // //
921  // Barrel readout: //
922  // //
923  //-------------------------------------------------------------------//
924 
925  //
926  // Get the number of straw layers in each module:
927  //
928 
929  unsigned int nStrawLayers = m_detectorManager->getNumerology()->getNBarrelLayers(iABC);
930  for (unsigned int iStrawLayer=0;iStrawLayer<nStrawLayers; iStrawLayer++) { // limit stored as float!
931 
932  unsigned int jStrawLayer=iStrawLayer;
933  if (iABC>0) jStrawLayer += m_detectorManager->getNumerology()->getNBarrelLayers(0);
934  if (iABC>1) jStrawLayer += m_detectorManager->getNumerology()->getNBarrelLayers(1);
935  //TK: just go from jStrawLayer=layerstart;jStrawLayer<layerend ?
936 
937  InDetDD::TRT_BarrelDescriptor *bD=bDescriptor[jStrawLayer];
938 
939  InDetDD::TRT_BarrelElement *element0 = new InDetDD::TRT_BarrelElement(pShell, bD, 0 , iABC, iMod, iStrawLayer, idHelper, m_detectorManager->conditions());
940  InDetDD::TRT_BarrelElement *element1 = new InDetDD::TRT_BarrelElement(pShell, bD, 1 , iABC, iMod, iStrawLayer, idHelper, m_detectorManager->conditions());
941 
944  }
945 
946  }//End "for (size_t iMod = ..." loop.
947 
948  }
949 
950  // Set up the nearest neighbor pointers: in R.
951  for (unsigned int e=0;e<2;e++) {
952  for (unsigned int iMod=0;iMod<m_data->nBarrelModulesUsed; iMod++) {
953  InDetDD::TRT_BarrelElement *prev=nullptr;
954  for (unsigned int iABC=0;iABC<m_data->nBarrelRings;iABC++) {
955  for (unsigned int s=0;s<m_detectorManager->getNumerology()->getNBarrelLayers(iABC); s++) {
957  if (prev && current) {
958  prev->setNextInR(current);
959  current->setPreviousInR(prev);
960  }
961  prev=current;
962  }
963  }
964  }
965  }
966 
967  // Set up the nearest neighbor pointers: in Phi.
968  for (unsigned int e=0;e<2;e++) {
969  for (unsigned int iABC=0;iABC<m_data->nBarrelRings;iABC++) {
970  for (unsigned int s=0;s<m_detectorManager->getNumerology()->getNBarrelLayers(iABC); s++) {
971  InDetDD::TRT_BarrelElement *prev=nullptr;
972  for (unsigned int iMod=0;iMod<m_data->nBarrelModulesUsed; iMod++) {
974  if (prev && current) {
975  prev->setNextInPhi(current);
976  current->setPreviousInPhi(prev);
977  }
978  prev=current;
979  }
980  if (m_data->nBarrelModulesUsed==m_data->nBarrelModules) { // Full complement; then, we wrap!:
982  InDetDD::TRT_BarrelElement *last =m_detectorManager->getBarrelElement(e,iABC,m_data->nBarrelModules-1,s);
983  if (first && last) {
984  first->setPreviousInPhi(last);
985  last->setNextInPhi(first);
986  }
987  }
988  }
989  }
990  }
991  }//end of if (pBarrelVol)
992 
993 
994 
995  //-----------------------------------------------------------------------//
996  // //
997  // Endcap Modules //
998  // //
999  //-----------------------------------------------------------------------//
1000 
1001  // TK: This part could really use some cleanup and reordering.
1002  // There is no need to repeat the same code for A, B & C endcaps.
1003 
1004 
1005  // if none of the endcaps is being built we can return.
1006  if (!(endcapABPlusPresent || endcapABMinusPresent || endcapCPlusPresent || endcapCMinusPresent)){
1007  return;
1008  }
1009  unsigned int firstIndexOfA = 0;
1010  unsigned int firstIndexOfB = m_data->endcapNumberOfAWheels;
1011  unsigned int firstIndexOfC = m_data->endcapNumberOfAWheels + m_data->endcapNumberOfBWheels;
1012 
1013  unsigned int indexUpperBound = firstIndexOfA + m_detectorManager->getNumerology()->getNEndcapWheels();
1014 
1015  if (m_data->initialLayout) indexUpperBound = firstIndexOfC; // No wheel C.
1016 
1017  const unsigned int nSides = 2;
1018  const unsigned int nStrawLayMaxEc = 8;//hardcoded...
1019 
1020  unsigned int iiSide, iiWheel, iiPlane, iiPhi, counter; //set of counters
1021  int sign;
1022  double zdelta = 0.024; // try to make smaller gaps for Endcap Inner/OuterSupportGapper
1023  GeoTransform *xfRadiator, *xfPlane, *xfHeatExchanger, *xfFaradayFoilFront, *xfFaradayFoilBack;
1024  GeoTransform *xfInnerSupportGapperA,*xfOuterSupportGapperA, *xfInnerSupportGapperB, *xfOuterSupportGapperB;
1025  GeoFullPhysVol *childPlane = nullptr;
1026 
1027 
1028  double RotationsOfStrawPlanes[nStrawLayMaxEc]; //8 is hardcoded
1029  double shiftForEachRotation = m_data->endCapShiftForEachRotation; // in units of deltaPhi
1030  RotationsOfStrawPlanes[0] = 0.;
1031 
1032  bool oldGeometry = true;
1033  // Temporary way to determine old from new
1034  if (shiftForEachRotation < 0) oldGeometry = false;
1035 
1036  if (oldGeometry) {
1037  // For old geometry
1038  for (counter = 1; counter < nStrawLayMaxEc; counter++)
1039  {
1040  RotationsOfStrawPlanes[counter] = RotationsOfStrawPlanes[counter-1] + shiftForEachRotation;
1041  if (RotationsOfStrawPlanes[counter] >= 1.)
1042  RotationsOfStrawPlanes[counter] -= 1.;
1043  }
1044  } else {
1045  // New geometry
1046  double RotationsOfStrawPlanesTmp[nStrawLayMaxEc] = {0,0,0,0,2,2,2,2};
1047  for (counter = 0; counter < nStrawLayMaxEc; counter++)
1048  {
1049  RotationsOfStrawPlanes[counter] = (counter * shiftForEachRotation) + RotationsOfStrawPlanesTmp[counter];
1050  }
1051  }
1052 
1053  // Create and initialize by 0 arrays of descriptors
1054  std::vector<InDetDD::TRT_EndcapDescriptor*> descriptorsAB[nSides][nStrawLayMaxEc];
1055  std::vector<InDetDD::TRT_EndcapDescriptor*> descriptorsC[nSides][nStrawLayMaxEc];
1056  InDetDD::TRT_EndcapDescriptor* pDescriptor = nullptr;
1057  InDetDD::TRT_EndcapElement* element = nullptr;
1058 
1059  for(iiSide = 0; iiSide<nSides; iiSide++) {
1060  for(iiPlane = 0; iiPlane < nStrawLayMaxEc; iiPlane++) {
1061  descriptorsAB[iiSide][iiPlane].resize (m_data->nEndcapPhi);
1062  descriptorsC[iiSide][iiPlane].resize (m_data->nEndcapPhi);
1063  }
1064  }
1065 
1066 
1067 
1068  // Do Wheels A and B if one of them is present
1069  if (endcapABPlusPresent || endcapABMinusPresent) {
1070  // -------------- Wheel A -----------------------
1071 
1072  // Inner/Outer supports
1073  GeoTube* sInnerSupportA = new GeoTube(m_data->endCapInnerRadiusOfSupportA,
1074  m_data->endCapInnerRadiusOfSupportA + m_data->endCapRadialThicknessOfInnerSupportA,
1075  m_data->endCapLengthOfWheelsA/2);
1076  GeoLogVol* lInnerSupportA = new GeoLogVol("InnerSupportA", sInnerSupportA, m_materialManager->getMaterial("trt::InnerSupportA"));
1077  GeoPhysVol* pInnerSupportA = new GeoPhysVol(lInnerSupportA);
1078 
1079  GeoTube* sOuterSupportA = new GeoTube(m_data->endCapOuterRadiusOfSupportA - m_data->endCapRadialThicknessOfOuterSupportA,
1080  m_data->endCapOuterRadiusOfSupportA, m_data->endCapLengthOfWheelsA/2);
1081  GeoLogVol* lOuterSupportA = new GeoLogVol("OuterSupportA", sOuterSupportA, m_materialManager->getMaterial("trt::OuterSupportA"));
1082  GeoPhysVol* pOuterSupportA = new GeoPhysVol(lOuterSupportA);
1083 
1084  // Straw plane
1085  GeoNodePtr<GeoFullPhysVol> pStrawPlaneA_Kr;
1086  GeoNodePtr<GeoFullPhysVol> pStrawPlaneA_Ar;
1087  if (m_doKrypton)
1088  pStrawPlaneA_Kr = makeStrawPlane(firstIndexOfA, GM_KRYPTON);
1089  if (m_doArgon)
1090  pStrawPlaneA_Ar = makeStrawPlane(firstIndexOfA, GM_ARGON);
1091  GeoIntrusivePtr<GeoFullPhysVol> pStrawPlaneA = makeStrawPlane(firstIndexOfA);
1092 
1093 
1094  //TK:
1095  // Instead of this confusing stuf (main, thin, middle??), make:
1096  // 1) An array which gives the exact thicknesses of the various radiators
1097  // 2) A "makeradiator" method like makestrawplane which checks
1098  // internally whether it already has created a radiator of a
1099  // given thickness.
1100  //
1101  // Then just loop over the radiators
1102  //
1103 
1104  // Radiators
1105  GeoTube* sMainRadiatorA = new GeoTube(m_data->endCapInnerRadiusOfSupportA + m_data->endCapRadialThicknessOfInnerSupportA,
1106  m_data->endCapOuterRadiusOfSupportA - m_data->endCapRadialThicknessOfOuterSupportA
1107  - m_data->endCapRadialDistFromRadToOuterSupportA, m_data->endCapMainRadiatorThicknessA/2);
1108  GeoLogVol* lMainRadiatorA = new GeoLogVol("MainRadiatorA",sMainRadiatorA, m_materialManager->getMaterial("trt::FoilRadiatorAC"));
1109  GeoPhysVol* pMainRadiatorA = new GeoPhysVol(lMainRadiatorA);
1110 
1111  GeoTube* sThinRadiatorA = new GeoTube(m_data->endCapInnerRadiusOfSupportA + m_data->endCapRadialThicknessOfInnerSupportA,
1112  m_data->endCapOuterRadiusOfSupportA - m_data->endCapRadialThicknessOfOuterSupportA
1113  - m_data->endCapRadialDistFromRadToOuterSupportA, m_data->endCapThinRadiatorThicknessA/2);
1114  GeoLogVol* lThinRadiatorA = new GeoLogVol("ThinRadiatorA",sThinRadiatorA, m_materialManager->getMaterial("trt::FoilRadiatorAC"));
1115  GeoPhysVol* pThinRadiatorA = new GeoPhysVol(lThinRadiatorA);
1116 
1117  // Wheel
1118  GeoTube* sWheelA = new GeoTube( m_data->endCapInnerRadiusOfSupportA,m_data->endCapOuterRadiusOfSupportA, m_data->endCapLengthOfWheelsA/2);
1119  GeoLogVol* lWheelA = new GeoLogVol("WheelA", sWheelA, m_materialManager->getMaterial("trt::CO2"));
1120 
1121  // This is the straw pitch.
1122  double deltaPhiForStrawsA = 360.*GeoModelKernelUnits::deg/m_data->endcapNumberOfStrawsInStrawLayer_AWheels;
1123 
1124 
1125  // In reality the positive and negative endcaps are built identical, both in
1126  // geometry and readout. The offline numbering however keeps phi numbering going
1127  // in the same direction as global phi (righthanded direction).
1128 
1129  // For the latest version we build +ve and negative endcaps identical.
1130  // We also build the descriptors identical apart from the setting of startphi.
1131  //
1132  // The mapping is fixed (this must be reproduced in the sensitive
1133  // detector and readout geometry) The mapping is 1-1 for the
1134  // +ve endcap, for the -ve endcap it is as follows:
1135  //
1136  // ***************************************************************
1137  // * Negative endcap (Endcap C) mapping. *
1138  // * *
1139  // * nSectors = 32 *
1140  // * nStraws = num straws in sector *
1141  // * sector -> (nSectors + nSectors/2 - sector - 1) % nSectors *
1142  // * straw -> nStraws - 1 - straw *
1143  // ***************************************************************
1144  //
1145  // For compatibility with old (wrong geometry) we rotate the strawlayers
1146  // differently for the negative endcap than we do for the positive endcap.
1147  // This is to allow the sensitive detector and readout geometry to have
1148  // the same code for both layouts.
1149  //
1150  // Below we refere to online as the physical readout and offline as the offline
1151  // identifier convetions.
1152  // iiPhi corresponds to the "online" readout phi sector. This goes
1153  // right handed in positive endcap and left handed in negative, where handedness
1154  // is wrt to global frame.
1155  // iiPhiOffline is the offline numbering which is always right handed.
1156 
1157  for(iiSide=0; iiSide<nSides; iiSide++) {
1158  // Wheel A
1159  if (pCommonEndcapAB[iiSide]) {
1160 
1161  double WheelPlacerA = m_data->endCapPositionOfFirstWheelA[iiSide];
1162 
1163  for(iiWheel=firstIndexOfA; iiWheel < firstIndexOfB; iiWheel++)
1164  {
1165  //prepair to place wheel
1166  WheelPlacerA += m_data->endCapDistanceBetweenWheelCentersA[iiSide][iiWheel] ;
1167 
1168  GeoFullPhysVol* pWheelA = new GeoFullPhysVol(lWheelA);
1169 
1170  GeoAlignableTransform * xfAlignableModule = nullptr;
1171 
1172  // Place planes in the wheel
1173  for (iiPlane = 0; iiPlane < m_data->endCapNumberOfStrawLayersPerWheelA; iiPlane++)
1174  {
1175 
1176 
1177 
1178  // WheelA is subdivided into 4 alignable objects. (Every 4th straw layer)
1179  // We create an alignable transform for each alignable module
1180  // and multiply this by the transform for every straw layer in the "alignable module"
1181  // The tranform is by default Identity.
1182  if (iiPlane % 4 == 0) {
1183  // Register alignable node
1184  int barrel_ec = (iiSide) ? -2 : +2;
1185  xfAlignableModule = new GeoAlignableTransform(GeoTrf::Transform3D::Identity());
1186  Identifier idSubModule = idHelper->layer_id(barrel_ec, 0, iiWheel, iiPlane);
1187  // We pass the parent volume as the local delta for this correction is the same as a local delta
1188  // on the transformation of the wheel.
1189  m_detectorManager->addAlignableTransform(AlignmentLevelSubWheel, idSubModule, xfAlignableModule, pWheelA);
1190  }
1191 
1192  // phiPlane is phi of straw 0, sector 0 (online numbering)
1193  double phiPlane = m_data->endCapPhiOfFirstStraw + RotationsOfStrawPlanes[iiPlane%nStrawLayMaxEc]*deltaPhiForStrawsA;
1194 
1195  // For compatibility with old geometry we have to shift every eighth wheel by 1 straw pitch.
1196  if(iiSide && oldGeometry && (iiPlane%8 == 0)) {
1197  phiPlane += deltaPhiForStrawsA;
1198  }
1199 
1200  int bar_ec = (iiSide) ? -2 : +2;
1201  Identifier TRT_Identifier = idHelper->straw_id(bar_ec, 1, iiWheel, 1, 1);
1202  int strawStatusHT = TRTCond::StrawStatus::Good;
1203  if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier, Gaudi::Hive::currentContext());
1204  ActiveGasMixture agm = DecideGasMixture(strawStatusHT);
1205 
1206  // Ruslan: insert plane with Ar-straws
1207  // Artem: same for Kr
1208  switch (agm)
1209  {
1210  case GM_ARGON:
1211  ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t"
1212  << idHelper->print_to_string(TRT_Identifier) );
1213  childPlane = pStrawPlaneA_Ar->clone();
1214  break;
1215  case GM_KRYPTON:
1216  ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t"
1217  << idHelper->print_to_string(TRT_Identifier) );
1218  childPlane = pStrawPlaneA_Kr->clone();
1219  break;
1220  case GM_XENON:
1221  ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t"
1222  << idHelper->print_to_string(TRT_Identifier) );
1223  childPlane = pStrawPlaneA->clone();
1224  break;
1225  default:
1226  ATH_MSG_FATAL( "Unexpected gas mixture: " << agm );
1227  throw std::runtime_error("Unexpected gas mixture");
1228  return;
1229  }
1230 
1231 
1232  xfPlane = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionA[iiPlane] - m_data->endCapLengthOfWheelsA/2)*GeoTrf::RotateZ3D(phiPlane));
1233 
1234  if (xfAlignableModule) pWheelA->add(xfAlignableModule);
1235  pWheelA->add(xfPlane);
1236  pWheelA->add(new GeoIdentifierTag(iiPlane));
1237  pWheelA->add(childPlane);
1238 
1239  // Create descriptors
1240  // Just do it for the first wheel
1241  if(iiWheel==firstIndexOfA && iiPlane < nStrawLayMaxEc)
1242  for(iiPhi = 0; iiPhi < m_data->nEndcapPhi; iiPhi++)
1243  {
1244 
1245  pDescriptor = new InDetDD::TRT_EndcapDescriptor();
1246  m_detectorManager->setEndcapDescriptor(pDescriptor);
1247 
1248  pDescriptor->nStraws() = m_data->endcapNumberOfStrawsInStrawLayer_AWheels/m_data->nEndcapPhi;
1249  pDescriptor->strawPitch() = deltaPhiForStrawsA;
1250 
1251  double startPhi = phiPlane + iiPhi * pDescriptor->strawPitch() * pDescriptor->nStraws();
1252 
1253  // For negative endcap the startPhi is the last straw in the physical sector
1254  // phi -> phi + strawPitch*(n-1)
1255  // it then gets rotated 180 around y axis
1256  // phi -> pi - phi
1257  if (iiSide) {
1258  startPhi = GeoModelKernelUnits::pi - (startPhi + pDescriptor->strawPitch() * (pDescriptor->nStraws() - 1));
1259  }
1260 
1261  // Make sure its between -pi and pi.
1262  if (startPhi <= -GeoModelKernelUnits::pi) startPhi += 2*GeoModelKernelUnits::pi;
1263  if (startPhi > GeoModelKernelUnits::pi) startPhi -= 2*GeoModelKernelUnits::pi;
1264 
1265  pDescriptor->startPhi() = startPhi;
1266 
1267  pDescriptor->strawLength() = m_data->endCapOuterRadiusOfSupportA - m_data->endCapRadialThicknessOfOuterSupportA
1268  - 2*m_data->lengthOfDeadRegion - m_data->endCapRadialThicknessOfInnerSupportA - m_data->endCapInnerRadiusOfSupportA;
1269  pDescriptor->innerRadius() = m_data->endCapInnerRadiusOfSupportA + m_data->endCapRadialThicknessOfInnerSupportA
1270  + m_data->lengthOfDeadRegion;
1271  pDescriptor->setStrawTransformField(m_detectorManager->endcapTransformField(0),iiPhi*pDescriptor->nStraws());
1272 
1273  descriptorsAB[iiSide][iiPlane%nStrawLayMaxEc][iiPhi] = pDescriptor;
1274  }
1275  // Create elements
1276  for(iiPhi = 0; iiPhi < m_data->nEndcapPhi; iiPhi++)
1277  {
1278  // m_data->nEndcapPhi assumed to be even.
1279  // For positive endcap online == offline. For negative endcap we rotate 180 deg about y axis so
1280  // sector 0 -> 15, 15 -> 0, 16 -> 31, 31 -> 16, etc. This is achieved with
1281  // sector -> (nSectors + nSectors/2 - sector - 1) % nSectors
1282  int iiPhiOffline = (iiSide==0) ? iiPhi : (3*m_data->nEndcapPhi/2 - iiPhi - 1)% m_data->nEndcapPhi;
1283  element = new InDetDD::TRT_EndcapElement(childPlane,
1284  descriptorsAB[iiSide][iiPlane%nStrawLayMaxEc][iiPhi],
1285  iiSide==0,
1286  iiWheel,
1287  iiPlane,
1288  iiPhiOffline,
1289  idHelper,
1292  }
1293  }
1294  // Place radiators in the wheel
1295  for (counter = 1; counter <= m_data->endCapNumberOfStrawLayersPerWheelA; counter++)
1296  {
1297  if (counter % 4 == 1)
1298  {
1299  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionA[counter-1] - m_data->endCapLengthOfWheelsA/2
1300  - m_data->outerRadiusOfStraw - m_data->endCapThinRadiatorThicknessA/2));
1301  pWheelA->add(xfRadiator);
1302  pWheelA->add(pThinRadiatorA);
1303  }
1304 
1305  if (counter % 4 == 0)
1306  {
1307  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionA[counter-1] - m_data->endCapLengthOfWheelsA/2
1308  + m_data->outerRadiusOfStraw + m_data->endCapThinRadiatorThicknessA/2));
1309  pWheelA->add(xfRadiator);
1310  pWheelA->add(pThinRadiatorA);
1311  continue;
1312  }
1313 
1314  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionA[counter-1] - m_data->endCapLengthOfWheelsA/2
1315  + m_data->outerRadiusOfStraw + m_data->endCapMainRadiatorThicknessA/2));
1316  pWheelA->add(xfRadiator);
1317  pWheelA->add(pMainRadiatorA);
1318  }
1319  // Place Inner/Outer supports in the wheel
1320  pWheelA->add(pInnerSupportA);
1321  pWheelA->add(pOuterSupportA);
1322 
1323  // Place wheel in the Endcap Volume
1324  GeoAlignableTransform * xfWheel = new GeoAlignableTransform( GeoTrf::TranslateZ3D(WheelPlacerA) );
1325 
1326  pCommonEndcapAB[iiSide]->add(xfWheel);
1327  pCommonEndcapAB[iiSide]->add(new GeoIdentifierTag(iiWheel));
1328  pCommonEndcapAB[iiSide]->add(pWheelA);
1329 
1330  // Register alignable node
1331  int barrel_ec = (iiSide) ? -2 : +2;
1332  Identifier idModule = idHelper->module_id(barrel_ec, 0, iiWheel);
1333  m_detectorManager->addAlignableTransform(AlignmentLevelModule, idModule, xfWheel, pWheelA);
1334 
1335  if (m_data->includeECFoilHeatExchangerAndMembranes) {
1336 
1337  // Faraday Foils added
1338  // same Faraday foils for both wheel A and B
1339  // KaptonFoil radius is between R_max of InnerSupport and R_min of OuterSupport....STS
1340  GeoTube* sFaradayFoilWheelAB = new GeoTube(m_data->endCapInnerRadiusOfSupportA + m_data->endCapRadialThicknessOfInnerSupportA,
1341  m_data->endCapOuterRadiusOfSupportA - m_data->endCapRadialThicknessOfOuterSupportA,
1342  m_data->endCapFaradayFoilThickness/2);
1343  GeoLogVol* lFaradayFoilWheelAB = new GeoLogVol("FaradayKaptonFoil",sFaradayFoilWheelAB, m_materialManager->getMaterial("trt::FaradayFoilMaterial"));
1344  GeoIntrusivePtr<GeoPhysVol> pFaradayFoilWheelAB{new GeoPhysVol(lFaradayFoilWheelAB)};
1345 
1346  // Heat Exchanger added
1347  GeoTube* sHeatExchangerA = new GeoTube(m_data->endCapRMinOfHeatExchanger,m_data->endCapRMaxOfHeatExchanger,m_data->endCapHeatExchangerThicknessA/2);
1348  GeoLogVol* lHeatExchangerA = new GeoLogVol("HeatExchangerA",sHeatExchangerA, m_materialManager->getMaterial("trt::HeatExchangerAMat"));
1349  GeoIntrusivePtr<GeoPhysVol> pHeatExchangerA{new GeoPhysVol(lHeatExchangerA)};
1350 
1351  // Inner/Outer Support Gapper added
1352  GeoTube* sInnerSupportGapperA = new GeoTube(m_data->endCapInnerRadiusOfSupportA,
1353  m_data->endCapInnerRadiusOfSupportA + m_data->endCapRadialThicknessOfInnerSupportA,
1354  m_data->endCapHeatExchangerThicknessA/2 + m_data->endCapFaradayFoilThickness/2 + zdelta);
1355  GeoLogVol* lInnerSupportGapperA = new GeoLogVol("InnerSupportGapperA", sInnerSupportGapperA, m_materialManager->getMaterial("trt::InnerSupportA"));
1356  GeoIntrusivePtr<GeoPhysVol> pInnerSupportGapperA{new GeoPhysVol(lInnerSupportGapperA)};
1357 
1358  GeoTube* sOuterSupportGapperA = new GeoTube(m_data->endCapOuterRadiusOfSupportA - m_data->endCapRadialThicknessOfOuterSupportA,
1359  m_data->endCapOuterRadiusOfSupportA,
1360  m_data->endCapHeatExchangerThicknessA/2 + m_data->endCapFaradayFoilThickness/2 + zdelta);
1361  GeoLogVol* lOuterSupportGapperA = new GeoLogVol("OuterSupportGapperA", sOuterSupportGapperA, m_materialManager->getMaterial("trt::OuterSupportA"));
1362  GeoIntrusivePtr<GeoPhysVol> pOuterSupportGapperA{new GeoPhysVol(lOuterSupportGapperA)};
1363 
1364  if(iiWheel<=firstIndexOfB-1)
1365  {
1366  xfFaradayFoilFront = new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerA
1367  - m_data->endCapLengthOfWheelsA/2
1368  - m_data->endCapFaradayFoilThickness/2.0));
1369  xfFaradayFoilBack = new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerA
1370  + m_data->endCapLengthOfWheelsA/2
1371  + m_data->endCapFaradayFoilThickness/2.0));
1372  pCommonEndcapAB[iiSide]->add(xfFaradayFoilFront);
1373  pCommonEndcapAB[iiSide]->add(pFaradayFoilWheelAB);
1374  pCommonEndcapAB[iiSide]->add(xfFaradayFoilBack);
1375  pCommonEndcapAB[iiSide]->add(pFaradayFoilWheelAB);
1376  }
1377  // Place HeatExchanger after putiing wheel only. No heat exchanger after the last wheel.
1378 
1379  // Ditto for Inner/OuterSupportGapper
1380  if(iiWheel<firstIndexOfB-1)
1381  {
1382  xfHeatExchanger = new GeoTransform(GeoTrf::TranslateZ3D( WheelPlacerA
1383  + m_data->endCapLengthOfWheelsA/2
1384  + m_data->endCapFaradayFoilThickness
1385  + m_data->endCapHeatExchangerThicknessA/2));
1386  pCommonEndcapAB[iiSide]->add(xfHeatExchanger);
1387  pCommonEndcapAB[iiSide]->add(pHeatExchangerA);
1388 
1389  xfInnerSupportGapperA = new GeoTransform(GeoTrf::TranslateZ3D( WheelPlacerA
1390  + m_data->endCapLengthOfWheelsA/2
1391  + m_data->endCapFaradayFoilThickness
1392  + m_data->endCapHeatExchangerThicknessA/2));
1393  xfOuterSupportGapperA = new GeoTransform(GeoTrf::TranslateZ3D( WheelPlacerA
1394  + m_data->endCapLengthOfWheelsA/2
1395  + m_data->endCapFaradayFoilThickness
1396  + m_data->endCapHeatExchangerThicknessA/2));
1397  pCommonEndcapAB[iiSide]->add(xfInnerSupportGapperA);
1398  pCommonEndcapAB[iiSide]->add(pInnerSupportGapperA);
1399  pCommonEndcapAB[iiSide]->add(xfOuterSupportGapperA);
1400  pCommonEndcapAB[iiSide]->add(pOuterSupportGapperA);
1401  }
1402 
1403  } //include membrane, heat exchanger and foil
1404  } // iiWheel loop for Wheel A
1405  } // if (pCommonEndcapAB[iiSide]) block for Wheel A
1406  } // iiSide loop for Wheel A
1407 
1408 
1409 
1410  // --------------- Wheel B ----------------------------
1411 
1412  //Check here that (m_data->endcapNumberOfStrawsInStrawLayer_AWheels == m_data->endcapNumberOfStrawsInStrawLayer_BWheels) !!
1413  //We assume this in several places!
1414 
1415  // Inner/Outer supports
1416 
1417  GeoTube* sInnerSupportB = new GeoTube(m_data->endCapInnerRadiusOfSupportB,
1418  m_data->endCapInnerRadiusOfSupportB + m_data->endCapRadialThicknessOfInnerSupportB,
1419  m_data->endCapLengthOfWheelsB/2);
1420  GeoLogVol* lInnerSupportB = new GeoLogVol("InnerSupportB", sInnerSupportB, m_materialManager->getMaterial("trt::InnerSupportB"));
1421  GeoPhysVol* pInnerSupportB = new GeoPhysVol(lInnerSupportB);
1422 
1423  GeoTube* sOuterSupportB = new GeoTube(m_data->endCapOuterRadiusOfSupportB - m_data->endCapRadialThicknessOfOuterSupportB,
1424  m_data->endCapOuterRadiusOfSupportB, m_data->endCapLengthOfWheelsB/2);
1425  GeoLogVol* lOuterSupportB = new GeoLogVol("OuterSupportB", sOuterSupportB, m_materialManager->getMaterial("trt::OuterSupportB"));
1426  GeoPhysVol* pOuterSupportB = new GeoPhysVol(lOuterSupportB);
1427 
1428  // Straw plane
1429  GeoFullPhysVol* pStrawPlaneB_Kr = nullptr;
1430  GeoFullPhysVol* pStrawPlaneB_Ar = nullptr;
1431  if (m_doKrypton)
1432  pStrawPlaneB_Kr = makeStrawPlane(firstIndexOfB,GM_KRYPTON);
1433  if (m_doArgon)
1434  pStrawPlaneB_Ar = makeStrawPlane(firstIndexOfB,GM_ARGON);
1435  GeoIntrusivePtr<GeoFullPhysVol> pStrawPlaneB {makeStrawPlane(firstIndexOfB)};
1436 
1437  // Radiators
1438 
1439  GeoTube* sMainRadiatorB = new GeoTube(m_data->endCapInnerRadiusOfSupportB + m_data->endCapRadialThicknessOfInnerSupportB, //TK: no dist between rad&support at inner??????????????????????????????????????
1440  m_data->endCapOuterRadiusOfSupportB - m_data->endCapRadialThicknessOfOuterSupportB
1441  - m_data->endCapRadialDistFromRadToOuterSupportB, m_data->endCapMainRadiatorThicknessB/2);
1442  GeoLogVol* lMainRadiatorB = new GeoLogVol("MainRadiatorB",sMainRadiatorB, m_materialManager->getMaterial("trt::FoilRadiatorB"));
1443  GeoPhysVol* pMainRadiatorB = new GeoPhysVol(lMainRadiatorB);
1444 
1445  GeoTube* sThinRadiatorB = new GeoTube(m_data->endCapInnerRadiusOfSupportB + m_data->endCapRadialThicknessOfInnerSupportB,
1446  m_data->endCapOuterRadiusOfSupportB - m_data->endCapRadialThicknessOfOuterSupportB
1447  - m_data->endCapRadialDistFromRadToOuterSupportB,
1448  m_data->endCapThinRadiatorThicknessB/2);
1449  GeoLogVol* lThinRadiatorB = new GeoLogVol("ThinRadiatorB",sThinRadiatorB, m_materialManager->getMaterial("trt::FoilRadiatorB"));
1450  GeoPhysVol* pThinRadiatorB = new GeoPhysVol(lThinRadiatorB);
1451 
1452  GeoTube* sMiddleRadiatorB = new GeoTube(m_data->endCapInnerRadiusOfSupportB + m_data->endCapRadialThicknessOfInnerSupportB,
1453  m_data->endCapOuterRadiusOfSupportB - m_data->endCapRadialThicknessOfOuterSupportB
1454  - m_data->endCapRadialDistFromRadToOuterSupportB, m_data->endCapMiddleRadiatorThicknessB/2);
1455  GeoLogVol* lMiddleRadiatorB = new GeoLogVol("MiddleRadiatorB",sMiddleRadiatorB, m_materialManager->getMaterial("trt::FoilRadiatorB"));
1456  GeoPhysVol* pMiddleRadiatorB = new GeoPhysVol(lMiddleRadiatorB);
1457 
1458  // Wheel
1459  //TK: endCapAmountWheelLengthExceedsSumOfLayer = ...................
1460  GeoTube* sWheelB = new GeoTube( m_data->endCapInnerRadiusOfSupportB,m_data->endCapOuterRadiusOfSupportB, m_data->endCapLengthOfWheelsB/2);
1461  GeoLogVol* lWheelB = new GeoLogVol("WheelB", sWheelB, m_materialManager->getMaterial("trt::CO2"));
1462 
1463  // This is the straw pitch.
1464  double deltaPhiForStrawsB = 360.*GeoModelKernelUnits::deg/m_data->endcapNumberOfStrawsInStrawLayer_BWheels;
1465 
1466  for(iiSide=0; iiSide<nSides; iiSide++) {
1467 
1468  double WheelPlacerB = m_data->endCapPositionOfFirstWheelB[iiSide];
1469 
1470  // Wheel B
1471  if (pCommonEndcapAB[iiSide]) {
1472  for(iiWheel=firstIndexOfB; iiWheel < firstIndexOfC; iiWheel++)
1473  {
1474  //prepair to place wheel
1475  WheelPlacerB += m_data->endCapDistanceBetweenWheelCentersB[iiSide][iiWheel];
1476 
1477  GeoFullPhysVol* pWheelB = new GeoFullPhysVol(lWheelB);
1478 
1479  GeoAlignableTransform * xfAlignableModule = nullptr;
1480 
1481  // Place planes in the wheel
1482  for (iiPlane = 0; iiPlane < m_data->endCapNumberOfStrawLayersPerWheelB; iiPlane++)
1483  {
1484 
1485  // Each wheel in WheelB is subdivided into 2 alignable objects (every 4th straw layer)
1486  // We create an alignable transform for each alignable module
1487  // and multiply this by the transform for every straw layer in the "alignable module"
1488  // The tranform is by default Identity.
1489  if (iiPlane % 4 == 0) {
1490  // Register alignable node
1491  int barrel_ec = (iiSide) ? -2 : +2;
1492  xfAlignableModule = new GeoAlignableTransform(GeoTrf::Transform3D::Identity());
1493  Identifier idSubModule = idHelper->layer_id(barrel_ec, 0, iiWheel, iiPlane);
1494  // We pass the parent volume as the local delta for this correction is the same as a local delta
1495  // on the transformation of the wheel.
1496  m_detectorManager->addAlignableTransform(AlignmentLevelSubWheel, idSubModule, xfAlignableModule, pWheelB);
1497  }
1498 
1499  int bar_ec = (iiSide) ? -2 : +2;
1500  Identifier TRT_Identifier = idHelper->straw_id(bar_ec, 1, iiWheel, 1, 1);
1501  int strawStatusHT = TRTCond::StrawStatus::Good;
1502  if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier, Gaudi::Hive::currentContext());
1503  ActiveGasMixture agm = DecideGasMixture(strawStatusHT);
1504 
1505  //Ruslan: insert plane with Ar-straws
1506  //Artem: same for Kr
1507  switch (agm)
1508  {
1509  case GM_ARGON:
1510  ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t"
1511  << idHelper->print_to_string(TRT_Identifier) );
1512  childPlane = pStrawPlaneB_Ar->clone();
1513  break;
1514  case GM_KRYPTON:
1515  ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t"
1516  << idHelper->print_to_string(TRT_Identifier));
1517  childPlane = pStrawPlaneB_Kr->clone();
1518  break;
1519  case GM_XENON:
1520  ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t"
1521  << idHelper->print_to_string(TRT_Identifier));
1522  childPlane = pStrawPlaneB->clone();
1523  break;
1524  default:
1525  ATH_MSG_FATAL( "Unexpected gas mixture: " << agm);
1526  throw std::runtime_error("Unexpected gas mixture");
1527  return;
1528  }
1529 
1530  // phiPlane is phi of straw 0, sector 0 (online numbering)
1531  double phiPlane = m_data->endCapPhiOfFirstStraw + RotationsOfStrawPlanes[iiPlane%nStrawLayMaxEc]*deltaPhiForStrawsB;
1532 
1533  // For compatibility with old geometry we have to shift every eighth wheel by 1 straw pitch.
1534  if(iiSide && oldGeometry && (iiPlane%8 == 0)) {
1535  phiPlane += deltaPhiForStrawsB;
1536  }
1537 
1538  xfPlane = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionB[iiPlane]
1539  - m_data->endCapLengthOfWheelsB/2)*GeoTrf::RotateZ3D(phiPlane));
1540 
1541  if (xfAlignableModule) pWheelB->add(xfAlignableModule);
1542  pWheelB->add(xfPlane);
1543  pWheelB->add(new GeoIdentifierTag(iiPlane));
1544  pWheelB->add(childPlane);
1545 
1546  // Create elements
1547  for(iiPhi = 0; iiPhi < m_data->nEndcapPhi; iiPhi++)
1548  {
1549  // m_data->nEndcapPhi assumed to be even.
1550  // For positive endcap online == offline. For negative endcap we rotate 180 deg about y axis so
1551  // sector 0 -> 15, 15 -> 0, 16 -> 31, 31 -> 16, etc. This is achieved with
1552  // sector -> (nSectors + nSectors/2 - sector - 1) % nSectors
1553  int iiPhiOffline = (iiSide==0) ? iiPhi : (3*m_data->nEndcapPhi/2 - iiPhi - 1)% m_data->nEndcapPhi;
1554  element = new InDetDD::TRT_EndcapElement(childPlane,
1555  descriptorsAB[iiSide][iiPlane%nStrawLayMaxEc][iiPhi],
1556  iiSide==0,
1557  iiWheel,
1558  iiPlane,
1559  iiPhiOffline,
1560  idHelper,
1563  }
1564  }
1565 
1566  // Place radiators in the wheel
1567  for (counter = 1; counter <= m_data->endCapNumberOfStrawLayersPerWheelB; counter++)
1568  {
1569  // Main radiators
1570  if (counter % 4 != 0)
1571  {
1572  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionB[counter-1] - m_data->endCapLengthOfWheelsB/2
1573  + m_data->outerRadiusOfStraw + m_data->endCapMainRadiatorThicknessB/2));
1574  pWheelB->add(xfRadiator);
1575  pWheelB->add(pMainRadiatorB);
1576  }
1577 
1578  // Thin radiators
1579  if (counter == 1 || counter == 8)
1580  {
1581  sign = counter == 1? -1 : 1;
1582  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionB[counter-1] - m_data->endCapLengthOfWheelsB/2 + sign*(m_data->outerRadiusOfStraw + m_data->endCapThinRadiatorThicknessB/2)));
1583  pWheelB->add(xfRadiator);
1584  pWheelB->add(pThinRadiatorB);
1585  }
1586 
1587  // Middle radiators
1588  if (counter == 4 || counter == 5)
1589  {
1590  sign = counter == 4 ? 1 : -1;
1591  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionB[counter-1] - m_data->endCapLengthOfWheelsB/2 + sign*(m_data->outerRadiusOfStraw + m_data->endCapMiddleRadiatorThicknessB/2)));
1592  pWheelB->add(xfRadiator);
1593  pWheelB->add(pMiddleRadiatorB);
1594  }
1595  }
1596 
1597  // Place Inner/Outer supports in the wheel
1598  pWheelB->add(pInnerSupportB);
1599  pWheelB->add(pOuterSupportB);
1600 
1601  // Place wheel in the Endcap Volume
1602  GeoAlignableTransform * xfWheel = new GeoAlignableTransform(GeoTrf::TranslateZ3D( WheelPlacerB ));
1603 
1604 
1605  pCommonEndcapAB[iiSide]->add(xfWheel);
1606  pCommonEndcapAB[iiSide]->add(new GeoIdentifierTag(iiWheel));
1607  pCommonEndcapAB[iiSide]->add(pWheelB);
1608 
1609  // Register alignable node
1610  int barrel_ec = (iiSide) ? -2 : +2;
1611  Identifier idModule = idHelper->module_id(barrel_ec, 0, iiWheel);
1612  m_detectorManager->addAlignableTransform(AlignmentLevelModule, idModule, xfWheel, pWheelB);
1613 
1614 
1615  if (m_data->includeECFoilHeatExchangerAndMembranes) {
1616 
1617  // Faraday Foils added
1618  // same Faraday foils for both wheel A and B
1619  // KaptonFoil radius is between R_max of InnerSupport and R_min of OuterSupport.....STS
1620  GeoTube* sFaradayFoilWheelAB = new GeoTube(m_data->endCapInnerRadiusOfSupportB + m_data->endCapRadialThicknessOfInnerSupportB,
1621  m_data->endCapOuterRadiusOfSupportB - m_data->endCapRadialThicknessOfOuterSupportB,
1622  m_data->endCapFaradayFoilThickness/2);
1623  GeoLogVol* lFaradayFoilWheelAB = new GeoLogVol("FaradayKaptonFoil",sFaradayFoilWheelAB, m_materialManager->getMaterial("trt::FaradayFoilMaterial"));
1624  GeoIntrusivePtr<GeoPhysVol> pFaradayFoilWheelAB{new GeoPhysVol(lFaradayFoilWheelAB)};
1625 
1626  // Heat Exchanger
1627  GeoTube* sHeatExchangerB = new GeoTube(m_data->endCapRMinOfHeatExchanger,m_data->endCapRMaxOfHeatExchanger,m_data->endCapHeatExchangerThicknessB/2);
1628 
1629  GeoLogVol* lHeatExchangerB = new GeoLogVol("HeatExchangerB", sHeatExchangerB, m_materialManager->getMaterial("trt::HeatExchangerBMat"));
1630  GeoIntrusivePtr<GeoPhysVol> pHeatExchangerB{new GeoPhysVol(lHeatExchangerB)};
1631 
1632  // Inner/Outer Support Gapper added
1633  GeoTube* sInnerSupportGapperB = new GeoTube(m_data->endCapInnerRadiusOfSupportB,
1634  m_data->endCapInnerRadiusOfSupportB + m_data->endCapRadialThicknessOfInnerSupportB,
1635  m_data->endCapHeatExchangerThicknessB/2 + m_data->endCapFaradayFoilThickness/2 + zdelta);
1636  GeoLogVol* lInnerSupportGapperB = new GeoLogVol("InnerSupportGapperB", sInnerSupportGapperB, m_materialManager->getMaterial("trt::InnerSupportB"));
1637  GeoIntrusivePtr<GeoPhysVol> pInnerSupportGapperB{new GeoPhysVol(lInnerSupportGapperB)};
1638 
1639  GeoTube* sOuterSupportGapperB = new GeoTube(m_data->endCapOuterRadiusOfSupportB - m_data->endCapRadialThicknessOfOuterSupportB,
1640  m_data->endCapOuterRadiusOfSupportB,
1641  m_data->endCapHeatExchangerThicknessB/2 + m_data->endCapFaradayFoilThickness/2 + zdelta);
1642  GeoLogVol* lOuterSupportGapperB = new GeoLogVol("OuterSupportGapperB", sOuterSupportGapperB, m_materialManager->getMaterial("trt::OuterSupportB"));
1643  GeoIntrusivePtr<GeoPhysVol> pOuterSupportGapperB{new GeoPhysVol(lOuterSupportGapperB)};
1644 
1645  // Place kapton foils on a wheel just like a sandwitch
1646  if(iiWheel-firstIndexOfB<firstIndexOfC-firstIndexOfB)
1647  {
1648  xfFaradayFoilFront = new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerB
1649  - m_data->endCapLengthOfWheelsB/2
1650  - m_data->endCapFaradayFoilThickness/2.0));
1651  xfFaradayFoilBack = new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerB
1652  + m_data->endCapLengthOfWheelsB/2
1653  + m_data->endCapFaradayFoilThickness/2.0));
1654 
1655  pCommonEndcapAB[iiSide]->add(xfFaradayFoilFront);
1656  pCommonEndcapAB[iiSide]->add(pFaradayFoilWheelAB);
1657  pCommonEndcapAB[iiSide]->add(xfFaradayFoilBack);
1658  pCommonEndcapAB[iiSide]->add(pFaradayFoilWheelAB);
1659  }
1660 
1661  // Place HeatExchanger after putiing wheel only. No heat exchanger after the last wheel
1662  // Ditto for Inner/OuterSupportGapper
1663  if(iiWheel-firstIndexOfB<firstIndexOfC-firstIndexOfB-1)
1664  {
1665  xfHeatExchanger = new GeoTransform(GeoTrf::TranslateZ3D( WheelPlacerB
1666  + m_data->endCapLengthOfWheelsB/2
1667  + m_data->endCapFaradayFoilThickness
1668  + m_data->endCapHeatExchangerThicknessB/2));
1669  pCommonEndcapAB[iiSide]->add(xfHeatExchanger);
1670  pCommonEndcapAB[iiSide]->add(pHeatExchangerB);
1671 
1672  xfInnerSupportGapperB = new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerB
1673  + m_data->endCapLengthOfWheelsB/2
1674  + m_data->endCapFaradayFoilThickness
1675  + m_data->endCapHeatExchangerThicknessB/2));
1676 
1677  xfOuterSupportGapperB = new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerB
1678  + m_data->endCapLengthOfWheelsB/2
1679  + m_data->endCapFaradayFoilThickness
1680  + m_data->endCapHeatExchangerThicknessB/2));
1681  pCommonEndcapAB[iiSide]->add(xfInnerSupportGapperB);
1682  pCommonEndcapAB[iiSide]->add(pInnerSupportGapperB);
1683  pCommonEndcapAB[iiSide]->add(xfOuterSupportGapperB);
1684  pCommonEndcapAB[iiSide]->add(pOuterSupportGapperB);
1685  }
1686  } // include foil, heat exchanger and membrane
1687  }// iiWheel loop for Wheel B
1688  } // if (pCommonEndcapAB[iiSide]) block for Wheel B
1689  } // iiSide loop for Wheel B
1690 
1691  } // end AB
1692 
1693 
1694 
1695 
1696 
1697 
1698 
1699 
1700  if (m_data->includeECFoilHeatExchangerAndMembranes) {
1701  // Membranes
1702 
1703  GeoTube* sMbrane = new GeoTube(m_data->endCapRMinOfMbrane, m_data->endCapRMaxOfMbrane, m_data->endCapThicknessOfMbrane/2.0);
1704  GeoLogVol* lMbrane = new GeoLogVol("Membrane", sMbrane, m_materialManager->getMaterial("trt::EndCapMbrane"));
1705  GeoPhysVol* pMbrane = new GeoPhysVol(lMbrane);
1706 
1707  GeoTransform *xfMbraneWheelA1 = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapZMinOfMbraneWheelA1 + m_data->endCapThicknessOfMbrane/2.0));
1708  GeoTransform *xfMbraneWheelA2 = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapZMinOfMbraneWheelA2 + m_data->endCapThicknessOfMbrane/2.0));
1709  GeoTransform *xfMbraneWheelB1 = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapZMinOfMbraneWheelB1 + m_data->endCapThicknessOfMbrane/2.0));
1710  GeoTransform *xfMbraneWheelB2 = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapZMinOfMbraneWheelB2 + m_data->endCapThicknessOfMbrane/2.0));
1711 
1712  for(iiSide=0; iiSide<nSides; iiSide++) {
1713  pCommonEndcapAB[iiSide]->add(xfMbraneWheelA1);
1714  pCommonEndcapAB[iiSide]->add(pMbrane);
1715  pCommonEndcapAB[iiSide]->add(xfMbraneWheelA2);
1716  pCommonEndcapAB[iiSide]->add(pMbrane);
1717  pCommonEndcapAB[iiSide]->add(xfMbraneWheelB1);
1718  pCommonEndcapAB[iiSide]->add(pMbrane);
1719  pCommonEndcapAB[iiSide]->add(xfMbraneWheelB2);
1720  pCommonEndcapAB[iiSide]->add(pMbrane);
1721  }
1722  }
1723 
1724 
1725 
1726  // ---------------- Wheel C ---------------------------
1727  // Not present in initial layout
1728  if (endcapCPlusPresent || endcapCMinusPresent) {
1729  // Inner/Outer supports
1730  GeoTube* sInnerSupportC = new GeoTube(m_data->endCapInnerRadiusOfSupportC, m_data->endCapInnerRadiusOfSupportC
1731  + m_data->endCapRadialThicknessOfInnerSupportC, m_data->endCapLengthOfWheelsC/2);
1732  GeoLogVol* lInnerSupportC = new GeoLogVol("InnerSupportC", sInnerSupportC, m_materialManager->getMaterial("trt::InnerSupportC"));
1733  GeoPhysVol* pInnerSupportC = new GeoPhysVol(lInnerSupportC);
1734 
1735  GeoTube* sOuterSupportC = new GeoTube(m_data->endCapOuterRadiusOfSupportC - m_data->endCapRadialThicknessOfOuterSupportC,
1736  m_data->endCapOuterRadiusOfSupportC, m_data->endCapLengthOfWheelsC/2);
1737  GeoLogVol* lOuterSupportC = new GeoLogVol("OuterSupportC", sOuterSupportC, m_materialManager->getMaterial("trt::OuterSupportC"));
1738  GeoPhysVol* pOuterSupportC = new GeoPhysVol(lOuterSupportC);
1739 
1740  // Straw plane
1741  GeoIntrusivePtr<GeoFullPhysVol> pStrawPlaneC = makeStrawPlane(firstIndexOfC);
1742 
1743  // Radiators
1744  GeoTube* sMainRadiatorC = new GeoTube(m_data->endCapInnerRadiusOfSupportC + m_data->endCapRadialThicknessOfInnerSupportC,
1745  m_data->endCapOuterRadiusOfSupportC - m_data->endCapRadialThicknessOfOuterSupportC
1746  - m_data->endCapRadialDistFromRadToOuterSupportC, m_data->endCapMainRadiatorThicknessC/2);
1747  GeoLogVol* lMainRadiatorC = new GeoLogVol("MainRadiatorC",sMainRadiatorC, m_materialManager->getMaterial("trt::FoilRadiatorAC"));
1748  GeoPhysVol* pMainRadiatorC = new GeoPhysVol(lMainRadiatorC);
1749 
1750  GeoTube* sThinRadiatorC = new GeoTube(m_data->endCapInnerRadiusOfSupportC + m_data->endCapRadialThicknessOfInnerSupportC,
1751  m_data->endCapOuterRadiusOfSupportC - m_data->endCapRadialThicknessOfOuterSupportC
1752  - m_data->endCapRadialDistFromRadToOuterSupportC, m_data->endCapThinRadiatorThicknessC/2);
1753  GeoLogVol* lThinRadiatorC = new GeoLogVol("ThinRadiatorC",sThinRadiatorC, m_materialManager->getMaterial("trt::FoilRadiatorAC"));
1754  GeoPhysVol* pThinRadiatorC = new GeoPhysVol(lThinRadiatorC);
1755 
1756  // Wheel
1757  GeoTube* sWheelC = new GeoTube( m_data->endCapInnerRadiusOfSupportC,m_data->endCapOuterRadiusOfSupportC, m_data->endCapLengthOfWheelsC/2);
1758  GeoLogVol* lWheelC = new GeoLogVol("WheelC", sWheelC, m_materialManager->getMaterial("trt::CO2"));
1759 
1760  // This is the straw pitch.
1761  double deltaPhiForStrawsC = 360.*GeoModelKernelUnits::deg/m_data->endcapNumberOfStrawsInStrawLayer_CWheels;
1762 
1763  for(iiSide=0; iiSide<nSides; iiSide++) {
1764  // Wheel C
1765  if (pCommonEndcapC[iiSide]) {
1766  for(iiWheel=firstIndexOfC; iiWheel < indexUpperBound; iiWheel++)
1767  {
1768  GeoFullPhysVol* pWheelC = new GeoFullPhysVol(lWheelC);
1769 
1770  // Place planes in the wheel
1771  for (iiPlane = 0; iiPlane < m_data->endCapNumberOfStrawLayersPerWheelC; iiPlane++)
1772  {
1773  // phiPlane is phi of straw 0, sector 0 (online numbering)
1774  double phiPlane = m_data->endCapPhiOfFirstStraw + RotationsOfStrawPlanes[iiPlane%nStrawLayMaxEc]*deltaPhiForStrawsC;
1775 
1776  // For compatibility with old geometry we have to shift every eighth wheel by 1 straw pitch.
1777  if(iiSide && oldGeometry && (iiPlane%8 == 0)) {
1778  phiPlane += deltaPhiForStrawsC;
1779  }
1780 
1781 
1782  childPlane = pStrawPlaneC->clone();
1783 
1784  xfPlane = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionC[iiPlane]
1785  - m_data->endCapLengthOfWheelsC/2)*GeoTrf::RotateZ3D(phiPlane));
1786  pWheelC->add(xfPlane);
1787  pWheelC->add(new GeoIdentifierTag(iiPlane));
1788  pWheelC->add(childPlane);
1789 
1790  // Create descriptors
1791  // Just do it for the first wheel
1792  if(iiWheel==firstIndexOfC && iiPlane < nStrawLayMaxEc)
1793  for(iiPhi = 0; iiPhi < m_data->nEndcapPhi; iiPhi++)
1794  {
1795  pDescriptor = new InDetDD::TRT_EndcapDescriptor();
1796  m_detectorManager->setEndcapDescriptor(pDescriptor);
1797 
1798  pDescriptor->nStraws() = m_data->endcapNumberOfStrawsInStrawLayer_CWheels/m_data->nEndcapPhi;
1799  pDescriptor->strawPitch() = deltaPhiForStrawsC;
1800 
1801 
1802  double startPhi = phiPlane + iiPhi * pDescriptor->strawPitch() * pDescriptor->nStraws();
1803 
1804  // For negative endcap the startPhi is the last straw in the physical sector, it then gets
1805  // rotated 180 around y axis (phi -> pi - phi)
1806  if (iiSide) {
1807  startPhi = GeoModelKernelUnits::pi - (startPhi + pDescriptor->strawPitch() * (pDescriptor->nStraws() - 1));
1808  }
1809 
1810  // Make sure its between -pi and pi.
1811  if (startPhi <= -GeoModelKernelUnits::pi) startPhi += 2*GeoModelKernelUnits::pi;
1812  if (startPhi > GeoModelKernelUnits::pi) startPhi -= 2*GeoModelKernelUnits::pi;
1813 
1814 
1815  pDescriptor->startPhi() = startPhi;
1816 
1817  pDescriptor->strawLength() = m_data->endCapOuterRadiusOfSupportC - m_data->endCapRadialThicknessOfOuterSupportC
1818  - 2*m_data->lengthOfDeadRegion - m_data->endCapRadialThicknessOfInnerSupportC - m_data->endCapInnerRadiusOfSupportC;
1819  pDescriptor->innerRadius() = m_data->endCapInnerRadiusOfSupportC + m_data->endCapRadialThicknessOfInnerSupportC + m_data->lengthOfDeadRegion;
1820  pDescriptor->setStrawTransformField(m_detectorManager->endcapTransformField(2),iiPhi*pDescriptor->nStraws());
1821 
1822 
1823  descriptorsC[iiSide][iiPlane%nStrawLayMaxEc][iiPhi] = pDescriptor;
1824  }
1825 
1826  // Create elements
1827  for(iiPhi = 0; iiPhi < m_data->nEndcapPhi; iiPhi++)
1828  {
1829  // m_data->nEndcapPhi assumed to be even.
1830  // For positive endcap online == offline. For negative endcap we rotate 180 deg about y axis so
1831  // sector 0 -> 15, 15 -> 0, 16 -> 31, 31 -> 16, etc. This is achieved with
1832  // sector -> (nSectors + nSectors/2 - sector - 1) % nSectors
1833  int iiPhiOffline = (iiSide==0) ? iiPhi : (3*m_data->nEndcapPhi/2 - iiPhi - 1)% m_data->nEndcapPhi;
1834  element = new InDetDD::TRT_EndcapElement(childPlane,
1835  descriptorsC[iiSide][iiPlane%nStrawLayMaxEc][iiPhi],
1836  iiSide==0,
1837  iiWheel,
1838  iiPlane,
1839  iiPhiOffline,
1840  idHelper,
1843  }
1844  }
1845 
1846  // Place radiators in the wheel
1847  for (counter = 1; counter <= m_data->endCapNumberOfStrawLayersPerWheelC; counter++)
1848  {
1849  if (counter % 4 == 1)
1850  {
1851  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionC[counter-1] - m_data->endCapLengthOfWheelsC/2
1852  - m_data->lengthOfDeadRegion - m_data->endCapThinRadiatorThicknessC/2));
1853  pWheelC->add(xfRadiator);
1854  pWheelC->add(pThinRadiatorC);
1855  }
1856 
1857  if (counter % 4 == 0)
1858  {
1859  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionC[counter-1] - m_data->endCapLengthOfWheelsC/2
1860  + m_data->outerRadiusOfStraw + m_data->endCapThinRadiatorThicknessC/2));
1861  pWheelC->add(xfRadiator);
1862  pWheelC->add(pThinRadiatorC);
1863  continue;
1864  }
1865 
1866  xfRadiator = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionC[counter-1] - m_data->endCapLengthOfWheelsC/2
1867  + m_data->outerRadiusOfStraw + m_data->endCapMainRadiatorThicknessC/2));
1868  pWheelC->add(xfRadiator);
1869  pWheelC->add(pMainRadiatorC);
1870  }
1871 
1872  // Place Inner/Outer supports in the wheel
1873  pWheelC->add(pInnerSupportC);
1874  pWheelC->add(pOuterSupportC);
1875 
1876  // Place wheel in the Endcap Volume
1877  GeoAlignableTransform * xfWheel
1878  = new GeoAlignableTransform(GeoTrf::TranslateZ3D(m_data->endCapPositionOfFirstWheelC
1879  + (iiWheel - firstIndexOfC)*m_data->endCapDistanceBetweenWheelCentersC));
1880 
1881  pCommonEndcapC[iiSide]->add(xfWheel);
1882  pCommonEndcapC[iiSide]->add(new GeoIdentifierTag(iiWheel));
1883  pCommonEndcapC[iiSide]->add(pWheelC);
1884 
1885  // Register alignable node
1886  int barrel_ec = (iiSide) ? -2 : +2;
1887  Identifier idModule = idHelper->module_id(barrel_ec, 0, iiWheel);
1888  m_detectorManager->addAlignableTransform(AlignmentLevelModule, idModule, xfWheel, pWheelC);
1889 
1890 
1891  } // iiWheel loop for Wheel C
1892  } // if (pCommonEndcapC[iiSide]) block for Wheel C
1893  } // iiSide loop for Wheel C
1894 
1895  } // End Wheel C
1896 
1897 
1898  // Set up the nearest neighbor pointers: in Z
1899  for (iiSide=0; iiSide<2; iiSide++)
1900  for(iiPhi=0; iiPhi<m_data->nEndcapPhi; iiPhi++)
1901  {
1902  InDetDD::TRT_EndcapElement *prev = nullptr;
1903  for (iiWheel=0; iiWheel<indexUpperBound; iiWheel++)
1904  for (iiPlane=0; iiPlane<m_detectorManager->getNumerology()->getNEndcapLayers(iiWheel); iiPlane++)
1905  {
1906  InDetDD::TRT_EndcapElement *current = m_detectorManager->getEndcapElement(iiSide, iiWheel, iiPlane, iiPhi);
1907  if (prev && current)
1908  {
1909  prev->setNextInZ(current);
1910  current->setPreviousInZ(prev);
1911  }
1912  prev=current;
1913  }
1914  }
1915 }
1916 
1918 
1919 
1920 
1922 // //
1923 // Here follows private helper methods, used to construct the barrel module //
1924 // forms (makeModule), the barrel straws (makeStraw) and the endcap straw //
1925 // planes (makeStrawPlane) //
1926 // //
1928 
1929 
1930 
1932 //
1933 const GeoShape * TRTDetectorFactory_Full::makeModule ( double length, const GeoTrf::Vector2D& corner1, const GeoTrf::Vector2D& corner2,
1934  const GeoTrf::Vector2D& corner3, const GeoTrf::Vector2D& corner4, GeoTrf::Transform3D & modulePosition, double shrinkDist/*=0*/) const {
1935 
1936 
1937  // This method takes the absolute coordinates of the four corners,
1938  // constructs the relevant shape, centered around the intersections
1939  // of its diagonals, and returns it along with the absolute
1940  // coordinates of that center (modulePosition).
1941  //
1942  // We know that the four corners _approximately_ can be described as
1943  // the union of two isosceles triangles with same side-lengths and
1944  // different bases.
1945  //
1946  // shrinkDist is for the radiator, which must be similar to the
1947  // shell, but shrunken by some distance.
1948 
1949  // First we calculate the relative vectors of the edges:
1950 
1951  GeoTrf::Vector2D delta12 = corner1 - corner2; GeoTrf::Vector2D delta23 = corner2 - corner3;
1952  GeoTrf::Vector2D delta34 = corner3 - corner4; GeoTrf::Vector2D delta14 = corner1 - corner4;
1953 
1954  // We also need the diagonals.
1955  GeoTrf::Vector2D delta24 = corner2 - corner4;
1956  GeoTrf::Vector2D delta13 = corner1 - corner3;
1957 
1958  // Then we find out which way the module bends (NB: .angle returns the UNSIGNED angle!).
1959  double openingAngleOfFirstCorner= angle(delta12,delta14);
1960  int sign = ( openingAngleOfFirstCorner < 90*GeoModelKernelUnits::deg ? 1 : -1);
1961 
1962  // If our approximation with triangles were correct, three of the
1963  // lengths (of edges and diagonals) would be equal. We force this
1964  // instead.
1965  //
1966  // (Whether the involved diagonal is 2-4 or 1-3 depends on the sign).
1967  double commonSide = (magn(delta14) + magn(delta23) + (sign==1?magn(delta24):magn(delta13)) ) / 3.;
1968  double base1 = magn(delta12); // Inner base
1969  double base2 = magn(delta34); // Outer base
1970 
1971  if (shrinkDist!=0) {
1972  // Since the moving corners bit above doesnt work, we do this instead:
1973  double cosAlpha= sqrt(commonSide*commonSide-0.25*base1*base1)/commonSide;
1974  commonSide -= (1+1/cosAlpha)*shrinkDist;
1975  base1 -= 2*shrinkDist;
1976  base2 -= 2*shrinkDist;
1977  }
1978 
1979  double height1 = sqrt (commonSide*commonSide-0.25*base1*base1);
1980  double height2 = sqrt (commonSide*commonSide-0.25*base2*base2);
1981  double rot = atan(base2/height2/2)-atan(base1/height1/2);
1982  double epsilon = 1*GeoModelKernelUnits::micrometer; // needed to ensure perfect overlaps.
1983  GeoTrd *trd1 = new GeoTrd(base1/2+epsilon, epsilon, length/2, length/2, height1/2);
1984  GeoTrd *trd2 = new GeoTrd(epsilon, base2/2+epsilon, length/2, length/2, height2/2);
1985 
1986  double gamma = atan((base2/2+epsilon)*2/height2);
1987  double r = sqrt((base2/2+epsilon)*(base2/2+epsilon) + height2*height2/4);
1988  GeoTrf::Transform3D xForm=GeoTrf::Translate3D(r*sin(sign*(gamma-rot)),0,height1/2-r*cos(gamma-rot))*GeoTrf::RotateY3D(sign*rot);
1989  const GeoShape & sShell = (*trd1).add((*trd2)<<xForm);
1990 
1991  // We now have the shape we want. We only have left to transform
1992  // its position to where we want it.
1993  //
1994  // First, the actual positions of the four corners of
1995  // the constructed shape.
1996  GeoTrf::Vector2D actualCorner1, actualCorner2, actualCorner3, actualCorner4;
1997  actualCorner1 = corner1;
1998  actualCorner2 = corner1 + GeoTrf::Vector2D(0,base1);
1999  if (sign==1) {
2000  actualCorner4 = corner1 + GeoTrf::Vector2D(height1,base1/2);
2001  actualCorner3 = actualCorner4 + GeoTrf::Vector2D(-base2*sin(rot),base2*cos(rot));
2002  } else {
2003  actualCorner3 = corner1 + GeoTrf::Vector2D(height1,base1/2);
2004  actualCorner4 = actualCorner3 + GeoTrf::Vector2D(-base2*sin(rot),-base2*cos(rot));
2005  }
2006  // The center of our shape is at
2007  GeoTrf::Vector2D center= corner1 + GeoTrf::Vector2D(height1/2,base1/2);
2008 
2009  // Let us turn the whole module
2010  double modRot = (-delta12).phi()-GeoTrf::Vector2D(0,1).phi();
2011 
2012  // std::cout << "TK: modRot : "<< modRot/GeoModelKernelUnits::degree<<" degrees"<<std::endl;
2013  rotate(modRot,actualCorner1);
2014  rotate(modRot,actualCorner2);
2015  rotate(modRot,actualCorner3);
2016  rotate(modRot,actualCorner4);
2017  rotate(modRot,center);
2018 
2019  // Finally, the shape is moved where it fits best with the original corner coordinates.
2020 
2021  GeoTrf::Vector2D displacement = 0.25*( (corner1+corner2+corner3+corner4) - (actualCorner1+actualCorner2+actualCorner3+actualCorner4) );
2022  // .. << ::DEBUG << std::cout << "TK: makeModule : moving a total of (micrometer) " << displacement.mag()/GeoModelKernelUnits::micrometer<< std::endl;
2023  // std::cout << "TK: makeModule : moving due to 1 (micrometer) " << 0.25*(corner1-actualCorner1).mag()/GeoModelKernelUnits::micrometer<< std::endl;
2024  // std::cout << "TK: makeModule : moving due to 2 (micrometer) " << 0.25*(corner2-actualCorner2).mag()/GeoModelKernelUnits::micrometer<< std::endl;
2025  // std::cout << "TK: makeModule : moving due to 3 (micrometer) " << 0.25*(corner3-actualCorner3).mag()/GeoModelKernelUnits::micrometer<< std::endl;
2026  // std::cout << "TK: makeModule : moving due to 4 (micrometer) " << 0.25*(corner4-actualCorner4).mag()/GeoModelKernelUnits::micrometer<< std::endl;
2027  center += displacement;
2028  actualCorner1 += displacement;
2029  actualCorner2 += displacement;
2030  actualCorner3 += displacement;
2031  actualCorner4 += displacement;
2032 
2033  // GeoTrf::Vector2D remainingOffset = -0.25*( (corner1+corner2+corner3+corner4) - (actualCorner1+actualCorner2+actualCorner3+actualCorner4) );
2034  // std::cout << "TK: makeModule : remaining total offset (should be zero) (micrometer) " << remainingOffset.mag()/GeoModelKernelUnits::micrometer<< std::endl;
2035  // std::cout << "TK: makeModule : 1 remaining offset (micrometer) " << (corner1-actualCorner1).mag()/GeoModelKernelUnits::micrometer<< std::endl;
2036  // std::cout << "TK: makeModule : 2 remaining offset (micrometer) " << (corner2-actualCorner2).mag()/GeoModelKernelUnits::micrometer<< std::endl;
2037  // std::cout << "TK: makeModule : 3 remaining offset (micrometer) " << (corner3-actualCorner3).mag()/GeoModelKernelUnits::micrometer<< std::endl;
2038  // std::cout << "TK: makeModule : 4 remaining offset (micrometer) " << (corner4-actualCorner4).mag()/GeoModelKernelUnits::micrometer<< std::endl;
2039 
2040  // The final positioning includes a few 90deg rotations because the axis's in the GeoTrd's are different from the actual axis's.
2041  modulePosition = GeoTrf::TranslateY3D(center.y())*GeoTrf::TranslateX3D(center.x())*GeoTrf::RotateZ3D(90.0*GeoModelKernelUnits::deg)*GeoTrf::RotateX3D(90.0*GeoModelKernelUnits::deg)*GeoTrf::RotateY3D(modRot);
2042 
2043  return &sShell;
2044 }
2046 
2047 
2048 
2050 
2051 //
2052 GeoPhysVol * TRTDetectorFactory_Full::makeStraw(bool hasLargeDeadRegion, ActiveGasMixture gasMixture) {
2053 
2054  double lengthOfInnerDeadRegion= hasLargeDeadRegion ? m_data->barrelLengthOfLargeDeadRegion : m_data->lengthOfDeadRegion ;
2055  double lengthOfActiveGas = (m_data->barrelLengthOfStraw-m_data->barrelLengthOfTwister)/2.0 - m_data->lengthOfDeadRegion - lengthOfInnerDeadRegion;
2056  double posA = (lengthOfActiveGas + m_data->barrelLengthOfTwister) / 2. + lengthOfInnerDeadRegion; // middle of lengthOfActiveGas
2057  double posInnerDeadRegion = ( m_data->barrelLengthOfTwister + lengthOfInnerDeadRegion ) / 2;
2058 
2059  // Straws:
2060  GeoTube *sHole = new GeoTube(0,m_data->barrelOuterRadiusOfStrawHole, m_data->barrelLengthOfStraw/2.0);
2061  GeoLogVol *lHole = new GeoLogVol("Hole", sHole, m_materialManager->getMaterial("trt::CO2"));
2062  GeoPhysVol *pHole = new GeoPhysVol(lHole);
2063 
2064  // Straws:
2065  GeoTube *sStraw = new GeoTube(0,m_data->outerRadiusOfStraw, m_data->barrelLengthOfStraw/2.0);
2066  GeoLogVol *lStrawMixed = new GeoLogVol("StrawM", sStraw, m_materialManager->getMaterial("trt::Straw"));
2067  GeoPhysVol *pStrawMixed = new GeoPhysVol(lStrawMixed);
2068 
2069  // Dead regions:
2070  GeoShape *sDeadRegion = new GeoTube(m_data->outerRadiusOfWire , m_data->innerRadiusOfStraw , m_data->lengthOfDeadRegion/2 );
2071  GeoLogVol *lDeadRegion = nullptr;
2072  if (gasMixture == GM_ARGON)
2073  lDeadRegion = new GeoLogVol("DeadRegion_Ar", sDeadRegion, m_materialManager->getMaterial("trt::ArCO2O2"));
2074  else if (gasMixture == GM_KRYPTON)
2075  lDeadRegion = new GeoLogVol("DeadRegion_Kr", sDeadRegion, m_materialManager->getMaterial("trt::KrCO2O2"));
2076  else
2077  lDeadRegion = new GeoLogVol("DeadRegion", sDeadRegion, m_materialManager->getMaterial((m_useOldActiveGasMixture ? "trt:XeCO2CF4" : "trt::XeCO2O2")));
2078  GeoPhysVol *pDeadRegion = new GeoPhysVol(lDeadRegion);
2079 
2080  // InnerDeadRegions, part II:
2081  GeoShape * sInnerDeadRegion = new GeoTube(m_data->outerRadiusOfWire , m_data->innerRadiusOfStraw, lengthOfInnerDeadRegion/2 );
2082  GeoLogVol * lInnerDeadRegion = nullptr;
2083  if (gasMixture == GM_ARGON)
2084  lInnerDeadRegion = new GeoLogVol("InnerDeadRegion_Ar", sInnerDeadRegion, m_materialManager->getMaterial("trt::ArCO2O2"));
2085  else if(gasMixture == GM_KRYPTON)
2086  lInnerDeadRegion = new GeoLogVol("InnerDeadRegion_Kr", sInnerDeadRegion, m_materialManager->getMaterial("trt::KrCO2O2"));
2087  else
2088  lInnerDeadRegion = new GeoLogVol("InnerDeadRegion", sInnerDeadRegion, m_materialManager->getMaterial((m_useOldActiveGasMixture ? "trt:XeCO2CF4" : "trt::XeCO2O2")));
2089  GeoPhysVol* pInnerDeadRegion = new GeoPhysVol(lInnerDeadRegion);
2090 
2091  // Twisters:
2092  GeoShape *sTwister = new GeoTube(m_data->outerRadiusOfWire , m_data->innerRadiusOfStraw, m_data->barrelLengthOfTwister/2);
2093  GeoLogVol *lTwister = new GeoLogVol("Twister", sTwister, m_materialManager->getMaterial("trt::Twister"));
2094  GeoPhysVol *pTwister = new GeoPhysVol(lTwister);
2095 
2096  // Wires:
2097  GeoShape *sWire = new GeoTube( 0,m_data->outerRadiusOfWire,m_data->barrelLengthOfStraw/2.0);
2098  GeoLogVol *lWire = new GeoLogVol("Wire", sWire, m_materialManager->getMaterial("trt::Wire"));
2099  GeoPhysVol *pWire = new GeoPhysVol(lWire);
2100 
2101  // NB please see comments in TRT_BarrelElement::getAbsoluteTransform before re-organizing
2102  // the next few paragraphs!!.
2103 
2104  // Gas for mixed straws, part I:
2105  GeoTube *sGasMA = new GeoTube(m_data->outerRadiusOfWire , m_data->innerRadiusOfStraw,lengthOfActiveGas/2.0);
2106  GeoLogVol * lGasMA = nullptr;
2107  if (gasMixture == GM_ARGON)
2108  lGasMA = new GeoLogVol("GasMA_Ar", sGasMA, m_materialManager->getMaterial("trt::ArCO2O2"));
2109  else if (gasMixture == GM_KRYPTON)
2110  lGasMA = new GeoLogVol("GasMA_Kr", sGasMA, m_materialManager->getMaterial("trt::KrCO2O2"));
2111  else
2112  lGasMA = new GeoLogVol("GasMA", sGasMA, m_materialManager->getMaterial((m_useOldActiveGasMixture ? "trt:XeCO2CF4" : "trt::XeCO2O2")));
2113  GeoNameTag *nGasMAPos = new GeoNameTag("GasMAPos");
2114  GeoTransform *xGasMAPos = new GeoTransform(GeoTrf::RotateY3D(M_PI)*GeoTrf::TranslateZ3D(-posA));//the rotation of pi is to... digitization (TK)
2115  GeoNameTag *nGasMANeg = new GeoNameTag("GasMANeg");
2116  GeoTransform *xGasMANeg = new GeoTransform(GeoTrf::TranslateZ3D(-posA));
2117  GeoPhysVol *pGasMA = new GeoPhysVol(lGasMA);
2118 
2119  // Assemble gas within straws
2120  GeoSerialIdentifier *id = new GeoSerialIdentifier(0);
2121  pStrawMixed->add(id);
2122  pStrawMixed->add(nGasMANeg);
2123  pStrawMixed->add(xGasMANeg);
2124  pStrawMixed->add(pGasMA);
2125  pStrawMixed->add(nGasMAPos);
2126  pStrawMixed->add(xGasMAPos);
2127  pStrawMixed->add(pGasMA);
2128 
2129  // Outer Dead region for mixed straws, part II:
2130  GeoSerialDenominator *nDeadMA = new GeoSerialDenominator("DeadRegionL");
2131  GeoTransform *xDeadPosMA = new GeoTransform(GeoTrf::TranslateZ3D(+(m_data->barrelLengthOfStraw-m_data->lengthOfDeadRegion)/2.0));
2132  GeoTransform *xDeadNegMA = new GeoTransform(GeoTrf::TranslateZ3D(-(m_data->barrelLengthOfStraw-m_data->lengthOfDeadRegion)/2.0));
2133 
2134  // Assemble dead regions within straws:
2135  pStrawMixed->add(nDeadMA);
2136  pStrawMixed->add(xDeadPosMA);
2137  pStrawMixed->add(pDeadRegion);
2138  pStrawMixed->add(xDeadNegMA);
2139  pStrawMixed->add(pDeadRegion);
2140 
2141  // InnerDeadRegions, part III:
2142  GeoSerialDenominator *nInnerDeadMA = new GeoSerialDenominator("InnerDeadRegionL");
2143  GeoTransform *xInnerDeadPosMA = new GeoTransform(GeoTrf::TranslateZ3D(+posInnerDeadRegion));
2144  GeoTransform *xInnerDeadNegMA = new GeoTransform(GeoTrf::TranslateZ3D(-posInnerDeadRegion));
2145  // add to mixedStraw:
2146  pStrawMixed->add(nInnerDeadMA);
2147  pStrawMixed->add(xInnerDeadPosMA);
2148  pStrawMixed->add(pInnerDeadRegion);
2149  pStrawMixed->add(xInnerDeadNegMA);
2150  pStrawMixed->add(pInnerDeadRegion);
2151 
2152  // Assemble twisters within straws.
2153  GeoNameTag *nTwister = new GeoNameTag("TwisterM");
2154  pStrawMixed->add(nTwister);
2155  pStrawMixed->add(pTwister);
2156 
2157  // Assemble wires within straws.
2158  GeoNameTag *nWire = new GeoNameTag("WireM");
2159  pStrawMixed->add(nWire);
2160  pStrawMixed->add(pWire);
2161 
2162  pHole->add(pStrawMixed);
2163 
2164  return pHole;
2165 }
2167 
2168 
2169 
2171 //
2172 //GeoFullPhysVol * TRTDetectorFactory_Full::makeStrawPlane(size_t w) const {
2173 GeoFullPhysVol * TRTDetectorFactory_Full::makeStrawPlane(size_t w, ActiveGasMixture gasMixture) {
2174  // -----------------------------------------------------------------------------------//
2175  // //
2176  // There are twelve straw planes; however there are only two kinds, one for sector //
2177  // A & B, and one for sector C. We call the first "type 1" and the second "type 2" //
2178  // In order to economize, we shall only create two planes. //
2179  // -----------------------------------------------------------------------------------//
2180 
2181  size_t nstraws=0;
2182 
2183  //A and B wheels have similar straw planes, but the C wheels are different.
2184  // const size_t firstIndexOfC = 15; //hardcoded
2185  const size_t firstIndexOfC = 14; //hardcoded
2186 
2187  unsigned iplane = 0;
2188  if (gasMixture == GM_ARGON) {
2189  iplane = 1;
2190  }
2191  else if (gasMixture == GM_KRYPTON) {
2192  iplane = 2;
2193  }
2194 
2195  if (w>=firstIndexOfC) {
2196  if (m_type2Planes[iplane] != nullptr) {
2197  return m_type2Planes[iplane];
2198  }
2199  nstraws=m_data->endcapNumberOfStrawsInStrawLayer_CWheels;
2200  }
2201  else {
2202  if (m_type1Planes[iplane] != nullptr) {
2203  return m_type1Planes[iplane];
2204  }
2205  nstraws=m_data->endcapNumberOfStrawsInStrawLayer_AWheels;
2206  //Check here that (m_data->endcapNumberOfStrawsInStrawLayer_AWheels == m_data->endcapNumberOfStrawsInStrawLayer_BWheels) !!
2207  }
2208 
2209  double MultiplierForStrawLength = 0.999;//TK: update... to avoid conflicts? should be 0.9999??
2210 
2211  double ldead = m_data->lengthOfDeadRegion;
2212  double r0 = m_data->outerRadiusOfWire;
2213  double r1 = m_data->innerRadiusOfStraw;
2214  double r2 = m_data->outerRadiusOfStraw;
2215 
2216  double R0, R1;
2217  if (w >= firstIndexOfC) {
2218  //C wheels:
2219  R0 = m_data->endcapOuterRadiusOfInnerSupport_wheelC;
2220  R1 = m_data->endcapInnerRadiusOfOuterSupport_wheelC;
2221  } else {
2222  //A and B wheels:
2223  R0 = m_data->endcapOuterRadiusOfInnerSupport_wheelAB;
2224  R1 = m_data->endcapInnerRadiusOfOuterSupport_wheelAB;
2225  }
2226 
2227  double Length = (R1-R0)*MultiplierForStrawLength;//TK update
2228  double pos = 0.5*(R0+R1);
2229 
2230 
2231  GeoFullPhysVol *pStrawPlane=nullptr;//TK update
2232  GeoTube *sStrawPlane = new GeoTube(R0,R1,r2);
2233  GeoLogVol *lStrawPlane = new GeoLogVol("StrawPlane", sStrawPlane, m_materialManager->getMaterial("trt::CO2"));
2234  pStrawPlane = new GeoFullPhysVol(lStrawPlane); //TK update
2235 
2236 
2237  GeoTube *sStraw = new GeoTube( 0, r2, Length/2.0);
2238  GeoLogVol *lStraw = new GeoLogVol("Straw",sStraw, m_materialManager->getMaterial("trt::Straw"));
2239  GeoPhysVol *pStraw = new GeoPhysVol(lStraw);
2240 
2241  // Positioning of straws :
2242  double dphi = 2*M_PI/ nstraws;
2243  GeoTrf::RotateZ3D Rz(1.0);// Radians!
2244  GeoTrf::TranslateX3D Tx(1.0);// MM! TK: actually this doesnt need to be interpreted as mm? Just as a dimensionless 1. (i guess)
2245  GeoTrf::TranslateY3D Ty(1.0);// MM!
2246  Variable i;
2247  Sin sin;
2248  Cos cos;
2249  TRANSFUNCTION tx = Pow(Tx,pos*cos(dphi*i))*Pow(Ty,pos*sin(dphi*i))*Pow(Rz,dphi*i)*GeoTrf::RotateY3D(-90*GeoModelKernelUnits::deg);
2250  GeoSerialTransformer *serialTransformer=new GeoSerialTransformer(pStraw, &tx, nstraws);
2251  pStrawPlane->add(new GeoSerialIdentifier(0));
2252  pStrawPlane->add(serialTransformer);
2253 
2254  // Give this parameterization also to the readout geometry:
2255  if (w<firstIndexOfC) {
2258  }
2259  else {
2261  }
2262 
2263  // Gas :
2264  // (Function TRTConstructionOfTube::ConstructAndPosition #2)
2265  GeoTube *sGas = new GeoTube (r0,r1,(Length-2*ldead)/2);
2266  GeoLogVol *lGas = nullptr;
2267  if (gasMixture == GM_ARGON)
2268  lGas = new GeoLogVol("Gas_Ar", sGas, m_materialManager->getMaterial("trt::ArCO2O2"));
2269  else if (gasMixture == GM_KRYPTON)
2270  lGas = new GeoLogVol("Gas_Kr", sGas, m_materialManager->getMaterial("trt::KrCO2O2"));
2271  else
2272  lGas = new GeoLogVol("Gas", sGas, m_materialManager->getMaterial((m_useOldActiveGasMixture ? "trt::XeCO2CF4" : "trt::XeCO2O2")));
2273  GeoPhysVol *pGas = new GeoPhysVol(lGas);
2274  pStraw->add(pGas);
2275 
2276  // Dead region :
2277  GeoTube *sDeadRegion = new GeoTube(r0,r1,ldead/2);
2278  GeoLogVol *lDeadRegion = nullptr;
2279  if (gasMixture == GM_ARGON)
2280  lDeadRegion = new GeoLogVol("DeadRegion_Ar",sDeadRegion,m_materialManager->getMaterial("trt::ArCO2O2"));
2281  else if (gasMixture == GM_KRYPTON)
2282  lDeadRegion = new GeoLogVol("DeadRegion_Kr",sDeadRegion,m_materialManager->getMaterial("trt::KrCO2O2"));
2283  else
2284  lDeadRegion = new GeoLogVol("DeadRegion",sDeadRegion,m_materialManager->getMaterial((m_useOldActiveGasMixture ? "trt::XeCO2CF4" : "trt::XeCO2O2")));
2285  GeoPhysVol *pDeadRegion = new GeoPhysVol(lDeadRegion);
2286 
2287  GeoTransform *xDeadPos = new GeoTransform(GeoTrf::TranslateZ3D(+(Length/2-ldead/2)));
2288  GeoTransform *xDeadNeg = new GeoTransform(GeoTrf::TranslateZ3D(-(Length/2-ldead/2)));
2289  pStraw->add(xDeadPos);
2290  pStraw->add(pDeadRegion);
2291  pStraw->add(xDeadNeg);
2292  pStraw->add(pDeadRegion);
2293 
2294 
2295  // Wire :
2296  GeoTube *sWire = new GeoTube( 0, r0, Length/2);
2297  GeoLogVol *lWire = new GeoLogVol("Wire", sWire, m_materialManager->getMaterial("trt::Wire"));
2298  GeoPhysVol *pWire = new GeoPhysVol(lWire);
2299  pStraw->add(pWire);
2300 
2301  if (w>=firstIndexOfC) {
2302  m_type2Planes[iplane] = pStrawPlane;
2303  }
2304  else {
2305  m_type1Planes[iplane] = pStrawPlane;
2306  }
2307  return pStrawPlane;
2308 
2309 }
2310 
2311 
2313  {
2314  ActiveGasMixture return_agm = GM_XENON;
2315  if (m_strawsvcavailable && m_doArgon && (strawStatusHT == TRTCond::StrawStatus::Dead ||
2316  strawStatusHT == TRTCond::StrawStatus::Argon))
2317  return_agm = GM_ARGON;
2318  else if (m_strawsvcavailable && m_doKrypton && (strawStatusHT == TRTCond::StrawStatus::Krypton))
2319  return_agm = GM_KRYPTON;
2320  else if (m_strawsvcavailable && strawStatusHT != TRTCond::StrawStatus::Xenon &&
2321  strawStatusHT != TRTCond::StrawStatus::Good &&
2322  strawStatusHT != TRTCond::StrawStatus::Dead &&
2323  strawStatusHT != TRTCond::StrawStatus::Argon &&
2324  strawStatusHT != TRTCond::StrawStatus::Krypton &&
2325  strawStatusHT != TRTCond::StrawStatus::EmulateArgon &&
2326  strawStatusHT != TRTCond::StrawStatus::EmulateKrypton)
2327  {
2328  msg(MSG::FATAL) << "Unexpected StatusHT value: " << strawStatusHT << endmsg;
2329  throw std::runtime_error("Unexpected StatusHT value");
2330  }
2331  return return_agm;
2332  }
2333 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
cmd-l1calo-dq-test.xx
xx
Definition: cmd-l1calo-dq-test.py:16
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:674
fillPileUpNoiseLumi.current
current
Definition: fillPileUpNoiseLumi.py:52
TRT_DetDescrDB_ParameterInterface.h
InDetDD::TRT_DetectorManager::manageBarrelElement
void manageBarrelElement(TRT_BarrelElement *barrel)
Definition: TRT_DetectorManager.cxx:89
InDetDD::TRT_DetectorManager::conditions
const TRT_Conditions * conditions() const
Conditions interface (mostly for internal use):-------------------------—.
Definition: TRT_DetectorManager.cxx:486
magn
double magn(GeoTrf::Vector2D &vector)
Definition: TRTDetectorFactory_Full.cxx:74
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:500
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDetDD::TRT_DetectorManager::addAlignableTransform
void addAlignableTransform(int level, const Identifier &id, GeoAlignableTransform *transform, const GeoVFullPhysVol *child=0, const GeoVFullPhysVol *frameVol=0)
Add alignable transforms: GeoModel/CLHEP based.
Definition: TRT_DetectorManager.cxx:273
InDetDD::TRT_BarrelElement
Definition: TRT_BarrelElement.h:43
InDetDD::InDetDetectorManager::addSpecialFolder
void addSpecialFolder(const std::string &key)
Definition: InDetDetectorManager.cxx:71
TRTDetectorFactory_Full::GM_KRYPTON
@ GM_KRYPTON
Definition: TRTDetectorFactory_Full.h:67
TRTDetectorFactory_Full::m_doArgon
bool m_doArgon
Definition: TRTDetectorFactory_Full.h:98
TRT_DetDescrDB_ParameterInterface
Definition: TRT_DetDescrDB_ParameterInterface.h:16
TRTDetectorFactory_Full::m_alignable
bool m_alignable
Definition: TRTDetectorFactory_Full.h:95
rotate
void rotate(double angler, GeoTrf::Vector2D &vector)
Definition: TRTDetectorFactory_Full.cxx:58
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
InDetDD::TRT_DetectorManager::setEndcapDescriptor
void setEndcapDescriptor(const TRT_EndcapDescriptor *endcapDescriptor)
Definition: TRT_DetectorManager.cxx:568
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:18
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PlotCalibFromCool.yy
yy
Definition: PlotCalibFromCool.py:714
InDetDD::TRT_EndcapElement::setNextInZ
void setNextInZ(const TRT_EndcapElement *element)
Set Next in Z.
Definition: TRT_EndcapElement.cxx:88
InDetDD::TRT_EndcapDescriptor::innerRadius
double & innerRadius()
The inner radius:
Definition: TRT_EndcapDescriptor.cxx:49
TRTDetectorFactory_Full::TRTDetectorFactory_Full
TRTDetectorFactory_Full(InDetDD::AthenaComps *athenaComps, const ITRT_StrawStatusSummaryTool *sumTool, bool useOldActiveGasMixture, bool DC2CompatibleBarrelCoordinates, bool alignable, bool doArgon, bool doKrypton, bool useDynamicAlignmentFolders)
Definition: TRTDetectorFactory_Full.cxx:80
GeoNodePtr.h
InDetDD::timedependent_run2
@ timedependent_run2
Definition: InDetDD_Defs.h:19
TRTCond::StrawStatusMultChanContainer
Definition: StrawStatusMultChanContainer.h:19
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
InDetDD::TRT_DetectorManager::getBarrelElement
const TRT_BarrelElement * getBarrelElement(unsigned int positive, unsigned int moduleIndex, unsigned int phiIndex, unsigned int strawLayerIndex) const
Access Barrel Elements:---------------—(Fast)-------------------------—.
Definition: TRT_DetectorManager.cxx:100
InDetDD::TRT_DetectorManager::setBarrelTransformField
void setBarrelTransformField(size_t i, const GeoXF::Function *field)
Definition: TRT_DetectorManager.cxx:192
InDetDD::AthenaComps
Class to hold various Athena components.
Definition: InDetDDAthenaComps.h:21
InDetDD::TRT_BarrelDescriptor
Definition: TRT_BarrelDescriptor.h:40
InDetDD::TRT_Numerology::setNBarrelLayers
void setNBarrelLayers(unsigned int module, unsigned int nLayers)
Definition: TRT_Numerology.cxx:25
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
TRTDetectorFactory_Full::GM_XENON
@ GM_XENON
Definition: TRTDetectorFactory_Full.h:66
M_PI
#define M_PI
Definition: ActiveFraction.h:11
InDetDD::TRT_EndcapElement
Definition: TRT_EndcapElement.h:43
TRTDetectorFactory_Full::GM_ARGON
@ GM_ARGON
Definition: TRTDetectorFactory_Full.h:68
deg
#define deg
Definition: SbPolyhedron.cxx:17
InDetDD::InDetDetectorManager::setVersion
void setVersion(const Version &version)
Definition: InDetDetectorManager.cxx:43
InDetDD::TRT_Numerology::setNEndcapLayers
void setNEndcapLayers(unsigned int wheel, unsigned int nLayers)
Definition: TRT_Numerology.cxx:29
InDetDD::Version
Definition: Version.h:24
GeoNodePtr
GeoIntrusivePtr< T > GeoNodePtr
Definition: GeoNodePtr.h:12
InDetDD::TRT_EndcapDescriptor::nStraws
unsigned int & nStraws()
The number of straws in a module:
Definition: TRT_EndcapDescriptor.cxx:33
InDetDD::static_run1
@ static_run1
Definition: InDetDD_Defs.h:19
ExtraMaterial.h
TRT_ID::barrel_ec_id
Identifier barrel_ec_id(int barrel_ec) const
For +/-barrel or +/-endcap id.
Definition: TRT_ID.h:417
TRTDetectorFactory_Full::m_type1Planes
GeoFullPhysVol * m_type1Planes[3]
Definition: TRTDetectorFactory_Full.h:102
TRTDetectorFactory_Full::makeStraw
GeoPhysVol * makeStraw(bool hasLargeDeadRegion=false, ActiveGasMixture gasMixture=GM_XENON)
Definition: TRTDetectorFactory_Full.cxx:2052
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
InDetDD::global
@ global
Definition: InDetDD_Defs.h:16
TRTDetectorFactory_Full::m_materialManager
std::unique_ptr< InDetMaterialManager > m_materialManager
Definition: TRTDetectorFactory_Full.h:90
TRTDetectorFactory_Full::m_data
std::unique_ptr< TRTParameterInterface > m_data
Definition: TRTDetectorFactory_Full.h:91
TRTDetectorFactory_Full::DecideGasMixture
ActiveGasMixture DecideGasMixture(int strawStatusHT)
Definition: TRTDetectorFactory_Full.cxx:2312
TRTDetectorFactory_Full::makeModule
const GeoShape * makeModule(double length, const GeoTrf::Vector2D &corner1, const GeoTrf::Vector2D &corner2, const GeoTrf::Vector2D &corner3, const GeoTrf::Vector2D &corner4, GeoTrf::Transform3D &absolutePosition, double shrinkDist=0) const
Definition: TRTDetectorFactory_Full.cxx:1933
InDetDD::TRT_DetectorManager::barrelTransformField
const GeoXF::Function * barrelTransformField(size_t i) const
Definition: TRT_DetectorManager.cxx:197
InDetDD::DetectorFactoryBase::msg
MsgStream & msg(MSG::Level lvl) const
Definition: InDetDetectorFactoryBase.h:37
x
#define x
InDetDD::InDetDetectorManager::addAlignFolderType
void addAlignFolderType(const AlignFolderType alignfolder)
Definition: InDetDetectorManager.cxx:81
TRTCond::StrawStatus::Dead
@ Dead
Definition: StrawStatus.h:18
InDetDD::TRT_BarrelElement::setNextInPhi
void setNextInPhi(const TRT_BarrelElement *element)
Sets the next-in-phi detector.
Definition: TRT_BarrelElement.cxx:77
TRTDetectorFactory_Full::m_useOldActiveGasMixture
bool m_useOldActiveGasMixture
Definition: TRTDetectorFactory_Full.h:93
ITRT_StrawStatusSummaryTool::getStatusHT
virtual int getStatusHT(const Identifier, const EventContext &) const =0
InDetDD::ExtraMaterial::add
void add(GeoPhysVol *parent, const std::string &parentName, double zPos=0)
Definition: ExtraMaterial.cxx:42
pi
#define pi
Definition: TileMuonFitter.cxx:65
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
TRTDetectorFactory_Full::m_DC2CompatibleBarrelCoordinates
bool m_DC2CompatibleBarrelCoordinates
Definition: TRTDetectorFactory_Full.h:94
InDetDD::TRT_BarrelElement::setNextInR
void setNextInR(const TRT_BarrelElement *element)
Sets the next-in-r detector.
Definition: TRT_BarrelElement.cxx:87
TRTCond::StrawStatus::EmulateKrypton
@ EmulateKrypton
Definition: StrawStatus.h:18
InDetDD::TRT_EndcapDescriptor
class TRT_EndcapDescriptor
Definition: TRT_EndcapDescriptor.h:30
InDetDD::TRT_DetectorManager::addTreeTop
void addTreeTop(const PVLink &)
Definition: TRT_DetectorManager.cxx:84
GeoGenfun::ArrayFunction
Definition: ArrayFunction.h:16
InDetDD::TRT_DetectorManager::manageEndcapElement
void manageEndcapElement(TRT_EndcapElement *endcap)
Definition: TRT_DetectorManager.cxx:95
InDetDD::TRT_EndcapDescriptor::setStrawTransformField
void setStrawTransformField(const GeoXF::Function *xf, size_t offsetInto)
Sets the transform field for straws and offset.
Definition: TRT_EndcapDescriptor.cxx:28
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
InDetDD::TRT_Numerology::setNBarrelRings
void setNBarrelRings(unsigned int ring)
Definition: TRT_Numerology.cxx:33
Version.h
InDetDD::TRT_Numerology::getNEndcapWheels
unsigned int getNEndcapWheels() const
TRTDetectorFactory_Full::getDetectorManager
virtual const InDetDD::TRT_DetectorManager * getDetectorManager() const override
Definition: TRTDetectorFactory_Full.cxx:107
TRTDetectorFactory_Full::create
virtual void create(GeoPhysVol *world) override
Definition: TRTDetectorFactory_Full.cxx:126
TRT_EndcapElement.h
TRT_DetDescrDB_ParameterInterface::scalingTable
IRDBRecordset_ptr scalingTable() const
Definition: TRT_DetDescrDB_ParameterInterface.h:31
TRT_EndcapDescriptor.h
InDetDD::TRT_DetectorManager::getNumerology
TRT_Numerology * getNumerology()
Access Numerological information:---------------------------------------—.
Definition: TRT_DetectorManager.cxx:43
TRTDetectorFactory_Full::m_sumTool
const ITRT_StrawStatusSummaryTool * m_sumTool
Definition: TRTDetectorFactory_Full.h:96
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
InDetDD_Defs.h
InDetDD::TRT_Numerology::setNEndcapWheels
void setNEndcapWheels(unsigned int wheel)
Definition: TRT_Numerology.cxx:41
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDetDD::TRT_DetectorManager::endcapTransformField
const GeoXF::Function * endcapTransformField(size_t i) const
Definition: TRT_DetectorManager.cxx:206
InDetDD::DetectorFactoryBase::detStore
StoreGateSvc * detStore()
Definition: InDetDetectorFactoryBase.h:27
TrigVtx::gamma
@ gamma
Definition: TrigParticleTable.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
python.SystemOfUnits.micrometer
float micrometer
Definition: SystemOfUnits.py:80
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:68
InDetDD::InDetDetectorManager::addFolder
void addFolder(const std::string &key)
Definition: InDetDetectorManager.cxx:66
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
TRTDetectorFactory_Full::ActiveGasMixture
ActiveGasMixture
Definition: TRTDetectorFactory_Full.h:65
TRT_PAI_physicsConstants::r0
const double r0
electron radius{cm}
Definition: TRT_PAI_physicsConstants.h:22
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
InDetDDAthenaComps.h
InDetDD::InDetDetectorManager::addGlobalFolder
void addGlobalFolder(const std::string &key)
Definition: InDetDetectorManager.cxx:76
TRT_BarrelDescriptor.h
InDetDD::TRT_Numerology::setNBarrelPhi
void setNBarrelPhi(unsigned int phi)
Definition: TRT_Numerology.cxx:37
InDetDD::TRT_Numerology::getNBarrelLayers
unsigned int getNBarrelLayers(unsigned int iMod) const
TRT_BarrelElement.h
ITRT_StrawStatusSummaryTool
Definition: ITRT_StrawStatusSummaryTool.h:27
TRTCond::StrawStatus::EmulateArgon
@ EmulateArgon
Definition: StrawStatus.h:18
TRTCond::StrawStatus::Good
@ Good
Definition: StrawStatus.h:18
InDetDD::TRT_DetectorManager::getEndcapElement
const TRT_EndcapElement * getEndcapElement(unsigned int positive, unsigned int wheelIndex, unsigned int strawLayerIndex, unsigned int phiIndex) const
Access Endcap Elements:---------------—(Fast)--------------------------—.
Definition: TRT_DetectorManager.cxx:116
InDetDD::TRT_EndcapDescriptor::startPhi
double & startPhi()
The starting phi (angular!!)
Definition: TRT_EndcapDescriptor.cxx:41
ArrayFunction.h
AtlasDetectorID::print_to_string
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:418
TRTCond::StrawStatus::Xenon
@ Xenon
Definition: StrawStatus.h:18
InDetDD::TRT_DetectorManager::setGasType
void setGasType(const ActiveGasType &)
Definition: TRT_DetectorManager.cxx:216
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
InDetDD::TRT_Numerology::setNEndcapPhi
void setNEndcapPhi(unsigned int phi)
Definition: TRT_Numerology.cxx:45
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Variable
Wrapper around a histogram which allows for some additional filling patterns and data manipulation.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/Variable.h:39
TRTDetectorFactory_Full::m_detectorManager
InDetDD::TRT_DetectorManager * m_detectorManager
Definition: TRTDetectorFactory_Full.h:89
InDetDD::TRT_DetectorManager::setIdHelper
void setIdHelper(const TRT_ID *idHelper, bool owns=true)
Get the ID helper: -----------------------------------------------------—.
Definition: TRT_DetectorManager.cxx:137
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
InDetDD::TRT_DetectorManager::oldgas
@ oldgas
Definition: TRT_DetectorManager.h:83
get_generator_info.version
version
Definition: get_generator_info.py:33
InDetDD::TRT_EndcapDescriptor::strawPitch
double & strawPitch()
The straw pitch (angular!!)
Definition: TRT_EndcapDescriptor.cxx:37
TRTDetectorFactory_Full::m_useDynamicAlignFolders
bool m_useDynamicAlignFolders
Definition: TRTDetectorFactory_Full.h:100
TRT_ID
Definition: TRT_ID.h:84
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:63
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::TRT_DetectorManager::newgas
@ newgas
Definition: TRT_DetectorManager.h:83
TRTDetectorFactory_Full::m_type2Planes
GeoFullPhysVol * m_type2Planes[3]
Definition: TRTDetectorFactory_Full.h:103
y
#define y
GeoGenfun
Definition: ArrayFunction.cxx:7
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::TRT_EndcapDescriptor::strawLength
double & strawLength()
Definition: TRT_EndcapDescriptor.cxx:45
DeMoScan.first
bool first
Definition: DeMoScan.py:534
InDetDD::TRT_DetectorManager::setEndcapTransformField
void setEndcapTransformField(size_t i, const GeoXF::Function *field)
Definition: TRT_DetectorManager.cxx:201
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
TRT_Numerology.h
ITRT_StrawStatusSummaryTool::getStrawStatusHTContainer
virtual const StrawStatusContainer * getStrawStatusHTContainer() const =0
InDetDD::TRT_Numerology::getNEndcapLayers
unsigned int getNEndcapLayers(unsigned int iWheel) const
TRTDetectorFactory_Full::m_strawsvcavailable
bool m_strawsvcavailable
Definition: TRTDetectorFactory_Full.h:97
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:198
InDetDD::InDetDetectorManager::addChannel
void addChannel(const std::string &key, int level, FrameType frame)
Alignment access.
Definition: InDetDetectorManager.cxx:56
test_pyathena.counter
counter
Definition: test_pyathena.py:15
InDetDD::ExtraMaterial
Definition: ExtraMaterial.h:23
TRTCond::StrawStatus::Argon
@ Argon
Definition: StrawStatus.h:18
StoreGateSvc.h
python.compressB64.c
def c
Definition: compressB64.py:93
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
TileDCSDataPlotter.tx
tx
Definition: TileDCSDataPlotter.py:880
TRTCond::StrawStatus::Krypton
@ Krypton
Definition: StrawStatus.h:18
InDetDD::DetectorFactoryBase::getAthenaComps
InDetDD::AthenaComps * getAthenaComps()
Definition: InDetDetectorFactoryBase.h:42
InDetDD::TRT_DetectorManager::setBarrelDescriptor
void setBarrelDescriptor(const TRT_BarrelDescriptor *barrelDescriptor)
Set TRT_Barrel/EndcapDescriptor pointer to the internal sets to delete them in the destructor.
Definition: TRT_DetectorManager.cxx:563
TRTDetectorFactory_Full.h
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106
TRT_ID::module_id
Identifier module_id(int barrel_ec, int phi_module, int layer_or_wheel) const
For an individual module phi sector.
Definition: TRT_ID.h:448
TRT_ID::straw_id
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
Definition: TRT_ID.h:581
TRTDetectorFactory_Full::makeStrawPlane
GeoFullPhysVol * makeStrawPlane(size_t w, ActiveGasMixture gasMixture=GM_XENON)
Definition: TRTDetectorFactory_Full.cxx:2173
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88
TRTDetectorFactory_Full::m_doKrypton
bool m_doKrypton
Definition: TRTDetectorFactory_Full.h:99
Identifier
Definition: IdentifierFieldParser.cxx:14