ATLAS Offline Software
TriggerSkimmingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TriggerSkimmingTool.cxx, (c) ATLAS Detector software
8 // Author: James Catmore (james.catmore@cern.ch)
9 //
10 // Direct skimming via TrigDecisionTool
11 // Only intended for cases where the triggers in question cannot be
12 // handled by ExpressionEvaluation (dashes, dots)
13 
15 
16 #include <vector>
17 #include <string>
18 
19 
20 
21 namespace DerivationFramework {
22 
24  const std::string& n,
25  const IInterface* p) :
26  AthAlgTool(t,n,p) {
27  declareInterface<DerivationFramework::ISkimmingTool>(this);
28 
29  }
30 
32  {
33  ATH_CHECK(m_trigDec.retrieve());
34  return StatusCode::SUCCESS;
35  }
36 
37 
38 
40  {
41 
42  if (msgLvl(MSG::VERBOSE)){
43  const Trig::ChainGroup* Chain = m_trigDec->getChainGroup(".*");
44  const std::vector<std::string> fired_triggers = Chain->getListOfTriggers();
45  for (const std::string& fired : fired_triggers) {
46  if (m_trigDec->isPassed(fired)) ATH_MSG_VERBOSE("Fired trigger "<<fired);
47  }
48  }
49 
50  unsigned int cntrAND{0}, cntrOR{0}, cntrORHLTOnly{0};
51  for (const std::string& trig_and : m_triggerListAND) {
52  ATH_MSG_DEBUG("AND - Trigger "<<trig_and<<" passed "<<m_trigDec->isPassed(trig_and));
53  cntrAND+=(m_trigDec->isPassed(trig_and));
54  }
55  for (const std::string& trig_or : m_triggerListOR) {
56  ATH_MSG_DEBUG("OR - Trigger "<<trig_or<<" passed "<<m_trigDec->isPassed(trig_or));
57  cntrOR +=(m_trigDec->isPassed(trig_or));
58  }
59  for (const std::string& trig_orhltonly : m_triggerListORHLTOnly) {
60  ATH_MSG_DEBUG("ORHLTOnly - Trigger "<<trig_orhltonly<<" passed "<<m_trigDec->isPassed(trig_orhltonly, TrigDefs::requireDecision));
61  cntrORHLTOnly +=(m_trigDec->isPassed(trig_orhltonly, TrigDefs::requireDecision));
62  }
63 
64  bool passAND = (cntrAND==m_triggerListAND.size() && !m_triggerListAND.empty());
65  bool passOR = (cntrOR > 0);
66  bool passORHLTOnly = (cntrORHLTOnly > 0);
67 
68  bool pass = passAND || passOR || passORHLTOnly;
69  return pass;
70  }
71 }
DerivationFramework::TriggerSkimmingTool::m_triggerListAND
Gaudi::Property< std::vector< std::string > > m_triggerListAND
Definition: TriggerSkimmingTool.h:28
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
DerivationFramework::TriggerSkimmingTool::eventPassesFilter
bool eventPassesFilter() const override
Check that the current event passes this filter.
Definition: TriggerSkimmingTool.cxx:39
DerivationFramework::TriggerSkimmingTool::TriggerSkimmingTool
TriggerSkimmingTool(const std::string &t, const std::string &n, const IInterface *p)
Definition: TriggerSkimmingTool.cxx:23
DerivationFramework::TriggerSkimmingTool::m_triggerListORHLTOnly
Gaudi::Property< std::vector< std::string > > m_triggerListORHLTOnly
Definition: TriggerSkimmingTool.h:30
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TriggerSkimmingTool.h
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
Trig::ChainGroup
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.h:51
DerivationFramework::TriggerSkimmingTool::m_trigDec
PublicToolHandle< Trig::TrigDecisionTool > m_trigDec
Definition: TriggerSkimmingTool.h:31
DerivationFramework::TriggerSkimmingTool::initialize
StatusCode initialize() override
Definition: TriggerSkimmingTool.cxx:31
DerivationFramework::TriggerSkimmingTool::m_triggerListOR
Gaudi::Property< std::vector< std::string > > m_triggerListOR
Definition: TriggerSkimmingTool.h:29
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
AthAlgTool
Definition: AthAlgTool.h:26
Trig::ChainGroup::getListOfTriggers
std::vector< std::string > getListOfTriggers() const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/Root/ChainGroup.cxx:467
passOR
@ passOR
Definition: SUSYToolsTester.cxx:100