BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
KalmanKinematicFit Class Reference

#include <KalmanKinematicFit.h>

+ Inheritance diagram for KalmanKinematicFit:

Public Member Functions

 ~KalmanKinematicFit ()
 
void AddResonance (int number, double mres, std::vector< int > tlis)
 
void AddResonance (int number, double mres, int n1)
 
void AddResonance (int number, double mres, int n1, int n2)
 
void AddResonance (int number, double mres, int n1, int n2, int n3)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4, int n5)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4, int n5, int n6)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4, int n5, int n6, int n7)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11)
 
void AddResonance (int number, double mres, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11, int n12)
 
void AddTotalEnergy (int number, double etot, std::vector< int > lis)
 
void AddTotalEnergy (int number, double etot, int n1)
 
void AddTotalEnergy (int number, double etot, int n1, int n2)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4, int n5)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4, int n5, int n6)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4, int n5, int n6, int n7)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11)
 
void AddTotalEnergy (int number, double etot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11, int n12)
 
void AddTotalMomentum (int number, double ptot, std::vector< int > lis)
 
void AddTotalMomentum (int number, double ptot, int n1)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4, int n5)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4, int n5, int n6)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4, int n5, int n6, int n7)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11)
 
void AddTotalMomentum (int number, double ptot, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11, int n12)
 
void AddThreeMomentum (int number, Hep3Vector p3)
 
void AddFourMomentum (int number, HepLorentzVector p4)
 
void AddFourMomentum (int number, double etot)
 
void AddEqualMass (int number, std::vector< int > tlis1, std::vector< int > tlis2)
 
void BuildVirtualParticle (int number)
 
void init ()
 
void setFlag (const bool flag=1)
 
void setIterNumber (const int niter=5)
 
void setChisqCut (const double chicut=200, const double chiter=0.05)
 
void setEspread (const double espread=0.0009)
 
void setCollideangle (const double collideangle=11e-3)
 
void setDynamicerror (const bool dynamicerror=1)
 
void setTgraph (TGraph2D *graph2d)
 
bool Fit ()
 
bool Fit (int n)
 
double chisq () const
 
double chisq (int n) const
 
HepLorentzVector pfit (int n) const
 
HepLorentzVector pfit1 (int n)
 
HepVector xfit ()
 
WTrackParameter origin (int n) const
 
WTrackParameter infit (int n) const
 
HepVector pull (int n)
 
double espread () const
 
double collideangle () const
 
bool dynamicerror () const
 
HepVector cpu () const
 
HepSymMatrix getCOrigin (int i) const
 
HepSymMatrix getCInfit (int i) const
 
WTrackParameter wVirtualTrack (int n) 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 KalmanKinematicFitinstance ()
 

Detailed Description

Definition at line 11 of file KalmanKinematicFit.h.

Constructor & Destructor Documentation

◆ ~KalmanKinematicFit()

KalmanKinematicFit::~KalmanKinematicFit ( )

Definition at line 28 of file KalmanKinematicFit.cxx.

28 {
29 // if(m_pointer) delete m_pointer;
30 delete m_pointer;
31}

Member Function Documentation

◆ AddEqualMass()

void KalmanKinematicFit::AddEqualMass ( int  number,
std::vector< int >  tlis1,
std::vector< int >  tlis2 
)

Definition at line 321 of file KalmanKinematicFit.cxx.

321 {
323 HepSymMatrix Vne = HepSymMatrix(1,0);
324 kc.EqualMassConstraints(tlis1, tlis2, Vne);
325 m_kc.push_back(kc);
326 if((unsigned int) number != m_kc.size()-1)
327 std::cout << "wrong kinematic constraints index" << std::endl;
328}
void EqualMassConstraints(std::vector< int > tlis1, std::vector< int > tlis2, HepSymMatrix Vne)

◆ AddFourMomentum() [1/2]

void KalmanKinematicFit::AddFourMomentum ( int  number,
double  etot 
)

Definition at line 374 of file KalmanKinematicFit.cxx.

374 {
375
376 HepLorentzVector p4(0.0, 0.0, 0.0, etot);
377 std::vector<int> tlis;
378 tlis.clear();
380
381 for(int i = 0; i < numberWTrack(); i++) {
382 tlis.push_back(i);
383 }
384 HepSymMatrix Vme = HepSymMatrix (4,0);
385 Vme[3][3] = 2*m_espread*m_espread;
386 kc.FourMomentumConstraints(p4, tlis, Vme);
387 m_kc.push_back(kc);
388 if((unsigned int) number != m_kc.size()-1)
389 std::cout << "wrong kinematic constraints index" << std::endl;
390}
Double_t etot
void FourMomentumConstraints(const HepLorentzVector p4, std::vector< int > tlis, HepSymMatrix Vme)
int numberWTrack() const
Definition: TrackPool.h:79

◆ AddFourMomentum() [2/2]

void KalmanKinematicFit::AddFourMomentum ( int  number,
HepLorentzVector  p4 
)

Definition at line 353 of file KalmanKinematicFit.cxx.

353 {
354
355 std::vector<int> tlis;
356 tlis.clear();
358
359 for(int i = 0; i < numberWTrack(); i++) {
360 tlis.push_back(i);
361 }
362
363 HepSymMatrix Vme = HepSymMatrix(4,0);
364 Vme[0][0] = 2*m_espread*m_espread*sin(m_collideangle)*sin(m_collideangle);
365 Vme[0][3] = 2*m_espread*m_espread*sin(m_collideangle);
366 Vme[3][3] = 2*m_espread*m_espread;
367
368 kc.FourMomentumConstraints(p4, tlis, Vme);
369 m_kc.push_back(kc);
370 if((unsigned int) number != m_kc.size()-1)
371 std::cout << "wrong kinematic constraints index" << std::endl;
372}
double sin(const BesAngle a)
Definition: BesAngle.h:210

Referenced by Gam4pikp::execute(), and Rhopi::execute().

◆ AddResonance() [1/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1 
)

Definition at line 71 of file KalmanKinematicFit.cxx.

71 {
72 std::vector<int> tlis = AddList(n1);
73 AddResonance(number, mres, tlis);
74}
int n1
Definition: SD0Tag.cxx:54
void AddResonance(int number, double mres, std::vector< int > tlis)
std::vector< int > AddList(int n1)
Definition: TrackPool.cxx:483

◆ AddResonance() [2/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2 
)

