ATLAS Offline Software
Loading...
Searching...
No Matches
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
12namespace 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);
67 namespace detail {
69 template<typename T>
70 bool validAttributeType(T val) {
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
Tree structure to find the position, index or pitch of a pixel on a semi-regular grid The grid is con...
bool validAttributeType(T val)
convenience method to test whether the given value can be converted into an attribute
InDetDD::PixelDiodeTree::AttributeType makeAttributeType(T val)
convenience method to convert the given value into an attribute
Message Stream Member.
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
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.