Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Kazuya Mochizuki
athena
Commits
7bc422cf
Commit
7bc422cf
authored
Jul 04, 2019
by
Jovan Mitrevski
Committed by
Adam Edward Barton
Jul 04, 2019
Browse files
Create new 7x11 clusters in egamma for selecting which cells to write in the AODs
parent
0646e8a5
Changes
17
Hide whitespace changes
Inline
Side-by-side
Calorimeter/CaloRec/python/CaloRecFlags.py
View file @
7bc422cf
...
...
@@ -64,7 +64,7 @@ class doEmCluster(CaloRecFlagsJobProperty):
"""
statusOn
=
True
allowedTypes
=
[
'bool'
]
StoredValue
=
Tru
e
StoredValue
=
Fals
e
class
doCaloCluster
(
CaloRecFlagsJobProperty
):
""" switch for combined calo cluster
...
...
Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py
View file @
7bc422cf
...
...
@@ -1338,8 +1338,7 @@ if ( rec.doAOD() or rec.doWriteAOD()) and not rec.readAOD() :
if
DetFlags
.
detdescr
.
Calo_on
()
and
rec
.
doAODCaloCells
():
try
:
from
CaloRec.CaloCellAODGetter
import
addClusterToCaloCellAOD
if
rec
.
readESD
()
or
jobproperties
.
CaloRecFlags
.
doEmCluster
()
:
addClusterToCaloCellAOD
(
"LArClusterEM7_11Nocorr"
)
addClusterToCaloCellAOD
(
"egamma711Clusters"
)
from
egammaRec.egammaRecFlags
import
jobproperties
if
(
rec
.
readESD
()
or
jobproperties
.
egammaRecFlags
.
Enabled
)
and
not
rec
.
ScopingLevel
()
==
4
and
rec
.
doEgamma
:
...
...
Reconstruction/egamma/egammaAlgs/CMakeLists.txt
View file @
7bc422cf
...
...
@@ -43,9 +43,10 @@ atlas_add_component( egammaAlgs
src/components/*.cxx
INCLUDE_DIRS
LINK_LIBRARIES AthenaBaseComps EventKernel xAODCaloEvent xAODEgamma xAODTruth GaudiKernel
MCTruthClassifierLib CaloGeoHelpers CaloUtilsLib AthenaKernel StoreGateLib xAODTracking InDetReadoutGeometry
EgammaAnalysisInterfacesLib egammaRecEvent egammaUtils TrkToolInterfaces InDetRecToolInterfaces
FourMomUtils RecoToolInterfaces TrkTrack TrkPseudoMeasurementOnTrack InDetConversionFinderToolsLib TrkCaloExtension
)
MCTruthClassifierLib CaloGeoHelpers CaloUtilsLib CaloRecLib AthenaKernel StoreGateLib
xAODTracking InDetReadoutGeometry EgammaAnalysisInterfacesLib egammaRecEvent egammaUtils
TrkToolInterfaces InDetRecToolInterfaces FourMomUtils RecoToolInterfaces TrkTrack
TrkPseudoMeasurementOnTrack InDetConversionFinderToolsLib TrkCaloExtension
)
# Install files from the package:
atlas_install_python_modules
(
python/*.py
)
...
...
Reconstruction/egamma/egammaAlgs/python/egammaLargeClusterMakerAlg.py
0 → 100644
View file @
7bc422cf
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
__doc__
=
"ToolFactory to instantiate egammaLargeClusterMaker with default configuration"
__author__
=
"Jovan Mitrevski"
from
egammaTools.egammaToolsFactories
import
egammaLargeClusterMakerTool
from
CaloRec
import
CaloRecConf
from
egammaRec.Factories
import
AlgFactory
,
ToolFactory
,
FcnWrapper
from
egammaRec
import
egammaKeys
from
CaloClusterCorrection.CaloSwCorrections
import
make_CaloSwCorrections
def
clusMakerTools
():
return
[
egammaLargeClusterMakerTool
()]
egammaLargeClusterMakerAlg
=
AlgFactory
(
CaloRecConf
.
CaloClusterMaker
,
name
=
"egammaLargeClusterMaker"
,
SaveUncalibratedSignalState
=
False
,
ClustersOutputName
=
egammaKeys
.
EgammaLargeClustersKey
(),
ClusterMakerTools
=
FcnWrapper
(
clusMakerTools
),
ClusterCorrectionTools
=
make_CaloSwCorrections
(
"ele7_11"
,
suffix
=
"Nocorr"
,
version
=
"none"
,
cells_name
=
egammaKeys
.
caloCellKey
()))
Reconstruction/egamma/egammaAlgs/python/egammaLargeClusterMakerAlgConfig.py
0 → 100644
View file @
7bc422cf
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
__doc__
=
"Configure egammaLargeClusterMaker, which chooses cells to store in the AOD"
__author__
=
"Jovan Mitrevski"
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
from
egammaTools.egammaLargeClusterMakerConfig
import
egammaLargeClusterMakerCfg
from
CaloClusterCorrection.CaloSwCorrections
import
make_CaloSwCorrections
from
CaloRec.CaloRecConf
import
CaloClusterMaker
def
egammaLargeClusterMakerAlgCfg
(
flags
,
name
=
"egammaLargeClusterMaker"
,
**
kwargs
):
acc
=
ComponentAccumulator
kwargs
.
setdefault
(
"SaveUncalibratedSignalState"
,
False
)
kwargs
.
setdefault
(
"ClustersOutputName"
,
flags
.
Egamma
.
Keys
.
Output
.
EgammaLargeClusters
)
if
"ClusterMakerTools"
not
in
kwargs
:
toolAcc
=
egammaLargeClusterMakerCfg
(
flags
)
kwargs
[
"ClusterMakerTools"
]
=
[
toolAcc
.
popPrivateTools
()
]
acc
.
merge
(
toolAcc
)
kwargs
.
setdefault
(
"ClusterCorrectionTools"
,
make_CaloSwCorrections
(
"ele7_11"
,
suffix
=
"Nocorr"
,
version
=
"none"
,
cells_name
=
flags
.
Egamma
.
Keys
.
Input
.
CaloCells
))
acc
.
addEventAlgo
(
CaloClusterMaker
(
name
,
**
kwargs
))
return
acc
Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx
View file @
7bc422cf
...
...
@@ -127,25 +127,28 @@ StatusCode topoEgammaBuilder::execute(){
unsigned
int
author
=
xAOD
::
EgammaParameters
::
AuthorElectron
;
xAOD
::
AmbiguityTool
::
AmbiguityType
type
=
xAOD
::
AmbiguityTool
::
electron
;
for
(
const
auto
&
photonRec
:
*
photonSuperRecs
)
{
//See if the same seed (0 element in the constituents) seed also a photon
if
(
caloClusterLinks
(
*
(
electronRec
->
caloCluster
())).
at
(
0
)
==
caloClusterLinks
(
*
(
photonRec
->
caloCluster
())).
at
(
0
)){
ATH_MSG_DEBUG
(
"Running AmbiguityTool for electron"
);
author
=
m_ambiguityTool
->
ambiguityResolve
(
electronRec
->
caloCluster
(),
photonRec
->
vertex
(),
electronRec
->
trackParticle
(),
type
);
// get the hottest cell
const
xAOD
::
CaloCluster
*
const
elClus
=
electronRec
->
caloCluster
();
const
auto
elEta0
=
elClus
->
eta0
();
const
auto
elPhi0
=
elClus
->
phi0
();
for
(
const
auto
&
photonRec
:
*
photonSuperRecs
)
{
break
;
}
const
xAOD
::
CaloCluster
*
const
phClus
=
photonRec
->
caloCluster
();
//See if they have the same hottest cell
if
(
elEta0
==
phClus
->
eta0
()
&&
elPhi0
==
phClus
->
phi0
())
{
ATH_MSG_DEBUG
(
"Running AmbiguityTool for electron"
);
author
=
m_ambiguityTool
->
ambiguityResolve
(
elClus
,
photonRec
->
vertex
(),
electronRec
->
trackParticle
(),
type
);
break
;
}
}
//Fill each electron
if
(
author
==
xAOD
::
EgammaParameters
::
AuthorElectron
||
author
==
xAOD
::
EgammaParameters
::
AuthorAmbiguous
){
author
==
xAOD
::
EgammaParameters
::
AuthorAmbiguous
){
ATH_MSG_DEBUG
(
"getElectron"
);
if
(
!
getElectron
(
electronRec
,
electronContainer
.
ptr
(),
author
,
type
)
){
return
StatusCode
::
FAILURE
;
...
...
@@ -159,23 +162,29 @@ StatusCode topoEgammaBuilder::execute(){
unsigned
int
author
=
xAOD
::
EgammaParameters
::
AuthorPhoton
;
xAOD
::
AmbiguityTool
::
AmbiguityType
type
=
xAOD
::
AmbiguityTool
::
photon
;
// get the hottest cell
const
xAOD
::
CaloCluster
*
const
phClus
=
photonRec
->
caloCluster
();
const
auto
phEta0
=
phClus
->
eta0
();
const
auto
phPhi0
=
phClus
->
phi0
();
//See if the same seed (0 element in the constituents) seed also an electron
for
(
const
auto
&
electronRec
:
*
electronSuperRecs
)
{
if
(
caloClusterLinks
(
*
(
photonRec
->
caloCluster
())).
at
(
0
)
==
caloClusterLinks
(
*
(
electronRec
->
caloCluster
())).
at
(
0
)){
ATH_MSG_DEBUG
(
"Running AmbiguityTool for photon"
);
author
=
m_ambiguityTool
->
ambiguityResolve
(
electronRec
->
caloCluster
(),
photonRec
->
vertex
(),
electronRec
->
trackParticle
(),
type
);
break
;
}
const
xAOD
::
CaloCluster
*
const
elClus
=
electronRec
->
caloCluster
();
//See if they have the same hottest cell
if
(
phEta0
==
elClus
->
eta0
()
&&
phPhi0
==
elClus
->
phi0
())
{
ATH_MSG_DEBUG
(
"Running AmbiguityTool for photon"
);
author
=
m_ambiguityTool
->
ambiguityResolve
(
elClus
,
photonRec
->
vertex
(),
electronRec
->
trackParticle
(),
type
);
break
;
}
}
//Fill each photon
if
(
author
==
xAOD
::
EgammaParameters
::
AuthorPhoton
||
author
==
xAOD
::
EgammaParameters
::
AuthorAmbiguous
){
author
==
xAOD
::
EgammaParameters
::
AuthorAmbiguous
){
ATH_MSG_DEBUG
(
"getPhoton"
);
if
(
!
getPhoton
(
photonRec
,
photonContainer
.
ptr
(),
author
,
type
)
){
return
StatusCode
::
FAILURE
;
...
...
Reconstruction/egamma/egammaConfig/python/egammaConfigFlags.py
View file @
7bc422cf
...
...
@@ -61,6 +61,11 @@ def createEgammaConfigFlags():
egcf
.
addFlag
(
"Egamma.Keys.Internal.PhotonSuperRecs"
,
'PhotonSuperRecCollection'
)
egcf
.
addFlag
(
"Egamma.Keys.Internal.ElectronSuperRecs"
,
'ElectronSuperRecCollection'
)
# These are the clusters that are used to determine which cells to write out to AOD
egcf
.
addFlag
(
"Egamma.Keys.Output.EgammaLargeClusters"
,
'egamma711Clusters'
)
egcf
.
addFlag
(
"Egamma.Keys.Output.EgammaLargeClustersSuppESD"
,
''
)
# don't define SuppAOD because the whole container is suppressed
egcf
.
addFlag
(
"Egamma.Keys.Output.ConversionVertices"
,
'GSFConversionVertices'
)
egcf
.
addFlag
(
"Egamma.Keys.Output.ConversionVerticesSuppESD"
,
'-vxTrackAtVertex'
)
egcf
.
addFlag
(
"Egamma.Keys.Output.ConversionVerticesSuppAOD"
,
'-vxTrackAtVertex'
)
...
...
Reconstruction/egamma/egammaRec/python/egammaKeys.py
View file @
7bc422cf
...
...
@@ -22,6 +22,7 @@ class egammaKeysDict:
outputs
=
dict
(
Conversion
=
[
'xAOD::VertexContainer'
,
'GSFConversionVertices'
,
'-vxTrackAtVertex.'
,
''
],
Cluster
=
[
'xAOD::CaloClusterContainer'
,
'egammaClusters'
,
''
,
''
],
EgammaLargeClusters
=
[
'xAOD::CaloClusterContainer'
,
'egamma711Clusters'
,
''
,
''
],
# not output to AOD
TopoSeededCluster
=
[
'xAOD::CaloClusterContainer'
,
'egammaTopoSeededClusters'
,
''
,
'-CellLink'
],
Electron
=
[
'xAOD::ElectronContainer'
,
'Electrons'
,
''
,
ShowerShapesSuppress
+
ElectronisemSupress
],
EgammaRec
=
[
'egammaRecContainer'
,
'egammaRecCollection'
,
''
,
''
],
...
...
@@ -38,6 +39,7 @@ class egammaKeysDict:
outputs
[
'CellLink'
]
=
[
'CaloClusterCellLinkContainer'
,
outputs
[
'Cluster'
][
1
]
+
'_links'
,
''
,
''
]
outputs
[
'TopoSeededCellLink'
]
=
[
'CaloClusterCellLinkContainer'
,
outputs
[
'TopoSeededCluster'
][
1
]
+
'_links'
,
''
,
''
]
outputs
[
'FwdClusterCellLink'
]
=
[
'CaloClusterCellLinkContainer'
,
outputs
[
'FwdCluster'
][
1
]
+
'_links'
,
''
,
''
]
outputs
[
'EgammaLargeClustersCellLink'
]
=
[
'CaloClusterCellLinkContainer'
,
outputs
[
'EgammaLargeClusters'
][
1
]
+
'_links'
,
''
,
''
]
#
# Create methods to return the types and keys in inputs and outputs
...
...
Reconstruction/egamma/egammaRec/python/topoEgammaGetter.py
View file @
7bc422cf
...
...
@@ -102,5 +102,16 @@ class topoEgammaGetter ( Configured ) :
return
False
print
self
.
_topoEgammaBuilder
# the egammaLargeClusterMaker (Which chooses the cells to store in the AOD)
from
egammaAlgs.egammaLargeClusterMakerAlg
import
egammaLargeClusterMakerAlg
try
:
self
.
_egammaLargeClusterMaker
=
egammaLargeClusterMakerAlg
()
except
Exception
:
mlog
.
error
(
"could not get handle to egammaLargeClusterMaker"
)
import
traceback
print
traceback
.
format_exc
()
return
False
print
self
.
_egammaLargeClusterMaker
return
True
Reconstruction/egamma/egammaRec/share/egammaOutputItemList_jobOptions.py
View file @
7bc422cf
...
...
@@ -30,6 +30,11 @@ def addAuxContainer(outputList, cType, cKey, auxOptionAll='',auxOptionAOD=''):
# List for of keys to be written to AOD.
# All egammaKeys.outputs but EgammaRec and TopoSeededCellLink
AOD_outputs
=
[
i
for
i
,
j
in
egammaKeysDict
.
outputs
.
items
()
if
i
not
in
(
'EgammaRec'
,
'PhotonSuperRec'
,
'ElectronSuperRec'
,
'TopoSeededCellLink'
,
'FwdClusterCellLink'
,
'EgammaLargeClusters'
,
'EgammaLargeClustersCellLink'
)]
ESD_outputs
=
[
i
for
i
,
j
in
egammaKeysDict
.
outputs
.
items
()
if
i
not
in
(
'EgammaRec'
,
'PhotonSuperRec'
,
'ElectronSuperRec'
,
'TopoSeededCellLink'
,
'FwdClusterCellLink'
)]
...
...
@@ -49,13 +54,30 @@ for i in AOD_outputs:
continue
addContainer
(
egammaAODList
,
cType
,
cKey
)
addContainer
(
egammaESDList
,
cType
,
cKey
)
# Add aux containers for xAOD containers
if
'xAOD::'
in
cType
:
addAuxContainer
(
egammaAODList
,
cType
,
cKey
,
auxOptionAll
,
auxOptionAOD
)
for
i
in
ESD_outputs
:
cType
,
cKey
,
auxOptionAll
,
auxOptionAOD
=
egammaKeysDict
.
outputs
[
i
]
# Skip truth if doTruth = False
if
not
rec
.
doTruth
()
and
'Truth'
in
cKey
:
continue
# Skip Trk::Tracks in xAOD
if
egammaKeys
.
outputTrackType
()
in
cType
:
continue
addContainer
(
egammaESDList
,
cType
,
cKey
)
# Add aux containers for xAOD containers
if
'xAOD::'
in
cType
:
addAuxContainer
(
egammaESDList
,
cType
,
cKey
,
auxOptionAll
)
# Add the non xAOD kind of collection in the ESD
egammaESDList
.
append
(
getItem
(
egammaKeys
.
outputTrackType
(),
egammaKeys
.
outputTrackKey
())
)
egammaESDList
.
append
(
getItem
(
egammaKeys
.
outputFwdClusterCellLinkType
(),
egammaKeys
.
outputFwdClusterCellLinkKey
())
)
...
...
Reconstruction/egamma/egammaRec/share/egammaRec_jobOptions.py
View file @
7bc422cf
...
...
@@ -23,8 +23,8 @@ if not DetFlags.detdescr.ID_on():
jobproperties
.
egammaRecFlags
.
doVertexBuilding
=
False
#GSF also is seeded by the LarEMClusters for now. So we need these as well
if
not
(
rec
.
readESD
()
or
jobproperties
.
CaloRecFlags
.
doEmCluster
()):
jobproperties
.
egammaRecFlags
.
doBremFinding
=
False
#
if not (rec.readESD() or jobproperties.CaloRecFlags.doEmCluster()):
#
jobproperties.egammaRecFlags.doBremFinding=False
#We can not run Forward without having the TopoClusters
if
not
(
rec
.
readESD
()
or
jobproperties
.
CaloRecFlags
.
doCaloTopoCluster
()):
...
...
Reconstruction/egamma/egammaTools/python/egammaLargeClusterMakerConfig.py
0 → 100644
View file @
7bc422cf
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
__doc__
=
"Configure egammaLargeClusterMaker, which chooses cells to store in the AOD"
__author__
=
"Jovan Mitrevski"
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
from
egammaTools.egammaToolsConf
import
egammaLargeClusterMaker
def
egammaLargeClusterMakerCfg
(
flags
,
**
kwargs
):
acc
=
ComponentAccumulator
kwargs
.
setdefault
(
"CellsName"
,
flags
.
Egamma
.
Keys
.
Input
.
CaloCells
)
kwargs
.
setdefault
(
"InputClusterCollection"
,
flags
.
Egamma
.
Keys
.
Output
.
CaloClusters
)
acc
.
setPrivateTools
(
egammaLargeClusterMaker
(
**
kwargs
))
return
acc
Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py
View file @
7bc422cf
...
...
@@ -71,6 +71,12 @@ EGammaAmbiguityTool = ToolFactory( ElectronPhotonSelectorToolsConf.EGammaAmbigui
EMFourMomBuilder
=
ToolFactory
(
egammaToolsConf
.
EMFourMomBuilder
)
egammaLargeClusterMakerTool
=
ToolFactory
(
egammaToolsConf
.
egammaLargeClusterMaker
,
name
=
"egammaLCMakerTool"
,
InputClusterCollection
=
egammaKeys
.
ClusterKey
(),
CellsName
=
egammaKeys
.
caloCellKey
()
)
# Electron Selectors
from
EMPIDBuilderBase
import
EMPIDBuilderElectronBase
ElectronPIDBuilder
=
ToolFactory
(
EMPIDBuilderElectronBase
,
name
=
"ElectronPIDBuilder"
)
...
...
Reconstruction/egamma/egammaTools/src/EMClusterTool.h
View file @
7bc422cf
...
...
@@ -97,8 +97,11 @@ class EMClusterTool : public AthAlgTool, virtual public IEMClusterTool {
"OutputClusterContainerName"
,
""
,
"Name of the output cluster container"
};
/** @brief Key of the output cluster container cell links: name taken from containter name **/
SG
::
WriteHandleKey
<
CaloClusterCellLinkContainer
>
m_outputClusterContainerCellLinkKey
;
/** @brief Key of the output cluster container cell links:
name taken from containter name; only dummy configurable **/
SG
::
WriteHandleKey
<
CaloClusterCellLinkContainer
>
m_outputClusterContainerCellLinkKey
{
this
,
"DoNotSet_OutputClusterContainerLinks"
,
""
,
"Key of the output cluster container cell links; Do not set! Name taken from associated container"
};
/** @brief Key of the output cluster container for topo-seeded clusters **/
SG
::
WriteHandleKey
<
xAOD
::
CaloClusterContainer
>
m_outputTopoSeededClusterContainerKey
{
this
,
...
...
@@ -106,8 +109,10 @@ class EMClusterTool : public AthAlgTool, virtual public IEMClusterTool {
"Name of the output cluster container for topo-seeded clusters (can be the same as the other clusters)"
};
/** @brief Key of the output cluster container cell links for topo-seeded clusters:
* name taken from containter name */
SG
::
WriteHandleKey
<
CaloClusterCellLinkContainer
>
m_outputTopoSeededClusterContainerCellLinkKey
;
* name taken from containter name; only dummy configurable */
SG
::
WriteHandleKey
<
CaloClusterCellLinkContainer
>
m_outputTopoSeededClusterContainerCellLinkKey
{
this
,
"DoNotSet_OutputTopoSeededClusterContainerLinks"
,
""
,
"Key of the output cluster container cell links for topo-seeded clusters; Do not set! Name taken from associated container"
};
/** Handle to the MVA calibration service **/
ServiceHandle
<
IegammaMVASvc
>
m_MVACalibSvc
{
this
,
...
...
Reconstruction/egamma/egammaTools/src/components/egammaTools_entries.cxx
View file @
7bc422cf
...
...
@@ -6,6 +6,7 @@
#include "../egammaOQFlagsBuilder.h"
#include "../EMPIDBuilder.h"
#include "../egammaSwTool.h"
#include "../egammaLargeClusterMaker.h"
DECLARE_COMPONENT
(
EMClusterTool
)
DECLARE_COMPONENT
(
EMConversionBuilder
)
...
...
@@ -15,3 +16,4 @@ DECLARE_COMPONENT( EMTrackMatchBuilder )
DECLARE_COMPONENT
(
egammaOQFlagsBuilder
)
DECLARE_COMPONENT
(
EMPIDBuilder
)
DECLARE_COMPONENT
(
egammaSwTool
)
DECLARE_COMPONENT
(
egammaLargeClusterMaker
)
Reconstruction/egamma/egammaTools/src/egammaLargeClusterMaker.cxx
0 → 100644
View file @
7bc422cf
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "egammaLargeClusterMaker.h"
#include "CaloEvent/CaloCellContainer.h"
#include "CaloEvent/CaloClusterCellLink.h"
#include "xAODCaloEvent/CaloCluster.h"
#include "xAODCaloEvent/CaloClusterAuxContainer.h"
#include "CaloUtils/CaloClusterStoreHelper.h"
//#include "xAODCaloEvent/CaloClusterKineHelper.h"
#include "StoreGate/ReadHandle.h"
#include "StoreGate/WriteHandle.h"
#include "CaloUtils/CaloLayerCalculator.h"
#include "CaloDetDescr/CaloDetDescrManager.h"
// =============================================================
egammaLargeClusterMaker
::
egammaLargeClusterMaker
(
const
std
::
string
&
type
,
const
std
::
string
&
name
,
const
IInterface
*
parent
)
:
AthAlgTool
(
type
,
name
,
parent
)
{
// declare interface
declareInterface
<
CaloClusterCollectionProcessor
>
(
this
);
}
// =============================================================
StatusCode
egammaLargeClusterMaker
::
initialize
()
{
ATH_MSG_DEBUG
(
"Initializing "
<<
name
()
<<
"..."
);
ATH_CHECK
(
m_inputClusterCollection
.
initialize
());
ATH_CHECK
(
m_cellsKey
.
initialize
());
ATH_CHECK
(
m_egammaEnergyPositionAllSamples
.
retrieve
());
ATH_MSG_DEBUG
(
"Initialization successful"
);
return
StatusCode
::
SUCCESS
;
}
// =========================================================================
StatusCode
egammaLargeClusterMaker
::
execute
(
const
EventContext
&
ctx
,
xAOD
::
CaloClusterContainer
*
collection
)
const
{
if
(
!
collection
)
{
ATH_MSG_ERROR
(
"A null collection was passed, which should never happen"
);
return
StatusCode
::
FAILURE
;
}
SG
::
ReadHandle
<
xAOD
::
CaloClusterContainer
>
inputClusters
(
m_inputClusterCollection
,
ctx
);
// retrieve the cell containers
SG
::
ReadHandle
<
CaloCellContainer
>
cellcoll
(
m_cellsKey
,
ctx
);
// The main loop over clusters
for
(
auto
cluster
:
*
inputClusters
)
{
// find the center of the cluster, copying the logic of egammaMiddleShape.cxx
// check if cluster is in barrel or in the end-cap
if
(
!
cluster
->
inBarrel
()
&&
!
cluster
->
inEndcap
()
)
{
ATH_MSG_DEBUG
(
" Cluster is neither in Barrel nor in Endcap; skipping "
);
continue
;
}
// check if cluster is in barrel or end-cap
bool
in_barrel
=
m_egammaEnergyPositionAllSamples
->
inBarrel
(
*
cluster
,
2
);
CaloSampling
::
CaloSample
sam
=
CaloSampling
::
EMB2
;
if
(
in_barrel
)
{
sam
=
CaloSampling
::
EMB2
;
}
else
{
sam
=
CaloSampling
::
EME2
;
}
// granularity in (eta,phi) in the pre sampler
// CaloCellList needs both enums: subCalo and CaloSample
auto
eta
=
cluster
->
etaSample
(
sam
);
auto
phi
=
cluster
->
phiSample
(
sam
);
if
((
eta
==
0.
&&
phi
==
0.
)
||
fabs
(
eta
)
>
100
)
{
return
StatusCode
::
SUCCESS
;
}
const
CaloDetDescrManager
*
dd_man
=
CaloDetDescrManager
::
instance
();
// Should get overritten
bool
barrel
=
false
;
CaloCell_ID
::
SUBCALO
subcalo
=
CaloCell_ID
::
LAREM
;
int
sampling_or_module
=
0
;
dd_man
->
decode_sample
(
subcalo
,
barrel
,
sampling_or_module
,
(
CaloCell_ID
::
CaloSample
)
sam
);
// Get the corresponding grannularities : needs to know where you are
// the easiest is to look for the CaloDetDescrElement
const
CaloDetDescrElement
*
dde
=
dd_man
->
get_element
(
CaloCell_ID
::
LAREM
,
0
,
barrel
,
eta
,
phi
);
// if object does not exist then return
if
(
!
dde
)
{
return
StatusCode
::
SUCCESS
;
}
// local granularity
auto
deta
=
dde
->
deta
();
auto
dphi
=
dde
->
dphi
();
// search the hottest cell around the (eta,phi)
// (eta,phi) are defined as etaSample() and phiSample
// around this position a hot cell is searched for in a window
// (m_neta*m_deta,m_nphi*m_dphi), by default (m_neta,m_nphi)=(7,7)
CaloLayerCalculator
calc
;
StatusCode
sc
=
calc
.
fill
(
cellcoll
.
ptr
(),
cluster
->
etaSample
(
sam
),
cluster
->
phiSample
(
sam
),
m_neta
*
deta
,
m_nphi
*
dphi
,
(
CaloSampling
::
CaloSample
)
sam
);
if
(
sc
.
isFailure
()
)
{
ATH_MSG_WARNING
(
"CaloLayerCalculator failed fill "
);
}
double
etamax
=
calc
.
etarmax
();
double
phimax
=
calc
.
phirmax
();
// create the new cluster
xAOD
::
CaloCluster
*
newCluster
=
CaloClusterStoreHelper
::
makeCluster
(
collection
,
cellcoll
.
ptr
());
newCluster
->
setEta0
(
etamax
);
newCluster
->
setPhi0
(
phimax
);
newCluster
->
setClusterSize
(
xAOD
::
CaloCluster
::
SW_7_11
);
}
return
StatusCode
::
SUCCESS
;
}
Reconstruction/egamma/egammaTools/src/egammaLargeClusterMaker.h
0 → 100644
View file @
7bc422cf
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/**
@class egammaLargeClusterMaker
This tool takes the EM CaloCluster used by egamma objects
and builds large 7x11 clusters around
@author J. Mitrevski
@author C. Anastopoulos
*/
#ifndef EGAMMATOOLS_EGAMMALARGECLUSTERMAKER_H
#define EGAMMATOOLS_EGAMMALARGECLUSTERMAKER_H
#include "AthenaBaseComps/AthAlgTool.h"
#include "xAODCaloEvent/CaloClusterFwd.h"
#include "xAODCaloEvent/CaloClusterContainer.h"
#include "egammaInterfaces/IegammaEnergyPositionAllSamples.h"
#include "CaloRec/CaloClusterCollectionProcessor.h"
#include "GaudiKernel/ToolHandle.h"
#include "StoreGate/ReadHandleKey.h"
class
CaloCellContainer
;
class
CaloClusterCellLink
;
class
egammaLargeClusterMaker
:
public
AthAlgTool
,
virtual
public
CaloClusterCollectionProcessor
{
public:
/** @bried constructor */
egammaLargeClusterMaker
(
const
std
::
string
&
type
,
const
std
::
string
&
name
,
const
IInterface
*
parent
);
using
CaloClusterCollectionProcessor
::
execute
;
/** @brief initialize method */
virtual
StatusCode
initialize
()
override
final
;
/** @brief execute on container */
virtual
StatusCode
execute
(
const
EventContext
&
ctx
,
xAOD
::
CaloClusterContainer
*
collection
)
const
override
final
;
private:
/** @brief tool to calculate sum of energy in all samples */
ToolHandle
<
IegammaEnergyPositionAllSamples
>
m_egammaEnergyPositionAllSamples
{
this
,
"egammaEnergyPositionAllSamplesTool"
,
"egammaEnergyPositionAllSamples/egammaEnergyPositionAllSamples"
};
/** @brief The name of the cluster container for electrons and photons */
SG
::
ReadHandleKey
<
xAOD
::
CaloClusterContainer
>
m_inputClusterCollection
{
this
,
"InputClusterCollection"
,
"egammaClusters"
,
"The name of the cluster container for electrons and photons"
};
/** @brief Cell container*/
SG
::
ReadHandleKey
<
CaloCellContainer
>
m_cellsKey
{
this
,
"CellsName"
,
"AllCalo"
,
"Names of containers which contain cells"
};
Gaudi
::
Property
<
double
>
m_neta
{
this
,
"Neta"
,
7.0
,
"Number of eta cells in each sampling in which to look for hottest cell"
};
Gaudi
::
Property
<
double
>
m_nphi
{
this
,
"Nphi"
,
7.0
,
"Number of phi cell in each sampling in which to look for hottest cell"
};
};
#endif // EGAMMATOOLS_EMCLUSTERTOOL_H
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment