ATLAS Offline Software
GeoPixelBarrel.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 "GeoPixelBarrel.h"
6 #include "GeoPixelLayer.h"
7 #include "GeoPixelServices.h"
8 #include "GeoPixelOldFrame.h"
9 #include "GeoPixelStaveRing.h"
10 #include "GeoPixelIFlexServices.h"
11 #include "GeoModelKernel/GeoBox.h"
12 #include "GeoModelKernel/GeoPara.h"
13 #include "GeoModelKernel/GeoTube.h"
14 #include "GeoModelKernel/GeoLogVol.h"
15 #include "GeoModelKernel/GeoNameTag.h"
16 #include "GeoModelKernel/GeoIdentifierTag.h"
17 #include "GeoModelKernel/GeoPhysVol.h"
18 #include "GeoModelKernel/GeoFullPhysVol.h"
19 #include "GeoModelKernel/GeoMaterial.h"
20 #include "GeoModelKernel/GeoAlignableTransform.h"
22 #include "Identifier/Identifier.h"
25 
27 
28 
29 #include <sstream>
30 #include <utility>
31 
32 using namespace std;
35  GeoModelIO::ReadGeoModel* sqliteReader,
36  std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
37  std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX,
38  GeoPixelServices * pixServices )
39  : GeoVPixelFactory (ddmgr, mgr, sqliteReader, std::move(mapFPV), std::move(mapAX)),
40  m_pixServices(pixServices)
41 {}
42 
43 GeoVPhysVol* GeoPixelBarrel::Build( ) {
44 
45  GeoFullPhysVol* barrelPhys{nullptr};
46 
47  if(m_sqliteReader) {
48  barrelPhys = (*m_mapFPV)["Barrel"];
49  }
50  else {
51  //
52  // create the Barrel Mother volume
53  //
54  double rmin = m_gmt_mgr->PixelBarrelRMin();
55  double rmax = m_gmt_mgr->PixelBarrelRMax();
56  double halflength = m_gmt_mgr->PixelBarrelHalfLength();
57  const GeoMaterial* air = m_mat_mgr->getMaterial("std::Air");
58  const GeoTube* barrelTube = new GeoTube(rmin,rmax,halflength);
59  const GeoLogVol* barrelLog = new GeoLogVol("Barrel",barrelTube,air);
60  barrelPhys = new GeoFullPhysVol(barrelLog);
61  }
62 
63  // Set numerology
65 
66  // In case of IBL stave detailed description -> add stave ring support and emdblocks
68  bool bAddIBLStaveRings = m_gmt_mgr->ibl()&&m_gmt_mgr->PixelStaveLayout()>3&&m_gmt_mgr->PixelStaveLayout()<7;
69 
70  //
71  // Build the layers inside
72  //
74  for(int ii = 0; ii < m_gmt_mgr->PixelBarrelNLayer(); ii++){
75  //cout << "Layer" << ii << endl;
77  if(m_gmt_mgr->isLDPresent()){
78  std::ostringstream lname;
79  lname << "Layer" << ii;
80 
81  Identifier id = m_gmt_mgr->getIdHelper()->wafer_id(0,ii,0,0);
82 
83  if(m_sqliteReader) {
84  GeoAlignableTransform* xform = (*m_mapAX)[lname.str()];
85  layer.Build();
86  GeoFullPhysVol* layerFPV = (*m_mapFPV) [lname.str()];
87  // Store the transform (at level 1)
88  m_DDmgr->addAlignableTransform(1, id, xform, layerFPV);
89 
90  // Extra Material.
91  // From Marilena: I don't think there is much room but we provide the hooks anyway
92  // NB this has been taken from the GeoPixelLayer class .. needed to be moved here cause here
93  // we have the GeoFullPhysVol available from the SQLite DB
95  xMat.add(layerFPV,"PixelLayer");
96  std::ostringstream ostr; ostr << m_gmt_mgr->GetLD();
97  xMat.add(layerFPV,"PixelLayer"+ostr.str());
98  }
99  else {
100  // IBL layer shift ( 2mm shift issue )
101  double layerZshift = m_gmt_mgr->PixelLayerGlobalShift();
102  GeoAlignableTransform* xform = new GeoAlignableTransform(GeoTrf::Translate3D(0.,0.,layerZshift));
103  GeoVPhysVol* layerphys = layer.Build();
104  GeoNameTag *tag = new GeoNameTag(lname.str());
105  barrelPhys->add(tag);
106  barrelPhys->add(new GeoIdentifierTag(ii));
107  barrelPhys->add(xform);
108  barrelPhys->add(layerphys);
109 
110  // Store the transform (at level 1)
111  m_DDmgr->addAlignableTransform(1, id, xform, layerphys);
112 
113  // IBL stave ring service area ( ring + endblocks + flexes + pipe + ...)
114  if(m_pixServices&&bAddIBLStaveRings&&ii==0)
115  {
116  // ----------- end of stave services (side A)
117  GeoNameTag * tagSupportA = new GeoNameTag("StaveRingAndEndblocks_A");
118  GeoTransform *xformSupportA = layer.getSupportTrfA();
119  GeoPhysVol *supportPhys_A = layer.getSupportA();
120  barrelPhys->add(tagSupportA);
121  barrelPhys->add(xformSupportA);
122  barrelPhys->add(supportPhys_A);
123 
124  // ----------- end of stave services (side C)
125  GeoNameTag * tagSupportC = new GeoNameTag("StaveRingAndEndblocks_C");
126  GeoTransform *xformSupportC = layer.getSupportTrfC();
127  GeoPhysVol *supportPhys_C = layer.getSupportC();
128  barrelPhys->add(tagSupportC);
129  barrelPhys->add(xformSupportC);
130  barrelPhys->add(supportPhys_C);
131 
132  // ----------- middle of stave services
133  if(m_gmt_mgr->PixelStaveAxe()==0) {
134  GeoNameTag *tagM = new GeoNameTag("Brl0M_StaveRing");
135  GeoTransform *xformSupportMidRing = layer.getSupportTrfMidRing();
136  GeoVPhysVol *supportPhysMidRing = layer.getSupportMidRing();
137  barrelPhys->add(tagM);
138  barrelPhys->add(xformSupportMidRing);
139  barrelPhys->add(supportPhysMidRing);
140  }
141 
142  // ----------- end of stave PP0 services (insde barrel)
143 
146  iFlexSrv.Build();
147 
148  GeoNameTag * tagFlexA = new GeoNameTag("PP0Flex_A");
149  GeoTransform *xformFlexA = iFlexSrv.getSupportTrfA();
150  GeoPhysVol *flexPhys_A = iFlexSrv.getSupportA();
151  barrelPhys->add(tagFlexA);
152  barrelPhys->add(xformFlexA);
153  barrelPhys->add(flexPhys_A);
154 
155  GeoNameTag * tagFlexC = new GeoNameTag("PP0Flex_C");
156  GeoTransform *xformFlexC = iFlexSrv.getSupportTrfC();
157  GeoPhysVol *flexPhys_C = iFlexSrv.getSupportC();
158  barrelPhys->add(tagFlexC);
159  barrelPhys->add(xformFlexC);
160  barrelPhys->add(flexPhys_C);
161  }
162  }
163  }
164  }
165  else
166  {
167  if(m_gmt_mgr->msgLvl(MSG::DEBUG)) m_gmt_mgr->msg(MSG::DEBUG) << "Layer " << ii << " not built" << endmsg;
168  }
169  }
170 
171  if(!m_sqliteReader && m_pixServices) {
172  //
173  // Add the services inside the barrel volume
174  //
175  m_pixServices->getBuilder()->buildAndPlace("B", barrelPhys);
177  m_pixServices->getServMatBuilder()->buildAndPlace("B", barrelPhys);
178  }
179 
180  //
181  // Add the pixel frame inside the barrel volume
182  // In recent versions this taken care of in the general services.
183  if (m_gmt_mgr->oldFrame()) {
185  frame.BuildInBarrel(barrelPhys);
186  }
187  }
188 
189  // Extra Material
191  xMat.add(barrelPhys,"PixelBarrel");
192 
193  return barrelPhys;
194 }
195 
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::PixelLayerGlobalShift
virtual double PixelLayerGlobalShift()=0
GeoPixelOldFrame.h
InDetDD::SiDetectorManager::numerology
const SiNumerology & numerology() const
Access Numerology.
Definition: SiDetectorManager.h:126
PixelGeometryManager
Definition: PixelGeometryManager.h:28
PixelGeometryManager::PixelBarrelRMin
virtual double PixelBarrelRMin()=0
PixelGeometryManager::msg
MsgStream & msg(MSG::Level lvl) const
Definition: PixelGeometryManager.h:611
InDetDD::SiNumerology::setNumLayers
void setNumLayers(int nLayers)
Definition: SiNumerology.cxx:27
GeoPixelBarrel.h
PixelGeometryManager::ibl
virtual bool ibl() const =0
PixelGeometryManager::msgLvl
bool msgLvl(MSG::Level lvl) const
Definition: PixelGeometryManager.h:614
PixelGeometryManager::PixelBarrelRMax
virtual double PixelBarrelRMax()=0
ExtraMaterial.h
GeoPixelStaveRing.h
GeoPixelIFlexServices::getSupportA
GeoPhysVol * getSupportA()
Definition: GeoPixelIFlexServices.h:29
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
GeoPixelOldFrame
Definition: GeoPixelOldFrame.h:14
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
GeoPixelBarrel::m_pixServices
GeoPixelServices * m_pixServices
Definition: GeoPixelBarrel.h:21
PixelDetectorManager.h
GeoPixelIFlexServices
Definition: GeoPixelIFlexServices.h:17
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
GeoPixelServices
Definition: GeoPixelServices.h:17
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
GeoPixelLayer
Definition: GeoPixelLayer.h:14
PixelGeometryManager::PixelBarrelHalfLength
virtual double PixelBarrelHalfLength()=0
InDetDD::PixelDetectorManager::addAlignableTransform
virtual void addAlignableTransform(int level, const Identifier &id, GeoAlignableTransform *xf, const GeoVFullPhysVol *child)
Add alignable transforms.
Definition: PixelDetectorManager.cxx:262
GeoPixelOldFrame::BuildInBarrel
void BuildInBarrel(GeoFullPhysVol *parent)
Definition: GeoPixelOldFrame.cxx:117
GeoPixelIFlexServices::getSupportC
GeoPhysVol * getSupportC()
Definition: GeoPixelIFlexServices.h:30
PixelGeometryManager::oldFrame
virtual bool oldFrame()=0
GeoPixelIFlexServices::getSupportTrfA
GeoTransform * getSupportTrfA()
Definition: GeoPixelIFlexServices.h:31
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
PixelGeometryManager::PixelStaveLayout
virtual int PixelStaveLayout()=0
PixelGeometryManager::SetCurrentLD
virtual void SetCurrentLD(int i)=0
PixelGeometryManager::PixelBarrelNLayer
virtual int PixelBarrelNLayer()=0
GeoVPixelFactory::m_mat_mgr
InDetMaterialManager * m_mat_mgr
Definition: GeoVPixelFactory.h:44
GeoPixelBarrel::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelBarrel.cxx:43
PixelGeometryManager::PixelStaveAxe
virtual int PixelStaveAxe()=0
GeoPixelBarrel::GeoPixelBarrel
GeoPixelBarrel(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: GeoPixelBarrel.cxx:33
GeoPixelIFlexServices::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelIFlexServices.cxx:41
GeoPixelServices::getServMatBuilder
InDetDD::VolumeBuilder * getServMatBuilder()
Definition: GeoPixelServices.h:32
DEBUG
#define DEBUG
Definition: page_access.h:11
VolumeBuilder.h
PixelGeometryManager::IBLFlexAndWingDefined
virtual bool IBLFlexAndWingDefined()=0
GeoVPixelFactory
This is the base class for all the pieces of the Pixel detector.
Definition: GeoVPixelFactory.h:31
PixelGeometryManager::getIdHelper
virtual const PixelID * getIdHelper()=0
GeoPixelIFlexServices.h
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
PixelGeometryManager::isLDPresent
virtual bool isLDPresent()=0
InDetDD::ExtraMaterial
Definition: ExtraMaterial.h:23
GeoPixelLayer.h
GeoPixelIFlexServices::getSupportTrfC
GeoTransform * getSupportTrfC()
Definition: GeoPixelIFlexServices.h:32
GeoPixelServices::getBuilder
InDetDD::VolumeBuilder * getBuilder()
Definition: GeoPixelServices.h:31
PixelGeometryManager::GetLD
virtual int GetLD()=0
Identifier
Definition: IdentifierFieldParser.cxx:14