ATLAS Offline Software
Loading...
Searching...
No Matches
NNClusterCalibratorToolImpl.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ACTSTRACKRECONSTRUCTION_NNCLUSTERCALIBRATORTOOLIMPL_H
6#define ACTSTRACKRECONSTRUCTION_NNCLUSTERCALIBRATORTOOLIMPL_H
7
19
20namespace ActsTrk::detail {
21
22template <typename calib_data_t, typename traj_t>
24
27template <typename calib_data_t, typename traj_t>
29 std::size_t m_minClusterSizeForNN = 0;
30 double m_minClusterChargeForNN = 15000.;
32 nullptr;
33 std::unique_ptr<AnalogueClusteringCalibrator<calib_data_t, traj_t>>
35 bool isValid() const { return m_models != nullptr and m_fallback; }
36};
37
39template <typename calib_data_t, typename traj_t>
42 NNClusterCalibrator<calib_data_t, traj_t>, traj_t> {
43 public:
44 using BASE =
46 traj_t>;
47 friend BASE;
48 // using BaseOptions = BASE::Options;
50
52 Options&& options)
53 : BASE(std::move(base_options)), m_options(std::move(options)) {}
54
55 protected:
56 std::tuple<typename NNClusterCalibrator<calib_data_t, traj_t>::BASE::Pos,
58 unsigned int>
59 calibrate(const EventContext& ctx, const Acts::GeometryContext& gctx,
60 const Acts::CalibrationContext& cctx,
61 const xAOD::PixelCluster& cluster,
62 const InDetDD::SiDetectorElement& detElement,
63 const std::pair<float, float>& angles) const;
64
65 private:
69 std::tuple<int, int, int, int> clusterIndexRanges(
70 const xAOD::PixelCluster& cluster) const;
71
78 const xAOD::PixelCluster& cluster,
79 const InDetDD::PixelModuleDesign* design) const;
80
87 void fillClusterData(NNinput& nn, const xAOD::PixelCluster& cluster,
88 const InDetDD::SiDetectorElement& detElement) const;
89
93 std::array<float, 3> predictNumberOfClusters(NNinput& nn) const;
94
97
99 Ort::Session& selectPositionNetwork(int number) const;
100
102};
103
105template <typename calib_data_t, typename traj_t>
107 : public AnalogueClusteringToolImpl<calib_data_t, traj_t> {
108 public:
110 using BASE::BASE;
111
112 virtual StatusCode initialize() override;
113
114 virtual std::unique_ptr<PixelOnBoundStateCalibratorBase> create(
115 const EventContext& ctx) const override {
116 return createOnTrackCalibrator(ctx);
117 }
118 /***
119 * @brief produces configured calibrator object for this event
120 *
121 * The structure is such because the calibrator is used many times per event
122 * and it needs event context for IOV potentially
123 */
124
125 virtual std::unique_ptr<PixelOnTrackCalibratorBase<traj_t>>
126 createOnTrackCalibrator(const EventContext& ctx) const override {
127 return std::make_unique<NNClusterCalibrator<calib_data_t, traj_t>>(
129 }
130
131 private:
132
139 const EventContext& ctx) const;
140
141 Gaudi::Property<std::size_t> m_minClusterSizeForNN{
142 this, "minClusterSizeForNN", 0,
143 "Use Analogue calibrator if size is smaller that this value"};
144
145 Gaudi::Property<double> m_minClusterChargeForNN{
146 this, "minClusterChargeForNN", 0,
147 "Minimum total charge to enable NN clustering"};
148
150 this, "NnCollectionONNXReadKey", "PixelClusterNNONNX",
151 "The conditions key for ONNX-based pixel cluster NNs"};
152
153 // to bo added here is tool to interface with NN inference
154};
155
156} // namespace ActsTrk::detail
157
159
160#endif // ACTSTRACKRECONSTRUCTION_NNCLUSTERINGTOOLIMPL_H
This is an Identifier helper class for the Pixel subdetector.
the tool to create the analogue clustering calibrator.
PixelClusterCalibrationToolBase< traj_t > BASE
NNClusterCalibratorOptions< calib_data_t, traj_t > createOptions(const EventContext &ctx) const
Create a Options object This is needed to configure the per-event calibrator instances.
virtual StatusCode initialize() override
initializes this base class (must be called by the derived class)
SG::ReadCondHandleKey< OnnxNNCollection > m_readKeyONNX
virtual std::unique_ptr< PixelOnBoundStateCalibratorBase > create(const EventContext &ctx) const override
convenience class to create an OnBoundState calibrator from an OnTrack calibrator.
virtual std::unique_ptr< PixelOnTrackCalibratorBase< traj_t > > createOnTrackCalibrator(const EventContext &ctx) const override
AnalogueClusteringToolImpl< calib_data_t, traj_t > BASE
std::array< float, 3 > predictNumberOfClusters(NNinput &nn) const
obtain probabilities of number of particles using numbers NN
Ort::Session & selectPositionNetwork(int number) const
returns network appropriate for the number of sub-clusters
NNClusterCalibratorOptions< calib_data_t, traj_t > Options
InDetDD::SiCellId weightedClusterCenter(const xAOD::PixelCluster &cluster, const InDetDD::PixelModuleDesign *design) const
Calculated charge weighted cluster position.
std::tuple< int, int, int, int > clusterIndexRanges(const xAOD::PixelCluster &cluster) const
returns spans of the cluster
void fillClusterData(NNinput &nn, const xAOD::PixelCluster &cluster, const InDetDD::SiDetectorElement &detElement) const
Fills payload for NN from cluster.
NNClusterCalibrator(PixelClusterCalibratorOptionsBase &&base_options, Options &&options)
NNClusterCalibratorOptions< calib_data_t, traj_t > m_options
std::tuple< typename NNClusterCalibrator< calib_data_t, traj_t >::BASE::Pos, typename NNClusterCalibrator< calib_data_t, traj_t >::BASE::Cov, unsigned int > calibrate(const EventContext &ctx, const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const xAOD::PixelCluster &cluster, const InDetDD::SiDetectorElement &detElement, const std::pair< float, float > &angles) const
PixelClusterCalibratorBase< NNClusterCalibrator< calib_data_t, traj_t >, traj_t > BASE
PositionNNoutput predictPositions(NNinput &nn, int number) const
run position inference
PixelClusterCalibratorOptionsBase createBaseOptions(const EventContext &) const
create options needed by the calibrator base class.
Class used to describe the design of a module (diode segmentation and readout scheme).
Identifier for the strip or pixel cell.
Definition SiCellId.h:29
Class to hold geometrical description of a silicon detector element.
Hash functions to pack the source link into unordered_maps / unordered_sets.
STL namespace.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
Options for the NN clustering calibrator that is kind of Analogue calibrator.
double m_minClusterChargeForNN
! minimum number of hits to run NN
std::unique_ptr< AnalogueClusteringCalibrator< calib_data_t, traj_t > > m_fallback
! set of models for inference (non owning pointer)
the base options the options of the options of every PixelClusterCalibrator must be based on
std::string number(const double &d, const std::string &s)
Definition utils.cxx:186