ATLAS Offline Software
TrigDecisionLooseSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 #include "TopEvent/Event.h"
8 
9 #include <sstream>
10 #include <iostream>
12 
13 namespace top {
15  std::shared_ptr<top::TopConfig> config) {
16  m_triggers = config->allTriggers_Loose(selectorName);
17  }
18 
20  // this selector does nothing for non-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  }
40 
41  std::string TrigDecisionLooseSelector::name() const {
42  std::string name = "TRIGDEC_LOOSE ";
43  for (auto trigger : m_triggers)
44  name += " " + trigger.first;
45 
46  return name;
47  }
48 }
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::TrigDecisionLooseSelector::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: TrigDecisionLooseSelector.h:59
top::TrigDecisionLooseSelector::apply
virtual bool apply(const top::Event &event) const override
Select events based on the 'OR' of a few user defined triggers.
Definition: TrigDecisionLooseSelector.cxx:19
TrigDecisionLooseSelector.h
StringUtil.h
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
Event.h
TopConfig.h
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::TrigDecisionLooseSelector::name
std::string name() const override
TRIGDEC because we might have a tool for trigger matching too at some point.
Definition: TrigDecisionLooseSelector.cxx:41
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
top::TrigDecisionLooseSelector::TrigDecisionLooseSelector
TrigDecisionLooseSelector(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).
Definition: TrigDecisionLooseSelector.cxx:14
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27