ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::CompetingRIOsOnTrack Class Referenceabstract

Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase. More...

#include <CompetingRIOsOnTrack.h>

Inheritance diagram for Trk::CompetingRIOsOnTrack:
Collaboration diagram for Trk::CompetingRIOsOnTrack:

Public Types

typedef double AssignmentProb
 Type def of Assignment probability: probability for a certain RIO_OnTrack to be assigned to the track.

Public Member Functions

 CompetingRIOsOnTrack ()
 Default Constructor for POOL.
 CompetingRIOsOnTrack (std::vector< AssignmentProb > &&assgnProb)
 Constructor with parameters.
 CompetingRIOsOnTrack (const CompetingRIOsOnTrack &compROT)=default
 Copy Constructor.
 CompetingRIOsOnTrack (CompetingRIOsOnTrack &&compROT) noexcept=default
CompetingRIOsOnTrackoperator= (const CompetingRIOsOnTrack &compROT)=default
 Assignment operator.
CompetingRIOsOnTrackoperator= (CompetingRIOsOnTrack &&compROT) noexcept=default
virtual ~CompetingRIOsOnTrack ()=default
 Destructor.
virtual CompetingRIOsOnTrackclone () const override=0
 Pseudo-constructor: needed to avoid excessive RTTI.
std::unique_ptr< CompetingRIOsOnTrackuniqueClone () const
 NVI Clone.
virtual unsigned int numberOfContainedROTs () const =0
 Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
unsigned int indexOfMaxAssignProb () const
 Index of the ROT with the highest assignment probability.
virtual const RIO_OnTrackrioOnTrack (unsigned int) const =0
 returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
AssignmentProb assignmentProbability (unsigned int indx) const
 returns the AssignmentProbability depending on the integer.
virtual void setLocalParametersAndErrorMatrix ()
 recalculate the LocalParameters and ErrorMatrix
virtual bool type (MeasurementBaseType::Type type) const override final
 Extended method checking the type.
const LocalParameterslocalParameters () const
 Interface method to get the LocalParameters.
const Amg::MatrixXlocalCovariance () const
 Interface method to get the localError.
virtual const SurfaceassociatedSurface () const =0
 Interface method to get the associated Surface.
virtual const Amg::Vector3DglobalPosition () const =0
 Interface method to get the global Position.

Protected Member Functions

virtual bool ROTsHaveCommonSurface (const bool withNonVanishingAssignProb=true) const =0
 query if all the contained ROTs have a common associated surface.
virtual MsgStream & dump (MsgStream &out) const override
 returns the some information about the base class members (avoid code duplication)
virtual std::ostream & dump (std::ostream &out) const override
 returns the some information about the base class members (avoid code duplication)

Protected Attributes

std::vector< AssignmentProbm_assignProb
 assignment probabilities of the ROTs
LocalParameters m_localParams
Amg::MatrixX m_localCovariance

Friends

class ::CompetingRIOsOnTrackCnv_p1

Detailed Description

Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.

This class is used e.g. by the Deterministic Annealing Filter to handle several RIO_OnTracks in one "effective detector layer" (might be more than one DetectorElement), which compete against each other in being assigned to a track. localParameters() and localErrorMatrix() should return the mean values according to the weights (assignment probabilities).

Effective LocalParameters, an ErrorMatrix and a number of competing ROTs with their assignment probabilities are the commonalities of all CompetingRIOsOnTrack.

The derived classes can overwrite the base class definitions of Trk::RIO_OnTrack and Trk::Surface with derived classes for internal use and to avoid extensive RTTI.

The Surface is chosen not to be a private member of the base class, such that dedicated Segments can save specific Surface types and overwrite the return type by a child class to avoid extensive RTTI.

Access to any information of the contained ROTs, such as the underlying Trk::PrepRawData, the pointer to the Trk::DetectorElementBase such as identifiers have to be retrieved from the ROT itself.

Author
Sebas.nosp@m.tian.nosp@m..Flei.nosp@m.schm.nosp@m.ann@c.nosp@m.ern..nosp@m.ch
Chistos Anastopoulos AthenaMT

Definition at line 63 of file CompetingRIOsOnTrack.h.

Member Typedef Documentation

◆ AssignmentProb

Type def of Assignment probability: probability for a certain RIO_OnTrack to be assigned to the track.

Definition at line 69 of file CompetingRIOsOnTrack.h.

Constructor & Destructor Documentation

◆ CompetingRIOsOnTrack() [1/4]

Trk::CompetingRIOsOnTrack::CompetingRIOsOnTrack ( )

Default Constructor for POOL.

