ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::TriggerGenericObjectThinningTool Class Reference

#include <TriggerGenericObjectThinningTool.h>

Inheritance diagram for DerivationFramework::TriggerGenericObjectThinningTool:
Collaboration diagram for DerivationFramework::TriggerGenericObjectThinningTool:

Public Member Functions

 TriggerGenericObjectThinningTool (const std::string &t, const std::string &n, const IInterface *p)
 ~TriggerGenericObjectThinningTool ()
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual StatusCode doThinning () const override

Private Member Functions

bool eventPassedFilter () const

Private Attributes

StringProperty m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
SG::ThinningHandleKey< xAOD::IParticleContainerm_SGKey { this, "ContainerName", "", "" }
Gaudi::Property< std::vector< std::string > > m_triggerListAND {this,"TriggerListAND", {}}
Gaudi::Property< std::vector< std::string > > m_triggerListOR {this,"TriggerListOR", {}}
Gaudi::Property< std::vector< std::string > > m_triggerListORHLTOnly {this,"TriggerListORHLTOnly", {}, "Decision is based on HLT only (unseeded triggers)"}
PublicToolHandle< Trig::TrigDecisionToolm_trigDec {this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"}

Detailed Description

Definition at line 30 of file TriggerGenericObjectThinningTool.h.

Constructor & Destructor Documentation

◆ TriggerGenericObjectThinningTool()

DerivationFramework::TriggerGenericObjectThinningTool::TriggerGenericObjectThinningTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 38 of file TriggerGenericObjectThinningTool.cxx.

40 :
41 base_class(t,n,p)
42 {
43 }

◆ ~TriggerGenericObjectThinningTool()

DerivationFramework::TriggerGenericObjectThinningTool::~TriggerGenericObjectThinningTool ( )

Definition at line 46 of file TriggerGenericObjectThinningTool.cxx.

46 {
47 }

Member Function Documentation

◆ doThinning()

StatusCode DerivationFramework::TriggerGenericObjectThinningTool::doThinning ( ) const
overridevirtual

Definition at line 68 of file TriggerGenericObjectThinningTool.cxx.

69 {
70 const EventContext& ctx = Gaudi::Hive::currentContext();
71
72 // Retrieve main object collection
73 SG::ThinningHandle<xAOD::IParticleContainer> particles (m_SGKey, ctx);
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 }
SG::ThinningHandleKey< xAOD::IParticleContainer > m_SGKey

◆ eventPassedFilter()

bool DerivationFramework::TriggerGenericObjectThinningTool::eventPassedFilter ( ) const
private

Definition at line 6 of file TriggerGenericObjectThinningTool.cxx.

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 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Gaudi::Property< std::vector< std::string > > m_triggerListOR
Gaudi::Property< std::vector< std::string > > m_triggerListAND
Gaudi::Property< std::vector< std::string > > m_triggerListORHLTOnly
std::vector< std::string > getListOfTriggers() const

◆ finalize()

StatusCode DerivationFramework::TriggerGenericObjectThinningTool::finalize ( )
overridevirtual

Definition at line 61 of file TriggerGenericObjectThinningTool.cxx.

62 {
63 ATH_MSG_VERBOSE("finalize() ...");
64 return StatusCode::SUCCESS;
65 }

◆ initialize()

StatusCode DerivationFramework::TriggerGenericObjectThinningTool::initialize ( )
overridevirtual

Definition at line 50 of file TriggerGenericObjectThinningTool.cxx.

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 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)

Member Data Documentation

◆ m_SGKey

SG::ThinningHandleKey<xAOD::IParticleContainer> DerivationFramework::TriggerGenericObjectThinningTool::m_SGKey { this, "ContainerName", "", "" }
private

Definition at line 41 of file TriggerGenericObjectThinningTool.h.

42{ this, "ContainerName", "", "" };

◆ m_streamName

StringProperty DerivationFramework::TriggerGenericObjectThinningTool::m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
private

Definition at line 39 of file TriggerGenericObjectThinningTool.h.

40{ this, "StreamName", "", "Name of the stream being thinned" };

◆ m_trigDec

PublicToolHandle<Trig::TrigDecisionTool> DerivationFramework::TriggerGenericObjectThinningTool::m_trigDec {this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"}
private

Definition at line 48 of file TriggerGenericObjectThinningTool.h.

48{this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"};

◆ m_triggerListAND

Gaudi::Property<std::vector<std::string> > DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListAND {this,"TriggerListAND", {}}
private

Definition at line 45 of file TriggerGenericObjectThinningTool.h.

45{this,"TriggerListAND", {}};

◆ m_triggerListOR

Gaudi::Property<std::vector<std::string> > DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListOR {this,"TriggerListOR", {}}
private

Definition at line 46 of file TriggerGenericObjectThinningTool.h.

46{this,"TriggerListOR", {}};

◆ m_triggerListORHLTOnly

Gaudi::Property<std::vector<std::string> > DerivationFramework::TriggerGenericObjectThinningTool::m_triggerListORHLTOnly {this,"TriggerListORHLTOnly", {}, "Decision is based on HLT only (unseeded triggers)"}
private

Definition at line 47 of file TriggerGenericObjectThinningTool.h.

47{this,"TriggerListORHLTOnly", {}, "Decision is based on HLT only (unseeded triggers)"};

The documentation for this class was generated from the following files: