ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigDecisionTool
Root
FeatureContainer.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/**********************************************************************************
6
* @Project: TrigDecisionTool
7
* @Package: TrigDecisionTool
8
* @Class : FeatureContainer
9
*
10
*
11
* @author Nicolas Berger <Nicolas.Berger@cern.ch> - LAPP Annecy
12
*
13
***********************************************************************************/
14
15
#include "
TrigDecisionTool/FeatureContainer.h
"
16
#include "
TrigDecisionTool/Combination.h
"
17
18
19
void
Trig::FeatureContainer::addWithChecking
(
const
Combination
& newComb)
20
{
21
/* Keep unique combinations and preserve insertion order to guarantee
22
reproducibility. We achieve this by an additional set (faster than doing
23
a linear search in the vector each time). */
24
if
(
m_combinations_unique
.insert(newComb).second) {
// true if element was inserted (not known yet)
25
m_combinations
.push_back(newComb);
26
}
27
}
28
29
void
Trig::FeatureContainer::append
(
const
FeatureContainer
& other)
30
{
31
for
(
const
Trig::Combination
& comb : other.m_combinations)
32
addWithChecking
(comb);
33
}
34
35
36
const
HLT::TrigNavStructure
*
37
Trig::FeatureContainer::navigation
()
const
{
38
return
m_cgm
->navigation();
39
}
40
41
42
43
bool
44
Trig::FeatureContainer::ordering_by_objects_attached::weakOrder
(
const
HLT::TriggerElement
*
a
,
const
HLT::TriggerElement
* b,
45
const
void
* obj_a,
const
void
* obj_b)
const
{
46
// returning False -> no insertion into set
47
// returning True -> insertion into set
48
// each pair of candidates is tested twice (if test returns False twice, then no insertion into set)
49
50
using namespace
HLT
;
51
if
(
a
==b && obj_a==obj_b) {
52
return
false
;
// if TE and object pointers are the same, then we don't insert the second cand at all
53
}
54
55
if
(
a
==b && obj_a!=obj_b) {
56
// if different objects but the same TE, then we always insert, so the order in the set is the insertion order
57
// this guaranties reproducibility only if the order of the objects in the TE is reproducible
58
return
true
;
59
}
60
61
// if the TEs are different we follow the old procedure which does guaranty reproducibily (the order of features is always the same)
62
const
TriggerElement::FeatureVec
& a_features =
a
->getFeatureAccessHelpers();
63
const
TriggerElement::FeatureVec
& b_features = b->getFeatureAccessHelpers();
64
65
if
( a_features.size() != b_features.size() )
66
return
a_features.size() < b_features.size();
67
68
for
(
unsigned
f = 0,
sz
= a_features.size(); f <
sz
; ++f ) {
69
const
TriggerElement::FeatureAccessHelper
& a_f = a_features[f];
70
const
TriggerElement::FeatureAccessHelper
& b_f = b_features[f];
71
if
( a_f.
getCLID
() == b_f.
getCLID
()) {
72
if
( a_f.
getIndex
() == b_f.
getIndex
())
continue
;
73
return
a_f.
getIndex
() < b_f.
getIndex
();
74
}
75
return
a_f.
getCLID
() < b_f.
getCLID
();
76
}
77
return
false
;
78
}
79
80
//this is a helper method to weakly order feature access helpers.
81
class
order_by_clid_and_index
{
82
public
:
83
bool
operator()
(
const
Trig::TypelessFeature
&
a
,
const
Trig::TypelessFeature
& b)
const
{
84
if
(
a
.accessHelper().getCLID() == b.accessHelper().getCLID()) {
85
return
a
.accessHelper().getIndex() < b.accessHelper().getIndex();
86
}
87
return
a
.accessHelper().getCLID() < b.accessHelper().getCLID();
88
}
89
};
90
91
92
const
std::vector<Trig::TypelessFeature>
Trig::FeatureContainer::typelessGet
(
HLT::class_id_type
clid,
const
std::string&
label
,
unsigned
int
condition,
const
std::string& teName)
const
{
93
if
( condition !=
TrigDefs::Physics
&& condition !=
TrigDefs::alsoDeactivateTEs
) {
94
throw
std::runtime_error(
"Only two flags can be supplied to features"
);
95
}
96
97
std::set<Trig::TypelessFeature,::order_by_clid_and_index> uniqnessHelper;
98
for
(
auto
& comb :
m_combinations
) {
99
if
(condition ==
TrigDefs::Physics
) {
100
if
(!comb.active())
continue
;
101
}
102
103
std::vector<Trig::TypelessFeature> features = comb.typelessGet(clid,
label
, condition, teName);
104
for
(
auto
& f : features) {
105
uniqnessHelper.insert(f);
106
}
107
}
108
return
std::vector<Trig::TypelessFeature>(uniqnessHelper.begin(), uniqnessHelper.end());
109
}
FeatureContainer.h
sz
static Double_t sz
Definition
LArPhysWaveHECTool.cxx:37
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
Combination.h
HLT::TrigNavStructure
Definition
TrigNavStructure.h:40
HLT::TriggerElement::FeatureAccessHelper
the FeatureAccessHelper is a class used to keep track of features attached to this TE.
Definition
TrigNavStructure/TrigNavStructure/TriggerElement.h:192
HLT::TriggerElement::FeatureAccessHelper::getIndex
const ObjectIndex & getIndex() const
index in the external ojects array
Definition
TrigNavStructure/TrigNavStructure/TriggerElement.h:209
HLT::TriggerElement::FeatureAccessHelper::getCLID
class_id_type getCLID() const
Class ID of object.
Definition
TrigNavStructure/TrigNavStructure/TriggerElement.h:208
HLT::TriggerElement
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
Definition
TrigNavStructure/TrigNavStructure/TriggerElement.h:27
HLT::TriggerElement::FeatureVec
std::vector< FeatureAccessHelper > FeatureVec
Definition
TrigNavStructure/TrigNavStructure/TriggerElement.h:233
Trig::Combination
is a connector between chains and object It store single combination of trigger elements.
Definition
Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:55
Trig::FeatureContainer::ordering_by_objects_attached::weakOrder
bool weakOrder(const HLT::TriggerElement *te_a, const HLT::TriggerElement *te_b, const void *obj_a, const void *obj_b) const
Definition
FeatureContainer.cxx:44
Trig::FeatureContainer::m_combinations
std::vector< Trig::Combination > m_combinations
container preserving insertion order
Definition
FeatureContainer.h:124
Trig::FeatureContainer::append
void append(const FeatureContainer &other)
Definition
FeatureContainer.cxx:29
Trig::FeatureContainer::typelessGet
const std::vector< Trig::TypelessFeature > typelessGet(HLT::class_id_type clid, const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
typeless version of get
Definition
FeatureContainer.cxx:92
Trig::FeatureContainer::FeatureContainer
FeatureContainer(const CacheGlobalMemory *cgm=0)
constructors, destructor
Definition
FeatureContainer.h:48
Trig::FeatureContainer::m_combinations_unique
std::unordered_set< Trig::Combination > m_combinations_unique
set for ensuring uniqueness in the above container
Definition
FeatureContainer.h:126
Trig::FeatureContainer::m_cgm
const Trig::CacheGlobalMemory * m_cgm
Definition
FeatureContainer.h:128
Trig::FeatureContainer::navigation
const HLT::TrigNavStructure * navigation() const
Definition
FeatureContainer.cxx:37
Trig::FeatureContainer::addWithChecking
void addWithChecking(const Combination &newComb)
add new combination to the container checking for overlap
Definition
FeatureContainer.cxx:19
Trig::TypelessFeature
Feature class, holding information on Feature attached to navigation.
Definition
TypelessFeature.h:20
order_by_clid_and_index
Definition
FeatureContainer.cxx:81
order_by_clid_and_index::operator()
bool operator()(const Trig::TypelessFeature &a, const Trig::TypelessFeature &b) const
Definition
FeatureContainer.cxx:83
label
std::string label(const std::string &format, int i)
Definition
label.h:19
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition
HLTResultReader.h:26
HLT::class_id_type
uint32_t class_id_type
Definition
Trigger/TrigEvent/TrigNavStructure/Root/Types.h:11
TrigDefs::Physics
static const unsigned int Physics
Definition
TrigEvent/TrigDecisionInterface/TrigDecisionInterface/Conditions.h:43
TrigDefs::alsoDeactivateTEs
static const unsigned int alsoDeactivateTEs
Definition
TrigEvent/TrigDecisionInterface/TrigDecisionInterface/Conditions.h:39
Generated on
for ATLAS Offline Software by
1.17.0