Definition at line 76 of file KalmanKinematicFit.cxx.

76 {
77 std::vector<int> tlis = AddList(n1, n2);
78 AddResonance(number, mres, tlis);
79}
int n2
Definition: SD0Tag.cxx:55

◆ AddResonance() [3/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3 
)

Definition at line 81 of file KalmanKinematicFit.cxx.

81 {
82 std::vector<int> tlis = AddList(n1, n2, n3);
83 AddResonance(number, mres, tlis);
84}

◆ AddResonance() [4/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4 
)

Definition at line 86 of file KalmanKinematicFit.cxx.

86 {
87 std::vector<int> tlis = AddList(n1, n2, n3, n4);
88 AddResonance(number, mres, tlis);
89}

◆ AddResonance() [5/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5 
)

Definition at line 91 of file KalmanKinematicFit.cxx.

92 {
93 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5);
94 AddResonance(number, mres, tlis);
95}

◆ AddResonance() [6/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6 
)

Definition at line 97 of file KalmanKinematicFit.cxx.

98 {
99 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6);
100 AddResonance(number, mres, tlis);
101}

◆ AddResonance() [7/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7 
)

Definition at line 103 of file KalmanKinematicFit.cxx.

104 {
105 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7);
106 AddResonance(number, mres, tlis);
107}

◆ AddResonance() [8/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8 
)

Definition at line 109 of file KalmanKinematicFit.cxx.

110 {
111 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8);
112 AddResonance(number, mres, tlis);
113}

◆ AddResonance() [9/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9 
)

Definition at line 115 of file KalmanKinematicFit.cxx.

116 {
117 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9);
118 AddResonance(number, mres, tlis);
119}

◆ AddResonance() [10/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10 
)

Definition at line 121 of file KalmanKinematicFit.cxx.

122 {
123 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10);
124 AddResonance(number, mres, tlis);
125}

◆ AddResonance() [11/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11 
)

Definition at line 128 of file KalmanKinematicFit.cxx.

130 {
131 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11);
132 AddResonance(number, mres, tlis);
133}

◆ AddResonance() [12/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11,
int  n12 
)

Definition at line 135 of file KalmanKinematicFit.cxx.

137 {
138 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12);
139 AddResonance(number, mres, tlis);
140}

◆ AddResonance() [13/13]

void KalmanKinematicFit::AddResonance ( int  number,
double  mres,
std::vector< int >  tlis 
)

Definition at line 142 of file KalmanKinematicFit.cxx.

142 {
144 HepSymMatrix Vre = HepSymMatrix(1,0);
145 kc.ResonanceConstraints(mres, tlis, Vre);
146 m_kc.push_back(kc);
147 if((unsigned int) number != m_kc.size()-1)
148 std::cout << "wrong kinematic constraints index" << std::endl;
149}
void ResonanceConstraints(const double mres, std::vector< int > tlis, HepSymMatrix Vre)

Referenced by AddResonance(), Rhopi::execute(), K0pi0::MTotal(), K0pipipi0::MTotal(), K3pipi0::MTotal(), Kkpi0::MTotal(), Kpipi0::MTotal(), Kpipi0pi0::MTotal(), and Pipipi0::MTotal().

◆ AddThreeMomentum()

void KalmanKinematicFit::AddThreeMomentum ( int  number,
Hep3Vector  p3 
)

Definition at line 334 of file KalmanKinematicFit.cxx.

334 {
335 std::vector<int> tlis;
336 tlis.clear();
337 WTrackParameter wtrk;
339
340 for(int i = 0; i < numberWTrack(); i++) {
341 tlis.push_back(i);
342 }
343 kc.ThreeMomentumConstraints(p3, tlis);
344 m_kc.push_back(kc);
345 if((unsigned int) number != m_kc.size()-1)
346 std::cout << "wrong kinematic constraints index" << std::endl;
347}
void ThreeMomentumConstraints(const Hep3Vector p3, std::vector< int > tlis)

◆ AddTotalEnergy() [1/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1 
)

Definition at line 239 of file KalmanKinematicFit.cxx.

239 {
240 std::vector<int> tlis = AddList(n1);
241 AddTotalEnergy(number, etot, tlis);
242}
void AddTotalEnergy(int number, double etot, std::vector< int > lis)

◆ AddTotalEnergy() [2/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2 
)

Definition at line 243 of file KalmanKinematicFit.cxx.

243 {
244 std::vector<int> tlis = AddList(n1, n2);
245 AddTotalEnergy(number, etot, tlis);
246}

◆ AddTotalEnergy() [3/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3 
)

Definition at line 248 of file KalmanKinematicFit.cxx.

248 {
249 std::vector<int> tlis = AddList(n1, n2, n3);
250 AddTotalEnergy(number, etot, tlis);
251}

◆ AddTotalEnergy() [4/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4 
)

Definition at line 253 of file KalmanKinematicFit.cxx.

253 {
254 std::vector<int> tlis = AddList(n1, n2, n3, n4);
255 AddTotalEnergy(number, etot, tlis);
256}

◆ AddTotalEnergy() [5/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5 
)

Definition at line 258 of file KalmanKinematicFit.cxx.

259 {
260 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5);
261 AddTotalEnergy(number, etot, tlis);
262}

◆ AddTotalEnergy() [6/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6 
)

Definition at line 264 of file KalmanKinematicFit.cxx.

265 {
266 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6);
267 AddTotalEnergy(number, etot, tlis);
268}

◆ AddTotalEnergy() [7/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7 
)

Definition at line 270 of file KalmanKinematicFit.cxx.

271 {
272 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7);
273 AddTotalEnergy(number, etot, tlis);
274}

◆ AddTotalEnergy() [8/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8 
)

Definition at line 276 of file KalmanKinematicFit.cxx.

277 {
278 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8);
279 AddTotalEnergy(number, etot, tlis);
280}

◆ AddTotalEnergy() [9/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9 
)

Definition at line 282 of file KalmanKinematicFit.cxx.

283 {
284 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9);
285 AddTotalEnergy(number, etot, tlis);
286}

◆ AddTotalEnergy() [10/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10 
)

Definition at line 288 of file KalmanKinematicFit.cxx.

290 {
291 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10);
292 AddTotalEnergy(number, etot, tlis);
293}

◆ AddTotalEnergy() [11/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11 
)

Definition at line 296 of file KalmanKinematicFit.cxx.

298 {
299 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11);
300 AddTotalEnergy(number, etot, tlis);
301}

