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