ATLAS Offline Software
FastReducer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGHLTJETHYPO_FASTREDUCER_H
6 #define TRIGHLTJETHYPO_FASTREDUCER_H
7 
9 #include "./Tree.h"
10 #include "./JetGroupProduct.h"
11 #include "./xAODJetCollector.h"
13 #include "./JetGroupRegister.h"
14 #include "./PointerPreds.h"
15 #include "./IHypoJetVectorFilter.h"
16 
17 #include <string>
18 #include <map>
19 
20 using TreeVec = std::vector<std::size_t>;
21 using IDJetGroup = std::map<std::size_t, HypoJetVector>;
22 typedef std::unique_ptr<ITrigJetHypoInfoCollector> Collector;
23 
28 using JetGroupInd2ElemInds = std::map<int, std::vector<std::size_t>>;
29 
31  std::vector<std::unique_ptr<IHypoJetVectorFilter>>;
32 
33 using ConditionFilterInds = std::vector<int>;
34 
35 class FastReducer {
36  public:
37 
38  FastReducer(const HypoJetVector& jv,
39  const ConditionPtrs& conditionObjects,
40  const ConditionFilters& conditionFilters,
41  const ConditionFilterInds& conditionFilterInds,
42  const Tree& conditionsTree,
43  xAODJetCollector& jetCollector,
44  const Collector& collector);
45 
46 
51  bool pass() const;
52 
53  std::string toString() const;
54 
55  private:
56 
57  // conditions owned by the matcher
59  std::vector<std::size_t> m_conditionMult;
60  std::vector<unsigned int> m_conditionCap;
61  std::vector<int> m_conditionClique;
62 
63  // conditionFilters owned by the matcher
66 
73 
74  // map Condition index onto a list of indices of satisfying jet groups.
76 
81  std::map<std::size_t, std::set<std::size_t>> m_testedBy;
82 
84  std::map<std::size_t, HypoJetVector> m_indJetGroup;
85 
88 
89 
91  bool m_pass{false};
92 
94 
101  bool findInitialJetGroups(const HypoJetVector& jv,
102  const Collector& collector);
103 
104 
105  bool propagateJetGroups(const Collector& collector);
106 
107 
108  bool propagate_(std::size_t child,
109  const std::vector<std::size_t>& siblings,
110  const Collector&);
111 
112  std::string dataStructuresToStr() const;
113 
114  void dumpDataStructures(const Collector&) const;
115 
116  void recordJetGroup(std::size_t ind,
117  const HypoJetVector& jg,
118  const Collector& collector) const;
119 
120  void recordFiltering(std::size_t leaf_ind,
121  std::size_t n_inputjets,
122  int n_filteredjets,
123  const Collector& collector) const;
124 
125  void collectLeafJets(xAODJetCollector& jetCollector,
126  const Collector& collector) const;
127 
128  bool capacitySatisfied(std::size_t ind,
129  const Collector& collector) const;
130 };
131 #endif
IDJetGroup
std::map< std::size_t, HypoJetVector > IDJetGroup
Definition: FastReducer.h:21
JetGroupProduct.h
CondInd2JetGroupsInds
std::map< int, std::vector< std::size_t > > CondInd2JetGroupsInds
Definition: JetGroupProduct.h:15
FastReducer::capacitySatisfied
bool capacitySatisfied(std::size_t ind, const Collector &collector) const
Definition: FastReducer.cxx:555
FastReducer::toString
std::string toString() const
Definition: FastReducer.cxx:445
Tree
Definition: Tree.h:18
ConditionFilterInds
std::vector< int > ConditionFilterInds
Definition: FastReducer.h:33
FastReducer::dumpDataStructures
void dumpDataStructures(const Collector &) const
Definition: FastReducer.cxx:508
FastReducer::m_conditionMult
std::vector< std::size_t > m_conditionMult
Definition: FastReducer.h:59
FastReducer::recordFiltering
void recordFiltering(std::size_t leaf_ind, std::size_t n_inputjets, int n_filteredjets, const Collector &collector) const
Definition: FastReducer.cxx:536
FastReducer::m_indJetGroup
std::map< std::size_t, HypoJetVector > m_indJetGroup
map jet group indices to jet groups
Definition: FastReducer.h:84
FastReducer::m_satisfiedBy
CondInd2JetGroupsInds m_satisfiedBy
Definition: FastReducer.h:75
FastReducer::findInitialJetGroups
bool findInitialJetGroups(const HypoJetVector &jv, const Collector &collector)
set up the data structures for propagation.
Definition: FastReducer.cxx:171
FastReducer::m_conditionFilters
const ConditionFilters & m_conditionFilters
Definition: FastReducer.h:64
FastReducer
Definition: FastReducer.h:35
FastReducer::m_testedBy
std::map< std::size_t, std::set< std::size_t > > m_testedBy
map Condition index onto a set of indices the condition has been tested with - used to prevent retest...
Definition: FastReducer.h:81
TreeVec
std::vector< std::size_t > TreeVec
Definition: FastReducer.h:20
FastReducer::m_jgRegister
JetGroupRegister m_jgRegister
Definition: FastReducer.h:95
FastReducer::recordJetGroup
void recordJetGroup(std::size_t ind, const HypoJetVector &jg, const Collector &collector) const
Definition: FastReducer.cxx:517
FastReducer::propagateJetGroups
bool propagateJetGroups(const Collector &collector)
Definition: FastReducer.cxx:276
JetGroupInd2ElemInds
std::map< int, std::vector< std::size_t > > JetGroupInd2ElemInds
Definition: elementalJetGroups.h:11
FastReducer::m_jg2elemjgs
JetGroupInd2ElemInds m_jg2elemjgs
map jet group indices to indices of incoming jet groups
Definition: FastReducer.h:87
PointerPreds.h
xAODJetCollector.h
FastReducer::pass
bool pass() const
determine whether a set of jets satisfies all hypo conditions.
Definition: FastReducer.cxx:552
FastReducer::m_pass
bool m_pass
event pass flag
Definition: FastReducer.h:91
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition: HypoJetDefs.h:27
FastReducer::m_conditionFilterInds
ConditionFilterInds m_conditionFilterInds
Definition: FastReducer.h:65
FastReducer::m_tree
Tree m_tree
tree structure for Conditions objects.
Definition: FastReducer.h:72
FastReducer::m_conditionClique
std::vector< int > m_conditionClique
Definition: FastReducer.h:61
FastReducer::propagate_
bool propagate_(std::size_t child, const std::vector< std::size_t > &siblings, const Collector &)
Definition: FastReducer.cxx:346
JetGroupRegister
Definition: JetGroupRegister.h:35
Collector
std::unique_ptr< ITrigJetHypoInfoCollector > Collector
Definition: FastReducer.h:22
FastReducer::dataStructuresToStr
std::string dataStructuresToStr() const
Definition: FastReducer.cxx:463
ConditionFilters
std::vector< std::unique_ptr< IHypoJetVectorFilter > > ConditionFilters
Definition: FastReducer.h:31
xAODJetCollector
Definition: xAODJetCollector.h:20
FastReducer::m_passingJets
HypoJetVector m_passingJets
Definition: FastReducer.h:93
Tree.h
RepeatedConditionsDefs.h
ITrigJetHypoInfoCollector.h
ConditionPtrs
std::vector< ConditionPtr > ConditionPtrs
Definition: RepeatedConditionsDefs.h:20
IHypoJetVectorFilter.h
FastReducer::m_conditionCap
std::vector< unsigned int > m_conditionCap
Definition: FastReducer.h:60
JetGroupRegister.h
FastReducer::collectLeafJets
void collectLeafJets(xAODJetCollector &jetCollector, const Collector &collector) const
Definition: FastReducer.cxx:94
FastReducer::m_conditions
const ConditionPtrs & m_conditions
Definition: FastReducer.h:58
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
FastReducer::FastReducer
FastReducer(const HypoJetVector &jv, const ConditionPtrs &conditionObjects, const ConditionFilters &conditionFilters, const ConditionFilterInds &conditionFilterInds, const Tree &conditionsTree, xAODJetCollector &jetCollector, const Collector &collector)
Definition: FastReducer.cxx:41