◆ AddTotalEnergy() [12/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11,
int  n12 
)

Definition at line 303 of file KalmanKinematicFit.cxx.

305 {
306 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12);
307 AddTotalEnergy(number, etot, tlis);
308}

◆ AddTotalEnergy() [13/13]

void KalmanKinematicFit::AddTotalEnergy ( int  number,
double  etot,
std::vector< int >  lis 
)

Definition at line 310 of file KalmanKinematicFit.cxx.

310 {
313 m_kc.push_back(kc);
314 if((unsigned int) number != m_kc.size()-1)
315 std::cout << "wrong kinematic constraints index" << std::endl;
316}
void TotalEnergyConstraints(const double etot, std::vector< int > tlis)

Referenced by AddTotalEnergy().

◆ AddTotalMomentum() [1/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1 
)

Definition at line 156 of file KalmanKinematicFit.cxx.

156 {
157 std::vector<int> tlis = AddList(n1);
158 AddTotalMomentum(number, ptot, tlis);
159}
void AddTotalMomentum(int number, double ptot, std::vector< int > lis)

◆ AddTotalMomentum() [2/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2 
)

Definition at line 160 of file KalmanKinematicFit.cxx.

160 {
161 std::vector<int> tlis = AddList(n1, n2);
162 AddTotalMomentum(number, ptot, tlis);
163}

◆ AddTotalMomentum() [3/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3 
)

Definition at line 165 of file KalmanKinematicFit.cxx.

165 {
166 std::vector<int> tlis = AddList(n1, n2, n3);
167 AddTotalMomentum(number, ptot, tlis);
168}

◆ AddTotalMomentum() [4/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4 
)

Definition at line 170 of file KalmanKinematicFit.cxx.

170 {
171 std::vector<int> tlis = AddList(n1, n2, n3, n4);
172 AddTotalMomentum(number, ptot, tlis);
173}

◆ AddTotalMomentum() [5/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5 
)

Definition at line 175 of file KalmanKinematicFit.cxx.

176 {
177 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5);
178 AddTotalMomentum(number, ptot, tlis);
179}

◆ AddTotalMomentum() [6/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6 
)

Definition at line 181 of file KalmanKinematicFit.cxx.

182 {
183 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6);
184 AddTotalMomentum(number, ptot, tlis);
185}

◆ AddTotalMomentum() [7/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7 
)

Definition at line 187 of file KalmanKinematicFit.cxx.

188 {
189 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7);
190 AddTotalMomentum(number, ptot, tlis);
191}

◆ AddTotalMomentum() [8/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8 
)

Definition at line 193 of file KalmanKinematicFit.cxx.

194 {
195 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8);
196 AddTotalMomentum(number, ptot, tlis);
197}

◆ AddTotalMomentum() [9/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9 
)

Definition at line 199 of file KalmanKinematicFit.cxx.

200 {
201 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9);
202 AddTotalMomentum(number, ptot, tlis);
203}

◆ AddTotalMomentum() [10/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10 
)

Definition at line 205 of file KalmanKinematicFit.cxx.

207 {
208 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10);
209 AddTotalMomentum(number, ptot, tlis);
210}

◆ AddTotalMomentum() [11/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11 
)

Definition at line 213 of file KalmanKinematicFit.cxx.

215 {
216 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11);
217 AddTotalMomentum(number, ptot, tlis);
218}

◆ AddTotalMomentum() [12/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11,
int  n12 
)

Definition at line 220 of file KalmanKinematicFit.cxx.

222 {
223 std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12);
224 AddTotalMomentum(number, ptot, tlis);
225}

◆ AddTotalMomentum() [13/13]

void KalmanKinematicFit::AddTotalMomentum ( int  number,
double  ptot,
std::vector< int >  lis 
)

Definition at line 227 of file KalmanKinematicFit.cxx.

227 {
229 kc.TotalMomentumConstraints(ptot, tlis);
230 m_kc.push_back(kc);
231 if((unsigned int) number != m_kc.size()-1)
232 std::cout << "wrong kinematic constraints index" << std::endl;
233}
void TotalMomentumConstraints(const double ptot, std::vector< int > tlis)

Referenced by AddTotalMomentum().

◆ BuildVirtualParticle()

void KalmanKinematicFit::BuildVirtualParticle ( int  number)

Definition at line 943 of file KalmanKinematicFit.cxx.

943 {
944 upCovmtx();
945 KinematicConstraints kc = m_kc[n];
946 int ntrk = (kc.Ltrk()).size();
947 int charge = 0;
948 HepVector w(7, 0);
949 HepSymMatrix ew1(7, 0);
950 HepSymMatrix ew2(7, 0);
951 HepVector w4(4, 0);
952 HepSymMatrix ew4(4, 0);
953 HepMatrix dwdp(4, 4, 0);
954 dwdp[0][0] = 1;
955 dwdp[1][1] = 1;
956 dwdp[2][2] = 1;
957 dwdp[3][3] = 1;
958 for (int i = 0; i < ntrk; i++) {
959 int itk = (kc.Ltrk())[i];
960 charge += wTrackInfit(itk).charge();
961 w4 = w4 + dwdp * pInfit(itk);
962 // ew = ew + (getCInfit(itk)).similarity(dwdp);
963 }
964 HepMatrix I(4, numberone(), 0);
965 for(int j2=0; j2<ntrk; j2++){
966 I[0][0+j2*4] = 1;
967 I[1][1+j2*4] = 1;
968 I[2][2+j2*4] = 1;
969 I[3][3+j2*4] = 1;
970 }
971 ew4 = m_C.similarity(I);
972 HepMatrix J(7,4,0);
973 double px = w4[0];
974 double py = w4[1];
975 double pz = w4[2];
976 double e = w4[3];
977 double pt = sqrt(px*px + py*py);
978 double p0 = sqrt(px*px + py*py + pz*pz);
979 double m = sqrt(e*e - p0*p0);
980 J[0][0] = -py;
981 J[0][1] = -(pz*px*pt)/(p0*p0);
982 J[0][2] = -m*px/(p0*p0);
983 J[0][3] = e*px/(p0*p0);
984 J[1][0] = px;
985 J[1][1] = -(pz*py*pt)/(p0*p0);
986 J[1][2] = -m*py/(p0*p0);
987 J[1][3] = e*py/(p0*p0);
988 J[2][0] = 0;
989 J[2][1] = pt*pt*pt/(p0*p0);
990 J[2][2] = -m*pz/(p0*p0);
991 J[2][3] = e*pz/(p0*p0);
992 J[3][0] = 0;
993 J[3][1] = 0;
994 J[3][2] = 0;
995 J[3][3] = 1;
996 ew1 = ew4.similarity(J);
997 ew2[0][0] = ew1[0][0];
998 ew2[1][1] = ew1[1][1];
999 ew2[2][2] = ew1[2][2];
1000 ew2[3][3] = ew1[3][3];
1001 w[0] = w4[0];
1002 w[1] = w4[1];
1003 w[2] = w4[2];
1004 w[3] = w4[3];
1005 WTrackParameter vwtrk;
1006 vwtrk.setCharge(charge);
1007 vwtrk.setW(w);
1008 vwtrk.setEw(ew2);
1009 vwtrk.setMass(m);
1010 m_virtual_wtrk.push_back(vwtrk);
1011}
const Int_t n
const DifComplex I
std::vector< int > Ltrk()
int numberone() const
Definition: TrackPool.h:117
std::vector< WTrackParameter > wTrackInfit() const
Definition: TrackPool.h:73
void setEw(const HepSymMatrix &Ew)
void setMass(const double mass)
void setCharge(const int charge)
void setW(const HepVector &w)

