BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
SecondVertexFit Class Reference

#include <SecondVertexFit.h>

+ Inheritance diagram for SecondVertexFit:

Public Member Functions

 ~SecondVertexFit ()
 
void init ()
 
void setIterNumber (const int niter=10)
 
void setChisqCut (const double chicut=500, const double chiter=1.0e-2)
 
void setVpar (const VertexParameter vpar)
 
void setPrimaryVertex (const VertexParameter vpar)
 
bool Fit ()
 
double chisq () const
 
double decayLength () const
 
double decayLengthError () const
 
double ctau () const
 
double ctauError () const
 
HepLorentzVector p4par () const
 
WTrackParameter wpar () const
 
VertexParameter vpar () const
 
HepPoint3D crossPoint () const
 
Hep3Vector crossVector () const
 
- Public Member Functions inherited from TrackPool
 TrackPool ()
 
 ~TrackPool ()
 
void AddTrack (const int number, const double mass, const RecMdcTrack *trk)
 
void AddTrack (const int number, const double mass, const RecMdcKalTrack *trk)
 
void AddTrack (const int number, const double mass, const RecEmcShower *trk)
 
void AddTrack (const int number, const WTrackParameter wtrk)
 
void AddMissTrack (const int number, const double mass)
 
void AddMissTrack (const int number, const double mass, const HepLorentzVector p4)
 
void AddMissTrack (const int number, const double mass, const RecEmcShower *trk)
 
void AddMissTrack (const int number, const RecEmcShower *trk)
 
void AddMissTrack (const int number, const HepLorentzVector p4)
 
void AddTrackVertex (const int number, const double mass, const RecEmcShower *trk)
 
std::vector< int > AddList (int n1)
 
std::vector< int > AddList (int n1, int n2)
 
std::vector< int > AddList (int n1, int n2, int n3)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4, int n5)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4, int n5, int n6)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4, int n5, int n6, int n7)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11)
 
std::vector< int > AddList (int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11, int n12)
 
std::vector< WTrackParameterwTrackOrigin () const
 
std::vector< WTrackParameterwTrackInfit () const
 
std::vector< int > wTrackList () const
 
WTrackParameter wTrackOrigin (int n) const
 
WTrackParameter wTrackInfit (int n) const
 
int wTrackList (int n) const
 
int numberWTrack () const
 
std::vector< GammaShapeGammaShapeValue () const
 
std::vector< int > GammaShapeList () const
 
GammaShape GammaShapeValue (int n) const
 
int GammaShapeList (int n) const
 
int numberGammaShape () const
 
void setWTrackOrigin (const int n, const WTrackParameter wtrk)
 
void setWTrackInfit (const int n, const WTrackParameter wtrk)
 
void setWTrackOrigin (const WTrackParameter wtrk)
 
void setWTrackInfit (const WTrackParameter wtrk)
 
void setWTrackList (const int n)
 
void clearWTrackOrigin ()
 
void clearWTrackInfit ()
 
void clearWTrackList ()
 
void clearone ()
 
void cleartwo ()
 
int numberone () const
 
int numbertwo () const
 
vector< int > mappositionA () const
 
vector< int > mappositionB () const
 
vector< int > mapkinematic () const
 
void clearMapkinematic ()
 
void clearMappositionA ()
 
void clearMappositionB ()
 
void setMapkinematic (const int n)
 
void setMappositionA (const int n)
 
void setMappositionB (const int n)
 
void setGammaShape (const int n, const GammaShape gammashape)
 
void setGammaShape (const GammaShape gammashape)
 
void setGammaShapeList (const int n)
 
void clearGammaShape ()
 
void clearGammaShapeList ()
 
void setBeamPosition (const HepPoint3D BeamPosition)
 
void setVBeamPosition (const HepSymMatrix VBeamPosition)
 
HepPoint3D getBeamPosition () const
 
HepSymMatrix getVBeamPosition () const
 

Static Public Member Functions

static SecondVertexFitinstance ()
 

Detailed Description

Definition at line 18 of file SecondVertexFit.h.

