ATLAS Offline Software
PixelDiodeTreeBuilder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3  */
4 #ifndef INDETDD_PIXELDIODETREEBUILDER_H
5 #define INDETDD_PIXELDIODETREEBUILDER_H
6 
7 #include "PixelDiodeTree.h"
8 #include <ostream>
9 #include <functional>
10 #include <tuple>
11 
12 namespace InDetDD {
13 
14  // AttributeRefiner is a functional to "compute" the diode and sub-matrix attributes for a
15  // certain split which contains at least one diode
16  //
17  // arguments
18  // 1) split_idx the index of the split position ,
19  // 2) diode_width the width of the diode in local-x and local-y direction
20  // 3) ganged an array of flags to indicate whether the diode is "ganged" in local-x or local-y,
21  // then two additional flags (elements 2,3) to indicate whether the diode is in the dead-zone
22  // in local-x or local-y (true) or outside (false).
23  // 4) split_i defines which of the 4 areas the diode belongs to : 2 | 3 ^
24  // ----- | local-y (chip-columns)
25  // 0 | 1 |
26  // ---> local-x (chip-rows)
27  // 5) the current_matrix_attribute which may already be set to a custom value, where all diodes of
28  // the same "split" have to set the matrix attribute to the same value otherwise the result will be undefined.
29  // 6) the current_diode_attribute which may already be set if the same diode appears in multiple splits, where
30  // this functional has to yield the same attribute for each re-occurrence of the same diode.
31  // The input value of current_matrix_attribute will be zero
32  // The input value of current_diode_attribute will contain information about the edges the diode is in.
33  // The bottom 16 bits are used for the edge-information in local-x direction, and the subsequent 16 bits
34  // for the edge-information in local-y direction:
35  // 1 for regular diodes,
36  // 2 for diodes in the outer edge
37  // 4 for diodes in the inner edge, and the value will be
38  // +8 if the pixel is ganged.
40  = std::function<std::tuple<PixelDiodeTree::AttributeType,PixelDiodeTree::AttributeType>
41  (const std::array<PixelDiodeTree::IndexType,2> & /* split_idx*/,
42  const PixelDiodeTree::Vector2D & /* diode_width*/,
43  const std::array<bool,4> & /* ganged*/,
44  unsigned int /* split_i*/,
45  PixelDiodeTree::AttributeType /* current_matrix_attribute*/,
46  PixelDiodeTree::AttributeType /* current_diode_attribute*/ )>;
47 
58  PixelDiodeTree createPixelDiodeTree( const std::array<unsigned int,2> &chip_dim,
59  const std::array<unsigned int,2> &chip_matrix_dim,
60  const PixelDiodeTree::Vector2D &pitch,
61  const std::array<std::array<unsigned int,2>,2> &edge_dim,
62  const std::array<PixelDiodeTree::Vector2D,2> &edge_pitch,
63  const std::array<std::array<unsigned int,2>,2> &dead_zone,
64  const AttributeRefiner &func_compute_attribute,
65  std::ostream *debug_out=nullptr);
66 
67  namespace detail {
69  template<typename T>
71  static_assert( sizeof(T) <= sizeof(InDetDD::PixelDiodeTree::AttributeType));
72  auto storage_type = static_cast<InDetDD::PixelDiodeTree::AttributeType>(val);
73  T user_type = static_cast<T>(storage_type);
74  return val==user_type;
75  }
76 
78  template<typename T>
80  assert( validAttributeType(val));
81  return static_cast<InDetDD::PixelDiodeTree::AttributeType>(val);
82  }
83  }
84 }
85 #endif
InDetDD::PixelDiodeTree
Tree structure to find the position, index or pitch of a pixel on a semi-regular grid The grid is con...
Definition: PixelDiodeTree.h:33
detail
Definition: extract_histogram_tag.cxx:14
InDetDD::PixelDiodeTree::AttributeType
unsigned int AttributeType
Definition: PixelDiodeTree.h:39
InDetDD::detail::validAttributeType
bool validAttributeType(T val)
convenience method to test whether the given value can be converted into an attribute
Definition: PixelDiodeTreeBuilder.h:70
lumiFormat.array
array
Definition: lumiFormat.py:91
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
Message Stream Member.
Definition: FakeTrackBuilder.h:8
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
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
PixelDiodeTree.h
InDetDD::AttributeRefiner
std::function< std::tuple< PixelDiodeTree::AttributeType, PixelDiodeTree::AttributeType >(const std::array< PixelDiodeTree::IndexType, 2 > &, const PixelDiodeTree::Vector2D &, const std::array< bool, 4 > &, unsigned int, PixelDiodeTree::AttributeType, PixelDiodeTree::AttributeType)> AttributeRefiner
Definition: PixelDiodeTreeBuilder.h:46