ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
EventSelectionAlgorithms
Root
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
7
#include "
EventSelectionAlgorithms/DileptonInvariantMassWindowSelectorAlg.h
"
8
#include "Math/Vector4D.h"
9
10
using
ROOT::Math::PtEtaPhiEVector;
11
12
namespace
CP
{
13
14
DileptonInvariantMassWindowSelectorAlg::DileptonInvariantMassWindowSelectorAlg
(
const
std::string &
name
, ISvcLocator *pSvcLocator)
15
:
EL
::
AnaAlgorithm
(
name
, pSvcLocator)
16
{}
17
18
StatusCode
DileptonInvariantMassWindowSelectorAlg::initialize
() {
19
ANA_CHECK
(
m_electronsHandle
.initialize(
m_systematicsList
,
SG::AllowEmpty
));
20
ANA_CHECK
(
m_electronSelection
.initialize(
m_systematicsList
,
m_electronsHandle
,
SG::AllowEmpty
));
21
ANA_CHECK
(
m_muonsHandle
.initialize(
m_systematicsList
,
SG::AllowEmpty
));
22
ANA_CHECK
(
m_muonSelection
.initialize(
m_systematicsList
,
m_muonsHandle
,
SG::AllowEmpty
));
23
ANA_CHECK
(
m_eventInfoHandle
.initialize(
m_systematicsList
));
24
25
ANA_CHECK
(
m_preselection
.initialize(
m_systematicsList
,
m_eventInfoHandle
,
SG::AllowEmpty
));
26
ANA_CHECK
(
m_decoration
.initialize(
m_systematicsList
,
m_eventInfoHandle
));
27
ANA_CHECK
(
m_systematicsList
.initialize());
28
29
return
StatusCode::SUCCESS;
30
}
31
32
StatusCode
DileptonInvariantMassWindowSelectorAlg::execute
(
const
EventContext& ctx) {
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, ctx));
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
;
53
if
(
m_electronsHandle
)
54
ANA_CHECK
(
m_electronsHandle
.retrieve(electrons, sys, ctx));
55
// retrieve the electron container
56
const
xAOD::IParticleContainer
*muons =
nullptr
;
57
if
(
m_muonsHandle
)
58
ANA_CHECK
(
m_muonsHandle
.retrieve(muons, sys, ctx));
59
60
// apply the requested selection
61
PtEtaPhiEVector lepton0, lepton1;
62
int
total_leptons = 0;
63
bool
isfilled0(
false
), isfilled1(
false
);
64
if
(
m_electronsHandle
) {
65
for
(
const
xAOD::IParticle
*el : *electrons) {
66
if
(!
m_electronSelection
||
m_electronSelection
.getBool(*el, sys)) {
67
total_leptons++;
68
if
(!isfilled0){
69
if
(
m_useDressedProperties
)
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){
78
if
(
m_useDressedProperties
)
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){
97
if
(
m_useDressedProperties
)
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){
106
if
(
m_useDressedProperties
)
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
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:32
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:322
DileptonInvariantMassWindowSelectorAlg.h
CP::DileptonInvariantMassWindowSelectorAlg::m_mllupper
Gaudi::Property< float > m_mllupper
the upper limit of the MLL window
Definition
DileptonInvariantMassWindowSelectorAlg.h:38
CP::DileptonInvariantMassWindowSelectorAlg::m_decoration
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
Definition
DileptonInvariantMassWindowSelectorAlg.h:85
CP::DileptonInvariantMassWindowSelectorAlg::m_mlllower
Gaudi::Property< float > m_mlllower
the lower limit of the MLL window
Definition
DileptonInvariantMassWindowSelectorAlg.h:41
CP::DileptonInvariantMassWindowSelectorAlg::m_electronSelection
CP::SysReadSelectionHandle m_electronSelection
the electrons selection
Definition
DileptonInvariantMassWindowSelectorAlg.h:60
CP::DileptonInvariantMassWindowSelectorAlg::m_muonSelection
CP::SysReadSelectionHandle m_muonSelection
the muons selection
Definition
DileptonInvariantMassWindowSelectorAlg.h:70
CP::DileptonInvariantMassWindowSelectorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
Definition
DileptonInvariantMassWindowSelectorAlg.h:75
CP::DileptonInvariantMassWindowSelectorAlg::m_muonsHandle
CP::SysReadHandle< xAOD::IParticleContainer > m_muonsHandle
the muons handle
Definition
DileptonInvariantMassWindowSelectorAlg.h:65
CP::DileptonInvariantMassWindowSelectorAlg::DileptonInvariantMassWindowSelectorAlg
DileptonInvariantMassWindowSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition
DileptonInvariantMassWindowSelectorAlg.cxx:14
CP::DileptonInvariantMassWindowSelectorAlg::initialize
virtual StatusCode initialize() override
Definition
DileptonInvariantMassWindowSelectorAlg.cxx:18
CP::DileptonInvariantMassWindowSelectorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
the systematics
Definition
DileptonInvariantMassWindowSelectorAlg.h:52
CP::DileptonInvariantMassWindowSelectorAlg::m_preselection
CP::SysReadSelectionHandle m_preselection
the preselection
Definition
DileptonInvariantMassWindowSelectorAlg.h:80
CP::DileptonInvariantMassWindowSelectorAlg::m_electronsHandle
CP::SysReadHandle< xAOD::IParticleContainer > m_electronsHandle
the electrons handle
Definition
DileptonInvariantMassWindowSelectorAlg.h:55
CP::DileptonInvariantMassWindowSelectorAlg::m_useDressedProperties
Gaudi::Property< bool > m_useDressedProperties
use dressed kinematics
Definition
DileptonInvariantMassWindowSelectorAlg.h:47
CP::DileptonInvariantMassWindowSelectorAlg::m_veto
Gaudi::Property< bool > m_veto
whether to veto events instead of selecting them
Definition
DileptonInvariantMassWindowSelectorAlg.h:44
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaAlgorithm.cxx:40
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
Generated on
for ATLAS Offline Software by
1.17.0