Constructor & Destructor Documentation

◆ ~SecondVertexFit()

SecondVertexFit::~SecondVertexFit ( )

Definition at line 64 of file SecondVertexFit.cxx.

65{
66// if(m_pointer) delete m_pointer;
67}

Member Function Documentation

◆ chisq()

double SecondVertexFit::chisq ( ) const
inline

◆ crossPoint()

HepPoint3D SecondVertexFit::crossPoint ( ) const
inline

Definition at line 75 of file SecondVertexFit.h.

76{
77 return HepPoint3D(m_crxyz[0], m_crxyz[1], m_crxyz[2]);
78}
HepGeom::Point3D< double > HepPoint3D
Definition: Gam4pikp.cxx:37

◆ crossVector()

Hep3Vector SecondVertexFit::crossVector ( ) const
inline

Definition at line 80 of file SecondVertexFit.h.

81{
82 return Hep3Vector(m_crxyz[0] - m_vpar_primary.Vx()[0],
83 m_crxyz[1] - m_vpar_primary.Vx()[1],
84 m_crxyz[2] - m_vpar_primary.Vx()[2]);
85}
HepVector Vx() const

◆ ctau()

double SecondVertexFit::ctau ( ) const
inline

Definition at line 44 of file SecondVertexFit.h.

44{return m_ctau;}

Referenced by inclks::execute(), incllambda::execute(), and DQAKsKpi::execute().

◆ ctauError()

double SecondVertexFit::ctauError ( ) const
inline

Definition at line 45 of file SecondVertexFit.h.

45{return m_ctau_error;}

◆ decayLength()

double SecondVertexFit::decayLength ( ) const
inline

◆ decayLengthError()

double SecondVertexFit::decayLengthError ( ) const
inline

Definition at line 43 of file SecondVertexFit.h.

43{return m_lxyz_error;}

Referenced by DQAKsInfo::calculate(), inclks::execute(), incllambda::execute(), and DQAKsKpi::execute().

◆ Fit()

bool SecondVertexFit::Fit ( )

Definition at line 86 of file SecondVertexFit.cxx.

87{
88// const double alpha = -0.00299792458;
89// const double field = 1.0;
90// double field_p = VertexFitBField::instance()->getBFieldZ(m_vpar_primary.vx());
91// double field_s = VertexFitBField::instance()->getBFieldZ(m_vpar_secondary.vx());
92// double field = (field_p + field_s) * 0.5 ;
93// std::cout << "field in SeconVertexFit= " << field << std::endl;
94
95 bool okfit = false;
96
97 HepVector aOrigin(10, 0);
98 HepVector aInfit(10, 0);
99 HepSymMatrix VaOrigin(10, 0);
100 HepSymMatrix VaInfit(10, 0);
101 aOrigin.sub(1, wTrackOrigin(0).w());
102 aOrigin.sub(8, m_vpar_primary.Vx());
103 VaOrigin.sub(1, wTrackOrigin(0).Ew());
104 VaOrigin.sub(8, m_vpar_primary.Evx());
105 HepVector ctOrigin(1, 0);
106 HepVector ctInfit(1, 0);
107 HepSymMatrix Vct(1, 0);
108 aInfit = aOrigin;
109 ctInfit = ctOrigin;
110
111 std::vector<double> chisq;
112 chisq.clear();
113 double chi2 = 999;
114 for(int it = 0; it < m_niter; it++)
115 {
116 HepMatrix D(3, 10, 0);
117 HepLorentzVector p4par = HepLorentzVector(aInfit[0], aInfit[1], aInfit[2], aInfit[3]);
118 HepMatrix E(3,1,0);
119 HepVector d(3, 0);
120 if (wTrackOrigin(0).charge() == 0)
121 {
122 D[0][4] = -1.0;
123 D[0][7] = 1.0;
124 D[1][5] = -1.0;
125 D[1][8] = 1.0;
126 D[2][6] = -1.0;
127 D[2][9] = 1.0;
128
129 E[0][0] = p4par.px()/p4par.m();
130 E[1][0] = p4par.py()/p4par.m();
131 E[2][0] = p4par.pz()/p4par.m();
132
133 d[0] = aInfit[7]-aInfit[4]+ctInfit[0]*p4par.px()/p4par.m();
134 d[1] = aInfit[8]-aInfit[5]+ctInfit[0]*p4par.py()/p4par.m();
135 d[2] = aInfit[9]-aInfit[6]+ctInfit[0]*p4par.pz()/p4par.m();
136 }
137 else
138 {
139 double afield = VertexFitBField::instance()->getCBz(m_vpar_primary.Vx(), m_vpar_secondary.Vx());
140 double a = afield * wTrackOrigin(0).charge();
141 D[0][4] = -1.0;
142 D[0][7] = 1.0;
143 D[1][5] = -1.0;
144 D[1][8] = 1.0;
145 D[2][6] = -1.0;
146 D[2][9] = 1.0;
147
148 E[0][0] = p4par.px() / p4par.m() * cos(a * ctInfit[0] / p4par.m()) + p4par.py() / p4par.m() * sin(a * ctInfit[0] / p4par.m());
149 E[1][0] = p4par.py() / p4par.m() * cos(a * ctInfit[0] / p4par.m()) - p4par.px() / p4par.m() * sin(a * ctInfit[0] / p4par.m());
150 E[2][0] = p4par.pz() / p4par.m();
151
152 d[0] = aInfit[7] - aInfit[4]+p4par.px()/a * sin(a * ctInfit[0]/p4par.m()) + p4par.py()/a*(1-cos(a*ctInfit[0]/p4par.m()));
153 d[1] = aInfit[8] - aInfit[5]+p4par.py()/a * sin(a * ctInfit[0]/p4par.m()) - p4par.px()/a*(1-cos(a*ctInfit[0]/p4par.m()));
154 d[2] = aInfit[9] - aInfit[6]+ctInfit[0]*p4par.pz()/p4par.m();
155 }
156
157 HepSymMatrix VD(3, 0);
158 HepVector dela0(10, 0);
159 HepVector lambda0(3, 0);
160 HepVector delct(1, 0);
161 HepVector lambda(3, 0);
162 int ifail;
163
164 VD = (VaOrigin.similarity(D)).inverse(ifail);
165 dela0 = aOrigin - aInfit;
166 lambda0 = VD*(D*dela0 + d);
167 Vct = (VD.similarity(E.T())).inverse(ifail);
168 delct = -(Vct * E.T()) * lambda0;
169 ctInfit = ctInfit + delct;
170 lambda = lambda0 + (VD * E) * delct;
171 aInfit = aOrigin - (VaOrigin * D.T()) * lambda;
172 chi2 = dot(lambda, D*dela0 + d);
173 VaInfit = VaOrigin - (VD.similarity(D.T())).similarity(VaOrigin);
174 VaInfit = VaInfit + (((Vct.similarity(E)).similarity(VD)).similarity(D.T())).similarity(VaOrigin);
175
176 chisq.push_back(chi2);
177
178 if(it > 0)
179 {
180 double delchi = chisq[it] - chisq[it-1];
181 if (fabs(delchi) < m_chiter)
182 {
183// std::cout <<"Fit(): pass all " << it <<" , " << delchi << std::endl;
184 break;
185 }
186 }
187 }
188 if (chi2 < 0 || chi2 > m_chicut)
189 return okfit;
190
191 HepLorentzVector p4par = HepLorentzVector(aInfit[0], aInfit[1], aInfit[2], aInfit[3]);
192 m_ctau = ctInfit[0];
193 m_ctau_error = sqrt(Vct[0][0]);
194 m_lxyz = ctInfit[0] * p4par.rho() / p4par.m();
195 m_lxyz_error = sqrt(Vct[0][0]) * p4par.rho() / p4par.m();
196 m_chisq = chi2;
197 m_p4par = p4par;
198 for(int i = 0; i < 3; i++)
199 m_crxyz[i] = aInfit[4+i];
200 HepVector w(7, 0);
201 HepSymMatrix Ew(7, 0);
202 for(int i = 0; i < 7; i++)
203 {
204 w[i] = aInfit[i];
205 for(int j = 0; j < 7; j++)
206 {
207 Ew[i][j] = VaInfit[i][j];
208 }
209 }
210 m_wtrk.setW(w);
211 m_wtrk.setEw(Ew);
212 m_wtrk.setCharge(wTrackOrigin(0).charge());
213 okfit = true;
214 return okfit;
215}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
HepLorentzVector p4par() const
double chisq() const
std::vector< WTrackParameter > wTrackOrigin() const
Definition: TrackPool.h:72
double getCBz(const HepVector &vtx, const HepVector &trackPosition)
HepSymMatrix Evx() const
void setEw(const HepSymMatrix &Ew)
void setCharge(const int charge)
void setW(const HepVector &w)

