ATLAS Offline Software
Loading...
Searching...
No Matches
TrigJetHypoToolHelperNoGrouper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
9#include "./nodeIDPrinter.h"
11#include "./CompoundCondition.h"
12#include <algorithm>
13#include <sstream>
14
16 const std::string& name,
17 const IInterface* parent) :
18 base_class(type, name, parent){
19}
20
22
23 for (const auto& config : m_configs) {
24 auto matcher = config->getMatcher();
25 if (!matcher->valid()) {
26 ATH_MSG_ERROR(matcher->msg());
27 return StatusCode::FAILURE;
28 }
29
30 m_matchers.push_back(std::move(matcher));
31 }
32
33 return StatusCode::SUCCESS;
34}
35
36bool
38 xAODJetCollector& jetCollector,
39 const std::unique_ptr<ITrigJetHypoInfoCollector>& collector) const {
40
41 if(collector){
42 std::stringstream ss;
43 ss << "No of jets " + std::to_string(jetsIn.size()) + '\n';
44 ss << jetsIn;
45 collector->collect(name(), ss.str());
46 }
47
48 if(jetsIn.empty()){
49 if (collector){
50 collector->collect(name(), "empty input jet collection");
51 }
52 bool pass = false;
53 return pass;
54 }
55
56 // prefilters are now local variables
57 std::vector<FilterPtr> prefilters{};
58 prefilters.reserve(m_prefilterMakers.size());
59 for (const auto& pf_maker : m_prefilterMakers){
60 prefilters.push_back(pf_maker->getHypoJetVectorFilter());
61 }
62
63 auto hjv = jetsIn;
64 for (const auto& pf : prefilters) {
65 hjv = pf->filter(hjv, collector);
66 }
67
68 // see if matchers pass. Each matcher conatains a FastReducer tree.
69 // if > matcher, this means the conditions of different trees may
70 // share jets.
71 bool pass = true;
72 for (const auto& matcher : m_matchers){
73 auto matcher_pass = matcher->match(hjv,
74 jetCollector,
75 collector);
76 if (!matcher_pass.has_value()) {
77 ATH_MSG_ERROR("Matcher cannot determine result. Config error?");
78 return false;
79 }
80
81 if (!(*matcher_pass)){
82 pass = false;
83 break;
84 }
85 }
86
87 return pass;
88}
89
91
92 std::stringstream ss;
93 ss << name();
94
95
96
97 std::vector<FilterPtr> prefilters{};
98 prefilters.reserve(m_prefilterMakers.size());
99 for (const auto& pf_maker : m_prefilterMakers){
100 prefilters.push_back(pf_maker->getHypoJetVectorFilter());
101 }
102
103
104 ss << "prefilters: [" << prefilters.size() << "]:\n";
105 for (const auto& pf : prefilters){
106 ss << '\n'<< *pf;
107 }
108
109 ss << '\n';
110
111 ss << "\nMatchers [" << m_matchers.size() << "]:\n\n";
112 unsigned int imatcher{0};
113 for (const auto & matcher : m_matchers) {
114 ss << "matcher " << imatcher++ << '\n';
115 ss << matcher -> toString();
116 }
117
118 return ss.str();
119}
120
121
122StatusCode
124 c.collect(name(), toString());
125 return StatusCode::SUCCESS;
126}
127
128
130 return m_configs[0]->requiresNJets();
131}
132
133
134
#define ATH_MSG_ERROR(x)
std::vector< pHypoJet > HypoJetVector
Definition HypoJetDefs.h:27
static Double_t ss
TrigJetHypoToolHelperNoGrouper(const std::string &type, const std::string &name, const IInterface *parent)
virtual bool pass(HypoJetVector &, xAODJetCollector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
std::vector< std::unique_ptr< IJetsMatcher > > m_matchers
ToolHandleArray< ITrigJetHypoToolNoGrouperConfig > m_configs
virtual std::size_t requiresNJets() const override
ToolHandleArray< ITrigHypoJetVectorFilterConfig > m_prefilterMakers
virtual StatusCode getDescription(ITrigJetHypoInfoCollector &) const override
virtual std::string toString() const override