Definition at line 18 of file CompetingRIOsOnTrack.cxx.

19 : Trk::MeasurementBase()
20 , m_assignProb()
21{
22}
std::vector< AssignmentProb > m_assignProb
assignment probabilities of the ROTs

◆ CompetingRIOsOnTrack() [2/4]

Trk::CompetingRIOsOnTrack::CompetingRIOsOnTrack ( std::vector< AssignmentProb > && assgnProb)

Constructor with parameters.

Definition at line 24 of file CompetingRIOsOnTrack.cxx.

25 : Trk::MeasurementBase()
26 , m_assignProb(std::move(assgnProb))
27{
28}

◆ CompetingRIOsOnTrack() [3/4]

Trk::CompetingRIOsOnTrack::CompetingRIOsOnTrack ( const CompetingRIOsOnTrack & compROT)
default

Copy Constructor.

◆ CompetingRIOsOnTrack() [4/4]

Trk::CompetingRIOsOnTrack::CompetingRIOsOnTrack ( CompetingRIOsOnTrack && compROT)
defaultnoexcept

◆ ~CompetingRIOsOnTrack()

virtual Trk::CompetingRIOsOnTrack::~CompetingRIOsOnTrack ( )
virtualdefault

Destructor.

Member Function Documentation

◆ assignmentProbability()

CompetingRIOsOnTrack::AssignmentProb Trk::CompetingRIOsOnTrack::assignmentProbability ( unsigned int indx) const
inline

returns the AssignmentProbability depending on the integer.

Definition at line 139 of file CompetingRIOsOnTrack.h.

140{
141 assert(indx < numberOfContainedROTs());
142 if (indx < numberOfContainedROTs()) {
143 return m_assignProb[indx];
144 }
145 return 0; // could consider throwing an exception here - EJWM
146}
virtual unsigned int numberOfContainedROTs() const =0
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.

◆ associatedSurface()

◆ clone()

virtual CompetingRIOsOnTrack * Trk::CompetingRIOsOnTrack::clone ( ) const
overridepure virtual

◆ dump() [1/2]

MsgStream & Trk::CompetingRIOsOnTrack::dump ( MsgStream & out) const
overrideprotectedvirtual

returns the some information about the base class members (avoid code duplication)

Implements Trk::MeasurementBase.

Reimplemented in InDet::CompetingPixelClustersOnTrack, InDet::CompetingSCT_ClustersOnTrack, InDet::CompetingTRT_DriftCirclesOnTrack, and Muon::CompetingMuonClustersOnTrack.

Definition at line 114 of file CompetingRIOsOnTrack.cxx.

115{
116 out << " - effective pars locX : ";
117 if (m_localParams.contains(Trk::locX)) {
119 if (m_localParams.contains(Trk::locY)) {
120 out << " and " << (m_localParams)[Trk::locY];
121 }
122 } else {
123 out << "ill-defined! They are " << m_localParams;
124 }
126 if (m_localParams.contains(Trk::locY)) {
128 out << std::endl;
129 }
130 unsigned int indexOfMaxProb = indexOfMaxAssignProb();
131 out << " - Contains: |ROT# identifier locX dLocX locY dlocY "
132 "ass.Prob |";
133 for (unsigned int i = 0; i < this->numberOfContainedROTs(); ++i) {
134 out << std::endl
135 << " | " << i << " " << this->rioOnTrack(i).identify() << " ";
137 out << std::format("{:>10.6f} {}",
140 } else {
141 out << " ";
142 }
144 out << std::format(" {:>10.6f} {} ",
147 } else {
148 out << " ";
149 }
150 out << " " << m_assignProb.at(i) << (indexOfMaxProb == i ? " **|" : " |");
151 }
152 return out;
153}
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
LocalParameters m_localParams
Identifier identify() const
return the identifier -extends MeasurementBase
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:116
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37

◆ dump() [2/2]

std::ostream & Trk::CompetingRIOsOnTrack::dump ( std::ostream & out) const
overrideprotectedvirtual

returns the some information about the base class members (avoid code duplication)

Implements Trk::MeasurementBase.

Reimplemented in InDet::CompetingPixelClustersOnTrack, InDet::CompetingSCT_ClustersOnTrack, InDet::CompetingTRT_DriftCirclesOnTrack, and Muon::CompetingMuonClustersOnTrack.

Definition at line 156 of file CompetingRIOsOnTrack.cxx.

