ATLAS Offline Software
PixelDetectorFactorySR1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "PixelSwitches.h"
8 
9 // Envelope, as a starting point of the geometry
10 #include "GeoPixelBarrel.h"
11 #include "GeoPixelEndCap.h"
12 #include "GeoPixelServices.h"
13 
14 // GeoModel includes
15 #include "GeoModelKernel/GeoNameTag.h"
16 #include "GeoModelKernel/GeoIdentifierTag.h"
17 #include "GeoModelKernel/GeoPhysVol.h"
18 #include "GeoModelKernel/GeoAlignableTransform.h"
19 #include "GaudiKernel/SystemOfUnits.h"
20 
21 // InDetReadoutGeometry
25 
27 #include "DBPixelGeoManager.h"
28 
30 
33 
35  const PixelSwitches & switches)
36  : InDetDD::DetectorFactoryBase(athenaComps),
37  m_detectorManager(nullptr)
38 {
39  // Create the detector manager
41 
42  // Create the geometry manager.
43  m_geometryManager = new DBPixelGeoManager(athenaComps);
44 
45  // Pass the switches
51 
52 
53  // Create SiCommonItems ans store it in geometry manager.
54  // These are items that are shared by all elements
55  std::unique_ptr<SiCommonItems> commonItems{std::make_unique<SiCommonItems>(athenaComps->getIdHelper())};
56  m_geometryManager->setCommonItems(commonItems.get());
57 
58  m_detectorManager->setCommonItems(std::move(commonItems));
59 
60  // Determine if initial layer and tag from the id dict are consistent
61  bool initialLayoutIdDict = (m_detectorManager->tag() == "initial_layout");
62  if (m_geometryManager->InitialLayout() != initialLayoutIdDict ) {
63  if(msgLvl(MSG::WARNING))
64  msg(MSG::WARNING) << "IdDict tag is \"" << m_detectorManager->tag()
65  << "\" which is inconsistent with the layout choosen!"
66  << endmsg;
67  }
68 
69 
70  //
71  // Set Version information
72  //
73  std::string versionTag = m_geometryManager->versionTag();
74  std::string versionName = "SR1";
75  std::string layout = "SR1";
76  std::string description = "SR1 Geometry";
77  int versionMajorNumber = 4;
78  int versionMinorNumber = 0;
79  int versionPatchNumber = 0;
80 
82  layout = "Initial";
83  }
84 
85  InDetDD::Version version(versionTag,
86  versionName,
87  layout,
88  description,
89  versionMajorNumber,
90  versionMinorNumber,
91  versionPatchNumber);
93 
94 }
95 
96 
98 {
99  delete m_geometryManager;
100 }
101 
102 
103 
104 //## Other Operations (implementation)
105 void PixelDetectorFactorySR1::create (GeoPhysVol *world)
106 {
109  if(msgLvl(MSG::INFO)) {
110  msg(MSG::INFO) << "Building Pixel Detector" << endmsg;
111  msg(MSG::INFO) << " " << m_detectorManager->getVersion().fullDescription() << endmsg;
112 
113  // Printout the parameters that are different in DC1 and DC2.
114  msg(MSG::INFO) << " B-Layer basic eta pitch: " << m_geometryManager->DesignPitchZ()/Gaudi::Units::micrometer << "um" << endmsg;
115  msg(MSG::INFO) << " B-Layer sensor thickness: " << m_geometryManager->PixelBoardThickness()/Gaudi::Units::micrometer << "um" << endmsg;
116  }
117 
118  bool barrelPresent = m_geometryManager->partPresent("Barrel");
119  bool endcapAPresent = m_geometryManager->partPresent("EndcapA");
120  bool endcapCPresent = m_geometryManager->partPresent("EndcapC");
121 
122  // Check that there is one and only one part built.
123  // Could have more than one part but then need to decide
124  // what to do about top level alignable transform.
125 
126  if ((barrelPresent && endcapAPresent) ||
127  (barrelPresent && endcapCPresent) ||
128  (endcapAPresent && endcapCPresent)) {
129  msg(MSG::ERROR) << "SR1 geometry can only have 1 part" << endmsg;
130  }
131 
132  if (!barrelPresent && !endcapAPresent && !endcapCPresent) {
133  msg(MSG::ERROR) << "SR1 geometry must have 1 part" << endmsg;
134  }
135 
136  GeoVPhysVol* physVol = nullptr;
137  GeoAlignableTransform * transform = nullptr;
138 
139  GeoPixelServices * pixServices = nullptr;
140  if(m_geometryManager->DoServices() ) {
141  pixServices = new GeoPixelServices(m_detectorManager, m_geometryManager, nullptr, nullptr, nullptr, nullptr);
142  }
143 
144  // Top level transform
145  GeoTrf::Transform3D topTransform = m_geometryManager->partTransform("Pixel");
146 
147  if (barrelPresent) {
148  //
149  // Add the Barrel:
150  //
152  GeoPixelBarrel brl(m_detectorManager, m_geometryManager, nullptr, nullptr, nullptr,pixServices);
153  physVol = brl.Build();
154 
155  GeoTrf::Transform3D barrelTransform = m_geometryManager->partTransform("Barrel");
156  transform = new GeoAlignableTransform(topTransform*barrelTransform);
157 
158  // Add this to the world
159  GeoNameTag* tag = new GeoNameTag("Pixel");
160  world->add(tag);
161  world->add(new GeoIdentifierTag(0));
162  world->add(physVol);
163  world->add(transform);
164 
165  }
166 
167  //
168  // Add the EndCaps
169  if (endcapAPresent || endcapCPresent) {
171 
172  GeoPixelEndCap pec(m_detectorManager, m_geometryManager, nullptr, nullptr, nullptr, pixServices);
174 
175 
176  // EndCap A
177  if (endcapAPresent) {
178 
180  physVol = pec.Build();
181 
182  GeoTrf::Transform3D endcapATransform = m_geometryManager->partTransform("EndcapA");
183  transform = new GeoAlignableTransform(topTransform * endcapATransform * GeoTrf::TranslateZ3D(zpos));
184 
185  GeoNameTag* tag = new GeoNameTag("Pixel");
186  world->add(tag);
187  world->add(new GeoIdentifierTag(2));
188  world->add(transform);
189  world->add(physVol);
190  }
191 
192  // EndCap C
193  if (endcapCPresent) {
194 
196  physVol = pec.Build();
197 
198  GeoTrf::Transform3D endcapCTransform = m_geometryManager->partTransform("EndcapC");
199  transform = new GeoAlignableTransform(topTransform * endcapCTransform * GeoTrf::TranslateZ3D(-zpos) * GeoTrf::RotateY3D(180*Gaudi::Units::deg));
200 
201  GeoNameTag* tag = new GeoNameTag("Pixel");
202  world->add(tag);
203  world->add(new GeoIdentifierTag(-2));
204  world->add(transform);
205  world->add(physVol);
206  }
207 
208  }
209 
210  // Delete pixServices
211  if(pixServices) delete pixServices;
212 
213  // Should not happen as we check before that we have at least one part built.
214  if (!physVol) {
215  msg(MSG::ERROR) << "Unexpected condition. Top level volume has zero pointer" << endmsg;
216  }
217 
218  // Store alignable transform
221 
222  //
223  // Add this to the list of top level physical volumes:
224  //
225  m_detectorManager->addTreeTop(physVol);
226 
227  // Initialize the neighbours
229 
230  // Set maximum rows/columns in numerology
231  for (int iDesign = 0; iDesign < m_detectorManager->numDesigns(); iDesign++) {
234  }
235 
236  // Register the callbacks and keys and the level corresponding to the key.
237  if (m_geometryManager->Alignable()) {
238  m_detectorManager->addFolder("/Indet/Align");
239  m_detectorManager->addChannel("/Indet/Align/ID", 2, InDetDD::global);
240  m_detectorManager->addChannel("/Indet/Align/PIX", 1, InDetDD::global);
241  if (barrelPresent) {
242  m_detectorManager->addChannel("/Indet/Align/PIXB1", 0, InDetDD::local);
243  m_detectorManager->addChannel("/Indet/Align/PIXB2", 0, InDetDD::local);
244  m_detectorManager->addChannel("/Indet/Align/PIXB3", 0, InDetDD::local);
245  }
246  if (endcapAPresent) {
247  m_detectorManager->addChannel("/Indet/Align/PIXEA1", 0, InDetDD::local);
248  m_detectorManager->addChannel("/Indet/Align/PIXEA2", 0, InDetDD::local);
249  m_detectorManager->addChannel("/Indet/Align/PIXEA3", 0, InDetDD::local);
250  }
251  if (endcapCPresent) {
252  m_detectorManager->addChannel("/Indet/Align/PIXEC1", 0, InDetDD::local);
253  m_detectorManager->addChannel("/Indet/Align/PIXEC2", 0, InDetDD::local);
254  m_detectorManager->addChannel("/Indet/Align/PIXEC3", 0, InDetDD::local);
255  }
256  }
257 }
258 
260 {
261  return m_detectorManager;
262 }
263 
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
PixelDetectorFactorySR1.h
InDetDD::SiDetectorManager::numerology
const SiNumerology & numerology() const
Access Numerology.
Definition: SiDetectorManager.h:126
PixelDetectorFactorySR1::PixelDetectorFactorySR1
PixelDetectorFactorySR1(PixelGeoModelAthenaComps *athenaComps, const PixelSwitches &switches)
Definition: PixelDetectorFactorySR1.cxx:34
PixelGeometryManager::PixelEndcapZMax
virtual double PixelEndcapZMax()=0
PixelGeometryManager::InitialLayout
virtual bool InitialLayout() const =0
InDetDD::PixelModuleDesign::columns
int columns() const
Number of cell columns per module:
Definition: PixelModuleDesign.h:340
PixelGeometryManager::SetServices
virtual void SetServices(bool isservice)=0
PixelSwitches
Definition: PixelSwitches.h:13
PixelDetectorFactorySR1::m_geometryManager
PixelGeometryManager * m_geometryManager
Definition: PixelDetectorFactorySR1.h:43
PixelGeometryManager::SetEndcap
virtual void SetEndcap()=0
PixelSwitches::dc1Geometry
bool dc1Geometry() const
Definition: PixelSwitches.cxx:34
InDetDD::SiDetectorManager::numDesigns
int numDesigns() const
Definition: SiDetectorManager.cxx:140
GeoPixelBarrel.h
PixelSwitches::servicesOnLadder
bool servicesOnLadder() const
Definition: PixelSwitches.cxx:23
DBPixelGeoManager
Definition: DBPixelGeoManager.h:33
InDetDD::PixelModuleDesign::rows
int rows() const
Number of cell rows per module:
Definition: PixelModuleDesign.h:345
GeoPixelBarrel
Definition: GeoPixelBarrel.h:11
GeoPixelEndCap.h
PixelDetectorFactorySR1::getDetectorManager
virtual const InDetDD::PixelDetectorManager * getDetectorManager() const
Definition: PixelDetectorFactorySR1.cxx:259
InDetDD::SiNumerology::setMaxNumEtaCells
void setMaxNumEtaCells(int cells)
Definition: SiNumerology.cxx:91
deg
#define deg
Definition: SbPolyhedron.cxx:17
InDetDD::InDetDetectorManager::setVersion
void setVersion(const Version &version)
Definition: InDetDetectorManager.cxx:43
InDetDD::Version
Definition: Version.h:24
PixelGeometryManager::DoServices
virtual bool DoServices()=0
InDetDD::global
@ global
Definition: InDetDD_Defs.h:16
InDetDD::DetectorFactoryBase::msg
MsgStream & msg(MSG::Level lvl) const
Definition: InDetDetectorFactoryBase.h:37
PixelGeometryManager::SetServicesOnLadder
virtual void SetServicesOnLadder(bool isservice)=0
InDetDD::SiDetectorManager::setCommonItems
void setCommonItems(std::unique_ptr< const SiCommonItems > &&commonItems)
Set SiCommonItems.
Definition: SiDetectorManager.cxx:151
GeoPixelServices.h
PixelGeometryManager::DesignPitchZ
virtual double DesignPitchZ(bool isModule3D=false)=0
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
PixelSwitches::initialLayout
bool initialLayout() const
Definition: PixelSwitches.cxx:30
PixelGeoModelAthenaComps.h
PixelDetectorFactorySR1::create
virtual void create(GeoPhysVol *world)
Definition: PixelDetectorFactorySR1.cxx:105
PixelGeometryManager::Alignable
virtual bool Alignable() const =0
InDetDD_Defs.h
GeoPixelEndCap::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelEndCap.cxx:37
InDetDD::DetectorFactoryBase::detStore
StoreGateSvc * detStore()
Definition: InDetDetectorFactoryBase.h:27
PixelGeometryManager::SetBarrel
virtual void SetBarrel()=0
InDetDD::PixelDetectorManager::initNeighbours
virtual void initNeighbours() override
Initialize the neighbours.
Definition: PixelDetectorManager.cxx:129
PixelGeoModelAthenaComps::getIdHelper
const PixelID * getIdHelper() const
Definition: PixelGeoModelAthenaComps.cxx:59
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
GeoPixelServices
Definition: GeoPixelServices.h:17
SiCommonItems.h
InDetDD::InDetDetectorManager::addFolder
void addFolder(const std::string &key)
Definition: InDetDetectorManager.cxx:66
PixelGeometryManager::PixelBoardThickness
virtual double PixelBoardThickness(bool isModule3D=false)=0
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
InDetDD::SiNumerology::setMaxNumPhiCells
void setMaxNumPhiCells(int cells)
Definition: SiNumerology.cxx:86
PixelSwitches::alignable
bool alignable() const
Definition: PixelSwitches.cxx:38
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
InDetDD::InDetDetectorManager::getVersion
const Version & getVersion() const
Get version information.
Definition: InDetDetectorManager.cxx:33
InDetDD::PixelDetectorManager::addTreeTop
void addTreeTop(const PVConstLink &vol)
Add a Tree top:
Definition: PixelDetectorManager.cxx:76
PixelDetectorFactorySR1::m_detectorManager
InDetDD::PixelDetectorManager * m_detectorManager
Definition: PixelDetectorFactorySR1.h:42
python.SystemOfUnits.micrometer
int micrometer
Definition: SystemOfUnits.py:71
InDetDD::PixelDetectorManager::addAlignableTransform
virtual void addAlignableTransform(int level, const Identifier &id, GeoAlignableTransform *xf, const GeoVFullPhysVol *child)
Add alignable transforms.
Definition: PixelDetectorManager.cxx:262
PixelGeometryManager::partTransform
virtual const GeoTrf::Transform3D & partTransform(const std::string &partName) const =0
PixelGeometryManager::versionTag
virtual std::string versionTag() const =0
InDetDD::local
@ local
Definition: InDetDD_Defs.h:16
InDetDD::DetectorFactoryBase::msgLvl
bool msgLvl(MSG::Level lvl)
Definition: InDetDetectorFactoryBase.h:40
PixelGeometryManager::SetPos
virtual void SetPos()=0
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
InDetDD::SiDetectorManager::tag
const std::string & tag() const
Get tag used in dictionary.
Definition: SiDetectorManager.cxx:34
PixelSwitches.h
InDetDD::SiCommonItems
Definition: SiCommonItems.h:45
PixelGeometryManager::SetNeg
virtual void SetNeg()=0
GeoPixelEndCap
Definition: GeoPixelEndCap.h:11
PixelGeometryManager::SetCurrentLD
virtual void SetCurrentLD(int i)=0
PixelGeometryManager::SetDC1Geometry
virtual void SetDC1Geometry(bool flag)=0
GeoPixelBarrel::Build
virtual GeoVPhysVol * Build() override
Definition: GeoPixelBarrel.cxx:43
DBPixelGeoManager.h
get_generator_info.version
version
Definition: get_generator_info.py:33
PixelGeometryManager::PixelEndcapZMin
virtual double PixelEndcapZMin()=0
PixelGeoModelAthenaComps
Class to hold various Athena components.
Definition: PixelGeoModelAthenaComps.h:16
PixelGeometryManager::SetInitialLayout
virtual void SetInitialLayout(bool flag)=0
InDetDD::Version::fullDescription
std::string fullDescription() const
Full Description For example, Version: SCT-DC1-00, Name: DC1, Layout: Final, Code Version: 2....
Definition: Version.cxx:90
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
PixelModuleDesign.h
PixelDetectorFactorySR1::~PixelDetectorFactorySR1
~PixelDetectorFactorySR1()
Definition: PixelDetectorFactorySR1.cxx:97
PixelGeometryManager::SetAlignable
virtual void SetAlignable(bool flag)=0
PixelGeometryManager::getIdHelper
virtual const PixelID * getIdHelper()=0
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
PixelSwitches::services
bool services() const
Definition: PixelSwitches.cxx:20
InDetDD::InDetDetectorManager::addChannel
void addChannel(const std::string &key, int level, FrameType frame)
Alignment access.
Definition: InDetDetectorManager.cxx:56
PixelGeometryManager::partPresent
virtual bool partPresent(const std::string &partName) const =0
PixelGeometryManager::setCommonItems
virtual void setCommonItems(InDetDD::SiCommonItems *commonItems)=0
InDetDD::PixelDetectorManager::getPixelDesign
virtual const PixelModuleDesign * getPixelDesign(int i) const
Access to module design, Casts to PixelModuleDesign.
Definition: PixelDetectorManager.cxx:290
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88
Identifier
Definition: IdentifierFieldParser.cxx:14