ATLAS Offline Software
GeoPixelEndCap.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 "GeoPixelEndCap.h"
6 #include "GeoModelKernel/GeoAlignableTransform.h"
7 #include "GeoModelKernel/GeoFullPhysVol.h"
8 #include "GeoModelKernel/GeoIdentifierTag.h"
9 #include "GeoModelKernel/GeoLogVol.h"
10 #include "GeoModelKernel/GeoMaterial.h"
11 #include "GeoModelKernel/GeoNameTag.h"
12 #include "GeoModelKernel/GeoPhysVol.h"
13 #include "GeoModelKernel/GeoTransform.h"
14 #include "GeoModelKernel/GeoTube.h"
15 #include "GeoPixelDisk.h"
16 #include "GeoPixelECCable.h"
17 #include "GeoPixelServices.h"
18 #include "Identifier/Identifier.h"
22 #include <sstream>
23 #include <utility>
24 
26 
29  GeoModelIO::ReadGeoModel* sqliteReader,
30  std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
31  std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX,
32  GeoPixelServices * pixServices)
33  : GeoVPixelFactory(ddmgr, mgr, sqliteReader, std::move(mapFPV), std::move(mapAX)),
34  m_pixServices(pixServices)
35 {}
36 
37 GeoVPhysVol* GeoPixelEndCap::Build( ) {
38 
39  GeoFullPhysVol* ecPhys{nullptr};
40  if(!m_sqliteReader) {
41  //
42  // create the Barrel Mother volume
43  //
44  double rmin = m_gmt_mgr->PixelEndcapRMin();
45  double rmax = m_gmt_mgr->PixelEndcapRMax();
46  double halflength = (m_gmt_mgr->PixelEndcapZMax()-m_gmt_mgr->PixelEndcapZMin())/2.;
47  const GeoMaterial* air = m_mat_mgr->getMaterial("std::Air");
48  const GeoTube* ecTube = new GeoTube(rmin,rmax,halflength);
49  const GeoLogVol* ecLog = new GeoLogVol("EndCap",ecTube,air);
50  ecPhys = new GeoFullPhysVol(ecLog);
51  }
52 
53  int ndisks = m_gmt_mgr->PixelEndcapNDisk();
54  m_gmt_mgr->msg(MSG::DEBUG) << "Number of disks is " << ndisks << endmsg;
55 
56  // Set numerology
57  m_DDmgr->numerology().setNumDisks(ndisks);
58 
59  // position of the endcap
60  double endcapZOffset = 0.5* (m_gmt_mgr->PixelEndcapZMax()+m_gmt_mgr->PixelEndcapZMin());
61 
62  //
63  // Place the disks and cables on both sides
64  //
67  for(int idisk = 0; idisk < ndisks; idisk++) {
68  m_gmt_mgr->SetCurrentLD(idisk);
69  // Some method is accessing the eta before the disk is built so we set it
70  // to a valid value.
71  m_gmt_mgr->SetEta(0);
72  if(m_gmt_mgr->isLDPresent()) {
73  if(m_sqliteReader) {
74  pd->Build();
75  int brl_ec = 2*m_gmt_mgr->GetSide();
76  Identifier id = m_gmt_mgr->getIdHelper()->wafer_id(brl_ec,idisk,0,0);
77  std::string key="Disk_"+std::to_string(brl_ec)+"_"+std::to_string(idisk)+"_"+std::to_string(m_gmt_mgr->GetLD())+"_"+std::to_string(m_gmt_mgr->Phi())+"_"+std::to_string(m_gmt_mgr->Eta());
79  }
80  else {
81 
82  //
83  // The position is given w.r.t to the center of the detector!
84  //
85  //position of the disk
86  double zdisk = m_gmt_mgr->PixelDiskZPosition()-endcapZOffset;
87  // place the disk
88  std::ostringstream nameTag;
89  nameTag << "Disk" << idisk;
90  GeoNameTag * tag = new GeoNameTag(nameTag.str());
91  GeoAlignableTransform* xform = new GeoAlignableTransform(GeoTrf::TranslateZ3D(zdisk));
92 
93  GeoVPhysVol * diskPhys = pd->Build();
94  ecPhys->add(tag);
95  ecPhys->add(new GeoIdentifierTag(idisk));
96  ecPhys->add(xform);
97  ecPhys->add(diskPhys);
98 
99  // Store the alignable transform
100  int brl_ec = 2*m_gmt_mgr->GetSide();
101  Identifier id = m_gmt_mgr->getIdHelper()->wafer_id(brl_ec,idisk,0,0);
102  m_DDmgr->addAlignableTransform(1, id, xform, diskPhys);
103 
104  //
105  // place the cables twice for the two active parts
106  //
107  double dz = pd->Thickness()/2. + m_gmt_mgr->PixelECCablesDistance() ;
108  GeoTransform * xformCablesPlus = new GeoTransform(GeoTrf::TranslateZ3D(zdisk+dz));
109  ecPhys->add(xformCablesPlus);
110  ecPhys->add(pecc->Build() );
111  GeoTransform * xformCablesMinus = new GeoTransform(GeoTrf::TranslateZ3D(zdisk-dz));
112  ecPhys->add(xformCablesMinus);
113  ecPhys->add(pecc->Build() );
114  }
115  } else {
116  if(m_gmt_mgr->msgLvl(MSG::DEBUG)) m_gmt_mgr->msg(MSG::DEBUG) << "Disk " << idisk << " not built" << endmsg;
117  }
118  }
119  delete pd;
120  delete pecc;
121 
122  std::string region = m_gmt_mgr->GetSide()>0 ? "A" : "C";
123 
124  if(m_sqliteReader) {
125  std::ostringstream ename;
126  ename << "EndCap" << region;
127  ecPhys = (*m_mapFPV)[ename.str()];
128  }
129  else if(m_pixServices) {
130  //
131  // Add the Endcap services inide the EC volume
132  //
133  m_pixServices->getBuilder()->buildAndPlace(region, ecPhys, endcapZOffset);
135  m_pixServices->getServMatBuilder()->buildAndPlace(region, ecPhys, endcapZOffset);
136  }
137  }
138 
139  {
140  // Extra Material
142  xMat.add(ecPhys,"PixelEndcap",endcapZOffset);
143  if (m_gmt_mgr->GetSide()>0) { // EndcapA
144  xMat.add(ecPhys,"PixelEndcapA",endcapZOffset);
145  } else { // EndcapC
146  xMat.add(ecPhys,"PixelEndcapC",endcapZOffset);
147  }
148  }
149 
150  return ecPhys;
151 }
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
PixelGeometryManager::distortedMatManager
virtual InDetDD::DistortedMaterialManager * distortedMatManager()=0
PixelGeometryManager::PixelDiskZPosition
virtual double PixelDiskZPosition()=0
PixelGeometryManager::SetEta
virtual void SetEta(int eta)=0
InDetDD::SiDetectorManager::numerology
const SiNumerology & numerology() const
Access Numerology.
Definition: SiDetectorManager.h:126
PixelGeometryManager::PixelEndcapZMax
virtual double PixelEndcapZMax()=0
PixelGeometryManager
Definition: PixelGeometryManager.h:28
PixelGeometryManager::msg
MsgStream & msg(MSG::Level lvl) const
Definition: PixelGeometryManager.h:611
GeoPixelDisk
Definition: GeoPixelDisk.h:11
PixelGeometryManager::PixelEndcapRMin
virtual double PixelEndcapRMin()=0
GeoPixelEndCap.h
PixelGeometryManager::msgLvl
bool msgLvl(MSG::Level lvl) const
Definition: PixelGeometryManager.h:614
makeDTCalibBlob_pickPhase.pd
pd
Definition: makeDTCalibBlob_pickPhase.py:342
ExtraMaterial.h
PixelGeometryManager::GetSide
virtual int GetSide()=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
GeoPixelECCable::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelECCable.cxx:22
GeoPixelServices.h
InDetDD::VolumeBuilder::buildAndPlace
void buildAndPlace(const std::string &region, GeoPhysVol *parent, double zcenter=0)
Definition: VolumeBuilder.cxx:83
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:364
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
PixelDetectorManager.h
GeoPixelEndCap::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelEndCap.cxx:37
PixelGeometryManager::PixelEndcapNDisk
virtual int PixelEndcapNDisk()=0
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
GeoPixelServices
Definition: GeoPixelServices.h:17
PixelGeometryManager::PixelECCablesDistance
virtual double PixelECCablesDistance()=0
PixelGeometryManager::Eta
virtual int Eta()=0
GeoPixelEndCap::m_pixServices
GeoPixelServices * m_pixServices
Definition: GeoPixelEndCap.h:21
GeoPixelECCable.h
InDetDD::PixelDetectorManager::addAlignableTransform
virtual void addAlignableTransform(int level, const Identifier &id, GeoAlignableTransform *xf, const GeoVFullPhysVol *child)
Add alignable transforms.
Definition: PixelDetectorManager.cxx:262
InDetDD::SiNumerology::setNumDisks
void setNumDisks(int nDisks)
Definition: SiNumerology.cxx:41
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
PixelGeometryManager::PixelEndcapRMax
virtual double PixelEndcapRMax()=0
PixelGeometryManager::SetCurrentLD
virtual void SetCurrentLD(int i)=0
GeoVPixelFactory::m_mat_mgr
InDetMaterialManager * m_mat_mgr
Definition: GeoVPixelFactory.h:44
PixelGeometryManager::PixelEndcapZMin
virtual double PixelEndcapZMin()=0
GeoPixelServices::getServMatBuilder
InDetDD::VolumeBuilder * getServMatBuilder()
Definition: GeoPixelServices.h:32
DEBUG
#define DEBUG
Definition: page_access.h:11
VolumeBuilder.h
GeoVPixelFactory
This is the base class for all the pieces of the Pixel detector.
Definition: GeoVPixelFactory.h:31
GeoPixelECCable
Definition: GeoPixelECCable.h:11
GeoPixelEndCap::GeoPixelEndCap
GeoPixelEndCap(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, GeoPixelServices *pixServices)
Definition: GeoPixelEndCap.cxx:27
PixelGeometryManager::getIdHelper
virtual const PixelID * getIdHelper()=0
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
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
GeoPixelDisk.h
PixelGeometryManager::isLDPresent
virtual bool isLDPresent()=0
InDetDD::ExtraMaterial
Definition: ExtraMaterial.h:23
GeoPixelServices::getBuilder
InDetDD::VolumeBuilder * getBuilder()
Definition: GeoPixelServices.h:31
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
PixelGeometryManager::GetLD
virtual int GetLD()=0
PixelGeometryManager::Phi
virtual int Phi()=0
Identifier
Definition: IdentifierFieldParser.cxx:14