ATLAS Offline Software
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 
7 #include "./xAODJetCollector.h"
9 #include "./nodeIDPrinter.h"
10 #include "./DebugInfoCollector.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 
36 bool
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 
124  c.collect(name(), toString());
125  return StatusCode::SUCCESS;
126 }
127 
128 
130  return m_configs[0]->requiresNJets();
131 }
132 
133 
134 
CompoundCondition.h
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
xAODJetAsIJet.h
ITrigJetHypoInfoCollector::collect
virtual void collect(const std::string &, const std::string &)=0
TrigJetHypoToolHelperNoGrouper::toString
virtual std::string toString() const override
Definition: TrigJetHypoToolHelperNoGrouper.cxx:90
nodeIDPrinter.h
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
ITrigJetHypoInfoCollector
Definition: ITrigJetHypoInfoCollector.h:9
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DebugInfoCollector.h
xAODJetCollector.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition: HypoJetDefs.h:27
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
xAODJetCollector
Definition: xAODJetCollector.h:20
TrigJetHypoToolHelperNoGrouper.h
ITrigJetHypoInfoCollector.h
TrigJetHypoToolHelperNoGrouper::m_matchers
std::vector< std::unique_ptr< IJetsMatcher > > m_matchers
Definition: TrigJetHypoToolHelperNoGrouper.h:59
python.output.AtlRunQueryRoot.pf
pf
Definition: AtlRunQueryRoot.py:988
TrigJetHypoToolHelperNoGrouper::m_configs
ToolHandleArray< ITrigJetHypoToolNoGrouperConfig > m_configs
Definition: TrigJetHypoToolHelperNoGrouper.h:65
TrigJetHypoToolHelperNoGrouper::getDescription
virtual StatusCode getDescription(ITrigJetHypoInfoCollector &) const override
Definition: TrigJetHypoToolHelperNoGrouper.cxx:123
TrigJetHypoToolHelperNoGrouper::m_prefilterMakers
ToolHandleArray< ITrigHypoJetVectorFilterConfig > m_prefilterMakers
Definition: TrigJetHypoToolHelperNoGrouper.h:70
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigJetHypoToolHelperNoGrouper::pass
virtual bool pass(HypoJetVector &, xAODJetCollector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
Definition: TrigJetHypoToolHelperNoGrouper.cxx:37
TrigJetHypoToolHelperNoGrouper::initialize
StatusCode initialize() override
Definition: TrigJetHypoToolHelperNoGrouper.cxx:21
TrigJetHypoToolHelperNoGrouper::requiresNJets
virtual std::size_t requiresNJets() const override
Definition: TrigJetHypoToolHelperNoGrouper.cxx:129
python.compressB64.c
def c
Definition: compressB64.py:93
TrigJetHypoToolHelperNoGrouper::TrigJetHypoToolHelperNoGrouper
TrigJetHypoToolHelperNoGrouper(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigJetHypoToolHelperNoGrouper.cxx:15