ATLAS Offline Software
Loading...
Searching...
No Matches
InDetDD::PLRGmxInterface Class Reference

#include <PLRGmxInterface.h>

Inheritance diagram for InDetDD::PLRGmxInterface:
Collaboration diagram for InDetDD::PLRGmxInterface:

Public Member Functions

 PLRGmxInterface (PixelDetectorManager *detectorManager, SiCommonItems *commonItems, WaferTree *moduleTree)
virtual int sensorId (std::map< std::string, int > &index) const override final
virtual void addSensorType (const std::string &clas, const std::string &typeName, const std::map< std::string, std::string > &parameters) override final
virtual void addSensor (const std::string &typeName, std::map< std::string, int > &index, int sequentialId, GeoVFullPhysVol *fpv) override final
virtual void buildReadoutGeometryFromSqlite (IRDBAccessSvc *RDBAccessSvc, GeoModelIO::ReadGeoModel *sqlreader)
virtual void addAlignable (int level, std::map< std::string, int > &index, GeoVFullPhysVol *fpv, GeoAlignableTransform *transform) override final
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Protected Member Functions

void makePixelModule (const std::string &typeName, const std::map< std::string, std::string > &parameters)

Protected Attributes

std::map< std::string, int > m_geometryMap
PixelDetectorManagerm_detectorManager {}
SiCommonItemsm_commonItems {}
WaferTreem_moduleTree {}

Private Member Functions

void makePLRModule (const std::string &typeName, const std::map< std::string, std::string > &parameters)
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Detailed Description

Definition at line 25 of file PLRGmxInterface.h.

Constructor & Destructor Documentation

◆ PLRGmxInterface()

InDetDD::PLRGmxInterface::PLRGmxInterface ( PixelDetectorManager * detectorManager,
SiCommonItems * commonItems,
WaferTree * moduleTree )

Definition at line 30 of file PLRGmxInterface.cxx.

33 : PixelGmxInterface(detectorManager, commonItems, moduleTree)
34{}
PixelGmxInterface(PixelDetectorManager *detectorManager, SiCommonItems *commonItems, WaferTree *moduleTree)

Member Function Documentation

◆ addAlignable()

void InDetDD::ITk::PixelGmxInterface::addAlignable ( int level,
std::map< std::string, int > & index,
GeoVFullPhysVol * fpv,
GeoAlignableTransform * transform )
finaloverridevirtualinherited

Definition at line 501 of file PixelGmxInterface.cxx.

505{
506 ATH_MSG_DEBUG("addAlignable called");
507 const PixelID *pixelIdHelper = dynamic_cast<const PixelID *> (m_commonItems->getIdHelper());
508 if (not pixelIdHelper){
509 ATH_MSG_ERROR("Dynamic cast to PixelID failed in PixelGmxInterface::addAlignable");
510 return;
511 }
512 Identifier id;
513 switch (level) {
514 case 0:
515 id = pixelIdHelper->wafer_id(index["barrel_endcap"],
516 index["layer_wheel"],
517 index["phi_module"],
518 index["eta_module"],
519 index["side"]);
520 break;
521 case 1:
522 id = pixelIdHelper->wafer_id(index["barrel_endcap"],
523 index["layer_wheel"],
524 index["phi_module"],
525 index["eta_module"],
526 0);
527 break;
528 case 2:
529 id = pixelIdHelper->wafer_id(index["barrel_endcap"],
530 index["layer_wheel"],
531 0,
532 0,
533 0);
534 break;
535 case 3:
536 id = pixelIdHelper->wafer_id(index["barrel_endcap"],
537 0,
538 0,
539 0,
540 0);
541 break;
542 default:
543 throw GaudiException("Unknown level " + std::to_string(level) + " for alignment in addAlignable",
544 "PixelGmxInterface::addAlignable", StatusCode::FAILURE);
545 break;
546 }
547 m_detectorManager->addAlignableTransform(level, id, transform, fpv);
548}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
PixelDetectorManager * m_detectorManager

◆ addSensor()

void InDetDD::PLRGmxInterface::addSensor ( const std::string & typeName,
std::map< std::string, int > & index,
int sequentialId,
GeoVFullPhysVol * fpv )
finaloverridevirtual

Reimplemented from InDetDD::ITk::PixelGmxInterface.

Definition at line 89 of file PLRGmxInterface.cxx.

