BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Ext_errmx Class Reference

#include <Ext_errmx.h>

Inheritance diagram for Ext_errmx:

Public Member Functions

 Ext_errmx ()
 Ext_errmx (const Ext_errmx &errmx)
 Ext_errmx (const HepSymMatrix &err)
virtual ~Ext_errmx ()
void put_err (const double error[])
void put_err (const HepSymMatrix &err)
const HepSymMatrix & get_err () const
double get_plane_err (const Hep3Vector &np, const Hep3Vector &nr) const
const HepVector & get_plane_errs (const Hep3Vector &np, const Hep3Vector &nr, const Hep3Vector &nt) const
const Hep3Vector * get_tvs (const int view, const Hep3Vector &pv) const
const Hep3Vector * get_tvs (const Hep3Vector &pv) const
bool valid (bool msg) const
Ext_errmxoperator= (const Ext_errmx &errmx)

Protected Member Functions

void set_plane_errs (const Hep3Vector &nx, const Hep3Vector &ny, const Hep3Vector &nz) const

Protected Attributes

HepSymMatrix m_err

Friends

std::ostream & operator<< (std::ostream &s, const Ext_errmx &errmx)

Detailed Description

Definition at line 33 of file Ext_errmx.h.

Constructor & Destructor Documentation

◆ Ext_errmx() [1/3]

Ext_errmx::Ext_errmx ( )

Definition at line 28 of file Ext_errmx.cxx.

29 : m_err( Ndim_err, 0 ), m_err3( 3, 0 ), m_R( 3, 3, 0 ), m_err2( 2 ), m_valid( 0 ) {}
HepSymMatrix m_err
Definition Ext_errmx.h:128

Referenced by Ext_errmx(), Ext_xp_err::Ext_xp_err(), operator<<, Ext_xp_err::operator<<, operator=(), Ext_xp_err::operator=(), and Ext_xp_err::set_err().

◆ Ext_errmx() [2/3]

Ext_errmx::Ext_errmx ( const Ext_errmx & errmx)

Definition at line 33 of file Ext_errmx.cxx.

34 : m_err( err.m_err )
35 , m_err3( err.m_err3 )
36 , m_R( err.m_R )
37 , m_err2( err.m_err2 )
38 , m_valid( err.m_valid ) {}

◆ Ext_errmx() [3/3]

Ext_errmx::Ext_errmx ( const HepSymMatrix & err)

Definition at line 40 of file Ext_errmx.cxx.

41 : m_err( err ), m_err3( 3, 0 ), m_R( 3, 3, 0 ), m_err2( 2 ), m_valid( 1 ) {}

◆ ~Ext_errmx()

virtual Ext_errmx::~Ext_errmx ( )
inlinevirtual

Definition at line 46 of file Ext_errmx.h.

46{};

Member Function Documentation

◆ get_err()

const HepSymMatrix & Ext_errmx::get_err ( ) const
inline

Definition at line 149 of file Ext_errmx.h.

149{ return m_err; }

◆ get_plane_err()

double Ext_errmx::get_plane_err ( const Hep3Vector & np,
const Hep3Vector & nr ) const

Definition at line 83 of file Ext_errmx.cxx.

92{
93
94 // Check the validity of the error matrix.
95
96 if ( !( *this ).valid( 0 ) )
97 {
98 // std::cout << "%WARNING at Ext_get_plane_err: You are trying to calculate"
99 // << " error \n using an invalid error matrix." << std::endl;
100 }
101
102 // Construct 3 TCS axes.
103
104 // x: nx --- unit vector which is perp to np and on the plane of nr and np.
105 // y: nz x nx
106 // z: nz( = np ) --- direction of the track.
107
108 double nr_np( nr * np );
109 double denom( 1.0 - nr_np * nr_np );
110 double error( 0.0 );
111
112 if ( denom > Eps )
113 { // Track is not parallel to the readout direction.
114
115 double fac( 1.0 / sqrt( denom ) );
116 Hep3Vector nx( ( nr - nr_np * np ) * fac );
117 Hep3Vector ny( np.cross( nx ) );
118
119 ( *this ).set_plane_errs( nx, ny, np );
120
121 double sigma2( m_err3( 1, 1 ) ); // Error along nx.
122 if ( sigma2 > 0 )
123 {
124 error = sqrt( sigma2 ) * fac; // Error projection.
125 }
126 }
127 else
128 { // Track is parallel to the readout direction.
129
130 error = Infinite;
131 }
132 return ( error );
133}

◆ get_plane_errs()

const HepVector & Ext_errmx::get_plane_errs ( const Hep3Vector & np,
const Hep3Vector & nr,
const Hep3Vector & nt ) const

Get the 2D projected error vector on the detector plane. \begin{itemize} \item np: track direction unit vector. \item nr: readout direction unit vector. \item nt: ( np x nr ) unit vector. \item HepVector(1)= error(sigma) along the nr. \item HepVector(2)= error(sigma) along the nt. \end{itemize}

Definition at line 140 of file Ext_errmx.cxx.

151{
152
153 // Check the validity of the error matrix.
154
155 if ( !( *this ).valid( 1 ) )
156 {
157 // std::cout << "%WARNING at Ext_get_plane_errs: You are trying to calculate"
158 // << " error \n using an invalid error matrix." << std::endl;
159 }
160
161 double nr_np( nr * np );
162 double denom_r( 1.0 - nr_np * nr_np );
163
164 if ( denom_r > Eps )
165 { // nr is not parallel to the track direction: np.
166
167 double nt_np( nt * np );
168 double denom_t( 1.0 - nt_np * nt_np );
169 double fac_r( 1.0 / sqrt( denom_r ) );
170 Hep3Vector nx( ( nr - nr_np * np ) * fac_r );
171 Hep3Vector ny( np.cross( nx ) );
172
173 ( *this ).set_plane_errs( nx, ny, np );
174
175 double sigma2( m_err3( 1, 1 ) ); // Error along nx.
176 if ( sigma2 > 0 )
177 {
178 m_err2( 1 ) = sqrt( sigma2 ) * fac_r; // Error projection.
179 }
180 else { m_err2( 1 ) = 0.0; }
181
182 if ( denom_t > Eps )
183 { // nt is not parallel to the track direction: np.
184 double fac_t( 1.0 / sqrt( denom_t ) );
185 sigma2 = m_err3( 2, 2 );
186 if ( sigma2 > 0 )
187 {
188 m_err2( 2 ) = sqrt( sigma2 ) * fac_t; // Error projection.
189 }
190 else { m_err2( 2 ) = 0.0; }
191 }
192 else
193 { // nt is parallel to the track direction: np.
194 m_err2( 2 ) = ( *this ).get_plane_err( np, nt );
195 }
196 }
197 else
198 { // nr is parallel to the track direction: np.
199 m_err2( 1 ) = ( *this ).get_plane_err( np, nr );
200 m_err2( 2 ) = ( *this ).get_plane_err( np, nt );
201 }
202 return ( m_err2 );
203}

◆ get_tvs() [1/2]

const Hep3Vector * Ext_errmx::get_tvs ( const Hep3Vector & pv) const

Get the 2D projected track error perpendicular to a given vector at the current point. pv: a given vector, momentum vector, for example. \begin{itemize} \item Hep3Vector(1)= error(1 sigma) along the direction which is perpendicular to pv on the plane formed by pv and z-axis. \item Hep3Vector(2)= error(1 sigma) along the direction which is (pv) x (HepVector(1) direction). \end{itemize}

Definition at line 294 of file Ext_errmx.cxx.

298{
299
300 Hep3Vector np( pv.unit() );
301 Hep3Vector nz( 0.0, 0.0, 1.0 );
302 Hep3Vector nt( ( nz.cross( np ) ).unit() );
303 Hep3Vector nr( nt.cross( np ) );
304
305 const HepVector& err_v = ( *this ).get_plane_errs( np, nr, nt );
306 *m_nv = err_v[0] * nr;
307 *( m_nv + 1 ) = err_v[1] * nt;
308 return ( m_nv );
309}

◆ get_tvs() [2/2]

const Hep3Vector * Ext_errmx::get_tvs ( const int view,
const Hep3Vector & pv ) const

Get 2D projected track error perpendicular to a given vector at the current point. pv: a given vector, momentum vector for example. \begin{itemize} \item view=1. \begin{itemize} \item Hep3Vector(1)= error(1 sigma) along the direction which is perpendicular to pv on the xy plane. \item Hep3Vector(2)= error(1 sigma) along the direction which is (pv) x (HepVector(1) direction). \end{itemize} \item view=2. \begin{itemize} \item Hep3Vector(1)= error(1 sigma) along the direction which is perpendicular to pv on the zy plane. \item Hep3Vector(2)= error(1 sigma) along the direction which is (pv) x (HepVector(1) direction). \end{itemize} \item view=3. \begin{itemize} \item Hep3Vector(1)= error(1 sigma) along the direction which is perpendicular to pv on the zx plane. \item Hep3Vector(2)= error(1 sigma) along the direction which is (pv) x (HepVector(1) direction). \end{itemize} \end{itemize}

Definition at line 222 of file Ext_errmx.cxx.

227{
228
229 Hep3Vector np( pv.unit() );
230 Hep3Vector nr;
231
232 switch ( view )
233 {
234
235 case 1: // xy view
236
237 if ( np.x() != 0 || np.y() != 0 )
238 {
239 nr.setX( np.y() );
240 nr.setY( -np.x() );
241 nr = nr.unit();
242 }
243 else
244 { // Pointing to z-direction.
245 nr.setX( 1 );
246 }
247 break;
248
249 case 2: // zy view
250
251 if ( np.y() != 0 || np.z() != 0 )
252 {
253 nr.setY( -np.z() );
254 nr.setZ( np.y() );
255 nr = nr.unit();
256 }
257 else
258 { // Pointing to x-direction.
259 nr.setZ( 1 );
260 }
261 break;
262
263 case 3: // zx view
264
265 if ( np.z() != 0 || np.x() != 0 )
266 {
267 nr.setX( -np.z() );
268 nr.setZ( np.x() );
269 nr = nr.unit();
270 }
271 else
272 { // Pointing to z-direction.
273 nr.setZ( 1 );
274 }
275 break;
276 } /* End of switch */
277
278 Hep3Vector nt( np.cross( nr ) );
279 const HepVector& err_v = ( *this ).get_plane_errs( np, nr, nt );
280 *m_nv = err_v[0] * nr;
281 *( m_nv + 1 ) = err_v[1] * nt;
282 return ( m_nv );
283}

◆ operator=()

Ext_errmx & Ext_errmx::operator= ( const Ext_errmx & errmx)

Definition at line 330 of file Ext_errmx.cxx.

330 {
331 if ( this != &err )
332 {
333 m_err = err.m_err;
334 m_err3 = err.m_err3;
335 m_err2 = err.m_err2;
336 m_R = err.m_R;
337 m_valid = err.m_valid;
338 *m_nv = *err.m_nv;
339 *( m_nv + 1 ) = *( err.m_nv + 1 );
340 }
341 return *this;
342}

◆ put_err() [1/2]

void Ext_errmx::put_err ( const double error[])

Definition at line 47 of file Ext_errmx.cxx.

47 {
48 int ne = 0;
49
50 for ( int i = 1; i <= m_err.num_col(); i++ )
51 {
52 for ( int j = 1; j <= i; j++ ) { m_err.fast( i, j ) = error[ne++]; }
53 }
54 m_valid = 1;
55}

Referenced by Ext_xp_err::set_err().

◆ put_err() [2/2]

void Ext_errmx::put_err ( const HepSymMatrix & err)
inline

Definition at line 141 of file Ext_errmx.h.

141 {
142 m_err = err;
143 m_valid = 1;
144}

◆ set_plane_errs()

void Ext_errmx::set_plane_errs ( const Hep3Vector & nx,
const Hep3Vector & ny,
const Hep3Vector & nz ) const
protected

Definition at line 60 of file Ext_errmx.cxx.

61 {
62 // Setup the rotation matrix.
63
64 m_R( 1, 1 ) = nx.x();
65 m_R( 1, 2 ) = nx.y();
66 m_R( 1, 3 ) = nx.z();
67 m_R( 2, 1 ) = ny.x();
68 m_R( 2, 2 ) = ny.y();
69 m_R( 2, 3 ) = ny.z();
70 m_R( 3, 1 ) = nz.x();
71 m_R( 3, 2 ) = nz.y();
72 m_R( 3, 3 ) = nz.z();
73
74 // Get the 3x3 sub matrix and Rotate the error matrix.
75
76 m_err3 = ( m_err.sub( 1, 3 ) ).similarity( m_R );
77}

◆ valid()

bool Ext_errmx::valid ( bool msg) const

Definition at line 315 of file Ext_errmx.cxx.

315 {
316 if ( m_valid )
317 {
318 if ( Ext_err_valid( msg, m_err, 6 ) ) { return 1; }
319 else
320 {
321 m_valid = 0;
322 return 0;
323 }
324 }
325 else { return 0; }
326}
bool Ext_err_valid(bool msg, HepSymMatrix &error, const int dimension)

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const Ext_errmx & errmx )
friend

Definition at line 347 of file Ext_errmx.cxx.

347 {
348 s << " m_valid: " << err.m_valid << '\n'
349 << "m_err: " << err.m_err << " m_err3: " << err.m_err3 << " m_R: " << err.m_R
350 << " m_err2: " << err.m_err2 << " *m_nv: " << *err.m_nv
351 << " *(m_nv+1): " << *( err.m_nv + 1 ) << std::endl;
352 return s;
353}
XmlRpcServer s

Member Data Documentation

◆ m_err

HepSymMatrix Ext_errmx::m_err
protected

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