ATLAS Offline Software
Loading...
Searching...
No Matches
TriggerGenericObjectThinningTool.cxx
Go to the documentation of this file.
3
4namespace DerivationFramework{
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
38 const std::string& n,
39 const IInterface* p ) :
40 base_class(t,n,p)
41 {
42 }
43
44 // Destructor
47
48 // Athena initialize and finalize
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
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
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};
#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.
virtual StatusCode doThinning(const EventContext &ctx) const override
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.