4#ifndef MUONR4_FASTRECONSTRUCTIONALGS_PATTERNFINDERUTILITIES__H
5#define MUONR4_FASTRECONSTRUCTIONALGS_PATTERNFINDERUTILITIES__H
26 explicit HitPayload(
const Acts::GeometryContext& gctx,
40 const bool isProjected)
const;
95 void print(std::ostream& ostr)
const;
121 const std::int8_t expSector,
123 const Acts::Logger*
logger);
143 const double residual,
144 const double resSigma);
151 const double newResidual,
152 const double newResSigma);
196 uint8_t
nStations(
const bool onlyGoodStations)
const;
271 v.pat.print(os, v.detailed);
Acts::KDTree< 2, const HitPayload *, double, std::array, 50 > SearchTree_t
Definition of the search tree class.
Muon::MuonStationIndex::StIndex StIndex
Type alias for the station index.
static const int s_nStations
Number of stations.
static PatternPrintView detailed(const PatternState &p)
Print the pattern state with detailed information.
: The muon space point bucket represents a collection of points that will bre processed together in t...
The SpacePointPerLayerSorter sort two given space points by their layer Identifier.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
GlobalPatternFinder::StIndex StIndex
LineTestDecision
: Enum for possible outcomes of pattern line compatibility test
@ eRejectHit
Test failed, discard the hit.
@ eBranchPattern
Test successfull with multiple pattern hits on same layer, branch the pattern.
@ eAddHit
Test successfull, add hit to pattern.
static const SpacePointPerLayerSorter s_spSorter
bool isPrecisionHit(const SpacePoint &hit)
Returns whether the uncalibrated spacepoint is a precision hit (Mdt, micromegas, stgc strips).
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
Small wrapper for candidate hits used to build patterns.
const HitPayload & operator*() const
void print(std::ostream &ostr) const
bool operator==(const CandidateHit &other) const
uint8_t globLayer
Global measurement layer number.
const SpacePoint * sp() const
friend std::ostream & operator<<(std::ostream &ostr, const CandidateHit &c)
bool operator==(const HitPayload &other) const
const HitPayload * hit
Pointer to the underlying hit.
const HitPayload * operator->() const
Configuration object for the patter finder.
Base class for hit struct containing hit information.
Amg::Vector3D position
Global position.
bool nonOrthogonalStrips
Are the strips non-orthogonal.
uint8_t locLayer
Layer number in the sector frame.
double phiCov
Cached angular covariance [rad^2] of the hit in the phi angle.
HitPayload(const Acts::GeometryContext &gctx, const SpacePoint *sp, const SpacePointBucket *bucket, const Amg::Transform3D &localToGlobal)
Constructor with parameters.
const SpacePoint & operator*() const
Dereference operator: it allows to access the underlying hit.
const SpacePoint * spacePoint
Pointer to the underlying hit.
const SpacePointBucket * bucket
Pointer to the parent bucket.
bool isPrecision
Is precision hit.
double residualVariance(const Acts::GeometryContext &gctx, const Amg::Vector3D &contractionVector, const bool isProjected) const
Hit contribution contribution to the residual variance due to its intrinsic position uncertainty.
Amg::Vector3D sensorDir(const Acts::GeometryContext &gctx) const
Sensor direction.
StIndex station
Station index.
bool operator==(const HitPayload &other) const
Equal operator: it compares the underlying hit.
double stripAngle
Strip angle when the strips are non-orthogonal.
const SpacePoint * operator->() const
Arrow operator: it allows to access the underlying hit.
A view of the pattern state for printing purposes.
friend std::ostream & operator<<(std::ostream &os, const PatternPrintView &v)
Print the pattern print view.
const PatternState & pat
The pattern state to be printed.
bool detailed
Whether to print detailed information.
Pattern state object storing pattern information during construction.
PatternState(const CandidateHit &seed, const std::int8_t expSector, const Config *cfg, const Acts::Logger *logger)
Constructor taking the seed information.
void moveLineAnchorHit(const CandidateHit &refHit)
Move the line anchor hit given a reference hit.
double lastResidual
Residual & residual uncertainty of the last inserted hit (needed when replacing a hit).
double meanNormResidual2
Mean over eta hits of the square of their residual divided by residual uncertainty.
Amg::Vector3D projToPhiPlane(const Acts::GeometryContext &gctx, const HitPayload &hit) const
Project a certain hit position onto the bending plane where the pattern is defined.
bool isInPattern(const HitPayload &hit) const
Check wheter a hit is present in the pattern.
void updateLineParameters(const Acts::GeometryContext &gctx, const Amg::Vector3D &beamSpot)
Update the line parameters based on the current hits.
uint8_t nStations(const bool onlyGoodStations) const
Method returning the number of stations.
double patPhiCov
Covariance of the pattern phi.
Amg::Vector3D linePos
Position and direction of the pattern line.
bool useBeamspot
Whether we used the beamspot to compute the line parameters.
PatternState(PatternState &&other) noexcept=default
Move constructor.
PatternState(const PatternState &other)=default
Copy constructor.
double leverArm
Distance between the two points defining the pattern line.
bool needLineUpdate
Whether we need to update the pattern line the next time we find a hit in a new layer.
std::vector< HitPayload > phiOnlyHits
Array holding phi-only hits.
ExpandedSector expSect
expanded MS sector
std::vector< const SpacePointBucket * > getParentBuckets() const
Get the buckets associated with the pattern.
bool isFinalized
Flag to indicate if the pattern has been finalized.
Amg::Vector3D bendPlaneNorm
Normal vector to the bending plane where the pattern lies.
uint8_t nBendingLayers() const
Return the number of layers in bending coordinate.
Acts::CloneablePtr< PatHitVisual > visualInfo
Pointer to Visual Information for pattern visualization.
CandidateHit prevLayerHit
Last hit in the second-to-last layer.
const Acts::Logger * m_logger
Logger.
void addHit(const CandidateHit &hit, const double residual, const double resSigma)
Add a hit to the pattern and update the internal state.
PatternState & operator=(const PatternState &other)=default
Copy assignment operator.
std::array< std::vector< CandidateHit >, s_nStations > hitsPerStation
Map collection of hits per station.
void print(std::ostream &ostr, bool detailed) const
Print the pattern candidate.
LineTestRes checkLineComp(const Acts::GeometryContext &gctx, const CandidateHit &testHit, const Amg::Vector3D &beamSpot)
Method checking line compatibility of a test hit against the pattern.
bool isOverlap
Flag to indicate if the pattern is overlapping with another one, used during overlap removal.
CandidateHit lineAnchorHit
Line anchor hit.
bool isPhiCompatible(const HitPayload &hit) const
Method to check the phi compatibility of a test hit with a given pattern.
void updatePatternPhi()
Helper method to update the pattern phi and bending plane normal.
const Config * cfg
Pointer to cfg option.
void overWriteHit(const CandidateHit &newHit, const double newResidual, const double newResSigma)
Overwrite the hits on the last layer with the new one.
double patPhi
Pattern phi, which is the phi of the bending plane where the pattern lies.
const Acts::Logger & logger() const
Return the logger.
PatternState & operator=(PatternState &&other) noexcept=default
Move assignment operator.
uint8_t nPrecisionLayers
Counts of precision / non-precision / phi layers.
CandidateHit lastInsertedHit
Last inserted hit.
LineTestRes computeLineResidual(const Acts::GeometryContext &gctx, const CandidateHit &testHit) const
Method to compute the residual of a test hit against the pattern line.
double getMeanResidual2() const
Return the mean normalized residual squared.
~PatternState()=default
Destructor.
bool operator==(const PatternState &other) const =delete
Patterns are considered identical if they have the same hit content.
double patTheta
Pattern theta, which is the value of the seed hit.
Structure to hold the search tree data.
std::vector< HitPayload > stripPayloads
Vector of strip hits.
SearchTree_t tree
The search tree.
: Small struct to encapsulate the result of the line compatibility test