ATLAS Offline Software
RunNumberSelector.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/EventTools.h"
8 
9 namespace top {
10  RunNumberSelector::RunNumberSelector(const std::string& params, std::shared_ptr<top::TopConfig> config) :
11  SignValueSelector("RUN_NUMBER", params) {
12  m_config = config;
13  }
14 
16  unsigned int number = 0;
17 
18  if (!m_config->isMC()) number = event.m_info->runNumber();
19  else {
20  if (event.m_info->isAvailable<unsigned int>("RandomRunNumber")) number = event.m_info->auxdataConst<unsigned int>(
21  "RandomRunNumber");
22  else {
23  throw std::runtime_error("RunNumberSelector: RandomRunNumber EventInfo decoration not available. Indicates issue with PRW tool.");
24  }
25  }
26 
27  return checkInt(number, value());
28  }
29 }
top::SignValueSelector::checkInt
bool checkInt(int value, int cut) const
Compare a cut supplied by the user with the value calculated in the event.
Definition: SignValueSelector.cxx:159
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::RunNumberSelector::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: RunNumberSelector.h:23
RunNumberSelector.h
top::SignValueSelector
Many of the tools need a sign (>=) and a value (2).
Definition: SignValueSelector.h:16
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
top::RunNumberSelector::RunNumberSelector
RunNumberSelector(const std::string &params, std::shared_ptr< top::TopConfig > config)
Definition: RunNumberSelector.cxx:10
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::RunNumberSelector::apply
bool apply(const top::Event &event) const override
This does stuff based on the information in an event.
Definition: RunNumberSelector.cxx:15
python.selection.number
number
Definition: selection.py:20
top::SignValueSelector::value
double value() const
Get the cut value assigned in the constructor.
Definition: SignValueSelector.cxx:94
TopConfig.h
config
std::vector< std::string > config
Definition: fbtTestBasics.cxx:72
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226