ATLAS Offline Software
TrigDecisionSelector.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 {
14  TrigDecisionSelector::TrigDecisionSelector(const std::string& selectorName, std::shared_ptr<top::TopConfig> config) {
15  m_triggers = config->allTriggers_Tight(selectorName);
16  for (auto s: config->allTriggers_Loose(selectorName))
17  if (std::find(m_triggers.begin(), m_triggers.end(), s) == m_triggers.end()) m_triggers.push_back(s);
18  }
19 
21  bool orOfAllTriggers(false);
22 
23  for (const auto& trigger : m_triggers) {
24  bool passThisTrigger(false);
25  auto trigger_name = RCU::substitute(RCU::substitute(trigger.first, ".", "p"), "-", "_");
26  if (event.m_info->isAvailable<char>("TRIGDEC_" + trigger_name)) {
27  if (event.m_info->auxdataConst<char>("TRIGDEC_" + trigger_name) == 1) {
28  passThisTrigger = true;
29  }
30  }
31 
32  orOfAllTriggers |= passThisTrigger;
33  }
34 
35  return orOfAllTriggers;
36  }
37 
38  std::string TrigDecisionSelector::name() const {
39  std::string name = "TRIGDEC ";
40  for (auto trigger : m_triggers)
41  name += " " + trigger.first;
42 
43  return name;
44  }
45 }
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::TrigDecisionSelector::apply
virtual bool apply(const top::Event &event) const override
Select events based on the 'OR' of a few user defined triggers.
Definition: TrigDecisionSelector.cxx:20
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
top::TrigDecisionSelector::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: TrigDecisionSelector.h:57
StringUtil.h
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::TrigDecisionSelector::TrigDecisionSelector
TrigDecisionSelector(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: TrigDecisionSelector.cxx:14
Event.h
TrigDecisionSelector.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::TrigDecisionSelector::name
std::string name() const override
TRIGDEC because we might have a tool for trigger matching too at some point.
Definition: TrigDecisionSelector.cxx:38
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27