93{
94 //
95 // Get the ATLAS "Offline" wafer identifier
96 //
97 const PLR_ID *pixelIdHelper = dynamic_cast<const PLR_ID *>(m_commonItems->getIdHelper());
98 if (not pixelIdHelper){
99 ATH_MSG_ERROR("Failed dynamic_cast to PLR_ID in PLRGmxInterface::addSensor");
100 return;
101 }
102 Identifier id = pixelIdHelper->wafer_id(index["barrel_endcap"],
103 index["layer_wheel"],
104 index["phi_module"],
105 index["eta_module"]);
106 IdentifierHash hashId = pixelIdHelper->wafer_hash(id);
107 //
108 // Now do our best to check if this is a valid id. If either the gmx file is wrong, or the xml file
109 // defining the allowed id's is wrong, you can get disallowed id's. These cause a crash later
110 // if allowed through. To do the check, we ask for the hash-id of this id. Invalid ids give a
111 // special invalid hash-id (0xFFFFFFFF). But we don't exit the run, to help debug things quicker.
112 //
113 if (!hashId.is_valid()) {
114 ATH_MSG_ERROR("Invalid id for sensitive module " << typeName << " volume with indices");
115 for (const auto& [key, value] : index) {
116 msg() << MSG::ERROR << key << " = " << value << "; ";
117 }
118 msg() << MSG::ERROR << endmsg;
119 ATH_MSG_ERROR("Refusing to make it into a sensitive element. Incompatible gmx and identifier-xml files.");
120 return;
121 }
122
123 //
124 // Create the detector element and add to the DetectorManager
125 //
126 auto it = m_geometryMap.find(typeName);
127 if(it == m_geometryMap.end()) {
128 ATH_MSG_ERROR("addSensor: Error: Readout sensor type " << typeName << " not found.");
129 throw std::runtime_error("readout sensor type " + typeName + " not found.");
130 }
131 const SiDetectorDesign *design = m_detectorManager->getDesign(it->second);
132 ATH_MSG_VERBOSE("Adding sensor with design: " << typeName << " " << design);
133 if (design == nullptr) {
134 ATH_MSG_ERROR("addSensor: Error: Readout sensor type " << typeName << " not found.");
135 throw std::runtime_error("readout sensor type " + typeName + " not found.");
136 }
137
138 m_detectorManager->addDetectorElement(new SiDetectorElement(id, design, fpv, m_commonItems));
139
140 //
141 // Build up a map-structure for numerology
142 //
143 Wafer module((unsigned int) hashId);
144 std::string errorMessage("");
145 if (!m_moduleTree->add(index["barrel_endcap"],
146 index["layer_wheel"],
147 index["eta_module"],
148 index["phi_module"],
149 module,
150 errorMessage)) {
151 ATH_MSG_ERROR(errorMessage);
152 }
153
154 return;
155}
#define endmsg
#define ATH_MSG_VERBOSE(x)
MsgStream & msg() const
The standard message stream.
constexpr bool is_valid() const
std::map< std::string, int > m_geometryMap

◆ addSensorType()

void InDetDD::PLRGmxInterface::addSensorType ( const std::string & clas,
const std::string & typeName,
const std::map< std::string, std::string > & parameters )
finaloverridevirtual

Reimplemented from InDetDD::ITk::PixelGmxInterface.

Definition at line 77 of file PLRGmxInterface.cxx.

80{
81 ATH_MSG_DEBUG("addSensorType called for class " << clas << ", typeName " << typeName);
82 // only load the sensor type that the PLR will use
83 if (clas == "SingleChip_RD53" && (typeName == "RD53_20x19_Single_25x100" || typeName == "PLR_20x19_Single_25x100")) {
84 makePLRModule(typeName, parameters);
85 }
86}
void makePLRModule(const std::string &typeName, const std::map< std::string, std::string > &parameters)

◆ buildReadoutGeometryFromSqlite()

void InDetDD::PLRGmxInterface::buildReadoutGeometryFromSqlite ( IRDBAccessSvc * RDBAccessSvc,
GeoModelIO::ReadGeoModel * sqlreader )
virtual

Definition at line 158 of file PLRGmxInterface.cxx.