Referenced by K0pi0::MTotal(), K0pipipi0::MTotal(), K3pipi0::MTotal(), Kkpi0::MTotal(), Kpipi0::MTotal(), Kpipi0pi0::MTotal(), and Pipipi0::MTotal().

◆ chisq() [1/2]

double KalmanKinematicFit::chisq ( ) const
inline

◆ chisq() [2/2]

double KalmanKinematicFit::chisq ( int  n) const
inline

Definition at line 151 of file KalmanKinematicFit.h.

151{return m_chisq[n];}

◆ collideangle()

double KalmanKinematicFit::collideangle ( ) const
inline

Definition at line 167 of file KalmanKinematicFit.h.

167{return m_collideangle;}

Referenced by setCollideangle().

◆ cpu()

HepVector KalmanKinematicFit::cpu ( ) const
inline

Definition at line 170 of file KalmanKinematicFit.h.

170{return m_cpu;}

◆ dynamicerror()

bool KalmanKinematicFit::dynamicerror ( ) const
inline

Definition at line 168 of file KalmanKinematicFit.h.

168{return m_dynamicerror;}

Referenced by setDynamicerror().

◆ espread()

double KalmanKinematicFit::espread ( ) const
inline

Definition at line 166 of file KalmanKinematicFit.h.

166{return m_espread;}

Referenced by setEspread().

◆ Fit() [1/2]

bool KalmanKinematicFit::Fit ( )

Definition at line 515 of file KalmanKinematicFit.cxx.

515 {
516 bool okfit = false;
517 TStopwatch timer;
518 m_nktrk = numberWTrack();
519 m_p0 = HepVector(numberone(), 0);
520 m_p = HepVector(numberone(), 0);
521 m_q0 = HepVector(numbertwo(), 0);
522 m_q = HepVector(numbertwo(), 0);
523 m_C0 = HepSymMatrix(numberone(), 0);
524 m_C = HepSymMatrix(numberone(), 0);
525 m_D0inv = HepSymMatrix(numbertwo(), 0);
526 m_D = HepSymMatrix(numbertwo(), 0);
527
528 HepVector m_p_tmp = HepVector(numberone(), 0);
529 HepVector m_q_tmp = HepVector(numbertwo(), 0);
530 HepMatrix m_A_tmp;
531 HepSymMatrix m_W_tmp;
532 HepMatrix m_KQ_tmp;
533 HepSymMatrix m_Dinv_tmp;
534 for(int i = 0; i < numberWTrack(); i++) {
536 int pa = mappositionA()[i] + 1;
537 int pb = mappositionB()[i] + 1;
538 int ptype = mapkinematic()[i];
539 switch(ptype) {
540 case 0 : {
541 HepVector w1(4, 0);
542 HepSymMatrix Ew1(4, 0);
543 for(int j = 0; j < 3; j++) {
544 w1[j] = wTrackOrigin(i).w()[j];
545 }
546 w1[3] = wTrackOrigin(i).mass();
547
548 for(int m = 0; m < 3; m++) {
549 for(int n = 0; n < 3; n++) {
550 Ew1[m][n] = wTrackOrigin(i).Ew()[m][n];
551 }
552 }
553 setPOrigin(pa, w1);
554 setPInfit(pa, w1);
555 setCOrigin(pa, Ew1);
556 break;
557 }
558 case 1 : {
559 setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 4));
560 setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 4));
561 setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 4));
562 break;
563 }
564 case 2 : {
565 setQOrigin(pb, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
566 setQInfit(pb, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
567 HepSymMatrix Dinv(4,0);
568 setDOriginInv(pb, Dinv);
569 break;
570 }
571 case 3 : {
572 setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(3, 3));
573 setPInfit(pa, (wTrackOrigin(i).plmp()).sub(3, 3));
574 setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(3, 3));
575 setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(1, 2));
576 setQInfit(pb, (wTrackOrigin(i).plmp()).sub(1, 2));
577 setQOrigin(pb+2, (wTrackOrigin(i).plmp()).sub(4, 4));
578 setQInfit(pb+2, (wTrackOrigin(i).plmp()).sub(4, 4));
579 HepSymMatrix Dinv(3,0);
580 setDOriginInv(pb, Dinv);
581 break;
582 }
583 case 4 : {
584 setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
585 setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
586 setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 2));
587 setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
588 setQInfit(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
589 HepSymMatrix Dinv(2,0);
590 setDOriginInv(pb, Dinv);
591 break;
592 }
593 case 5 : {
594 setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
595 setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
596 setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 3));
597 setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
598 setQInfit(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
599 HepSymMatrix Dinv(1,0);
600 setDOriginInv(pb, Dinv);
601 break;
602 }
603 case 6 : {
604 setPOrigin(pa, (wTrackOrigin(i).w()).sub(5, 7));
605 setPOrigin(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
606 setPInfit(pa, (wTrackOrigin(i).w()).sub(5, 7));
607 setPInfit(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
608 setCOrigin(pa, (wTrackOrigin(i).Ew()).sub(5,7));
609 setCOrigin(pa+3, (wTrackOrigin(i).Ew()).sub(4,4));
610 HepVector beam(3,0);
611 beam[0] = getBeamPosition().x();
612 beam[1] = getBeamPosition().y();
613 beam[2] = getBeamPosition().z();
614 setQOrigin(pb, beam);
615 setQInfit(pb, beam);
616 HepSymMatrix Dinv(3, 0);
617 int ifail;
618 Dinv = getVBeamPosition().inverse(ifail);
619 setDOriginInv(pb, Dinv);
620 break;
621 }
622 case 7 : {
623 HepVector w1(4, 0);
624 HepSymMatrix Ew1(4, 0);
625 for(int j = 0; j < 3; j++) {
626 w1[j] = wTrackOrigin(i).w()[j];
627 }
628 w1[3] = wTrackOrigin(i).mass();
629
630 for(int m = 0; m < 3; m++) {
631 for(int n = 0; n < 3; n++) {
632 Ew1[m][n] = wTrackOrigin(i).Ew()[m][n];
633 }
634 }
635 setPOrigin(pa, w1);
636 setPInfit(pa, w1);
637 setCOrigin(pa, Ew1);
638 break;
639 }
640
641 }
642 }
643
644
645 //
646 // iteration
647 //
648
649 std::vector<double> chisq;
650 chisq.clear();
651 int nc = 0;
652 for(int i = 0; i < m_kc.size(); i++)
653 nc += m_kc[i].nc();
654
655 m_A = HepMatrix(nc, numberone(), 0);
656 m_AT = HepMatrix(numberone(), nc, 0);
657 m_B = HepMatrix(nc, numbertwo(), 0);
658 m_BT = HepMatrix(numbertwo(), nc, 0);
659 m_G = HepVector(nc, 0);
660 m_Vm = HepSymMatrix(nc, 0);
661 int num1 = 0;
662 for(unsigned int i = 0; i < m_kc.size(); i++) {
663 KinematicConstraints kc = m_kc[i];
664 m_Vm.sub(num1+1,kc.Vmeasure());
665 num1 = num1 + kc.nc();
666 }
667
668 double tmp_chisq = 999;
669 bool flag_break = 0;
670 for(int it = 0; it < m_niter; it++) {
671 timer.Start();
672 m_nc = 0;
673 for(unsigned int i = 0; i < m_kc.size(); i++) {
674 KinematicConstraints kc = m_kc[i];
675 updateConstraints(kc);
676 }
677 timer.Stop();
678 m_cpu[0] += timer.CpuTime();
679 fit();
680 //
681 //reset origin parameters for virtual particle
682 //
683 // if(it == 0){
684 // for(int i = 0; i < numberWTrack(); i++) {
685 // // setWTrackInfit(i, wTrackOrigin(i));
686 // int pa = mappositionA()[i] + 1;
687 // int pb = mappositionB()[i] + 1;
688 // int ptype = mapkinematic()[i];
689 // switch(ptype) {
690 // case 3 : {
691 // setPOrigin(pa, m_p.sub(pa, pa));
692 // setPInfit(pa, m_p.sub(pa, pa));
693 // setQOrigin(pb, m_q.sub(pb, pb+2));
694 // setQInfit(pb, m_q.sub(pb, pb+2));
695 // break;
696 // }
697 // case 4 : {
698 // setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
699 // setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
700 // setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 2));
701 // setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
702 // setQInfit(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
703 // HepSymMatrix Dinv(2,0);
704 // setDOriginInv(pb, Dinv);
705 // break;
706 // }
707 // case 5 : {
708 // setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
709 // setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
710 // setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 3));
711 // setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
712 // setQInfit(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
713 // HepSymMatrix Dinv(1,0);
714 // setDOriginInv(pb, Dinv);
715 // break;
716 // }
717 // case 6 : {
718 // setPOrigin(pa, (wTrackOrigin(i).w()).sub(5, 7));
719 // setPOrigin(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
720 // setPInfit(pa, (wTrackOrigin(i).w()).sub(5, 7));
721 // setPInfit(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
722 // setCOrigin(pa, (wTrackOrigin(i).Ew()).sub(5,7));
723 // setCOrigin(pa+3, (wTrackOrigin(i).Ew()).sub(4,4));
724 // HepVector beam(3,0);
725 // beam[0] = getBeamPosition().x();
726 // beam[1] = getBeamPosition().y();
727 // beam[2] = getBeamPosition().z();
728 // setQOrigin(pb, beam);
729 // setQInfit(pb, beam);
730 // HepSymMatrix Dinv(3, 0);
731 // int ifail;
732 // Dinv = getVBeamPosition().inverse(ifail);
733 // setDOriginInv(pb, Dinv);
734 // break;
735 // }
736 //
737 // }
738 // }
739 //
740 // }
741 //
742 //
743 //===================reset over=============================
744 //
745 chisq.push_back(m_chi);
746 if(it > 0) {
747 double delchi = chisq[it]- chisq[it-1];
748 if(fabs(delchi) < m_chiter){
749 flag_break =1;
750 break;
751 }
752 }
753 }
754 if(!flag_break) {
755 return okfit;
756 }
757 if(m_chi > m_chicut) return okfit;
758 timer.Start();
759 timer.Stop();
760 m_cpu[5] += timer.CpuTime();
761 okfit = true;
762 return okfit;
763
764}
const int num1
string::const_iterator ptype
Definition: EvtMTree.hh:19
HepSymMatrix Vmeasure() const
vector< int > mappositionA() const
Definition: TrackPool.h:120
HepSymMatrix getVBeamPosition() const
Definition: TrackPool.h:148
HepPoint3D getBeamPosition() const
Definition: TrackPool.h:147
std::vector< WTrackParameter > wTrackOrigin() const
Definition: TrackPool.h:72
int numbertwo() const
Definition: TrackPool.h:118
vector< int > mappositionB() const
Definition: TrackPool.h:121
vector< int > mapkinematic() const
Definition: TrackPool.h:122
void setWTrackInfit(const int n, const WTrackParameter wtrk)
Definition: TrackPool.h:106

Referenced by Gam4pikp::execute(), Rhopi::execute(), K0pi0::MTotal(), K0pipipi0::MTotal(), K3pipi0::MTotal(), Kkpi0::MTotal(), Kpipi0::MTotal(), Kpipi0pi0::MTotal(), and Pipipi0::MTotal().

◆ Fit() [2/2]

bool KalmanKinematicFit::Fit ( int  n)

