ATLAS Offline Software
Loading...
Searching...
No Matches
SumNLeptonPtSelectorAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9namespace CP {
10
11 SumNLeptonPtSelectorAlg::SumNLeptonPtSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
12 : EL::AnaAlgorithm(name, pSvcLocator)
13 {}
14
32
34 // accessors
35 static const SG::ConstAccessor<float> acc_pt_dressed("pt_dressed");
36
37 for (const auto &sys : m_systematicsList.systematicsVector()) {
38 // retrieve the EventInfo
39 const xAOD::EventInfo *evtInfo = nullptr;
40 ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
41
42 // default-decorate EventInfo
43 m_decoration.setBool(*evtInfo, 0, sys);
44
45 // check the preselection
46 if (m_preselection && !m_preselection.getBool(*evtInfo, sys))
47 continue;
48
49 // retrieve the electron container
50 const xAOD::IParticleContainer *electrons = nullptr;
52 ANA_CHECK(m_electronsHandle.retrieve(electrons, sys));
53 // retrieve the muon container
54 const xAOD::IParticleContainer *muons = nullptr;
55 if (m_muonsHandle)
56 ANA_CHECK(m_muonsHandle.retrieve(muons, sys));
57 // retrieve the tau container
58 const xAOD::IParticleContainer *taus = nullptr;
59 if (m_tausHandle)
60 ANA_CHECK(m_tausHandle.retrieve(taus, sys));
61
62 // apply the requested selection
63 int count = 0;
65 for (const xAOD::IParticle *el : *electrons) {
66 if (!m_electronSelection || m_electronSelection.getBool(*el, sys)) {
68 if (acc_pt_dressed(*el) >= m_elptmin) count++;
69 } else {
70 if (el->pt() >= m_elptmin) count++;
71 }
72 }
73 }
74 }
75 if (m_muonsHandle) {
76 for (const xAOD::IParticle *mu : *muons) {
77 if (!m_muonSelection || m_muonSelection.getBool(*mu, sys)) {
79 if (acc_pt_dressed(*mu) >= m_muptmin) count++;
80 } else {
81 if (mu->pt() >= m_muptmin) count++;
82 }
83 }
84 }
85 }
86 if (m_tausHandle) {
87 for (const xAOD::IParticle *tau : *taus) {
88 if (!m_tauSelection || m_tauSelection.getBool(*tau, sys)) {
89 // for taus dressed properties do not make a big difference
90 if (tau->pt() >= m_tauptmin) count++;
91 }
92 }
93 }
94
95 // calculate decision
96 bool decision = SignEnum::checkValue(m_count.value(), m_signEnum, count);
97 m_decoration.setBool(*evtInfo, decision, sys);
98 }
99 return StatusCode::SUCCESS;
100 }
101} // namespace CP
#define ANA_CHECK(EXP)
check whether the given expression was successful
static Double_t taus
CP::SysListHandle m_systematicsList
the systematics list
CP::SysReadSelectionHandle m_muonSelection
the muons selection
Gaudi::Property< int > m_count
the count of events desired
Gaudi::Property< float > m_muptmin
the pT threshold on which to select electrons
CP::SysReadHandle< xAOD::IParticleContainer > m_tausHandle
the taus handle
Gaudi::Property< std::string > m_sign
the sign against which to compare pT (GT, LT, etc)
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
CP::SysReadSelectionHandle m_electronSelection
the electrons selection
Gaudi::Property< float > m_tauptmin
the pT threshold on which to select taus
Gaudi::Property< float > m_elptmin
the pT threshold on which to select electrons
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
CP::SysReadHandle< xAOD::IParticleContainer > m_electronsHandle
the electrons handle
CP::SysReadSelectionHandle m_tauSelection
the taus selection
virtual StatusCode initialize() override
SumNLeptonPtSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Gaudi::Property< bool > m_useDressedProperties
use dressed kinematics
CP::SysReadSelectionHandle m_preselection
the preselection
virtual StatusCode execute() override
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
CP::SysReadHandle< xAOD::IParticleContainer > m_muonsHandle
the muons handle
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Helper class to provide constant type-safe access to aux data.
Class providing the definition of the 4-vector interface.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Select isolated Photons, Electrons and Muons.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
bool checkValue(T reference, ComparisonOperator sign, T test)
the comparison test given the specified sign and two test values
Definition SignEnums.h:37
static const std::map< std::string, ComparisonOperator > stringToOperator
the map between user inputs and comparison operators
Definition SignEnums.h:27
EventInfo_v1 EventInfo
Definition of the latest event info version.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.