Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
InDet::ConnectedModulesUtil Namespace Reference

Functions

template<class T_ID >
std::unordered_multimap< unsigned int, unsigned int > createModuleConnectionMap (const T_ID &id_helper, const InDetDD::SiDetectorElementCollection &det_ele_coll)
 create a map between detector elements and all such elements connected the same sensor More...
 
template<class T_ID >
void visitMatchingConnectedModules (const T_ID &id_helper, const std::vector< int > &a_module_pattern, const InDetDD::SiDetectorElementCollection &det_ele_coll, unsigned id_hash, const std::unordered_multimap< unsigned int, unsigned int > &connected_modules, std::function< void(unsigned int id_hash, const InDetDD::SiDetectorElement &)> visit_func)
 Visit all detector elements connected to the same physical sensor which match the given pattern. More...
 

Function Documentation

◆ createModuleConnectionMap()

template<class T_ID >
std::unordered_multimap<unsigned int, unsigned int> InDet::ConnectedModulesUtil::createModuleConnectionMap ( const T_ID &  id_helper,
const InDetDD::SiDetectorElementCollection det_ele_coll 
)
inline

create a map between detector elements and all such elements connected the same sensor

Parameters
id_helperthe ID identifier helper e.g. SCT_ID
det_ele_collcollection of all detector elements e.g. all Strip detector elements
Returns
the created map. Create a map between detector elements and all detector elements which are connected to either side of the same physical sensor.

Definition at line 28 of file ConnectedModulesUtil.h.

29  {
30  std::unordered_multimap<unsigned int, unsigned int> connected_modules;
31  std::size_t det_ele_coll_sz = det_ele_coll.size();
32  for (unsigned int module_i=0u;module_i<det_ele_coll_sz;++module_i) {
33  const InDetDD::SiDetectorElement *det_ele = det_ele_coll[module_i];
34  const InDetDD::SiDetectorElement *side_det_ele = det_ele;
35  for (unsigned int side_i=0; side_i<2; ++side_i) {
36  const GeoVFullPhysVol*phys_vol = side_det_ele->getMaterialGeom();
37  if (phys_vol) {
38  connected_modules.insert( std::make_pair(phys_vol->getId(), module_i));
39  }
40  unsigned int id_hash = id_helper.get_other_side(det_ele->identifyHash());
41  if (id_hash >= det_ele_coll.size()) break;
42  side_det_ele = det_ele_coll[id_hash];
43  }
44  }
45  return connected_modules;
46  }

◆ visitMatchingConnectedModules()

template<class T_ID >
void InDet::ConnectedModulesUtil::visitMatchingConnectedModules ( const T_ID &  id_helper,
const std::vector< int > &  a_module_pattern,
const InDetDD::SiDetectorElementCollection det_ele_coll,
unsigned  id_hash,
const std::unordered_multimap< unsigned int, unsigned int > &  connected_modules,
std::function< void(unsigned int id_hash, const InDetDD::SiDetectorElement &)>  visit_func 
)
inline

Visit all detector elements connected to the same physical sensor which match the given pattern.

Parameters
id_helperthe ID identifier helper e.g. SCT_ID
a_module_patterna pattern to match module identifiers
det_ele_collcollection of all detector elements e.g. all strip detector elements
id_hashthe ID hash of the module which defines the physical sensor
module_connectionsmap which associates an ID hash to all ID hashes of modules connected to the same physical sensor
visit_funcfunction to be called for all connected modules which match the pattern Will visit all modules connected to both sides of the same physical sensor excluding the module given by id_hash itself. More over the visited modules have to match the side range defined in the given pattern, and have to be in the same row unless the all-rows flag is set in the pattern.

Definition at line 60 of file ConnectedModulesUtil.h.

65  {
66  assert( id_hash < det_ele_coll.size() );
68  || ModuleIdentifierMatchUtil::matchesBothSides(a_module_pattern)) {
69  const InDetDD::SiDetectorElement *det_ele = det_ele_coll[id_hash];
70  // propagate the defect to all modules connected to the same physical sensor
71  // i.e. also mark opposite side or other rows as defect if configured accordingly
72  if (det_ele->getMaterialGeom()) {
73  std::pair< std::unordered_multimap< unsigned int, unsigned int>::const_iterator,
74  std::unordered_multimap< unsigned int, unsigned int>::const_iterator >
75  childs = connected_modules.equal_range(det_ele->getMaterialGeom()->getId());
76  unsigned int other_side_id_hash = id_helper.get_other_side(det_ele->identifyHash());
77  using ConnectedKey_t = unsigned int;
78  for (const std::pair<const ConnectedKey_t, unsigned int> &child : std::ranges::subrange(childs.first, childs.second)) {
79  assert( child.second < det_ele_coll.size());
80  const InDetDD::SiDetectorElement *connected_det_ele( det_ele_coll[child.second] );
81  int side = id_helper.side( connected_det_ele->identify());
82  if ( ModuleIdentifierMatchUtil::isSideMatching(a_module_pattern, side)
84  || child.second == other_side_id_hash)) {
85  assert(connected_det_ele);
86  visit_func(child.second, *connected_det_ele);
87  }
88  }
89  }
90  }
91  }
InDet::ModuleIdentifierMatchUtil::matchesAllModuleRowsOfSensor
bool matchesAllModuleRowsOfSensor(const std::vector< int > &a_module_pattern)
Test whether a pattern matches all module rows of a sensor or just a single row.
Definition: ModuleIdentifierMatchUtil.h:199
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
InDetDD::SolidStateDetectorElementBase::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
TRT::Hit::side
@ side
Definition: HitInfo.h:83
InDet::ModuleIdentifierMatchUtil::isSideMatching
bool isSideMatching(const std::vector< int > &a_module_pattern, int side)
Test whether the given pattern matches the given side.
Definition: ModuleIdentifierMatchUtil.h:186
InDet::ModuleIdentifierMatchUtil::matchesBothSides
bool matchesBothSides(const std::vector< int > &a_module_pattern)
Test whether the given pattern matches identifiers which refer to either side of a sensor.
Definition: ModuleIdentifierMatchUtil.h:179
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109