ATLAS Offline Software
Loading...
Searching...
No Matches
TrigJetHypoToolConfig_fastreduction.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7
8#include "GaudiKernel/StatusCode.h"
9
10#include "./RepeatedCondition.h"
12#include "./Tree.h"
13#include "./ConditionsDefs.h"
14
16
20
22 const std::string& name,
23 const IInterface* parent) :
24 base_class(type, name, parent){
25
26}
27
28
31
33 ATH_MSG_DEBUG("initialising " << name());
34
35 if(m_conditionMakers.size() != m_treeVec.size()){
36 ATH_MSG_ERROR("No. of conditions mismatch with tree vector size");
37 return StatusCode::FAILURE;
38 }
39
40 if(m_conditionMakers.size() < 2){ // first node is root, need more
41 ATH_MSG_ERROR("No. of conditions " +
42 std::to_string( m_conditionMakers.size()) +
43 " require at least 2" );
44 return StatusCode::FAILURE;
45 }
46
47 if(m_filterMakerInds.size() != m_conditionMakers.size()){
48 // need an index for each condition
49 ATH_MSG_ERROR("No. of conditions " +
50 std::to_string( m_conditionMakers.size()) +
51 " no. of filter inds " +
52 std::to_string( m_filterMakerInds.size()) +
53 " must be equal" );
54 return StatusCode::FAILURE;
55 }
56
57 return StatusCode::SUCCESS;
58}
59
60
63
64 ConditionPtrs conditions;
65
66 // collect the Conditions objects from the various sources
67
68 for(const auto& cm : m_conditionMakers){
69 conditions.push_back(cm->getRepeatedCondition());
70 }
71
72 return conditions;
73}
74
75/*
76std::vector<std::unique_ptr<ConditionFilter>>
77TrigJetHypoToolConfig_fastreduction::getConditionFilters() const {
78
79 auto filters = std::vector<std::unique_ptr<ConditionFilter>>();
80
81 for(const auto& cm : m_filtConditionMakers){
82
83 ConditionPtrs filterConditions; // will contain a single Condition
84 ConditionPtr repeatedCondition = cm->getRepeatedCondition();
85
86 // repeatedPtr is a nullptr is there are no contained conditions.
87 // this means the filter should act as pass-through.
88 if (repeatedCondition) {
89 filterConditions.push_back(std::move(repeatedCondition));
90 }
91
92 auto cf = std::make_unique<ConditionFilter>(filterConditions);
93 filters.push_back(std::move(cf));
94 }
95
96 return filters;
97}
98*/
99
100std::vector<FilterPtr>
102
103 auto filters = std::vector<FilterPtr>();
104 filters.reserve(m_filterMakers.size());
105
106 for(const auto& filterMaker : m_filterMakers) {
107 filters.push_back(filterMaker->getHypoJetVectorFilter());
108 }
109
110 return filters;
111}
112
113
114// following function not used for treeless hypos
115std::size_t
119
120
121std::unique_ptr<IJetsMatcher>
123
124 auto matcher = std::unique_ptr<IJetsMatcher>(nullptr);
125
126 auto repeatedConds = getRepeatedConditions();
127
128 if(repeatedConds.empty()){return matcher;}
129
130 auto conditions = std::move(repeatedConds);
131 auto filters = getFilters();
132
133 auto fpm = new FastReductionMatcher(std::move(conditions),
134 std::move(filters),
136 Tree(m_treeVec));
137 matcher.reset(fpm);
138 return matcher;
139}
140
142 return StatusCode::SUCCESS;
143}
144
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
std::vector< ConditionPtr > ConditionPtrs
Definition Tree.h:18
ToolHandleArray< ITrigHypoJetVectorFilterConfig > m_filterMakers
Gaudi::Property< std::vector< int > > m_filterMakerInds
TrigJetHypoToolConfig_fastreduction(const std::string &type, const std::string &name, const IInterface *parent)
virtual std::unique_ptr< IJetsMatcher > getMatcher() const override
ToolHandleArray< ITrigJetRepeatedConditionConfig > m_conditionMakers
Gaudi::Property< std::vector< std::size_t > > m_treeVec
unsigned int DecisionID