ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
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 addAlignable (int level, std::map< std::string, int > &index, GeoVFullPhysVol *fpv, GeoAlignableTransform *transform) override final
 
void buildReadoutGeometryFromSqlite (IRDBAccessSvc *rdbAccessSvc, GeoModelIO::ReadGeoModel *sqlreader)
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

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. More...
 

Private Attributes

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

Detailed Description

Definition at line 24 of file PLRGmxInterface.h.

Constructor & Destructor Documentation

◆ PLRGmxInterface()

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

Definition at line 22 of file PLRGmxInterface.cxx.

25  : PixelGmxInterface(detectorManager, commonItems, moduleTree)
26 {}

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  }
548 }

◆ 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 81 of file PLRGmxInterface.cxx.

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

◆ 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 69 of file PLRGmxInterface.cxx.

72 {
73  ATH_MSG_DEBUG("addSensorType called for class " << clas << ", typeName " << typeName);
74  // only load the sensor type that the PLR will use
75  if (clas == "SingleChip_RD53" && (typeName == "RD53_20x19_Single_25x100" || typeName == "PLR_20x19_Single_25x100")) {
77  }
78 }

◆ buildReadoutGeometryFromSqlite()

void InDetDD::ITk::PixelGmxInterface::buildReadoutGeometryFromSqlite ( IRDBAccessSvc rdbAccessSvc,
GeoModelIO::ReadGeoModel *  sqlreader 
)
inherited

Definition at line 429 of file PixelGmxInterface.cxx.

429  {
430 
431  const std::array<std::string,2> sensorTypes{"QuadChip_RD53","SingleChip_RD53"};
432  const std::array<std::string,17> rd53_ParamNames{"circuitsPerEta","circuitsPerPhi","columns","detectorType","is3D","nEtaEndPerSide","nEtaLongPerSide","nPhiEndPerSide","nPhiLongPerSide","pitchEta","pitchEtaEnd","pitchEtaLong","pitchPhi","pitchPhiEnd","pitchPhiLong","rows","thickness"};
433 
434  for(const std::string & sType:sensorTypes){
435  IRDBRecordset_ptr rd53 = rdbAccessSvc->getRecordsetPtr(sType,"");
436  if(rd53->size() !=0){
437  for (unsigned int iR =0;iR<rd53->size();iR++){
438  std::map<std::string,std::string> rd53_Map;
439  for(const std::string & paramName:rd53_ParamNames){
440  std::string paramValue = (*rd53)[iR]->getString(paramName);
441  rd53_Map[paramName] = std::move(paramValue);
442  }
443  std::string rd35_Name = (*rd53)[iR]->getString("SensorType");
444  makePixelModule(rd35_Name,rd53_Map);
445  // @TODO remove once all endcap modules are oriented consistently i.e. there is
446  // one relation between local "hardware" coordinates and local offline coordinates
447  if ( rd35_Name.find("Quad")!= std::string::npos
448  && ( rd35_Name.find("endcap")!= std::string::npos
449  || rd35_Name.find("inclined")!= std::string::npos)) {
450  makePixelModule(rd35_Name+"_even",rd53_Map);
451  }
452  }
453  }
454  else ATH_MSG_WARNING("Could not retrieve "<<sType<<" table");
455  }
456 
457  //Now, loop over the FullPhysVols and create the SiDetectorElements
458  //lots of string parsing...
459  const std::array<std::string,5> fields{"barrel_endcap","layer_wheel","phi_module","eta_module","side"};
460  //First, find which name the tables are in the file under (depends upon the plugin used to create the input file)
461  //sort these in order of precedence - ITkPlugin, then ITkPixelPlugin, then GeoModelXMLPlugin
462  const std::array<std::string,3> publishers({"ITk","ITkPixel","GeoModelXML"});
463  //The below is a map of string keys which will contain all the Identifier/DetElement relevant info, and the associated FullPhysVol
464  // (once filled from the published table in the SQLite)
465  std::map<std::string, GeoFullPhysVol*> mapFPV;
466  for (auto & iPub : publishers){
467  //setting the "checkTable" option to true, so that an empty map will be returned if not found and we can try the next one
468  mapFPV = sqlreader->getPublishedNodes<std::string, GeoFullPhysVol*>(iPub,true);
469  if (!mapFPV.empty()) {
470  ATH_MSG_DEBUG("Using FPV tables from publisher "<<iPub);
471  break;
472  }
473  }
474  if (mapFPV.empty()) ATH_MSG_ERROR("Could not find any FPV tables under the expected names: "<<publishers);
475 
476  for (const auto&[fullPhysVolInfoString, fullPhysVolPointer] : mapFPV){
477  //find the name of the corresponding detector design type
478  size_t startRG = fullPhysVolInfoString.find("RD53_");
479  if(startRG==std::string::npos){
480  ATH_MSG_DEBUG("GeoFullPhysVol "<<fullPhysVolInfoString<<" does not have the expected format. Skipping");
481  continue;
482  }
483  std::string typeName = fullPhysVolInfoString.substr(startRG);
484  std::map<std::string, int> index;
485  for (const std::string & field:fields){
486  size_t first = fullPhysVolInfoString.find(field+"_");
487  size_t last = fullPhysVolInfoString.find('_',first+field.size()+1);//start looking only after end of first delimiter (plus 1 for the "_" appended) ends
488  if(first==std::string::npos || last==std::string::npos){
489  ATH_MSG_DEBUG("Could not extract "<<field<<" from "<<fullPhysVolInfoString<<". Skipping");
490  continue;
491  }
492  std::string strNew = fullPhysVolInfoString.substr(first+field.size()+1,last-(first+field.size()+1));
493  index[field] = std::stoi(strNew);
494  }
495 
496  addSensor(typeName,index,0,fullPhysVolPointer);
497  }
498 
499 }

