Skip to content
Snippets Groups Projects
Commit 8ebdf7a3 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'master-egammaToolHandleArrayFix' into 'master'

Fix the initialization of TookHandleArrays

See merge request atlas/athena!15807
parents f5b5250f 460e2328
No related branches found
No related tags found
No related merge requests found
......@@ -98,19 +98,19 @@ StatusCode egammaBuilder::initialize()
CHECK( RetrieveEMConversionBuilder() );
// retrieve EM Cluster Tool
CHECK( RetrieveEMClusterTool() );
ATH_CHECK( m_clusterTool.retrieve() );
// retrieve ambiguity tool
CHECK( RetrieveAmbiguityTool() );
ATH_CHECK( m_ambiguityTool.retrieve() );
ATH_MSG_INFO("Retrieving " << m_egammaTools.size() << " tools for egamma objects");
CHECK( RetrieveTools(m_egammaTools) );
ATH_CHECK( m_egammaTools.retrieve() );
ATH_MSG_INFO("Retrieving " << m_electronTools.size() << " tools for electrons");
CHECK( RetrieveTools(m_electronTools) );
ATH_CHECK( m_electronTools.retrieve() );
ATH_MSG_INFO("Retrieving " << m_photonTools.size() << " tools for photons");
CHECK( RetrieveTools(m_photonTools) );
ATH_CHECK( m_photonTools.retrieve() );
// retrieve timing profile
CHECK( service("ChronoStatSvc",m_timingProfile) );
......@@ -119,54 +119,6 @@ StatusCode egammaBuilder::initialize()
return StatusCode::SUCCESS;
}
// ====================================================================
StatusCode egammaBuilder::RetrieveTools(ToolHandleArray<IegammaBaseTool>& tools)
{
for (const auto& tool : tools)
{
if ( tool.retrieve().isFailure() )
{
ATH_MSG_FATAL( "Could not get tool: " << tool );
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}
// ====================================================================
StatusCode egammaBuilder::RetrieveEMClusterTool(){
// retrieve Ambiguity tool
if (m_clusterTool.empty()) {
ATH_MSG_ERROR("EMClusterTool is empty");
return StatusCode::FAILURE;
}
if((m_clusterTool.retrieve()).isFailure()) {
ATH_MSG_ERROR("Unable to retrieve "<<m_clusterTool);
return StatusCode::FAILURE;
}
else ATH_MSG_DEBUG("Retrieved Tool "<<m_clusterTool);
return StatusCode::SUCCESS;
}
// ====================================================================
StatusCode egammaBuilder::RetrieveAmbiguityTool()
{
// retrieve Ambiguity tool
if (m_ambiguityTool.empty()) {
ATH_MSG_ERROR("EGammaAmbiguityTool is empty");
return StatusCode::FAILURE;
}
if((m_ambiguityTool.retrieve()).isFailure()) {
ATH_MSG_ERROR("Unable to retrieve "<<m_ambiguityTool);
return StatusCode::FAILURE;
}
else ATH_MSG_DEBUG("Retrieved Tool "<<m_ambiguityTool);
return StatusCode::SUCCESS;
}
// ====================================================================
StatusCode egammaBuilder::RetrieveEMTrackMatchBuilder(){
......
......@@ -123,9 +123,6 @@ class egammaBuilder : public AthAlgorithm
"ConversionBuilderTool", "EMConversionBuilder",
"Tool that matches conversion vertices to egammaRecs"};
/** @brief Retrieve each tool in the given vector **/
StatusCode RetrieveTools(ToolHandleArray<IegammaBaseTool>& tools);
/** @brief Call a tool using contExecute and electrons, photon containers if given **/
StatusCode CallTool(const EventContext& ctx,
......@@ -133,11 +130,6 @@ class egammaBuilder : public AthAlgorithm
xAOD::ElectronContainer *electronContainer = 0,
xAOD::PhotonContainer *photonContainer = 0);
/** @brief retrieve EMClusterTool **/
StatusCode RetrieveEMClusterTool();
/** @brief retrieve EGammaAmbiguityTool **/
StatusCode RetrieveAmbiguityTool();
/** @brief retrieve EMTrackMatchBuilder **/
StatusCode RetrieveEMTrackMatchBuilder();
/** @brief retrieve EMConversionBuilder **/
......
......@@ -70,9 +70,7 @@ StatusCode egammaForwardBuilder::initialize()
ATH_CHECK(m_fourMomBuilder.retrieve());
}
for (const auto& selector : m_forwardElectronIsEMSelectors) {
ATH_CHECK(selector.retrieve());
}
ATH_CHECK(m_forwardElectronIsEMSelectors.retrieve());
if (m_forwardElectronIsEMSelectors.size() != m_forwardElectronIsEMSelectorResultNames.size()) {
ATH_MSG_ERROR("The number of selectors does not match the number of given fwd-electron selector names");
......
......@@ -62,13 +62,10 @@ class egammaForwardBuilder : public AthReentrantAlgorithm
/** @brief execute method*/
virtual StatusCode execute_r(const EventContext& ctx) const override final;
/** @brief retrieve object quality tool */
void RetrieveObjectQualityTool();
/** @brief execute object quality tool */
StatusCode ExecObjectQualityTool(const EventContext &ctx, xAOD::Egamma *eg) const;
private:
StatusCode ExecObjectQualityTool(const EventContext &ctx, xAOD::Egamma *eg) const;
/** @brief Tool to perform object quality*/
ToolHandle<IegammaBaseTool> m_objectQualityTool {this,
"ObjectQualityToolName", "",
......
......@@ -51,14 +51,14 @@ StatusCode topoEgammaBuilder::initialize()
//
//////////////////////////////////////////////////
// retrieve tools
CHECK( RetrieveEMClusterTool() );
CHECK( RetrieveAmbiguityTool() );
ATH_CHECK( m_clusterTool.retrieve() );
ATH_CHECK( m_ambiguityTool.retrieve() );
ATH_MSG_DEBUG("Retrieving " << m_egammaTools.size() << " tools for egamma objects");
CHECK( RetrieveTools(m_egammaTools) );
ATH_CHECK( m_egammaTools.retrieve() );
ATH_MSG_DEBUG("Retrieving " << m_electronTools.size() << " tools for electrons");
CHECK( RetrieveTools(m_electronTools) );
ATH_CHECK( m_electronTools.retrieve() );
ATH_MSG_DEBUG("Retrieving " << m_photonTools.size() << " tools for photons");
CHECK( RetrieveTools(m_photonTools) );
ATH_CHECK( m_photonTools.retrieve() );
// retrieve timing profile
if (m_doChrono) CHECK( m_timingProfile.retrieve() );
......@@ -67,52 +67,6 @@ StatusCode topoEgammaBuilder::initialize()
return StatusCode::SUCCESS;
}
// ====================================================================
StatusCode topoEgammaBuilder::RetrieveTools(ToolHandleArray<IegammaBaseTool>& tools){
for (const auto tool : tools){
if ( tool.retrieve().isFailure() ){
ATH_MSG_FATAL( "Could not get tool: " << tool);
return StatusCode::FAILURE;
}
else ATH_MSG_DEBUG("Retrieved Tool " << tool);
}
return StatusCode::SUCCESS;
}
// ====================================================================
StatusCode topoEgammaBuilder::RetrieveEMClusterTool(){
// retrieve Ambiguity tool
if (m_clusterTool.empty()) {
ATH_MSG_ERROR("EMClusterTool is empty");
return StatusCode::FAILURE;
}
if((m_clusterTool.retrieve()).isFailure()) {
ATH_MSG_ERROR("Unable to retrieve "<<m_clusterTool);
return StatusCode::FAILURE;
}
else ATH_MSG_DEBUG("Retrieved Tool "<<m_clusterTool);
return StatusCode::SUCCESS;
}
// ====================================================================
StatusCode topoEgammaBuilder::RetrieveAmbiguityTool(){
// retrieve Ambiguity tool
if (m_ambiguityTool.empty()) {
ATH_MSG_ERROR("EMAmbiguityTool is empty");
return StatusCode::FAILURE;
}
if((m_ambiguityTool.retrieve()).isFailure()) {
ATH_MSG_ERROR("Unable to retrieve "<<m_ambiguityTool);
return StatusCode::FAILURE;
}
else ATH_MSG_DEBUG("Retrieved Tool "<<m_ambiguityTool);
return StatusCode::SUCCESS;
}
// ====================================================================
StatusCode topoEgammaBuilder::finalize(){
// finalize method
......
......@@ -74,16 +74,6 @@ private:
"Tool that does electron/photon ambiguity resolution"};
/** @brief Retrieve each tool in the given vector **/
StatusCode RetrieveTools(ToolHandleArray<IegammaBaseTool>& tools);
/** @brief retrieve EMClusterTool **/
StatusCode RetrieveEMClusterTool();
/** @brief retrieve EMAmbiguityTool **/
StatusCode RetrieveAmbiguityTool();
/** Given an egammaRec object, a pointer to the electron container and the author,
* create and dress an electron, pushing it back to the container and
* calling the relevant tools **/
......
......@@ -40,35 +40,28 @@ StatusCode EMPIDBuilder::initialize()
ATH_MSG_DEBUG(" Initializing EMPIDBuilder");
for (const auto& selector : m_electronIsEMselectors) {
CHECK(selector.retrieve());
}
ATH_CHECK(m_electronIsEMselectors.retrieve());
if (m_electronIsEMselectors.size() != m_electronIsEMselectorResultNames.size()) {
ATH_MSG_ERROR("The number of selectors does not match the number of given electronIsEMselector names");
return StatusCode::FAILURE;
}
for (const auto& selector : m_electronLHselectors) {
CHECK(selector.retrieve());
}
ATH_CHECK(m_electronLHselectors.retrieve());
if (m_electronLHselectors.size() != m_electronLHselectorResultNames.size()) {
ATH_MSG_ERROR("The number of selectors does not match the number of given electron LH selector names");
return StatusCode::FAILURE;
}
for (const auto& selector : m_genericIsEMselectors) {
CHECK(selector.retrieve());
}
ATH_CHECK(m_genericIsEMselectors.retrieve());
if (m_genericIsEMselectors.size() != m_genericIsEMselectorResultNames.size()) {
ATH_MSG_ERROR("The number of selectors does not match the number of given generic selector names");
return StatusCode::FAILURE;
}
for (const auto& selector : m_photonIsEMselectors) {
CHECK(selector.retrieve());
}
ATH_CHECK(m_photonIsEMselectors.retrieve());
if (m_photonIsEMselectors.size() != m_photonIsEMselectorResultNames.size()) {
ATH_MSG_ERROR("The number of selectors does not match the number of given photon selector names");
......
......@@ -45,29 +45,29 @@ StatusCode egammaSwTool::initialize()
ATH_MSG_DEBUG(" Initializing egammaSwTool");
ATH_CHECK(populateTools(m_clusterCorrectionPointersEle35));
ATH_CHECK(populateTools(m_clusterCorrectionPointersEle37));
ATH_CHECK(populateTools(m_clusterCorrectionPointersEle55));
ATH_CHECK(m_clusterCorrectionPointersEle35.retrieve());
ATH_CHECK(m_clusterCorrectionPointersEle37.retrieve());
ATH_CHECK(m_clusterCorrectionPointersEle55.retrieve());
//
ATH_CHECK(populateTools(m_clusterCorrectionPointersGam35));
ATH_CHECK(populateTools(m_clusterCorrectionPointersGam37));
ATH_CHECK(populateTools(m_clusterCorrectionPointersGam55));
ATH_CHECK(m_clusterCorrectionPointersGam35.retrieve());
ATH_CHECK(m_clusterCorrectionPointersGam37.retrieve());
ATH_CHECK(m_clusterCorrectionPointersGam55.retrieve());
//
ATH_CHECK(populateTools(m_clusterCorrectionPointersEconv35));
ATH_CHECK(populateTools(m_clusterCorrectionPointersEconv37));
ATH_CHECK(populateTools(m_clusterCorrectionPointersEconv55));
ATH_CHECK(m_clusterCorrectionPointersEconv35.retrieve());
ATH_CHECK(m_clusterCorrectionPointersEconv37.retrieve());
ATH_CHECK(m_clusterCorrectionPointersEconv55.retrieve());
//SuperCluster
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterEle35));
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterEle37));
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterEle55));
ATH_CHECK(m_clusterCorrectionPointersSuperClusterEle35.retrieve());
ATH_CHECK(m_clusterCorrectionPointersSuperClusterEle37.retrieve());
ATH_CHECK(m_clusterCorrectionPointersSuperClusterEle55.retrieve());
//
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterGam35));
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterGam37));
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterGam55));
ATH_CHECK(m_clusterCorrectionPointersSuperClusterGam35.retrieve());
ATH_CHECK(m_clusterCorrectionPointersSuperClusterGam37.retrieve());
ATH_CHECK(m_clusterCorrectionPointersSuperClusterGam55.retrieve());
//
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterEconv35));
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterEconv37));
ATH_CHECK(populateTools(m_clusterCorrectionPointersSuperClusterEconv55));
ATH_CHECK(m_clusterCorrectionPointersSuperClusterEconv35.retrieve());
ATH_CHECK(m_clusterCorrectionPointersSuperClusterEconv37.retrieve());
ATH_CHECK(m_clusterCorrectionPointersSuperClusterEconv55.retrieve());
return StatusCode::SUCCESS;
}
......@@ -173,18 +173,6 @@ StatusCode egammaSwTool::execute(const EventContext& ctx, xAOD::CaloCluster* clu
return StatusCode::SUCCESS;
}
StatusCode egammaSwTool::populateTools(ToolHandleArray<CaloClusterProcessor>& tools)
{
for (const auto tool : tools){
if ( tool.retrieve().isFailure() ){
ATH_MSG_FATAL( "Could not get tool: " << tool);
return StatusCode::FAILURE;
}
else ATH_MSG_DEBUG("Retrieved Tool " << tool);
}
return StatusCode::SUCCESS;
}
StatusCode egammaSwTool::processTools(const EventContext& ctx, ToolHandleArray<CaloClusterProcessor>& tools,
xAOD::CaloCluster* cluster) const
{
......
......@@ -44,7 +44,6 @@ class egammaSwTool : public AthAlgTool, virtual public IegammaSwTool
private:
StatusCode populateTools(ToolHandleArray<CaloClusterProcessor>& tools);
StatusCode processTools(const EventContext& ctx, ToolHandleArray<CaloClusterProcessor>& tools, xAOD::CaloCluster* cluster) const;
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment