ATLAS Offline Software
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"
11 #include "./FastReductionMatcher.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 
30 }
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 " +
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 " +
51  " no. of filter inds " +
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 /*
76 std::vector<std::unique_ptr<ConditionFilter>>
77 TrigJetHypoToolConfig_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 
100 std::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
115 std::size_t
117  return 0;
118 }
119 
120 
121 std::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(conditions,
134  filters,
136  Tree(m_treeVec));
137  matcher.reset(fpm);
138  return matcher;
139 }
140 
142  return StatusCode::SUCCESS;
143 }
144 
TrigJetHypoToolConfig_fastreduction::getRepeatedConditions
ConditionPtrs getRepeatedConditions() const
Definition: TrigJetHypoToolConfig_fastreduction.cxx:62
TrigJetHypoToolConfig_fastreduction::m_treeVec
Gaudi::Property< std::vector< std::size_t > > m_treeVec
Definition: TrigJetHypoToolConfig_fastreduction.h:67
ConditionsDefs.h
TrigJetHypoToolConfig_fastreduction::TrigJetHypoToolConfig_fastreduction
TrigJetHypoToolConfig_fastreduction(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigJetHypoToolConfig_fastreduction.cxx:21
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigCompositeContainer.h:21
Tree
Definition: Tree.h:18
TrigJetHypoToolConfig_fastreduction.h
TrigJetHypoToolConfig_fastreduction::getMatcher
virtual std::unique_ptr< IJetsMatcher > getMatcher() const override
Definition: TrigJetHypoToolConfig_fastreduction.cxx:122
FastReductionMatcher.h
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
TrigCompositeUtils.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigJetHypoToolConfig_fastreduction::initialize
virtual StatusCode initialize() override
Definition: TrigJetHypoToolConfig_fastreduction.cxx:32
TrigJetHypoToolConfig_fastreduction::m_filterMakerInds
Gaudi::Property< std::vector< int > > m_filterMakerInds
Definition: TrigJetHypoToolConfig_fastreduction.h:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FastReductionMatcher
Definition: FastReductionMatcher.h:23
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigJetHypoToolConfig_fastreduction::m_filterMakers
ToolHandleArray< ITrigHypoJetVectorFilterConfig > m_filterMakers
Definition: TrigJetHypoToolConfig_fastreduction.h:56
TrigJetHypoToolConfig_fastreduction::requiresNJets
virtual std::size_t requiresNJets() const override
Definition: TrigJetHypoToolConfig_fastreduction.cxx:116
TrigJetHypoToolConfig_fastreduction::checkVals
virtual StatusCode checkVals() const override
Definition: TrigJetHypoToolConfig_fastreduction.cxx:141
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:20
Tree.h
TrigJetHypoToolConfig_fastreduction::getFilters
std::vector< FilterPtr > getFilters() const
Definition: TrigJetHypoToolConfig_fastreduction.cxx:101
ConditionPtrs
std::vector< ConditionPtr > ConditionPtrs
Definition: RepeatedConditionsDefs.h:20
TrigJetHypoToolConfig_fastreduction::m_conditionMakers
ToolHandleArray< ITrigJetRepeatedConditionConfig > m_conditionMakers
Definition: TrigJetHypoToolConfig_fastreduction.h:53
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RepeatedCondition.h
TrigJetHypoToolConfig_fastreduction::~TrigJetHypoToolConfig_fastreduction
virtual ~TrigJetHypoToolConfig_fastreduction()
Definition: TrigJetHypoToolConfig_fastreduction.cxx:29