ATLAS Offline Software
Loading...
Searching...
No Matches
GeoPixelSiCrystal.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5//
6// This class builds one Si Crystal to be placed in one module
7//
8// The information on which layer to build is retrieved by the Geometry Manager
9//
10// Contained by: PixelModule_log
11//
12// Contains: nothing
13//
14#include "GeoPixelSiCrystal.h"
15#include "GeoModelKernel/GeoBox.h"
16#include "GeoModelKernel/GeoLogVol.h"
17#include "GeoModelKernel/GeoFullPhysVol.h"
18#include "GeoModelKernel/GeoMaterial.h"
19#include "GaudiKernel/SystemOfUnits.h"
20#include "Identifier/Identifier.h"
23
30
31#include <algorithm> //for std::min, std::max
32#include <utility>
33#include <vector>
34
35#include "PixelGeoUtils.h"
36namespace {
37 InDetDD::PixelReadoutTechnology getPixelReadoutTechnology(int rowsPerCircuit, int columnsPerCircuit) {
38 if (rowsPerCircuit*columnsPerCircuit>26000) { return InDetDD::PixelReadoutTechnology::FEI4; }
40 }
41}
42using namespace InDetDD;
43
46 GeoModelIO::ReadGeoModel* sqliteReader,
47 std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
48 std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX,
49 bool isBLayer, bool isModule3D, bool even_odd_phi_design)
50 : GeoVPixelFactory (ddmgr, mgr, sqliteReader, std::move(mapFPV), std::move(mapAX))
51{
52 //
53 //Builds the design for this crystal
54 m_isBLayer = isBLayer;
55 m_isModule3D = isModule3D;
56
57 // Dimensions
58 const double thickness = m_gmt_mgr->PixelBoardThickness(m_isModule3D);
59 const double length = m_gmt_mgr->PixelBoardLength(m_isModule3D);
60 const double width = m_gmt_mgr->PixelBoardWidth(m_isModule3D);
61
62 int circuitsPerPhi = m_gmt_mgr->DesignCircuitsPhi(m_isModule3D); // Warning col/row naming opposite to chip
63 int circuitsPerEta = m_gmt_mgr->DesignCircuitsEta(m_isModule3D); // Warning col/row naming opposite to chip
64 int cellRowPerCirc = m_gmt_mgr->DesignCellRowsPerCircuit(m_isModule3D);
65 int cellColPerCirc = m_gmt_mgr->DesignCellColumnsPerCircuit(m_isModule3D);
66 int rowsPerCircuit = m_gmt_mgr->DesignDiodeRowsPerCircuit(m_isModule3D);
67 int columnsPerCircuit = m_gmt_mgr->DesignDiodeColumnsPerCircuit(m_isModule3D);
68 int readoutSide = m_gmt_mgr->DesignReadoutSide(m_isModule3D);
69
70 double pitchEtaLongEnd = m_gmt_mgr->DesignPitchZLongEnd(m_isModule3D);
71 double pitchEtaLong = m_gmt_mgr->DesignPitchZLong(m_isModule3D);
72 double pitchPhi = m_gmt_mgr->DesignPitchRP(m_isModule3D);
73 double pitchEta = m_gmt_mgr->DesignPitchZ(m_isModule3D);
74
75 auto readoutTechnology = getPixelReadoutTechnology(rowsPerCircuit,columnsPerCircuit );
76 auto circuitsPerPhi_corr = circuitsPerPhi;
77 auto rowsPerCircuit_corr = rowsPerCircuit;
78 if (readoutTechnology==InDetDD::PixelReadoutTechnology::FEI3 && circuitsPerPhi==1 && rowsPerCircuit==328) {
79 // FEI3 has 2x8 circuits and 160 + 4 rows per circuit not 1x8 circuits with 328 rows
80 // without this correction it is not possible to use the attribute associated to sub-matrices
81 // to assign FE numbers to sub-matrices.
82 circuitsPerPhi_corr*=2;
83 rowsPerCircuit_corr/=2;
84 }
85
86 // optionally create different module design for even and odd phi modules, because
87 // the front-ends are numbered differently
88 m_nPhiDesigns=even_odd_phi_design ? 2 : 1;
89 for (unsigned int design_i=0; design_i<m_nPhiDesigns ; ++design_i) {
90 // for endcap modules the design for even-phi indices uses a "mirrored" front-end numbering scheme.
91 // instead of from top left 0..7 to top right, then bottom right to bottom left 8..15 , the front
92 // ends are numbered from bottom left to top left i.e. bottom and top are swapped.
94
95 constexpr auto kNDirections = InDetDD::detail::kNDirections;
96 constexpr auto kNPixelLocations = InDetDD::detail::kNPixelLocations;
98 readoutTechnology,
99 std::array<int,kNDirections>{circuitsPerPhi_corr,circuitsPerEta}, // [0]=phi/row, [1]=eta/column
100 std::array<int,kNDirections>{rowsPerCircuit_corr,columnsPerCircuit}, // [0]=phi/row, [1]=eta/column
101 std::array<std::array<double,kNDirections>,kNPixelLocations>{ // regular/central,longEnd/outer,long/inner
102 std::array<double,kNDirections>{pitchPhi,pitchEta},
103 std::array<double,kNDirections>{0.,pitchEtaLongEnd},
104 std::array<double,kNDirections>{0.,pitchEtaLong}},
105 fe_numbering);
106
107 std::unique_ptr<PixelModuleDesign> p_barrelDesign2 = std::make_unique<PixelModuleDesign>(thickness,
108 circuitsPerPhi,
109 circuitsPerEta,
110 cellColPerCirc,
111 cellRowPerCirc,
112 columnsPerCircuit,
113 rowsPerCircuit,
114 std::move(diode_tree),
116 readoutSide,
117 false, /* 3D */
118 InDetDD::Undefined, /* detector type */
119 readoutTechnology);
120
121 // Multiple connections (ganged pixels)
122 if (m_gmt_mgr->NumberOfEmptyRows() > 0) {
123 int minRow = m_gmt_mgr->EmptyRows(0);
124 int maxRow = minRow;
125 for (int iConnect = 0; iConnect < m_gmt_mgr->NumberOfEmptyRows(); iConnect++){
126 minRow = std::min(minRow, m_gmt_mgr->EmptyRows(iConnect));
127 minRow = std::min(minRow, m_gmt_mgr->EmptyRowConnections(iConnect));
128 maxRow = std::max(maxRow, m_gmt_mgr->EmptyRows(iConnect));
129 maxRow = std::max(maxRow, m_gmt_mgr->EmptyRowConnections(iConnect));
130 }
131
132 std::vector <int> connections(maxRow-minRow+1);
133
134 // We fill them all with a one to one correspondence first.
135 for (unsigned int iRow = 0; iRow < connections.size(); iRow++){
136 connections[iRow] = iRow + minRow;
137 }
138
139 // Now make the connections.
140 for (int iConnect = 0; iConnect < m_gmt_mgr->NumberOfEmptyRows(); iConnect++){
141 connections[m_gmt_mgr->EmptyRows(iConnect)-minRow] = m_gmt_mgr->EmptyRowConnections(iConnect);
142 }
143
144 p_barrelDesign2->addMultipleRowConnection(minRow, connections);
145
146 } else {
147 // No empty rows.
148 if (!m_gmt_mgr->ibl()) {
149 m_gmt_mgr->msg(MSG::WARNING) << "GeoPixelSiCrystal: No ganged pixels" << endmsg;
150 } else {
151 if (m_gmt_mgr->msgLvl(MSG::DEBUG)) m_gmt_mgr->msg(MSG::DEBUG) << "GeoPixelSiCrystal: No ganged pixels" << endmsg;
152 }
153 }
154
155 // Check that the active area seems reasonable
156
157 if ( (m_gmt_mgr->DesignRPActiveArea(m_isModule3D) > width) ||
158 (m_gmt_mgr->DesignZActiveArea(m_isModule3D) > length) ||
159 (width - m_gmt_mgr->DesignRPActiveArea(m_isModule3D) > 4 * Gaudi::Units::mm) ||
160 (length - m_gmt_mgr->DesignZActiveArea(m_isModule3D) > 4 * Gaudi::Units::mm) ) {
161 m_gmt_mgr->msg(MSG::WARNING) << "GeoPixelSiCrystal: Active area not consistent with sensor size. Sensor: "
162 << width/Gaudi::Units::mm << " x " << length/Gaudi::Units::mm << ", Active: "
163 << m_gmt_mgr->DesignRPActiveArea(m_isModule3D)/Gaudi::Units::mm << " x " << m_gmt_mgr->DesignZActiveArea(m_isModule3D)/Gaudi::Units::mm
164 << endmsg;
165 } else {
166 if (m_gmt_mgr->msgLvl(MSG::DEBUG)) m_gmt_mgr->msg(MSG::DEBUG)
167 << "GeoPixelSiCrystal: Sensor: "
168 << width/Gaudi::Units::mm << " x " << length/Gaudi::Units::mm << ", Active: "
169 << m_gmt_mgr->DesignRPActiveArea(m_isModule3D)/Gaudi::Units::mm << " x " << m_gmt_mgr->DesignZActiveArea(m_isModule3D)/Gaudi::Units::mm
170 << endmsg;
171 }
172
173
174 m_design.at(design_i) = m_DDmgr->addDesign(std::move(p_barrelDesign2));
175 }
176
177
178}
180
181 GeoFullPhysVol* siPhys{nullptr};
182 int brl_ec= m_gmt_mgr->isEndcap() ? 2*m_gmt_mgr->GetSide() : 0;
183
184 if(m_sqliteReader) {
185 std::string siName ="SiPhys_" + 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());
186 siPhys = (*m_mapFPV)[siName];
187 }
188 else {
189 //(sar) code moved from c'tor..
190 const double thickness = m_gmt_mgr->PixelBoardThickness(m_isModule3D);
191 const double length = m_gmt_mgr->PixelBoardLength(m_isModule3D);
192 const double width = m_gmt_mgr->PixelBoardWidth(m_isModule3D);
193 //
194 std::string matName = m_gmt_mgr->getMaterialName("Sensor");
195 const GeoMaterial* siMat = m_mat_mgr->getMaterial(matName);
196 const GeoBox* siBox = new GeoBox(thickness*0.5,width*0.5,length*0.5);
197 std::string logname{"siLog"};
198 // There is not a strong need to give the blayer a different name but leave it for now.
199 if(m_isBLayer) logname = "siBLayLog";
200 auto *logVolume = new GeoLogVol(logname,siBox,siMat);
201 //(sar) ...to here
202
203
204 siPhys = new GeoFullPhysVol(logVolume);
205 }
206 // Build the Identifier for the silicon:
207 //
208 const PixelID * idHelper = m_gmt_mgr->getIdHelper();
209 m_id = idHelper->wafer_id(brl_ec,m_gmt_mgr->GetLD(),m_gmt_mgr->Phi(),m_gmt_mgr->Eta());
210 SiDetectorElement * element = new SiDetectorElement(m_id, m_design[ m_gmt_mgr->Phi() % m_nPhiDesigns] , siPhys, m_gmt_mgr->commonItems());
211
212 // add the element to the manager
213 m_DDmgr->addDetectorElement(element);
214 return siPhys;
215}
#define endmsg
double length(const pvec &v)
This is an Identifier helper class for the Pixel subdetector.
const double width
unsigned int m_nPhiDesigns
std::array< const InDetDD::SiDetectorDesign *, 2 > m_design
virtual GeoVPhysVol * Build() override
GeoPixelSiCrystal(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, bool isBLayer, bool isModule3D=false, bool even_odd_phi_design=false)
GeoModelIO::ReadGeoModel * m_sqliteReader
PixelGeometryManager * m_gmt_mgr
InDetDD::PixelDetectorManager * m_DDmgr
InDetMaterialManager * m_mat_mgr
GeoVPixelFactory(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)
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated pixel ...
Tree structure to find the position, index or pitch of a pixel on a semi-regular grid The grid is con...
Class to hold geometrical description of a silicon detector element.
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:67
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition PixelID.h:360
PixelDiodeTree makePixelDiodeTree(T_MsgParent *gmt_mgr, InDetDD::PixelReadoutTechnology readoutTechnology, const std::array< int, kNDirections > &circuits, const std::array< int, kNDirections > &dimPerCircuit, const std::array< std::array< double, kNDirections >, kNPixelLocations > &pitch, FENumbering fe_numbering)
Message Stream Member.
STL namespace.