◆ 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  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ 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 << " ) !<"
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
348 }

◆ makePLRModule()

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

Definition at line 150 of file PLRGmxInterface.cxx.

152 {
153  int circuitsPerEta{1}; // row
154  int circuitsPerPhi{1}; // column
155  double thickness{0.150};
156  double pitchEta{};
157  double pitchPhi{};
158  double pitchEtaLong{};
159  double pitchPhiLong{};
160  double pitchEtaEnd{};
161  double pitchPhiEnd{};
162  int nEtaLongPerSide{};
163  int nPhiLongPerSide{};
164  int nEtaEndPerSide{};
165  int nPhiEndPerSide{};
166  int rowsPerCircuit{};
167  int columnsPerCircuit{};
168 
169  // unused
171  int readoutSide{1};
172  bool is3D{true};
173 
174  // read parameters
175  getParameter(typeName, parameters, "circuitsPerEta", circuitsPerEta);
176  getParameter(typeName, parameters, "circuitsPerPhi", circuitsPerPhi);
177  getParameter(typeName, parameters, "thickness", thickness);
178  getParameter(typeName, parameters, "is3D", is3D);
179  getParameter(typeName, parameters, "rows", rowsPerCircuit);
180  getParameter(typeName, parameters, "columns", columnsPerCircuit);
181  getParameter(typeName, parameters, "pitchEta", pitchEta);
182  getParameter(typeName, parameters, "pitchPhi", pitchPhi);
183  getParameter(typeName, parameters, "pitchEtaLong", pitchEtaLong);
184  getParameter(typeName, parameters, "pitchPhiLong", pitchPhiLong);
185  getParameter(typeName, parameters, "pitchEtaEnd", pitchEtaEnd);
186  getParameter(typeName, parameters, "pitchPhiEnd", pitchPhiEnd);
187  getParameter(typeName, parameters, "nPhiLongPerSide", nPhiLongPerSide);
188  getParameter(typeName, parameters, "nEtaLongPerSide", nEtaLongPerSide);
189  getParameter(typeName, parameters, "nPhiEndPerSide", nPhiEndPerSide);
190  getParameter(typeName, parameters, "nEtaEndPerSide", nEtaEndPerSide);
191 
193 
194  // helper function to associate attributes to sub-matrices and diodes.
195  auto computeAttribute = [pitchPhi,
196  pitchEta,
197  rowsPerCircuit,
198  columnsPerCircuit
199  ](const std::array<PixelDiodeTree::IndexType,2> &split_idx,
200  const PixelDiodeTree::Vector2D &diode_width,
201  [[maybe_unused]] const std::array<bool,4> &ganged,
202  [[maybe_unused]] unsigned int split_i,
203  PixelDiodeTree::AttributeType current_matrix_attribute,
204  PixelDiodeTree::AttributeType current_diode_attribute)
205  -> std::tuple<PixelDiodeTree::AttributeType,PixelDiodeTree::AttributeType>
206  {
207  assert (readoutTechnology==InDetDD::PixelReadoutTechnology::RD53);
208  // split_idx the absolute index at which this sub-matrix is split into 4 sub-sub-matrices
209  // diode_width the diode pitch in both directions
210  // ganged ganged[0],ganged[1] whether the pixel diode is ganged in the corresponding direction
211  // ganged[2],ganged[3] whether the diode is inside (true) or outside the dead zone
212  // where ganged[2] denotes the flag in local-x and ganged[3] in local-y direction
213  //
214  // split_i defines which of the 4 areas the diode belongs to : 2 | 3 ^
215  // ----- | local-y (chip-columns)
216  // 0 | 1 |
217  // ---> local-x (chip-rows)
218  //
219  // current_matrix_attribute the default attribute for the unsplit sub-matrix assigned by the builder
220  // current_diode_attribute the default attribute assigned to the current diode associated to the split
221  // area specified by split_i
222  // return new matrix attribute, new diode attribute
223 
224  // if the pixel is significantly wider in one direction consider the pixel to be long
225  // or if wider in both directions large
226  assert(split_idx[0]>=0 && split_idx[1]>=0);
227  std::array<int,2> chip_idx{split_idx[0]/rowsPerCircuit, split_idx[1]/columnsPerCircuit};
228 
229  unsigned int n_large_dimensions = ( (std::abs(diode_width[0]-pitchPhi)>pitchPhi*.25)
230  +(std::abs(diode_width[1]-pitchEta)>pitchEta*.25));
231  switch (n_large_dimensions) {
232  case 1:
234  break;
235  case 2:
237  break;
238  default:
240  }
241 
242  current_matrix_attribute = InDetDD::detail::makeAttributeType(chip_idx[1] + chip_idx[0]*2);
243  return std::make_tuple(current_matrix_attribute, current_diode_attribute);
244  };
245 
246  PixelDiodeTree diode_tree
247  = createPixelDiodeTree(std::array<unsigned int,2>{static_cast<unsigned int>(circuitsPerPhi),static_cast<unsigned int>(circuitsPerEta)},
248  std::array<unsigned int,2>{static_cast<unsigned int>(rowsPerCircuit),static_cast<unsigned int>(columnsPerCircuit)},
249  PixelDiodeTree::Vector2D{pitchPhi,pitchEta}, // regular ptich
250  std::array<std::array<unsigned int,2>, 2>{ std::array<unsigned int,2>{static_cast<unsigned int>(nPhiEndPerSide),
251  static_cast<unsigned int>(nEtaEndPerSide)}, // outer edge in pixels
252  std::array<unsigned int,2>{static_cast<unsigned int>(nPhiLongPerSide),
253  static_cast<unsigned int>(nEtaLongPerSide)}}, // inner edge in pixels
254  std::array<PixelDiodeTree::Vector2D,2>{PixelDiodeTree::Vector2D{pitchPhiEnd, pitchEtaEnd}, // outer edge pitch (correct?)
255  PixelDiodeTree::Vector2D{pitchPhiLong,pitchEtaLong} // inner edge pitch
256  },
257  std::array<std::array<unsigned int,2>, 2>{ std::array<unsigned int,2>{0u,0u}, // @TODO add dead zone for run1-3 pixels
258  std::array<unsigned int,2>{0u,0u} // @TODO add dead zone for run1-3 pixels
259  },
260  computeAttribute,
261  nullptr);
262 
263  // Setting module identifier to InDetDD::PLR
264  // (so far) primarily useful to avoid orientation warnings
265  InDetDD::DetectorType detectorType{InDetDD::PLR};
266 
267  auto design = std::make_unique<PixelModuleDesign>(thickness,
268  circuitsPerPhi, circuitsPerEta,
269  columnsPerCircuit, rowsPerCircuit,
270  columnsPerCircuit, rowsPerCircuit,
271  std::move(diode_tree), carrier,
272  readoutSide, is3D, detectorType,
273  readoutTechnology);
274 
275  ATH_MSG_DEBUG("readout geo - design " << typeName << " " << design->width() << "x" << design->length() << "x" << design->thickness()
276  << " " << design->rows() << "x" << design->columns()
277  << ", " << circuitsPerPhi << "x" << circuitsPerEta << " "
278  << rowsPerCircuit << "x" << columnsPerCircuit
279  << " carrier " << carrier << " readout side " << readoutSide << ":\n"
280  << diode_tree.debugStringRepr());
281 
282  [[maybe_unused]] auto observedPtr = m_detectorManager->addDesign(std::move(design));
283 
284  // Add to map for addModule routine
286 }

