ATLAS Offline Software
Loading...
Searching...
No Matches
UTPCMMClusterBuilderTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef UTPCMMClusterBuilderTool_h
5#define UTPCMMClusterBuilderTool_h
6
7#include <tuple>
8
13#include "GaudiKernel/SystemOfUnits.h"
14#include "TF1.h"
15#include "TFitResult.h"
16#include "TFitResultPtr.h"
17#include "TGraphErrors.h"
18#include "TH2D.h"
19#include "TLinearFitter.h"
20#include "TMatrixDSym.h"
21
22//
23// Simple clusterization tool for MicroMegas
24//
25namespace Muon {
26
28 public:
30 UTPCMMClusterBuilderTool(const std::string&, const std::string&, const IInterface*);
31
33 virtual ~UTPCMMClusterBuilderTool() = default;
34
36 virtual StatusCode initialize() override;
37
38 virtual StatusCode getClusters(const EventContext& ctx,
39 std::vector<Muon::MMPrepData>&& stripsVect,
40 std::vector<std::unique_ptr<Muon::MMPrepData>>& clustersVect) const override;
41
42 virtual RIO_Author getCalibratedClusterPosition(const EventContext& ctx,
43 const std::vector<NSWCalib::CalibratedStrip>& calibratedStrips,
44 const Amg::Vector3D& directionEstimate,
45 Amg::Vector2D& clusterLocalPosition,
46 Amg::MatrixX& covMatrix) const override;
47
48 private:
49 using LaySortedPrds = std::array<std::vector<Muon::MMPrepData>, 8>;
51 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
52
53 Gaudi::Property<bool> m_writeStripProperties{this, "writeStripProperties", true };
54
55 // params for the hough trafo
56 Gaudi::Property<double> m_alphaMin{this, "HoughAlphaMin", -90. };
57 Gaudi::Property<double> m_alphaMax{this, "HoughAlphaMax", 0. };
58 Gaudi::Property<double> m_alphaResolution{this, "HoughAlphaResolution", 1.};
59 Gaudi::Property<double> m_selectionCut{this, "HoughSelectionCut", 1. * Gaudi::Units::mm};
60 Gaudi::Property<double> m_dMin{this, "HoughDMin", 0.};
61 Gaudi::Property<double> m_dMax {this, "HoughDMax", 0.};
62 Gaudi::Property<double> m_dResolution{this, "HoughDResolution", 0.125};
63 Gaudi::Property<double> m_driftRange{this, "HoughExpectedDriftRange", 12.*Gaudi::Units::m};
64 Gaudi::Property<unsigned> m_houghMinCounts{this, "HoughMinCounts", 3};
65
67 Gaudi::Property<double> m_outerChargeRatioCut{this,"outerChargeRatioCut", 0.};
68 // max number of strips cut by cross talk cut
69 Gaudi::Property<int> m_maxStripsCut{this, "maxStripRemove", 4};
70
71 Gaudi::Property<bool> m_digiHasNegativeAngles{this, "digiHasNegativeAngle", true};
72
73 StatusCode runHoughTrafo(const std::vector<Muon::MMPrepData>& mmPrd, std::vector<double>& xpos, std::vector<int>& flag,
74 std::vector<int>& idx_selected) const;
75 StatusCode fillHoughTrafo(const std::vector<Muon::MMPrepData>& mmPrd, std::vector<double>& xpos, std::vector<int>& flag,
76 std::unique_ptr<TH2D>& h_hough) const;
77 StatusCode houghInitCummulator(std::unique_ptr<TH2D>& cummulator, double xmax, double xmin) const;
78
79 StatusCode findAlphaMax(std::unique_ptr<TH2D>& h_hough, std::vector<std::tuple<double, double>>& maxPos) const;
80 StatusCode selectTrack(const std::vector<Muon::MMPrepData>& mmPrd, std::vector<double>& xpos, std::vector<int>& flag,
81 std::vector<std::tuple<double, double>>& tracks, std::vector<int>& idxGoodStrips) const;
82
83 StatusCode transformParameters(double alpha, double d, double dRMS, double& slope, double& intercept, double& interceptRMS) const;
84 StatusCode applyCrossTalkCut(std::vector<int>& idxSelected, const std::vector<MMPrepData>& MMPrdsOfLayer, std::vector<int>& flag,
85 int& nStripsCut) const;
86 StatusCode finalFit(const std::vector<Identifier>& ids, const std::vector<float>& stripsPos, const std::vector<float>& driftDists,
87 const std::vector<AmgVector(2)>& driftDistErrors, double& x0, double& sigmaX0, double& fitAngle,
88 double& chiSqProb) const;
89 };
90
91} // namespace Muon
92#endif
#define AmgVector(rows)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
MMClusterOnTrack::Author RIO_Author
Refinement of the cluster position after the cluster calibration loop is ran with a complete external...
StatusCode findAlphaMax(std::unique_ptr< TH2D > &h_hough, std::vector< std::tuple< double, double > > &maxPos) const
Gaudi::Property< double > m_alphaResolution
Gaudi::Property< double > m_driftRange
Gaudi::Property< bool > m_digiHasNegativeAngles
StatusCode selectTrack(const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::vector< std::tuple< double, double > > &tracks, std::vector< int > &idxGoodStrips) const
Gaudi::Property< double > m_outerChargeRatioCut
charge ratio cut to supress cross talk
virtual StatusCode initialize() override
standard initialize method
Gaudi::Property< double > m_selectionCut
UTPCMMClusterBuilderTool(const std::string &, const std::string &, const IInterface *)
Default constructor.
StatusCode transformParameters(double alpha, double d, double dRMS, double &slope, double &intercept, double &interceptRMS) const
virtual RIO_Author getCalibratedClusterPosition(const EventContext &ctx, const std::vector< NSWCalib::CalibratedStrip > &calibratedStrips, const Amg::Vector3D &directionEstimate, Amg::Vector2D &clusterLocalPosition, Amg::MatrixX &covMatrix) const override
virtual ~UTPCMMClusterBuilderTool()=default
Default destructor.
StatusCode runHoughTrafo(const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::vector< int > &idx_selected) const
Gaudi::Property< unsigned > m_houghMinCounts
Gaudi::Property< bool > m_writeStripProperties
StatusCode applyCrossTalkCut(std::vector< int > &idxSelected, const std::vector< MMPrepData > &MMPrdsOfLayer, std::vector< int > &flag, int &nStripsCut) const
virtual StatusCode getClusters(const EventContext &ctx, std::vector< Muon::MMPrepData > &&stripsVect, std::vector< std::unique_ptr< Muon::MMPrepData > > &clustersVect) const override
Standard Interface to produce Micromega clusters from raw Input hits without external contstaint.
StatusCode finalFit(const std::vector< Identifier > &ids, const std::vector< float > &stripsPos, const std::vector< float > &driftDists, const std::vector< AmgVector(2)> &driftDistErrors, double &x0, double &sigmaX0, double &fitAngle, double &chiSqProb) const
Gaudi::Property< double > m_dResolution
StatusCode houghInitCummulator(std::unique_ptr< TH2D > &cummulator, double xmax, double xmin) const
StatusCode fillHoughTrafo(const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::unique_ptr< TH2D > &h_hough) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Muon Detector Descriptor.
std::array< std::vector< Muon::MMPrepData >, 8 > LaySortedPrds
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.