ATLAS Offline Software
NVarRCJetSelector.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 #include <iostream>
8 
9 namespace top {
10  NVarRCJetSelector::NVarRCJetSelector(const std::string& name, const std::string& params) :
11  SignValueSelector("VRCJET_N " + name, params, true),
12  m_name(name) {
14  }
15 
17  auto func = [&](const xAOD::Jet* jetPtr) {
18  return jetPtr->pt() > value();
19  };
20 
21  top::check(event.m_VarRCJets.find(
22  m_name) != event.m_VarRCJets.end(),
23  "Error in NVarRCJetSelector: Variable-R reclustered jets with parameter " + m_name + " not defined!");
24  std::unordered_map< std::string, std::shared_ptr<xAOD::JetContainer> > VarRCJets = event.m_VarRCJets;
25  auto count = std::count_if(VarRCJets[m_name]->begin(), VarRCJets[m_name]->end(), func);
26  return checkInt(count, multiplicity());
27  }
28 
30  auto func = [&](const xAOD::Jet* jetPtr) {
31  return jetPtr->pt() > value();
32  };
33 
34  top::check(event.m_VarRCJets.find(
35  m_name) != event.m_VarRCJets.end(),
36  "Error in NVarRCJetSelector: Variable-R reclustered jets with parameter " + m_name + " not defined!");
37  auto count = std::count_if(event.m_VarRCJets[m_name]->begin(), event.m_VarRCJets[m_name]->end(), func);
38  return checkInt(count, multiplicity());
39  }
40 }
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::SignValueSelector::multiplicity
double multiplicity() const
Get the cut multiplicity assigned in the constructor.
Definition: SignValueSelector.cxx:106
top::NVarRCJetSelector::applyParticleLevel
bool applyParticleLevel(const top::ParticleLevelEvent &) const override
This does stuff based on the information in a particle level event.
Definition: NVarRCJetSelector.cxx:29
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
top::SignValueSelector
Many of the tools need a sign (>=) and a value (2).
Definition: SignValueSelector.h:16
top::NVarRCJetSelector::m_name
std::string m_name
Definition: NVarRCJetSelector.h:13
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
top::NVarRCJetSelector::apply
bool apply(const top::Event &event) const override
This does stuff based on the information in an event.
Definition: NVarRCJetSelector.cxx:16
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
NVarRCJetSelector.h
top::ParticleLevelEvent
Definition: ParticleLevelEvent.h:24
top::NVarRCJetSelector::NVarRCJetSelector
NVarRCJetSelector(const std::string &name, const std::string &params)
Definition: NVarRCJetSelector.cxx:10
top::SignValueSelector::checkMultiplicityIsInteger
void checkMultiplicityIsInteger()
Integers are annoying in C++.
Definition: SignValueSelector.cxx:82
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
top::SignValueSelector::value
double value() const
Get the cut value assigned in the constructor.
Definition: SignValueSelector.cxx:94
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
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