Definition at line 767 of file KalmanKinematicFit.cxx.

767 {
768 bool okfit = false;
769 if(n < 0 || (unsigned int)n >= m_kc.size()) return okfit;
770 m_nktrk = numberWTrack();
771 m_p0 = HepVector(numberone(), 0);
772 m_p = HepVector(numberone(), 0);
773 m_q0 = HepVector(numbertwo(), 0);
774 m_q = HepVector(numbertwo(), 0);
775 m_C0 = HepSymMatrix(numberone(), 0);
776 m_C = HepSymMatrix(numberone(), 0);
777 m_D0inv = HepSymMatrix(numbertwo(), 0);
778 m_D = HepSymMatrix(numbertwo(), 0);
779
780 for(int i = 0; i < numberWTrack(); i++) {
782 int pa = mappositionA()[i] + 1;
783 int pb = mappositionB()[i] + 1;
784 int ptype = mapkinematic()[i];
785 switch(ptype) {
786 case 0 : {
787 HepVector w1(4, 0);
788 HepSymMatrix Ew1(4, 0);
789 for(int j = 0; j < 3; j++) {
790 w1[j] = wTrackOrigin(i).w()[j];
791 }
792 w1[3] = wTrackOrigin(i).mass();
793
794 for(int m = 0; m < 3; m++) {
795 for(int n = 0; n < 3; n++) {
796 Ew1[m][n] = wTrackOrigin(i).Ew()[m][n];
797 }
798 }
799 setPOrigin(pa, w1);
800 setPInfit(pa, w1);
801 setCOrigin(pa, Ew1);
802 break;
803 }
804 case 1 : {
805 setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 4));
806 setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 4));
807 setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 4));
808 break;
809 }
810 case 2 : {
811 setQOrigin(pb, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
812 setQInfit(pb, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
813 HepSymMatrix Dinv(4,0);
814 setDOriginInv(pb, Dinv);
815 break;
816 }
817 case 3 : {
818 setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(3, 3));
819 setPInfit(pa, (wTrackOrigin(i).plmp()).sub(3, 3));
820 setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(3, 3));
821 setQOrigin(pb, (wTrackOrigin(i).w()).sub(1, 3));
822 setQInfit(pb, (wTrackOrigin(i).w()).sub(1, 3));
823 HepSymMatrix Dinv(3,0);
824 setDOriginInv(pb, Dinv);
825 break;
826 }
827 case 4 : {
828 setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
829 setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
830 setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 2));
831 setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
832 setQInfit(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
833 HepSymMatrix Dinv(2,0);
834 setDOriginInv(pb, Dinv);
835 break;
836 }
837 case 5 : {
838 setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
839 setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
840 setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 3));
841 setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
842 setQInfit(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
843 HepSymMatrix Dinv(1,0);
844 setDOriginInv(pb, Dinv);
845 break;
846 }
847 case 6 : {
848 setPOrigin(pa, (wTrackOrigin(i).w()).sub(5, 7));
849 setPOrigin(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
850 setPInfit(pa, (wTrackOrigin(i).w()).sub(5, 7));
851 setPInfit(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
852 setCOrigin(pa, (wTrackOrigin(i).Ew()).sub(5,7));
853 setCOrigin(pa+3, (wTrackOrigin(i).Ew()).sub(4,4));
854 HepVector beam(3,0);
855 beam[0] = getBeamPosition().x();
856 beam[1] = getBeamPosition().y();
857 beam[2] = getBeamPosition().z();
858 setQOrigin(pb, beam);
859 setQInfit(pb, beam);
860 HepSymMatrix Dinv(3, 0);
861 int ifail;
862 Dinv = getVBeamPosition().inverse(ifail);
863
864 setDOriginInv(pb, Dinv);
865 break;
866 }
867
868 case 7 : {
869 HepVector w1(4, 0);
870 HepSymMatrix Ew1(4, 0);
871 for(int j = 0; j < 3; j++) {
872 w1[j] = wTrackOrigin(i).w()[j];
873 }
874 w1[3] = wTrackOrigin(i).mass();
875
876 for(int m = 0; m < 3; m++) {
877 for(int n = 0; n < 3; n++) {
878 Ew1[m][n] = wTrackOrigin(i).Ew()[m][n];
879 }
880 }
881 setPOrigin(pa, w1);
882 setPInfit(pa, w1);
883 setCOrigin(pa, Ew1);
884 break;
885 }
886 }
887 }
888
889
890
891 //
892 // iteration
893 //
894
895 std::vector<double> chisq;
896 chisq.clear();
897 int nc = 0;
898 // for(int i = 0; i < m_kc.size(); i++)
899 nc += m_kc[n].nc();
900
901 m_A = HepMatrix(nc, numberone(), 0);
902 m_AT = HepMatrix(numberone(), nc, 0);
903 m_B = HepMatrix(nc, numbertwo(), 0);
904 m_BT = HepMatrix(numbertwo(), nc, 0);
905 m_G = HepVector(nc, 0);
906 m_Vm = HepSymMatrix(nc, 0);
907 int num1 = 0;
908 KinematicConstraints kc = m_kc[n];
909 m_Vm.sub(num1+1,kc.Vmeasure());
910 num1 = kc.nc();
911 for(int it = 0; it < m_niter; it++) {
912 m_nc = 0;
913 KinematicConstraints kc = m_kc[n];
914 updateConstraints(kc);
915 fit(n);
916
917 chisq.push_back(m_chisq[n]);
918
919 if(it > 0) {
920
921 double delchi = chisq[it]- chisq[it-1];
922 if(fabs(delchi) < m_chiter)
923 break;
924 }
925 }
926 if(m_chisq[n] >= m_chicut) {
927 return okfit;
928 }
929 //update track parameter and its covariance matrix
930 //upCovmtx();
931
932 okfit = true;
933
934
935 return okfit;
936
937}

◆ getCInfit()

HepSymMatrix KalmanKinematicFit::getCInfit ( int  i) const

Definition at line 1415 of file KalmanKinematicFit.cxx.

