|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef SICLUSTERIZATIONTOOL_NnClusterizationFactory_C
6 #define SICLUSTERIZATIONTOOL_NnClusterizationFactory_C
22 #include "GaudiKernel/ToolHandle.h"
23 #include "GaudiKernel/ServiceHandle.h"
40 #include <RtypesCore.h>
41 #include <Eigen/Dense>
45 #include <string_view>
54 class LightweightGraph;
58 class NeuralNetworkToHistoTool;
63 class SiLocalPosition;
88 static const InterfaceID IID_NnClusterizationFactory(
"InDet::NnClusterizationFactory", 1, 0);
95 static const InterfaceID&
interfaceID() {
return IID_NnClusterizationFactory; };
98 const std::string&
n,
const IInterface*
p);
114 std::vector<Amg::MatrixX> &
errors,
115 int numberSubClusters)
const;
121 std::vector<Amg::MatrixX> &
errors,
122 int numberSubClusters)
const;
132 const std::vector<double>& inputData)
const;
143 const std::vector<double>& inputData,
146 int numberSubClusters,
147 std::vector<Amg::MatrixX> &
errors)
const;
156 int numberSubClusters,
157 std::vector<Amg::MatrixX> &
errors)
const;
162 double correctedRMSY(
double posPixels, std::vector<float>& pitches)
const;
167 double & tanl)
const;
172 const double tanl)
const;
188 std::vector<double>& outputY,
189 std::vector<Amg::MatrixX>& errorMatrix,
190 int nParticles)
const;
194 {
this,
"NetworkOrder", {
199 "ImpactPointErrorsX1",
200 "ImpactPointErrorsX2",
201 "ImpactPointErrorsX3",
202 "ImpactPointErrorsY1",
203 "ImpactPointErrorsY2",
204 "ImpactPointErrorsY3"},
205 "The order in which the networks will appear in the TTrainedNetworkCollection"};
212 static constexpr std::array<std::string_view, kNNetworkTypes>
s_nnTypeNames{
218 static const std::array<std::regex, kNNetworkTypes>
m_nnNames;
221 std::vector< std::vector<unsigned int> >
m_NNId{};
239 {
this,
"PixelLorentzAngleTool",
"SiLorentzAngleTool/PixelLorentzAngleTool",
"Tool to retreive Lorentz angle of Pixel"};
242 {
this,
"PixelReadoutManager",
"PixelReadoutManager",
"Pixel readout manager" };
245 {
this,
"PixelChargeCalibCondData",
"PixelChargeCalibCondData",
"Output key"};
248 {
this,
"NnCollectionReadKey",
"PixelClusterNN",
"The conditions store key for the pixel cluster NNs"};
251 {
this,
"NnCollectionWithTrackReadKey",
"PixelClusterNNWithTrack",
252 "The conditions store key for the pixel cluster NNs which needs tracks as input"};
255 {
this,
"NnCollectionJSONReadKey",
"PixelClusterNNJSON",
256 "The conditions key for the pixel cluster NNs configured via JSON file and accessed with lwtnn"};
263 {
this,
"OutputNodePos1", 7,
264 "Output node for the 1 position networks (LWTNN)"};
267 {
this,
"OutputNodePos2", { 10, 11 },
268 "List of output nodes for the 2 position network (LWTNN)"};
271 {
this,
"OutputNodePos3", { 13, 14, 15 },
272 "List of output nodes for the 3 position networks (LWTNN)"};
275 {
this,
"MaxSubClusters", 3,
"Maximum number of sub cluster supported by the networks." };
278 {
this,
"correctLorShiftBarrelWithoutTracks",0.,
"Lorentz shift correction factor when evaluating NN without track input."};
281 {
this,
"correctLorShiftBarrelWithTracks",0.,
"Lorentz shift correction factor when evaluating NN with track input."};
284 {
this,
"useToT",
true,
"Use Tot rather than charge." };
287 {
this,
"addIBL",
false,
"Also apply to clusters in IBL." };
290 {
this,
"doRunI",
false,
"Use runI style network (outputs are not normalised; add pitches; use charge if not m_useToT)"};
293 {
this,
"useTTrainedNetworks",
false,
"Use earlier (release-21-like) neural networks stored in ROOT files and accessed via TTrainedNetowrk."};
296 {
this,
"useRecenteringNNWithoutTracks",
false,
"Recenter x position when evaluating NN without track input."};
299 {
this,
"useRecenteringNNWithTracks",
false,
"Recenter x position when evaluating NN with track input."};
302 {
this,
"sizeX",7,
"Size of pixel matrix along X"};
305 {
this,
"sizeY",7,
"Size of pixel matrix along Y"};
Gaudi::Property< unsigned int > m_sizeX
Gaudi::Property< bool > m_addIBL
static constexpr std::array< unsigned int, kNNetworkTypes > m_nParticleGroup
SG::ReadCondHandleKey< PixelChargeCalibCondData > m_chargeDataKey
std::vector< double > estimateNumberOfParticles(const InDet::PixelCluster &pCluster, Amg::Vector3D &beamSpotPosition) const
Gaudi::Property< std::size_t > m_outputNodesPos1
std::vector< std::vector< unsigned int > > m_NNId
virtual StatusCode initialize() override
virtual StatusCode finalize() override
std::vector< Amg::Vector2D > estimatePositionsTTN(const TTrainedNetworkCollection &nn_collection, const std::vector< double > &inputData, const NNinput &input, const InDet::PixelCluster &pCluster, int numberSubClusters, std::vector< Amg::MatrixX > &errors) const
~NnClusterizationFactory()=default
Gaudi::Property< unsigned int > m_maxSubClusters
InputVector eigenInput(NNinput &input) const
static const std::array< std::regex, kNNetworkTypes > m_nnNames
void addTrackInfoToInput(NNinput &input, const Trk::Surface &pixelSurface, const Trk::TrackParameters &trackParsAtSurface, const double tanl) const
std::vector< Amg::Vector2D > estimatePositionsLWTNN(NnClusterizationFactory::InputVector &input, NNinput &rawInput, const InDet::PixelCluster &pCluster, int numberSubClusters, std::vector< Amg::MatrixX > &errors) const
std::vector< double >(InDet::NnClusterizationFactory::* m_assembleInput)(NNinput &input) const
std::vector< double > assembleInputRunI(NNinput &input) const
Gaudi::Property< bool > m_useTTrainedNetworks
SG::ReadCondHandleKey< LWTNNCollection > m_readKeyJSON
static double correctedRMSX(double posPixels)
std::vector< Amg::Vector2D > getPositionsFromOutput(std::vector< double > &output, const NNinput &input, const InDet::PixelCluster &pCluster) const
std::vector< Double_t > InputType
void getErrorMatrixFromOutput(std::vector< double > &outputX, std::vector< double > &outputY, std::vector< Amg::MatrixX > &errorMatrix, int nParticles) const
::StatusCode StatusCode
StatusCode definition for legacy code.
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
SG::ReadCondHandleKey< TTrainedNetworkCollection > m_readKeyWithTrack
DVec calculateNormalized(const DVec &input) const
static constexpr std::array< std::string_view, kNNetworkTypes > s_nnTypeNames
std::vector< double > estimateNumberOfParticlesTTN(const TTrainedNetworkCollection &nn_collection, const std::vector< double > &inputData) const
SG::ReadCondHandleKey< TTrainedNetworkCollection > m_readKeyWithoutTrack
Gaudi::Property< bool > m_useRecenteringNNWithTracks
NnClusterizationFactory(const std::string &name, const std::string &n, const IInterface *p)
Ensure that the ATLAS eigen extensions are properly loaded.
unsigned int m_nParticleNNId
Gaudi::Property< bool > m_useToT
double correctedRMSY(double posPixels, std::vector< float > &pitches) const
Gaudi::Property< double > m_correctLorShiftBarrelWithoutTracks
std::vector< double > estimateNumberOfParticlesLWTNN(NnClusterizationFactory::InputVector &input) const
Eigen::Matrix< double, 3, 1 > Vector3D
ToolHandle< ISiLorentzAngleTool > m_pixelLorentzAngleTool
static const InterfaceID & interfaceID()
AlgTool interface methods.
Gaudi::Property< std::vector< std::size_t > > m_outputNodesPos3
Gaudi::Property< double > m_correctLorShiftBarrelWithTracks
Gaudi::Property< unsigned int > m_sizeY
ReturnType(::TTrainedNetwork::* m_calculateOutput)(const InputType &input) const
std::vector< double > assembleInputRunII(NNinput &input) const
Gaudi::Property< bool > m_useRecenteringNNWithouTracks
Gaudi::Property< std::vector< std::string > > m_nnOrder
size_t calculateVectorDimension(const bool useTrackInfo) const
Gaudi::Property< std::vector< std::size_t > > m_outputNodesPos2
Store pixel constant parameters in PixelModuleData.
defines and typedefs for IOVSvc
Gaudi::Property< bool > m_doRunI
std::vector< Eigen::VectorXd > InputVector
std::vector< Amg::Vector2D > estimatePositions(const InDet::PixelCluster &pCluster, Amg::Vector3D &beamSpotPosition, std::vector< Amg::MatrixX > &errors, int numberSubClusters) const
setBGCode setTAP setLVL2ErrorBits bool
NNinput createInput(const InDet::PixelCluster &pCluster, Amg::Vector3D &beamSpotPosition, double &tanl) const
std::vector< Double_t > ReturnType