Commit 2796f620 authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

egammaSuperClusterBuilder allow to define if we want electron or photon correction/calibration

parent 59561d04
......@@ -31,7 +31,14 @@ egammaSuperClusterBuilder::initialize()
ATH_CHECK(m_egammaSuperRecCollectionKey.initialize());
ATH_CHECK(m_precorrClustersKey.initialize(SG::AllowEmpty));
ATH_CHECK(m_caloDetDescrMgrKey.initialize());
if (m_calibrationType == "electron") {
m_egTypeForCalibration = xAOD::EgammaParameters::electron;
} else if (m_calibrationType == "photon") {
m_egTypeForCalibration = xAOD::EgammaParameters::unconvertedPhoton;
} else {
ATH_MSG_ERROR("Unsupported calibration for " << m_calibrationType);
return StatusCode::FAILURE;
}
return egammaSuperClusterBuilderBase::initialize();
}
......@@ -61,16 +68,18 @@ egammaSuperClusterBuilder::execute(const EventContext& ctx) const
m_egammaSuperRecCollectionKey, ctx);
ATH_CHECK(newEgammaRecs.record(std::make_unique<EgammaRecContainer>()));
std::optional<SG::WriteHandle<xAOD::CaloClusterContainer> > precorrClustersH;
std::optional<SG::WriteHandle<xAOD::CaloClusterContainer>> precorrClustersH;
if (!m_precorrClustersKey.empty()) {
precorrClustersH.emplace (m_precorrClustersKey, ctx);
ATH_CHECK( precorrClustersH->record
(std::make_unique<xAOD::CaloClusterContainer>(),
std::make_unique<xAOD::CaloClusterAuxContainer>()) );
precorrClustersH.emplace(m_precorrClustersKey, ctx);
ATH_CHECK(precorrClustersH->record(
std::make_unique<xAOD::CaloClusterContainer>(),
std::make_unique<xAOD::CaloClusterAuxContainer>()));
}
// The calo Det Descr manager
SG::ReadCondHandle<CaloDetDescrManager> caloDetDescrMgrHandle { m_caloDetDescrMgrKey, ctx };
SG::ReadCondHandle<CaloDetDescrManager> caloDetDescrMgrHandle{
m_caloDetDescrMgrKey, ctx
};
ATH_CHECK(caloDetDescrMgrHandle.isValid());
const CaloDetDescrManager* calodetdescrmgr = *caloDetDescrMgrHandle;
......@@ -80,7 +89,7 @@ egammaSuperClusterBuilder::execute(const EventContext& ctx) const
std::vector<bool> isUsedRevert(egammaRecs->size(), false);
// Loop over input egammaRec objects, build superclusters.
for (std::size_t i = 0; i < egammaRecs->size(); ++i) {
if (isUsed[i]){
if (isUsed[i]) {
continue;
}
......@@ -112,7 +121,7 @@ egammaSuperClusterBuilder::execute(const EventContext& ctx) const
createNewCluster(ctx,
accumulatedClusters,
*calodetdescrmgr,
xAOD::EgammaParameters::electron,
m_egTypeForCalibration,
precorrClustersH ? precorrClustersH->ptr() : nullptr);
if (!newCluster) {
......
......@@ -8,8 +8,8 @@
#include "egammaSuperClusterBuilderBase.h"
#include "GaudiKernel/EventContext.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/WriteHandleKey.h"
#include "CaloDetDescr/CaloDetDescrManager.h"
......@@ -24,8 +24,7 @@
/**
* @brief Create supercluster under egamma (no tracking) hypothesis
* Useful if you want to run electron reconstuction without tracking
* (the photon one can run anyhow without tracking)
* Useful if you want to run calo reconstuction without tracking
*
* The algorithm creates superclusters merging topoclusters.
* Input containers:
......@@ -85,7 +84,16 @@ private:
const EgammaRecContainer* egammaRecs,
std::vector<bool>& isUsed) const;
// internal variables
xAOD::EgammaParameters::EgammaType m_egTypeForCalibration;
/** @brief type to be assumed for calibration */
Gaudi::Property<std::string> m_calibrationType{
this,
"CalibrationType",
"electron",
" type to be assumed for calibration"
"electron , photon"
};
/** @brief Key for input egammaRec container */
SG::ReadHandleKey<EgammaRecContainer> m_inputEgammaRecContainerKey{
this,
......@@ -94,7 +102,7 @@ private:
"input egammaRec container"
};
SG::ReadCondHandleKey<CaloDetDescrManager> m_caloDetDescrMgrKey {
SG::ReadCondHandleKey<CaloDetDescrManager> m_caloDetDescrMgrKey{
this,
"CaloDetDescrManager",
"CaloDetDescrManager",
......@@ -118,11 +126,12 @@ private:
};
/** @brief Optional key for pre-correction clusters */
SG::WriteHandleKey<xAOD::CaloClusterContainer>
m_precorrClustersKey{ this,
"precorrClustersName",
"",
"optional pre-correction clusters" };
SG::WriteHandleKey<xAOD::CaloClusterContainer> m_precorrClustersKey{
this,
"precorrClustersName",
"",
"optional pre-correction clusters"
};
};
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment