ATLAS Offline Software
Loading...
Searching...
No Matches
egammaSuperClusterBuilder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
13#include "xAODEgamma/Egamma.h"
16
17#include <cmath>
18#include <memory>
19
21 ISvcLocator* pSvcLocator)
22 : egammaSuperClusterBuilderBase(name, pSvcLocator)
23 , m_egTypeForCalibration(xAOD::EgammaParameters::electron)
24{
25}
26
27StatusCode
29{
30 ATH_MSG_DEBUG(" Initializing egammaSuperClusterBuilder");
31
32 // the data handle keys
33 if (m_calibrationType == "electron") {
35 } else if (m_calibrationType == "photon") {
37 } else {
38 ATH_MSG_ERROR("Unsupported calibration for " << m_calibrationType);
39 return StatusCode::FAILURE;
40 }
41
43}
44
46egammaSuperClusterBuilder::getEgammaRecType([[maybe_unused]]const egammaRec *egRec) const {
48}
49
50// assume egammaRecs != 0, since the ReadHadler is valid
51// assume seed egammaRec has a valid cluster, since it has been already used
52std::vector<std::size_t>
54 std::size_t seedIndex,
55 const EgammaRecContainer* egammaRecs,
56 std::vector<bool>& isUsed) const
57{
58
59 std::vector<std::size_t> secondaryIndices;
60
61 const auto* const seedEgammaRec = (*egammaRecs)[seedIndex];
62 const xAOD::CaloCluster* const seedCaloClus = seedEgammaRec->caloCluster();
63
64 // for stats
65 int nWindowClusters = 0;
66 // Now loop over the potential secondary clusters
67 for (std::size_t i = 0; i < egammaRecs->size(); ++i) {
68 // if already used continue
69 if (isUsed[i]) {
70 continue;
71 }
72 const auto* const secEgammaRec = (*egammaRecs)[i];
73 const xAOD::CaloCluster* const secClus = secEgammaRec->caloCluster();
74 if (!secClus) {
76 "The potentially secondary egammaRec does not have a cluster");
77 continue;
78 }
79 bool addCluster = false;
80 if (matchesInWindow(seedCaloClus, secClus)) {
81 ATH_MSG_DEBUG("Cluster with Et: " << secClus->et()
82 << " matched in window");
83 ++nWindowClusters;
84 addCluster = true;
85 }
86 // Add it to the list of secondary clusters if it matches.
87 if (addCluster) {
88 secondaryIndices.push_back(i);
89 isUsed[i] = true;
90 }
91 }
92 ATH_MSG_DEBUG("Found: " << secondaryIndices.size() << " secondaries");
93 ATH_MSG_DEBUG("window clusters: " << nWindowClusters);
94 return secondaryIndices;
95}
96
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Definition of CaloDetDescrManager.
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
size_type size() const noexcept
Returns the number of elements in the collection.
Represent an egamma object for internal egamma usage during reconstruction.
Definition egammaRec.h:31
egammaSuperClusterBuilderBase(const std::string &name, ISvcLocator *pSvcLocator)
Protected constructor since this class should not be instantiated by itself.
bool matchesInWindow(const xAOD::CaloCluster *ref, const xAOD::CaloCluster *clus) const
Is clus in window center around ref?
virtual StatusCode initialize() override
should be called by the derived class in the initialize phase
egammaSuperClusterBuilder(const std::string &name, ISvcLocator *pSvcLocator)
virtual xAOD::EgammaParameters::EgammaType getEgammaRecType(const egammaRec *egRec) const override final
Gaudi::Property< std::string > m_calibrationType
type to be assumed for calibration
xAOD::EgammaParameters::EgammaType m_egTypeForCalibration
virtual StatusCode initialize() override final
should be called by the derived class in the initialize phase
virtual std::vector< std::size_t > searchForSecondaryClusters(std::size_t egammaInd, const EgammaRecContainer *egammaRecs, std::vector< bool > &isUsed) const override final
Return extra clusters that can be added to make supercluster.
DataVector< egammaRec > EgammaRecContainer
The container is a simple typedef for now.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.