158 {
159
160 const std::array<std::string,1> sensorTypes{"SingleChip_RD53"};
161 const std::array<std::string,17> ParamNames{"circuitsPerEta", "circuitsPerPhi", "thickness", "is3D", "rows", "columns", "pitchEta", "pitchPhi", "pitchEtaLong", "pitchPhiLong", "pitchEtaEnd", "pitchPhiEnd", "nPhiLongPerSide", "nEtaLongPerSide", "nPhiEndPerSide", "nEtaEndPerSide", "detectorType"};
162 static const std::string empty;
163 for(const std::string & sType:sensorTypes){
164
165 IRDBRecordset_ptr PLR_module = rdbAccessSvc->getRecordsetPtr(sType,empty);
166
167 if(PLR_module->size() != 0){
168
169 for (const auto& typeParams : *PLR_module){
170 std::map<std::string,std::string> PLR_moduleMap;
171
172 for(const std::string & paramName:ParamNames){
173 std::string paramValue = typeParams->getString(paramName);
174 PLR_moduleMap[paramName] = std::move(paramValue);
175 }
176 std::string sensorName = typeParams->getString("SensorType");
177 addSensorType(sType, sensorName, PLR_moduleMap);
178 }
179 } else ATH_MSG_WARNING("Could not retrieve "<<sType<<" table");
180 }
181
182 //Now, loop over the FullPhysVols and create the SiDetectorElements
183 //lots of string parsing...
184 const std::array<std::string,5> fields{"barrel_endcap","layer_wheel","phi_module","eta_module","side"};
185 //First, find which name the tables are in the file under (depends upon the plugin used to create the input file)
186 //sort these in order of precedence - ITkPlugin, then ITkPixelPlugin, then GeoModelXMLPlugin
187 const std::array<std::string,3> publishers({"ITk","ITkPixel","GeoModelXML"});
188 //The below is a map of string keys which will contain all the Identifier/DetElement relevant info, and the associated FullPhysVol
189 // (once filled from the published table in the SQLite)
190 std::map<std::string, GeoFullPhysVol*> mapFPV;
191 for (auto & iPub : publishers){
192 //setting the "checkTable" option to true, so that an empty map will be returned if not found and we can try the next one
193 mapFPV = sqlreader->getPublishedNodes<std::string, GeoFullPhysVol*>(iPub,true);
194 if (!mapFPV.empty()) {
195 ATH_MSG_INFO("Using FPV tables from publisher "<<iPub);
196 break;
197 }
198 }
199 if (mapFPV.empty()) ATH_MSG_ERROR("Could not find any FPV tables under the expected names: "<<publishers);
200
201 for (const auto&[fullPhysVolInfoString, fullPhysVolPointer] : mapFPV){
202 //find the name of the corresponding detector design type
203 size_t startRG = fullPhysVolInfoString.find("PLR_");
204 if(startRG==std::string::npos){
205 ATH_MSG_DEBUG("GeoFullPhysVol "<<fullPhysVolInfoString<<" does not have the expected format. Skipping");
206 continue;
207 }
208 std::string typeName = fullPhysVolInfoString.substr(startRG);
209 std::map<std::string, int> index;
210 for (const std::string & field:fields){
211 size_t first = fullPhysVolInfoString.find(field+"_");
212 size_t last = fullPhysVolInfoString.find('_',first+field.size()+1); //start looking only after end of first delimiter (plus 1 for the "_" appended) ends
213 if(first==std::string::npos || last==std::string::npos){
214 ATH_MSG_WARNING("Could not extract "<<field<<" from "<<fullPhysVolInfoString<<". Skipping");
215 continue;
216 }
217 std::string strNew = fullPhysVolInfoString.substr(first+field.size()+1,last-(first+field.size()+1));
218 index[field] = std::stoi(strNew);
219 }
220 addSensor(typeName,index,0,fullPhysVolPointer);
221 }
222}
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
static const Attributes_t empty
virtual unsigned int size() const =0
virtual void addSensorType(const std::string &clas, const std::string &typeName, const std::map< std::string, std::string > &parameters) override final
virtual void addSensor(const std::string &typeName, std::map< std::string, int > &index, int sequentialId, GeoVFullPhysVol *fpv) override final
bool first
Definition DeMoScan.py:534
str index
Definition DeMoScan.py:362

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ makePixelModule()

void InDetDD::ITk::PixelGmxInterface::makePixelModule ( const std::string & typeName,
const std::map< std::string, std::string > & parameters )
protectedinherited

Definition at line 132 of file PixelGmxInterface.cxx.

