ATLAS Offline Software
eTauSortSelectCountPortsOut.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef GLOBALSIM_ETAUSORTSELECTCOUNTPORTSOUT_H
6 #define GLOBALSIM_ETAUSORTSELECTCOUNTPORTSOUT_H
7 
8 #include "GenericTob.h"
9 
10 #include <ostream>
11 #include <memory>
12 #include <vector>
13 
14 
15 #include "AthenaKernel/CLASS_DEF.h"
16 
17 namespace GlobalSim {
18 
20 
21  //eTauSortSelectCount
22 
23  constexpr static std::size_t NumSort{3};
24  // 0:eTaus 1:eTausl 2:eTausm, 3:eTauab, 4:eTauabm
25  constexpr static std::size_t NumSelect{5};
26  constexpr static std::size_t NumNoSort{0};
27 
28  // no of sorts = No of items to keep for each sort
29  constexpr static std::array<std::size_t, NumSort> SortOutWidths {
30  {6UL, 10UL, 10UL}
31  };
32 
33 
34  constexpr static std::size_t SortOutWidth{
37  0U)};
38 
39  constexpr static std::size_t NoSortOutWidth{0};
40 
41  constexpr static std::size_t NumTotalTobWidth{SortOutWidth +
43 
44  // indices to place sorted tobs in output array found by compile
45  // time summing of width values.
46  constexpr static std::array<std::size_t, NumSort> SortOutStart =
47  []{
48  std::array<std::size_t, NumSort> a{};
49  std::partial_sum(std::cbegin(SortOutWidths),
50  std::cend(SortOutWidths)-1,
51  a.begin()+1,
52  std::plus<std::size_t>());
53  return a;
54  }();
55 
56  constexpr static std::size_t NumCount{14};
57  constexpr static std::array<unsigned, NumCount> CountOutWidth {
58  2,2,2,2,2,2,2,2,2,2,2,2,2,2
59  };
60 
61  // calculate the total width from the individual widths
62  constexpr static std::size_t NumTotalCountWidth{
65  0U)};
66 
67  // calculate the start position in the output bits for each count
68  constexpr static std::array<std::size_t, NumCount> CountOutStart =
69  []{
70  std::array<std::size_t, NumCount> a{};
71  std::partial_sum(std::cbegin(CountOutWidth),
72  std::cend(CountOutWidth)-1,
73  a.begin()+1,
74  std::plus<std::size_t>());
75  return a;
76  }();
77 
78 
79  // [2^n-1..] where n are the elements of CountOutWidth
80  constexpr static std::array<std::size_t, NumCount> max_counts = [] {
81  std::array<std::size_t, NumCount> a{};
82  for (std::size_t ind =0; ind != CountOutWidth.size(); ++ind) {
83  std::size_t result = 1;
84  for(unsigned i = 1; i <= CountOutWidth[ind]; ++i) {
85  result *= 2;
86  }
87 
88  a[ind] = result-1;
89  }
90  return a;
91  }();
92 
93 
94  using GenTobPtr = std::shared_ptr<GenericTob>;
96  std::shared_ptr<std::bitset<NumTotalCountWidth>>;
97 
98  // Output GenericTobs. VHDL variable is an array of GenericTobs
99  std::array<GenTobPtr, NumTotalTobWidth> m_O_eTauGenTob;
100 
101  // Output counts. VHDL variable is a bit array
103  m_O_Multiplicity{std::make_shared<std::bitset<NumTotalCountWidth>>()};
104 
106  for(std::size_t i = 0; i != NumTotalTobWidth; ++i) {
107  m_O_eTauGenTob[i] = std::make_shared<GenericTob>();
108  }
109  }
110  };
111 
112 }
113 
114 std::ostream&
115 operator<< (std::ostream&,
117 
119 
120 #endif
121 
GlobalSim::eTauSortSelectCountPortsOut::SortOutWidths
constexpr static std::array< std::size_t, NumSort > SortOutWidths
Definition: eTauSortSelectCountPortsOut.h:29
get_generator_info.result
result
Definition: get_generator_info.py:21
GlobalSim::eTauSortSelectCountPortsOut::SortOutWidth
constexpr static std::size_t SortOutWidth
Definition: eTauSortSelectCountPortsOut.h:34
GlobalSim::eTauSortSelectCountPortsOut::CountOutWidth
constexpr static std::array< unsigned, NumCount > CountOutWidth
Definition: eTauSortSelectCountPortsOut.h:57
GlobalSim::eTauSortSelectCountPortsOut::eTauSortSelectCountPortsOut
eTauSortSelectCountPortsOut()
Definition: eTauSortSelectCountPortsOut.h:105
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
GlobalSim::eTauSortSelectCountPortsOut::NumSelect
constexpr static std::size_t NumSelect
Definition: eTauSortSelectCountPortsOut.h:25
GenericTob.h
GlobalSim::eTauSortSelectCountPortsOut::BSPtrNumTotalCountWidth
std::shared_ptr< std::bitset< NumTotalCountWidth > > BSPtrNumTotalCountWidth
Definition: eTauSortSelectCountPortsOut.h:96
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
GlobalSim::eTauSortSelectCountPortsOut
Definition: eTauSortSelectCountPortsOut.h:19
GlobalSim
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Definition: dump.h:8
GlobalSim::eTauSortSelectCountPortsOut::NumCount
constexpr static std::size_t NumCount
Definition: eTauSortSelectCountPortsOut.h:56
GlobalSim::eTauSortSelectCountPortsOut::NumSort
constexpr static std::size_t NumSort
Definition: eTauSortSelectCountPortsOut.h:23
lumiFormat.i
int i
Definition: lumiFormat.py:85
GlobalSim::eTauSortSelectCountPortsOut::max_counts
constexpr static std::array< std::size_t, NumCount > max_counts
Definition: eTauSortSelectCountPortsOut.h:80
GlobalSim::eTauSortSelectCountPortsOut::SortOutStart
constexpr static std::array< std::size_t, NumSort > SortOutStart
Definition: eTauSortSelectCountPortsOut.h:46
GlobalSim::eTauSortSelectCountPortsOut::GenTobPtr
std::shared_ptr< GenericTob > GenTobPtr
Definition: eTauSortSelectCountPortsOut.h:94
GlobalSim::eTauSortSelectCountPortsOut::NoSortOutWidth
constexpr static std::size_t NoSortOutWidth
Definition: eTauSortSelectCountPortsOut.h:39
GlobalSim::eTauSortSelectCountPortsOut::NumNoSort
constexpr static std::size_t NumNoSort
Definition: eTauSortSelectCountPortsOut.h:26
GlobalSim::eTauSortSelectCountPortsOut::m_O_eTauGenTob
std::array< GenTobPtr, NumTotalTobWidth > m_O_eTauGenTob
Definition: eTauSortSelectCountPortsOut.h:99
runIDAlign.accumulate
accumulate
Update flags based on parser line args.
Definition: runIDAlign.py:60
a
TList * a
Definition: liststreamerinfos.cxx:10
GlobalSim::eTauSortSelectCountPortsOut::NumTotalCountWidth
constexpr static std::size_t NumTotalCountWidth
Definition: eTauSortSelectCountPortsOut.h:62
GlobalSim::eTauSortSelectCountPortsOut::m_O_Multiplicity
BSPtrNumTotalCountWidth m_O_Multiplicity
Definition: eTauSortSelectCountPortsOut.h:103
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
GlobalSim::eTauSortSelectCountPortsOut::NumTotalTobWidth
constexpr static std::size_t NumTotalTobWidth
Definition: eTauSortSelectCountPortsOut.h:41
CLASS_DEF.h
macros to associate a CLID to a type
operator<<
std::ostream & operator<<(std::ostream &, const GlobalSim::eTauSortSelectCountPortsOut &)
Definition: eTauSortSelectCountPortsOut.cxx:9
GlobalSim::eTauSortSelectCountPortsOut::CountOutStart
constexpr static std::array< std::size_t, NumCount > CountOutStart
Definition: eTauSortSelectCountPortsOut.h:68