ATLAS Offline Software
GeoPixelDisk.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 "GeoPixelDisk.h"
6 #include "GeoPixelModule.h"
7 #include "GeoPixelDiskSupports.h"
8 #include "GeoPixelSiCrystal.h"
9 
11 
12 #include "GeoModelKernel/GeoTube.h"
13 #include "GeoModelKernel/GeoLogVol.h"
14 #include "GeoModelKernel/GeoNameTag.h"
15 #include "GeoModelKernel/GeoIdentifierTag.h"
16 #include "GeoModelKernel/GeoFullPhysVol.h"
17 #include "GeoModelKernel/GeoMaterial.h"
18 #include "GeoModelKernel/GeoTransform.h"
19 #include "GeoModelKernel/GeoAlignableTransform.h"
20 #include "GaudiKernel/SystemOfUnits.h"
21 
23 #include <sstream>
24 #include <utility>
25 
28  GeoModelIO::ReadGeoModel* sqliteReader,
29  std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
30  std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX)
31  : GeoVPixelFactory (ddmgr, mgr, sqliteReader, std::move(mapFPV), std::move(mapAX))
32 {
33 }
34 
35 GeoVPhysVol* GeoPixelDisk::Build( ) {
36 
37  int brl_ec=0;
38 
39  // Need to specify some eta. Assume all module the same
40  m_gmt_mgr->SetEta(0);
41  // angle between two adjacent modules on one side of the disk
42  // it is 360 deg / 24 modules = 15 deg
43  int nbECSector = m_gmt_mgr->PixelECNSectors1();
44  if(nbECSector==0){
45  return nullptr;
46  }
47 
48  std::ostringstream ostr;
49  ostr << m_gmt_mgr->GetLD();
50  const GeoLogVol* theDisk{nullptr};
51  if(!m_sqliteReader) {
52  //
53  // Dimensions from class methods.
54  //
55  double rmin = RMin();
56  double rmax = RMax();
57  double halflength = Thickness()*0.5;
58  const GeoMaterial* air = m_mat_mgr->getMaterial("std::Air");
59  const GeoTube* diskTube = new GeoTube(rmin,rmax,halflength);
60  theDisk = new GeoLogVol("Disk"+ostr.str(),diskTube,air);
61  }
62  //
63  // Define the Sensor to be used here, so it will be the same for all the disk
65  if(m_sqliteReader && m_gmt_mgr->isEndcap() ) brl_ec = 2*m_gmt_mgr->GetSide();
66  GeoFullPhysVol* diskPhys = m_sqliteReader==nullptr ? new GeoFullPhysVol(theDisk) : nullptr;
67  //
68  // Place the disk sectors (on both sides):
69  //
70  // Need to specify some eta. Assume all module the same
72  double zpos = m_gmt_mgr->PixelECSiDz1()*0.5;
73  double deltaPhi = 360.*Gaudi::Units::deg/ (float) nbECSector;
74  // This is the start angle of the even modules (3.75 deg):
75  double startAngle = deltaPhi*0.25;
76  // Start angle could eventually come from the database...
77  // double startAngle = m_gmt_mgr->PixelECStartPhi();
78 
79  // This is the radius of the center of the active sensor (also center of the module)
80  double moduleRadius = m_gmt_mgr->PixelDiskRMin() + 0.5*m_gmt_mgr->PixelBoardActiveLength();
81 
82  // for compatibility with older geometries we have to incorrectly rotate modules in endcap C
83  bool oldGeometry = (m_gmt_mgr->dbVersion() < 1);
84 
85  // In Global coordinate system (X,Y,Z):
86  //--------------------------------------
87  // (for reference see GWG's June 20, 2005 Pixel Offline Mtg presentation, p.4)
88  // The module has X axis (depth axis) out of the plane pointing
89  // towards the chips. Z axis is the eta direction. To place it on
90  // the disk we rotate 90 deg around Y. This leaves the depth axis
91  // pointing in the -ve Z direction. For the back of the disk this is
92  // the correct orientation. For the front of the disk we rotate
93  // 180 deg around X.
94 
95 
96 
97  // Looking from IP at module at ~12:00 (+ve global Y)
98  //
99  // For side A, Global axes:
100  //
101  // Y ^
102  // |
103  // |
104  // X<--x
105  //
106  // Z axis into page
107  //
108 
109  // Module on front of disk (closest to IP)
110  // MCC side
111  //
112  // 0 F ^z
113  // . . |
114  // . . |
115  // . . <-- x Module ref system (Hit frame)
116  // 7 8 y
117 
118  // Module on back of disk (furthest from IP)
119  // Still looking from IP.
120  //
121  // Chip side
122  // F 0 ^z
123  // . . |
124  // . . |
125  // . . .--> Module ref system (Hit frame)
126  // 8 z y
127  //
128  //
129 
130  // Set numerology
131  m_gmt_mgr->SetEta(0);
134 
135  // Even modules (front of disk, delta z < 0)
136  // and Odd modules (back of disk, delta z > 0)
137  int pixelECNSectors1 = m_gmt_mgr->PixelECNSectors1();
138  for (int ii = 0; ii < pixelECNSectors1*2; ii++) {
139 
140  // Build both endcaps the same but re-number phiId in endcap C to get correct offline numbering.
141  // Endcap C is obtained by rotating endcap A by 180 around y axis. Numbering goes in opposite direction
142  // with module 0 becoming module 23. Mapping is 0<->23, 24<->47.
143 
144  // Add a test to get rid off division by zero coverity error
145  int phiId = 0;
146  if(pixelECNSectors1>0) phiId = (m_gmt_mgr->GetSide()>0) ? ii : (3*pixelECNSectors1-ii-1)%(pixelECNSectors1*2);
147 
148  m_gmt_mgr->SetPhi(phiId);
149 
150  if(m_sqliteReader) {
151  psd.Build();
152  std::string key="ModuleEC_"+ std::to_string(phiId)+"_"+std::to_string(m_gmt_mgr->GetLD())+"_"+std::to_string(m_gmt_mgr->Phi())+"_"+std::to_string(m_gmt_mgr->Eta());
153  Identifier id = theSensor.getID();
155  continue;
156  }
157 
158  double angle = ii*0.5*deltaPhi+startAngle;
159  //if ( m_gmt_mgr->GetSide()<0 ) angle = 360*Gaudi::Units::deg-(ii*deltaPhi+startAngle);
160  int diskSide = (ii%2) ? +1 : -1; // even: -1, odd +1
161 
162 
163  GeoTrf::Transform3D rmX(GeoTrf::Transform3D::Identity());
164  if (oldGeometry && m_gmt_mgr->GetSide()<0) {
165  if (diskSide > 0) rmX = GeoTrf::RotateX3D(180.*Gaudi::Units::deg); // This is for compatibilty with older geomtries.
166  } else {
167  if (diskSide < 0) rmX = GeoTrf::RotateX3D(180.*Gaudi::Units::deg); // depth axis points towards disk.
168  }
169  GeoTrf::Transform3D rm = GeoTrf::RotateZ3D(angle) * rmX * GeoTrf::RotateY3D(90*Gaudi::Units::deg);
170  GeoTrf::Vector3D pos(moduleRadius,0.,diskSide*zpos);
171  pos = GeoTrf::RotateZ3D(angle)*pos;
172  GeoAlignableTransform* xform = new GeoAlignableTransform(GeoTrf::Translate3D(pos.x(),pos.y(),pos.z())*rm);
173  GeoVPhysVol * modulePhys = psd.Build();
174  std::ostringstream nameTag;
175  nameTag << "ModuleEC" << phiId;
176  GeoNameTag * tag = new GeoNameTag(nameTag.str());
177  diskPhys->add(tag);
178  diskPhys->add(new GeoIdentifierTag(phiId));
179  diskPhys->add(xform);
180  diskPhys->add(modulePhys);
181 
182  // Now store the xform by identifier:
183  Identifier id = theSensor.getID();
184  m_DDmgr->addAlignableTransform(0,id,xform,modulePhys);
185  }
186 
187  if(m_sqliteReader) {
188  std::string key="PixelDisk_"+std::to_string(brl_ec)+"_"+std::to_string(m_gmt_mgr->GetLD())+"_"+std::to_string(m_gmt_mgr->Phi())+"_"+std::to_string(m_gmt_mgr->Eta());
189  diskPhys=(*m_mapFPV)[key];
190  }
191  else {
192  //
193  // Place the supports for the disks:
194  //
196  for(int ii =0; ii< pds.NCylinders(); ii++) {
197  pds.SetCylinder(ii);
198  GeoTransform* xform = new GeoTransform( GeoTrf::Translate3D(0, 0, pds.ZPos()) );
199  diskPhys->add(xform);
200  diskPhys->add(pds.Build() );
201  }
202  }
203 
204  // Extra Material
206  xMat.add(diskPhys,"PixelDisc");
207  //Defined above as:
208  // std::ostringstream ostr; ostr << m_gmt_mgr->GetLD();
209  xMat.add(diskPhys,"PixelDisc"+ostr.str());
210  if (m_gmt_mgr->GetSide()>0) { // EndcapA
211  xMat.add(diskPhys,"PixelDiscA");
212  xMat.add(diskPhys,"PixelDiscA"+ostr.str());
213  } else { // EndcapC
214  xMat.add(diskPhys,"PixelDiscC");
215  xMat.add(diskPhys,"PixelDiscC"+ostr.str());
216  }
217 
218 
219  return diskPhys;
220 }
221 
223  return m_gmt_mgr->PixelECCarbonRMin("Inner");
224 }
225 
227  return m_gmt_mgr->PixelECCarbonRMax("Outer");
228 }
229 
231  //
232  // This can be calculated as the minimum thickness possible
233  // as for the layers I use a number which is enough to contain
234  // the inner part of the detector.
235  //
236  // 7-1 I switch to the minimum thickness possible as the cables are right
237  // outside this volume.
238  //
239  // return 10*Gaudi::Units::mm;
240  // GWG. It would be nice to get these numbers from the module itself to
241  // ensure consistency.
242  double safety = 0.01* Gaudi::Units::mm; // This is the safety added to the module.
243  double zClearance = 0.5 * Gaudi::Units::mm; // Clearance for misalignments
244  double tck = 2*(safety + 0.5*m_gmt_mgr->PixelBoardThickness()
247  );
249  tck += 2.*zClearance;
250  // TO DO: Add some safety (N.B. I think the module is slightly bigger because of some safety added there)
251  return tck;
252 }
253 
254 
InDetDD::SiNumerology::setNumRingsForDisk
void setNumRingsForDisk(int disk, int nRings)
Definition: SiNumerology.cxx:48
PixelGeometryManager::distortedMatManager
virtual InDetDD::DistortedMaterialManager * distortedMatManager()=0
GeoPixelModule::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelModule.cxx:119
PixelGeometryManager::PixelChipThickness
virtual double PixelChipThickness(bool isModule3D=false)=0
PixelGeometryManager::PixelBoardActiveLength
virtual double PixelBoardActiveLength(bool isModule3D=false)=0
PixelGeometryManager::PixelECCarbonRMin
virtual double PixelECCarbonRMin(std::string)=0
PixelGeometryManager::SetEta
virtual void SetEta(int eta)=0
GeoPixelDisk::Thickness
double Thickness()
Definition: GeoPixelDisk.cxx:230
PixelGeometryManager::PixelECCarbonRMax
virtual double PixelECCarbonRMax(std::string)=0
InDetDD::SiDetectorManager::numerology
const SiNumerology & numerology() const
Access Numerology.
Definition: SiDetectorManager.h:126
max
#define max(a, b)
Definition: cfImp.cxx:41
PixelGeometryManager
Definition: PixelGeometryManager.h:28
GeoPixelDisk::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelDisk.cxx:35
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
GeoPixelSiCrystal.h
deg
#define deg
Definition: SbPolyhedron.cxx:17
GeoPixelDiskSupports::NCylinders
int NCylinders()
Definition: GeoPixelDiskSupports.h:21
ExtraMaterial.h
PixelGeometryManager::GetSide
virtual int GetSide()=0
PixelGeometryManager::PixelChipGap
virtual double PixelChipGap(bool isModule3D=false)=0
GeoVPixelFactory::m_mapAX
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > m_mapAX
Definition: GeoVPixelFactory.h:48
GeoVPixelFactory::m_sqliteReader
GeoModelIO::ReadGeoModel * m_sqliteReader
Definition: GeoVPixelFactory.h:46
PixelGeometryManager::PixelHybridThickness
virtual double PixelHybridThickness(bool isModule3D=false)=0
GeoPixelDisk::RMin
double RMin()
Definition: GeoPixelDisk.cxx:222
GeoPixelDiskSupports::ZPos
double ZPos()
Definition: GeoPixelDiskSupports.h:23
GeoVPixelFactory::m_DDmgr
InDetDD::PixelDetectorManager * m_DDmgr
Definition: GeoVPixelFactory.h:45
InDetDD::ExtraMaterial::add
void add(GeoPhysVol *parent, const std::string &parentName, double zPos=0)
Definition: ExtraMaterial.cxx:42
GeoVPixelFactory::m_gmt_mgr
PixelGeometryManager * m_gmt_mgr
Definition: GeoVPixelFactory.h:43
GeoVPixelFactory::m_mapFPV
std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > m_mapFPV
Definition: GeoVPixelFactory.h:47
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
GeoPixelSiCrystal
Definition: GeoPixelSiCrystal.h:20
PixelDetectorManager.h
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
PixelGeometryManager::PixelBoardThickness
virtual double PixelBoardThickness(bool isModule3D=false)=0
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
PixelGeometryManager::Eta
virtual int Eta()=0
PixelGeometryManager::SetPhi
virtual void SetPhi(int phi)=0
PixelGeometryManager::PixelECSiDz1
virtual double PixelECSiDz1()=0
PixelGeometryManager::isEndcap
virtual bool isEndcap()=0
InDetDD::PixelDetectorManager::addAlignableTransform
virtual void addAlignableTransform(int level, const Identifier &id, GeoAlignableTransform *xf, const GeoVFullPhysVol *child)
Add alignable transforms.
Definition: PixelDetectorManager.cxx:262
GeoPixelDiskSupports.h
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
InDetDD::SiNumerology::setNumPhiModulesForDiskRing
void setNumPhiModulesForDiskRing(int disk, int ring, int nPhiModules)
Definition: SiNumerology.cxx:55
GeoPixelDiskSupports
Definition: GeoPixelDiskSupports.h:11
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
GeoVPixelFactory::m_mat_mgr
InDetMaterialManager * m_mat_mgr
Definition: GeoVPixelFactory.h:44
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
GeoPixelDiskSupports::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelDiskSupports.cxx:44
GeoPixelDisk::GeoPixelDisk
GeoPixelDisk(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: GeoPixelDisk.cxx:26
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
GeoPixelModule.h
GeoPixelDisk::RMax
double RMax()
Definition: GeoPixelDisk.cxx:226
GeoPixelDiskSupports::SetCylinder
void SetCylinder(int n)
Definition: GeoPixelDiskSupports.h:22
PixelGeometryManager::PixelECSiDz2
virtual double PixelECSiDz2()=0
GeoVPixelFactory
This is the base class for all the pieces of the Pixel detector.
Definition: GeoVPixelFactory.h:31
GeoPixelModule
Definition: GeoPixelModule.h:14
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
PixelGeometryManager::PixelECNSectors1
virtual int PixelECNSectors1()=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
PixelGeometryManager::dbVersion
virtual int dbVersion()=0
GeoPixelSiCrystal::getID
Identifier getID()
Definition: GeoPixelSiCrystal.h:29
GeoPixelDisk.h
InDetDD::ExtraMaterial
Definition: ExtraMaterial.h:23
readCCLHist.float
float
Definition: readCCLHist.py:83
PixelGeometryManager::PixelDiskRMin
virtual double PixelDiskRMin()=0
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
PixelGeometryManager::GetLD
virtual int GetLD()=0
PixelGeometryManager::Phi
virtual int Phi()=0
Identifier
Definition: IdentifierFieldParser.cxx:14