134{
135 int circuitsPerEta{2}; // row
136 int circuitsPerPhi{2}; // column
137 double thickness{0.150};
138 double pitchEta{};
139 double pitchPhi{};
140 double pitchEtaLong{};
141 double pitchPhiLong{};
142 double pitchEtaEnd{};
143 double pitchPhiEnd{};
144 int nEtaLongPerSide{};
145 int nPhiLongPerSide{};
146 int nEtaEndPerSide{};
147 int nPhiEndPerSide{};
148 int rowsPerCircuit{};
149 int columnsPerCircuit{};
150
151 // unused
153 int readoutSide{1};
154 bool is3D{false};
155
156 bool phiSymmetric{true};
157 bool etaSymmetric{true};
158 bool depthSymmetric{true};
159
160 // read parameters
161 getParameter(typeName, parameters, "circuitsPerEta", circuitsPerEta);
162 getParameter(typeName, parameters, "circuitsPerPhi", circuitsPerPhi);
163 getParameter(typeName, parameters, "thickness", thickness);
164 getParameter(typeName, parameters, "is3D", is3D);
165 getParameter(typeName, parameters, "rows", rowsPerCircuit);
166 getParameter(typeName, parameters, "columns", columnsPerCircuit);
167 getParameter(typeName, parameters, "pitchEta", pitchEta);
168 getParameter(typeName, parameters, "pitchPhi", pitchPhi);
169 getParameter(typeName, parameters, "pitchEtaLong", pitchEtaLong);
170 getParameter(typeName, parameters, "pitchPhiLong", pitchPhiLong);
171 getParameter(typeName, parameters, "pitchEtaEnd", pitchEtaEnd);
172 getParameter(typeName, parameters, "pitchPhiEnd", pitchPhiEnd);
173 getParameter(typeName, parameters, "nPhiLongPerSide", nPhiLongPerSide);
174 getParameter(typeName, parameters, "nEtaLongPerSide", nEtaLongPerSide);
175 getParameter(typeName, parameters, "nPhiEndPerSide", nPhiEndPerSide);
176 getParameter(typeName, parameters, "nEtaEndPerSide", nEtaEndPerSide);
177
178 checkParameter(typeName, parameters, "phiSymmetric", phiSymmetric);
179 checkParameter(typeName, parameters, "etaSymmetric", etaSymmetric);
180 checkParameter(typeName, parameters, "depthSymmetric", depthSymmetric);
181
182 //
183 // Make Module Design and add to DetectorManager
184 //
185 ATH_MSG_DEBUG("readout geo - design thickness " << thickness << " "
186 << " circuits " << circuitsPerPhi << " " << circuitsPerEta << " "
187 << " rows/columns " << rowsPerCircuit << " " << columnsPerCircuit << " "
188 << " pitch regular/long/end " << pitchPhi << " " << pitchEta
189 << " " << pitchPhiLong << " " << pitchEtaLong
190 << " " << pitchPhiEnd << " " << pitchEtaEnd
191 << " n-long " << nPhiLongPerSide << " " << nEtaLongPerSide
192 << " n-end " << nPhiEndPerSide << " " << nEtaEndPerSide
193 << carrier << " " << readoutSide);
194
195 //For optionally setting PixelBarrel,PixelEndcap,PixelInclined
196 //(so far) primarily useful for the latter to avoid orientation warnings
197 InDetDD::DetectorType detectorType{InDetDD::PixelBarrel}; // TODO: we should probably fail and not default to barrel here.
198 int detectorTypeEnum = 0;
199 if (checkParameter(typeName, parameters, "detectorType", detectorTypeEnum)) {
200 if (detectorTypeEnum == 1) detectorType = InDetDD::PixelBarrel;
201 else if (detectorTypeEnum == 2) detectorType = InDetDD::PixelEndcap;
202 else if (detectorTypeEnum == 3) detectorType = InDetDD::PixelInclined;
203 }
204
205 InDetDD::PixelReadoutTechnology readoutTechnology = getPixelReadoutTechnology(detectorType, rowsPerCircuit, columnsPerCircuit );
206
207 if ( circuitsPerPhi*rowsPerCircuit<0 || circuitsPerPhi*rowsPerCircuit >= std::numeric_limits<PixelDiodeTree::CellIndexType>::max()
208 || circuitsPerEta*columnsPerCircuit<0 || circuitsPerEta*columnsPerCircuit >= std::numeric_limits<PixelDiodeTree::CellIndexType>::max()) {
209 std::stringstream amsg;
210 amsg << "Index overflows index type of PixelDiodeTree. Parameters "
211 << "( " << circuitsPerPhi << " * " << rowsPerCircuit << " ), ( "
212 << "( " << circuitsPerEta << " * " << columnsPerCircuit << " ) !<"
213 << std::numeric_limits<PixelDiodeTree::CellIndexType>::max() << " each.";
214 throw std::runtime_error(amsg.str());
215 }
216
217 // @TODO remove once all endcap modules are oriented consistently i.e. there is
218 // one relation between local "hardware" coordinates and local offline coordinates
219 bool flipFE=(typeName.find("_even") !=std::string::npos);
220
221 // helper function to associate correct diode type and front-end number to sub-matrices and diodes
222 // in the diode tree as attributes.
223 auto computeAttribute = [readoutTechnology,
224 pitchPhi,
225 pitchEta,
226 circuitsPerPhi,
227 circuitsPerEta,
228 rowsPerCircuit,
229 columnsPerCircuit,
230 flipFE
231 ](const std::array<PixelDiodeTree::IndexType,2> &split_idx,
232 const PixelDiodeTree::Vector2D &diode_width,
233 [[maybe_unused]] const std::array<bool,4> &ganged,
234 [[maybe_unused]] unsigned int split_i,
235 PixelDiodeTree::AttributeType current_matrix_attribute,
236 PixelDiodeTree::AttributeType current_diode_attribute)
237 -> std::tuple<PixelDiodeTree::AttributeType,PixelDiodeTree::AttributeType>
238 {
239 // split_idx the absolute index at which this sub-matrix is split into 4 sub-sub-matrices
240 // diode_width the diode pitch in both directions
241 // ganged ganged[0],ganged[1] whether the pixel diode is ganged in the corresponding direction
242 // ganged[2],ganged[3] whether the diode is inside (true) or outside the dead zone
243 // where ganged[2] denotes the flag in local-x and ganged[3] in local-y direction
244 //
245 // split_i defines which of the 4 areas the diode belongs to : 2 | 3 ^
246 // ----- | local-y (chip-columns)
247 // 0 | 1 |
248 // ---> local-x (chip-rows)
249 //
250 // current_matrix_attribute the default attribute for the unsplit sub-matrix assigned by the builder
251 // current_diode_attribute the default attribute assigned to the current diode associated to the split
252 // area specified by split_i
253 // return new matrix attribute, new diode attribute
254
255 // if the pixel is significantly wider in one direction consider the pixel to be long
256 // or if wider in both directions large
257 assert(split_idx[0]>=0 && split_idx[1]>=0);
258 std::array<int,2> chip_idx{split_idx[0]/rowsPerCircuit, split_idx[1]/columnsPerCircuit};
259
260 unsigned int n_large_dimensions = ( (std::abs(diode_width[0]-pitchPhi)>pitchPhi*.25)
261 +(std::abs(diode_width[1]-pitchEta)>pitchEta*.25));
262 switch (n_large_dimensions) {
263 case 1:
265 break;
266 case 2:
268 break;
269 default:
271 }
272
273 if (readoutTechnology==InDetDD::PixelReadoutTechnology::RD53) {
274 // The matrix attribute is used to store the front-end number, this works because
275 // the matrices are first split by circuit and then by inner edge.
276
277 // @TODO Is the numbering-scheme something that should be specified by the DB ?
278 //
279 // The front-ends are numbered like ^ 0 | 1 2 | 3
280 // | ----- ------
281 // local-x | 2 | 3 0 \ 1
282 // row/phi | (even) (odd)
283 // + ---> local-y (chip-column/eta)
284 //
285 // (the sensor facing side of even modules points towards the IP)
286
287 // Numbering scheme taken from the ITkPixelReadoutManager:
288 if (flipFE) {
289 current_matrix_attribute = InDetDD::detail::makeAttributeType(chip_idx[1] + (circuitsPerPhi-chip_idx[0]-1)*2);
290 }
291 else {
292 current_matrix_attribute = InDetDD::detail::makeAttributeType(chip_idx[1] + chip_idx[0]*2);
293 }
294
295 }
296 else {
297 // @TODO compute front-end number correctly
298 // just do something simple:
299 // if there is a single row just the chip-column (local-y, eta)
300 // if there are two rows: top row chip-column starting from the opposite end; bottom row: chip column + chips per top row
301 // ^ 0 |.. |n/2-1
302 // local-x | --------------- [swapped axis direction to fit into fewer lines]
303 // /eta | n-1 |... |n/2
304 // --> local-y (chip-rows, phi)
305 current_matrix_attribute = InDetDD::detail::makeAttributeType( chip_idx[0] > 0
306 ? circuitsPerEta - chip_idx[1] - 1
307 : (circuitsPerPhi-1) * circuitsPerEta + chip_idx[1]);
308 }
309 return std::make_tuple(current_matrix_attribute, current_diode_attribute);
310 };
311
312 PixelDiodeTree diode_tree
313 = createPixelDiodeTree(std::array<unsigned int,2>{static_cast<unsigned int>(circuitsPerPhi),static_cast<unsigned int>(circuitsPerEta)},
314 std::array<unsigned int,2>{static_cast<unsigned int>(rowsPerCircuit),static_cast<unsigned int>(columnsPerCircuit)},
315 PixelDiodeTree::Vector2D{pitchPhi,pitchEta}, // regular ptich
316 std::array<std::array<unsigned int,2>, 2>{ std::array<unsigned int,2>{static_cast<unsigned int>(nPhiEndPerSide),
317 static_cast<unsigned int>(nEtaEndPerSide)}, // outer edge in pixels
318 std::array<unsigned int,2>{static_cast<unsigned int>(nPhiLongPerSide),
319 static_cast<unsigned int>(nEtaLongPerSide)}}, // inner edge in pixels
320 std::array<PixelDiodeTree::Vector2D,2>{PixelDiodeTree::Vector2D{pitchPhiEnd, pitchEtaEnd}, // outer edge pitch (correct?)
321 PixelDiodeTree::Vector2D{pitchPhiLong,pitchEtaLong} // inner edge pitch
322 },
323 std::array<std::array<unsigned int,2>, 2>{ std::array<unsigned int,2>{0u,0u}, // @TODO add dead zone for run1-3 pixels?
324 std::array<unsigned int,2>{0u,0u} // @TODO add dead zone for run1-3 pixels?
325 },
326 computeAttribute,
327 nullptr);
328
329 auto design = std::make_unique<PixelModuleDesign>(thickness,
330 phiSymmetric, etaSymmetric, depthSymmetric,
331 circuitsPerPhi, circuitsPerEta,
332 columnsPerCircuit, rowsPerCircuit,
333 columnsPerCircuit, rowsPerCircuit,
334 std::move(diode_tree), carrier,
335 readoutSide, is3D, detectorType, readoutTechnology);
336
337 ATH_MSG_DEBUG("readout geo - design : " << typeName
338 << " " << design->width() << "x" << design->length() << "x" << design->thickness()
339 << " " << design->rows() << "x" << design->columns()
340 << ", " << circuitsPerPhi << "x" << circuitsPerEta << " "
341 << rowsPerCircuit << " " << columnsPerCircuit << ":\n"
342 << diode_tree.debugStringRepr());
343
344 [[maybe_unused]] auto observePtr = m_detectorManager->addDesign(std::move(design));
345
346 // Add to map for addModule routine
347 m_geometryMap[typeName] = m_detectorManager->numDesigns() - 1;
348}
InDetDD::PixelDiodeTree::AttributeType makeAttributeType(T val)
convenience method to convert the given value into an attribute
PixelDiodeTree createPixelDiodeTree(const std::array< unsigned int, 2 > &chip_dim, const std::array< unsigned int, 2 > &chip_matrix_dim, const PixelDiodeTree::Vector2D &pitch, const std::array< std::array< unsigned int, 2 >, 2 > &edge_dim, const std::array< PixelDiodeTree::Vector2D, 2 > &edge_pitch, const std::array< std::array< unsigned int, 2 >, 2 > &dead_zone, const AttributeRefiner &func_compute_attribute, std::ostream *debug_out=nullptr)
Create a pixel diode tree.
std::vector< T > getParameter(const std::string &varName, const std::vector< std::string > &buffer)
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77

