ATLAS Offline Software
Loading...
Searching...
No Matches
MuonHoughPatternTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONHOUGHPATTERNTOOLS_MUONHOUGHPATTERNTOOL_H
6#define MUONHOUGHPATTERNTOOLS_MUONHOUGHPATTERNTOOL_H
7
8#include <TFile.h>
9#include <TH2.h>
10
14
17
19public:
21 MuonHoughPatternTool(const std::string& type, const std::string& name, const IInterface* parent);
23 virtual ~MuonHoughPatternTool() = default;
24
26 virtual void makePatterns(const MuonHoughHitContainer& hitcontainer, MuonHoughPatternContainerShip& houghpatterns) const override;
27
29 virtual StatusCode initialize() override;
30
32 virtual StatusCode finalize() override;
33
35 virtual std::unique_ptr<MuonPrdPatternCollection> getPhiMuonPatterns(MuonHoughPatternContainerShip& houghpatterns) const override;
37 virtual std::unique_ptr<MuonPrdPatternCollection> getEtaMuonPatterns(MuonHoughPatternContainerShip& houghpatterns) const override;
38
40 virtual MuonHoughPatternContainerShip emptyHoughPattern() const override;
41
42private:
44 void makePatterns(int id_number, double weightmdt, const MuonHoughHitContainer& event,
45 MuonHoughPatternContainerShip& houghpatterns) const;
46
48 std::unique_ptr<MuonPrdPatternCollection> getCurvedMuonPatterns(MuonHoughPatternContainerShip& houghpatterns) const;
49
51 static void resetAssociation(const MuonHoughHitContainer& event);
52
54 void useIPMuons();
55
63 bool analyseHisto(int id_number, int level, const std::unique_ptr<MuonHoughHitContainer>& event_to_analyse,
64 std::unique_ptr<MuonHoughTransformSteering>& houghtransform, MuonHoughPatternContainerShip& houghpatterns) const;
65
67 static bool hitsLeft(const MuonHoughHitContainer& event);
68
70 int numberOfHits(const MuonHoughHitContainer& event) const;
71
73 bool hitInHoughPattern(const std::shared_ptr<MuonHoughHit>& hit, const MuonHoughPatternContainer& houghpattern) const;
74
76 static std::unique_ptr<MuonHoughHitContainer> hitsNotInPattern(const MuonHoughHitContainer& event, int id_number);
77
79 void weightRescaling(const MuonHoughHitContainer& event, int id_number, int level) const;
80
82 void calculateWeights(const MuonHoughHitContainer& event, double weightmdt) const;
83
85 int overlapHoughPatterns(const MuonHoughPattern& houghpattern1, const MuonHoughPattern& houghpattern2) const;
86
88 std::unique_ptr<MuonHoughHitContainer> whichEventHough(int id, const MuonHoughHitContainer& event, double weightmdt) const;
89
91 std::unique_ptr<MuonHoughHitContainer> whichEventAssociation(int id, const MuonHoughHitContainer& event) const;
92
94 std::unique_ptr<MuonHoughTransformSteering> whichHoughTransform(int id) const;
95
97 std::vector<int> maxLevelHoughPattern(const MuonHoughPatternContainerShip& houghpattern) const;
98
101 int maxLevelHoughPattern(const MuonHoughPatternContainerShip& houghpattern, int id_number) const;
102
104 static void transformCoordsMaximum(std::pair<double, double>& coordsmaximum, double r0_true) ;
105
107 std::unique_ptr<Muon::MuonPrdPattern> houghPatternToEtaPattern(const MuonHoughPattern& houghpattern) const;
109 std::unique_ptr<Muon::MuonPrdPattern> houghPatternToPhiPattern(const MuonHoughPattern& houghpattern) const;
111 std::unique_ptr<Muon::MuonPrdPattern> houghPatternsToOneEtaPattern(const MuonHoughPattern& houghpattern1,
112 const MuonHoughPattern& houghpattern2) const;
114 std::unique_ptr<Muon::MuonPrdPattern> houghPatternsToOnePhiPattern(const MuonHoughPattern& houghpattern1,
115 const MuonHoughPattern& houghpattern2) const;
117 std::unique_ptr<Muon::MuonPrdPattern> houghPatternToCleanPhiPattern(MuonHoughPattern& houghpattern) const;
118
120 unsigned int getThresholdHoughPattern(int id_number) const;
122 double getThresholdHisto(int id_number) const;
123
125 void setWeightMdtCutValue(const MuonHoughHitContainer& event, double& weightmdt) const;
126
128 bool hitThroughCut(const std::shared_ptr<MuonHoughHit>& hit, double weightmdt) const;
129
131 std::unique_ptr<TFile> m_file;
134
136 Gaudi::Property<bool> m_use_histos{this, "UseHistos", false};
138 Gaudi::Property<bool> m_use_cosmics{this, "UseCosmics", false};
140 Gaudi::Property<bool> m_use_csc_in_pattern{this, "UseCscInPattern", true};
142 Gaudi::Property<bool> m_use_csc_in_hough{this, "UseCscInHough", true};
144 Gaudi::Property<bool> m_use_negative_weights{this, "UseNegativeWeights", false};
146 Gaudi::Property<bool> m_use_curvedhough{this, "UseCurvedHough", true};
147
150
152 Gaudi::Property<int> m_number_of_maxima{this, "NumberOfMaximaPerIterations", 5};
153
155 // const bool m_use_rpc_measures_phi;
157 static constexpr bool m_use_rpc_measures_eta{true};
159 bool m_use_ip{false};
160
162 Gaudi::Property<unsigned int> m_thresholdpattern_xyz{this, "SetThresholdPatternRPhi", 1};
164 Gaudi::Property<unsigned int> m_thresholdpattern_rz{this, "SetThresholdPatternREta", 3};
165
166 // hittosegment association:
167
169 static constexpr double m_maximum_residu_mm{500.};
171 static constexpr double m_maximum_residu_mm_cosmics{2000.};
173 static constexpr double m_maximum_residu_angle{3.};
174
176 static constexpr int m_maximum_level{5};
177 // for hough_correction:
181 // const bool m_use_hough_correction;
183 static constexpr double m_z_cor_constant{-10000.};
185 static constexpr double m_z_cor_constant2{6000.};
187 static constexpr double m_theta_cor_constant{-0.042};
189 static constexpr double m_theta_cor_constant2{4000.};
190
191 // detectorsizes:
192
200 static constexpr double m_detectorsize_xy_full{15000.};
202 static constexpr double m_detectorsize_yz_full{25000.};
204 static constexpr double m_detectorsize_rz_full{27750.};
205
207 static constexpr double m_detectorsize_xy_ip{600.};
209 static constexpr double m_detectorsize_yz_ip{1000.};
211 static constexpr double m_detectorsize_rz_ip{1500.};
212
214 static constexpr double m_detectorsize_angle_xyz{360.};
216 static constexpr double m_detectorsize_angle_rz{180.};
218 // const double m_detectorsize_inv_sqrt_curvature;
219
220 // properties of histograms:
221
223 static constexpr double m_stepsize_xy{75.};
225 static constexpr double m_stepsize_yz{250.};
227 static constexpr double m_stepsize_rz{75.};
229 static constexpr double m_stepsize_xy_cosmics{150.};
231 static constexpr double m_stepsize_rz_cosmics{150.};
233 static constexpr double m_stepsize_per_angle_xyz{0.25};
235 static constexpr double m_stepsize_per_angle_rz{0.25};
237 static constexpr double m_stepsize_per_angle_xy_cosmics{1.};
239 static constexpr double m_stepsize_per_angle_rz_cosmics{2.};
241 // const double m_stepsize_per_inv_sqrt_curvature;
242
244 static constexpr int m_nbins_curved{160};
245
247 Gaudi::Property<bool> m_weightcut{this, "ApplyWeightCut", true};
248
250 Gaudi::Property<double> m_weight{this, "WeightCut", 0.25}; // cut all hits under 0.25
251
253 Gaudi::Property<bool> m_weightcutmdt{this, "ApplyWeightCutMdt",
254 true}; // cut all mdt hits under a certain weight (dependent on number of mdt hits in event
255
257 Gaudi::Property<double> m_thresholdhisto_xyz{this, "SetThresholdHistoRPhi", 0.9};
259 Gaudi::Property<double> m_thresholdhisto_rz{this, "SetThresholdHistoREta", 2.1};
260
262 Gaudi::Property<int> m_number_of_sectors_xyz{this, "SetNumberOfSectorsRPhi", 12};
264 Gaudi::Property<int> m_number_of_sectors_rz{this, "SetNumberOfSectorsREta", 16};
267
269 Gaudi::Property<int> m_printlevel{this, "Printlevel", 0};
270
271 mutable std::atomic_uint m_ncalls{0};
272
274 Gaudi::Property<int> m_maxNumberOfPhiHits{this, "MaximumNumberOfPhiHits", -1};
275
277 void printPattern(Muon::MuonPrdPattern* muonpattern) const;
278};
279
280#endif // MUONHOUGHPATTERNTOOLS_MUONHOUGHPATTERNTOOL_H
std::vector< MuonHoughPatternContainer > MuonHoughPatternContainerShip
std::vector< MuonHoughPatternCollection > MuonHoughPatternContainer
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
std::unique_ptr< MuonHoughHitContainer > whichEventHough(int id, const MuonHoughHitContainer &event, double weightmdt) const
selects the hitcontainer to be used for filling the histograms
static constexpr double m_stepsize_rz_cosmics
bin width for rzcosmics
static constexpr double m_stepsize_yz
bin width for yz
static constexpr double m_theta_cor_constant
constant 1 for theta for hough correction
virtual StatusCode initialize() override
initiates private members
std::unique_ptr< Muon::MuonPrdPattern > houghPatternToCleanPhiPattern(MuonHoughPattern &houghpattern) const
converts hough pattern to EDM phi patterns and cleans it from outliers
Gaudi::Property< double > m_thresholdhisto_rz
threshold histogram in rz
int m_number_of_ids
number of hough transforms currently supported (7)
Gaudi::Property< int > m_number_of_sectors_rz
number of sectors (different regions in which patterns can be found in the same iteration) in rz
Gaudi::Property< int > m_maxNumberOfPhiHits
maximum number of phi hits to do pattern recognition, if small zero no cut is applied
std::unique_ptr< MuonPrdPatternCollection > getCurvedMuonPatterns(MuonHoughPatternContainerShip &houghpatterns) const
returns curvedpattern container in EDM
virtual ~MuonHoughPatternTool()=default
Destructor.
virtual MuonHoughPatternContainerShip emptyHoughPattern() const override
creates houghpatterns, called from FinderTool
std::unique_ptr< MuonHoughHitContainer > whichEventAssociation(int id, const MuonHoughHitContainer &event) const
selects the hitcontainer to be used to associate to the maxima
static constexpr double m_stepsize_per_angle_xyz
bin width for angle in xyz
static constexpr double m_stepsize_per_angle_rz_cosmics
bin width for angle in rzcosmics
static constexpr int m_maximum_level
// number of maximum iterations over houghtransform
int m_number_of_sectors_rz_cosmics
number of sectors (different regions in which patterns can be found in the same iteration) in rzcosmi...
MuonHoughMathUtils m_muonhoughmathutils
object for use of mathematical formulas for trackmodels
static constexpr double m_maximum_residu_mm
distance hits are associated with pattern in mm
static constexpr double m_detectorsize_rz_full
size of full detector in rz (eta) in mm, used as acceptancy for cosmics
unsigned int getThresholdHoughPattern(int id_number) const
returns minimum number of hits a hough pattern can contain
int numberOfHits(const MuonHoughHitContainer &event) const
returns number of hits left (unused)
static void transformCoordsMaximum(std::pair< double, double > &coordsmaximum, double r0_true)
corrects the maximum of the histogram with a factor (not in use anymore, used for old rz transform)
static constexpr double m_detectorsize_angle_rz
max range of angle in rz in degrees (180)
static constexpr double m_stepsize_per_angle_xy_cosmics
bin width for angle in xy cosmics
Gaudi::Property< bool > m_use_curvedhough
use curved hough transformation for eta patterns (true)
bool analyseHisto(int id_number, int level, const std::unique_ptr< MuonHoughHitContainer > &event_to_analyse, std::unique_ptr< MuonHoughTransformSteering > &houghtransform, MuonHoughPatternContainerShip &houghpatterns) const
analyses the hough histograms
static constexpr double m_detectorsize_angle_xyz
max range of angle in xyz in degrees (360)
bool m_use_ip
use interaction point constraint (true)
static constexpr double m_z_cor_constant
use hough correction to correct the maximum found in rz-plane slightly as there is a bias in the houg...
Gaudi::Property< bool > m_use_csc_in_pattern
use csc hits in association / pattern (true)
void printPattern(Muon::MuonPrdPattern *muonpattern) const
print out pattern hits
Gaudi::Property< unsigned int > m_thresholdpattern_rz
minimal size for a eta pattern (3)
Gaudi::Property< int > m_number_of_maxima
number of iterations (5)
static constexpr int m_nbins_curved
bin width for 1/sqrt(curvature)
std::unique_ptr< Muon::MuonPrdPattern > houghPatternsToOnePhiPattern(const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
converts and combines two hough patterns to one EDM phi pattern
double m_detectorsize_rz
acceptancy of patterns in rz (eta) in mm
std::unique_ptr< MuonHoughTransformSteering > whichHoughTransform(int id) const
returns the Houghtransform for the id
Gaudi::Property< bool > m_weightcutmdt
weight_cut for mdt hits in hough
static constexpr double m_theta_cor_constant2
constant 2 for theta for hough correction
static constexpr double m_detectorsize_yz_ip
acceptancy of patterns for ip in yz (not used) in mm
bool hitThroughCut(const std::shared_ptr< MuonHoughHit > &hit, double weightmdt) const
hit through weight cut?
static constexpr double m_maximum_residu_angle
distance hits are associated with pattern in degrees
static constexpr double m_stepsize_per_angle_rz
bin width for angle in rz
bool hitInHoughPattern(const std::shared_ptr< MuonHoughHit > &hit, const MuonHoughPatternContainer &houghpattern) const
checks if hit is already in one of the found houghpatterns (unused)
virtual void makePatterns(const MuonHoughHitContainer &hitcontainer, MuonHoughPatternContainerShip &houghpatterns) const override
method that builds the patterns
Gaudi::Property< bool > m_weightcut
weight_cut for hits in hough
static constexpr double m_z_cor_constant2
constant 2 for z for hough correction
Gaudi::Property< double > m_weight
value of weight cut
static constexpr double m_stepsize_xy_cosmics
bin width for xy cosmics
std::unique_ptr< TFile > m_file
pointer to the file name for the hough histograms
static void resetAssociation(const MuonHoughHitContainer &event)
reset association flag of hits in m_event
static constexpr double m_stepsize_rz
bin width for rz
virtual std::unique_ptr< MuonPrdPatternCollection > getEtaMuonPatterns(MuonHoughPatternContainerShip &houghpatterns) const override
returns etapattern container in EDM
int overlapHoughPatterns(const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
returns number of hits that are in both hough patterns
Gaudi::Property< double > m_thresholdhisto_xyz
threshold histogram in xyz
MuonHoughPatternTool(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Gaudi::Property< int > m_printlevel
output level (range 0-10) (default 0)
std::vector< int > maxLevelHoughPattern(const MuonHoughPatternContainerShip &houghpattern) const
returns the maximum iteration, not in use
static constexpr double m_detectorsize_rz_ip
acceptancy of patterns for ip in rz (eta) in mm
std::unique_ptr< Muon::MuonPrdPattern > houghPatternToEtaPattern(const MuonHoughPattern &houghpattern) const
converts hough pattern to EDM eta patterns
static constexpr double m_detectorsize_yz_full
size of full detector in yz (not used) in mm, used as acceptancy for cosmics
virtual std::unique_ptr< MuonPrdPatternCollection > getPhiMuonPatterns(MuonHoughPatternContainerShip &houghpatterns) const override
returns phipattern container in EDM
void setWeightMdtCutValue(const MuonHoughHitContainer &event, double &weightmdt) const
calculates the mdt weight cut value
double m_detectorsize_xy
acceptancy of patterns in xy (phi) in mm
Gaudi::Property< bool > m_use_csc_in_hough
use csc hits in histogram (false)
virtual StatusCode finalize() override
deletes private members
static constexpr double m_stepsize_xy
max range of 1/sqrt(curvature) for curved transform, corresponds to 0.02 ~ 2,5m ~ 1....
double getThresholdHisto(int id_number) const
returns minimum number for the maximum of a hough transform
static std::unique_ptr< MuonHoughHitContainer > hitsNotInPattern(const MuonHoughHitContainer &event, int id_number)
returns a hitcontainer with hits not yet used in pattern
void calculateWeights(const MuonHoughHitContainer &event, double weightmdt) const
calculates new weights based on rejection factor (1-origweight) and number of hits in event,...
Gaudi::Property< bool > m_use_cosmics
use cosmic settings (false)
void weightRescaling(const MuonHoughHitContainer &event, int id_number, int level) const
rescales hits per iteration to reduce number of patterns when already some have been found
std::unique_ptr< Muon::MuonPrdPattern > houghPatternsToOneEtaPattern(const MuonHoughPattern &houghpattern1, const MuonHoughPattern &houghpattern2) const
converts and combines two hough patterns to one EDM phi pattern
void useIPMuons()
reduces Detector sizes for Hough Histograms to find patterns from muons from the Interaction Point (d...
static constexpr double m_maximum_residu_mm_cosmics
distance hits are associated with pattern in mm for cosmics
Gaudi::Property< int > m_number_of_sectors_xyz
number of sectors (different regions in which patterns can be found in the same iteration) in xyz
Gaudi::Property< bool > m_use_negative_weights
use negative weights (false)
static bool hitsLeft(const MuonHoughHitContainer &event)
returns if there are hits left
static constexpr double m_detectorsize_xy_ip
acceptancy of patterns for ip in xy (phi) in mm
static constexpr bool m_use_rpc_measures_eta
use rpc phi strips in phi-patterns (true)
Gaudi::Property< bool > m_use_histos
output histograms (false)
std::unique_ptr< Muon::MuonPrdPattern > houghPatternToPhiPattern(const MuonHoughPattern &houghpattern) const
converts hough pattern to EDM phi patterns
double m_detectorsize_yz
acceptancy of patterns in yz (not used) in mm
static constexpr double m_detectorsize_xy_full
size of full detector in xy (phi) in mm, used as acceptancy for cosmics
Gaudi::Property< unsigned int > m_thresholdpattern_xyz
minimal size for a phi pattern (1)
Abstract base class, Strategy pattern.
Class to store a pattern in the muon system containing PrepRawData pointers.