ATLAS Offline Software
MWTSelector.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"
7 
8 namespace top {
9  MWTSelector::MWTSelector(const std::string& params) :
10  SignValueSelector("MWT", params) {
11  }
12 
13  bool MWTSelector::apply(const top::Event& event) const {
14  const xAOD::IParticle* lepton = 0;
15 
16  if (!event.m_electrons.empty()) lepton = event.m_electrons.front();
17  else if (!event.m_muons.empty()) lepton = event.m_muons.front();
18  else {
19  throw std::runtime_error("MWTSelector::apply: No charged lepton in event");
20  }
21 
22  const double mwt = top::mwt(*lepton, *event.m_met);
23  return checkFloat(mwt, value());
24  }
25 
27  // If any of the required collections is a nullptr (i.e. has not been
28  // loaded) return false.
29  if (not event.m_electrons
30  or not event.m_muons
31  or not event.m_met) {
32  return false;
33  }
34 
35  const xAOD::IParticle* lepton = 0;
36  if (!event.m_electrons->empty()) lepton = event.m_electrons->front();
37  else if (!event.m_muons->empty()) lepton = event.m_muons->front();
38  else {
39  throw std::runtime_error("MWTSelector::applyParticleLevel: No charged lepton in event");
40  }
41 
42  const double mwt = top::mwt(*lepton, *event.m_met);
43  return checkFloat(mwt, value());
44  }
45 }
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::MWTSelector::applyParticleLevel
bool applyParticleLevel(const top::ParticleLevelEvent &event) const override
This does stuff based on the information in a particle level event.
Definition: MWTSelector.cxx:26
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
top::SignValueSelector
Many of the tools need a sign (>=) and a value (2).
Definition: SignValueSelector.h:16
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
top::SignValueSelector::checkFloat
bool checkFloat(double value, double cut) const
Compare a cut supplied by the user with the value calculated in the event.
Definition: SignValueSelector.cxx:133
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::MWTSelector::apply
bool apply(const top::Event &event) const override
This does stuff based on the information in an event.
Definition: MWTSelector.cxx:13
top::MWTSelector::MWTSelector
MWTSelector(const std::string &params)
Definition: MWTSelector.cxx:9
top::ParticleLevelEvent
Definition: ParticleLevelEvent.h:24
top::SignValueSelector::value
double value() const
Get the cut value assigned in the constructor.
Definition: SignValueSelector.cxx:94
MWTSelector.h
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
top::mwt
double mwt(const xAOD::IParticle &lepton, const xAOD::MissingET &met)
Calculate the transverse mass of the W from the charged lepton and the missing ET.
Definition: EventTools.cxx:29