157{
158 out << " - effective pars locX : ";
159 if (m_localParams.contains(Trk::locX)) {
161 if (m_localParams.contains(Trk::locY)) {
162 out << " and " << (m_localParams)[Trk::locY];
163 }
164 } else {
165 out << "ill-defined! They are " << m_localParams;
166 }
168 if (m_localParams.contains(Trk::locY)) {
170 out << std::endl;
171 }
172
173 unsigned int indexOfMaxProb = indexOfMaxAssignProb();
174 out << " - Contains: |ROT# identifier locX dLocX locY dlocY "
175 "ass.Prob |";
176 for (unsigned int i = 0; i < this->numberOfContainedROTs(); ++i) {
177 out << std::endl
178 << " | " << i << " " << this->rioOnTrack(i).identify() << " ";
180 out << std::format("{:>10.6f} {}",
183 } else {
184 out << " ";
185 }
187 out << std::format(" {:>10.6f} {} ",
190 } else {
191 out << " ";
192 }
193 out << " " << m_assignProb.at(i) << (indexOfMaxProb == i ? " **|" : " |");
194 }
195 return out;
196}

◆ globalPosition()

◆ indexOfMaxAssignProb()

unsigned int Trk::CompetingRIOsOnTrack::indexOfMaxAssignProb ( ) const

Index of the ROT with the highest assignment probability.

Definition at line 100 of file CompetingRIOsOnTrack.cxx.

101{
102 unsigned int index = 0;
103 double maxAssgnProb = 0;
104 for (unsigned int i = 0; i < numberOfContainedROTs(); i++) {
105 if (m_assignProb[i] >= maxAssgnProb) {
106 index = i;
107 maxAssgnProb = m_assignProb[i];
108 }
109 }
110 return index;
111}
str index
Definition DeMoScan.py:362

◆ localCovariance()

const Amg::MatrixX & Trk::MeasurementBase::localCovariance ( ) const
inlineinherited

Interface method to get the localError.

Definition at line 138 of file MeasurementBase.h.

139{
140 return m_localCovariance;
141}
Amg::MatrixX m_localCovariance

◆ localParameters()

const Trk::LocalParameters & Trk::MeasurementBase::localParameters ( ) const
inlineinherited

Interface method to get the LocalParameters.

Definition at line 132 of file MeasurementBase.h.

133{
134 return m_localParams;
135}

◆ numberOfContainedROTs()

virtual unsigned int Trk::CompetingRIOsOnTrack::numberOfContainedROTs ( ) const
pure virtual

◆ operator=() [1/2]

CompetingRIOsOnTrack & Trk::CompetingRIOsOnTrack::operator= ( CompetingRIOsOnTrack && compROT)
defaultnoexcept

◆ operator=() [2/2]

CompetingRIOsOnTrack & Trk::CompetingRIOsOnTrack::operator= ( const CompetingRIOsOnTrack & compROT)
default

Assignment operator.

◆ rioOnTrack()

virtual const RIO_OnTrack & Trk::CompetingRIOsOnTrack::rioOnTrack ( unsigned int ) const
pure virtual

◆ ROTsHaveCommonSurface()

virtual bool Trk::CompetingRIOsOnTrack::ROTsHaveCommonSurface ( const bool withNonVanishingAssignProb = true) const
protectedpure virtual

query if all the contained ROTs have a common associated surface.

If withNonVanishingAssignProb==true just the ROTs with non-vanishing assignment probabilities are checked.

Implemented in InDet::CompetingPixelClustersOnTrack, InDet::CompetingSCT_ClustersOnTrack, InDet::CompetingTRT_DriftCirclesOnTrack, and Muon::CompetingMuonClustersOnTrack.

◆ setLocalParametersAndErrorMatrix()

void Trk::CompetingRIOsOnTrack::setLocalParametersAndErrorMatrix ( )
virtual

recalculate the LocalParameters and ErrorMatrix

Reimplemented in InDet::CompetingSCT_ClustersOnTrack, and InDet::CompetingTRT_DriftCirclesOnTrack.

Definition at line 33 of file CompetingRIOsOnTrack.cxx.

