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

Namespaces

 detail
 

Typedefs

using ModuleData_t = std::array< int, ModuleIdentifierMatchUtil::kAllRows/2 >
 

Enumerations

enum  EModulePatternPart {
  kBarrelEndcapSelectRange =0, kLayerRange =2, kEtaRange =4, kPhiRange =6,
  kColumnStripRange =8, kLength =10, kSideRange =12, kAllRows =14,
  kNParts =15
}
 The identifier parts used for identifier matching kAllRows denotes the element which contains a flag (0, 1), to specify whether a pattern should match all modules which are connected to the same side of a physical sensor. More...
 

Functions

template<ModuleDesignConcept T_ModuleDesign>
int getColumnsOrCells (const T_ModuleDesign &moduleDesign)
 
template<bool test_order, typename T >
bool verifyElementCountAndOrder (const std::vector< std::vector< T > > &arr, std::size_t n_expected, [[maybe_unused]] std::size_t test_n=0)
 Test whether the given 2D vector has the expected number of elements, and correct ordering. More...
 
bool verifyModulePatternList (const std::vector< std::vector< int > > &arr)
 Verify whether a list of module identifier patterns is consistent. More...
 
template<typename T >
bool verifyElementCount (const std::vector< std::vector< T > > &arr, std::size_t n_expected)
 test whether the 2D vector arr has the expected number of elements. More...
 
void setModuleData (EModulePatternPart part, int value, std::array< int, kAllRows/2 > &dest)
 Convenience function to set the specified element in the given array. More...
 
template<class T_ID , class T_ModuleDesign >
void setModuleData (const T_ID &id_helper, const Identifier &identifier, const T_ModuleDesign &module_design, ModuleData_t &module_data)
 Convenience function to extract various identifier parts and set the given array. More...
 
void moduleMatches (const std::vector< std::vector< int > > &module_pattern, const ModuleData_t &module_data, std::vector< unsigned int > &module_pattern_idx)
 Test whether an identifier, which is split into various parts, matches some of the given patterns. More...
 
bool matchesBothSides (const std::vector< int > &a_module_pattern)
 Test whether the given pattern matches identifiers which refer to either side of a sensor. More...
 
bool isSideMatching (const std::vector< int > &a_module_pattern, int side)
 Test whether the given pattern matches the given side. More...
 
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. More...
 

Variables

template<typename T_ModuleDesign >
concept HasColumns = requires(T_ModuleDesign design) { design.columns(); }
 
template<typename T_ModuleDesign >
concept HasCells = requires(T_ModuleDesign design) { design.cells(); }
 
template<typename T_ModuleDesign >
concept ModuleDesignConcept = HasColumns<T_ModuleDesign> || HasCells<T_ModuleDesign>
 

Typedef Documentation

◆ ModuleData_t

Definition at line 67 of file ModuleIdentifierMatchUtil.h.

Enumeration Type Documentation

◆ EModulePatternPart

The identifier parts used for identifier matching kAllRows denotes the element which contains a flag (0, 1), to specify whether a pattern should match all modules which are connected to the same side of a physical sensor.

Enumerator
kBarrelEndcapSelectRange 
kLayerRange 
kEtaRange 
kPhiRange 
kColumnStripRange 
kLength 
kSideRange 
kAllRows 
kNParts 

Definition at line 55 of file ModuleIdentifierMatchUtil.h.

55  {
57  kLayerRange=2,
58  kEtaRange=4,
59  kPhiRange=6,
61  kLength=10,
62  kSideRange=12,
63  kAllRows=14,
64  kNParts=15
65  };

Function Documentation

◆ getColumnsOrCells()

template<ModuleDesignConcept T_ModuleDesign>
int InDet::ModuleIdentifierMatchUtil::getColumnsOrCells ( const T_ModuleDesign &  moduleDesign)

Definition at line 40 of file ModuleIdentifierMatchUtil.h.

40  {
41  if constexpr(HasColumns<T_ModuleDesign>) {
42  return moduleDesign.columns();
43  }
44  else {
45  return moduleDesign.cells();
46  }
47  }

◆ isSideMatching()

bool InDet::ModuleIdentifierMatchUtil::isSideMatching ( const std::vector< int > &  a_module_pattern,
int  side 
)
inline

Test whether the given pattern matches the given side.

Definition at line 186 of file ModuleIdentifierMatchUtil.h.

186  {
187  assert( ModuleIdentifierMatchUtil::kSideRange+1 < a_module_pattern.size() );
188  return side >= a_module_pattern[ModuleIdentifierMatchUtil::kSideRange]
189  && side <= a_module_pattern[ModuleIdentifierMatchUtil::kSideRange+1];
190  }

◆ matchesAllModuleRowsOfSensor()

bool InDet::ModuleIdentifierMatchUtil::matchesAllModuleRowsOfSensor ( const std::vector< int > &  a_module_pattern)
inline

Test whether a pattern matches all module rows of a sensor or just a single row.

Parameters
a_module_patterna module identifier pattern
Returns
true if the pattern matches all module rows connected to a physical sensor. A sensor might be connected to multiple modules where the modules might be connected to the same sensor side in multiple rows. If the given pattern matches all rows, this function returns true.

Definition at line 199 of file ModuleIdentifierMatchUtil.h.

199  {
200  assert(ModuleIdentifierMatchUtil::kAllRows < a_module_pattern.size());
201  return a_module_pattern[ModuleIdentifierMatchUtil::kAllRows] != 0;
202  }

◆ matchesBothSides()

bool InDet::ModuleIdentifierMatchUtil::matchesBothSides ( const std::vector< int > &  a_module_pattern)
inline

Test whether the given pattern matches identifiers which refer to either side of a sensor.

Parameters
a_module_patterna module identifier pattern
Returns
true if the side range only contains one element A sensor might be connected to multiple modules where the modules might be located on different sides of a sensor. The side range may contain one side only or both sides. In the latter case this function returns true.

Definition at line 179 of file ModuleIdentifierMatchUtil.h.

179  {
180  assert( ModuleIdentifierMatchUtil::kSideRange+1 < a_module_pattern.size() );
181  return a_module_pattern[ModuleIdentifierMatchUtil::kSideRange]
182  != a_module_pattern[ModuleIdentifierMatchUtil::kSideRange+1];
183  }

◆ moduleMatches()

void InDet::ModuleIdentifierMatchUtil::moduleMatches ( const std::vector< std::vector< int > > &  module_pattern,
const ModuleData_t module_data,
std::vector< unsigned int > &  module_pattern_idx 
)
inline

Test whether an identifier, which is split into various parts, matches some of the given patterns.

Parameters
module_patternan array which contains ranges for various identifier parts
module_dataan array which contains various parts of an identifier
module_pattern_idxan output vector which will be filled with the indices of matching patterns Will test all "patterns" in module pattern whether they match the given identifier parts. The patterns contain ranges of identifier parts (start and end of the range are inclusive). For a pattern to match, all identifier parts have to be within the allowed range of a pattern.

Definition at line 150 of file ModuleIdentifierMatchUtil.h.

152  {
153  module_pattern_idx.clear();
154  for (unsigned int pattern_i=0u; pattern_i<module_pattern.size(); ++pattern_i) {
155  const std::vector<int> &pattern = module_pattern[pattern_i];
156  unsigned int range_i=0;
157  bool match=true;
158  for (int module_value : module_data) {
159  assert( range_i+1 < pattern.size());
160  if (module_value<pattern[range_i] || module_value>pattern[range_i+1]) {
161  match=false;
162  break;
163  }
164  range_i+=2;
165  }
166  if (match) {
167  module_pattern_idx.push_back(pattern_i);
168  }
169  }
170  }

◆ setModuleData() [1/2]

template<class T_ID , class T_ModuleDesign >
void InDet::ModuleIdentifierMatchUtil::setModuleData ( const T_ID &  id_helper,
const Identifier identifier,
const T_ModuleDesign &  module_design,
ModuleData_t module_data 
)
inline

Convenience function to extract various identifier parts and set the given array.

Parameters
id_helperthe ID helper e.g. PixelID, SCT_ID to extract various parts from the given identifier
identifierthe identifier from which the various parts are extracted
n_columns_or_stripseither the number of columns (e.g. for pixel) or strips
module_datathe array which will be filled with the identifier parts Fill an array with identifier parts which can be used to match module identifiers.

Definition at line 129 of file ModuleIdentifierMatchUtil.h.

132  {
133  setModuleData(kBarrelEndcapSelectRange, id_helper.barrel_ec(identifier), module_data);
134  setModuleData(kLayerRange, id_helper.layer_disk(identifier), module_data);
135  setModuleData(kEtaRange, id_helper.eta_module(identifier), module_data);
136  setModuleData(kPhiRange, id_helper.phi_module(identifier), module_data);
137  setModuleData(kColumnStripRange, getColumnsOrCells(module_design), module_data);
138  setModuleData(kLength, static_cast<int>(module_design.length()*1e3), module_data);
139  setModuleData(kSideRange, detail::getZeroOrSide(id_helper,identifier),module_data);
140  }

◆ setModuleData() [2/2]

void InDet::ModuleIdentifierMatchUtil::setModuleData ( EModulePatternPart  part,
int  value,
std::array< int, kAllRows/2 > &  dest 
)
inline

Convenience function to set the specified element in the given array.

Parameters
partspecifies the element to set
valuethe value to copy to the array
destthe array to which the value is copied

Definition at line 116 of file ModuleIdentifierMatchUtil.h.

116  {
117  assert( part%2==0 && static_cast<unsigned int>(part/2)<dest.size());
118  dest[part/2] = value;
119  }

◆ verifyElementCount()

template<typename T >
bool InDet::ModuleIdentifierMatchUtil::verifyElementCount ( const std::vector< std::vector< T > > &  arr,
std::size_t  n_expected 
)
inline

test whether the 2D vector arr has the expected number of elements.

See verifyElementCountAndOrder

Definition at line 107 of file ModuleIdentifierMatchUtil.h.

107  {
108  return verifyElementCountAndOrder<false,T>(arr,n_expected, 0);
109  }

◆ verifyElementCountAndOrder()

template<bool test_order, typename T >
bool InDet::ModuleIdentifierMatchUtil::verifyElementCountAndOrder ( const std::vector< std::vector< T > > &  arr,
std::size_t  n_expected,
[[maybe_unused] ] std::size_t  test_n = 0 
)
inline

Test whether the given 2D vector has the expected number of elements, and correct ordering.

Template Parameters
test_orderif true test element order otherwise only test element count
Telement type
Parameters
arr2D array to be tested
n_expectednumber of elements of in each element vector of the top-level vector
test_nnumber of elements (not pairs) to test when verifying the correct order of element pairs
Returns
true if arr passes the tests Test whether each element vector of arr, which is a vector, contains the same number of elements n_expected. if test_order is true also test whether the first test_n/2 element pairs of each element vector of arr are in ascending order i.e. arr[..][2*i] < arr[..][2*i+1] for all i..n_test/2

Definition at line 81 of file ModuleIdentifierMatchUtil.h.

81  {
82  for (const auto &sub_arr : arr) {
83  if (sub_arr.size() != n_expected) return false;
84  if (test_n%2 != 0 || test_n>=n_expected) return false;
85  if constexpr(test_order) {
86  for (unsigned int i=0; i<test_n; i+=2) {
87  if (sub_arr.at(i)>sub_arr.at(i+1)) return false;
88  }
89  }
90  }
91  return true;
92  }

◆ verifyModulePatternList()

bool InDet::ModuleIdentifierMatchUtil::verifyModulePatternList ( const std::vector< std::vector< int > > &  arr)
inline

Verify whether a list of module identifier patterns is consistent.

The function tests whether the given 2D vector has the correct number of elements and whether the element pairs which represent ranges have the expected ascending order. See verifyElementCountAndOrder

Definition at line 99 of file ModuleIdentifierMatchUtil.h.

99  {
100  return verifyElementCountAndOrder<true,int>(arr,kNParts, kAllRows);
101  }

Variable Documentation

◆ HasCells

template<typename T_ModuleDesign >
concept InDet::ModuleIdentifierMatchUtil::HasCells = requires(T_ModuleDesign design) { design.cells(); }

Definition at line 32 of file ModuleIdentifierMatchUtil.h.

◆ HasColumns

template<typename T_ModuleDesign >
concept InDet::ModuleIdentifierMatchUtil::HasColumns = requires(T_ModuleDesign design) { design.columns(); }

Definition at line 30 of file ModuleIdentifierMatchUtil.h.

◆ ModuleDesignConcept

template<typename T_ModuleDesign >
concept InDet::ModuleIdentifierMatchUtil::ModuleDesignConcept = HasColumns<T_ModuleDesign> || HasCells<T_ModuleDesign>

Definition at line 35 of file ModuleIdentifierMatchUtil.h.

LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
InDet::ModuleIdentifierMatchUtil::kAllRows
@ kAllRows
Definition: ModuleIdentifierMatchUtil.h:63
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:26
InDet::ModuleIdentifierMatchUtil::kEtaRange
@ kEtaRange
Definition: ModuleIdentifierMatchUtil.h:58
InDet::ModuleIdentifierMatchUtil::kPhiRange
@ kPhiRange
Definition: ModuleIdentifierMatchUtil.h:59
athena.value
value
Definition: athena.py:124
perfmonmt-printer.dest
dest
Definition: perfmonmt-printer.py:189
InDet::ModuleIdentifierMatchUtil::setModuleData
void setModuleData(const T_ID &id_helper, const Identifier &identifier, const T_ModuleDesign &module_design, ModuleData_t &module_data)
Convenience function to extract various identifier parts and set the given array.
Definition: ModuleIdentifierMatchUtil.h:129
InDet::ModuleIdentifierMatchUtil::getColumnsOrCells
int getColumnsOrCells(const T_ModuleDesign &moduleDesign)
Definition: ModuleIdentifierMatchUtil.h:40
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
InDet::ModuleIdentifierMatchUtil::detail::getZeroOrSide
int getZeroOrSide(const T_ID &id_helper, const Identifier &id)
Definition: ModuleIdentifierMatchUtil.h:18
InDet::ModuleIdentifierMatchUtil::kNParts
@ kNParts
Definition: ModuleIdentifierMatchUtil.h:64
TRT::Hit::side
@ side
Definition: HitInfo.h:83
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDet::ModuleIdentifierMatchUtil::kSideRange
@ kSideRange
Definition: ModuleIdentifierMatchUtil.h:62
InDet::ModuleIdentifierMatchUtil::kLength
@ kLength
Definition: ModuleIdentifierMatchUtil.h:61
InDet::ModuleIdentifierMatchUtil::kBarrelEndcapSelectRange
@ kBarrelEndcapSelectRange
Definition: ModuleIdentifierMatchUtil.h:56
InDet::ModuleIdentifierMatchUtil::kLayerRange
@ kLayerRange
Definition: ModuleIdentifierMatchUtil.h:57
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356
InDet::ModuleIdentifierMatchUtil::kColumnStripRange
@ kColumnStripRange
Definition: ModuleIdentifierMatchUtil.h:60