◆ makePLRModule()

void InDetDD::PLRGmxInterface::makePLRModule ( const std::string & typeName,
const std::map< std::string, std::string > & parameters )
private

Definition at line 226 of file PLRGmxInterface.cxx.

228{
229 int circuitsPerEta{1}; // row
230 int circuitsPerPhi{1}; // column
231 double thickness{0.150};
232 double pitchEta{};
233 double pitchPhi{};
234 double pitchEtaLong{};
235 double pitchPhiLong{};
236 double pitchEtaEnd{};
237 double pitchPhiEnd{};
238 int nEtaLongPerSide{};
239 int nPhiLongPerSide{};
240 int nEtaEndPerSide{};
241 int nPhiEndPerSide{};
242 int rowsPerCircuit{};
243 int columnsPerCircuit{};
244
245 // unused
247 int readoutSide{1};
248 bool is3D{true};
249
250 // read parameters
251 getParameter(typeName, parameters, "circuitsPerEta", circuitsPerEta);
252 getParameter(typeName, parameters, "circuitsPerPhi", circuitsPerPhi);
253 getParameter(typeName, parameters, "thickness", thickness);
254 getParameter(typeName, parameters, "is3D", is3D);
255 getParameter(typeName, parameters, "rows", rowsPerCircuit);
256 getParameter(typeName, parameters, "columns", columnsPerCircuit);
257 getParameter(typeName, parameters, "pitchEta", pitchEta);
258 getParameter(typeName, parameters, "pitchPhi", pitchPhi);
259 getParameter(typeName, parameters, "pitchEtaLong", pitchEtaLong);
260 getParameter(typeName, parameters, "pitchPhiLong", pitchPhiLong);
261 getParameter(typeName, parameters, "pitchEtaEnd", pitchEtaEnd);
262 getParameter(typeName, parameters, "pitchPhiEnd", pitchPhiEnd);
263 getParameter(typeName, parameters, "nPhiLongPerSide", nPhiLongPerSide);
264 getParameter(typeName, parameters, "nEtaLongPerSide", nEtaLongPerSide);
265 getParameter(typeName, parameters, "nPhiEndPerSide", nPhiEndPerSide);
266 getParameter(typeName, parameters, "nEtaEndPerSide", nEtaEndPerSide);
267
269
270 // helper function to associate attributes to sub-matrices and diodes.
271 auto computeAttribute = [pitchPhi,
272 pitchEta,
273 rowsPerCircuit,
274 columnsPerCircuit
275 ](const std::array<PixelDiodeTree::IndexType,2> &split_idx,
276 const PixelDiodeTree::Vector2D &diode_width,
277 [[maybe_unused]] const std::array<bool,4> &ganged,
278 [[maybe_unused]] unsigned int split_i,
279 PixelDiodeTree::AttributeType current_matrix_attribute,
280 PixelDiodeTree::AttributeType current_diode_attribute)
281 -> std::tuple<PixelDiodeTree::AttributeType,PixelDiodeTree::AttributeType>
282 {
283 assert (readoutTechnology==InDetDD::PixelReadoutTechnology::RD53);
284 // split_idx the absolute index at which this sub-matrix is split into 4 sub-sub-matrices
285 // diode_width the diode pitch in both directions
286 // ganged ganged[0],ganged[1] whether the pixel diode is ganged in the corresponding direction
287 // ganged[2],ganged[3] whether the diode is inside (true) or outside the dead zone
288 // where ganged[2] denotes the flag in local-x and ganged[3] in local-y direction
289 //
290 // split_i defines which of the 4 areas the diode belongs to : 2 | 3 ^
291 // ----- | local-y (chip-columns)
292 // 0 | 1 |
293 // ---> local-x (chip-rows)
294 //
295 // current_matrix_attribute the default attribute for the unsplit sub-matrix assigned by the builder
296 // current_diode_attribute the default attribute assigned to the current diode associated to the split
297 // area specified by split_i
298 // return new matrix attribute, new diode attribute
299
300 // if the pixel is significantly wider in one direction consider the pixel to be long
301 // or if wider in both directions large
302 assert(split_idx[0]>=0 && split_idx[1]>=0);
303 std::array<int,2> chip_idx{split_idx[0]/rowsPerCircuit, split_idx[1]/columnsPerCircuit};
304
305 unsigned int n_large_dimensions = ( (std::abs(diode_width[0]-pitchPhi)>pitchPhi*.25)
306 +(std::abs(diode_width[1]-pitchEta)>pitchEta*.25));
307 switch (n_large_dimensions) {
308 case 1:
310 break;
311 case 2:
313 break;
314 default:
316 }
317
318 current_matrix_attribute = InDetDD::detail::makeAttributeType(chip_idx[1] + chip_idx[0]*2);
319 return std::make_tuple(current_matrix_attribute, current_diode_attribute);
320 };
321
322 PixelDiodeTree diode_tree
323 = createPixelDiodeTree(std::array<unsigned int,2>{static_cast<unsigned int>(circuitsPerPhi),static_cast<unsigned int>(circuitsPerEta)},
324 std::array<unsigned int,2>{static_cast<unsigned int>(rowsPerCircuit),static_cast<unsigned int>(columnsPerCircuit)},
325 PixelDiodeTree::Vector2D{pitchPhi,pitchEta}, // regular ptich
326 std::array<std::array<unsigned int,2>, 2>{ std::array<unsigned int,2>{static_cast<unsigned int>(nPhiEndPerSide),
327 static_cast<unsigned int>(nEtaEndPerSide)}, // outer edge in pixels
328 std::array<unsigned int,2>{static_cast<unsigned int>(nPhiLongPerSide),
329 static_cast<unsigned int>(nEtaLongPerSide)}}, // inner edge in pixels
330 std::array<PixelDiodeTree::Vector2D,2>{PixelDiodeTree::Vector2D{pitchPhiEnd, pitchEtaEnd}, // outer edge pitch (correct?)
331 PixelDiodeTree::Vector2D{pitchPhiLong,pitchEtaLong} // inner edge pitch
332 },
333 std::array<std::array<unsigned int,2>, 2>{ std::array<unsigned int,2>{0u,0u}, // @TODO add dead zone for run1-3 pixels
334 std::array<unsigned int,2>{0u,0u} // @TODO add dead zone for run1-3 pixels
335 },
336 computeAttribute,
337 nullptr);
338
339 // Setting module identifier to InDetDD::PLR
340 // (so far) primarily useful to avoid orientation warnings
342
343 auto design = std::make_unique<PixelModuleDesign>(thickness,
344 circuitsPerPhi, circuitsPerEta,
345 columnsPerCircuit, rowsPerCircuit,
346 columnsPerCircuit, rowsPerCircuit,
347 std::move(diode_tree), carrier,
348 readoutSide, is3D, detectorType,
349 readoutTechnology);
350
351 ATH_MSG_DEBUG("readout geo - design " << typeName << " " << design->width() << "x" << design->length() << "x" << design->thickness()
352 << " " << design->rows() << "x" << design->columns()
353 << ", " << circuitsPerPhi << "x" << circuitsPerEta << " "
354 << rowsPerCircuit << "x" << columnsPerCircuit
355 << " carrier " << carrier << " readout side " << readoutSide << ":\n"
356 << diode_tree.debugStringRepr());
357
358 [[maybe_unused]] auto observedPtr = m_detectorManager->addDesign(std::move(design));
359
360 // Add to map for addModule routine
361 m_geometryMap[typeName] = m_detectorManager->numDesigns() - 1;
362}

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels).
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ sensorId()

