ATLAS Offline Software
MdtSegmentSeedGenerator.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 MUONR4_MUONPATTERNHELPERS_MDTSEGMENTSEEDGENERATOR_H
5 #define MUONR4_MUONPATTERNHELPERS_MDTSEGMENTSEEDGENERATOR_H
6 
10 #include <GaudiKernel/SystemOfUnits.h>
11 
12 
13 #include <vector>
14 #include <array>
15 
16 
17 namespace MuonR4 {
18  class ISpacePointCalibrator;
25  public:
27 
29  struct Config{
31  std::array<double, 2> thetaRange{0, 180.*Gaudi::Units::deg};
33  std::array<double, 2> interceptRange{-20.*Gaudi::Units::m, 20.*Gaudi::Units::m};
35  double hitPullCut{5.};
37  bool startWithPattern{false};
39  unsigned int busyLayerLimit{2};
41  unsigned int nMdtHitCut{3};
44  double nMdtLayHitCut{2./3.};
47  bool tightenHitCut{true};
50  bool overlapCorridor{true};
52  bool recalibSeedCircles{false};
56  bool fastSeedFit{true};
58  unsigned int nMaxIter{100};
60  double precCutOff{1.e-6};
61  };
67  std::vector<std::unique_ptr<CalibratedSpacePoint>> measurements{};
69  unsigned int nIter{0};
71  double chi2{0.};
73  const SpacePointBucket* parentBucket{nullptr};
74  };
75 
81  MdtSegmentSeedGenerator(const std::string& name,
82  const SegmentSeed* segmentSeed,
83  const Config& configuration);
84 
87  std::optional<DriftCircleSeed> nextSeed(const EventContext& ctx);
89  unsigned int numGenerated() const;
91  const Config& config() const;
92  private:
97  using SignComboType = std::array<int, 2>;
98  constexpr static std::array<SignComboType,4> s_signCombos{
99  std::array{ 1, 1}, std::array{ 1,-1},
100  std::array{-1,-1}, std::array{-1, 1},
101  };
103  struct SeedSolution{
105  double theta{0.};
107  double Y0{0.};
109  double dTheta{0.};
111  double dY0{0.};
115  std::vector<int> solutionSigns{};
116 
117  friend std::ostream& operator<<(std::ostream& ostr, const SeedSolution& sol) {
118  return sol.print(ostr);
119  }
120  std::ostream& print(std::ostream& ostr) const;
121  };
122 
123 
129  std::optional<DriftCircleSeed> buildSeed(const EventContext& ctx,
130  const HoughHitType & topHit,
131  const HoughHitType & bottomHit,
132  const SignComboType& signs);
133 
138  void fitDriftCircles(DriftCircleSeed& seed) const;
139 
141  void moveToNextCandidate();
143 
144 
145  const SegmentSeed* m_segmentSeed{nullptr};
147 
149  std::size_t m_upperLayer{0};
151  std::size_t m_lowerLayer{0};
153  std::size_t m_lowerHitIndex{0};
155  std::size_t m_upperHitIndex{0};
157  std::size_t m_signComboIndex{0};
158 
159  std::vector<SeedSolution> m_seenSolutions{};
161  unsigned int m_nGenSeeds{0};
162 
163  };
164 }
165 
166 #endif
MuonR4::MdtSegmentSeedGenerator::m_upperHitIndex
std::size_t m_upperHitIndex
Explicit hit to pick in the selected top layer.
Definition: MdtSegmentSeedGenerator.h:155
MuonR4::MdtSegmentSeedGenerator::SeedSolution::dTheta
double dTheta
: Uncertainty on the slope
Definition: MdtSegmentSeedGenerator.h:109
MuonR4::MdtSegmentSeedGenerator::Config::overlapCorridor
bool overlapCorridor
Check whether a new seed candidate shares the same left-right solution with already accepted ones Rej...
Definition: MdtSegmentSeedGenerator.h:50
MuonR4::MdtSegmentSeedGenerator::numGenerated
unsigned int numGenerated() const
Returns how many seeds have been generated.
Definition: MdtSegmentSeedGenerator.cxx:88
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MuonR4::MdtSegmentSeedGenerator::DriftCircleSeed::parameters
SegmentFit::Parameters parameters
Seed parameters.
Definition: MdtSegmentSeedGenerator.h:65
MuonR4::MdtSegmentSeedGenerator::Config::nMdtHitCut
unsigned int nMdtHitCut
How many drift circle hits needs the seed to contain in order to be valid.
Definition: MdtSegmentSeedGenerator.h:41
MuonR4::SegmentFit::Parameters
AmgVector(toInt(ParamDefs::nPars)) Parameters
Definition: MuonHoughDefs.h:48
MuonR4::MdtSegmentSeedGenerator::SignComboType
std::array< int, 2 > SignComboType
Sign combinations to draw the 4 lines tangent to 2 drift circles The first two are indicating whether...
Definition: MdtSegmentSeedGenerator.h:97
MuonR4::SpacePointBucket
: The muon space point bucket represents a collection of points that will bre processed together in t...
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:21
MuonR4::MdtSegmentSeedGenerator::Config::busyLayerLimit
unsigned int busyLayerLimit
How many drift circles may be on a layer to be used for seeding.
Definition: MdtSegmentSeedGenerator.h:39
MuonR4::SpacePointPerLayerSorter
The SpacePointPerLayerSorter groups the space points by their layer Identifier.
Definition: SpacePointPerLayerSorter.h:14
SegmentSeed.h
MuonR4::MdtSegmentSeedGenerator::SeedSolution::solutionSigns
std::vector< int > solutionSigns
Vector of radial signs of the valid hits.
Definition: MdtSegmentSeedGenerator.h:115
MuonR4::MdtSegmentSeedGenerator::config
const Config & config() const
Returns the current seed configuration.
Definition: MdtSegmentSeedGenerator.cxx:37
MuonR4::MdtSegmentSeedGenerator::MdtSegmentSeedGenerator
MdtSegmentSeedGenerator(const std::string &name, const SegmentSeed *segmentSeed, const Config &configuration)
Standard constructor taking the segmentSeed to start with and then few configuration tunes.
Definition: MdtSegmentSeedGenerator.cxx:41
deg
#define deg
Definition: SbPolyhedron.cxx:17
MuonR4::MdtSegmentSeedGenerator::SeedSolution
Cache of all solutions seen thus far.
Definition: MdtSegmentSeedGenerator.h:103
MuonR4::MdtSegmentSeedGenerator::Config::fastSeedFit
bool fastSeedFit
Toggle whether the seed is rapidly refitted.
Definition: MdtSegmentSeedGenerator.h:56
MuonR4::MdtSegmentSeedGenerator::m_nGenSeeds
unsigned int m_nGenSeeds
Counter on how many seeds have been generated.
Definition: MdtSegmentSeedGenerator.h:161
MuonR4::MdtSegmentSeedGenerator::Config::nMdtLayHitCut
double nMdtLayHitCut
Hit cut based on the fraction of collected tube layers.
Definition: MdtSegmentSeedGenerator.h:44
MuonR4::MdtSegmentSeedGenerator::Config::recalibSeedCircles
bool recalibSeedCircles
Recalibrate the seed drift circles from the initial estimate
Definition: MdtSegmentSeedGenerator.h:52
MuonR4::MdtSegmentSeedGenerator
Helper class to generate valid seeds for the segment fit.
Definition: MdtSegmentSeedGenerator.h:24
MuonR4::MdtSegmentSeedGenerator::Config::startWithPattern
bool startWithPattern
Try at the first time the pattern seed as candidate.
Definition: MdtSegmentSeedGenerator.h:37
MuonR4::MdtSegmentSeedGenerator::m_lowerHitIndex
std::size_t m_lowerHitIndex
Explicit hit to pick in the selected bottom layer.
Definition: MdtSegmentSeedGenerator.h:153
MuonR4::MdtSegmentSeedGenerator::Config
Configuration switches of the module
Definition: MdtSegmentSeedGenerator.h:29
MuonR4::MdtSegmentSeedGenerator::s_signCombos
constexpr static std::array< SignComboType, 4 > s_signCombos
Definition: MdtSegmentSeedGenerator.h:98
MuonR4::MdtSegmentSeedGenerator::SeedSolution::theta
double theta
: Theta of the line
Definition: MdtSegmentSeedGenerator.h:105
MuonR4::MdtSegmentSeedGenerator::m_cfg
Config m_cfg
Definition: MdtSegmentSeedGenerator.h:142
MuonR4::MdtSegmentSeedGenerator::SeedSolution::print
std::ostream & print(std::ostream &ostr) const
Definition: MdtSegmentSeedGenerator.cxx:31
MuonR4::SpacePointPerLayerSorter::HitVec
std::vector< const SpacePoint * > HitVec
Definition: SpacePointPerLayerSorter.h:16
MuonR4::MdtSegmentSeedGenerator::Config::thetaRange
std::array< double, 2 > thetaRange
Cut on the theta angle.
Definition: MdtSegmentSeedGenerator.h:31
MuonR4::MdtSegmentSeedGenerator::buildSeed
std::optional< DriftCircleSeed > buildSeed(const EventContext &ctx, const HoughHitType &topHit, const HoughHitType &bottomHit, const SignComboType &signs)
Tries to build the seed from the two hits.
Definition: MdtSegmentSeedGenerator.cxx:157
MuonR4::MdtSegmentSeedGenerator::m_upperLayer
std::size_t m_upperLayer
Considered layer to pick the top drift circle from.
Definition: MdtSegmentSeedGenerator.h:149
MuonR4::SegmentSeed::getHitsInMax
const std::vector< HitType > & getHitsInMax() const
Returns the list of assigned hits.
Definition: SegmentSeed.cxx:37
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
MuonR4::MdtSegmentSeedGenerator::SeedSolution::seedHits
HitVec seedHits
Used hits in the seed.
Definition: MdtSegmentSeedGenerator.h:113
MuonR4::MdtSegmentSeedGenerator::SeedSolution::dY0
double dY0
: Uncertainty on the intercept
Definition: MdtSegmentSeedGenerator.h:111
MuonR4::MdtSegmentSeedGenerator::Config::hitPullCut
double hitPullCut
Upper cut on the hit chi2 w.r.t.
Definition: MdtSegmentSeedGenerator.h:35
Config
Definition: dumpNPs.cxx:47
MuonR4::MdtSegmentSeedGenerator::DriftCircleSeed::measurements
std::vector< std::unique_ptr< CalibratedSpacePoint > > measurements
List of calibrated measurements.
Definition: MdtSegmentSeedGenerator.h:67
MuonR4::SpacePoint
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePoint.h:18
MuonR4::MdtSegmentSeedGenerator::~MdtSegmentSeedGenerator
~MdtSegmentSeedGenerator()
lumiFormat.array
array
Definition: lumiFormat.py:91
MuonR4::MdtSegmentSeedGenerator::SeedSolution::operator<<
friend std::ostream & operator<<(std::ostream &ostr, const SeedSolution &sol)
Definition: MdtSegmentSeedGenerator.h:117
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MuonR4::MdtSegmentSeedGenerator::DriftCircleSeed::chi2
double chi2
Seed chi2.
Definition: MdtSegmentSeedGenerator.h:71
MuonR4::MdtSegmentSeedGenerator::moveToNextCandidate
void moveToNextCandidate()
Prepares the generator to generate the seed from the next pair of drift circles.
Definition: MdtSegmentSeedGenerator.cxx:91
MuonR4::ISpacePointCalibrator
Interface class to refine the space point calibration with an external seed.
Definition: ISpacePointCalibrator.h:19
MuonR4::MdtSegmentSeedGenerator::DriftCircleSeed::nIter
unsigned int nIter
Iterations to obtain the seed.
Definition: MdtSegmentSeedGenerator.h:69
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
MuonR4::MdtSegmentSeedGenerator::Config::nMaxIter
unsigned int nMaxIter
Maximum number of iterations in the fast segment fit.
Definition: MdtSegmentSeedGenerator.h:58
MuonR4::MdtSegmentSeedGenerator::m_segmentSeed
const SegmentSeed * m_segmentSeed
Definition: MdtSegmentSeedGenerator.h:145
MuonR4::MdtSegmentSeedGenerator::Config::tightenHitCut
bool tightenHitCut
Once a seed with even more than initially required hits is found, reject all following seeds with les...
Definition: MdtSegmentSeedGenerator.h:47
MuonR4::SegmentSeed
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition: SegmentSeed.h:14
AthMessaging.h
MuonR4::MdtSegmentSeedGenerator::m_seenSolutions
std::vector< SeedSolution > m_seenSolutions
Definition: MdtSegmentSeedGenerator.h:159
MuonR4::MdtSegmentSeedGenerator::Config::interceptRange
std::array< double, 2 > interceptRange
Cut on the intercept range.
Definition: MdtSegmentSeedGenerator.h:33
MuonR4::MdtSegmentSeedGenerator::DriftCircleSeed::parentBucket
const SpacePointBucket * parentBucket
Pointer to the parent bucket.
Definition: MdtSegmentSeedGenerator.h:73
MuonR4::MdtSegmentSeedGenerator::DriftCircleSeed
Helper struct from a generated Mdt seed.
Definition: MdtSegmentSeedGenerator.h:63
MuonR4::MdtSegmentSeedGenerator::fitDriftCircles
void fitDriftCircles(DriftCircleSeed &seed) const
Refine the seed by performing a fast Mdt segment fit.
Definition: MdtSegmentSeedGenerator.cxx:332
MuonR4::MdtSegmentSeedGenerator::m_signComboIndex
std::size_t m_signComboIndex
Explicit hit to pick in the selected top layer.
Definition: MdtSegmentSeedGenerator.h:157
MuonR4::MdtSegmentSeedGenerator::Config::precCutOff
double precCutOff
Precision cut off in the fast segment fit.
Definition: MdtSegmentSeedGenerator.h:60
MuonR4::MdtSegmentSeedGenerator::Config::calibrator
const ISpacePointCalibrator * calibrator
Pointer to the space point calibrator.
Definition: MdtSegmentSeedGenerator.h:54
MuonR4::MdtSegmentSeedGenerator::m_hitLayers
SpacePointPerLayerSorter m_hitLayers
Definition: MdtSegmentSeedGenerator.h:146
MuonR4::MdtSegmentSeedGenerator::HitVec
SpacePointPerLayerSorter::HitVec HitVec
Definition: MdtSegmentSeedGenerator.h:26
SpacePointPerLayerSorter.h
MuonR4::MdtSegmentSeedGenerator::m_lowerLayer
std::size_t m_lowerLayer
Considered layer to pick the bottom drift circle from.
Definition: MdtSegmentSeedGenerator.h:151
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
MuonR4::MdtSegmentSeedGenerator::nextSeed
std::optional< DriftCircleSeed > nextSeed(const EventContext &ctx)
returns the next seed in the row
Definition: MdtSegmentSeedGenerator.cxx:117
MuonR4::MdtSegmentSeedGenerator::SeedSolution::Y0
double Y0
Intersecpt of the line.
Definition: MdtSegmentSeedGenerator.h:107