ATLAS Offline Software
SCT_SkiPowerTape.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //
6 // 1st Feb 2005 D.Naito modified.
7 // 28th Mar 2005 S.Mima modified.
8 //
10 
12 
15 
16 #include "SCT_GeoModel/SCT_Ski.h"
19 
20 #include "GeoModelKernel/GeoBox.h"
21 #include "GeoModelKernel/GeoLogVol.h"
22 #include "GeoModelKernel/GeoPhysVol.h"
23 #include "GeoModelKernel/GeoNameTag.h"
24 #include "GeoModelKernel/GeoTransform.h"
25 #include "GeoModelKernel/GeoMaterial.h"
26 #include "GeoModelKernel/Units.h"
27 #include "GeoModelKernel/GeoDefinitions.h"
28 #include "GaudiKernel/SystemOfUnits.h"
29 #include <iostream>
30 #include <sstream>
31 #include <cmath>
32 
33 
35  const SCT_Ski * ski,
36  double length,
37  InDetDD::SCT_DetectorManager* detectorManager,
38  SCT_GeometryManager* geometryManager,
39  SCT_MaterialManager* materials) :
40  SCT_SharedComponentFactory(name, detectorManager, geometryManager, materials),
41  m_length(length), m_ski(ski)
42 {
43  getParameters();
45 }
46 
47 void
49 {
51 
52  // Width is the same as the width of a single powertape.
53  m_powerTapeThickness = parameters->powerTapeThickness();
54  m_width = parameters->powerTapeWidth();
55  m_powerTapeStartPointOffset = parameters->powerTapeStartPointOffset();
56 }
57 
58 
59 GeoVPhysVol *
61 {
62  // The power tapes are stacked going from the nearest interlink to the
63  // nearset edge of the dogleg.
64  //
65  // --- ---
66  // ------ ------
67  // --------- ---------
68 
69 
70  int nHalfModules = m_ski->modulesPerSki()/2;
71 
72  // Thickness of the stack.
73  m_thickness = nHalfModules * m_powerTapeThickness;
74 
75 
76  // This is a volume containing all the power tapes.
77  const GeoBox * skiPowerTapeShape = new GeoBox(0.5*m_thickness, 0.5*m_width, 0.5*m_length);
78  const GeoLogVol *skiPowerTapeLog =
79  new GeoLogVol(getName(), skiPowerTapeShape, m_materials->gasMaterial());
80  GeoPhysVol * skiPowerTape = new GeoPhysVol(skiPowerTapeLog);
81 
82  // Loop over modules in ski as we need their z positions.
83  for (int iModule = 0; iModule < m_ski->modulesPerSki(); iModule++) {
84 
85  // Position PowerTapes
86  // These run from the nearest interlink to the edge of the dogleg
87  double tapeLength, tapeMid, tapeStart, tapeEnd;
88 
89  // nPos is used to stack the power tapes. Modules closest to interlink are
90  // furthest from support. The positive and negative z positions are
91  // syGaudi::Units::mmetric. nPos = 5,4,3,2,1,0,0,1,2,3,4,5 for the 12 modules.
92  int nPos;
93 
94  // test sign of zpos to determine whether the tape runs to the
95  // high z end or low z end.
96 
97  if (m_ski->zPos(iModule) > 0) {
98 
99  // Tape runs from high z end to edge of dogleg. NB width of dogleg is in z-direction
100  tapeStart = m_ski->zPos(iModule) + m_ski->coolingBlockOffsetZ() + m_powerTapeStartPointOffset;
101  tapeEnd = 0.5 * m_length;
102 
103  // For 12 module: iModule = 6, 7, 8, ..., 11 --> nPos = 0, 1, 2, ..., 5
104  nPos = iModule - nHalfModules;
105 
106  } else {
107 
108  // Tape runs from low z end to edge of dogleg. NB width of dogleg is in z-direction
109  tapeStart = m_ski->zPos(iModule) + m_ski->coolingBlockOffsetZ() - m_powerTapeStartPointOffset;
110  tapeEnd = -0.5 * m_length;
111 
112  // For 12 module: iModule = 0, 1, 2, ..., 5 --> nPos = 5, 4, 3, ..., 0
113  nPos = nHalfModules - iModule - 1;
114 
115  }
116 
117  tapeLength = std::abs(tapeEnd - tapeStart);
118  tapeMid = 0.5 * (tapeEnd + tapeStart);
119 
120 
121  // Make sure that first half are negative and secand half are positive.
122  // Checking that nPos is >= 0 is equivalent to this.
123  if (nPos < 0) {
124  std::cout << "SCT_SkiPowerTape: Module position inconsistent with assumption that\n"
125  << " first half has z < 0 and second half has z > 0"
126  << std::endl;
127  }
128 
129  // Create the tape
130 
131  // Label tape with M# at end of string
132  SCT_PowerTape powerTape(getName()+"PowerTapeM"+intToString(iModule + 1), tapeLength,
134 
135  // Calculate x position of tape. This will depend on the module number.
136  // The reference point is the middle of the stack.
137  double xTapePos = - 0.5 * m_thickness +
138  (nPos + 0.5) * powerTape.thickness();
139  double yTapePos = 0;
140 
141 
142  // Position the tape
143  skiPowerTape->add(new GeoTransform(GeoTrf::Translate3D(xTapePos, yTapePos, tapeMid)));
144  skiPowerTape->add(powerTape.getVolume());
145 
146  }
147 
148  return skiPowerTape;
149 }
SCT_ComponentFactory::m_geometryManager
SCT_GeometryManager * m_geometryManager
Definition: SCT_ComponentFactory.h:42
SCT_PowerTape.h
SCT_MaterialManager
Definition: SCT_MaterialManager.h:21
InDetDD::SCT_DetectorManager
Definition: SCT_DetectorManager.h:49
SCT_Ski::coolingBlockOffsetZ
double coolingBlockOffsetZ() const
Definition: SCT_Ski.h:75
SCT_MaterialManager.h
SCT_SkiPowerTape::m_powerTapeStartPointOffset
double m_powerTapeStartPointOffset
Definition: SCT_SkiPowerTape.h:49
SCT_ComponentFactory::m_detectorManager
InDetDD::SCT_DetectorManager * m_detectorManager
Definition: SCT_ComponentFactory.h:41
SCT_SkiPowerTape.h
SCT_SkiPowerTape::m_thickness
double m_thickness
Definition: SCT_SkiPowerTape.h:41
SCT_SkiPowerTape::build
virtual GeoVPhysVol * build()
Definition: SCT_SkiPowerTape.cxx:60
SCT_SkiPowerTape::SCT_SkiPowerTape
SCT_SkiPowerTape(const std::string &name, const SCT_Ski *ski, double length, InDetDD::SCT_DetectorManager *detectorManager, SCT_GeometryManager *geometryManager, SCT_MaterialManager *materials)
Definition: SCT_SkiPowerTape.cxx:34
SCT_SharedComponentFactory::getVolume
GeoVPhysVol * getVolume()
Definition: SCT_ComponentFactory.h:67
SCT_MaterialManager::gasMaterial
const GeoMaterial * gasMaterial() const
Definition: SCT_MaterialManager.cxx:69
SCT_SkiPowerTape::getParameters
void getParameters()
Definition: SCT_SkiPowerTape.cxx:48
SCT_SkiPowerTape::m_width
double m_width
Definition: SCT_SkiPowerTape.h:40
SCT_GeometryManager::barrelParameters
const SCT_BarrelParameters * barrelParameters() const
Definition: SCT_GeometryManager.cxx:78
SCT_ComponentFactory::intToString
std::string intToString(int i) const
Definition: SCT_ComponentFactory.cxx:30
SCT_Ski.h
SCT_Ski
Definition: SCT_Ski.h:30
SCT_SkiPowerTape::m_powerTapeThickness
double m_powerTapeThickness
Definition: SCT_SkiPowerTape.h:42
SCT_ComponentFactory::m_materials
SCT_MaterialManager * m_materials
Definition: SCT_ComponentFactory.h:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SCT_SharedComponentFactory::m_physVolume
GeoVPhysVol * m_physVolume
Definition: SCT_ComponentFactory.h:70
SCT_Module.h
SCT_SkiPowerTape::m_ski
const SCT_Ski * m_ski
Definition: SCT_SkiPowerTape.h:45
SCT_Ski::zPos
double zPos(int i) const
Definition: SCT_Ski.h:52
SCT_BarrelParameters
Definition: SCT_BarrelParameters.h:12
SCT_BarrelParameters.h
SCT_SharedComponentFactory
Definition: SCT_ComponentFactory.h:56
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
SCT_PowerTape::thickness
double thickness() const
Definition: SCT_PowerTape.h:28
SCT_PowerTape
Definition: SCT_PowerTape.h:18
SCT_ComponentFactory::getName
const std::string & getName() const
Definition: SCT_ComponentFactory.h:35
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
SCT_SkiPowerTape::m_length
double m_length
Definition: SCT_SkiPowerTape.h:39
SCT_GeometryManager.h
SCT_GeometryManager
Definition: SCT_GeometryManager.h:25
SCT_Ski::modulesPerSki
int modulesPerSki() const
Definition: SCT_Ski.h:56