int InDetDD::PLRGmxInterface::sensorId ( std::map< std::string, int > & index) const
finaloverridevirtual

Reimplemented from InDetDD::ITk::PixelGmxInterface.

Definition at line 36 of file PLRGmxInterface.cxx.

37{
38 // Return the Simulation HitID (nothing to do with "ATLAS Identifiers" aka "Offline Identifiers")
39
40 // Check if identifier is valid
41 // TODO: drop this check in the future
42 const PLR_ID *pixelIdHelper = dynamic_cast<const PLR_ID *>(m_commonItems->getIdHelper());
43 if (not pixelIdHelper){
44 ATH_MSG_ERROR("Failed dynamic_cast to PLR_ID in PLRGmxInterface::sensorId");
45 return -1;
46 }
47 Identifier id = pixelIdHelper->wafer_id(index["barrel_endcap"],
48 index["layer_wheel"],
49 index["phi_module"],
50 index["eta_module"]);
51 IdentifierHash hashId = pixelIdHelper->wafer_hash(id);
52 if (!hashId.is_valid()) {
53 ATH_MSG_WARNING("PLR Invalid hash for Index list: " << index["barrel_endcap"] << " " << index["layer_wheel"] << " "
54 << index["eta_module"] << " " << index["phi_module"] << " " << index["side"]);
55 return -1;
56 }
57 // Compute the actuall SiHitId, first number is the part number: lumi=2
58 int hitIdOfModule = SiHitIdHelper::GetHelper()->buildHitId(2,
59 index["barrel_endcap"],
60 index["layer_wheel"],
61 index["eta_module"],
62 index["phi_module"],
63 index["side"]);
64 ATH_MSG_DEBUG("Index list: " << index["barrel_endcap"] << " " << index["layer_wheel"] << " "
65 << index["eta_module"] << " " << index["phi_module"] << " " << index["side"]);
66 ATH_MSG_DEBUG("hitIdOfModule = " << std::hex << hitIdOfModule << std::dec);
67 ATH_MSG_DEBUG(" bec = " << SiHitIdHelper::GetHelper()->getBarrelEndcap(hitIdOfModule)
68 << " lay = " << SiHitIdHelper::GetHelper()->getLayerDisk(hitIdOfModule)
69 << " eta = " << SiHitIdHelper::GetHelper()->getEtaModule(hitIdOfModule)
70 << " phi = " << SiHitIdHelper::GetHelper()->getPhiModule(hitIdOfModule)
71 << " side = " << SiHitIdHelper::GetHelper()->getSide(hitIdOfModule));
72
73 return hitIdOfModule;
74}
int buildHitId(const int, const int, const int, const int, const int, const int) const
static const SiHitIdHelper * GetHelper()

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging).

Definition at line 141 of file AthMessaging.h.

◆ m_commonItems

SiCommonItems* InDetDD::ITk::PixelGmxInterface::m_commonItems {}
protectedinherited

Definition at line 59 of file PixelGmxInterface.h.

59{};

◆ m_detectorManager

PixelDetectorManager* InDetDD::ITk::PixelGmxInterface::m_detectorManager {}
protectedinherited

Definition at line 58 of file PixelGmxInterface.h.

58{};

◆ m_geometryMap

std::map<std::string, int> InDetDD::ITk::PixelGmxInterface::m_geometryMap
protectedinherited

Definition at line 53 of file PixelGmxInterface.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_moduleTree

WaferTree* InDetDD::ITk::PixelGmxInterface::m_moduleTree {}
protectedinherited

Definition at line 60 of file PixelGmxInterface.h.

60{};

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files: