BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
DifVector.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: DifVector.h,v 1.3 2009/12/23 02:59:56 zhangy Exp $
4//
5// Description:
6// Class Header for |DifVector|
7// A 3-vector based on differential numbers
8//
9// Environment:
10// Software developed for the BaBar Detector at the SLAC B-Factory.
11//
12// Author List:
13// A. Snyder
14//
15// Copyright Information:
16// Copyright (C) 1996 SLAC
17//
18// History:
19// Migration for BESIII MDC
20//
21//------------------------------------------------------------------------
22
23#ifndef DifVector_H
24#define DifVector_H
25
27#include "CLHEP/Vector/ThreeVector.h"
28#include <iosfwd>
29class DifRotation;
30using CLHEP::Hep3Vector;
31
32class DifVector {
33
34public:
35
36 //constructors
37 DifVector(); // null - default
38 DifVector // construct from components
39 (const DifNumber& x,const DifNumber& y,const DifNumber& z);
41 (double x,double y,double z);
42 DifVector // construct from |Hep3Vector|
43 (const Hep3Vector& v);
44 DifVector(const DifVector& v); // copy
45
46 //destructor
47 ~DifVector() {} // destroy
48
49 //given error on parameters calculate error on vector
50 HepSymMatrix errorMatrix // caclulate error matrix
51 (const HepSymMatrix& e)const;
52
53 //give jacobian transformation matrix wrt independent parameters;
54 HepMatrix jacobian()const;
55
56 //operators
60 inline DifVector& operator*=(const double& n);
62 DifVector& operator/=(const double& n);
63 inline DifVector& operator=(const DifVector & v);
64 inline DifVector operator-()const;
65
66 inline friend DifVector operator+ // vector sum
67 (const DifVector& a,const DifVector& b);
68 inline friend DifVector operator- // vector difference
69 (const DifVector& a,const DifVector& b);
70 inline friend DifNumber operator* // scalar product
71 (const DifVector& a,const DifVector& b);
72 inline friend DifVector operator* // vector*scalar
73 (const DifVector& v,const DifNumber& n);
74 inline friend DifVector operator* // scalar*vector
75 (const DifNumber& n,const DifVector& v);
76 inline friend DifVector operator/ // vector/scalar
77 (const DifVector& v,const DifNumber& n);
78 inline friend DifVector operator* // vector*scalar
79 (const DifVector& v,const double& n);
80 inline friend DifVector operator* // scalar*vector
81 (const double& n,const DifVector& v);
82 inline friend DifVector operator/ // vector/scalar
83 (const DifVector& v,const double& n);
84
85
86 //other operations
87 inline friend DifVector cross(const DifVector& a,const DifVector& b);
88
89 //access
90 inline int nPar()const; // return number of params
91
92 //i/o
93 void print()const; // print out
94
95
96 //manipulations
97
98 //misc
99 inline DifVector& flipsign(); // flip sign of all components
100 inline DifVector& normalize(); // norm to unit vector
101 inline DifVector& zeroDerivatives(); // zero derivatives
102
103
104 //rotations
105 inline DifVector& rotate(const DifVector& axis,const DifNumber& angle); // rotate around axis
106 inline DifVector& rotate(const DifVector& axis, const DifNumber& cosine, const DifNumber& sine);// rotate with cos and sine
107 DifVector& rotate(const DifNumber& alpha,const DifNumber& beta,const DifNumber& gamma); // euler angles
108 DifVector& rotate(const DifRotation& r); // rotatation matrix
109 inline DifVector& rotateX(const DifNumber& angle); // around x
110 inline DifVector& rotateX(const DifNumber& cosine,const DifNumber& sine);
111 inline DifVector& rotateY(const DifNumber& angle); // around y
112 inline DifVector& rotateY(const DifNumber& cosine,const DifNumber& sine);
113 inline DifVector& rotateZ(const DifNumber& angle); // around z
114 inline DifVector& rotateZ(const DifNumber& cosine,const DifNumber& sine);
115
116 inline DifVector& rotate(const DifVector& axis,const double& angle); // rotate around axis
117 inline DifVector& rotate(const DifVector& axis, const double& cosine, const double& sine);// rotate with cos and sine
118 DifVector& rotate(const double& alpha,const double& beta,const double& gamma); // euler angles
119 inline DifVector& rotateX(const double& angle); // around x
120 inline DifVector& rotateX(const double& cosine,const double& sine);
121 inline DifVector& rotateY(const double& angle); // around y
122 inline DifVector& rotateY(const double& cosine,const double& sine);
123 inline DifVector& rotateZ(const double& angle); // around z
124 inline DifVector& rotateZ(const double& cosine,const double& sine);
125
126 //algebra
127 inline DifVector transverse // part tranverse to |v|
128 (const DifVector& v)const;
129 inline DifNumber dot // scalr product
130 (const DifVector& v)const;
131 inline DifNumber length()const; // length of vector
132 inline DifNumber lengthSq()const; // length squared
133 inline DifVector unit()const; // direction
134 inline DifNumber perp()const; // perp comp
135 inline DifNumber perpSq()const; // perp squared
136
137
138 //polar corrdinates
139 DifNumber r()const; // length by any other name
140 DifNumber phi()const; // azimutal angle
141 DifNumber theta()const; // polar angle
142 DifNumber cosTheta()const; // cosine of polar angle
143
144 //data members - public .. yes, folks that's intentional!
145public:
146
147 //x,y,z components of 3-vector
151
152
153};
154/*SKIP
155//io
156inline std::ostream& operator<<(std::ostream& o,const DifVector& n) {
157 n.print(o);
158 return o;
159}
160*/
161#include "MdcRecoUtil/DifVector.icc"
162
163#endif
164
165
166
167
168
169
170
171
172
const Int_t n
const double alpha
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
DifVector & operator+=(const DifVector &v)
DifVector transverse(const DifVector &v) const
DifVector & rotateX(const DifNumber &angle)
DifVector & normalize()
DifVector & rotate(const DifVector &axis, const DifNumber &cosine, const DifNumber &sine)
DifVector & rotateZ(const double &cosine, const double &sine)
DifVector & flipsign()
DifVector & rotateY(const double &cosine, const double &sine)
DifNumber y
Definition DifVector.h:149
int nPar() const
DifVector & zeroDerivatives()
DifNumber perpSq() const
DifVector unit() const
DifVector & rotateX(const double &angle)
DifNumber cosTheta() const
DifNumber phi() const
DifVector & rotateZ(const DifNumber &angle)
DifNumber x
Definition DifVector.h:148
DifVector & rotateY(const DifNumber &cosine, const DifNumber &sine)
DifNumber z
Definition DifVector.h:150
DifNumber r() const
DifVector & rotate(const DifVector &axis, const DifNumber &angle)
DifVector & rotateZ(const DifNumber &cosine, const DifNumber &sine)
DifVector & operator*=(const double &n)
DifVector & rotate(const DifVector &axis, const double &angle)
DifVector & rotateZ(const double &angle)
DifNumber dot(const DifVector &v) const
DifVector operator-() const
HepSymMatrix errorMatrix(const HepSymMatrix &e) const
Definition DifVector.cxx:54
DifVector & operator*=(const DifNumber &n)
DifNumber length() const
DifVector & rotate(const DifVector &axis, const double &cosine, const double &sine)
DifVector & operator-=(const DifVector &v)
DifVector & operator/=(const double &n)
DifVector & rotateY(const double &angle)
DifVector & operator/=(const DifNumber &n)
DifNumber perp() const
DifNumber theta() const
DifVector & operator=(const DifVector &v)
DifVector & rotate(const double &alpha, const double &beta, const double &gamma)
friend DifVector cross(const DifVector &a, const DifVector &b)
HepMatrix jacobian() const
Definition DifVector.cxx:65
DifVector & rotateY(const DifNumber &angle)
DifVector & rotateX(const DifNumber &cosine, const DifNumber &sine)
DifVector & rotateX(const double &cosine, const double &sine)
void print() const
Definition DifVector.cxx:85
DifNumber lengthSq() const
const double b
Definition slope.cxx:9