1415 {
1416 int pa = mappositionA()[n] + 1;
1417 int pb = mappositionB()[n] + 1;
1418 int ptype = mapkinematic()[n];
1419 switch(ptype) {
1420 case 0 : {
1421 return m_C.sub(pa, pa+NTRKPAR-1);
1422 break;
1423 }
1424 case 1 : {
1425 return m_C.sub(pa, pa+NTRKPAR-1);
1426 break;
1427 }
1428 case 3 : {
1429 return m_C.sub(pa, pa);
1430 break;
1431 }
1432 case 4 : {
1433 return m_C.sub(pa, pa+1);
1434 break;
1435 }
1436 case 5 : {
1437 return m_C.sub(pa, pa+2);
1438 break;
1439 }
1440 case 7 : {
1441 return m_C.sub(pa, pa+NTRKPAR-1);
1442 break;
1443 }
1444 }
1445}

Referenced by pull().

◆ getCOrigin()

HepSymMatrix KalmanKinematicFit::getCOrigin ( int  i) const

Definition at line 1381 of file KalmanKinematicFit.cxx.

1381 {
1382 int pa = mappositionA()[n] + 1;
1383 int pb = mappositionB()[n] + 1;
1384 int ptype = mapkinematic()[n];
1385 switch(ptype) {
1386 case 0 : {
1387 return m_C0.sub(pa, pa+NTRKPAR-1);
1388 break;
1389 }
1390 case 1 : {
1391 return m_C0.sub(pa, pa+NTRKPAR-1);
1392 break;
1393 }
1394 case 3 : {
1395 return m_C0.sub(pa, pa);
1396 break;
1397 }
1398 case 4 : {
1399 return m_C0.sub(pa, pa+1);
1400 break;
1401 }
1402 case 5 : {
1403 return m_C0.sub(pa, pa+2);
1404 break;
1405 }
1406 case 7 : {
1407 return m_C0.sub(pa, pa+NTRKPAR-1);
1408 break;
1409 }
1410
1411 }
1412}

Referenced by pull().

◆ infit()

WTrackParameter KalmanKinematicFit::infit ( int  n) const
inline

Definition at line 161 of file KalmanKinematicFit.h.

161{return wTrackInfit(n);}

◆ init()

void KalmanKinematicFit::init ( )

Definition at line 34 of file KalmanKinematicFit.cxx.

34 {
38 //gamma shape
44 clearone();
45 cleartwo();
46 setBeamPosition(HepPoint3D(0.0,0.0,0.0));
47 setVBeamPosition(HepSymMatrix(3,0));
48 //=============
49 m_kc.clear();
50 m_chisq.clear();
51 m_chi = 9999.;
52 m_niter = 10;
53 m_chicut = 200.;
54 m_chiter = 0.005;
55 m_espread = 0.0;
56 m_collideangle = 11e-3;
57 m_flag = 0;
58 m_dynamicerror = 0;
59 m_nc = 0;
60 m_cpu = HepVector(10, 0);
61 m_virtual_wtrk.clear();
62 m_graph2d = 0;
63 // m_graph2d = TGraph2D("/ihepbatch/bes/yanl/6.5.0//TestRelease/TestRelease-00-00-62/run/gamma/new/graph.dat");
64}
HepGeom::Point3D< double > HepPoint3D
Definition: Gam4pikp.cxx:37
void setVBeamPosition(const HepSymMatrix VBeamPosition)
Definition: TrackPool.h:144
void clearMapkinematic()
Definition: TrackPool.h:124
void clearGammaShapeList()
Definition: TrackPool.h:140
void clearWTrackOrigin()
Definition: TrackPool.h:111
void clearone()
Definition: TrackPool.h:115
void clearMappositionB()
Definition: TrackPool.h:126
void clearWTrackList()
Definition: TrackPool.h:113
void clearMappositionA()
Definition: TrackPool.h:125
void cleartwo()
Definition: TrackPool.h:116
void clearGammaShape()
Definition: TrackPool.h:139
void clearWTrackInfit()
Definition: TrackPool.h:112
void setBeamPosition(const HepPoint3D BeamPosition)
Definition: TrackPool.h:143

Referenced by Gam4pikp::execute(), Rhopi::execute(), K0pi0::MTotal(), K0pipipi0::MTotal(), K3pipi0::MTotal(), Kkpi0::MTotal(), Kpipi0::MTotal(), Kpipi0pi0::MTotal(), and Pipipi0::MTotal().

◆ instance()

KalmanKinematicFit * KalmanKinematicFit::instance ( )
static

Definition at line 20 of file KalmanKinematicFit.cxx.

20 {
21 if(m_pointer) return m_pointer;
22 m_pointer = new KalmanKinematicFit();
23 return m_pointer;
24}

Referenced by Gam4pikp::execute(), Rhopi::execute(), K0pi0::MTotal(), K0pipipi0::MTotal(), K3pipi0::MTotal(), Kkpi0::MTotal(), Kpipi0::MTotal(), Kpipi0pi0::MTotal(), and Pipipi0::MTotal().

◆ origin()

WTrackParameter KalmanKinematicFit::origin ( int  n) const
inline

Definition at line 160 of file KalmanKinematicFit.h.

160{return wTrackOrigin(n);}

◆ pfit()

HepLorentzVector KalmanKinematicFit::pfit ( int  n) const
inline

◆ pfit1()

HepLorentzVector KalmanKinematicFit::pfit1 ( int  n)
inline

Definition at line 157 of file KalmanKinematicFit.h.

157{return p4Origin(n);}

◆ pull()

HepVector KalmanKinematicFit::pull ( int  n)

Definition at line 1061 of file KalmanKinematicFit.cxx.