Referenced by DQAKsInfo::calculate(), inclks::execute(), incllambda::execute(), DQAKsKpi::execute(), JsiLL::execute(), K0kk::MTotal(), K0kpi::MTotal(), K0pi0::MTotal(), K0pipi::MTotal(), and K0pipipi0::MTotal().

◆ init()

void SecondVertexFit::init ( )

Definition at line 69 of file SecondVertexFit.cxx.

70{
74 m_vpar_secondary = VertexParameter();
75 m_lxyz = 0;
76 m_lxyz_error = 0;
77 m_p4par = HepLorentzVector(0, 0, 0, 0);
78 m_crxyz = HepVector(3, 0);
79 m_chisq = 9999;
80 m_wtrk = WTrackParameter();
81 m_niter = 10;
82 m_chicut = 500;
83 m_chiter = 1.0e-2;
84}
void clearWTrackOrigin()
Definition: TrackPool.h:111
void clearWTrackList()
Definition: TrackPool.h:113
void clearWTrackInfit()
Definition: TrackPool.h:112

Referenced by DQAKsInfo::calculate(), inclks::execute(), incllambda::execute(), DQAKsKpi::execute(), JsiLL::execute(), DQAKsInfo::init(), K0kk::MTotal(), K0kpi::MTotal(), K0pi0::MTotal(), K0pipi::MTotal(), and K0pipipi0::MTotal().

◆ instance()

SecondVertexFit * SecondVertexFit::instance ( )
static

◆ p4par()

HepLorentzVector SecondVertexFit::p4par ( ) const
inline

◆ setChisqCut()

void SecondVertexFit::setChisqCut ( const double  chicut = 500,
const double  chiter = 1.0e-2 
)
inline

Definition at line 31 of file SecondVertexFit.h.

31{m_chicut = chicut;m_chiter=chiter;}

Referenced by DQAKsInfo::calculate().

◆ setIterNumber()

void SecondVertexFit::setIterNumber ( const int  niter = 10)
inline

Definition at line 30 of file SecondVertexFit.h.

30{m_niter = niter;}

◆ setPrimaryVertex()

void SecondVertexFit::setPrimaryVertex ( const VertexParameter  vpar)
inline

Definition at line 35 of file SecondVertexFit.h.

35{m_vpar_primary.setVx(vpar.Vx());m_vpar_primary.setEvx(vpar.Evx());}
VertexParameter vpar() const
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)

Referenced by DQAKsInfo::calculate(), DQAKsKpi::execute(), K0kk::MTotal(), K0kpi::MTotal(), K0pi0::MTotal(), K0pipi::MTotal(), and K0pipipi0::MTotal().

◆ setVpar()

void SecondVertexFit::setVpar ( const VertexParameter  vpar)
inline

◆ vpar()

VertexParameter SecondVertexFit::vpar ( ) const
inline

Definition at line 49 of file SecondVertexFit.h.

49{return m_vpar_secondary;}

Referenced by setPrimaryVertex(), and setVpar().

◆ wpar()

WTrackParameter SecondVertexFit::wpar ( ) const
inline

Definition at line 48 of file SecondVertexFit.h.

48{return m_wtrk;}

Referenced by DQAKsKpi::execute(), JsiLL::execute(), and K0pipi::MTotal().


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