Commit 0fb91904 authored by Tadej Novak's avatar Tadej Novak
Browse files

Merge branch 'cluster_maker_algo_21p9' into '21.9'

HGTD PRD formation algorithm

See merge request !46340
parents b629351c a6edb464
################################################################################
# Package: HGTD_PRDFormation
################################################################################
# Declare the package name:
atlas_subdir( HGTD_PRDFormation )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
GaudiKernel)
# Component(s) in the package:
atlas_add_component( TrackTimeExtensionAlg
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps GaudiKernel HGTD_RecToolInterfaces
HGTD_RawData HGTD_Identifier)
# Install files from the package:
atlas_install_headers( HGTD_PRDFormation )
atlas_install_python_modules( python/*.py)
atlas_install_joboptions( share/*.py )
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*
* @file HGTD_PRDFormation/PadClusterizationAlg.h
* @author Alexander Leopold <alexander.leopold@cern.ch>
* @date September, 2021
*
* @brief RDO objects get transformed into PrepRawData objects and recorded in
* the event store.
*
* TODO: - for R22, the Read/WriteHandleKey interface changed: please update!
*/
#ifndef HGTD_RECALGS_PRDFORMATION_H
#define HGTD_RECALGS_PRDFORMATION_H
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "HGTD_PrepRawData/HGTD_ClusterContainer.h"
#include "HGTD_RawData/HGTD_RDOContainer.h"
#include "HGTD_RecToolInterfaces/IHGTD_PadClusterizationTool.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/WriteHandleKey.h"
#include <string>
class HGTD_ID;
namespace HGTD {
class PadClusterizationAlg : public AthAlgorithm {
public:
PadClusterizationAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~PadClusterizationAlg() {}
virtual StatusCode initialize() override final;
virtual StatusCode execute() override final;
private:
ToolHandle<HGTD::IHGTD_PadClusterizationTool> m_clusterization_tool;
// FIXME: should look like this in master
// SG::ReadHandleKey<HGTD::HGTD_RDOContainer> m_rdo_rh_key{
// this, "RDOContainerName", "HGTD_RDOs", "Name of the HGTD_RDO
// container"};
//
// SG::WriteHandleKey<HGTD::HGTD_ClusterContainer> m_prd_wh_key{
// this, "PRDContainerName", "HGTD_Clusters",
// "Name of the HGTD_Cluster container"};
SG::ReadHandleKey<HGTD::HGTD_RDOContainer> m_rdo_rh_key;
SG::WriteHandleKey<HGTD::HGTD_ClusterContainer> m_prd_wh_key;
const HGTD_ID* m_hgtd_idhelper;
};
} // namespace HGTD
#endif // HGTD_RECALGS_PRDFORMATION_H
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*
* @file HGTD_PRDFormation/src/PadClusterizationAlg.cxx
* @author Alexander Leopold <alexander.leopold@cern.ch>
* @date September, 2021
* @brief
*/
#include "HGTD_PRDFormation/PadClusterizationAlg.h"
#include "HGTD_Identifier/HGTD_ID.h"
#include "StoreGate/WriteHandle.h"
namespace HGTD {
PadClusterizationAlg::PadClusterizationAlg(const std::string& name,
ISvcLocator* pSvcLocator)
: AthAlgorithm(name, pSvcLocator),
m_clusterization_tool("HGTD::SinglePadClusterTool"),
m_hgtd_idhelper(nullptr) {
declareProperty("ClusterizationTool", m_clusterization_tool);
///////
// FIXME remove these two lines in master
declareProperty("RDOContainerName", m_rdo_rh_key = "HGTD_RDOs");
declareProperty("PRDContainerName", m_prd_wh_key = "HGTD_Clusters");
///////
}
StatusCode PadClusterizationAlg::initialize() {
ATH_CHECK(m_clusterization_tool.retrieve());
ATH_CHECK(m_rdo_rh_key.initialize());
ATH_CHECK(m_prd_wh_key.initialize());
ATH_CHECK(detStore()->retrieve(m_hgtd_idhelper, "HGTD_ID"));
return StatusCode::SUCCESS;
}
StatusCode PadClusterizationAlg::execute() {
// retrieve the RDOs
SG::ReadHandle<HGTD::HGTD_RDOContainer> rdo_container_handle(m_rdo_rh_key);
const HGTD::HGTD_RDOContainer* rdo_container = rdo_container_handle.cptr();
// register the PRD container in storegate
SG::WriteHandle<HGTD::HGTD_ClusterContainer> prd_container_handle(
m_prd_wh_key);
ATH_CHECK(
prd_container_handle.record(std::make_unique<HGTD::HGTD_ClusterContainer>(
m_hgtd_idhelper->wafer_hash_max())));
HGTD::HGTD_ClusterContainer* locp_prd_container = prd_container_handle.ptr();
// Transform the RDOs collection by collection
for (const auto& rdo_collection : *rdo_container) {
if (rdo_collection->empty()) {
continue;
}
std::unique_ptr<HGTD::HGTD_ClusterCollection> prd_collection =
m_clusterization_tool->clusterize(*rdo_collection);
// can happen if some channels are masked, not really relevant currently
if (prd_collection->empty()) {
continue;
}
if (locp_prd_container
->addCollection(prd_collection.release(),
prd_collection->identifyHash())
.isFailure()) {
ATH_MSG_WARNING("Could not add ClusterCollection to container!");
}
} // END LOOP over container
return StatusCode::SUCCESS;
}
} // namespace HGTD
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*/
#include "GaudiKernel/DeclareFactoryEntries.h"
#include "HGTD_PRDFormation/PadClusterizationAlg.h"
DECLARE_NAMESPACE_ALGORITHM_FACTORY(HGTD, PadClusterizationAlg)
DECLARE_FACTORY_ENTRIES(HGTD_PRDFormation) {
DECLARE_NAMESPACE_ALGORITHM(HGTD, PadClusterizationAlg)
}
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*/
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES(HGTD_PRDFormation)
Markdown is supported
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