ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
top::TrigDecisionTightSelector Class Reference

Sometimes you may want to select events that pass a certain trigger, or triggers. More...

#include <TrigDecisionTightSelector.h>

Inheritance diagram for top::TrigDecisionTightSelector:
Collaboration diagram for top::TrigDecisionTightSelector:

Public Member Functions

 TrigDecisionTightSelector (const std::string &selectorName, std::shared_ptr< top::TopConfig > config)
 A tool to select events that pass a certain trigger (or any trigger in a list). More...
 
virtual bool apply (const top::Event &event) const override
 Select events based on the 'OR' of a few user defined triggers. More...
 
std::string name () const override
 TRIGDEC because we might have a tool for trigger matching too at some point. More...
 
virtual bool applyParticleLevel (const top::ParticleLevelEvent &) const
 This does stuff based on the information in a particle level event. More...
 

Private Attributes

std::vector< std::pair< std::string, int > > m_triggers
 List of triggers to 'or' together for each event. If any one passes, the event passes. More...
 

Detailed Description

Sometimes you may want to select events that pass a certain trigger, or triggers.

This code only accepts the event if it passes at least one of the triggers that it was configured with. It does an 'OR' of all the trigger decisions.

This will only be applied on the tight trees, not the loose ones (i.e. not those with "_Loose" in their names)

For example:

TRIGDEC_TIGHT HLT_e24_tight_L1EM20V HLT_e60_medium1

Would select the event if either of those passes.

Definition at line 33 of file TrigDecisionTightSelector.h.

Constructor & Destructor Documentation

◆ TrigDecisionTightSelector()

top::TrigDecisionTightSelector::TrigDecisionTightSelector ( const std::string &  selectorName,
std::shared_ptr< top::TopConfig config 
)

A tool to select events that pass a certain trigger (or any trigger in a list).

Parameters
nameThe name of the current event selection - e.g. ee
config- this will give use a std::vector<std::string> of triggers to check

Definition at line 14 of file TrigDecisionTightSelector.cxx.

15  {
16  m_triggers = config->allTriggers_Tight(selectorName);
17  }

Member Function Documentation

◆ apply()

bool top::TrigDecisionTightSelector::apply ( const top::Event event) const
overridevirtual

Select events based on the 'OR' of a few user defined triggers.

The thinking is you might want to pass e25i or e30 so "TRIGDEC e25i e30".

Parameters
eventThe event in question. Not used by the trigger decision tool. I guess it finds out the information some other, internal, way.
Returns
True if at least one of the triggers in the string list passed.

Implements top::EventSelectorBase.

Definition at line 19 of file TrigDecisionTightSelector.cxx.

19  {
20  // this selector does nothing for loose events
21  bool loose = event.m_isLoose;
22 
23  if (loose) return true;
24 
25  bool orOfAllTriggers(false);
26  for (const auto& trigger : m_triggers) {
27  bool passThisTrigger(false);
28  auto trigger_name = RCU::substitute(RCU::substitute(trigger.first, ".", "p"), "-", "_");
29  if (event.m_info->isAvailable<char>("TRIGDEC_" + trigger_name)) {
30  if (event.m_info->auxdataConst<char>("TRIGDEC_" + trigger_name) == 1) {
31  passThisTrigger = true;
32  }
33  }
34 
35  orOfAllTriggers |= passThisTrigger;
36  }
37 
38  return orOfAllTriggers;
39  }

◆ applyParticleLevel()

virtual bool top::EventSelectorBase::applyParticleLevel ( const top::ParticleLevelEvent ) const
inlinevirtualinherited

This does stuff based on the information in a particle level event.

The idea is that you implement this to return either true or false, based on the information held within the top::ParticleLevelEvent. If this function returns true, then the event is kept, otherwise it is removed. The function has a default implementation (which returns true) because it is expected that many EventSelector objects do not operate on ParticleLevelEvent objects.

Parameters
top::ParticleLevelEventthe current particle level event.
trueif the event should be kept (i.e. it passed the selector criteria), false otherwise.

Reimplemented in top::JetNGhostSelector, top::PrintEventSelector, top::PseudoTopRecoRun, top::NElectronNMuonTightSelector, top::NElectronNMuonSelector, top::NFwdElectronSelector, top::HTSelector, top::OSLeptonTightSelector, top::MLLSelector, top::MWTSelector, top::NElectronTightSelector, top::NFwdElectronTightSelector, top::NMuonTightSelector, top::OSLeptonSelector, top::METMWTSelector, top::METSelector, top::MLLWindow, top::NElectronSelector, top::NJetSelector, top::NMuonSelector, top::NPhotonSelector, top::NSoftMuonSelector, top::NTauSelector, top::SSLeptonTightSelector, top::SSLeptonSelector, top::ParticleLevelSelector, top::RecoLevelSelector, top::NVarRCJetSelector, top::NLargeJetSelector, and top::NRCJetSelector.

Definition at line 73 of file EventSelectorBase.h.

73 {return true;}

◆ name()

std::string top::TrigDecisionTightSelector::name ( ) const
overridevirtual

TRIGDEC because we might have a tool for trigger matching too at some point.

Implements top::EventSelectorBase.

Definition at line 41 of file TrigDecisionTightSelector.cxx.

41  {
42  std::string name = "TRIGDEC_TIGHT ";
43  for (auto trigger : m_triggers)
44  name += " " + trigger.first;
45 
46  return name;
47  }

Member Data Documentation

◆ m_triggers

std::vector<std::pair<std::string, int> > top::TrigDecisionTightSelector::m_triggers
private

List of triggers to 'or' together for each event. If any one passes, the event passes.

Definition at line 59 of file TrigDecisionTightSelector.h.


The documentation for this class was generated from the following files:
top::TrigDecisionTightSelector::name
std::string name() const override
TRIGDEC because we might have a tool for trigger matching too at some point.
Definition: TrigDecisionTightSelector.cxx:41
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
RCU::substitute
std::string substitute(const std::string &str, const std::string &pattern, const std::string &with)
effects: substitute all occurences of "pattern" with "with" in the string "str" returns: the substitu...
Definition: StringUtil.cxx:24
top::TrigDecisionTightSelector::m_triggers
std::vector< std::pair< std::string, int > > m_triggers
List of triggers to 'or' together for each event. If any one passes, the event passes.
Definition: TrigDecisionTightSelector.h:59
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27