ATLAS Offline Software
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 //
25 namespace 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
Muon::UTPCMMClusterBuilderTool::m_alphaMax
Gaudi::Property< double > m_alphaMax
Definition: UTPCMMClusterBuilderTool.h:57
Muon::UTPCMMClusterBuilderTool::m_writeStripProperties
Gaudi::Property< bool > m_writeStripProperties
Definition: UTPCMMClusterBuilderTool.h:53
Muon::UTPCMMClusterBuilderTool::m_dResolution
Gaudi::Property< double > m_dResolution
Definition: UTPCMMClusterBuilderTool.h:62
Muon::UTPCMMClusterBuilderTool::applyCrossTalkCut
StatusCode applyCrossTalkCut(std::vector< int > &idxSelected, const std::vector< MMPrepData > &MMPrdsOfLayer, std::vector< int > &flag, int &nStripsCut) const
Definition: UTPCMMClusterBuilderTool.cxx:348
Muon::UTPCMMClusterBuilderTool::m_dMin
Gaudi::Property< double > m_dMin
Definition: UTPCMMClusterBuilderTool.h:60
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Muon::UTPCMMClusterBuilderTool::m_driftRange
Gaudi::Property< double > m_driftRange
Definition: UTPCMMClusterBuilderTool.h:63
Muon::UTPCMMClusterBuilderTool::finalFit
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
Definition: UTPCMMClusterBuilderTool.cxx:388
Muon::UTPCMMClusterBuilderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Muon Detector Descriptor.
Definition: UTPCMMClusterBuilderTool.h:51
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Muon::UTPCMMClusterBuilderTool::~UTPCMMClusterBuilderTool
virtual ~UTPCMMClusterBuilderTool()=default
Default destructor.
hist_file_dump.d
d
Definition: hist_file_dump.py:137
Muon::UTPCMMClusterBuilderTool::LaySortedPrds
std::array< std::vector< Muon::MMPrepData >, 8 > LaySortedPrds
Definition: UTPCMMClusterBuilderTool.h:49
Muon::UTPCMMClusterBuilderTool
Definition: UTPCMMClusterBuilderTool.h:27
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::UTPCMMClusterBuilderTool::m_houghMinCounts
Gaudi::Property< unsigned > m_houghMinCounts
Definition: UTPCMMClusterBuilderTool.h:64
Muon::UTPCMMClusterBuilderTool::transformParameters
StatusCode transformParameters(double alpha, double d, double dRMS, double &slope, double &intercept, double &interceptRMS) const
Definition: UTPCMMClusterBuilderTool.cxx:338
Muon::IMMClusterBuilderTool
Definition: IMMClusterBuilderTool.h:22
Muon::UTPCMMClusterBuilderTool::selectTrack
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
Definition: UTPCMMClusterBuilderTool.cxx:277
Muon::UTPCMMClusterBuilderTool::m_alphaMin
Gaudi::Property< double > m_alphaMin
Definition: UTPCMMClusterBuilderTool.h:56
Muon::UTPCMMClusterBuilderTool::m_selectionCut
Gaudi::Property< double > m_selectionCut
Definition: UTPCMMClusterBuilderTool.h:59
xmin
double xmin
Definition: listroot.cxx:60
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::covMatrix
covMatrix
Definition: TrackMeasurement_v1.cxx:19
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
master.flag
bool flag
Definition: master.py:29
AthAlgTool.h
MMPrepData.h
Muon::UTPCMMClusterBuilderTool::getClusters
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.
Definition: UTPCMMClusterBuilderTool.cxx:40
Muon::UTPCMMClusterBuilderTool::UTPCMMClusterBuilderTool
UTPCMMClusterBuilderTool(const std::string &, const std::string &, const IInterface *)
Default constructor.
Definition: UTPCMMClusterBuilderTool.cxx:30
Muon::UTPCMMClusterBuilderTool::findAlphaMax
StatusCode findAlphaMax(std::unique_ptr< TH2D > &h_hough, std::vector< std::tuple< double, double >> &maxPos) const
Definition: UTPCMMClusterBuilderTool.cxx:256
Muon::UTPCMMClusterBuilderTool::m_alphaResolution
Gaudi::Property< double > m_alphaResolution
Definition: UTPCMMClusterBuilderTool.h:58
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
Muon::UTPCMMClusterBuilderTool::m_outerChargeRatioCut
Gaudi::Property< double > m_outerChargeRatioCut
charge ratio cut to supress cross talk
Definition: UTPCMMClusterBuilderTool.h:67
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
Muon::UTPCMMClusterBuilderTool::m_dMax
Gaudi::Property< double > m_dMax
Definition: UTPCMMClusterBuilderTool.h:61
Muon::UTPCMMClusterBuilderTool::fillHoughTrafo
StatusCode fillHoughTrafo(const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::unique_ptr< TH2D > &h_hough) const
Definition: UTPCMMClusterBuilderTool.cxx:242
xmax
double xmax
Definition: listroot.cxx:61
IMMClusterBuilderTool.h
Muon::UTPCMMClusterBuilderTool::m_maxStripsCut
Gaudi::Property< int > m_maxStripsCut
Definition: UTPCMMClusterBuilderTool.h:69
AthAlgTool
Definition: AthAlgTool.h:26
Muon::UTPCMMClusterBuilderTool::houghInitCummulator
StatusCode houghInitCummulator(std::unique_ptr< TH2D > &cummulator, double xmax, double xmin) const
Definition: UTPCMMClusterBuilderTool.cxx:225
Muon::UTPCMMClusterBuilderTool::getCalibratedClusterPosition
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
Definition: UTPCMMClusterBuilderTool.cxx:463
Muon::UTPCMMClusterBuilderTool::m_digiHasNegativeAngles
Gaudi::Property< bool > m_digiHasNegativeAngles
Definition: UTPCMMClusterBuilderTool.h:71
Muon::MMClusterOnTrack::Author
Author
Definition: MMClusterOnTrack.h:89
Muon::UTPCMMClusterBuilderTool::initialize
virtual StatusCode initialize() override
standard initialize method
Definition: UTPCMMClusterBuilderTool.cxx:35
IMuonIdHelperSvc.h
Muon::UTPCMMClusterBuilderTool::runHoughTrafo
StatusCode runHoughTrafo(const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::vector< int > &idx_selected) const
Definition: UTPCMMClusterBuilderTool.cxx:204
ServiceHandle< Muon::IMuonIdHelperSvc >