1061 {
1062 upCovmtx();
1063 int pa = mappositionA()[n] + 1;
1064 int pb = mappositionB()[n] + 1 ;
1065 int ptype = mapkinematic()[n];
1066 switch(ptype) {
1067 case 0 :{
1068 HepVector W(7,0);
1069 HepSymMatrix Ew(7,0);
1070 HepVector W1(7,0);
1071 HepSymMatrix Ew1(7,0);
1073 W = wTrackOrigin(n).w();
1074 Ew = wTrackOrigin(n).Ew();
1075 for(int i=0; i<4; i++) {
1076 W[i] = pInfit(n)[i];
1077 }
1078 for(int j=0; j<4; j++) {
1079 for(int k=0; k<4; k++) {
1080 Ew[j][k] = getCInfit(n)[j][k];
1081 }
1082 }
1083 W1 = W;
1084 double px = p4Infit(n).px();
1085 double py = p4Infit(n).py();
1086 double pz = p4Infit(n).pz();
1087 double m = p4Infit(n).m();
1088 double e = p4Infit(n).e();
1089 HepMatrix J(7, 7, 0);
1090 J[0][0] = 1;
1091 J[1][1] = 1;
1092 J[2][2] = 1;
1093 J[3][0] = px/e;
1094 J[3][1] = py/e;
1095 J[3][2] = pz/e;
1096 J[3][3] = m/e;
1097 J[4][4] = 1;
1098 J[5][5] = 1;
1099 J[6][6] = 1;
1100 Ew1 = Ew.similarity(J);
1101
1102 wtrk.setW(W1);
1103 wtrk.setEw(Ew1);
1104 setWTrackInfit(n, wtrk);
1105
1108 HepVector a0 = horigin.hel();
1109 HepVector a1 = hinfit.hel();
1110 HepSymMatrix v0 = horigin.eHel();
1111 HepSymMatrix v1 = hinfit.eHel();
1112 HepVector pull(9,0);
1113 for (int k=0; k<5; k++) {
1114 pull[k] = (a0[k]-a1[k])/sqrt(abs(v0[k][k]-v1[k][k]));
1115 }
1116 for (int l=5; l<9; l++) {
1117 pull[l] = (wTrackOrigin(n).w()[l-5] - wTrackInfit(n).w()[l-5])/sqrt(abs(wTrackOrigin(n).Ew()[l-5][l-5] - wTrackInfit(n).Ew()[l-5][l-5]));
1118 }
1119 return pull;
1120 break;
1121 }
1122 case 1 : {
1123 HepVector a0(4,0);
1124 HepVector a1(4,0);
1125 a0 = m_p0.sub(pa, pa+3);
1126 a1 = m_p.sub(pa, pa+3);
1127 HepSymMatrix v1 = getCInfit(n);
1128 HepSymMatrix v0 = getCOrigin(n);
1129 HepVector pull(3,0);
1130 for (int k=0; k<2; k++) {
1131 pull[k] = (a0[k]-a1[k])/sqrt(v0[k][k]-v1[k][k]);
1132 }
1133 pull[2] = (a0[3]-a1[3])/sqrt(v0[3][3]-v1[3][3]);
1134 return pull;
1135 break;
1136 }
1137 // case 2 : {
1138 // return pull;
1139 // break;
1140 // }
1141 // case 3 : {
1142 // return pull;
1143 // break;
1144 // }
1145 // case 4 : {
1146 // return pull;
1147 // break;
1148 // }
1149 case 5 : {
1150 HepLorentzVector p0 = p4Origin(n);
1151 HepLorentzVector p1 = p4Infit(n);
1152 HepVector a0(2,0);
1153 HepVector a1(2,0);
1154 a0[0] = p4Origin(n).phi();
1155 a1[0] = p4Infit(n).phi();
1156 a0[1] = p4Origin(n).pz()/p4Origin(n).perp();
1157 a1[1] = p4Infit(n).pz()/p4Infit(n).perp();
1158 HepMatrix Jacobi(2, 4, 0);
1159 Jacobi[0][0] = - p4Infit(n).py()/p4Infit(n).perp2();
1160 Jacobi[0][1] = p4Infit(n).px()/p4Infit(n).perp2();
1161 Jacobi[1][0] = - (p4Infit(n).px()/p4Infit(n).perp()) * (p4Infit(n).pz()/p4Infit(n).perp2());
1162 Jacobi[1][1] = - (p4Infit(n).py()/p4Infit(n).perp()) * (p4Infit(n).pz()/p4Infit(n).perp2());
1163 Jacobi[1][2] = 1/p4Infit(n).perp();
1164 HepSymMatrix v1 = getCInfit(n).similarity(Jacobi);
1165 HepSymMatrix v0 = wTrackOrigin(n).Vplm().sub(1,2);
1166 HepVector pull(2,0);
1167 for (int k=0; k<2; k++) {
1168 pull[k] = (a0[k]-a1[k])/sqrt(v0[k][k]-v1[k][k]);
1169 }
1170 return pull;
1171 break;
1172 }
1173 }
1174}
double abs(const EvtComplex &c)
Definition: EvtComplex.hh:212
HepVector hel() const
HepSymMatrix eHel() const
HepSymMatrix getCInfit(int i) const
HepSymMatrix getCOrigin(int i) const

Referenced by pull().

◆ setChisqCut()

void KalmanKinematicFit::setChisqCut ( const double  chicut = 200,
const double  chiter = 0.05 
)
inline

Definition at line 132 of file KalmanKinematicFit.h.

132{m_chicut = chicut;m_chiter=chiter;}

Referenced by K0pi0::MTotal(), K0pipipi0::MTotal(), K3pipi0::MTotal(), Kkpi0::MTotal(), Kpipi0::MTotal(), Kpipi0pi0::MTotal(), and Pipipi0::MTotal().

◆ setCollideangle()

void KalmanKinematicFit::setCollideangle ( const double  collideangle = 11e-3)
inline

Definition at line 137 of file KalmanKinematicFit.h.

137{m_collideangle = collideangle;}
double collideangle() const

◆ setDynamicerror()

void KalmanKinematicFit::setDynamicerror ( const bool  dynamicerror = 1)
inline

Definition at line 138 of file KalmanKinematicFit.h.

138{m_dynamicerror = dynamicerror;}

◆ setEspread()

void KalmanKinematicFit::setEspread ( const double  espread = 0.0009)
inline

Definition at line 136 of file KalmanKinematicFit.h.

136{m_espread = espread;}
double espread() const

◆ setFlag()

void KalmanKinematicFit::setFlag ( const bool  flag = 1)
inline

Definition at line 130 of file KalmanKinematicFit.h.

130{m_flag = flag;}

◆ setIterNumber()

void KalmanKinematicFit::setIterNumber ( const int  niter = 5)
inline

Definition at line 131 of file KalmanKinematicFit.h.

131{m_niter = niter;}

◆ setTgraph()

void KalmanKinematicFit::setTgraph ( TGraph2D *  graph2d)
inline

Definition at line 139 of file KalmanKinematicFit.h.

139{m_graph2d = graph2d;}

◆ wVirtualTrack()

WTrackParameter KalmanKinematicFit::wVirtualTrack ( int  n) const
inline

Definition at line 174 of file KalmanKinematicFit.h.

174{return m_virtual_wtrk[n];}

◆ xfit()

HepVector KalmanKinematicFit::xfit ( )
inline

Definition at line 158 of file KalmanKinematicFit.h.

158{return m_q.sub(1,3);}

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