ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
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. More...
 

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

std::vector< AssignmentProbm_assignProb
 assignment probabilities of the ROTs More...
 
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 19 of file CompetingRIOsOnTrack.cxx.

21  , m_assignProb()
22 {
23 }

◆ CompetingRIOsOnTrack() [2/4]

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

Constructor with parameters.

Definition at line 25 of file CompetingRIOsOnTrack.cxx.

27  , m_assignProb(std::move(assgnProb))
28 {
29 }

◆ 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 }

◆ associatedSurface()

virtual const Surface& Trk::MeasurementBase::associatedSurface ( ) const
pure virtualinherited

◆ 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 Muon::CompetingMuonClustersOnTrack, InDet::CompetingTRT_DriftCirclesOnTrack, InDet::CompetingPixelClustersOnTrack, and InDet::CompetingSCT_ClustersOnTrack.

Definition at line 115 of file CompetingRIOsOnTrack.cxx.

116 {
117 
118  boost::io::ios_all_saver ias(out.stream());
119  out << " - effective pars locX : ";
123  out << " and " << (m_localParams)[Trk::locY];
124  }
125  } else {
126  out << "ill-defined! They are " << m_localParams;
127  }
131  out << std::endl // << std::setiosflags(ios::right)<<std::setiosflags(ios::adjustfield)
132  << std::setiosflags(std::ios::fixed) << std::resetiosflags(std::ios::scientific)
133  << std::setprecision(6);
134  }
135  unsigned int indexOfMaxProb = indexOfMaxAssignProb();
136  out << " - Contains: |ROT# identifier locX dLocX locY dlocY "
137  "ass.Prob |";
138  for (unsigned int i = 0; i < this->numberOfContainedROTs(); ++i) {
139  out << std::endl
140  << " | " << i << " " << this->rioOnTrack(i).identify() << " ";
142  out << std::setw(10) << this->rioOnTrack(i).localParameters()[Trk::locX] << " "
143  << 1 / this->rioOnTrack(i).localCovariance()(Trk::locX, Trk::locX);
144  } else {
145  out << " ";
146  }
148  out << " " << std::setw(10) << this->rioOnTrack(i).localParameters()[Trk::locY] << " "
149  << 1 / this->rioOnTrack(i).localCovariance()(Trk::locY, Trk::locY) << " ";
150  } else {
151  out << " ";
152  }
153  out << " " << m_assignProb.at(i) << (indexOfMaxProb == i ? " **|" : " |");
154  }
155  ias.restore();
156  return out;
157 }

◆ 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 Muon::CompetingMuonClustersOnTrack, InDet::CompetingTRT_DriftCirclesOnTrack, InDet::CompetingPixelClustersOnTrack, and InDet::CompetingSCT_ClustersOnTrack.

Definition at line 160 of file CompetingRIOsOnTrack.cxx.

161 {
162  boost::io::ios_all_saver ias(out);
163  out << " - effective pars locX : ";
167  out << " and " << (m_localParams)[Trk::locY];
168  }
169  } else {
170  out << "ill-defined! They are " << m_localParams;
171  }
175  out << std::endl // << std::setiosflags(ios::right)<<std::setiosflags(ios::adjustfield)
176  << std::setiosflags(std::ios::fixed) << std::resetiosflags(std::ios::scientific)
177  << std::setprecision(6);
178  }
179 
180  unsigned int indexOfMaxProb = indexOfMaxAssignProb();
181  out << " - Contains: |ROT# identifier locX dLocX locY dlocY "
182  "ass.Prob |";
183  for (unsigned int i = 0; i < this->numberOfContainedROTs(); ++i) {
184  out << std::endl
185  << " | " << i << " " << this->rioOnTrack(i).identify() << " ";
187  out << std::setw(10) << this->rioOnTrack(i).localParameters()[Trk::locX] << " "
188  << 1 / this->rioOnTrack(i).localCovariance()(Trk::locX, Trk::locX);
189  } else {
190  out << " ";
191  }
193  out << " " << std::setw(10) << this->rioOnTrack(i).localParameters()[Trk::locY] << " "
194  << 1 / this->rioOnTrack(i).localCovariance()(Trk::locY, Trk::locY) << " ";
195  } else {
196  out << " ";
197  }
198  out << " " << m_assignProb.at(i) << (indexOfMaxProb == i ? " **|" : " |");
199  }
200  ias.restore();
201  return out;
202 }

◆ globalPosition()

virtual const Amg::Vector3D& Trk::MeasurementBase::globalPosition ( ) const
pure virtualinherited

◆ indexOfMaxAssignProb()

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

Index of the ROT with the highest assignment probability.

Definition at line 101 of file CompetingRIOsOnTrack.cxx.

102 {
103  unsigned int index = 0;
104  double maxAssgnProb = 0;
105  for (unsigned int i = 0; i < numberOfContainedROTs(); i++) {
106  if (m_assignProb[i] >= maxAssgnProb) {
107  index = i;
108  maxAssgnProb = m_assignProb[i];
109  }
110  }
111  return index;
112 }

◆ 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 }

◆ 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 Muon::CompetingMuonClustersOnTrack, InDet::CompetingTRT_DriftCirclesOnTrack, InDet::CompetingPixelClustersOnTrack, and InDet::CompetingSCT_ClustersOnTrack.

◆ setLocalParametersAndErrorMatrix()

void Trk::CompetingRIOsOnTrack::setLocalParametersAndErrorMatrix ( )
virtual

recalculate the LocalParameters and ErrorMatrix

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

Definition at line 34 of file CompetingRIOsOnTrack.cxx.

35 {
36 
37  if (ROTsHaveCommonSurface()) {
38  // std::cout << "CompROT - weight matrices: " << std::endl;
39  // std::cout << "CompROT - [1] " << rioOnTrack(0).localCovariance() << std::endl;
40  Amg::MatrixX meanWeightMatrix =
42  for (unsigned int i = 1; i < numberOfContainedROTs(); i++) {
43  meanWeightMatrix += assignmentProbability(i) * rioOnTrack(i).localCovariance().inverse();
44  // std::cout << "CompROT - ["<< i << "] " << rioOnTrack(i).localCovariance() <<
45  // std::endl;
46  }
47  // limit weight values against values too close to 0, otherwise inversion will fail!
48  if (meanWeightMatrix.trace() <= 1.0e-15) {
49  meanWeightMatrix = Amg::MatrixX(rioOnTrack(0).localCovariance().rows(),
51  meanWeightMatrix.setZero();
52  for (int i = 0; i < meanWeightMatrix.cols(); ++i) {
53  meanWeightMatrix(i, i) = 1.0e-10;
54  }
55  }
56  // std::cout << "CompROT - mean weight: " << meanWeightMatrix << std::endl;
57  m_localCovariance = meanWeightMatrix.inverse();
58  // std::cout << "CompROT - mean covariance: " << localCovariance() << std::endl;
59 
60  if (numberOfContainedROTs() == 1) {
62  } else {
64  Amg::VectorX meanParams =
66  for (unsigned int i = 1; i < numberOfContainedROTs(); i++) {
67  weight = rioOnTrack(i).localCovariance().inverse();
68  meanParams =
70  }
71  // std::cout << "CompROT - sum params: " << meanParams << std::endl;
72  meanParams = localCovariance() * meanParams;
73  // std::cout << "CompROT - mean params: " << meanParams << std::endl;
74  int paramKey = rioOnTrack(0).localParameters().parameterKey();
75  if (paramKey == 1) {
76  Trk::DefinedParameter Par1(meanParams[Trk::loc1], Trk::loc1);
78  } else if (paramKey == 3) {
79  Trk::DefinedParameter Par1(meanParams[Trk::loc1], Trk::loc1);
80  Trk::DefinedParameter Par2(meanParams[Trk::loc2], Trk::loc2);
81  m_localParams = Trk::LocalParameters(Par1, Par2);
82  } else {
83  std::cout << "Trk::CompetingRIOsOnTrack: can not handle parameter key " << paramKey
84  << std::endl;
85  }
86  }
87  } else {
88  // --------------------------------------------------
89  // Warning: effective localParams cannot be calculated when ROTs don't lie on the
90  // associated surface without detector specific knowledge.
91  // --------------------------------------------------
92  // return 0;
93  std::cout
94  << "Trk::CompetingRIOsOnTrack: can not handle ROTs in different surfaces without "
95  "detector specific knowledge "
96  << std::endl;
97  }
98 }

◆ 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  }

◆ 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  }

Friends And Related Function Documentation

◆ ::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:
Trk::LocalParameters
Definition: LocalParameters.h:98
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Trk::locX
@ locX
Definition: ParamDefs.h:37
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
Trk::LocalParameters::parameterKey
int parameterKey() const
Identifier key for matrix expansion/reduction.
index
Definition: index.py:1
Trk::LocalParameters::contains
bool contains(ParamDefs par) const
The simple check for the clients whether the parameter is contained.
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
Trk::loc2
@ loc2
generic first and second local coordinate
Definition: ParamDefs.h:35
Trk::CompetingRIOsOnTrack::type
virtual bool type(MeasurementBaseType::Type type) const override final
Extended method checking the type.
Definition: CompetingRIOsOnTrack.h:116
Trk::DefinedParameter
std::pair< double, ParamDefs > DefinedParameter
Definition: DefinedParameter.h:27
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
Trk::CompetingRIOsOnTrack::rioOnTrack
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
beamspotnt.cols
list cols
Definition: bin/beamspotnt.py:1114
Trk::CompetingRIOsOnTrack::numberOfContainedROTs
virtual unsigned int numberOfContainedROTs() const =0
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::MeasurementBaseType::CompetingRIOsOnTrack
@ CompetingRIOsOnTrack
Definition: MeasurementBase.h:50
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
Trk::CompetingRIOsOnTrack::m_assignProb
std::vector< AssignmentProb > m_assignProb
assignment probabilities of the ROTs
Definition: CompetingRIOsOnTrack.h:125
beamspotnt.rows
list rows
Definition: bin/beamspotnt.py:1112
Trk::MeasurementBase::m_localParams
LocalParameters m_localParams
Definition: MeasurementBase.h:111
Trk::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk::CompetingRIOsOnTrack::clone
virtual CompetingRIOsOnTrack * clone() const override=0
Pseudo-constructor: needed to avoid excessive RTTI.
Trk::CompetingRIOsOnTrack::ROTsHaveCommonSurface
virtual bool ROTsHaveCommonSurface(const bool withNonVanishingAssignProb=true) const =0
query if all the contained ROTs have a common associated surface.
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
Trk::MeasurementBase::m_localCovariance
Amg::MatrixX m_localCovariance
Definition: MeasurementBase.h:112
DeMoScan.index
string index
Definition: DeMoScan.py:364
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
Trk::CompetingRIOsOnTrack::indexOfMaxAssignProb
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
Definition: CompetingRIOsOnTrack.cxx:101
Trk::loc1
@ loc1
Definition: ParamDefs.h:34
Trk::CompetingRIOsOnTrack::assignmentProbability
AssignmentProb assignmentProbability(unsigned int indx) const
returns the AssignmentProbability depending on the integer.
Definition: CompetingRIOsOnTrack.h:139