Commit 55956ed6 authored by Alexander Leopold's avatar Alexander Leopold Committed by Tadej Novak
Browse files

HGTD cluster maker tools - 2nd try

parent a3c65c91
################################################################################
# Package: HGTD_PadClusterizationTools
################################################################################
# Declare the package name:
atlas_subdir( HGTD_PadClusterizationTools )
# Component(s) in the package:
atlas_add_component( HGTD_PadClusterizationTools
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps GaudiKernel
HGTD_RecToolInterfaces HGTD_PrepRawData)
# Install files from the package:
atlas_install_headers( HGTD_PadClusterizationTools )
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*
* @file HGTD_ClusterMakerTools/HGTD_ClusterMakerTool.h
* @author Alexander Leopold <alexander.leopold@cern.ch>
* @date August, 2021
*
* @brief Creates HGTD_Cluster objects from the pre-processed raw data
* information. The clustering itself happens outside of this tool, it just
* combines the information into a HGTD_Cluster object.
*
* TODO:
* - The resolution of the TOA is currently fixed to 35ps. This is radius and
* luminosity dependent and should be set via a dedicated tool!
*/
#ifndef HGTD_CLUSTERMAKERTOOL_H
#define HGTD_CLUSTERMAKERTOOL_H
#include "AthenaBaseComps/AthAlgTool.h"
#include "HGTD_PrepRawData/HGTD_Cluster.h"
#include <memory>
namespace HGTD {
class HGTD_ClusterMakerTool : public AthAlgTool {
public:
HGTD_ClusterMakerTool(const std::string&, const std::string&,
const IInterface*);
virtual ~HGTD_ClusterMakerTool();
/**
* @brief Builds a HGTD_Cluster.
*
* @param [in] rdo_id Identifier of the Cluster, retrieved from centroid
* position in case more than one pads are contained in the cluster.
* @param [in] loc_pos local position of the cluster
* @param [in] rdo_list RDO identifiers of the pads included in the cluster.
* @param [in] width SiWidth information of the full cluster.
* @param [in] det_el Detector element (module) the RDOs were found on.
* @param [in] time_of_arrival Time of arrival assigned to the cluster.
* @param [in] time_over_threshold TOT of each of the cluster components.
*
* @return Pointer to a HGTD_Cluster, owned by caller.
*/
virtual std::unique_ptr<HGTD_Cluster>
createCluster(const Identifier& rdo_id, const Amg::Vector2D& loc_pos,
const std::vector<Identifier>& rdo_list,
const InDet::SiWidth& width,
const InDetDD::SolidStateDetectorElementBase* det_el,
const float time_of_arrival,
const std::vector<int>& time_over_threshold) const;
};
} // namespace HGTD
#endif // HGTD_CLUSTERMAKERTOOL_H
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*
* @file HGTD_ClusterMakerTools/SinglePadClusterTool.h
* @author Alexander Leopold <alexander.leopold@cern.ch>
* @date August, 2021
*
* @brief Translates HGTD_RDO objects of a given detector element into
* HGTD_PrepRawData clusters. Since currently no or only very small crosstalk
* between neighbouring pixels of LGAD sensors is expected, a single RDO gets
* translated directly into a HGTD_Cluster.
*
*/
#ifndef HGTD_SINGLEPADCLUSTERTOOL_H
#define HGTD_SINGLEPADCLUSTERTOOL_H
#include "AthenaBaseComps/AthAlgTool.h"
#include "HGTD_RecToolInterfaces/IHGTD_PadClusterizationTool.h"
#include "HGTD_PadClusterizationTools/HGTD_ClusterMakerTool.h"
#include <memory>
class HGTD_DetectorManager;
namespace HGTD {
class SinglePadClusterTool : public AthAlgTool,
virtual public IHGTD_PadClusterizationTool {
public:
SinglePadClusterTool(const std::string& type, const std::string& name,
const IInterface* parent);
virtual ~SinglePadClusterTool() {}
virtual StatusCode initialize();
virtual std::unique_ptr<HGTD::HGTD_ClusterCollection>
clusterize(const HGTD::HGTD_RDOCollection& rdo_coll) const override;
private:
ToolHandle<HGTD_ClusterMakerTool> m_cluster_maker;
const HGTD_DetectorManager* m_hgtd_det_mgr;
};
} // namespace HGTD
#endif // HGTD_SINGLEPADCLUSTERTOOL_H
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*
* @file HGTD_ClusterMakerTools/src/HGTD_ClusterMakerTool.cxx
* @author Alexander Leopold <alexander.leopold@cern.ch>
* @date August, 2021
*
* @brief
*/
#include "HGTD_PadClusterizationTools/HGTD_ClusterMakerTool.h"
#include "HGTD_PrepRawData/HGTD_Cluster.h"
// usable in the current file only
namespace {
inline double square(const double x) { return x * x; }
constexpr double g_one_over_twelve = 1. / 12.;
} // namespace
HGTD::HGTD_ClusterMakerTool::HGTD_ClusterMakerTool(const std::string& t,
const std::string& n,
const IInterface* p)
: AthAlgTool(t, n, p) {}
HGTD::HGTD_ClusterMakerTool::~HGTD_ClusterMakerTool() {}
std::unique_ptr<HGTD::HGTD_Cluster> HGTD::HGTD_ClusterMakerTool::createCluster(
const Identifier& rdo_id, const Amg::Vector2D& loc_pos,
const std::vector<Identifier>& rdo_list, const InDet::SiWidth& width,
const InDetDD::SolidStateDetectorElementBase* det_el,
const float time_of_arrival,
const std::vector<int>& time_over_threshold) const {
Amg::MatrixX* loc_err_matx = new Amg::MatrixX(2, 2);
loc_err_matx->setIdentity();
// HGTD pixels are 1.3x1.3 mm2, using phiR and z methods for
// consistency with other code
loc_err_matx->fillSymmetric(0, 0, square(width.phiR()) * g_one_over_twelve);
loc_err_matx->fillSymmetric(1, 1, square(width.z()) * g_one_over_twelve);
// time_of_arrival_err
// FIXME: to define the expected time resolution, I should have a service that
// tells me which resolution I expect, depending on the radius and after
// the current integrated luminosity
float time_of_arrival_err =
0.035; // 35 pico second resolution at start of operation, given in nano
// seconds in ATHENA
return std::make_unique<HGTD::HGTD_Cluster>(
rdo_id, loc_pos, rdo_list, width, det_el, loc_err_matx, time_of_arrival,
time_of_arrival_err, time_over_threshold);
}
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*
* @file HGTD_ClusterMakerTools/src/SinglePadClusterTool.cxx
* @author Alexander Leopold <alexander.leopold@cern.ch>
* @date August, 2021
*
* @brief
*
*/
#include "HGTD_PadClusterizationTools/SinglePadClusterTool.h"
#include "HGTD_ReadoutGeometry/HGTD_DetectorManager.h"
namespace HGTD {
SinglePadClusterTool::SinglePadClusterTool(const std::string& type,
const std::string& name,
const IInterface* parent)
: AthAlgTool(type, name, parent),
m_cluster_maker(nullptr),
m_hgtd_det_mgr(nullptr) {}
StatusCode SinglePadClusterTool::initialize() {
ATH_CHECK(AlgTool::initialize());
ATH_CHECK(m_cluster_maker.retrieve());
ATH_CHECK(detStore()->retrieve(m_hgtd_det_mgr, "HGTD"));
return StatusCode::SUCCESS;
}
std::unique_ptr<HGTD::HGTD_ClusterCollection>
SinglePadClusterTool::clusterize(const HGTD_RDOCollection& rdo_coll) const {
Identifier identifier = rdo_coll.identify();
IdentifierHash id_hash = rdo_coll.identifierHash();
std::unique_ptr<HGTD::HGTD_ClusterCollection> cluster_collection =
std::make_unique<HGTD::HGTD_ClusterCollection>(id_hash);
cluster_collection->setIdentifier(identifier);
cluster_collection->reserve(rdo_coll.size());
InDetDD::HGTD_DetectorElement* element =
m_hgtd_det_mgr->getDetectorElement(identifier);
for (const auto& rdo : rdo_coll) {
Identifier rdo_id = rdo->identify();
ATH_MSG_DEBUG("Using RDO: " << rdo_id);
// get the local position from the detector design
InDetDD::SiCellId si_cell_id = element->cellIdFromIdentifier(rdo_id);
const HGTD_ModuleDesign& det_design = element->design();
InDetDD::SiLocalPosition si_pos =
det_design.localPositionOfCell(si_cell_id);
Amg::Vector2D loc_pos(si_pos.xPhi(), si_pos.xEta());
ATH_MSG_DEBUG("Local position: x=" << loc_pos.x() << " y=" << loc_pos.y());
// a cluster consists only of the pad itself
std::vector<Identifier> rdo_list = {rdo_id};
// From SiWidth header:
// Constructor with parameters: <col, row> in units of RDOs (so should be
// int),
// <phiR width in mm, Z width in mm>
// NOTE: without a clustering of the pads, the width of each "cluster" is 1
// in col and row direction
int col_width = 1;
int row_width = 1;
double eta_width = det_design.etaPitch();
double phi_width = det_design.phiPitch();
ATH_MSG_DEBUG("eta_width=" << eta_width << " phi_width=" << phi_width);
InDet::SiWidth si_width(Amg::Vector2D(col_width, row_width),
Amg::Vector2D(phi_width, eta_width));
// retrieve the time of arrival
float time_of_arrival = rdo->getTOA();
// this would hold the vector of all cluster components. Only size 1 if RDO
// gets transformed to cluster directly
std::vector<int> time_over_threshold = {static_cast<int>(rdo->getTOT())};
std::unique_ptr<HGTD::HGTD_Cluster> cluster =
m_cluster_maker->createCluster(rdo_id, loc_pos, rdo_list, si_width,
element, time_of_arrival,
time_over_threshold);
cluster->setHashAndIndex(cluster_collection->identifyHash(),
cluster_collection->size());
cluster_collection->push_back(cluster.release());
}
return cluster_collection;
}
} // namespace HGTD
#include "GaudiKernel/DeclareFactoryEntries.h"
#include "HGTD_PadClusterizationTools/HGTD_ClusterMakerTool.h"
using namespace HGTD;
DECLARE_TOOL_FACTORY(HGTD_ClusterMakerTool)
DECLARE_FACTORY_ENTRIES( HGTD_PadClusterizationTools )
{
DECLARE_TOOL( HGTD_ClusterMakerTool )
}
#include "GaudiKernel/DeclareFactoryEntries.h"
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES(HGTD_ClusterMakerTool)
......@@ -8,4 +8,5 @@ atlas_subdir( HGTD_RecToolInterfaces )
# Component(s) in the package:
atlas_add_library( HGTD_RecToolInterfaces
PUBLIC_HEADERS HGTD_RecToolInterfaces
LINK_LIBRARIES Identifier GaudiKernel)
LINK_LIBRARIES Identifier GaudiKernel HGTD_ReadoutGeometry
HGTD_Identifier HGTD_RawData HGTD_PrepRawData)
/**
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
*
* @file HGTD_RecToolInterfaces/IHGTD_ClusterMakerTool.h
* @author Alexander Leopold <alexander.leopold@cern.ch>
* @date August, 2021
*
* @brief To use hits found in HGTD in reconstruction, the raw data objects
* (RDOs) need to be transformed into "HGTD_PrepRawData" objects. In general,
* adjacent hits on an LGAD could originate from the same energy deposit. This
* charge sharing is expected to be negligible, but via the interfaces different
* ways of handling the transformation and applying clustering algorithms can be
* implemented.
*/
#ifndef IHGTD_CLUSTERMAKERTOOL_H
#define IHGTD_CLUSTERMAKERTOOL_H
#include "GaudiKernel/AlgTool.h"
#include "HGTD_Identifier/HGTD_ID.h"
#include "HGTD_PrepRawData/HGTD_ClusterCollection.h"
#include "HGTD_RawData/HGTD_RDOCollection.h"
#include "HGTD_ReadoutGeometry/HGTD_DetectorManager.h"
#include <memory>
class MsgStream;
namespace HGTD {
static const InterfaceID
IID_IHGTD_PadClusterizationTool("HGTD::IHGTD_PadClusterizationTool", 1, 0);
class IHGTD_PadClusterizationTool : virtual public IAlgTool {
public:
static const InterfaceID& interfaceID();
/**
* @brief Processes raw data objects on a HGTD module into tracking input.
*
* @param [in] rdo_collection RDOs found on a given detector element.
*
* @return The collection of clusters built from the RDOs.
*/
virtual std::unique_ptr<HGTD::HGTD_ClusterCollection>
clusterize(const HGTD::HGTD_RDOCollection& rdo_collection) const = 0;
};
/** Inline methods **/
inline const InterfaceID& IHGTD_PadClusterizationTool::interfaceID() {
return IID_IHGTD_PadClusterizationTool;
}
} // namespace HGTD
#endif // IHGTD_CLUSTERMAKERTOOL_H
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