ATLAS Offline Software
Loading...
Searching...
No Matches
DileptonInvariantMassWindowSelectorAlg.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#include "Math/Vector4D.h"
9
10using ROOT::Math::PtEtaPhiEVector;
11
12namespace CP {
13
15 : EL::AnaAlgorithm(name, pSvcLocator)
16 {}
17
31
33 // accessors
34 static const SG::ConstAccessor<float> acc_pt_dressed("pt_dressed");
35 static const SG::ConstAccessor<float> acc_eta_dressed("eta_dressed");
36 static const SG::ConstAccessor<float> acc_phi_dressed("phi_dressed");
37 static const SG::ConstAccessor<float> acc_e_dressed("e_dressed");
38
39 for (const auto &sys : m_systematicsList.systematicsVector()) {
40 // retrieve the EventInfo
41 const xAOD::EventInfo *evtInfo = nullptr;
42 ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
43
44 // default-decorate EventInfo
45 m_decoration.setBool(*evtInfo, 0, sys);
46
47 // check the preselection
48 if (m_preselection && !m_preselection.getBool(*evtInfo, sys))
49 continue;
50
51 // retrieve the electron container
52 const xAOD::IParticleContainer *electrons = nullptr;
54 ANA_CHECK(m_electronsHandle.retrieve(electrons, sys));
55 // retrieve the electron container
56 const xAOD::IParticleContainer *muons = nullptr;
57 if (m_muonsHandle)
58 ANA_CHECK(m_muonsHandle.retrieve(muons, sys));
59
60 // apply the requested selection
61 PtEtaPhiEVector lepton0, lepton1;
62 int total_leptons = 0;
63 bool isfilled0(false), isfilled1(false);
65 for (const xAOD::IParticle *el : *electrons) {
66 if (!m_electronSelection || m_electronSelection.getBool(*el, sys)) {
67 total_leptons++;
68 if (!isfilled0){
70 lepton0.SetCoordinates(acc_pt_dressed(*el),
71 acc_eta_dressed(*el),
72 acc_phi_dressed(*el),
73 acc_e_dressed(*el));
74 else
75 lepton0.SetCoordinates(el->pt(), el->eta(), el->phi(), el->e());
76 isfilled0 = true;
77 } else if (!isfilled1){
79 lepton1.SetCoordinates(acc_pt_dressed(*el),
80 acc_eta_dressed(*el),
81 acc_phi_dressed(*el),
82 acc_e_dressed(*el));
83 else
84 lepton1.SetCoordinates(el->pt(), el->eta(), el->phi(), el->e());
85 isfilled1 = true;
86 } else {
87 break;
88 }
89 }
90 }
91 }
92 if (m_muonsHandle) {
93 for (const xAOD::IParticle *mu : *muons) {
94 if (!m_muonSelection || m_muonSelection.getBool(*mu, sys)) {
95 total_leptons++;
96 if (!isfilled0){
98 lepton0.SetCoordinates(acc_pt_dressed(*mu),
99 acc_eta_dressed(*mu),
100 acc_phi_dressed(*mu),
101 acc_e_dressed(*mu));
102 else
103 lepton0.SetCoordinates(mu->pt(), mu->eta(), mu->phi(), mu->e());
104 isfilled0 = true;
105 } else if (!isfilled1){
107 lepton1.SetCoordinates(acc_pt_dressed(*mu),
108 acc_eta_dressed(*mu),
109 acc_phi_dressed(*mu),
110 acc_e_dressed(*mu));
111 else
112 lepton1.SetCoordinates(mu->pt(), mu->eta(), mu->phi(), mu->e());
113 isfilled1 = true;
114 } else {
115 break;
116 }
117 }
118 }
119 }
120
121 if (total_leptons != 2){
122 ATH_MSG_ERROR("Exactly two leptons are required to compute the MLL window!");
123 return StatusCode::FAILURE;
124 }
125
126 // compute MLL
127 float mll = (lepton0 + lepton1).M();
128
129 // calculate decision
130 bool in_range = ( mll > m_mlllower && mll < m_mllupper );
131 bool decision = m_veto ? (!in_range) : in_range;
132 m_decoration.setBool(*evtInfo, decision, sys);
133 }
134 return StatusCode::SUCCESS;
135 }
136} // namespace CP
#define ATH_MSG_ERROR(x)
#define ANA_CHECK(EXP)
check whether the given expression was successful
Gaudi::Property< float > m_mllupper
the upper limit of the MLL window
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
Gaudi::Property< float > m_mlllower
the lower limit of the MLL window
CP::SysReadSelectionHandle m_electronSelection
the electrons selection
CP::SysReadSelectionHandle m_muonSelection
the muons selection
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
CP::SysReadHandle< xAOD::IParticleContainer > m_muonsHandle
the muons handle
DileptonInvariantMassWindowSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
CP::SysReadSelectionHandle m_preselection
the preselection
CP::SysReadHandle< xAOD::IParticleContainer > m_electronsHandle
the electrons handle
Gaudi::Property< bool > m_useDressedProperties
use dressed kinematics
Gaudi::Property< bool > m_veto
whether to veto events instead of selecting them
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.
Select isolated Photons, Electrons and Muons.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
EventInfo_v1 EventInfo
Definition of the latest event info version.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.