ATLAS Offline Software
Loading...
Searching...
No Matches
AlignTSOS.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
10
11#include <iostream>
12
13namespace Trk {
14
15 //________________________________________________________________________
18 const RIO_OnTrack * rio,
22 , m_rio(rio)
23 , m_crio(nullptr)
24 , m_unbiasedTrackPars(nullptr)
25 , m_derivatives(nullptr)
26 , m_isvalid(true)
28 , m_measDir(Trk::x)
29 , m_alphaStrip(0)
30 , m_derivativesVtx(nullptr)
31 {
32 if(!module)
33 m_isvalid = false;
34
35 const TrkDetElementBase * detelement(nullptr);
37
38 m_detelements.push_back(detelement);
39 }
40
41 //________________________________________________________________________
48 , m_rio(nullptr)
49 , m_crio(crio)
50 , m_unbiasedTrackPars(nullptr)
51 , m_derivatives(nullptr)
52 , m_isvalid(true)
54 , m_measDir(Trk::x)
55 , m_alphaStrip(0)
56 , m_derivativesVtx(nullptr)
57 {
58 if(!module)
59 m_isvalid = false;
60
61 for (unsigned int irio = 0; irio < crio->numberOfContainedROTs(); irio++) {
62 const Trk::RIO_OnTrack& rio = crio->rioOnTrack(irio);
63 m_detelements.push_back(rio.associatedSurface().associatedDetectorElement());
64 }
65 }
66
67 //________________________________________________________________________
71 , m_module(nullptr)
72 , m_rio(nullptr)
73 , m_crio(nullptr)
74 , m_unbiasedTrackPars(nullptr)
75 , m_derivatives(nullptr)
76 , m_isvalid(false)
78 , m_measDir(Trk::x)
79 , m_alphaStrip(0)
80 , m_derivativesVtx(nullptr)
81 {
82 m_detelements.push_back(nullptr);
83 }
84
85 //________________________________________________________________________
87 {
89 delete m_derivatives;
90 }
91
92 //________________________________________________________________________
94 : TrackStateOnSurface(atsos)
95 , m_module(atsos.m_module)
96 , m_rio(atsos.m_rio)
97 , m_crio(atsos.m_crio)
101 , m_derivatives(atsos.m_derivatives ? new std::vector<Amg::VectorX>(*(atsos.m_derivatives)) : nullptr)
102 , m_isvalid(atsos.m_isvalid)
103 , m_measType(atsos.m_measType)
104 , m_measDir(atsos.m_measDir)
107 {
108 }
109
110 //________________________________________________________________________
112 {
113 if(this != &atsos) {
114
115 // assign TrackStateOnSurface contents
117
118 // copy the rest
119 m_module = atsos.m_module;
120 m_rio = atsos.m_rio;
121 m_crio = atsos.m_crio;
122
123 m_residuals.clear();
124 m_residuals = atsos.m_residuals;
125
126 m_detelements.clear();
128
129 m_isvalid = atsos.m_isvalid;
130 m_measType = atsos.m_measType;
131 m_measDir = atsos.m_measDir;
133
134 delete m_unbiasedTrackPars;
136
137 delete m_derivatives;
138 m_derivatives = atsos.m_derivatives ? new std::vector<Amg::VectorX>(*(atsos.m_derivatives)) : nullptr;
139
141 }
142
143 return *this;
144 }
145
146 //________________________________________________________________________
148 {
149 Identifier id(0);
150 const MeasurementBase* mesb = this->measurementOnTrack();
151 const RIO_OnTrack* rio = dynamic_cast<const RIO_OnTrack*>(mesb);
152 if (rio) id=rio->identify();
153 return id;
154 }
155
156 //________________________________________________________________________
158 if (m_rio) return m_rio;
159 else if (m_crio) return &(m_crio->rioOnTrack(0));
160 else return nullptr;
161 }
162
163 //________________________________________________________________________
164 MsgStream& operator << ( MsgStream& sl, const AlignTSOS& atsos)
165 {
166 //sl <<"\t"<<atsos.dumpType()
167 // << std::setw(11) << std::showpos<< std::scientific
168 // <<"\tres[0]="<<atsos.residual(0)<<", err[0]="<<atsos.residualErrorSq(0)
169 // <<", dchi2="<<std::noshowpos
170 // <<atsos.residual(0)*atsos.residual(0)/atsos.residualErrorSq(0)<<endmsg;
171 sl <<"\t"<<atsos.dumpType()<<" ("<<atsos.dumpMeasType()<<", direction "<<atsos.dumpMeasDir()<<")"<<endmsg;
172 sl << " --> ";
173
174 int ires(0);
175 std::vector<Residual>::const_iterator itRes = atsos.firstResidual();
176 std::vector<Residual>::const_iterator itRes_end = atsos.lastResidual();
177 for( ; itRes != itRes_end ; ++itRes, ++ires) {
178 double resnorm = itRes->residualNorm();
179 if(ires){
180 std::ios_base::fmtflags f(sl.stream().flags());
181 sl << endmsg << " --> ";
182 sl << ires << ": res="
183 << std::setw(11) << std::showpos << std::scientific
184 << itRes->residual() <<" res/err="<<resnorm
185 << ", dchi2="<<std::noshowpos<<resnorm*resnorm
186 << resetiosflags(std::ios::floatfield);
187 sl.flags(f);
188 }
189 }
190 return sl;
191 }
192
193 //________________________________________________________________________
194 std::string AlignTSOS::dumpMeasType() const
195 {
196 switch(m_measType) {
197 case Trk::TrackState::unidentified: return "none";
198 case Trk::TrackState::Pixel: return "Pixel";
199 case Trk::TrackState::SCT: return "SCT";
200 case Trk::TrackState::TRT: return "TRT";
201 case Trk::TrackState::MDT: return "MDT";
202 case Trk::TrackState::CSC: return "CSC";
203 case Trk::TrackState::RPC: return "RPC";
204 case Trk::TrackState::TGC: return "TGC";
205 case Trk::TrackState::Pseudo: return "Pseudo";
206 case Trk::TrackState::Vertex: return "Vertex";
207 case Trk::TrackState::Segment: return "Segment";
208 case Trk::TrackState::SpacePoint: return "SpacePoint";
209 default: return "UNDEFINED";
210 }
211 }
212
213 //________________________________________________________________________
214 std::string AlignTSOS::dumpMeasDir() const
215 {
216 switch(m_measDir) {
217 case Trk::x: return "X";
218 case Trk::y: return "Y";
219 case Trk::z: return "Z";
220 default: return "?";
221 }
222 }
223
224} // end namespace
225
#define endmsg
double m_alphaStrip
Definition AlignTSOS.h:177
const RIO_OnTrack * rio() const
returns RIO_OnTrack or leading RIO of CompetingRIOsOnTrack (assigned by c'tor)
TrackState::MeasurementType m_measType
Definition AlignTSOS.h:173
std::vector< Residual >::const_iterator lastResidual() const
returns last Residual iterator
Definition AlignTSOS.h:107
virtual ~AlignTSOS()
destructor
Definition AlignTSOS.cxx:86
AlignModule * m_module
Definition AlignTSOS.h:159
AlignTSOS(const TrackStateOnSurface &tsos, AlignModule *module, const RIO_OnTrack *rio, TrackState::MeasurementType detType)
constructor takes: 1) the TSOS from the original track, 2) the AlignModule containing the TrkDetEleme...
Definition AlignTSOS.cxx:16
std::vector< const TrkDetElementBase * > m_detelements
Definition AlignTSOS.h:167
std::string dumpMeasDir() const
returns string corresponding to the measurement direction
std::vector< Residual > m_residuals
Definition AlignTSOS.h:165
const CompetingRIOsOnTrack * m_crio
Definition AlignTSOS.h:161
std::vector< Amg::VectorX > * m_derivativesVtx
Definition AlignTSOS.h:179
AlignTSOS & operator=(const AlignTSOS &atsos)
asignment operator
const RIO_OnTrack * m_rio
Definition AlignTSOS.h:160
Identifier identify() const
returns Identifier of RIO
std::vector< Residual >::const_iterator firstResidual() const
returns first Residual iterator
Definition AlignTSOS.h:104
const CompetingRIOsOnTrack * crio() const
returns CompetingRIOsOnTrack
Definition AlignTSOS.h:92
Trk::ParamDefs m_measDir
direction of measurement (set to Trk::x by default)
Definition AlignTSOS.h:175
const AlignModule * module() const
accessor method for AlignModule to which tsos belongs
Definition AlignTSOS.h:69
std::string dumpMeasType() const
returns string corresponding to the measurement type
std::vector< Amg::VectorX > * m_derivatives
Definition AlignTSOS.h:169
const TrackParameters * m_unbiasedTrackPars
Definition AlignTSOS.h:163
const TrkDetElementBase * detelement(int i=0) const
method for retrieving detector elements (one if RIO, more if CRIO)
Definition AlignTSOS.h:110
TrackState::MeasurementType measType() const
returns measurement type enum
Definition AlignTSOS.h:80
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
This class is the pure abstract base class for all fittable tracking measurements.
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
virtual ParametersBase< DIM, T > * clone() const override=0
clone method for polymorphic deep copy
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
virtual TrackStateOnSurface * clone() const
Pseudo-constructor: needed to avoid excessive RTTI.
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
TrackStateOnSurface()
Default ctor for POOL.
std::string dumpType() const
returns a string with the expanded type of the object (i.e.
Trk::TrackStateOnSurface & operator=(const Trk::TrackStateOnSurface &rhs)
This is the base class for all tracking detector elements with read-out relevant information.
Definition of ATLAS Math & Geometry primitives (Amg)
MeasurementType
enum describing the flavour of MeasurementBase
Ensure that the ATLAS eigen extensions are properly loaded.
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
@ x
Definition ParamDefs.h:55
@ z
global position (cartesian)
Definition ParamDefs.h:57
@ y
Definition ParamDefs.h:56
STL namespace.