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