ATLAS Offline Software
TriggerGenericObjectThinningTool.cxx
Go to the documentation of this file.
3 #include "GaudiKernel/ThreadLocalContext.h"
4 
5 namespace 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
47  }
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 };
DerivationFramework::TriggerGenericObjectThinningTool::m_streamName
StringProperty m_streamName
Definition: TriggerGenericObjectThinningTool.h:40
DerivationFramework::TriggerGenericObjectThinningTool::~TriggerGenericObjectThinningTool
~TriggerGenericObjectThinningTool()
Definition: TriggerGenericObjectThinningTool.cxx:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListAND
Gaudi::Property< std::vector< std::string > > m_triggerListAND
Definition: TriggerGenericObjectThinningTool.h:45
ThinningHandle.h
Handle for requesting thinning for a data object.
DerivationFramework::TriggerGenericObjectThinningTool::doThinning
virtual StatusCode doThinning() const override
Definition: TriggerGenericObjectThinningTool.cxx:68
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::TriggerGenericObjectThinningTool::TriggerGenericObjectThinningTool
TriggerGenericObjectThinningTool(const std::string &t, const std::string &n, const IInterface *p)
Definition: TriggerGenericObjectThinningTool.cxx:38
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
SG::ThinningHandle
Handle for requesting thinning for a data object.
Definition: ThinningHandle.h:84
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListORHLTOnly
Gaudi::Property< std::vector< std::string > > m_triggerListORHLTOnly
Definition: TriggerGenericObjectThinningTool.h:47
DerivationFramework::TriggerGenericObjectThinningTool::m_SGKey
SG::ThinningHandleKey< xAOD::IParticleContainer > m_SGKey
Definition: TriggerGenericObjectThinningTool.h:42
DerivationFramework::TriggerGenericObjectThinningTool::finalize
virtual StatusCode finalize() override
Definition: TriggerGenericObjectThinningTool.cxx:61
TriggerGenericObjectThinningTool.h
Trig::ChainGroup
Definition: ChainGroup.h:51
DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListOR
Gaudi::Property< std::vector< std::string > > m_triggerListOR
Definition: TriggerGenericObjectThinningTool.h:46
DerivationFramework::TriggerGenericObjectThinningTool::m_trigDec
PublicToolHandle< Trig::TrigDecisionTool > m_trigDec
Definition: TriggerGenericObjectThinningTool.h:48
DerivationFramework::TriggerGenericObjectThinningTool::initialize
virtual StatusCode initialize() override
Definition: TriggerGenericObjectThinningTool.cxx:50
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
DerivationFramework::TriggerGenericObjectThinningTool::eventPassedFilter
bool eventPassedFilter() const
Definition: TriggerGenericObjectThinningTool.cxx:6
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Trig::ChainGroup::getListOfTriggers
std::vector< std::string > getListOfTriggers() const
Definition: ChainGroup.cxx:467
passOR
@ passOR
Definition: SUSYToolsTester.cxx:105