◆ 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 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ 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 179 of file AthMessaging.h.

180 { 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 (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ sensorId()

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

Reimplemented from InDetDD::ITk::PixelGmxInterface.

Definition at line 28 of file PLRGmxInterface.cxx.

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

◆ 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.

◆ m_detectorManager

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

Definition at line 58 of file PixelGmxInterface.h.

◆ 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.

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_moduleTree

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

Definition at line 60 of file PixelGmxInterface.h.

◆ 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:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
InDetDD::PixelReadoutTechnology
PixelReadoutTechnology
Definition: PixelReadoutDefinitions.h:37
InDetDD::PLR
@ PLR
Definition: DetectorDesign.h:46
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
InDetDD::SiCommonItems::getIdHelper
const AtlasDetectorID * getIdHelper() const
Definition: SiCommonItems.h:83
index
Definition: index.py:1
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
InDetDD::SiDetectorManager::numDesigns
int numDesigns() const
Definition: SiDetectorManager.cxx:140
skel.it
it
Definition: skel.GENtoEVGEN.py:407
PLR_ID
This is a Identifier helper class for the PLR subdetector. This class inherits from PixelID.
Definition: PLR_ID.h:22
InDetDD::SiDetectorManager::addDesign
const SiDetectorDesign * addDesign(std::unique_ptr< const SiDetectorDesign > &&)
Access to module design; returns an observer pointer.
Definition: SiDetectorManager.cxx:134
athena.value
value
Definition: athena.py:124
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
InDetDD::ITk::PixelGmxInterface::m_moduleTree
WaferTree * m_moduleTree
Definition: PixelGmxInterface.h:60
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
InDetDD::PixelInclined
@ PixelInclined
Definition: DetectorDesign.h:46
InDetDD::ITk::PixelGmxInterface::m_geometryMap
std::map< std::string, int > m_geometryMap
Definition: PixelGmxInterface.h:53
InDetDD::PixelEndcap
@ PixelEndcap
Definition: DetectorDesign.h:46
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
InDetDD::PixelReadoutTechnology::RD53
@ RD53
PixelConditionsData::getParameter
std::vector< T > getParameter(const std::string &varName, const std::vector< std::string > &buffer)
Definition: PixelConditionsDataStringUtils.h:51
python.PyAthena.module
module
Definition: PyAthena.py:131
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDetDD::PixelDiodeType::LONG
@ LONG
InDetDD::DetectorType
DetectorType
Definition: DetectorDesign.h:45
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Wafer
Definition: WaferTree.h:27
BarrelEndcap::add
bool add(int bec, int ld, int eta, int phi, int side, Wafer &wafer, std::string &errorMessage)
Definition: WaferTree.cxx:55
InDetDD::PixelDiodeTree::AttributeType
unsigned int AttributeType
Definition: PixelDiodeTree.h:39
InDetDD::SiDetectorManager::getDesign
const SiDetectorDesign * getDesign(int i) const
Definition: SiDetectorManager.cxx:146
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
InDetDD::PLRGmxInterface::makePLRModule
void makePLRModule(const std::string &typeName, const std::map< std::string, std::string > &parameters)
Definition: PLRGmxInterface.cxx:150
InDetDD::PixelDiodeType::LARGE
@ LARGE
InDetDD::ITk::PixelGmxInterface::m_commonItems
SiCommonItems * m_commonItems
Definition: PixelGmxInterface.h:59
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
InDetDD::PixelDetectorManager::addAlignableTransform
virtual void addAlignableTransform(int level, const Identifier &id, GeoAlignableTransform *xf, const GeoVFullPhysVol *child)
Add alignable transforms.
Definition: PixelDetectorManager.cxx:274
IdentifierHash::is_valid
bool is_valid() const
Check if id is in a valid state.
InDetDD::ITk::PixelGmxInterface::PixelGmxInterface
PixelGmxInterface(PixelDetectorManager *detectorManager, SiCommonItems *commonItems, WaferTree *moduleTree)
Definition: PixelGmxInterface.cxx:50
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
InDetDD::PixelBarrel
@ PixelBarrel
Definition: DetectorDesign.h:46
InDetDD::ITk::PixelGmxInterface::makePixelModule
void makePixelModule(const std::string &typeName, const std::map< std::string, std::string > &parameters)
Definition: PixelGmxInterface.cxx:132
InDetDD::detail::makeAttributeType
InDetDD::PixelDiodeTree::AttributeType makeAttributeType(T val)
convenience method to convert the given value into an attribute
Definition: PixelDiodeTreeBuilder.h:79
InDetDD::PixelDiodeTree::Vector2D
Amg::Vector2D Vector2D
Definition: PixelDiodeTree.h:35
InDetDD::ITk::PixelGmxInterface::m_detectorManager
PixelDetectorManager * m_detectorManager
Definition: PixelGmxInterface.h:58
DeMoScan.index
string index
Definition: DeMoScan.py:362
InDetDD::CarrierType
CarrierType
Definition: InDetDD_Defs.h:17
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
DeMoScan.first
bool first
Definition: DeMoScan.py:534
SiHitIdHelper::GetHelper
static const SiHitIdHelper * GetHelper()
Definition: SiHitIdHelper.cxx:19
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
InDetDD::PixelDiodeType::NORMAL
@ NORMAL
CaloCondBlobAlgs_fillNoiseFromASCII.fields
fields
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:105
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
InDetDD::ITk::PixelGmxInterface::addSensor
virtual void addSensor(const std::string &typeName, std::map< std::string, int > &index, int sequentialId, GeoVFullPhysVol *fpv) override
Definition: PixelGmxInterface.cxx:351
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
SiHitIdHelper::buildHitId
int buildHitId(const int, const int, const int, const int, const int, const int) const
Definition: SiHitIdHelper.cxx:118
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
InDetDD::createPixelDiodeTree
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.
Definition: PixelDiodeTreeBuilder.cxx:224
PixelID
Definition: PixelID.h:67
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
InDetDD::PixelDetectorManager::addDetectorElement
virtual void addDetectorElement(SiDetectorElement *element) override
Add elememts.
Definition: PixelDetectorManager.cxx:128
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
python.SystemOfUnits.ms
float ms
Definition: SystemOfUnits.py:148
Identifier
Definition: IdentifierFieldParser.cxx:14