11 template<
typename InputIterator,
typename AccumulateType,
typename BinaryOperation,
typename Predicate>
13 accumulate_if(InputIterator
first,
const InputIterator last,
14 AccumulateType
init, BinaryOperation&& binary_op,Predicate&& predicate){
21 enum TupleItem{ ThisLayer, NumLayers, NumHits};
23 using OneDetail = std::tuple<int, int, int>;
24 using DetailVector = std::vector<OneDetail>;
27 int addUp(
int l,
const std::pair < Trk::DetectorRegion, DetailVector > &
p){
28 for (
const auto &
t:
p.second){
35 return [
r](
const std::pair < Trk::DetectorRegion, DetailVector > &
p){
40 auto fromStrips
ATLAS_THREAD_SAFE =[](
const std::pair < Trk::DetectorRegion, DetailVector > &
p) {
44 auto fromPixels
ATLAS_THREAD_SAFE =[](
const std::pair < Trk::DetectorRegion, DetailVector > &
p) {
53 const std::vector < std::pair < Trk::DetectorRegion, std::vector < std::tuple <int , int , int> > > > &
60 for (
auto& [thisRegion,thisHitInfoVector] : m_detailedHitInfo) {
61 if (thisRegion==region) {
62 for (
auto& [thisLayer, nLayers, nHits] : thisHitInfoVector) {
63 if (thisLayer==
layer) {
67 m_prevEta = eta_module;
76 m_prevEta = eta_module;
77 std::vector < std::tuple <int, int, int> > counts = {{
layer, 1, hit}};
78 m_detailedHitInfo.emplace_back(region, counts);
83 for (
auto& [thisRegion,thisHitInfoVector] : m_detailedHitInfo) {
84 if (thisRegion==region) {
85 for (
auto& [thisLayer, nLayers, nHits] : thisHitInfoVector) {
86 if (thisLayer==
layer) {
97 return accumulate_if(m_detailedHitInfo.begin(), m_detailedHitInfo.end(), 0, addUp<NumLayers>, fromRegion(region));
102 return std::accumulate(m_detailedHitInfo.begin(), m_detailedHitInfo.end(), 0, addUp<NumLayers>);
107 return accumulate_if(m_detailedHitInfo.begin(), m_detailedHitInfo.end(), 0, addUp<NumHits>, fromRegion(region));
112 return std::accumulate(m_detailedHitInfo.begin(), m_detailedHitInfo.end(), 0, addUp<NumHits>);
117 return accumulate_if(m_detailedHitInfo.begin(), m_detailedHitInfo.end(), 0, addUp<NumLayers>, fromPixels);
122 return accumulate_if(m_detailedHitInfo.begin(), m_detailedHitInfo.end(), 0, addUp<NumHits>, fromPixels);
128 return accumulate_if(m_detailedHitInfo.begin(), m_detailedHitInfo.end(), 0, addUp<NumLayers>, fromStrips);
133 return accumulate_if(m_detailedHitInfo.begin(), m_detailedHitInfo.end(), 0, addUp<NumHits>, fromStrips);