ATLAS Offline Software
GeoPixelCable.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GeoPixelCable.h"
6 #include "GeoModelKernel/GeoBox.h"
7 #include "GeoModelKernel/GeoLogVol.h"
8 #include "GeoModelKernel/GeoPhysVol.h"
9 #include "GeoModelKernel/GeoMaterial.h"
10 
11 #include <sstream>
12 #include <utility>
13 
16  GeoModelIO::ReadGeoModel* sqliteReader,
17  std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
18  std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX)
19  : GeoVPixelFactory(ddmgr, mgr, sqliteReader, std::move(mapFPV), std::move(mapAX)),
20  m_currentElement(-1)
21 {
23  if (m_elements.empty()) { // If no information for layer use layer 0 numbers.
24  fillElements(0, m_gmt_mgr->Phi());
25  }
26 }
27 
28 void
30 {
32  int biStaveType = m_gmt_mgr->PixelBiStaveType(layer, phiSector);
33 
34  for (int i = 0; i < nentries; i++) {
35  // bistave number
36  // 0 means both staves in bistave the same
37  // 1 means odd bistave
38  // 2 means even bistave
39  // If 0 then keep for all staves otherwise keep if odd/even correspond
40  int cableBiStaveNum = m_gmt_mgr->PixelCableBiStaveNum(i);
42  if (!cableBiStaveNum || ((cableBiStaveNum%2) == biStaveType%2)) {
43  m_elements.push_back(i);
44  }
45  }
46  }
47 }
48 
49 
50 GeoVPhysVol* GeoPixelCable::Build() {
51 
52  if (m_currentElement < 0){
53  std::cout << "ERROR: GeoPixelCableCurrent, current element not set." << std::endl;
54  return nullptr;
55  }
56 
57 
58  int tableIndex = m_elements[m_currentElement];
59  //std::cout << "GeoPixelCable: " << m_currentElement << ", " << tableIndex << std::endl;
60 
61  double zstart = m_gmt_mgr->PixelCableZStart(tableIndex);
62  double zend = m_gmt_mgr->PixelCableZEnd(tableIndex);
63  double length = std::abs(zend - zstart);
64  double width = m_gmt_mgr->PixelCableWidth(tableIndex);
65  double thickness = m_gmt_mgr->PixelCableThickness(tableIndex);
66  double weight = m_gmt_mgr->PixelCableWeight(tableIndex);
67  std::string label = m_gmt_mgr->PixelCableLabel(tableIndex);
68 
69  std::string matName = m_gmt_mgr->getMaterialName("Cable", m_gmt_mgr->GetLD());
70  const GeoMaterial* cableMat = m_mat_mgr->getMaterial(matName);
71 
72  // If weight supplied use it to calculate the required thickness
73  // otherwise use the suppled thickness
74  if (weight != 0) {
75  thickness = weight / (cableMat->getDensity() * length * width);
76  }
77 
78  const GeoBox* cableBox = new GeoBox(0.5*thickness,0.5*width,0.5*length);
79  std::string logName = "Cable";
80  std::ostringstream o;
81  o << m_gmt_mgr->getLD_Label() << label;
82  logName = logName+o.str();
83  //std::cout << logName << ": " << weight/Gaudi::Units::g << " g, " << thickness << std::endl;
84 
85  GeoLogVol* theCable = new GeoLogVol(logName,cableBox,cableMat);
86  GeoPhysVol* cablePhys = new GeoPhysVol(theCable);
87  return cablePhys;
88 }
89 
90 
92 
93  int tableIndex = m_elements[m_currentElement];
94  double zstart = m_gmt_mgr->PixelCableZStart(tableIndex);
95  double zend = m_gmt_mgr->PixelCableZEnd(tableIndex);
96  return 0.5*(zend + zstart);
97 }
98 
100  int tableIndex = m_elements[m_currentElement];
101  return m_gmt_mgr->PixelCableStackOffset(tableIndex);
102 
103 }
104 
GeoPixelCable::zpos
double zpos()
Definition: GeoPixelCable.cxx:91
GeoPixelCable::m_elements
std::vector< int > m_elements
Definition: GeoPixelCable.h:26
GeoPixelCable::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelCable.cxx:50
PixelGeometryManager::PixelCableZEnd
virtual double PixelCableZEnd(int index)=0
PixelGeometryManager
Definition: PixelGeometryManager.h:28
PixelGeometryManager::PixelCableStackOffset
virtual double PixelCableStackOffset(int index)=0
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
GeoPixelCable::fillElements
void fillElements(int layer, int phiSector)
Definition: GeoPixelCable.cxx:29
PixelGeometryManager::PixelCableLabel
virtual std::string PixelCableLabel(int index)=0
GeoPixelCable::m_currentElement
int m_currentElement
Definition: GeoPixelCable.h:25
GeoVPixelFactory::m_gmt_mgr
PixelGeometryManager * m_gmt_mgr
Definition: GeoVPixelFactory.h:43
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
PixelGeometryManager::PixelBiStaveType
virtual int PixelBiStaveType(int layer, int phi)=0
PixelGeometryManager::PixelCableWidth
virtual double PixelCableWidth(int index)=0
PlotCalibFromCool.nentries
nentries
Definition: PlotCalibFromCool.py:798
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
PixelGeometryManager::getLD_Label
virtual std::string getLD_Label()=0
PixelGeometryManager::PixelCableLayerNum
virtual int PixelCableLayerNum(int index)=0
PixelGeometryManager::PixelCableElements
virtual int PixelCableElements()=0
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
GeoVPixelFactory::m_mat_mgr
InDetMaterialManager * m_mat_mgr
Definition: GeoVPixelFactory.h:44
GeoPixelCable.h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
PixelGeometryManager::PixelCableZStart
virtual double PixelCableZStart(int index)=0
PixelGeometryManager::PixelCableWeight
virtual double PixelCableWeight(int index)=0
GeoVPixelFactory
This is the base class for all the pieces of the Pixel detector.
Definition: GeoVPixelFactory.h:31
PixelGeometryManager::getMaterialName
virtual std::string getMaterialName(const std::string &volumeName, int layerdisk=0, int typenum=0)=0
PixelGeometryManager::PixelCableBiStaveNum
virtual int PixelCableBiStaveNum(int index)=0
InDetMaterialManager::getMaterial
const GeoMaterial * getMaterial(const std::string &materialName)
Get material. First looks for locally defined material and if not found looks in GeoModel material ma...
Definition: InDetMaterialManager.cxx:96
GeoPixelCable::getStackOffset
double getStackOffset()
Definition: GeoPixelCable.cxx:99
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
PixelGeometryManager::PixelCableThickness
virtual double PixelCableThickness(int index)=0
PixelGeometryManager::GetLD
virtual int GetLD()=0
PixelGeometryManager::Phi
virtual int Phi()=0
GeoPixelCable::GeoPixelCable
GeoPixelCable(InDetDD::PixelDetectorManager *ddmgr, PixelGeometryManager *mgr, GeoModelIO::ReadGeoModel *sqliteReader, std::shared_ptr< std::map< std::string, GeoFullPhysVol * >> mapFPV, std::shared_ptr< std::map< std::string, GeoAlignableTransform * >> mapAX)
Definition: GeoPixelCable.cxx:14