ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkTrigger
src
TriggerGenericObjectThinningTool.cxx
Go to the documentation of this file.
1
#include "
TriggerGenericObjectThinningTool.h
"
2
#include "
StoreGate/ThinningHandle.h
"
3
4
namespace
DerivationFramework
{
5
bool
TriggerGenericObjectThinningTool::eventPassedFilter
()
const
6
{
7
if
(msgLvl(MSG::VERBOSE)){
8
const
Trig::ChainGroup
* Chain =
m_trigDec
->getChainGroup(
".*"
);
9
const
std::vector<std::string> fired_triggers = Chain->
getListOfTriggers
();
10
for
(
const
std::string& fired : fired_triggers) {
11
if
(
m_trigDec
->isPassed(fired))
ATH_MSG_VERBOSE
(
"Fired trigger "
<<fired);
12
}
13
}
14
15
unsigned
int
cntrAND{0}, cntrOR{0}, cntrORHLTOnly{0};
16
for
(
const
std::string& trig_and :
m_triggerListAND
) {
17
ATH_MSG_DEBUG
(
"AND - Trigger "
<<trig_and<<
" passed "
<<
m_trigDec
->isPassed(trig_and));
18
cntrAND+=(
m_trigDec
->isPassed(trig_and));
19
}
20
for
(
const
std::string& trig_or :
m_triggerListOR
) {
21
ATH_MSG_DEBUG
(
"OR - Trigger "
<<trig_or<<
" passed "
<<
m_trigDec
->isPassed(trig_or));
22
cntrOR +=(
m_trigDec
->isPassed(trig_or));
23
}
24
for
(
const
std::string& trig_orhltonly :
m_triggerListORHLTOnly
) {
25
ATH_MSG_DEBUG
(
"ORHLTOnly - Trigger "
<<trig_orhltonly<<
" passed "
<<
m_trigDec
->isPassed(trig_orhltonly,
TrigDefs::requireDecision
));
26
cntrORHLTOnly +=(
m_trigDec
->isPassed(trig_orhltonly,
TrigDefs::requireDecision
));
27
}
28
29
bool
passAND = (cntrAND==
m_triggerListAND
.size() && !
m_triggerListAND
.empty());
30
bool
passOR
= (cntrOR > 0);
31
bool
passORHLTOnly = (cntrORHLTOnly > 0);
32
33
bool
pass = passAND ||
passOR
|| passORHLTOnly;
34
return
pass;
35
}
36
37
TriggerGenericObjectThinningTool::TriggerGenericObjectThinningTool
(
const
std::string& t,
38
const
std::string& n,
39
const
IInterface* p ) :
40
base_class(t,n,p)
41
{
42
}
43
44
// Destructor
45
TriggerGenericObjectThinningTool::~TriggerGenericObjectThinningTool
() {
46
}
47
48
// Athena initialize and finalize
49
StatusCode
TriggerGenericObjectThinningTool::initialize
()
50
{
51
ATH_MSG_VERBOSE
(
"initialize() ..."
);
52
53
//check xAOD::InDetTrackParticle collection
54
ATH_CHECK
(
m_SGKey
.initialize (
m_streamName
) );
55
ATH_MSG_INFO
(
"Using "
<<
m_SGKey
<<
"as the source collection"
);
56
57
return
StatusCode::SUCCESS;
58
}
59
60
StatusCode
TriggerGenericObjectThinningTool::finalize
()
61
{
62
ATH_MSG_VERBOSE
(
"finalize() ..."
);
63
return
StatusCode::SUCCESS;
64
}
65
66
// The thinning itself
67
StatusCode
TriggerGenericObjectThinningTool::doThinning
(
const
EventContext& ctx)
const
68
{
69
70
// Retrieve main object collection
71
SG::ThinningHandle<xAOD::IParticleContainer>
particles (
m_SGKey
, ctx);
72
73
// Check the event contains objects
74
unsigned
int
nObjects = particles->size();
75
if
(nObjects==0)
return
StatusCode::SUCCESS;
76
77
//check if the trigger passed for the event
78
bool
keep_container =
eventPassedFilter
();
79
80
// Set up a mask with the same entries as the full collection
81
std::vector<bool> mask;
82
mask.assign(nObjects,keep_container);
83
84
85
// Execute the thinning based on the mask. Finish.
86
particles.keep (mask);
87
88
return
StatusCode::SUCCESS;
89
}
90
};
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
passOR
@ passOR
Definition
SUSYToolsTester.cxx:100
ThinningHandle.h
Handle for requesting thinning for a data object.
TriggerGenericObjectThinningTool.h
DerivationFramework::TriggerGenericObjectThinningTool::doThinning
virtual StatusCode doThinning(const EventContext &ctx) const override
Definition
TriggerGenericObjectThinningTool.cxx:67
DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListOR
Gaudi::Property< std::vector< std::string > > m_triggerListOR
Definition
TriggerGenericObjectThinningTool.h:46
DerivationFramework::TriggerGenericObjectThinningTool::~TriggerGenericObjectThinningTool
~TriggerGenericObjectThinningTool()
Definition
TriggerGenericObjectThinningTool.cxx:45
DerivationFramework::TriggerGenericObjectThinningTool::TriggerGenericObjectThinningTool
TriggerGenericObjectThinningTool(const std::string &t, const std::string &n, const IInterface *p)
Definition
TriggerGenericObjectThinningTool.cxx:37
DerivationFramework::TriggerGenericObjectThinningTool::eventPassedFilter
bool eventPassedFilter() const
Definition
TriggerGenericObjectThinningTool.cxx:5
DerivationFramework::TriggerGenericObjectThinningTool::m_trigDec
PublicToolHandle< Trig::TrigDecisionTool > m_trigDec
Definition
TriggerGenericObjectThinningTool.h:48
DerivationFramework::TriggerGenericObjectThinningTool::finalize
virtual StatusCode finalize() override
Definition
TriggerGenericObjectThinningTool.cxx:60
DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListAND
Gaudi::Property< std::vector< std::string > > m_triggerListAND
Definition
TriggerGenericObjectThinningTool.h:45
DerivationFramework::TriggerGenericObjectThinningTool::m_SGKey
SG::ThinningHandleKey< xAOD::IParticleContainer > m_SGKey
Definition
TriggerGenericObjectThinningTool.h:42
DerivationFramework::TriggerGenericObjectThinningTool::m_streamName
StringProperty m_streamName
Definition
TriggerGenericObjectThinningTool.h:40
DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListORHLTOnly
Gaudi::Property< std::vector< std::string > > m_triggerListORHLTOnly
Definition
TriggerGenericObjectThinningTool.h:47
DerivationFramework::TriggerGenericObjectThinningTool::initialize
virtual StatusCode initialize() override
Definition
TriggerGenericObjectThinningTool.cxx:49
SG::ThinningHandle
Handle for requesting thinning for a data object.
Definition
ThinningHandle.h:84
Trig::ChainGroup
Definition
ChainGroup.h:51
Trig::ChainGroup::getListOfTriggers
std::vector< std::string > getListOfTriggers() const
Definition
ChainGroup.cxx:467
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
TrigDefs::requireDecision
static const unsigned int requireDecision
Definition
TrigEvent/TrigDecisionInterface/TrigDecisionInterface/Conditions.h:25
Generated on
for ATLAS Offline Software by
1.17.0