34{
35
37 // std::cout << "CompROT - weight matrices: " << std::endl;
38 // std::cout << "CompROT - [1] " << rioOnTrack(0).localCovariance() << std::endl;
39 Amg::MatrixX meanWeightMatrix =
41 for (unsigned int i = 1; i < numberOfContainedROTs(); i++) {
42 meanWeightMatrix += assignmentProbability(i) * rioOnTrack(i).localCovariance().inverse();
43 // std::cout << "CompROT - ["<< i << "] " << rioOnTrack(i).localCovariance() <<
44 // std::endl;
45 }
46 // limit weight values against values too close to 0, otherwise inversion will fail!
47 if (meanWeightMatrix.trace() <= 1.0e-15) {
48 meanWeightMatrix = Amg::MatrixX(rioOnTrack(0).localCovariance().rows(),
50 meanWeightMatrix.setZero();
51 for (int i = 0; i < meanWeightMatrix.cols(); ++i) {
52 meanWeightMatrix(i, i) = 1.0e-10;
53 }
54 }
55 // std::cout << "CompROT - mean weight: " << meanWeightMatrix << std::endl;
56 m_localCovariance = meanWeightMatrix.inverse();
57 // std::cout << "CompROT - mean covariance: " << localCovariance() << std::endl;
58
59 if (numberOfContainedROTs() == 1) {
61 } else {
63 Amg::VectorX meanParams =
65 for (unsigned int i = 1; i < numberOfContainedROTs(); i++) {
66 weight = rioOnTrack(i).localCovariance().inverse();
67 meanParams =
69 }
70 // std::cout << "CompROT - sum params: " << meanParams << std::endl;
71 meanParams = localCovariance() * meanParams;
72 // std::cout << "CompROT - mean params: " << meanParams << std::endl;
73 int paramKey = rioOnTrack(0).localParameters().parameterKey();
74 if (paramKey == 1) {
75 Trk::DefinedParameter Par1(meanParams[Trk::loc1], Trk::loc1);
76 m_localParams = Trk::LocalParameters(Par1);
77 } else if (paramKey == 3) {
78 Trk::DefinedParameter Par1(meanParams[Trk::loc1], Trk::loc1);
79 Trk::DefinedParameter Par2(meanParams[Trk::loc2], Trk::loc2);
80 m_localParams = Trk::LocalParameters(Par1, Par2);
81 } else {
82 std::cout << "Trk::CompetingRIOsOnTrack: can not handle parameter key " << paramKey
83 << std::endl;
84 }
85 }
86 } else {
87 // --------------------------------------------------
88 // Warning: effective localParams cannot be calculated when ROTs don't lie on the
89 // associated surface without detector specific knowledge.
90 // --------------------------------------------------
91 // return 0;
92 std::cout
93 << "Trk::CompetingRIOsOnTrack: can not handle ROTs in different surfaces without "
94 "detector specific knowledge "
95 << std::endl;
96 }
97}
virtual bool ROTsHaveCommonSurface(const bool withNonVanishingAssignProb=true) const =0
query if all the contained ROTs have a common associated surface.
AssignmentProb assignmentProbability(unsigned int indx) const
returns the AssignmentProbability depending on the integer.
int parameterKey() const
Identifier key for matrix expansion/reduction.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
@ loc2
generic first and second local coordinate
Definition ParamDefs.h:35
@ loc1
Definition ParamDefs.h:34
std::pair< double, ParamDefs > DefinedParameter
Typedef to of a std::pair<double, ParamDefs> to identify a passed-through double as a specific type o...

◆ type()

virtual bool Trk::CompetingRIOsOnTrack::type ( MeasurementBaseType::Type type) const
inlinefinaloverridevirtual

Extended method checking the type.

Implements Trk::MeasurementBase.

Definition at line 116 of file CompetingRIOsOnTrack.h.

117 {
119 }
virtual bool type(MeasurementBaseType::Type type) const override final
Extended method checking the type.

◆ uniqueClone()

std::unique_ptr< CompetingRIOsOnTrack > Trk::CompetingRIOsOnTrack::uniqueClone ( ) const
inline

NVI Clone.

Definition at line 88 of file CompetingRIOsOnTrack.h.

89 {
90 return std::unique_ptr<CompetingRIOsOnTrack>(clone());
91 }
virtual CompetingRIOsOnTrack * clone() const override=0
Pseudo-constructor: needed to avoid excessive RTTI.

◆ ::CompetingRIOsOnTrackCnv_p1

friend class ::CompetingRIOsOnTrackCnv_p1
friend

Definition at line 122 of file CompetingRIOsOnTrack.h.

Member Data Documentation

◆ m_assignProb

std::vector<AssignmentProb> Trk::CompetingRIOsOnTrack::m_assignProb
protected

assignment probabilities of the ROTs

Definition at line 125 of file CompetingRIOsOnTrack.h.

◆ m_localCovariance

Amg::MatrixX Trk::MeasurementBase::m_localCovariance
protectedinherited

Definition at line 112 of file MeasurementBase.h.

◆ m_localParams

LocalParameters Trk::MeasurementBase::m_localParams
protectedinherited

Definition at line 111 of file MeasurementBase.h.


The documentation for this class was generated from the following files: