BOSS 7.1.2
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 36 of file Ext_errmx.h.

Constructor & Destructor Documentation

◆ Ext_errmx() [1/3]

Ext_errmx::Ext_errmx ( )

Definition at line 29 of file Ext_errmx.cxx.

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

◆ Ext_errmx() [2/3]

Ext_errmx::Ext_errmx ( const Ext_errmx & errmx)

Definition at line 34 of file Ext_errmx.cxx.

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

◆ Ext_errmx() [3/3]

Ext_errmx::Ext_errmx ( const HepSymMatrix & err)

Definition at line 38 of file Ext_errmx.cxx.

38 : m_err(err),
39 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 49 of file Ext_errmx.h.

49{};

Member Function Documentation

◆ get_err()

const HepSymMatrix & Ext_errmx::get_err ( ) const
inline

Definition at line 157 of file Ext_errmx.h.

157 {
158 return m_err;
159}

Referenced by ExtSteppingAction::UserSteppingAction().

◆ get_plane_err()

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

Definition at line 85 of file Ext_errmx.cxx.

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

Referenced by ExtSteppingAction::UserSteppingAction().

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

◆ 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 278 of file Ext_errmx.cxx.

282{
283
284 Hep3Vector np( pv.unit() );
285 Hep3Vector nz( 0.0, 0.0, 1.0 );
286 Hep3Vector nt( (nz.cross(np)).unit() );
287 Hep3Vector nr( nt.cross(np) );
288
289 const HepVector & err_v = (*this).get_plane_errs( np, nr, nt );
290 *m_nv = err_v[0]*nr;
291 *(m_nv+1) = err_v[1]*nt;
292 return( m_nv );
293
294}

◆ 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 215 of file Ext_errmx.cxx.

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

◆ operator=()

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

Definition at line 316 of file Ext_errmx.cxx.

317{
318 if( this != &err ){
319 m_err = err.m_err;
320 m_err3 = err.m_err3;
321 m_err2 = err.m_err2;
322 m_R = err.m_R;
323 m_valid = err.m_valid;
324 *m_nv = *err.m_nv;
325 *(m_nv+1) = *(err.m_nv+1);
326 }
327 return *this;
328}

◆ put_err() [1/2]

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

Definition at line 45 of file Ext_errmx.cxx.

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

Referenced by Ext_xp_err::set_err(), and ExtSteppingAction::UserSteppingAction().

◆ put_err() [2/2]

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

Definition at line 148 of file Ext_errmx.h.

149{
150 m_err = err;
151 m_valid = 1;
152}

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

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

◆ valid()

bool Ext_errmx::valid ( bool msg) const

Definition at line 300 of file Ext_errmx.cxx.

301{
302 if( m_valid ){
303 if( Ext_err_valid( msg, m_err, 6 ) ){
304 return 1;
305 } else {
306 m_valid = 0;
307 return 0;
308 }
309 } else {
310 return 0;
311 }
312}
bool Ext_err_valid(bool msg, HepSymMatrix &error, const int dimension)

Friends And Related Symbol Documentation

◆ operator<<

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

Definition at line 333 of file Ext_errmx.cxx.

334{
335 s << " m_valid: " << err.m_valid << '\n'
336 << "m_err: " << err.m_err << " m_err3: " << err.m_err3
337 << " m_R: " << err.m_R << " m_err2: " << err.m_err2
338 << " *m_nv: " << *err.m_nv
339 << " *(m_nv+1): " << *(err.m_nv+1)
340 << std::endl;
341 return s;
342}
XmlRpcServer s

Member Data Documentation

◆ m_err

HepSymMatrix Ext_errmx::m_err
protected

Definition at line 133 of file Ext_errmx.h.

Referenced by get_err(), Ext_xp_err::move(), operator=(), put_err(), put_err(), set_plane_errs(), and valid().


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