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,
64 const Acts::Vector2& predicted_local_position) const;
65
66 private:
70 std::tuple<int, int, int, int> clusterIndexRanges(
71 const xAOD::PixelCluster& cluster) const;
72
79 const xAOD::PixelCluster& cluster,
80 const InDetDD::PixelModuleDesign* design) const;
81
88 void fillClusterData(NNinput& nn, const xAOD::PixelCluster& cluster,
89 const InDetDD::SiDetectorElement& detElement) const;
90
94 std::array<float, 3> predictNumberOfClusters(NNinput& nn) const;
95
98
100 Ort::Session& selectPositionNetwork(int number) const;
101
103};
104
106template <typename calib_data_t, typename traj_t>
108 : public AnalogueClusteringToolImpl<calib_data_t, traj_t> {
109 public:
111 using BASE::BASE;
112
113 virtual StatusCode initialize() override;
114
115 virtual std::unique_ptr<PixelOnBoundStateCalibratorBase> create(
116 const EventContext& ctx) const override {
117 return createOnTrackCalibrator(ctx);
118 }
119 /***
120 * @brief produces configured calibrator object for this event
121 *
122 * The structure is such because the calibrator is used many times per event
123 * and it needs event context for IOV potentially
124 */
125
126 virtual std::unique_ptr<PixelOnTrackCalibratorBase<traj_t>>
127 createOnTrackCalibrator(const EventContext& ctx) const override {
128 return std::make_unique<NNClusterCalibrator<calib_data_t, traj_t>>(
130 }
131
132 private:
133
140 const EventContext& ctx) const;
141
142 Gaudi::Property<std::size_t> m_minClusterSizeForNN{
143 this, "minClusterSizeForNN", 0,
144 "Use Analogue calibrator if size is smaller that this value"};
145
146 Gaudi::Property<double> m_minClusterChargeForNN{
147 this, "minClusterChargeForNN", 0,
148 "Minimum total charge to enable NN clustering"};
149
151 this, "NnCollectionONNXReadKey", "PixelClusterNNONNX",
152 "The conditions key for ONNX-based pixel cluster NNs"};
153
154 // to bo added here is tool to interface with NN inference
155};
156
157} // namespace ActsTrk::detail
158
160
161#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
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 Acts::Vector2 &predicted_local_position) const
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
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