ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
PFlow
PFlowValidation
PFOHistUtils
src
FlowElement_LinkerPlots.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PFOHistUtils/FlowElement_LinkerPlots.h
"
6
#include "
xAODMuon/MuonContainer.h
"
7
#include "
xAODEgamma/ElectronContainer.h
"
8
#include "
xAODEgamma/PhotonContainer.h
"
9
#include "
xAODTau/TauJetContainer.h
"
10
#include "AthLinks/ElementLink.h"
11
12
namespace
PFO
{
13
14
FlowElement_LinkerPlots::FlowElement_LinkerPlots
(
PlotBase
* pParent,
const
std::string & sDir,
const
std::string & sFEContainerName,
bool
doNeutralFE):
15
PlotBase
(pParent, sDir),
16
m_sFEContainerName
(sFEContainerName),
17
m_doNeutralFE
(doNeutralFE)
18
{
19
}
20
21
void
FlowElement_LinkerPlots::initializePlots
(){
22
// init only the histograms we're going to use (m_doNeutralFE is the switch)
23
//tau
24
if
(
m_sFEContainerName
==
""
){
// skip init if container not used.
25
return
;
26
}
27
if
(!
m_doNeutralFE
){
28
m_CFE_tau_dR
=
Book1D
(
"_CFE_tau_dR"
,
m_sFEContainerName
+
"_CFE_tau_dR"
,10,0,1);
29
m_CFE_tau_NMatchedTau
=
Book1D
(
"_CFE_tau_NMatchedTau"
,
m_sFEContainerName
+
"_CFE_tau_NMatchedTau"
,5,0,5);
30
}
31
else
{
32
m_NFE_tau_dR
=
Book1D
(
"_NFE_tau_dR"
,
m_sFEContainerName
+
"_NFE_tau_dR"
,10,0,1);
33
m_NFE_tau_NMatchedTau
=
Book1D
(
"_NFE_tau_NMatchedTau"
,
m_sFEContainerName
+
"_NFE_tau_NMatchedTau"
,5,0,5);
34
}
35
//electron
36
if
(!
m_doNeutralFE
){
37
m_CFE_electron_dR
=
Book1D
(
"_CFE_electron_dR"
,
m_sFEContainerName
+
"_CFE_electron_dR"
,15,0,1.5);
38
m_CFE_electron_NMatchedElectron
=
Book1D
(
"_CFE_electron_NMatchedElectron"
,
m_sFEContainerName
+
"_CFE_electron_NMatchedElectron"
,10,0,10);
39
}
40
else
{
41
m_NFE_electron_dR
=
Book1D
(
"_NFE_electron_dR"
,
m_sFEContainerName
+
"_NFE_electron_dR"
,10,0,1);
42
m_NFE_electron_NMatchedElectron
=
Book1D
(
"_NFE_electron_NMatchedElectron"
,
m_sFEContainerName
+
"_NFE_electron_NMatchedElectron"
,5,0,5);
43
}
44
//muon
45
if
(!
m_doNeutralFE
){
46
m_CFE_muon_dR
=
Book1D
(
"_CFE_muon_dR"
,
m_sFEContainerName
+
"_CFE_muon_dR"
,10,0,1);
47
m_CFE_muon_NMatchedMuon
=
Book1D
(
"_CFE_muon_NMatchedMuon"
,
m_sFEContainerName
+
"_CFE_muon_NMatchedMuon"
,5,0,5);
48
m_CFE_muon_largeDR_debug_author
=
Book1D
(
"_CFE_muon_largeDR_debug_author"
,
m_sFEContainerName
+
"_CFE_muon_largeDR_debug_author"
,20,0,20);
49
m_CFE_muon_largeDR_debug_type
=
Book1D
(
"_CFE_muon_largeDR_debug_type"
,
m_sFEContainerName
+
"_CFE_muon_largeDR_debug_type"
,20,0,20);
50
}
51
else
{
52
m_NFE_muon_dR
=
Book1D
(
"_NFE_muon_dR"
,
m_sFEContainerName
+
"_NFE_muon_dR"
,10,0,1);
53
m_NFE_muon_NMatchedMuon
=
Book1D
(
"_NFE_muon_NMatchedMuon"
,
m_sFEContainerName
+
"_NFE_muon_NMatchedMuon"
,10,0,10);
54
}
55
//photon
56
if
(!
m_doNeutralFE
){
57
m_CFE_photon_dR
=
Book1D
(
"_CFE_photon_dR"
,
m_sFEContainerName
+
"_CFE_photon_dR"
,10,0,1);
58
m_CFE_photon_NMatchedPhoton
=
Book1D
(
"_CFE_photon_NMatchedPhoton"
,
m_sFEContainerName
+
"_CFE_photon_NMatchedPhoton"
,5,0,5);
59
}
60
else
{
61
m_NFE_photon_dR
=
Book1D
(
"_NFE_photon_dR"
,
m_sFEContainerName
+
"_NFE_photon_dR"
,10,0,1);
62
m_NFE_photon_NMatchedPhoton
=
Book1D
(
"_NFE_photon_NMatchedPhoton"
,
m_sFEContainerName
+
"_NFE_photon_NMatchedPhoton"
,5,0,5);
63
}
64
}
65
void
FlowElement_LinkerPlots::fill
(
const
xAOD::FlowElement
& FE,
const
xAOD::EventInfo
& eventInfo){
66
// methods work for both CFE and NFE since the auxvars are named the same
67
SG::ConstAccessor< std::vector < ElementLink< xAOD::MuonContainer >
> > acc_muon_FE_Link(
"FE_MuonLinks"
);
68
SG::ConstAccessor< std::vector < ElementLink< xAOD::PhotonContainer >
> > acc_photon_FE_Link(
"FE_PhotonLinks"
);
69
SG::ConstAccessor< std::vector < ElementLink< xAOD::ElectronContainer >
> > acc_electron_FE_Link(
"FE_ElectronLinks"
);
70
SG::ConstAccessor< std::vector < ElementLink< xAOD::TauJetContainer >
> > acc_tau_FE_Link(
"FE_TauLinks"
);
71
72
TLorentzVector FE_fourvec=FE.
p4
();
73
// Muon block
74
if
(acc_muon_FE_Link.
isAvailable
(FE)){
75
std::vector< ElementLink < xAOD::MuonContainer > > MuonLinks=acc_muon_FE_Link(FE);
76
int
nMuons_per_FE=MuonLinks.size();
77
if
(nMuons_per_FE>0){
// skip cases w/o match
78
if
(
m_doNeutralFE
)
79
m_NFE_muon_NMatchedMuon
->Fill(nMuons_per_FE,eventInfo.
beamSpotWeight
());
80
else
81
m_CFE_muon_NMatchedMuon
->Fill(nMuons_per_FE,eventInfo.
beamSpotWeight
());
82
}
83
84
for
(
ElementLink<xAOD::MuonContainer>
MuonLink
: MuonLinks){
85
86
//get Muon from link by de-referencing it
87
if
(!
MuonLink
.isValid()){
88
std::cerr <<
"FlowElement_LinkerPlots encountered an invalid muon element link. Skipping. "
<<std::endl;
89
continue
;
90
}
91
const
xAOD::Muon
* muon = *
MuonLink
;
92
TLorentzVector muon_fourvec=muon->p4();
93
double
deltaR
=muon_fourvec.DeltaR(FE_fourvec);
94
if
(muon->muonType()==xAOD::Muon::MuonType::SiliconAssociatedForwardMuon)
// skip forward muons, as have tracklets which mis-link to FE.
95
continue
;
96
if
(
m_doNeutralFE
)
97
m_NFE_muon_dR
->Fill(
deltaR
,eventInfo.
beamSpotWeight
());
98
else
{
99
m_CFE_muon_dR
->Fill(
deltaR
,eventInfo.
beamSpotWeight
());
100
if
(
deltaR
>1){
// should never happen, but catch for extreme cases
101
int
auth=
static_cast<
int
>
(muon->author());
102
int
type
=
static_cast<
int
>
(muon->muonType());
103
m_CFE_muon_largeDR_debug_author
->Fill(auth,eventInfo.
beamSpotWeight
());
104
m_CFE_muon_largeDR_debug_type
->Fill(
type
,eventInfo.
beamSpotWeight
());
105
}
106
}
// end of CFE fill block for muon_dR code
107
}
108
}
// end of muon acc block
109
110
// Electron block
111
if
(acc_electron_FE_Link.
isAvailable
(FE)){
112
std::vector< ElementLink < xAOD::ElectronContainer > > ElectronLinks=acc_electron_FE_Link(FE);
113
int
nElectrons_per_FE=ElectronLinks.size();
114
if
(nElectrons_per_FE>0){
// skip cases w/o match
115
if
(
m_doNeutralFE
)
116
m_NFE_electron_NMatchedElectron
->Fill(nElectrons_per_FE,eventInfo.
beamSpotWeight
());
117
else
118
m_CFE_electron_NMatchedElectron
->Fill(nElectrons_per_FE,eventInfo.
beamSpotWeight
());
119
}
120
121
for
(
ElementLink<xAOD::ElectronContainer>
ElectronLink
: ElectronLinks){
122
//get Electron from link by de-referencing it
123
if
(!
ElectronLink
.isValid()){
124
std::cerr <<
"FlowElement_LinkerPlots encountered an invalid electron element link. Skipping. "
<<std::endl;
125
continue
;
126
}
127
const
xAOD::Electron
* electron = *
ElectronLink
;
128
TLorentzVector electron_fourvec=electron->p4();
129
double
deltaR
=electron_fourvec.DeltaR(FE_fourvec);
130
if
(
m_doNeutralFE
)
131
m_NFE_electron_dR
->Fill(
deltaR
,eventInfo.
beamSpotWeight
());
132
else
133
m_CFE_electron_dR
->Fill(
deltaR
,eventInfo.
beamSpotWeight
());
134
}
135
}
// end of electron acc block
136
137
// Photon block
138
if
(acc_photon_FE_Link.
isAvailable
(FE)){
139
std::vector< ElementLink < xAOD::PhotonContainer > > PhotonLinks=acc_photon_FE_Link(FE);
140
int
nPhotons_per_FE=PhotonLinks.size();
141
if
(nPhotons_per_FE>0){
// skip cases w/o match
142
if
(
m_doNeutralFE
)
143
m_NFE_photon_NMatchedPhoton
->Fill(nPhotons_per_FE,eventInfo.
beamSpotWeight
());
144
else
145
m_CFE_photon_NMatchedPhoton
->Fill(nPhotons_per_FE,eventInfo.
beamSpotWeight
());
146
}
147
148
for
(
ElementLink<xAOD::PhotonContainer>
PhotonLink: PhotonLinks){
149
//get Photon from link by de-referencing it
150
if
(!PhotonLink.isValid()){
151
std::cerr <<
"FlowElement_LinkerPlots encountered an invalid photon element link. Skipping. "
<<std::endl;
152
continue
;
153
}
154
const
xAOD::Photon
* photon = *PhotonLink;
155
TLorentzVector photon_fourvec=photon->p4();
156
double
deltaR
=photon_fourvec.DeltaR(FE_fourvec);
157
if
(
m_doNeutralFE
)
158
m_NFE_photon_dR
->Fill(
deltaR
,eventInfo.
beamSpotWeight
());
159
else
160
m_CFE_photon_dR
->Fill(
deltaR
,eventInfo.
beamSpotWeight
());
161
}
162
}
// end of photon acc block
163
164
// Taujet block
165
if
(acc_tau_FE_Link.
isAvailable
(FE)){
166
std::vector< ElementLink < xAOD::TauJetContainer > > TaujetLinks=acc_tau_FE_Link(FE);
167
int
nTaujets_per_FE=TaujetLinks.size();
168
if
(nTaujets_per_FE>0){
// skip cases w/o match
169
if
(
m_doNeutralFE
)
170
m_NFE_tau_NMatchedTau
->Fill(nTaujets_per_FE,eventInfo.
beamSpotWeight
());
171
else
172
m_CFE_tau_NMatchedTau
->Fill(nTaujets_per_FE,eventInfo.
beamSpotWeight
());
173
}
174
175
TLorentzVector FE_fourvec=FE.
p4
();
176
for
(
ElementLink<xAOD::TauJetContainer>
TaujetLink: TaujetLinks){
177
//get Taujet from link by de-referencing it
178
if
(!TaujetLink.isValid()){
179
std::cerr <<
"FlowElement_LinkerPlots encountered an invalid tau jet element link. Skipping. "
<<std::endl;
180
continue
;
181
}
182
const
xAOD::TauJet
* taujet = *TaujetLink;
183
TLorentzVector taujet_fourvec=taujet->
p4
();
184
double
deltaR
=taujet_fourvec.DeltaR(FE_fourvec);
185
if
(
m_doNeutralFE
)
186
m_NFE_tau_dR
->Fill(
deltaR
,eventInfo.
beamSpotWeight
());
187
else
188
m_CFE_tau_dR
->Fill(
deltaR
,eventInfo.
beamSpotWeight
());
189
}
190
}
// end of taujet acc block
191
}
// end of fill statement
192
}
// end of PFO namespace
deltaR
Scalar deltaR(const MatrixBase< Derived > &vec) const
Definition
AmgMatrixBasePlugin.h:105
MuonLink
ElementLink< xAOD::MuonContainer > MuonLink
Definition
BPhysHelper.cxx:21
ElectronLink
ElementLink< xAOD::ElectronContainer > ElectronLink
Definition
BPhysHelper.cxx:23
ElectronContainer.h
PhotonContainer.h
MuonContainer.h
FlowElement_LinkerPlots.h
TauJetContainer.h
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
PFO::FlowElement_LinkerPlots::m_NFE_electron_NMatchedElectron
TH1 * m_NFE_electron_NMatchedElectron
Definition
FlowElement_LinkerPlots.h:53
PFO::FlowElement_LinkerPlots::m_NFE_muon_dR
TH1 * m_NFE_muon_dR
Definition
FlowElement_LinkerPlots.h:40
PFO::FlowElement_LinkerPlots::m_CFE_photon_NMatchedPhoton
TH1 * m_CFE_photon_NMatchedPhoton
Definition
FlowElement_LinkerPlots.h:44
PFO::FlowElement_LinkerPlots::m_CFE_muon_largeDR_debug_author
TH1 * m_CFE_muon_largeDR_debug_author
Definition
FlowElement_LinkerPlots.h:37
PFO::FlowElement_LinkerPlots::m_CFE_muon_NMatchedMuon
TH1 * m_CFE_muon_NMatchedMuon
Definition
FlowElement_LinkerPlots.h:36
PFO::FlowElement_LinkerPlots::m_doNeutralFE
bool m_doNeutralFE
Definition
FlowElement_LinkerPlots.h:57
PFO::FlowElement_LinkerPlots::m_CFE_muon_largeDR_debug_type
TH1 * m_CFE_muon_largeDR_debug_type
Definition
FlowElement_LinkerPlots.h:38
PFO::FlowElement_LinkerPlots::FlowElement_LinkerPlots
FlowElement_LinkerPlots(PlotBase *pParent, const std::string &sDir, const std::string &sFEContainerName, bool doNeutralFE)
Definition
FlowElement_LinkerPlots.cxx:14
PFO::FlowElement_LinkerPlots::m_NFE_tau_NMatchedTau
TH1 * m_NFE_tau_NMatchedTau
Definition
FlowElement_LinkerPlots.h:33
PFO::FlowElement_LinkerPlots::m_NFE_electron_dR
TH1 * m_NFE_electron_dR
Definition
FlowElement_LinkerPlots.h:52
PFO::FlowElement_LinkerPlots::m_NFE_muon_NMatchedMuon
TH1 * m_NFE_muon_NMatchedMuon
Definition
FlowElement_LinkerPlots.h:41
PFO::FlowElement_LinkerPlots::m_sFEContainerName
std::string m_sFEContainerName
Definition
FlowElement_LinkerPlots.h:56
PFO::FlowElement_LinkerPlots::m_NFE_photon_dR
TH1 * m_NFE_photon_dR
Definition
FlowElement_LinkerPlots.h:46
PFO::FlowElement_LinkerPlots::m_NFE_tau_dR
TH1 * m_NFE_tau_dR
Definition
FlowElement_LinkerPlots.h:32
PFO::FlowElement_LinkerPlots::m_CFE_tau_NMatchedTau
TH1 * m_CFE_tau_NMatchedTau
Definition
FlowElement_LinkerPlots.h:30
PFO::FlowElement_LinkerPlots::m_CFE_muon_dR
TH1 * m_CFE_muon_dR
Definition
FlowElement_LinkerPlots.h:35
PFO::FlowElement_LinkerPlots::m_NFE_photon_NMatchedPhoton
TH1 * m_NFE_photon_NMatchedPhoton
Definition
FlowElement_LinkerPlots.h:47
PFO::FlowElement_LinkerPlots::m_CFE_tau_dR
TH1 * m_CFE_tau_dR
Definition
FlowElement_LinkerPlots.h:29
PFO::FlowElement_LinkerPlots::initializePlots
void initializePlots()
Definition
FlowElement_LinkerPlots.cxx:21
PFO::FlowElement_LinkerPlots::m_CFE_electron_dR
TH1 * m_CFE_electron_dR
Definition
FlowElement_LinkerPlots.h:49
PFO::FlowElement_LinkerPlots::m_CFE_photon_dR
TH1 * m_CFE_photon_dR
Definition
FlowElement_LinkerPlots.h:43
PFO::FlowElement_LinkerPlots::m_CFE_electron_NMatchedElectron
TH1 * m_CFE_electron_NMatchedElectron
Definition
FlowElement_LinkerPlots.h:50
PFO::FlowElement_LinkerPlots::fill
void fill(const xAOD::FlowElement &FE, const xAOD::EventInfo &eventInfo)
Definition
FlowElement_LinkerPlots.cxx:65
PlotBase::Book1D
TH1D * Book1D(std::string_view name, std::string_view labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition
PlotBase.cxx:94
PlotBase::PlotBase
PlotBase(PlotBase *parent, std::string_view sDir)
Definition
PlotBase.cxx:29
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::EventInfo_v1::beamSpotWeight
float beamSpotWeight() const
Weight for beam spot size reweighting.
Definition
EventInfo_v1.cxx:970
xAOD::FlowElement_v1::p4
virtual FourMom_t p4() const override
The full 4-momentum of the particle.
Definition
FlowElement_v1.cxx:33
xAOD::TauJet_v3::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition
TauJet_v3.cxx:96
PFO
Definition
ClusterMomentPlots.h:15
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
xAOD::FlowElement
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition
FlowElement.h:16
xAOD::TauJet
TauJet_v3 TauJet
Definition of the current "tau version".
Definition
TauJet.h:17
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
type
Generated on
for ATLAS Offline Software by
1.17.0