Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
atlas
athena
Commits
98024ae5
Commit
98024ae5
authored
May 25, 2021
by
Christos Anastopoulos
Committed by
Adam Edward Barton
May 25, 2021
Browse files
eflowRec : Make it pass the static thread safety checker. Also some clang-tidy inspired fixes
parent
737ea621
Changes
35
Hide whitespace changes
Inline
Side-by-side
Reconstruction/eflowRec/eflowRec/ATLAS_CHECK_THREAD_SAFETY
0 → 100644
View file @
98024ae5
Reconstruction/eflowRec
Reconstruction/eflowRec/eflowRec/PFLeptonSelector.h
View file @
98024ae5
/*
Copyright (C) 2002-201
8
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
2
1 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PFLEPTONSELECTOR_H
#define PFLEPTONSELECTOR_H
...
...
@@ -31,13 +31,13 @@ public:
private:
/** Select electrons to use */
StatusCode
selectElectrons
(
SG
::
WriteHandle
<
ConstDataVector
<
xAOD
::
ElectronContainer
>>&
selectedElectronsWriteHandle
,
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
leptonCaloCellsWriteHandle
);
StatusCode
selectElectrons
(
SG
::
WriteHandle
<
ConstDataVector
<
xAOD
::
ElectronContainer
>>&
selectedElectronsWriteHandle
,
const
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
&
leptonCaloCellsWriteHandle
);
/** store the cells of the electrons */
void
storeElectronCells
(
const
xAOD
::
Egamma
&
electron
,
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
leptonCaloCellsWriteHandle
);
/** select muons to use */
StatusCode
selectMuons
(
SG
::
WriteHandle
<
ConstDataVector
<
xAOD
::
MuonContainer
>
>&
selectedMuonsWriteHandle
,
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
leptonCaloCellsWriteHandle
);
StatusCode
selectMuons
(
SG
::
WriteHandle
<
ConstDataVector
<
xAOD
::
MuonContainer
>
>&
selectedMuonsWriteHandle
,
const
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
&
leptonCaloCellsWriteHandle
);
/** store the cells of the muons */
void
storeMuonCells
(
const
xAOD
::
Muon
&
muon
,
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
leptonCaloCellsWriteHandle
);
...
...
Reconstruction/eflowRec/eflowRec/PFMatcher.h
View file @
98024ae5
...
...
@@ -21,7 +21,7 @@ class DistanceProvider;
namespace
PFMatch
{
typedef
std
::
pair
<
const
ICluster
*
,
double
>
MatchDistance
;
typedef
std
::
pair
<
ICluster
*
,
double
>
MatchDistance
;
/**
Checks if a cluster should be matched to a track or not, and has methods to return list of best matches.
...
...
@@ -36,9 +36,14 @@ public:
MatchDistance
match
(
ITrack
*
track
,
ICluster
*
cluster
)
const
;
template
<
class
ClusterType
>
MatchDistance
bestMatchDRparametrized
(
ITrack
*
track
,
const
std
::
vector
<
ClusterType
*>&
clusters
)
const
;
MatchDistance
bestMatchDRparametrized
(
ITrack
*
track
,
const
std
::
vector
<
ClusterType
*>&
clusters
)
const
;
template
<
class
ClusterType
>
std
::
vector
<
MatchDistance
>
bestMatches
(
ITrack
*
track
,
std
::
vector
<
ClusterType
*>&
clusters
,
int
nMatches
,
double
energyThreshold
)
const
;
std
::
vector
<
MatchDistance
>
bestMatches
(
ITrack
*
track
,
std
::
vector
<
ClusterType
*>&
clusters
,
int
nMatches
,
double
energyThreshold
)
const
;
template
<
class
ClusterType
>
double
getDRCutSquared
(
ClusterType
*
theCluster
)
const
;
...
...
Reconstruction/eflowRec/eflowRec/PFTrackClusterMatchingTool.h
View file @
98024ae5
/*
Copyright (C) 2002-202
0
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-202
1
CERN for the benefit of the ATLAS collaboration
*/
/*
...
...
@@ -39,8 +39,14 @@ public:
StatusCode
finalize
();
/** Get n clusters that matches best to a given track */
std
::
vector
<
std
::
pair
<
eflowRecCluster
*
,
float
>
>
doMatches
(
const
eflowRecTrack
*
track
,
eflowRecClusterContainer
*
clusters
,
int
n
)
const
;
std
::
vector
<
std
::
pair
<
eflowRecCluster
*
,
float
>
>
doMatches
(
const
eflowRecTrack
*
track
,
const
std
::
vector
<
eflowRecCluster
*>
clusters
,
int
n
)
const
;
std
::
vector
<
std
::
pair
<
eflowRecCluster
*
,
float
>>
doMatches
(
const
eflowRecTrack
*
track
,
eflowRecClusterContainer
*
clusters
,
int
n
)
const
;
std
::
vector
<
std
::
pair
<
eflowRecCluster
*
,
float
>>
doMatches
(
const
eflowRecTrack
*
track
,
std
::
vector
<
eflowRecCluster
*>&
clusters
,
int
n
)
const
;
private:
...
...
Reconstruction/eflowRec/eflowRec/eflowCaloObject.h
View file @
98024ae5
/*
Copyright (C) 2002-201
8
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
2
1 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EFLOWEVENT_EFLOWCALOOBJECT_H
...
...
@@ -75,9 +75,9 @@ public:
void
clearLinks
()
{
m_trackClusterLinks
.
clear
();
}
/* Calculate total tracks energy, total tracks energy variance, total cluster energy for subtraction */
double
getExpectedEnergy
();
double
getExpectedVariance
();
double
getClusterEnergy
()
;
double
getExpectedEnergy
()
const
;
double
getExpectedVariance
()
const
;
double
getClusterEnergy
()
const
;
void
simulateShower
(
eflowLayerIntegrator
*
integrator
,
eflowEEtaBinnedParameters
*
binnedParameters
,
bool
useUpdated2015ChargedShowerSubtraction
);
...
...
Reconstruction/eflowRec/eflowRec/eflowCaloObjectMaker.h
View file @
98024ae5
/*
Copyright (C) 2002-202
0
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-202
1
CERN for the benefit of the ATLAS collaboration
*/
/*
...
...
@@ -34,9 +34,9 @@ public:
private:
std
::
vector
<
eflowRecCluster
*>
uniqCluster
(
const
std
::
vector
<
eflowRecTrack
*>
trackForNextLoop
,
const
std
::
vector
<
eflowRecCluster
*>
clusterList
);
std
::
vector
<
eflowRecTrack
*>
uniqTrack
(
const
std
::
vector
<
eflowRecCluster
*>
clusterForNextLoop
,
const
std
::
vector
<
eflowRecTrack
*>
trackList
);
void
updateTracksToConsider
(
std
::
vector
<
eflowRecTrack
*>&
total
,
const
std
::
vector
<
eflowRecTrack
*>
part
);
std
::
vector
<
eflowRecCluster
*>
uniqCluster
(
const
std
::
vector
<
eflowRecTrack
*>
&
trackForNextLoop
,
const
std
::
vector
<
eflowRecCluster
*>
&
clusterList
);
std
::
vector
<
eflowRecTrack
*>
uniqTrack
(
const
std
::
vector
<
eflowRecCluster
*>
&
clusterForNextLoop
,
const
std
::
vector
<
eflowRecTrack
*>
&
trackList
);
void
updateTracksToConsider
(
std
::
vector
<
eflowRecTrack
*>&
total
,
const
std
::
vector
<
eflowRecTrack
*>
&
part
);
};
...
...
Reconstruction/eflowRec/eflowRec/eflowCellSubtractionFacilitator.h
View file @
98024ae5
/*
Copyright (C) 2002-201
7
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
2
1 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EFLOWCELLSUBTRACTIONFACILITATOR_H
...
...
@@ -54,17 +54,18 @@ public:
private:
bool
m_annFlag
;
CaloClusterCellLink
::
iterator
getCellIterator
(
const
xAOD
::
CaloCluster
*
thisCluster
,
xAOD
::
CaloCluster
*
thisCluster
,
const
CaloCell
*
thisCell
);
void
updateClusterKinematics
(
std
::
vector
<
std
::
pair
<
xAOD
::
CaloCluster
*
,
bool
>>&
tracksClusters
);
void
updateClusterKinematics
(
xAOD
::
CaloCluster
*
);
double
getTotalEnergy
(
std
::
vector
<
std
::
pair
<
xAOD
::
CaloCluster
*
,
bool
>>
tracksClusters
);
const
std
::
vector
<
std
::
pair
<
xAOD
::
CaloCluster
*
,
bool
>>
&
tracksClusters
);
double
getRingsEnergy
(
const
std
::
vector
<
std
::
pair
<
xAOD
::
CaloCluster
*
,
bool
>>&
tracksClusters
,
std
::
vector
<
std
::
pair
<
xAOD
::
CaloCluster
*
,
bool
>>&
tracksClusters
,
CellIt
beginRing
,
CellIt
endRing
);
...
...
Reconstruction/eflowRec/eflowRec/eflowDepthCalculator.h
View file @
98024ae5
/*
Copyright (C) 2002-201
7
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
2
1 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EFLOWDEPTHCALCULATOR_H
...
...
@@ -101,7 +101,7 @@ class eflowDepthCalculator {
static
const
int
m_nDepth
=
FCAL2
;
//Tile_back; // number of region bounds
static
const
DEPTHLAYER
m_layerDepthMap
[
eflowCalo
::
nRegions
];
double
m_layerDepth
[
m_nDepth
+
1
];
double
m_layerDepth
[
m_nDepth
+
1
]
{}
;
};
...
...
Reconstruction/eflowRec/eflowRec/eflowLayerIntegrator.h
View file @
98024ae5
...
...
@@ -67,7 +67,7 @@ class eflowLayerIntegrator {
eflowDepthCalculator
m_caloModel
;
double
m_densityConversion
[
eflowCalo
::
nRegions
];
double
m_densityConversion
[
eflowCalo
::
nRegions
]
{}
;
std
::
vector
<
double
>
m_nUnitCellPerWindowOverCellEtaPhiArea
;
...
...
Reconstruction/eflowRec/eflowRec/eflowRecCluster.h
View file @
98024ae5
...
...
@@ -155,7 +155,8 @@ public:
}
virtual
~
eflowMatchCluster
()
{}
eflowRecCluster
*
getEfRecCluster
()
const
{
return
m_efRecCluster
;
}
eflowRecCluster
*
getEfRecCluster
()
{
return
m_efRecCluster
;
}
const
eflowRecCluster
*
getEfRecCluster
()
const
{
return
m_efRecCluster
;
}
virtual
double
e
()
const
{
return
m_clusterEne
;
}
virtual
double
eta
()
const
{
return
m_clusterEta
;
}
...
...
Reconstruction/eflowRec/eflowRec/eflowRecTrack.h
View file @
98024ae5
/*
Copyright (C) 2002-201
8
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
2
1 CERN for the benefit of the ATLAS collaboration
*/
/*
...
...
@@ -65,7 +65,7 @@ public:
const
std
::
vector
<
eflowTrackClusterLink
*>&
getClusterMatches
()
const
{
return
m_clusterMatches
;
}
void
clearClusterMatches
()
{
m_clusterMatches
.
clear
();
}
const
std
::
vector
<
eflowTrackClusterLink
*>*
getAlternativeClusterMatches
(
std
::
string
key
)
const
;
// { return m_alternativeClusterMatches.at(key); }
const
std
::
vector
<
eflowTrackClusterLink
*>*
getAlternativeClusterMatches
(
const
std
::
string
&
key
)
const
;
// { return m_alternativeClusterMatches.at(key); }
bool
hasBin
()
const
{
return
m_hasBin
;
}
void
setHasBin
(
bool
hasBin
)
{
m_hasBin
=
hasBin
;
}
...
...
@@ -124,7 +124,7 @@ private:
int
m_type
;
double
m_pull15
;
int
m_layerHED
;
int
m_layerHED
{}
;
std
::
vector
<
int
>
m_layerCellOrderVector
;
std
::
vector
<
float
>
m_radiusCellOrderVector
;
std
::
vector
<
float
>
m_avgEdensityCellOrderVector
;
...
...
@@ -144,7 +144,7 @@ private:
std
::
map
<
std
::
string
,
std
::
vector
<
eflowTrackClusterLink
*>
>
m_alternativeClusterMatches
;
ISvcLocator
*
m_svcLoc
;
IMessageSvc
*
m_msgSvc
;
IMessageSvc
*
m_msgSvc
{}
;
std
::
unique_ptr
<
MsgStream
>
m_mlog
;
public:
...
...
Reconstruction/eflowRec/src/EtaPhiLUT.cxx
View file @
98024ae5
/*
Copyright (C) 2002-202
0
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-202
1
CERN for the benefit of the ATLAS collaboration
*/
#include <cmath>
...
...
@@ -50,10 +50,10 @@ namespace eflowRec {
// Extract index ranges to iterate over
std
::
vector
<
std
::
pair
<
int
,
int
>
>
iPhiRanges
;
if
(
iPhiMin
<
iPhiMax
)
{
iPhiRanges
.
push_back
(
std
::
make_pair
(
iPhiMin
,
iPhiMax
)
);
iPhiRanges
.
emplace_back
(
iPhiMin
,
iPhiMax
);
}
else
{
// special treatment for phi-wrapping
iPhiRanges
.
push_back
(
std
::
make_pair
(
0
,
iPhiMax
)
);
iPhiRanges
.
push_back
(
std
::
make_pair
(
iPhiMin
,
m_nphiBins
-
1
)
);
iPhiRanges
.
emplace_back
(
0
,
iPhiMax
);
iPhiRanges
.
emplace_back
(
iPhiMin
,
m_nphiBins
-
1
);
}
float
dr2Cut
=
dr
*
dr
;
...
...
Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx
View file @
98024ae5
...
...
@@ -205,16 +205,15 @@ void PFCellLevelSubtractionTool::calculateRadialEnergyProfiles(eflowData& data)
std
::
vector
<
eflowRecCluster
*>
matchedClusters
;
matchedClusters
.
clear
();
std
::
vector
<
eflowTrackClusterLink
*>
links
=
efRecTrack
->
getClusterMatches
();
for
(
auto
thisEFlowTrackClusterLink
:
links
)
matchedClusters
.
push_back
(
thisEFlowTrackClusterLink
->
getCluster
());
for
(
auto
*
thisEFlowTrackClusterLink
:
links
)
matchedClusters
.
push_back
(
thisEFlowTrackClusterLink
->
getCluster
());
std
::
vector
<
std
::
pair
<
xAOD
::
CaloCluster
*
,
bool
>
>
clusterSubtractionList
;
for
(
auto
thisEFlowRecCluster
:
matchedClusters
)
clusterSubtractionList
.
push_back
(
std
::
pair
(
thisEFlowRecCluster
->
getCluster
(),
false
));
clusterSubtractionList
.
reserve
(
matchedClusters
.
size
());
for
(
auto
*
thisEFlowRecCluster
:
matchedClusters
)
clusterSubtractionList
.
emplace_back
(
thisEFlowRecCluster
->
getCluster
(),
false
);
eflowCellList
calorimeterCellList
;
Subtractor
::
makeOrderedCellList
(
efRecTrack
->
getTrackCaloPoints
(),
clusterSubtractionList
,
calorimeterCellList
);
eflowRingThicknesses
ringThicknessGenerator
;
std
::
vector
<
int
>
layerToStoreVector
;
std
::
vector
<
float
>
radiusToStoreVector
;
std
::
vector
<
float
>
avgEdensityToStoreVector
;
...
...
@@ -223,7 +222,7 @@ void PFCellLevelSubtractionTool::calculateRadialEnergyProfiles(eflowData& data)
eflowCaloENUM
layer
=
(
eflowCaloENUM
)
i
;
ATH_MSG_DEBUG
(
"layer is "
<<
layer
);
double
ringThickness
=
r
ingThickness
Generator
.
ringThickness
((
eflowCaloENUM
)
i
);
double
ringThickness
=
eflowR
ingThickness
es
::
ringThickness
((
eflowCaloENUM
)
i
);
ATH_MSG_DEBUG
(
"ring thickness is "
<<
ringThickness
);
double
eta_extr
=
calorimeterCellList
.
etaFF
(
layer
);
...
...
@@ -376,7 +375,7 @@ void PFCellLevelSubtractionTool::performSubtraction(eflowData& data) const {
std
::
vector
<
std
::
pair
<
xAOD
::
CaloCluster
*
,
bool
>
>
clusterList
;
unsigned
nCluster
=
thisEflowCaloObject
->
nClusters
();
for
(
unsigned
iCluster
=
0
;
iCluster
<
nCluster
;
++
iCluster
)
clusterList
.
push_back
(
std
::
pair
(
thisEflowCaloObject
->
efRecCluster
(
iCluster
)
->
getCluster
(),
false
)
)
;
for
(
unsigned
iCluster
=
0
;
iCluster
<
nCluster
;
++
iCluster
)
clusterList
.
emplace_back
(
thisEflowCaloObject
->
efRecCluster
(
iCluster
)
->
getCluster
(),
false
);
Subtractor
::
annihilateClusters
(
clusterList
);
...
...
@@ -404,15 +403,15 @@ void PFCellLevelSubtractionTool::performSubtraction(eflowData& data) const {
std
::
vector
<
eflowRecCluster
*>
matchedClusters
;
matchedClusters
.
clear
();
std
::
vector
<
eflowTrackClusterLink
*>
links
=
efRecTrack
->
getClusterMatches
();
for
(
auto
thisEFlowTrackClusterLink
:
links
)
matchedClusters
.
push_back
(
thisEFlowTrackClusterLink
->
getCluster
());
for
(
auto
*
thisEFlowTrackClusterLink
:
links
)
matchedClusters
.
push_back
(
thisEFlowTrackClusterLink
->
getCluster
());
ATH_MSG_DEBUG
(
"Have filled matchedClusters list for this eflowCaloObject"
);
std
::
vector
<
std
::
pair
<
xAOD
::
CaloCluster
*
,
bool
>
>
clusterSubtractionList
;
std
::
map
<
xAOD
::
CaloCluster
*
,
double
>
clusterEnergyMap
;
for
(
auto
thisEFlowRecCluster
:
matchedClusters
)
{
for
(
auto
*
thisEFlowRecCluster
:
matchedClusters
)
{
xAOD
::
CaloCluster
*
thisCluster
=
thisEFlowRecCluster
->
getCluster
();
clusterSubtractionList
.
push_back
(
std
::
pair
(
thisCluster
,
false
)
)
;
clusterSubtractionList
.
emplace_back
(
thisCluster
,
false
);
clusterEnergyMap
[
thisCluster
]
=
thisCluster
->
e
();
}
...
...
Reconstruction/eflowRec/src/PFChargedFlowElementCreatorAlgorithm.cxx
View file @
98024ae5
...
...
@@ -29,7 +29,7 @@ StatusCode PFChargedFlowElementCreatorAlgorithm::execute(const EventContext& ctx
/* Create Charged FlowElements from all eflowCaloObjects */
SG
::
ReadHandle
<
eflowCaloObjectContainer
>
eflowCaloObjectContainerReadHandle
(
m_eflowCaloObjectContainerReadHandleKey
,
ctx
);
for
(
const
auto
thisEflowCaloObject
:
*
eflowCaloObjectContainerReadHandle
)
createChargedFlowElements
(
*
thisEflowCaloObject
,
true
,
chargedFlowElementContainerWriteHandle
);
for
(
const
auto
*
const
thisEflowCaloObject
:
*
eflowCaloObjectContainerReadHandle
)
createChargedFlowElements
(
*
thisEflowCaloObject
,
true
,
chargedFlowElementContainerWriteHandle
);
std
::
sort
(
chargedFlowElementContainerWriteHandle
->
begin
(),
chargedFlowElementContainerWriteHandle
->
end
(),
[]
(
const
xAOD
::
FlowElement
*
flowElement1
,
const
xAOD
::
FlowElement
*
flowElement2
)
{
return
flowElement1
->
pt
()
>
flowElement2
->
pt
();});
...
...
@@ -128,8 +128,8 @@ void PFChargedFlowElementCreatorAlgorithm::createChargedFlowElements(const eflow
eflowRecCluster
*
efRecCluster
=
trackClusterLinkPair
.
first
->
getCluster
();
ElementLink
<
xAOD
::
CaloClusterContainer
>
theOriginalClusterLink
=
efRecCluster
->
getOriginalClusElementLink
();
ElementLink
<
xAOD
::
CaloClusterContainer
>
theSisterClusterLink
=
(
*
theOriginalClusterLink
)
->
getSisterClusterLink
();
if
(
theSisterClusterLink
.
isValid
())
vectorClusterToSubtractedEnergies
.
push
_back
(
std
::
pair
(
theSisterClusterLink
,
trackClusterLinkPair
.
second
));
else
vectorClusterToSubtractedEnergies
.
push
_back
(
std
::
pair
(
theOriginalClusterLink
,
trackClusterLinkPair
.
second
));
if
(
theSisterClusterLink
.
isValid
())
vectorClusterToSubtractedEnergies
.
emplace
_back
(
std
::
pair
(
theSisterClusterLink
,
trackClusterLinkPair
.
second
));
else
vectorClusterToSubtractedEnergies
.
emplace
_back
(
std
::
pair
(
theOriginalClusterLink
,
trackClusterLinkPair
.
second
));
}
else
if
(
m_eOverPMode
&&
trackClusterLinkPair
.
first
==
trackClusterLink
)
thisTracks_trackClusterLinksSubtracted
.
push_back
(
trackClusterLink
);
}
...
...
Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx
View file @
98024ae5
/*
Copyright (C) 2002-201
7
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
2
1 CERN for the benefit of the ATLAS collaboration
*/
#include "eflowRec/PFClusterCollectionTool.h"
...
...
@@ -19,7 +19,7 @@ std::unique_ptr<eflowRecClusterContainer> PFClusterCollectionTool::retrieve(cons
std
::
unique_ptr
<
eflowRecClusterContainer
>
result
=
std
::
make_unique
<
eflowRecClusterContainer
>
();
/* Loop over all eflowCaloObjects */
for
(
auto
thisEflowCaloObject
:
theEflowCaloObjectContainer
){
for
(
const
auto
*
thisEflowCaloObject
:
theEflowCaloObjectContainer
){
/* Add all clusters on the eflowCaloObject to the container */
unsigned
int
nClusters
=
thisEflowCaloObject
->
nClusters
();
...
...
@@ -43,7 +43,7 @@ std::unique_ptr<xAOD::CaloClusterContainer> PFClusterCollectionTool::execute(con
std
::
unique_ptr
<
xAOD
::
CaloClusterContainer
>
result
=
std
::
make_unique
<
xAOD
::
CaloClusterContainer
>
(
SG
::
VIEW_ELEMENTS
);
/* Loop over all eflowCaloObjects */
for
(
auto
thisEflowCaloObject
:
theEflowCaloObjectContainer
){
for
(
const
auto
*
thisEflowCaloObject
:
theEflowCaloObjectContainer
){
/* Add all clusters on the eflowCaloObject to the container */
unsigned
int
nClusters
=
thisEflowCaloObject
->
nClusters
();
...
...
Reconstruction/eflowRec/src/PFEGamFlowElementAssoc.cxx
View file @
98024ae5
/*
Copyright (C) 2002-202
0
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-202
1
CERN for the benefit of the ATLAS collaboration
*/
#include "StoreGate/WriteDecorHandle.h"
...
...
@@ -18,8 +18,8 @@
typedef
ElementLink
<
xAOD
::
ElectronContainer
>
ElectronLink_t
;
typedef
ElementLink
<
xAOD
::
PhotonContainer
>
PhotonLink_t
;
typedef
ElementLink
<
xAOD
::
FlowElementContainer
>
FlowElementLink_t
;
using
PhotonLink_t
=
ElementLink
<
xAOD
::
PhotonContainer
>
;
using
FlowElementLink_t
=
ElementLink
<
xAOD
::
FlowElementContainer
>
;
PFEGamFlowElementAssoc
::
PFEGamFlowElementAssoc
(
const
std
::
string
&
name
,
...
...
@@ -141,7 +141,7 @@ StatusCode PFEGamFlowElementAssoc::execute(const EventContext &ctx) const
size_t
electronClusterIndex
=
cluster
->
index
();
//match the indices: Cluster match between Flow Element (FE) and electron
if
(
electronClusterIndex
==
FEClusterIndex
){
FEElectronLinks
.
push_back
(
ElectronLink_t
(
*
electronReadHandle
,
electron
->
index
()
)
);
FEElectronLinks
.
emplace_back
(
*
electronReadHandle
,
electron
->
index
()
);
//Add Flow Element (FE) link to a vector
//index() is the unique index of the Flow Element in the container
electronNeutralFEVec
.
at
(
electron
->
index
()).
push_back
(
FlowElementLink_t
(
*
neutralFEReadHandle
,
FE
->
index
())
);
...
...
@@ -166,7 +166,7 @@ StatusCode PFEGamFlowElementAssoc::execute(const EventContext &ctx) const
//do the matching
if
(
photonClusterIndex
==
FEClusterIndex
){
// Add flow element (FE) links to photon
FEPhotonLinks
.
push_back
(
PhotonLink_t
(
*
photonReadHandle
,
photon
->
index
()
)
);
FEPhotonLinks
.
emplace_back
(
*
photonReadHandle
,
photon
->
index
()
);
//Add Flow Element (FE) link to a vector
//index() is the unique index of the Flow Element in the container
photonNeutralFEVec
.
at
(
photon
->
index
()).
push_back
(
FlowElementLink_t
(
*
neutralFEReadHandle
,
FE
->
index
())
);
...
...
@@ -209,7 +209,7 @@ StatusCode PFEGamFlowElementAssoc::execute(const EventContext &ctx) const
if
(
electronTrackIndex
==
FETrackIndex
){
// Add electron element link to a vector
// index() is the unique index of the electron in the electron container
FEElectronLinks
.
push_back
(
ElectronLink_t
(
*
electronReadHandle
,
electron
->
index
()
)
);
FEElectronLinks
.
emplace_back
(
*
electronReadHandle
,
electron
->
index
()
);
// Add FE element link to a vector
// index() is the unique index of the cFE in the cFE container
electronChargedFEVec
.
at
(
electron
->
index
()).
push_back
(
FlowElementLink_t
(
*
chargedFEReadHandle
,
FE
->
index
())
);
...
...
@@ -230,7 +230,7 @@ StatusCode PFEGamFlowElementAssoc::execute(const EventContext &ctx) const
if
(
photonTrackIndex
==
FETrackIndex
){
// Add photon element link to a vector
// index() is the unique index of the photon in the photon container
FEPhotonLinks
.
push_back
(
PhotonLink_t
(
*
photonReadHandle
,
photon
->
index
()
)
);
FEPhotonLinks
.
emplace_back
(
*
photonReadHandle
,
photon
->
index
()
);
// Add FE element link to a vector
// index() is the unique index of the cFE in the cFE container
photonChargedFEVec
.
at
(
photon
->
index
()).
push_back
(
FlowElementLink_t
(
*
chargedFEReadHandle
,
FE
->
index
())
);
...
...
Reconstruction/eflowRec/src/PFEGammaPFOAssoc.cxx
View file @
98024ae5
/*
Copyright (C) 2002-201
9
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
2
1 CERN for the benefit of the ATLAS collaboration
*/
#include "eflowRec/PFEGammaPFOAssoc.h"
...
...
@@ -14,8 +14,8 @@
#include "xAODPFlow/PFO.h"
typedef
ElementLink
<
xAOD
::
ElectronContainer
>
ElectronLink_t
;
typedef
ElementLink
<
xAOD
::
PhotonContainer
>
PhotonLink_t
;
typedef
ElementLink
<
xAOD
::
PFOContainer
>
PFOLink_t
;
using
PhotonLink_t
=
ElementLink
<
xAOD
::
PhotonContainer
>
;
using
PFOLink_t
=
ElementLink
<
xAOD
::
PFOContainer
>
;
// =============================================================
PFEGammaPFOAssoc
::
PFEGammaPFOAssoc
(
const
std
::
string
&
name
,
...
...
@@ -115,7 +115,7 @@ StatusCode PFEGammaPFOAssoc::execute() {
if
(
electronClusterIndex
==
pfoClusterIndex
)
{
// Add electron element link to a vector
// index() is the unique index of the electron in the electron container
pfoElectronLinks
.
push_back
(
ElectronLink_t
(
*
electronReadHandle
,
electron
->
index
()
)
);
pfoElectronLinks
.
emplace_back
(
*
electronReadHandle
,
electron
->
index
()
);
// Add pfo element link to a vector
// index() is the unique index of the nPFO in the nPFO container
electronNeutralPFOVec
.
at
(
electron
->
index
()).
push_back
(
PFOLink_t
(
*
neutralpfoReadHandle
,
pfo
->
index
())
);
...
...
@@ -136,7 +136,7 @@ StatusCode PFEGammaPFOAssoc::execute() {
if
(
photonClusterIndex
==
pfoClusterIndex
)
{
// Add photon element link to a vector
// index() is the unique index of the nPFO in the nPFO container
pfoPhotonLinks
.
push_back
(
PhotonLink_t
(
*
photonReadHandle
,
photon
->
index
()
)
);
pfoPhotonLinks
.
emplace_back
(
*
photonReadHandle
,
photon
->
index
()
);
// Add pfo element link to a vector
// index() is the unique index of the nPFO in the nPFO container
photonNeutralPFOVec
.
at
(
photon
->
index
()).
push_back
(
PFOLink_t
(
*
neutralpfoReadHandle
,
pfo
->
index
())
);
...
...
@@ -174,7 +174,7 @@ StatusCode PFEGammaPFOAssoc::execute() {
if
(
electronTrackIndex
==
pfoTrackIndex
)
{
// Add electron element link to a vector
// index() is the unique index of the electron in the electron container
pfoElectronLinks
.
push_back
(
ElectronLink_t
(
*
electronReadHandle
,
electron
->
index
()
)
);
pfoElectronLinks
.
emplace_back
(
*
electronReadHandle
,
electron
->
index
()
);
// Add pfo element link to a vector
// index() is the unique index of the cPFO in the cPFO container
electronChargedPFOVec
.
at
(
electron
->
index
()).
push_back
(
PFOLink_t
(
*
chargedpfoReadHandle
,
pfo
->
index
())
);
...
...
@@ -195,7 +195,7 @@ StatusCode PFEGammaPFOAssoc::execute() {
if
(
photonTrackIndex
==
pfoTrackIndex
)
{
// Add photon element link to a vector
// index() is the unique index of the photon in the photon container
pfoPhotonLinks
.
push_back
(
PhotonLink_t
(
*
photonReadHandle
,
photon
->
index
()
)
);
pfoPhotonLinks
.
emplace_back
(
*
photonReadHandle
,
photon
->
index
()
);
// Add pfo element link to a vector
// index() is the unique index of the cPFO in the cPFO container
photonChargedPFOVec
.
at
(
photon
->
index
()).
push_back
(
PFOLink_t
(
*
chargedpfoReadHandle
,
pfo
->
index
())
);
...
...
Reconstruction/eflowRec/src/PFLeptonSelector.cxx
View file @
98024ae5
/*
Copyright (C) 2002-201
8
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
2
1 CERN for the benefit of the ATLAS collaboration
*/
#include <utility>
#include "eflowRec/PFLeptonSelector.h"
PFLeptonSelector
::
PFLeptonSelector
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
)
:
...
...
@@ -49,7 +53,7 @@ StatusCode PFLeptonSelector::execute(){
StatusCode
PFLeptonSelector
::
finalize
(){
return
StatusCode
::
SUCCESS
;
}
StatusCode
PFLeptonSelector
::
selectElectrons
(
SG
::
WriteHandle
<
ConstDataVector
<
xAOD
::
ElectronContainer
>>&
selectedElectronsWriteHandle
,
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
leptonCaloCellsWriteHandle
){
StatusCode
PFLeptonSelector
::
selectElectrons
(
SG
::
WriteHandle
<
ConstDataVector
<
xAOD
::
ElectronContainer
>>&
selectedElectronsWriteHandle
,
const
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
&
leptonCaloCellsWriteHandle
){
SG
::
ReadHandle
<
xAOD
::
ElectronContainer
>
electronsReadHandle
(
m_electronsReadHandleKey
);
...
...
@@ -58,7 +62,7 @@ StatusCode PFLeptonSelector::selectElectrons(SG::WriteHandle<ConstDataVector<xAO
return
StatusCode
::
FAILURE
;
}
for
(
auto
theElectron
:
*
electronsReadHandle
){
for
(
const
auto
*
theElectron
:
*
electronsReadHandle
){
if
(
theElectron
){
if
(
theElectron
->
pt
()
>
10000
){
...
...
@@ -68,7 +72,7 @@ StatusCode PFLeptonSelector::selectElectrons(SG::WriteHandle<ConstDataVector<xAO
ATH_MSG_WARNING
(
"Could not get Electron ID"
);
continue
;
}
if
(
true
==
passElectronID
){
if
(
passElectronID
){
if
(
selectedElectronsWriteHandle
.
isValid
())
selectedElectronsWriteHandle
->
push_back
(
theElectron
);
else
ATH_MSG_WARNING
(
"Do not have valid WriteHandle for ElectronContainer with name: "
<<
selectedElectronsWriteHandle
.
key
());
if
(
true
==
m_storeLeptonCells
)
this
->
storeElectronCells
(
*
theElectron
,
leptonCaloCellsWriteHandle
);
...
...
@@ -86,13 +90,13 @@ void PFLeptonSelector::storeElectronCells(const xAOD::Egamma& electron, SG::Writ
const
xAOD
::
CaloCluster
*
electronCluster
=
electron
.
caloCluster
();
if
(
electronCluster
){
this
->
storeLeptonCells
(
*
electronCluster
,
leptonCaloCellsWriteHandle
);
this
->
storeLeptonCells
(
*
electronCluster
,
std
::
move
(
leptonCaloCellsWriteHandle
)
)
;
}
else
ATH_MSG_WARNING
(
"This electron has an invalid pointer to its cluster"
);
}
StatusCode
PFLeptonSelector
::
selectMuons
(
SG
::
WriteHandle
<
ConstDataVector
<
xAOD
::
MuonContainer
>
>&
selectedMuonsWriteHandle
,
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
leptonCaloCellsWriteHandle
)
{
StatusCode
PFLeptonSelector
::
selectMuons
(
SG
::
WriteHandle
<
ConstDataVector
<
xAOD
::
MuonContainer
>
>&
selectedMuonsWriteHandle
,
const
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
&
leptonCaloCellsWriteHandle
)
{
SG
::
ReadHandle
<
xAOD
::
MuonContainer
>
muonsReadHandle
(
m_muonsReadHandleKey
);
...
...
@@ -101,7 +105,7 @@ StatusCode PFLeptonSelector::selectMuons(SG::WriteHandle<ConstDataVector<xAOD::M
return
StatusCode
::
FAILURE
;
}
for
(
auto
theMuon
:
*
muonsReadHandle
){
for
(
const
auto
*
theMuon
:
*
muonsReadHandle
){
//Details of medium muons are here:
//https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionTool
...
...
@@ -123,11 +127,11 @@ StatusCode PFLeptonSelector::selectMuons(SG::WriteHandle<ConstDataVector<xAOD::M
void
PFLeptonSelector
::
storeMuonCells
(
const
xAOD
::
Muon
&
muon
,
SG
::
WriteHandle
<
ConstDataVector
<
CaloCellContainer
>
>
leptonCaloCellsWriteHandle
){
const
ElementLink
<
xAOD
::
CaloClusterContainer
>
theLink
=
muon
.
clusterLink
();
const
ElementLink
<
xAOD
::
CaloClusterContainer
>
&
theLink
=
muon
.
clusterLink
();
if
(
theLink
.
isValid
()){
const
xAOD
::
CaloCluster
*
muonCluster
=
*
theLink
;
if
(
muonCluster
){
this
->
storeLeptonCells
(
*
muonCluster
,
leptonCaloCellsWriteHandle
);
this
->
storeLeptonCells
(
*
muonCluster
,
std
::
move
(
leptonCaloCellsWriteHandle
)
)
;
}
else
ATH_MSG_WARNING
(
"This muon has an invalid pointer to its cluster "
);
}
...
...
@@ -140,7 +144,7 @@ void PFLeptonSelector::storeLeptonCells(const xAOD::CaloCluster& theCluster, SG:
const
CaloClusterCellLink
*
theCellLink
=
theCluster
.
getCellLinks
();
if
(
theCellLink
){
for
(
auto
theCaloCell
:
*
theCellLink
){
for
(
const
auto
*
theCaloCell
:
*
theCellLink
){
if
(
leptonCaloCellsWriteHandle
.
isValid
())
leptonCaloCellsWriteHandle
->
push_back
(
theCaloCell
);
else
ATH_MSG_WARNING
(
" Do not have valid WriteHandle for CaloCellContaienr with name: "
<<
leptonCaloCellsWriteHandle
.
key
());
}
//cell loop
...
...
Reconstruction/eflowRec/src/PFMuonFlowElementAssoc.cxx
View file @
98024ae5
/*
Copyright (C) 2002-202
0
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-202
1
CERN for the benefit of the ATLAS collaboration
*/
#include "eflowRec/PFMuonFlowElementAssoc.h"
...
...
@@ -15,7 +15,7 @@
#include "Identifier/Identifier.h"
typedef
ElementLink
<
xAOD
::
MuonContainer
>
MuonLink_t
;
typedef
ElementLink
<
xAOD
::
FlowElementContainer
>
FlowElementLink_t
;
using
FlowElementLink_t
=
ElementLink
<
xAOD
::
FlowElementContainer
>
;
//
// Algorithm created by M.T. Anthony
//
...
...
@@ -127,7 +127,7 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const
if
(
MuonTrkIndex
==
FETrackIndex
){
// Add Muon element link to a vector
// index() is the unique index of the muon in the muon container
FEMuonLinks
.
push_back
(
MuonLink_t
(
*
muonReadHandle
,
muon
->
index
())
)
;
FEMuonLinks
.
emplace_back
(
*
muonReadHandle
,
muon
->
index
());
// Add flow element link to a vector
// index() is the unique index of the cFlowElement in the cFlowElementcontaine
muonChargedFEVec
.
at
(
muon
->
index
()).
push_back
(
FlowElementLink_t
(
*
ChargedFEReadHandle
,
FE
->
index
()));
...
...
@@ -183,7 +183,7 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const
std
::
vector
<
double
>
Muon_efrac_clustermatch
;
for
(
const
xAOD
::
Muon
*
muon
:
*
muonNeutralFEWriteDecorHandle
){
//Retrieve the ElementLink vector of clusters
const
ElementLink
<
xAOD
::
CaloClusterContainer
>
ClusterLink
=
muon
->
clusterLink
();
const
ElementLink
<
xAOD
::
CaloClusterContainer
>
&
ClusterLink
=
muon
->
clusterLink
();
//check if the ElementLink is valid
if
(
!
ClusterLink
.
isValid
()){
ATH_MSG_DEBUG
(
"Muon has an invalid link to cluster"
);
...
...
@@ -194,7 +194,7 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const
if
(
m_UseMuonTopoClusters
){
// get the linker to the topo clusters
std
::
vector
<
ElementLink
<
xAOD
::
CaloClusterContainer
>>
linksToTopoClusters
=
cluster
->
auxdata
<
std
::
vector
<
ElementLink
<
xAOD
::
CaloClusterContainer
>>
>
(
"constituentClusterLinks"
);
for
(
ElementLink
<
xAOD
::
CaloClusterContainer
>
TopoClusterLink
:
linksToTopoClusters
){
for
(
const
ElementLink
<
xAOD
::
CaloClusterContainer
>
&
TopoClusterLink
:
linksToTopoClusters
){
if
(
!
TopoClusterLink
.
isValid
()){
ATH_MSG_WARNING
(
"Muon Calo cluster's TopoCluster link not found, skip"
);
continue
;
...
...
@@ -204,7 +204,7 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const
if
(
MuonTopoCluster_index
==
FEclusterindex
){
// Add Muon element link to a vector
// index() is the unique index of the muon in the muon container
FEMuonLinks
.
push_back
(
MuonLink_t
(
*
muonReadHandle
,
muon
->
index
())
)
;
FEMuonLinks
.
emplace_back
(
*
muonReadHandle
,
muon
->
index
());
// index() is the unique index of the cFlowElement in the cFlowElementcontaine
muonNeutralFEVec
.
at
(
muon
->
index
()).
push_back
(
FlowElementLink_t
(
*
NeutralFEReadHandle
,
FE
->
index
()));
ATH_MSG_VERBOSE
(
"Got a match between NFE and Muon"
);
...
...
@@ -267,7 +267,7 @@ StatusCode PFMuonFlowElementAssoc::execute(const EventContext & ctx) const
if
(
isCellMatched
){
// cell matched => Link the two objects.
// Add Muon element link to a vector