KalmanKinematicFit Class Reference

#include <KalmanKinematicFit.h>

Inheritance diagram for KalmanKinematicFit:

TrackPool List of all members.

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
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
WTrackParameter wTrackOrigin (int n) const
std::vector< WTrackParameterwTrackInfit () const
WTrackParameter wTrackInfit (int n) const
std::vector< int > wTrackList () const
int wTrackList (int n) const
int numberWTrack () const
std::vector< GammaShapeGammaShapeValue () const
GammaShape GammaShapeValue (int n) const
std::vector< int > GammaShapeList () const
int GammaShapeList (int n) const
int numberGammaShape () const
void setWTrackOrigin (const int n, const WTrackParameter wtrk)
void setWTrackOrigin (const WTrackParameter wtrk)
void setWTrackInfit (const int n, 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 ()

Private Member Functions

void updateConstraints (KinematicConstraints kc)
void fit ()
void upCovmtx ()
void upTrkpar ()
void clearDDT ()
void fit (int n)
void covMatrix (int n)
void gda ()
void setA (int ic, int itk, const HepMatrix &p)
void setAT (int itk, int ic, const HepMatrix &p)
void setB (int ic, int itk, const HepMatrix &p)
void setBT (int itk, int ic, const HepMatrix &p)
HepVector pOrigin (int i) const
HepLorentzVector p4Origin (int i) const
HepVector pInfit (int i) const
HepLorentzVector p4Infit (int i) const
void setPOrigin (int i, const HepVector &p)
void setPInfit (int i, const HepVector &p)
void setCOrigin (int i, const HepSymMatrix &D)
void setCInfit (int i, const HepSymMatrix &D)
void setQOrigin (int i, const HepVector &q)
void setQInfit (int i, const HepVector &q)
void setDOrigin (int i, const HepSymMatrix &D)
void setDInfit (int i, const HepSymMatrix &D)
void setDOriginInv (int i, const HepSymMatrix &Dinv)
 KalmanKinematicFit ()

Private Attributes

std::vector< WTrackParameterm_virtual_wtrk
std::vector< KinematicConstraintsm_kc
std::vector< double > m_chisq
double m_chi
HepSymMatrix m_Vm
HepMatrix m_A
HepMatrix m_AT
HepVector m_G
HepSymMatrix m_W
HepMatrix m_KP
HepMatrix m_B
HepMatrix m_BT
HepMatrix m_KQ
int m_nc
int m_nktrk
HepVector m_p0
HepVector m_p
HepSymMatrix m_C0
HepSymMatrix m_C
HepVector m_q0
HepVector m_q
HepSymMatrix m_D0
HepSymMatrix m_D
HepSymMatrix m_D0inv
HepSymMatrix m_Dinv
int m_niter
bool m_flag
double m_chicut
double m_chiter
double m_espread
double m_collideangle
HepVector m_cpu
bool m_dynamicerror
TGraph2D * m_graph2d

Static Private Attributes

static KalmanKinematicFitm_pointer = 0
static const int NTRKPAR = 4
static const int NKFPAR
static const int Resonance = 1
static const int TotalEnergy = 2
static const int TotalMomentum = 4
static const int ThreeMomentum = 16
static const int FourMomentum = 32
static const int EqualMass = 64
static const int Position = 8

Detailed Description

Definition at line 11 of file KalmanKinematicFit.h.


Constructor & Destructor Documentation

KalmanKinematicFit::~KalmanKinematicFit (  ) 

Definition at line 28 of file KalmanKinematicFit.cxx.

References m_pointer.

00028                                         {
00029     //       if(m_pointer) delete m_pointer;
00030     delete m_pointer;
00031 }

KalmanKinematicFit::KalmanKinematicFit (  )  [private]

Definition at line 26 of file KalmanKinematicFit.cxx.

Referenced by instance().

00026 {;}


Member Function Documentation

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

Definition at line 321 of file KalmanKinematicFit.cxx.

References KinematicConstraints::EqualMassConstraints(), and m_kc.

00321                                                                                              {
00322     KinematicConstraints kc;
00323     HepSymMatrix Vne = HepSymMatrix(1,0);
00324     kc.EqualMassConstraints(tlis1, tlis2, Vne);
00325     m_kc.push_back(kc);
00326     if((unsigned int) number != m_kc.size()-1) 
00327         std::cout << "wrong kinematic constraints index" << std::endl;
00328 }

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

Definition at line 374 of file KalmanKinematicFit.cxx.

References KinematicConstraints::FourMomentumConstraints(), genRecEmupikp::i, m_espread, m_kc, and TrackPool::numberWTrack().

00374                                                                 {
00375 
00376     HepLorentzVector p4(0.0, 0.0, 0.0, etot);
00377     std::vector<int> tlis;
00378     tlis.clear();
00379     KinematicConstraints kc;
00380 
00381     for(int i = 0; i < numberWTrack(); i++) {
00382         tlis.push_back(i);
00383     }
00384     HepSymMatrix Vme = HepSymMatrix (4,0);
00385     Vme[3][3] = 2*m_espread*m_espread;
00386     kc.FourMomentumConstraints(p4, tlis, Vme);
00387     m_kc.push_back(kc);
00388     if((unsigned int) number != m_kc.size()-1) 
00389         std::cout << "wrong kinematic constraints index" << std::endl;
00390 }

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

Definition at line 353 of file KalmanKinematicFit.cxx.

References KinematicConstraints::FourMomentumConstraints(), genRecEmupikp::i, m_collideangle, m_espread, m_kc, TrackPool::numberWTrack(), and sin().

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

00353                                                                         {
00354 
00355     std::vector<int> tlis;
00356     tlis.clear();
00357     KinematicConstraints kc;
00358 
00359     for(int i = 0; i < numberWTrack(); i++) {
00360         tlis.push_back(i);
00361     }
00362 
00363     HepSymMatrix Vme = HepSymMatrix(4,0);
00364     Vme[0][0] = 2*m_espread*m_espread*sin(m_collideangle)*sin(m_collideangle);
00365     Vme[0][3] = 2*m_espread*m_espread*sin(m_collideangle);
00366     Vme[3][3] = 2*m_espread*m_espread;
00367 
00368     kc.FourMomentumConstraints(p4, tlis, Vme);
00369     m_kc.push_back(kc);
00370     if((unsigned int) number != m_kc.size()-1) 
00371         std::cout << "wrong kinematic constraints index" << std::endl;
00372 }

std::vector< int > TrackPool::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 
) [inherited]

Definition at line 618 of file TrackPool.cxx.

00619                                            {
00620     std::vector<int> lis;
00621     lis.clear();
00622     lis.push_back(n1);
00623     lis.push_back(n2);
00624     lis.push_back(n3);
00625     lis.push_back(n4);
00626     lis.push_back(n5);
00627     lis.push_back(n6);
00628     lis.push_back(n7);
00629     lis.push_back(n8);
00630     lis.push_back(n9);
00631     lis.push_back(n10);
00632     lis.push_back(n11);
00633     lis.push_back(n12);
00634     return lis;
00635 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10,
int  n11 
) [inherited]

Definition at line 600 of file TrackPool.cxx.

00601                                   {
00602     std::vector<int> lis;
00603     lis.clear();
00604     lis.push_back(n1);
00605     lis.push_back(n2);
00606     lis.push_back(n3);
00607     lis.push_back(n4);
00608     lis.push_back(n5);
00609     lis.push_back(n6);
00610     lis.push_back(n7);
00611     lis.push_back(n8);
00612     lis.push_back(n9);
00613     lis.push_back(n10);
00614     lis.push_back(n11);
00615     return lis;
00616 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9,
int  n10 
) [inherited]

Definition at line 583 of file TrackPool.cxx.

00584                          {
00585     std::vector<int> lis;
00586     lis.clear();
00587     lis.push_back(n1);
00588     lis.push_back(n2);
00589     lis.push_back(n3);
00590     lis.push_back(n4);
00591     lis.push_back(n5);
00592     lis.push_back(n6);
00593     lis.push_back(n7);
00594     lis.push_back(n8);
00595     lis.push_back(n9);
00596     lis.push_back(n10);
00597     return lis;
00598 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8,
int  n9 
) [inherited]

Definition at line 567 of file TrackPool.cxx.

00568                 {
00569     std::vector<int> lis;
00570     lis.clear();
00571     lis.push_back(n1);
00572     lis.push_back(n2);
00573     lis.push_back(n3);
00574     lis.push_back(n4);
00575     lis.push_back(n5);
00576     lis.push_back(n6);
00577     lis.push_back(n7);
00578     lis.push_back(n8);
00579     lis.push_back(n9);
00580     return lis;
00581 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7,
int  n8 
) [inherited]

Definition at line 553 of file TrackPool.cxx.

00553                                                                                                 {
00554     std::vector<int> lis;
00555     lis.clear();
00556     lis.push_back(n1);
00557     lis.push_back(n2);
00558     lis.push_back(n3);
00559     lis.push_back(n4);
00560     lis.push_back(n5);
00561     lis.push_back(n6);
00562     lis.push_back(n7);
00563     lis.push_back(n8);
00564     return lis;
00565 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6,
int  n7 
) [inherited]

Definition at line 540 of file TrackPool.cxx.

00540                                                                                         {
00541     std::vector<int> lis;
00542     lis.clear();
00543     lis.push_back(n1);
00544     lis.push_back(n2);
00545     lis.push_back(n3);
00546     lis.push_back(n4);
00547     lis.push_back(n5);
00548     lis.push_back(n6);
00549     lis.push_back(n7);
00550     return lis;
00551 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5,
int  n6 
) [inherited]

Definition at line 528 of file TrackPool.cxx.

00528                                                                                 {
00529     std::vector<int> lis;
00530     lis.clear();
00531     lis.push_back(n1);
00532     lis.push_back(n2);
00533     lis.push_back(n3);
00534     lis.push_back(n4);
00535     lis.push_back(n5);
00536     lis.push_back(n6);
00537     return lis;
00538 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3,
int  n4,
int  n5 
) [inherited]

Definition at line 517 of file TrackPool.cxx.

00517                                                                         {
00518     std::vector<int> lis;
00519     lis.clear();
00520     lis.push_back(n1);
00521     lis.push_back(n2);
00522     lis.push_back(n3);
00523     lis.push_back(n4);
00524     lis.push_back(n5);
00525     return lis;
00526 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3,
int  n4 
) [inherited]

Definition at line 507 of file TrackPool.cxx.

00507                                                                 {
00508     std::vector<int> lis;
00509     lis.clear();
00510     lis.push_back(n1);
00511     lis.push_back(n2);
00512     lis.push_back(n3);
00513     lis.push_back(n4);
00514     return lis;
00515 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2,
int  n3 
) [inherited]

Definition at line 498 of file TrackPool.cxx.

00498                                                         {
00499     std::vector<int> lis;
00500     lis.clear();
00501     lis.push_back(n1);
00502     lis.push_back(n2);
00503     lis.push_back(n3);
00504     return lis;
00505 }

std::vector< int > TrackPool::AddList ( int  n1,
int  n2 
) [inherited]

Definition at line 490 of file TrackPool.cxx.

00490                                                 {
00491     std::vector<int> lis;
00492     lis.clear();
00493     lis.push_back(n1);
00494     lis.push_back(n2);
00495     return lis;
00496 }

std::vector< int > TrackPool::AddList ( int  n1  )  [inherited]

Definition at line 483 of file TrackPool.cxx.

Referenced by VertexFit::AddBeamFit(), KinematicFit::AddResonance(), AddResonance(), KinematicFit::AddTotalEnergy(), AddTotalEnergy(), KinematicFit::AddTotalMomentum(), AddTotalMomentum(), and VertexFit::AddVertex().

00483                                         {
00484     std::vector<int> lis;
00485     lis.clear();
00486     lis.push_back(n1);
00487     return lis;
00488 }

void TrackPool::AddMissTrack ( const int  number,
const HepLorentzVector  p4 
) [inherited]

Definition at line 403 of file TrackPool.cxx.

References genRecEmupikp::i, ganga-rec::j, TrackPool::m_numberone, TrackPool::m_numbertwo, WTrackParameter::setEw(), TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), WTrackParameter::setType(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), and TrackPool::setWTrackOrigin().

00403                                                                   {
00404     double dphi = 1E+3;
00405     double dthe = 1E+3;
00406     double dE = 1E+3;
00407     WTrackParameter wtrk(p4, dphi, dthe, dE);
00408     HepSymMatrix Ew = HepSymMatrix(7,0);
00409     for (int i = 0; i < 7; i++) {
00410         for (int j = 0; j < 7; j++) {
00411             if(i==j)    Ew[i][j] = 1E+6;
00412         }
00413     }
00414     wtrk.setType(1);
00415     wtrk.setEw(Ew);
00416     setWTrackOrigin(wtrk);
00417     setWTrackInfit(wtrk);
00418     setWTrackList(number);
00419     setMapkinematic(2);
00420     setMappositionA(m_numberone);
00421     setMappositionB(m_numbertwo);
00422     m_numbertwo = m_numbertwo + 4;     
00423 }

void TrackPool::AddMissTrack ( const int  number,
const RecEmcShower trk 
) [inherited]

Definition at line 250 of file TrackPool.cxx.

References cos(), DstEmcShower::dphi(), DstEmcShower::dtheta(), DstEmcShower::energy(), WTrackParameter::Ew(), TrackPool::m_BeamPosition, TrackPool::m_numberone, TrackPool::m_numbertwo, TrackPool::m_VBeamPosition, mass, DstEmcShower::phi(), TrackPool::setGammaShape(), TrackPool::setGammaShapeList(), TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), WTrackParameter::setPlmp(), WTrackParameter::setType(), WTrackParameter::setVplm(), WTrackParameter::setW(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), TrackPool::setWTrackOrigin(), sin(), DstEmcShower::theta(), DstEmcShower::x(), x, DstEmcShower::y(), and DstEmcShower::z().

00250                                                                       {
00251     //
00252     //parameters: phi lambda mass E
00253     //
00254 
00255     double mass = 0;
00256     double ptrk = trk->energy();
00257     double e = sqrt(ptrk*ptrk + mass * mass);
00258     double the = trk->theta();
00259     double phi = trk->phi();
00260     HepLorentzVector p4( e* sin(the) * cos(phi),
00261             e * sin(the) * sin(phi),
00262             e * cos(the),
00263             e);
00264     double dphi = trk->dphi();
00265     double dthe = trk->dtheta();
00266     double de   = 1E+6;
00267     double x = trk->x();
00268     double y = trk->y();
00269     double z = trk->z();
00270 
00271     HepPoint3D x3 (x, y ,z);
00272     WTrackParameter wtrk(x3, p4 ,dphi ,dthe, de);
00273     HepSymMatrix Vpe = HepSymMatrix(2,0);
00274     //=== get Vclus===
00275     HepSymMatrix Vclus = HepSymMatrix (3,0);
00276     Vclus = (wtrk.Ew()).sub(5,7);
00277     double xpr = x - m_BeamPosition[0];
00278     double ypr = y - m_BeamPosition[1];
00279     double zpr = z - m_BeamPosition[2];
00280     double Rpr = sqrt(xpr*xpr + ypr*ypr);
00281     // === get jacobi ===   
00282     HepMatrix J(2,3,0);
00283     J[0][0] = -ypr/(Rpr*Rpr);
00284     J[0][1] = xpr/(Rpr*Rpr);
00285     J[1][0] = -xpr * zpr/(Rpr*Rpr*Rpr);
00286     J[1][1] = -ypr * zpr/(Rpr*Rpr*Rpr);
00287     J[1][2] = 1/Rpr;
00288     Vpe = Vclus.similarity(J) + m_VBeamPosition.similarity(J);
00289     Vpe[0][1]=0;
00290     double phipre = atan(ypr/xpr);
00291 
00292     if(xpr<0){
00293         phipre = atan(ypr/xpr) + 3.1415926;
00294     }
00295     double lambdapre = zpr/Rpr;
00296 
00297 
00298     HepVector plmp(4 , 0);
00299     plmp[0] = phipre;
00300     plmp[1] = lambdapre;
00301     plmp[2] = mass;
00302     plmp[3] = e;
00303     wtrk.setPlmp(plmp);
00304 
00305     HepSymMatrix Vplm(2,0);
00306     Vplm[0][0] = Vpe[0][0];
00307     Vplm[1][1] = Vpe[1][1];
00308     wtrk.setVplm(Vplm);
00309 
00310 
00311 
00312     // === set p4 ===
00313     double p0x = ptrk*cos(phipre)/sqrt(1 + lambdapre*lambdapre);
00314     double p0y = ptrk*sin(phipre)/sqrt(1 + lambdapre*lambdapre);
00315     double p0z = ptrk*lambdapre/sqrt(1 + lambdapre*lambdapre);
00316     double p0e = e;
00317 
00318     wtrk.setW(0,p0x);
00319     wtrk.setW(1,p0y);
00320     wtrk.setW(2,p0z);
00321     wtrk.setW(3,p0e);
00322 
00323     wtrk.setType(1);
00324     setWTrackOrigin(wtrk);
00325     setWTrackInfit(wtrk);
00326     setWTrackList(number);
00327     GammaShape gtrk(p4,dphi,dthe,de);
00328     setGammaShape(gtrk);
00329     setGammaShapeList(number);
00330     setMapkinematic(4);
00331     setMappositionA(m_numberone);
00332     setMappositionB(m_numbertwo);
00333 
00334     m_numberone = m_numberone + 2;
00335     m_numbertwo = m_numbertwo + 2;
00336 }

void TrackPool::AddMissTrack ( const int  number,
const double  mass,
const RecEmcShower trk 
) [inherited]

Definition at line 159 of file TrackPool.cxx.

References cos(), DstEmcShower::dphi(), DstEmcShower::dtheta(), DstEmcShower::energy(), WTrackParameter::Ew(), TrackPool::m_BeamPosition, TrackPool::m_numberone, TrackPool::m_numbertwo, TrackPool::m_VBeamPosition, DstEmcShower::phi(), TrackPool::setGammaShape(), TrackPool::setGammaShapeList(), TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), WTrackParameter::setPlmp(), WTrackParameter::setType(), WTrackParameter::setVplm(), WTrackParameter::setW(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), TrackPool::setWTrackOrigin(), sin(), DstEmcShower::theta(), DstEmcShower::x(), x, DstEmcShower::y(), and DstEmcShower::z().

00160                                  {
00161     //
00162     //parameters: phi lambda mass ptrk
00163     //
00164     double ptrk = trk->energy();
00165     double e = sqrt(ptrk*ptrk + mass * mass);
00166     double the = trk->theta();
00167     double phi = trk->phi();
00168     HepLorentzVector p4( e* sin(the) * cos(phi), 
00169             e * sin(the) * sin(phi),
00170             e * cos(the),
00171             e);
00172     double dphi = trk->dphi();
00173     double dthe = trk->dtheta();
00174     double de   = 1E+6;
00175     double x = trk->x();
00176     double y = trk->y();
00177     double z = trk->z();
00178 
00179     HepPoint3D x3 (x, y ,z);
00180     WTrackParameter wtrk(x3, p4 ,dphi ,dthe, de);
00181     HepSymMatrix Vpe = HepSymMatrix(2,0);
00182     //=== get Vclus===
00183     HepSymMatrix Vclus = HepSymMatrix (3,0);
00184     Vclus = (wtrk.Ew()).sub(5,7);
00185     double xpr = x - m_BeamPosition[0];
00186     double ypr = y - m_BeamPosition[1];
00187     double zpr = z - m_BeamPosition[2];
00188     double Rpr = sqrt(xpr*xpr + ypr*ypr);
00189     // === get jacobi ===   
00190     HepMatrix J(2,3,0);
00191     J[0][0] = -ypr/(Rpr*Rpr);
00192     J[0][1] = xpr/(Rpr*Rpr);
00193     J[1][0] = -xpr * zpr/(Rpr*Rpr*Rpr);
00194     J[1][1] = -ypr * zpr/(Rpr*Rpr*Rpr);
00195     J[1][2] = 1/Rpr;
00196     Vpe = Vclus.similarity(J) + m_VBeamPosition.similarity(J);
00197     Vpe[0][1]=0;
00198 
00199     double phipre = atan(ypr/xpr);
00200 
00201     if(xpr<0){
00202         phipre = atan(ypr/xpr) + 3.1415926;
00203     } 
00204     double lambdapre = zpr/Rpr;  
00205 
00206 
00207     HepVector plmp(4 , 0);
00208     plmp[0] = phipre;
00209     plmp[1] = lambdapre;
00210     plmp[2] = mass;
00211     plmp[3] = ptrk;
00212     wtrk.setPlmp(plmp);
00213 
00214     HepSymMatrix Vplm(3,0);
00215     Vplm[0][0] = Vpe[0][0];
00216     Vplm[1][1] = Vpe[1][1];
00217     wtrk.setVplm(Vplm);
00218 
00219 
00220 
00221     // === set p4 ===
00222     double p0x = ptrk*cos(phipre)/sqrt(1 + lambdapre*lambdapre);
00223     double p0y = ptrk*sin(phipre)/sqrt(1 + lambdapre*lambdapre);  
00224     double p0z = ptrk*lambdapre/sqrt(1 + lambdapre*lambdapre);
00225     double p0e = e;
00226 
00227     wtrk.setW(0,p0x);
00228     wtrk.setW(1,p0y);
00229     wtrk.setW(2,p0z);
00230     wtrk.setW(3,p0e);
00231 
00232     wtrk.setType(1);
00233     setWTrackOrigin(wtrk);
00234     setWTrackInfit(wtrk);
00235     setWTrackList(number);
00236     GammaShape gtrk(p4,dphi,dthe,de);
00237     setGammaShape(gtrk);
00238     setGammaShapeList(number);
00239     setMapkinematic(5);
00240     setMappositionA(m_numberone);
00241     setMappositionB(m_numbertwo);
00242 
00243     m_numberone = m_numberone + 3;
00244     m_numbertwo = m_numbertwo + 1;
00245 }

void TrackPool::AddMissTrack ( const int  number,
const double  mass,
const HepLorentzVector  p4 
) [inherited]

Definition at line 341 of file TrackPool.cxx.

References WTrackParameter::Lambda(), TrackPool::m_numberone, TrackPool::m_numbertwo, TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), WTrackParameter::setPlmp(), WTrackParameter::setType(), WTrackParameter::setVplm(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), and TrackPool::setWTrackOrigin().

00341                                                                                            {
00342     //
00343     //parameters: mass px py pz
00344     //  
00345 
00346     double dphi = 1E+6;
00347     double dthe = 1E+6;
00348     double dE = 1E+6;
00349     WTrackParameter wtrk(p4, dphi, dthe, dE);
00350     HepVector plmp(4, 0);
00351     double phipre = atan(p4[1]/p4[0]);
00352 
00353     if(p4[0]<0){
00354         phipre = atan(p4[1]/p4[0]) + 3.1415926;
00355     }
00356     plmp[0] = phipre;
00357     plmp[1] = wtrk.Lambda();
00358     plmp[2] = mass;
00359     plmp[3] = p4[3];
00360     HepSymMatrix Vplm(3, 0);
00361     wtrk.setPlmp(plmp);
00362     wtrk.setVplm(Vplm);
00363     wtrk.setType(1);
00364     setWTrackOrigin(wtrk);
00365     setWTrackInfit(wtrk); 
00366     setWTrackList(number);
00367     setMapkinematic(3);
00368     setMappositionA(m_numberone);
00369     setMappositionB(m_numbertwo);
00370     m_numberone = m_numberone + 1;
00371     m_numbertwo = m_numbertwo + 3;
00372 }

void TrackPool::AddMissTrack ( const int  number,
const double  mass 
) [inherited]

Definition at line 375 of file TrackPool.cxx.

References TrackPool::m_numberone, TrackPool::m_numbertwo, WTrackParameter::setEw(), TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), WTrackParameter::setMass(), WTrackParameter::setW(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), TrackPool::setWTrackOrigin(), and w.

00375                                                                 {
00376     //
00377     //parameters: mass px py pz, but px,py,pz 's error matrix is set as 10e^6
00378     //
00379     WTrackParameter wtrk;
00380     wtrk.setMass(mass);
00381     HepVector w(7,0);
00382     HepSymMatrix Ew(7,0);
00383     w[0] = 0.2;
00384     w[1] = 0.2;
00385     w[2] = 0.2;
00386     w[3] = sqrt(0.2*0.2*3 + mass*mass);
00387     Ew[0][0] = 1E+6;
00388     Ew[1][1] = 1E+6;
00389     Ew[2][2] = 1E+6;
00390     wtrk.setW(w);
00391     wtrk.setEw(Ew);
00392     setWTrackOrigin(wtrk);
00393     setWTrackInfit(wtrk);
00394     setWTrackList(number);
00395     setMapkinematic(7);
00396     setMappositionA(m_numberone);
00397     setMappositionB(m_numbertwo);
00398     m_numberone = m_numberone + 4;
00399 
00400 }

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.

References TrackPool::AddList(), and AddResonance().

00137                                    {
00138     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12);
00139     AddResonance(number, mres, tlis);
00140 }

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.

References TrackPool::AddList(), and AddResonance().

00130                           {
00131     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11);
00132     AddResonance(number, mres, tlis);
00133 }

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.

References TrackPool::AddList(), and AddResonance().

00122                                                          {
00123     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10);
00124     AddResonance(number, mres, tlis);
00125 }

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.

References TrackPool::AddList(), and AddResonance().

00116                                                 {
00117     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9);
00118     AddResonance(number, mres, tlis);
00119 }

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.

References TrackPool::AddList(), and AddResonance().

00110                                         {
00111     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8);
00112     AddResonance(number, mres, tlis);
00113 }

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.

References TrackPool::AddList(), and AddResonance().

00104                                 {
00105     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7);
00106     AddResonance(number, mres, tlis);
00107 }

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.

References TrackPool::AddList(), and AddResonance().

00098                         {
00099     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6);
00100     AddResonance(number, mres, tlis);
00101 }

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.

References TrackPool::AddList(), and AddResonance().

00092                 {
00093     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5);
00094     AddResonance(number, mres, tlis);
00095 }

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

Definition at line 86 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddResonance().

00086                                                                                              {
00087     std::vector<int> tlis = AddList(n1, n2, n3, n4);
00088     AddResonance(number, mres, tlis);
00089 }

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

Definition at line 81 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddResonance().

00081                                                                                      {
00082     std::vector<int> tlis = AddList(n1, n2, n3);
00083     AddResonance(number, mres, tlis);
00084 }

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

Definition at line 76 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddResonance().

00076                                                                              {
00077     std::vector<int> tlis = AddList(n1, n2);
00078     AddResonance(number, mres, tlis);
00079 }

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

Definition at line 71 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddResonance().

00071                                                                      {
00072     std::vector<int> tlis = AddList(n1);
00073     AddResonance(number, mres, tlis);
00074 }

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

Definition at line 142 of file KalmanKinematicFit.cxx.

References m_kc, and KinematicConstraints::ResonanceConstraints().

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

00142                                                                                   {
00143     KinematicConstraints kc;
00144     HepSymMatrix Vre = HepSymMatrix(1,0);
00145     kc.ResonanceConstraints(mres, tlis, Vre);
00146     m_kc.push_back(kc);
00147     if((unsigned int) number != m_kc.size()-1) 
00148         std::cout << "wrong kinematic constraints index" << std::endl;
00149 }

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

Definition at line 334 of file KalmanKinematicFit.cxx.

References genRecEmupikp::i, m_kc, TrackPool::numberWTrack(), and KinematicConstraints::ThreeMomentumConstraints().

00334                                                                    {
00335     std::vector<int>  tlis;
00336     tlis.clear();
00337     WTrackParameter wtrk;
00338     KinematicConstraints kc;
00339 
00340     for(int i = 0; i < numberWTrack(); i++) {
00341         tlis.push_back(i);
00342     }
00343     kc.ThreeMomentumConstraints(p3, tlis);
00344     m_kc.push_back(kc);
00345     if((unsigned int) number != m_kc.size()-1) 
00346         std::cout << "wrong kinematic constraints index" << std::endl;
00347 }

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.

References TrackPool::AddList(), and AddTotalEnergy().

00305                                    {
00306     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12);
00307     AddTotalEnergy(number, etot, tlis);
00308 }

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.

References TrackPool::AddList(), and AddTotalEnergy().

00298                           {
00299     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11);
00300     AddTotalEnergy(number, etot, tlis);
00301 }

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.

References TrackPool::AddList(), and AddTotalEnergy().

00290                  {
00291     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10);
00292     AddTotalEnergy(number, etot, tlis);
00293 }

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.

References TrackPool::AddList(), and AddTotalEnergy().

00283                                                 {
00284     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9);
00285     AddTotalEnergy(number, etot, tlis);
00286 }

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.

References TrackPool::AddList(), and AddTotalEnergy().

00277                                         {
00278     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8);
00279     AddTotalEnergy(number, etot, tlis);
00280 }

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.

References TrackPool::AddList(), and AddTotalEnergy().

00271                                 {
00272     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7);
00273     AddTotalEnergy(number, etot, tlis);
00274 }

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.

References TrackPool::AddList(), and AddTotalEnergy().

00265                         {
00266     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6);
00267     AddTotalEnergy(number, etot, tlis);
00268 }

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.

References TrackPool::AddList(), and AddTotalEnergy().

00259                 {
00260     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5);
00261     AddTotalEnergy(number, etot, tlis);
00262 }

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

Definition at line 253 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddTotalEnergy().

00253                                                                                                {
00254     std::vector<int> tlis = AddList(n1, n2, n3, n4);
00255     AddTotalEnergy(number, etot, tlis);
00256 }

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

Definition at line 248 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddTotalEnergy().

00248                                                                                        {
00249     std::vector<int> tlis = AddList(n1, n2, n3);
00250     AddTotalEnergy(number, etot, tlis);
00251 }

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

Definition at line 243 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddTotalEnergy().

00243                                                                                {
00244     std::vector<int> tlis = AddList(n1, n2);
00245     AddTotalEnergy(number, etot, tlis);
00246 }

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

Definition at line 239 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddTotalEnergy().

00239                                                                        {
00240     std::vector<int> tlis = AddList(n1);
00241     AddTotalEnergy(number, etot, tlis);
00242 }

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

Definition at line 310 of file KalmanKinematicFit.cxx.

References m_kc, and KinematicConstraints::TotalEnergyConstraints().

Referenced by AddTotalEnergy().

00310                                                                                     {
00311     KinematicConstraints kc;
00312     kc.TotalEnergyConstraints(etot, tlis);
00313     m_kc.push_back(kc);
00314     if((unsigned int) number != m_kc.size()-1) 
00315         std::cout << "wrong kinematic constraints index" << std::endl;
00316 }

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.

References TrackPool::AddList(), and AddTotalMomentum().

00222                                    {
00223     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12);
00224     AddTotalMomentum(number, ptot, tlis);
00225 }

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.

References TrackPool::AddList(), and AddTotalMomentum().

00215                           {
00216     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11);
00217     AddTotalMomentum(number, ptot, tlis);
00218 }

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.

References TrackPool::AddList(), and AddTotalMomentum().

00207                  {
00208     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10);
00209     AddTotalMomentum(number, ptot, tlis);
00210 }

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.

References TrackPool::AddList(), and AddTotalMomentum().

00200                                                 {
00201     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8, n9);
00202     AddTotalMomentum(number, ptot, tlis);
00203 }

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.

References TrackPool::AddList(), and AddTotalMomentum().

00194                                         {
00195     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7, n8);
00196     AddTotalMomentum(number, ptot, tlis);
00197 }

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.

References TrackPool::AddList(), and AddTotalMomentum().

00188                                 {
00189     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6, n7);
00190     AddTotalMomentum(number, ptot, tlis);
00191 }

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.

References TrackPool::AddList(), and AddTotalMomentum().

00182                         {
00183     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5, n6);
00184     AddTotalMomentum(number, ptot, tlis);
00185 }

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.

References TrackPool::AddList(), and AddTotalMomentum().

00176                 {
00177     std::vector<int> tlis = AddList(n1, n2, n3, n4, n5);
00178     AddTotalMomentum(number, ptot, tlis);
00179 }

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

Definition at line 170 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddTotalMomentum().

00170                                                                                                  {
00171     std::vector<int> tlis = AddList(n1, n2, n3, n4);
00172     AddTotalMomentum(number, ptot, tlis);
00173 }

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

Definition at line 165 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddTotalMomentum().

00165                                                                                          {
00166     std::vector<int> tlis = AddList(n1, n2, n3);
00167     AddTotalMomentum(number, ptot, tlis);
00168 }

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

Definition at line 160 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddTotalMomentum().

00160                                                                                  {
00161     std::vector<int> tlis = AddList(n1, n2);
00162     AddTotalMomentum(number, ptot, tlis);
00163 }

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

Definition at line 156 of file KalmanKinematicFit.cxx.

References TrackPool::AddList(), and AddTotalMomentum().

00156                                                                          {
00157     std::vector<int> tlis = AddList(n1);
00158     AddTotalMomentum(number, ptot, tlis);
00159 }

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

Definition at line 227 of file KalmanKinematicFit.cxx.

References m_kc, and KinematicConstraints::TotalMomentumConstraints().

Referenced by AddTotalMomentum().

00227                                                                                       {
00228     KinematicConstraints kc;
00229     kc.TotalMomentumConstraints(ptot, tlis);
00230     m_kc.push_back(kc);
00231     if((unsigned int) number != m_kc.size()-1) 
00232         std::cout << "wrong kinematic constraints index" << std::endl;
00233 }

void TrackPool::AddTrack ( const int  number,
const WTrackParameter  wtrk 
) [inherited]

Definition at line 429 of file TrackPool.cxx.

References TrackPool::m_numberone, TrackPool::m_numbertwo, TrackPool::numberWTrack(), TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), and TrackPool::setWTrackOrigin().

00429                                                                {
00430     setWTrackOrigin(wtrk);
00431     setWTrackInfit(wtrk);
00432     setWTrackList(number);
00433     if(number != numberWTrack()-1) {
00434         std::cout << "TrackPool: wrong track index" <<" " 
00435             <<number<<" , " <<numberWTrack()<< std::endl;
00436     }
00437     setMapkinematic(0);
00438     setMappositionA(m_numberone); 
00439     setMappositionB(m_numbertwo);
00440     m_numberone = m_numberone + 4;
00441 }

void TrackPool::AddTrack ( const int  number,
const double  mass,
const RecEmcShower trk 
) [inherited]

Definition at line 44 of file TrackPool.cxx.

References EvtCyclic3::B, cos(), DstEmcShower::dE(), DstEmcShower::dphi(), DstEmcShower::dtheta(), DstEmcShower::energy(), WTrackParameter::Ew(), TrackPool::m_BeamPosition, TrackPool::m_numberone, TrackPool::m_numbertwo, TrackPool::m_VBeamPosition, TrackPool::numberWTrack(), DstEmcShower::phi(), WTrackParameter::setEw(), TrackPool::setGammaShape(), TrackPool::setGammaShapeList(), TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), WTrackParameter::setPlmp(), WTrackParameter::setVplm(), WTrackParameter::setW(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), TrackPool::setWTrackOrigin(), sin(), DstEmcShower::theta(), DstEmcShower::x(), x, DstEmcShower::y(), and DstEmcShower::z().

00045                                  {
00046     //
00047     //parameters: phi lambda mass energy
00048     //  
00049     double ptrk = trk->energy();
00050     double e = sqrt(ptrk*ptrk + mass * mass);
00051     double the = trk->theta();
00052     double phi = trk->phi();
00053     HepLorentzVector p4(ptrk * sin(the) * cos(phi), 
00054             ptrk * sin(the) * sin(phi),
00055             ptrk * cos(the),
00056             e);
00057     double dphi = trk->dphi();
00058     double dthe = trk->dtheta();
00059     double de   = trk->dE();
00060     double x = trk->x();
00061     double y = trk->y();
00062     double z = trk->z();
00063     HepPoint3D x3 (x, y ,z);
00064     WTrackParameter wtrk(x3, p4 ,dphi ,dthe, de);
00065     HepSymMatrix Vpl = HepSymMatrix(2,0);
00066     //=== get Vclus===
00067     HepSymMatrix Vclus = HepSymMatrix (3,0);
00068     Vclus = (wtrk.Ew()).sub(5,7);
00069     double xpr = x - m_BeamPosition[0];
00070     double ypr = y - m_BeamPosition[1];
00071     double zpr = z - m_BeamPosition[2];
00072     double Rpr = sqrt(xpr*xpr + ypr*ypr);
00073     // === get jacobi ===   
00074     HepMatrix J(2,3,0);
00075     J[0][0] = -ypr/(Rpr*Rpr);
00076     J[0][1] = xpr/(Rpr*Rpr);
00077     J[1][0] = -xpr * zpr/(Rpr*Rpr*Rpr);
00078     J[1][1] = -ypr * zpr/(Rpr*Rpr*Rpr);
00079     J[1][2] = 1/Rpr;
00080     Vpl = Vclus.similarity(J) + m_VBeamPosition.similarity(J);
00081     Vpl[0][1]=0;
00082     // === get phipre, lambda===
00083 
00084     double phipre = atan(ypr/xpr);
00085 
00086     if(xpr<0){
00087         phipre = atan(ypr/xpr) + 3.1415926;
00088     }
00089     double lambdapre = zpr/Rpr;
00090 
00091 
00092     // === set p4 ===
00093     double p0x = ptrk*cos(phipre)/sqrt(1 + lambdapre*lambdapre);
00094     double p0y = ptrk*sin(phipre)/sqrt(1 + lambdapre*lambdapre);
00095     double p0z = ptrk*lambdapre/sqrt(1 + lambdapre*lambdapre);
00096     double p0e = e;
00097 
00098 
00099     double p0ver = sqrt(p0x*p0x + p0y*p0y);
00100 
00101 
00102     HepMatrix B(4,3,0);
00103     B[0][0] = -p0y;
00104     B[0][1] = -p0z * p0x * p0ver/(p0e * p0e);
00105     B[0][2] = p0x/p0e;
00106     B[1][0] = p0x;
00107     B[1][1] = -p0z * p0y * p0ver/(p0e * p0e);
00108     B[1][2] = p0y/p0e;
00109     B[2][1] = p0ver * p0ver * p0ver/(p0e * p0e);
00110     B[2][2] = p0z/p0e;
00111     B[3][2] = 1;
00112 
00113     HepSymMatrix Vple(3,0);
00114     Vple[0][0] = Vpl[0][0];
00115     Vple[1][1] = Vpl[1][1];
00116     Vple[2][2] = de * de;
00117 
00118     HepSymMatrix Vpxyze(4,0);
00119     Vpxyze = Vple.similarity(B);
00120 
00121     wtrk.setW(0,p0x);
00122     wtrk.setW(1,p0y);
00123     wtrk.setW(2,p0z);
00124     wtrk.setW(3,p0e);
00125 
00126     wtrk.setEw(Vpxyze);
00127 
00128     HepSymMatrix Vplme(4,0);
00129     Vplme[0][0] = Vpl[0][0];
00130     Vplme[1][1] = Vpl[1][1];
00131     Vplme[3][3] = de * de;
00132     wtrk.setVplm(Vplme); 
00133 
00134     HepVector plmp(4 , 0);
00135     plmp[0] = phipre;
00136     plmp[1] = lambdapre;
00137     plmp[2] = mass;
00138     plmp[3] = e;
00139     wtrk.setPlmp(plmp);
00140 
00141 
00142     setWTrackOrigin(wtrk);
00143     setWTrackInfit(wtrk);
00144     setWTrackList(number);
00145     if(number != numberWTrack()-1) {
00146         std::cout << "TrackPool: wrong track index" <<" " 
00147             <<number<<" , " <<numberWTrack()<< std::endl;
00148     }
00149     GammaShape gtrk(p4,dphi,dthe,de);
00150     setGammaShape(gtrk);
00151     setGammaShapeList(number);
00152     setMapkinematic(1);
00153     setMappositionA(m_numberone);
00154     setMappositionB(m_numbertwo);
00155     m_numberone = m_numberone + 4;
00156 }

void TrackPool::AddTrack ( const int  number,
const double  mass,
const RecMdcKalTrack trk 
) [inherited]

void TrackPool::AddTrack ( const int  number,
const double  mass,
const RecMdcTrack trk 
) [inherited]

Definition at line 22 of file TrackPool.cxx.

References DstMdcTrack::err(), ers::error, DstMdcTrack::helix(), genRecEmupikp::i, TrackPool::m_numberone, TrackPool::m_numbertwo, TrackPool::numberWTrack(), TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), and TrackPool::setWTrackOrigin().

Referenced by DQAKsInfo::calculate(), LambdaReconstruction::execute(), KShortReconstruction::execute(), PrimaryVertex::execute(), Pi0EtaToGGRecAlg::execute(), BeamParams::execute(), CalibEventSelect::execute(), JsiLL::execute(), DQARhopi::execute(), DQAKsKpi::execute(), incllambda::execute(), inclks::execute(), Rhopi::execute(), Ppjrhopi::execute(), Gam4pikp::execute(), Pipipi0::MTotal(), Pipi::MTotal(), Kpipi0pi0::MTotal(), Kpipi0::MTotal(), Kpi::MTotal(), Kkpipi::MTotal(), Kkpi0::MTotal(), Kk::MTotal(), K3pipi0::MTotal(), K3pi::MTotal(), K0pipipi0::MTotal(), K0pipi::MTotal(), K0pi0::MTotal(), K0kpi::MTotal(), K0kk::MTotal(), LocalKsSelector::operator()(), Pi0::Pi0ListToTDS(), utility::SecondaryVFit(), and utility::vfit().

00023                                 {
00024     HepVector helix(5,0);
00025     double error[15];
00026     for(int i = 0; i < 5; i++)
00027         helix[i] = trk->helix(i);
00028     for(int i = 0; i < 15; i++)
00029         error[i] = trk->err(i);
00030     WTrackParameter wtrk(mass, helix, error);
00031     setWTrackOrigin(wtrk);
00032     setWTrackInfit(wtrk);
00033     setWTrackList(number);
00034     if(number != numberWTrack()-1) {
00035         std::cout << "TrackPool: wrong track index" <<" " 
00036             <<number<<" , " <<numberWTrack()<< std::endl;
00037     }
00038     setMapkinematic(0);
00039     setMappositionA(m_numberone);
00040     setMappositionB(m_numbertwo);
00041     m_numberone = m_numberone + 4;
00042 }

void TrackPool::AddTrackVertex ( const int  number,
const double  mass,
const RecEmcShower trk 
) [inherited]

Definition at line 444 of file TrackPool.cxx.

References cos(), DstEmcShower::dE(), DstEmcShower::dphi(), DstEmcShower::dtheta(), DstEmcShower::energy(), TrackPool::m_numberone, TrackPool::m_numbertwo, TrackPool::numberWTrack(), DstEmcShower::phi(), TrackPool::setGammaShape(), TrackPool::setGammaShapeList(), TrackPool::setMapkinematic(), TrackPool::setMappositionA(), TrackPool::setMappositionB(), TrackPool::setWTrackInfit(), TrackPool::setWTrackList(), TrackPool::setWTrackOrigin(), sin(), DstEmcShower::theta(), DstEmcShower::x(), x, DstEmcShower::y(), and DstEmcShower::z().

00444                                                                                            {
00445     double ptrk = trk->energy();
00446     double e = sqrt(ptrk*ptrk + mass * mass);
00447     double the = trk->theta();
00448     double phi = trk->phi();
00449     HepLorentzVector p4(ptrk * sin(the) * cos(phi), 
00450             ptrk * sin(the) * sin(phi),
00451             ptrk * cos(the),
00452             e);
00453     double dphi = trk->dphi();
00454     double dthe = trk->dtheta();
00455     double de   = trk->dE();
00456     double x = trk->x();
00457     double y = trk->y();
00458     double z = trk->z();
00459     HepPoint3D x3 (x, y ,z);
00460     WTrackParameter wtrk(x3, p4 ,dphi ,dthe, de);
00461     setWTrackOrigin(wtrk);
00462     setWTrackInfit(wtrk);
00463     setWTrackList(number);
00464     if(number != numberWTrack()-1) {
00465         std::cout << "TrackPool: wrong track index" <<" " 
00466             <<number<<" , " <<numberWTrack()<< std::endl;
00467     }
00468     GammaShape gtrk(p4,dphi,dthe,de);
00469     setGammaShape(gtrk);
00470     setGammaShapeList(number);
00471     setMapkinematic(6);
00472     m_numbertwo = 0;
00473     setMappositionA(m_numberone);
00474     setMappositionB(m_numbertwo);
00475 
00476     m_numberone = m_numberone + 4;
00477     m_numbertwo = m_numbertwo + 3;
00478 }

void KalmanKinematicFit::BuildVirtualParticle ( int  number  ) 

Definition at line 943 of file KalmanKinematicFit.cxx.

References I, genRecEmupikp::i, KinematicConstraints::Ltrk(), m_C, m_kc, m_virtual_wtrk, TrackPool::numberone(), pInfit(), WTrackParameter::setCharge(), WTrackParameter::setEw(), WTrackParameter::setMass(), WTrackParameter::setW(), delete_small_size::size, upCovmtx(), w, and TrackPool::wTrackInfit().

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

00943                                                     {
00944     upCovmtx();
00945     KinematicConstraints kc = m_kc[n];
00946     int ntrk = (kc.Ltrk()).size();
00947     int charge = 0;
00948     HepVector w(7, 0);
00949     HepSymMatrix ew1(7, 0);
00950     HepSymMatrix ew2(7, 0);
00951     HepVector w4(4, 0);              
00952     HepSymMatrix ew4(4, 0); 
00953     HepMatrix dwdp(4, 4, 0);
00954     dwdp[0][0] = 1;
00955     dwdp[1][1] = 1;
00956     dwdp[2][2] = 1;
00957     dwdp[3][3] = 1;
00958     for (int i = 0; i < ntrk; i++) {
00959         int itk = (kc.Ltrk())[i];
00960         charge += wTrackInfit(itk).charge();
00961         w4 = w4 + dwdp * pInfit(itk);
00962         //                              ew = ew + (getCInfit(itk)).similarity(dwdp);
00963     }
00964     HepMatrix I(4, numberone(), 0);
00965     for(int j2=0; j2<ntrk; j2++){
00966         I[0][0+j2*4] = 1;
00967         I[1][1+j2*4] = 1;
00968         I[2][2+j2*4] = 1;
00969         I[3][3+j2*4] = 1;
00970     } 
00971     ew4 = m_C.similarity(I);
00972     HepMatrix J(7,4,0);
00973     double px = w4[0];
00974     double py = w4[1];
00975     double pz = w4[2];
00976     double e = w4[3];
00977     double pt = sqrt(px*px + py*py);
00978     double p0 = sqrt(px*px + py*py + pz*pz);
00979     double m =  sqrt(e*e - p0*p0);
00980     J[0][0] = -py;
00981     J[0][1] = -(pz*px*pt)/(p0*p0);
00982     J[0][2] = -m*px/(p0*p0);
00983     J[0][3] = e*px/(p0*p0);
00984     J[1][0] = px;
00985     J[1][1] = -(pz*py*pt)/(p0*p0);
00986     J[1][2] = -m*py/(p0*p0);
00987     J[1][3] = e*py/(p0*p0);
00988     J[2][0] = 0;
00989     J[2][1] = pt*pt*pt/(p0*p0);
00990     J[2][2] = -m*pz/(p0*p0);
00991     J[2][3] = e*pz/(p0*p0);
00992     J[3][0] = 0;
00993     J[3][1] = 0;
00994     J[3][2] = 0;
00995     J[3][3] = 1;
00996     ew1 = ew4.similarity(J);
00997     ew2[0][0] = ew1[0][0];
00998     ew2[1][1] = ew1[1][1];
00999     ew2[2][2] = ew1[2][2];
01000     ew2[3][3] = ew1[3][3];
01001     w[0] = w4[0];
01002     w[1] = w4[1];
01003     w[2] = w4[2];
01004     w[3] = w4[3];
01005     WTrackParameter vwtrk;
01006     vwtrk.setCharge(charge);
01007     vwtrk.setW(w);
01008     vwtrk.setEw(ew2);
01009     vwtrk.setMass(m);
01010     m_virtual_wtrk.push_back(vwtrk);
01011 }

double KalmanKinematicFit::chisq ( int  n  )  const [inline]

Definition at line 151 of file KalmanKinematicFit.h.

References m_chisq.

00151 {return m_chisq[n];}

double KalmanKinematicFit::chisq (  )  const [inline]

Definition at line 150 of file KalmanKinematicFit.h.

References m_chi.

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

00150 {return m_chi;}

void KalmanKinematicFit::clearDDT (  )  [private]

void TrackPool::clearGammaShape (  )  [inline, inherited]

Definition at line 139 of file TrackPool.h.

References TrackPool::m_gammashape.

Referenced by VertexFit::init(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00139 {m_gammashape.clear();}

void TrackPool::clearGammaShapeList (  )  [inline, inherited]

Definition at line 140 of file TrackPool.h.

References TrackPool::m_lgammashape.

Referenced by VertexFit::init(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00140 {m_lgammashape.clear();}

void TrackPool::clearMapkinematic (  )  [inline, inherited]

Definition at line 124 of file TrackPool.h.

References TrackPool::m_mapkinematic.

Referenced by VertexFit::init(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00124 {m_mapkinematic.clear();}

void TrackPool::clearMappositionA (  )  [inline, inherited]

Definition at line 125 of file TrackPool.h.

References TrackPool::m_mappositionA.

Referenced by VertexFit::init(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00125 {m_mappositionA.clear();}

void TrackPool::clearMappositionB (  )  [inline, inherited]

Definition at line 126 of file TrackPool.h.

References TrackPool::m_mappositionB.

Referenced by VertexFit::init(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00126 {m_mappositionB.clear();}

void TrackPool::clearone (  )  [inline, inherited]

Definition at line 115 of file TrackPool.h.

References TrackPool::m_numberone.

Referenced by VertexFit::init(), KinematicFit::init(), and init().

00115 {m_numberone = 0;}

void TrackPool::cleartwo (  )  [inline, inherited]

Definition at line 116 of file TrackPool.h.

References TrackPool::m_numbertwo.

Referenced by VertexFit::init(), KinematicFit::init(), and init().

00116 {m_numbertwo = 0;}

void TrackPool::clearWTrackInfit (  )  [inline, inherited]

Definition at line 112 of file TrackPool.h.

References TrackPool::m_wtrk_infit.

Referenced by VertexFit::init(), SecondVertexFit::init(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00112 {m_wtrk_infit.clear();}

void TrackPool::clearWTrackList (  )  [inline, inherited]

Definition at line 113 of file TrackPool.h.

References TrackPool::m_lwtrk.

Referenced by VertexFit::init(), SecondVertexFit::init(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00113 {m_lwtrk.clear();}

void TrackPool::clearWTrackOrigin (  )  [inline, inherited]

Definition at line 111 of file TrackPool.h.

References TrackPool::m_wtrk_origin.

Referenced by VertexFit::init(), SecondVertexFit::init(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00111 {m_wtrk_origin.clear();}

double KalmanKinematicFit::collideangle (  )  const [inline]

Definition at line 167 of file KalmanKinematicFit.h.

References m_collideangle.

Referenced by setCollideangle().

00167 {return m_collideangle;} 

void KalmanKinematicFit::covMatrix ( int  n  )  [private]

HepVector KalmanKinematicFit::cpu (  )  const [inline]

Definition at line 170 of file KalmanKinematicFit.h.

References m_cpu.

00170 {return m_cpu;}

bool KalmanKinematicFit::dynamicerror (  )  const [inline]

Definition at line 168 of file KalmanKinematicFit.h.

References m_dynamicerror.

Referenced by setDynamicerror().

00168 {return m_dynamicerror;}

double KalmanKinematicFit::espread (  )  const [inline]

Definition at line 166 of file KalmanKinematicFit.h.

References m_espread.

Referenced by setEspread().

00166 {return m_espread;}

void KalmanKinematicFit::fit ( int  n  )  [private]

Definition at line 466 of file KalmanKinematicFit.cxx.

References EvtCyclic3::AC, gda(), genRecEmupikp::i, m_A, m_AT, m_B, m_BT, m_C0, m_chisq, m_D, m_D0inv, m_Dinv, m_dynamicerror, m_G, m_kc, m_KP, m_KQ, m_nc, m_p, m_p0, m_q, m_q0, m_Vm, m_W, TrackPool::numberone(), TrackPool::numbertwo(), and TrackPool::numberWTrack().

00466                                   {
00467     if(m_chisq.size() == 0) {
00468         for(unsigned int i = 0; i < m_kc.size(); i++)
00469             m_chisq.push_back(9999.0);
00470     }
00471 
00472     KinematicConstraints kc;
00473     int nc = m_nc;
00474     int ntrk = numberWTrack();
00475 
00476     //cout<<" =====calculate AC_{0}A^{T}====="<<endl;
00477     HepSymMatrix AC(m_nc, 0);
00478     AC = m_C0.similarity(m_A);
00479 
00480     //cout<<" =====calculate W====="<<endl;
00481     int ifail;
00482     m_W = HepSymMatrix(m_nc, 0);
00483     m_W = (m_Vm + m_C0.similarity(m_A)).inverse(ifail);
00484     //cout<<" =====calculate D , D^{-1}====="<<endl;
00485     int ifailD;
00486     m_Dinv =  m_D0inv + m_W.similarity(m_B.T());   
00487     m_D = m_Dinv.inverse(ifailD);
00488 
00489     //cout<<"===== G equals r ====="<<endl;
00490     HepVector G(m_nc, 0);
00491     G = m_A * (m_p0 - m_p) + m_B * (m_q0 - m_q)+ m_G;
00492     //cout<<"===== calculate KQ, Kp======"<<endl;
00493     m_KQ = HepMatrix(numbertwo(), m_nc, 0);
00494     m_KQ = m_D * m_BT * m_W;
00495 
00496     m_KP = HepMatrix(numberone(), m_nc, 0);
00497     m_KP = m_C0 * m_AT * m_W - m_C0 * m_AT * m_W * m_B * m_KQ;
00498     // ===== update track par =====
00499     m_p = m_p0 - m_KP * G;
00500     m_q = m_q0 - m_KQ * G;
00501 
00502     //===== caluculate chi2 =====
00503     m_chisq[n] = (m_W.similarity(G.T()) - m_Dinv.similarity((m_q - m_q0).T()))[0][0];
00504     if(m_dynamicerror ==1) 
00505         gda(); 
00506 }

void KalmanKinematicFit::fit (  )  [private]

Definition at line 393 of file KalmanKinematicFit.cxx.

References EvtCyclic3::AC, gda(), m_A, m_AT, m_B, m_BT, m_C0, m_chi, m_cpu, m_D, m_D0inv, m_Dinv, m_dynamicerror, m_G, m_KP, m_KQ, m_nc, m_p, m_p0, m_q, m_q0, m_Vm, m_W, TrackPool::numberone(), TrackPool::numbertwo(), TrackPool::numberWTrack(), and timer.

Referenced by Fit().

00393                              {
00394 
00395 
00396     KinematicConstraints kc;
00397     int nc = m_nc;
00398     int ntrk = numberWTrack();
00399 
00400     TStopwatch timer;
00401 
00402 
00403 
00404     timer.Start();
00405     //cout<<" =====calculate AC_{0}A^{T}====="<<endl;
00406     HepSymMatrix AC(m_nc, 0);
00407     AC = m_C0.similarity(m_A);
00408     timer.Stop();
00409     m_cpu[1] += timer.CpuTime();
00410 
00411     timer.Start();
00412     //cout<<" =====calculate W====="<<endl;
00413     int ifail;
00414     m_W = HepSymMatrix(m_nc, 0);
00415     m_W = (m_Vm + m_C0.similarity(m_A)).inverse(ifail);
00416     //cout<<" =====calculate D , D^{-1}====="<<endl;
00417     int ifailD;
00418     m_Dinv =  m_D0inv + m_W.similarity(m_B.T());   
00419     m_D = m_Dinv.inverse(ifailD);
00420     timer.Stop();
00421     m_cpu[2] += timer.CpuTime();
00422 
00423     timer.Start();
00424     //cout<<"===== G equals r ====="<<endl;
00425     HepVector G(m_nc, 0);
00426     G = m_A * (m_p0 - m_p) + m_B * (m_q0 - m_q)+ m_G;
00427     //cout<<"===== calculate KQ, Kp======"<<endl;
00428     m_KQ = HepMatrix(numbertwo(), m_nc, 0);
00429     m_KQ = m_D * m_BT * m_W;
00430 
00431     m_KP = HepMatrix(numberone(), m_nc, 0);
00432     m_KP = m_C0 * m_AT * m_W - m_C0 * m_AT * m_W * m_B * m_KQ;
00433     // ===== update track par =====
00434     m_p = m_p0 - m_KP * G;
00435     m_q = m_q0 - m_KQ * G;
00436     timer.Stop();
00437     m_cpu[4] += timer.CpuTime();
00438 
00439     timer.Start();   
00440     //===== caluculate chi2 ===== 
00441     m_chi = (m_W.similarity(G.T()) - m_Dinv.similarity((m_q - m_q0).T()))[0][0];
00442     timer.Stop();
00443     m_cpu[3] += timer.CpuTime();
00444     timer.Start();
00445     if(m_dynamicerror ==1) 
00446         gda(); 
00447 
00448     timer.Stop();
00449     m_cpu[6] += timer.CpuTime();
00450 
00451 }

bool KalmanKinematicFit::Fit ( int  n  ) 

Definition at line 767 of file KalmanKinematicFit.cxx.

References chisq(), fit(), TrackPool::getBeamPosition(), TrackPool::getVBeamPosition(), genRecEmupikp::i, ganga-rec::j, m_A, m_AT, m_B, m_BT, m_C, m_C0, m_chicut, m_chisq, m_chiter, m_D, m_D0inv, m_G, m_kc, m_nc, m_niter, m_nktrk, m_p, m_p0, m_q, m_q0, m_Vm, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), KinematicConstraints::nc(), NTRKPAR, num1, TrackPool::numberone(), TrackPool::numbertwo(), TrackPool::numberWTrack(), setCOrigin(), setDOriginInv(), setPInfit(), setPOrigin(), setQInfit(), setQOrigin(), TrackPool::setWTrackInfit(), updateConstraints(), KinematicConstraints::Vmeasure(), w, and TrackPool::wTrackOrigin().

00767                                   {
00768     bool okfit = false;
00769     if(n < 0 || (unsigned int)n >= m_kc.size()) return okfit;
00770     m_nktrk = numberWTrack();
00771     m_p0 = HepVector(numberone(), 0);
00772     m_p  = HepVector(numberone(), 0);
00773     m_q0 = HepVector(numbertwo(), 0);
00774     m_q  = HepVector(numbertwo(), 0);
00775     m_C0 = HepSymMatrix(numberone(), 0);
00776     m_C  = HepSymMatrix(numberone(), 0);
00777     m_D0inv = HepSymMatrix(numbertwo(), 0);
00778     m_D  = HepSymMatrix(numbertwo(), 0);
00779 
00780     for(int i = 0; i < numberWTrack(); i++) {
00781         setWTrackInfit(i, wTrackOrigin(i));
00782         int pa = mappositionA()[i] + 1;
00783         int pb = mappositionB()[i] + 1;
00784         int ptype = mapkinematic()[i];
00785         switch(ptype) {
00786             case 0 : {
00787                          HepVector w1(4, 0);
00788                          HepSymMatrix Ew1(4, 0);
00789                          for(int j = 0; j < 3; j++) {
00790                              w1[j] = wTrackOrigin(i).w()[j];
00791                          }
00792                          w1[3] = wTrackOrigin(i).mass();
00793 
00794                          for(int m = 0; m < 3; m++) {
00795                              for(int n = 0; n < 3; n++) {
00796                                  Ew1[m][n] = wTrackOrigin(i).Ew()[m][n];
00797                              }
00798                          }
00799                          setPOrigin(pa, w1);
00800                          setPInfit(pa, w1);
00801                          setCOrigin(pa, Ew1);
00802                          break;
00803                      }
00804             case 1 : {
00805                          setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 4));
00806                          setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 4));
00807                          setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 4));
00808                          break;
00809                      }
00810             case 2 : {
00811                          setQOrigin(pb, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
00812                          setQInfit(pb, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
00813                          HepSymMatrix Dinv(4,0);
00814                          setDOriginInv(pb, Dinv);
00815                          break;
00816                      }
00817             case 3 : {
00818                          setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(3, 3));
00819                          setPInfit(pa, (wTrackOrigin(i).plmp()).sub(3, 3));
00820                          setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(3, 3));
00821                          setQOrigin(pb, (wTrackOrigin(i).w()).sub(1, 3));
00822                          setQInfit(pb, (wTrackOrigin(i).w()).sub(1, 3));
00823                          HepSymMatrix Dinv(3,0);
00824                          setDOriginInv(pb, Dinv);
00825                          break;
00826                      }
00827             case 4 : {
00828                          setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
00829                          setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
00830                          setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 2));
00831                          setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
00832                          setQInfit(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
00833                          HepSymMatrix Dinv(2,0);
00834                          setDOriginInv(pb, Dinv);
00835                          break;
00836                      }
00837             case 5 : {
00838                          setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
00839                          setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
00840                          setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 3));
00841                          setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
00842                          setQInfit(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
00843                          HepSymMatrix Dinv(1,0);
00844                          setDOriginInv(pb, Dinv);
00845                          break;
00846                      }
00847             case 6 : {
00848                          setPOrigin(pa, (wTrackOrigin(i).w()).sub(5, 7));
00849                          setPOrigin(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
00850                          setPInfit(pa, (wTrackOrigin(i).w()).sub(5, 7));
00851                          setPInfit(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
00852                          setCOrigin(pa, (wTrackOrigin(i).Ew()).sub(5,7));
00853                          setCOrigin(pa+3, (wTrackOrigin(i).Ew()).sub(4,4));
00854                          HepVector beam(3,0);
00855                          beam[0] = getBeamPosition().x();
00856                          beam[1] = getBeamPosition().y();
00857                          beam[2] = getBeamPosition().z();
00858                          setQOrigin(pb, beam);
00859                          setQInfit(pb, beam);
00860                          HepSymMatrix Dinv(3, 0);
00861                          int ifail;
00862                          Dinv = getVBeamPosition().inverse(ifail);
00863 
00864                          setDOriginInv(pb, Dinv);
00865                          break;
00866                      }
00867 
00868             case 7 : {
00869                          HepVector w1(4, 0);
00870                          HepSymMatrix Ew1(4, 0);
00871                          for(int j = 0; j < 3; j++) {
00872                              w1[j] = wTrackOrigin(i).w()[j];
00873                          }
00874                          w1[3] = wTrackOrigin(i).mass();
00875 
00876                          for(int m = 0; m < 3; m++) {
00877                              for(int n = 0; n < 3; n++) {
00878                                  Ew1[m][n] = wTrackOrigin(i).Ew()[m][n];
00879                              }
00880                          }
00881                          setPOrigin(pa, w1);
00882                          setPInfit(pa, w1);
00883                          setCOrigin(pa, Ew1);
00884                          break;
00885                      }
00886         }
00887     }
00888 
00889 
00890 
00891     //
00892     // iteration
00893     //
00894 
00895     std::vector<double> chisq;
00896     chisq.clear();
00897     int nc = 0;
00898     //  for(int i = 0; i < m_kc.size(); i++)
00899     nc += m_kc[n].nc();
00900 
00901     m_A = HepMatrix(nc, numberone(), 0);
00902     m_AT = HepMatrix(numberone(), nc, 0);
00903     m_B = HepMatrix(nc, numbertwo(), 0);
00904     m_BT = HepMatrix(numbertwo(), nc, 0);
00905     m_G = HepVector(nc, 0);
00906     m_Vm = HepSymMatrix(nc, 0);
00907     int num1 = 0; 
00908     KinematicConstraints kc = m_kc[n];
00909     m_Vm.sub(num1+1,kc.Vmeasure());
00910     num1 =  kc.nc();
00911     for(int it = 0; it < m_niter; it++) {
00912         m_nc = 0;
00913         KinematicConstraints kc = m_kc[n];
00914         updateConstraints(kc);
00915         fit(n);
00916 
00917         chisq.push_back(m_chisq[n]);
00918 
00919         if(it > 0) {
00920 
00921             double delchi = chisq[it]- chisq[it-1];
00922             if(fabs(delchi) < m_chiter) 
00923                 break;
00924         }
00925     }
00926     if(m_chisq[n] >= m_chicut) {
00927         return okfit;
00928     }
00929     //update track parameter and its covariance matrix
00930     //upCovmtx();
00931 
00932     okfit = true;
00933 
00934 
00935     return okfit;
00936 
00937 }

bool KalmanKinematicFit::Fit (  ) 

Definition at line 515 of file KalmanKinematicFit.cxx.

References chisq(), fit(), TrackPool::getBeamPosition(), TrackPool::getVBeamPosition(), genRecEmupikp::i, ganga-rec::j, m_A, m_AT, m_B, m_BT, m_C, m_C0, m_chi, m_chicut, m_chiter, m_cpu, m_D, m_D0inv, m_G, m_kc, m_nc, m_niter, m_nktrk, m_p, m_p0, m_q, m_q0, m_Vm, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), NTRKPAR, num1, TrackPool::numberone(), TrackPool::numbertwo(), TrackPool::numberWTrack(), setCOrigin(), setDOriginInv(), setPInfit(), setPOrigin(), setQInfit(), setQOrigin(), TrackPool::setWTrackInfit(), timer, updateConstraints(), w, and TrackPool::wTrackOrigin().

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

00515                              {
00516     bool okfit = false;
00517     TStopwatch timer;
00518     m_nktrk = numberWTrack();
00519     m_p0 = HepVector(numberone(), 0);
00520     m_p  = HepVector(numberone(), 0);
00521     m_q0 = HepVector(numbertwo(), 0);
00522     m_q  = HepVector(numbertwo(), 0);
00523     m_C0 = HepSymMatrix(numberone(), 0);
00524     m_C  = HepSymMatrix(numberone(), 0);
00525     m_D0inv = HepSymMatrix(numbertwo(), 0);
00526     m_D  = HepSymMatrix(numbertwo(), 0);
00527 
00528     HepVector  m_p_tmp = HepVector(numberone(), 0);
00529     HepVector  m_q_tmp = HepVector(numbertwo(), 0);
00530     HepMatrix  m_A_tmp;
00531     HepSymMatrix m_W_tmp;
00532     HepMatrix  m_KQ_tmp;
00533     HepSymMatrix m_Dinv_tmp;
00534     for(int i = 0; i < numberWTrack(); i++) {
00535         setWTrackInfit(i, wTrackOrigin(i));
00536         int pa = mappositionA()[i] + 1;
00537         int pb = mappositionB()[i] + 1;
00538         int ptype = mapkinematic()[i];
00539         switch(ptype) {
00540             case 0 : {
00541                          HepVector w1(4, 0);
00542                          HepSymMatrix Ew1(4, 0);
00543                          for(int j = 0; j < 3; j++) {
00544                              w1[j] = wTrackOrigin(i).w()[j];
00545                          }
00546                          w1[3] = wTrackOrigin(i).mass();
00547 
00548                          for(int m = 0; m < 3; m++) {
00549                              for(int n = 0; n < 3; n++) {
00550                                  Ew1[m][n] = wTrackOrigin(i).Ew()[m][n];
00551                              }
00552                          }
00553                          setPOrigin(pa, w1);
00554                          setPInfit(pa, w1);
00555                          setCOrigin(pa, Ew1);
00556                          break;
00557                      }
00558             case 1 : {
00559                          setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 4));
00560                          setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 4));
00561                          setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 4));
00562                          break;
00563                      }
00564             case 2 : {
00565                          setQOrigin(pb, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
00566                          setQInfit(pb, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
00567                          HepSymMatrix Dinv(4,0);
00568                          setDOriginInv(pb, Dinv);
00569                          break;
00570                      }
00571             case 3 : {
00572                          setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(3, 3));
00573                          setPInfit(pa, (wTrackOrigin(i).plmp()).sub(3, 3));
00574                          setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(3, 3));
00575                          setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(1, 2));
00576                          setQInfit(pb, (wTrackOrigin(i).plmp()).sub(1, 2));
00577                          setQOrigin(pb+2, (wTrackOrigin(i).plmp()).sub(4, 4));
00578                          setQInfit(pb+2, (wTrackOrigin(i).plmp()).sub(4, 4));
00579                          HepSymMatrix Dinv(3,0);
00580                          setDOriginInv(pb, Dinv);
00581                          break;
00582                      }
00583             case 4 : {
00584                          setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
00585                          setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
00586                          setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 2));
00587                          setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
00588                          setQInfit(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
00589                          HepSymMatrix Dinv(2,0);
00590                          setDOriginInv(pb, Dinv);
00591                          break;
00592                      }
00593             case 5 : {
00594                          setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
00595                          setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
00596                          setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 3));
00597                          setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
00598                          setQInfit(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
00599                          HepSymMatrix Dinv(1,0);
00600                          setDOriginInv(pb, Dinv);
00601                          break;
00602                      }
00603             case 6 : {
00604                          setPOrigin(pa, (wTrackOrigin(i).w()).sub(5, 7));
00605                          setPOrigin(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
00606                          setPInfit(pa, (wTrackOrigin(i).w()).sub(5, 7));
00607                          setPInfit(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
00608                          setCOrigin(pa, (wTrackOrigin(i).Ew()).sub(5,7));
00609                          setCOrigin(pa+3, (wTrackOrigin(i).Ew()).sub(4,4));
00610                          HepVector beam(3,0);
00611                          beam[0] = getBeamPosition().x();
00612                          beam[1] = getBeamPosition().y();
00613                          beam[2] = getBeamPosition().z();
00614                          setQOrigin(pb, beam);
00615                          setQInfit(pb, beam);
00616                          HepSymMatrix Dinv(3, 0);
00617                          int ifail;
00618                          Dinv = getVBeamPosition().inverse(ifail);
00619                          setDOriginInv(pb, Dinv);
00620                          break;
00621                      }
00622             case 7 : {
00623                          HepVector w1(4, 0);
00624                          HepSymMatrix Ew1(4, 0);
00625                          for(int j = 0; j < 3; j++) {
00626                              w1[j] = wTrackOrigin(i).w()[j];
00627                          }
00628                          w1[3] = wTrackOrigin(i).mass();
00629 
00630                          for(int m = 0; m < 3; m++) {
00631                              for(int n = 0; n < 3; n++) {
00632                                  Ew1[m][n] = wTrackOrigin(i).Ew()[m][n];
00633                              }
00634                          }
00635                          setPOrigin(pa, w1);
00636                          setPInfit(pa, w1);
00637                          setCOrigin(pa, Ew1);
00638                          break;
00639                      }
00640 
00641         }
00642     }
00643 
00644 
00645     //
00646     // iteration
00647     //
00648 
00649     std::vector<double> chisq;
00650     chisq.clear();
00651     int nc = 0;
00652     for(int i = 0; i < m_kc.size(); i++)
00653         nc += m_kc[i].nc();
00654 
00655     m_A = HepMatrix(nc, numberone(), 0);
00656     m_AT = HepMatrix(numberone(), nc, 0);
00657     m_B = HepMatrix(nc, numbertwo(), 0);
00658     m_BT = HepMatrix(numbertwo(), nc, 0);
00659     m_G = HepVector(nc, 0);
00660     m_Vm = HepSymMatrix(nc, 0);
00661     int num1 = 0; 
00662     for(unsigned int i = 0; i < m_kc.size(); i++) {
00663         KinematicConstraints kc = m_kc[i];
00664         m_Vm.sub(num1+1,kc.Vmeasure());
00665         num1 = num1 + kc.nc();
00666     }
00667 
00668     double tmp_chisq = 999;
00669     bool flag_break = 0;
00670     for(int it = 0; it < m_niter; it++) {
00671         timer.Start();
00672         m_nc = 0;
00673         for(unsigned int i = 0; i < m_kc.size(); i++) {
00674             KinematicConstraints kc = m_kc[i];
00675             updateConstraints(kc);
00676         }
00677         timer.Stop();
00678         m_cpu[0] += timer.CpuTime();
00679         fit();
00680         //              
00681         //reset origin parameters for virtual particle
00682         //
00683         //                if(it == 0){
00684         //                    for(int i = 0; i < numberWTrack(); i++) {
00685         //                      //  setWTrackInfit(i, wTrackOrigin(i));
00686         //                        int pa = mappositionA()[i] + 1;
00687         //                        int pb = mappositionB()[i] + 1;
00688         //                        int ptype = mapkinematic()[i];
00689         //                        switch(ptype) {
00690         //                           case 3 : {
00691         //                                         setPOrigin(pa, m_p.sub(pa, pa));
00692         //                                         setPInfit(pa,  m_p.sub(pa, pa));
00693         //                                         setQOrigin(pb, m_q.sub(pb, pb+2));
00694         //                                         setQInfit(pb,  m_q.sub(pb, pb+2));
00695         //                                         break;
00696         //                                    }
00697         //                           case 4 : {
00698         //                                        setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
00699         //                                        setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 2));
00700         //                                        setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 2));
00701         //                                        setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
00702         //                                        setQInfit(pb, (wTrackOrigin(i).plmp()).sub(3, 4));
00703         //                                        HepSymMatrix Dinv(2,0);
00704         //                                        setDOriginInv(pb, Dinv);
00705         //                                        break;
00706         //                                    }
00707         //                           case 5 : {
00708         //                                        setPOrigin(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
00709         //                                        setPInfit(pa, (wTrackOrigin(i).plmp()).sub(1, 3));
00710         //                                        setCOrigin(pa, (wTrackOrigin(i).Vplm()).sub(1, 3));
00711         //                                        setQOrigin(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
00712         //                                        setQInfit(pb, (wTrackOrigin(i).plmp()).sub(4, 4));
00713         //                                        HepSymMatrix Dinv(1,0);
00714         //                                        setDOriginInv(pb, Dinv);
00715         //                                        break;
00716         //                                    }
00717         //                           case 6 : {
00718         //                                        setPOrigin(pa, (wTrackOrigin(i).w()).sub(5, 7));
00719         //                                        setPOrigin(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
00720         //                                        setPInfit(pa, (wTrackOrigin(i).w()).sub(5, 7));
00721         //                                        setPInfit(pa+3, (wTrackOrigin(i).w()).sub(4, 4));
00722         //                                        setCOrigin(pa, (wTrackOrigin(i).Ew()).sub(5,7));
00723         //                                        setCOrigin(pa+3, (wTrackOrigin(i).Ew()).sub(4,4));
00724         //                                        HepVector beam(3,0);
00725         //                                        beam[0] = getBeamPosition().x();
00726         //                                        beam[1] = getBeamPosition().y();
00727         //                                        beam[2] = getBeamPosition().z();
00728         //                                        setQOrigin(pb, beam);
00729         //                                        setQInfit(pb, beam);
00730         //                                        HepSymMatrix Dinv(3, 0);
00731         //                                        int ifail;
00732         //                                        Dinv = getVBeamPosition().inverse(ifail);
00733         //                                        setDOriginInv(pb, Dinv);
00734         //                                        break;
00735         //                                    }
00736         //
00737         //                        }
00738         //                    }
00739         //
00740         //                }
00741         //
00742         //
00743         //===================reset over=============================
00744         //
00745         chisq.push_back(m_chi);
00746         if(it > 0) {
00747             double delchi = chisq[it]- chisq[it-1];  
00748             if(fabs(delchi) < m_chiter){
00749                 flag_break =1; 
00750                 break;
00751             }
00752         }
00753     }
00754     if(!flag_break) {
00755         return okfit;
00756     }
00757     if(m_chi > m_chicut) return okfit;
00758     timer.Start();
00759     timer.Stop();
00760     m_cpu[5] += timer.CpuTime();
00761     okfit = true;
00762     return okfit;
00763 
00764 }

int TrackPool::GammaShapeList ( int  n  )  const [inline, inherited]

Definition at line 98 of file TrackPool.h.

References TrackPool::m_lgammashape.

00098 {return m_lgammashape[n];}

std::vector<int> TrackPool::GammaShapeList (  )  const [inline, inherited]

Definition at line 96 of file TrackPool.h.

References TrackPool::m_lgammashape.

Referenced by KinematicFit::gda(), and gda().

00096 {return m_lgammashape;}

GammaShape TrackPool::GammaShapeValue ( int  n  )  const [inline, inherited]

Definition at line 97 of file TrackPool.h.

References TrackPool::m_gammashape.

00097 {return m_gammashape[n];}

std::vector<GammaShape> TrackPool::GammaShapeValue (  )  const [inline, inherited]

Definition at line 95 of file TrackPool.h.

References TrackPool::m_gammashape.

Referenced by KinematicFit::gda(), and gda().

00095 {return m_gammashape;}

void KalmanKinematicFit::gda (  )  [private]

Definition at line 1015 of file KalmanKinematicFit.cxx.

References TrackPool::GammaShapeList(), TrackPool::GammaShapeValue(), genRecEmupikp::i, ganga-rec::j, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), NTRKPAR, TrackPool::numberGammaShape(), TrackPool::numberWTrack(), p4Infit(), p4Origin(), pOrigin(), setCOrigin(), type, and TrackPool::wTrackOrigin().

Referenced by fit().

01015                             {
01016     //        TGraph2D *g = new TGraph2D("/ihepbatch/bes/yanl/6.5.0//TestRelease/TestRelease-00-00-62/run/gamma/new/graph.dat");
01017     for(int i = 0; i < numberWTrack(); i++) {
01018         if ((wTrackOrigin(i)).type() == 2 ){
01019             int n ;
01020             for(int j = 0; j < numberGammaShape(); j++) {
01021                 if(i==GammaShapeList(j))  n = j;
01022             }
01023             int pa = mappositionA()[i] + 1;
01024             int pb = mappositionB()[i] + 1;
01025             int ptype = mapkinematic()[i];
01026             HepSymMatrix Ew(NTRKPAR, 0);
01027             HepLorentzVector p1 = p4Infit(i);
01028             HepLorentzVector p2 = p4Origin(i);
01029             double eorigin = pOrigin(i)[3];
01030             HepMatrix dwda1(NTRKPAR, 3, 0);
01031             dwda1[0][0] = 1;
01032             dwda1[1][1] = - (p2.e()*p2.e())/(p2.px()*p2.px() + p2.py()*p2.py());
01033             //            dwda1[1][1] = - (p1.e()*p1.e())/(p1.px()*p1.px() + p1.py()*p1.py());
01034             dwda1[3][2] = 1;
01035             HepSymMatrix emcmea1(3, 0);
01036             double pk = p1[3];
01037             //                                          double pk = GammaShapeValue(n).peak(p1[3]);
01038             emcmea1[0][0] = GammaShapeValue(n).getdphi() * GammaShapeValue(n).getdphi();
01039             emcmea1[1][1] = GammaShapeValue(n).getdthe() * GammaShapeValue(n).getdthe()*(1/(1 - p2.cosTheta()*p2.cosTheta())) *(1/(1 - p2.cosTheta()*p2.cosTheta()));
01040             //            cout<<"delta lambda ="<<emcmea1[1][1]<<endl;
01041             emcmea1[2][2] = GammaShapeValue(n).de(eorigin,pk)*GammaShapeValue(n).de(eorigin,pk);
01042             //                        double tmp_e22 = m_graph2d->Interpolate(eorigin, pk);
01043             //                        if(fabs((eorigin/pk)-1)<0.05&&tmp_e22==0)emcmea1[2][2] = 0.025*pk*0.025;
01044             //                        else  emcmea1[2][2] = (tmp_e22*tmp_e22);
01045             //                        emcmea1[2][2] = m_graph2d->Interpolate(eorigin, pk)*m_graph2d->Interpolate(eorigin, pk);
01046             //                                          emcmea1[2][2] = GammaShapeValue(n).de(eorigin,pk) * GammaShapeValue(n).de(eorigin,pk);
01047             //         cout<<"dy_e  ="<<GammaShapeValue(n).de(eorigin,pk)<<endl;
01048             //        Ew = emcmea1.similarity(dwda1);
01049             Ew[0][0] = emcmea1[0][0];
01050             Ew[1][1] = emcmea1[1][1];
01051             Ew[3][3] = emcmea1[2][2];
01052             //            cout<<"Ew ="<<Ew<<endl;
01053             if(ptype==6)
01054                 setCOrigin(pa+3, Ew.sub(4,4));
01055             else setCOrigin(pa,Ew);
01056         } 
01057     }
01058 }

HepPoint3D TrackPool::getBeamPosition (  )  const [inline, inherited]

Definition at line 147 of file TrackPool.h.

References TrackPool::m_BeamPosition.

Referenced by Fit().

00147 {return m_BeamPosition;}

HepSymMatrix KalmanKinematicFit::getCInfit ( int  i  )  const

Definition at line 1415 of file KalmanKinematicFit.cxx.

References m_C, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), and NTRKPAR.

Referenced by pull().

01415                                                       {
01416     int pa = mappositionA()[n] + 1;
01417     int pb = mappositionB()[n] + 1;
01418     int ptype = mapkinematic()[n];
01419     switch(ptype) {
01420         case 0 : {
01421                      return m_C.sub(pa, pa+NTRKPAR-1);
01422                      break;
01423                  }
01424         case 1 : {
01425                      return m_C.sub(pa, pa+NTRKPAR-1);
01426                      break;
01427                  }
01428         case 3 : {
01429                      return m_C.sub(pa, pa);
01430                      break;
01431                  }
01432         case 4 : {
01433                      return m_C.sub(pa, pa+1);
01434                      break;
01435                  }
01436         case 5 : {
01437                      return m_C.sub(pa, pa+2);
01438                      break;
01439                  }
01440         case 7 : {
01441                      return m_C.sub(pa, pa+NTRKPAR-1);
01442                      break;
01443                  }
01444     }
01445 }

HepSymMatrix KalmanKinematicFit::getCOrigin ( int  i  )  const

Definition at line 1381 of file KalmanKinematicFit.cxx.

References m_C0, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), and NTRKPAR.

Referenced by pull().

01381                                                        {
01382     int pa = mappositionA()[n] + 1;
01383     int pb = mappositionB()[n] + 1;
01384     int ptype = mapkinematic()[n];
01385     switch(ptype) {
01386         case 0 : {
01387                      return m_C0.sub(pa, pa+NTRKPAR-1);
01388                      break;
01389                  }
01390         case 1 : {
01391                      return m_C0.sub(pa, pa+NTRKPAR-1);
01392                      break;
01393                  }
01394         case 3 : {
01395                      return m_C0.sub(pa, pa);
01396                      break;
01397                  }
01398         case 4 : {
01399                      return m_C0.sub(pa, pa+1);
01400                      break;
01401                  }
01402         case 5 : {
01403                      return m_C0.sub(pa, pa+2);
01404                      break;
01405                  }
01406         case 7 : {
01407                      return m_C0.sub(pa, pa+NTRKPAR-1);
01408                      break;
01409                  }
01410 
01411     }
01412 } 

HepSymMatrix TrackPool::getVBeamPosition (  )  const [inline, inherited]

Definition at line 148 of file TrackPool.h.

References TrackPool::m_VBeamPosition.

Referenced by Fit().

00148 {return m_VBeamPosition;}

WTrackParameter KalmanKinematicFit::infit ( int  n  )  const [inline]

Definition at line 161 of file KalmanKinematicFit.h.

References TrackPool::wTrackInfit().

00161 {return wTrackInfit(n);}

void KalmanKinematicFit::init (  ) 

Definition at line 34 of file KalmanKinematicFit.cxx.

References TrackPool::clearGammaShape(), TrackPool::clearGammaShapeList(), TrackPool::clearMapkinematic(), TrackPool::clearMappositionA(), TrackPool::clearMappositionB(), TrackPool::clearone(), TrackPool::cleartwo(), TrackPool::clearWTrackInfit(), TrackPool::clearWTrackList(), TrackPool::clearWTrackOrigin(), m_chi, m_chicut, m_chisq, m_chiter, m_collideangle, m_cpu, m_dynamicerror, m_espread, m_flag, m_graph2d, m_kc, m_nc, m_niter, m_virtual_wtrk, TrackPool::setBeamPosition(), and TrackPool::setVBeamPosition().

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

00034                               {
00035     clearWTrackOrigin();
00036     clearWTrackInfit();
00037     clearWTrackList();
00038     //gamma shape
00039     clearGammaShape();
00040     clearGammaShapeList();  
00041     clearMapkinematic();
00042     clearMappositionA();
00043     clearMappositionB();
00044     clearone();
00045     cleartwo();
00046     setBeamPosition(HepPoint3D(0.0,0.0,0.0));
00047     setVBeamPosition(HepSymMatrix(3,0));
00048     //=============  
00049     m_kc.clear();
00050     m_chisq.clear();
00051     m_chi = 9999.;
00052     m_niter = 10;
00053     m_chicut = 200.;
00054     m_chiter = 0.005;
00055     m_espread = 0.0;
00056     m_collideangle = 11e-3;
00057     m_flag = 0;
00058     m_dynamicerror = 0; 
00059     m_nc = 0;
00060     m_cpu = HepVector(10, 0);
00061     m_virtual_wtrk.clear(); 
00062     m_graph2d = 0;
00063     //  m_graph2d = TGraph2D("/ihepbatch/bes/yanl/6.5.0//TestRelease/TestRelease-00-00-62/run/gamma/new/graph.dat"); 
00064 }

KalmanKinematicFit * KalmanKinematicFit::instance (  )  [static]

Definition at line 20 of file KalmanKinematicFit.cxx.

References KalmanKinematicFit(), and m_pointer.

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

00020                                                   {
00021     if(m_pointer) return m_pointer;
00022     m_pointer = new KalmanKinematicFit();
00023     return m_pointer;
00024 }

vector<int> TrackPool::mapkinematic (  )  const [inline, inherited]

Definition at line 122 of file TrackPool.h.

References TrackPool::m_mapkinematic.

Referenced by Fit(), gda(), getCInfit(), getCOrigin(), pInfit(), pOrigin(), pull(), and updateConstraints().

00122 {return m_mapkinematic;}

vector<int> TrackPool::mappositionA (  )  const [inline, inherited]

Definition at line 120 of file TrackPool.h.

References TrackPool::m_mappositionA.

Referenced by Fit(), gda(), getCInfit(), getCOrigin(), pInfit(), pOrigin(), pull(), and updateConstraints().

00120 {return m_mappositionA;}

vector<int> TrackPool::mappositionB (  )  const [inline, inherited]

Definition at line 121 of file TrackPool.h.

References TrackPool::m_mappositionB.

Referenced by Fit(), gda(), getCInfit(), getCOrigin(), pInfit(), pOrigin(), pull(), and updateConstraints().

00121 {return m_mappositionB;}

int TrackPool::numberGammaShape (  )  const [inline, inherited]

Definition at line 99 of file TrackPool.h.

References TrackPool::m_lgammashape.

Referenced by KinematicFit::gda(), and gda().

00099 { return ((int)(m_lgammashape.size()) );} 

int TrackPool::numberone (  )  const [inline, inherited]

Definition at line 117 of file TrackPool.h.

References TrackPool::m_numberone.

Referenced by BuildVirtualParticle(), Fit(), fit(), and upCovmtx().

00117 {return m_numberone;}

int TrackPool::numbertwo (  )  const [inline, inherited]

Definition at line 118 of file TrackPool.h.

References TrackPool::m_numbertwo.

Referenced by Fit(), fit(), and upCovmtx().

00118 {return m_numbertwo;}

int TrackPool::numberWTrack (  )  const [inline, inherited]

Definition at line 79 of file TrackPool.h.

References TrackPool::m_lwtrk.

Referenced by KinematicFit::AddFourMomentum(), AddFourMomentum(), KinematicFit::AddThreeMomentum(), AddThreeMomentum(), TrackPool::AddTrack(), TrackPool::AddTrackVertex(), VertexFit::Fit(), KinematicFit::Fit(), KinematicFit::fit(), Fit(), fit(), KinematicFit::gda(), gda(), and KinematicFit::upCovmtx().

00079 { return ((int)(m_lwtrk.size()));}

WTrackParameter KalmanKinematicFit::origin ( int  n  )  const [inline]

Definition at line 160 of file KalmanKinematicFit.h.

References TrackPool::wTrackOrigin().

00160 {return wTrackOrigin(n);}

HepLorentzVector KalmanKinematicFit::p4Infit ( int  i  )  const [inline, private]

Definition at line 222 of file KalmanKinematicFit.h.

References pInfit().

Referenced by gda(), pfit(), pull(), and updateConstraints().

00222 { HepVector p(4, 0); p = pInfit(i); return HepLorentzVector(p[0], p[1], p[2], p[3]); }

HepLorentzVector KalmanKinematicFit::p4Origin ( int  i  )  const [inline, private]

Definition at line 220 of file KalmanKinematicFit.h.

References pOrigin().

Referenced by gda(), pfit1(), and pull().

00220 { HepVector p(4, 0); p = pOrigin(i); return HepLorentzVector(p[0], p[1], p[2], p[3]);}

HepLorentzVector KalmanKinematicFit::pfit ( int  n  )  const [inline]

Definition at line 154 of file KalmanKinematicFit.h.

References p4Infit().

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

00154 {return p4Infit(n);}

HepLorentzVector KalmanKinematicFit::pfit1 ( int  n  )  [inline]

Definition at line 157 of file KalmanKinematicFit.h.

References p4Origin().

00157 {return p4Origin(n);}

HepVector KalmanKinematicFit::pInfit ( int  i  )  const [private]

Definition at line 1178 of file KalmanKinematicFit.cxx.

References cos(), lambda, m_p, m_q, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), mass, rb::R(), sin(), and x.

Referenced by BuildVirtualParticle(), p4Infit(), and pull().

01178                                                 {
01179     int pa = mappositionA()[n] + 1;
01180     int pb = mappositionB()[n] + 1;
01181     int ptype = mapkinematic()[n];
01182     switch(ptype) {
01183         case 0 : {  
01184                      double mass = m_p.sub(pa+3, pa+3)[0];
01185                      HepVector p4(4,0);
01186                      p4[0] = m_p.sub(pa,pa)[0];
01187                      p4[1] = m_p.sub(pa+1, pa+1)[0];
01188                      p4[2] = m_p.sub(pa+2, pa+2)[0];
01189                      p4[3] = sqrt(p4[0]*p4[0] + p4[1]*p4[1] + p4[2]*p4[2] + mass * mass);
01190                      return p4;
01191                      break;
01192                  }
01193         case 1 : {
01194                      double phi = m_p.sub(pa, pa)[0];
01195                      double lambda = m_p.sub(pa+1, pa+1)[0];
01196                      double mass = m_p.sub(pa+2, pa+2)[0];
01197                      double E = m_p.sub(pa+3, pa+3)[0];
01198                      double p0 = sqrt(E*E - mass*mass);
01199                      HepVector p4(4,0);
01200                      p4[0] = p0*cos(phi)/sqrt(1 + lambda*lambda);
01201                      p4[1] = p0*sin(phi)/sqrt(1 + lambda*lambda);
01202                      p4[2] = p0*lambda/sqrt(1 + lambda*lambda);
01203                      p4[3] = sqrt(p0*p0 + mass*mass);
01204                      return p4;
01205                      break;
01206                  }      
01207         case 2 : {
01208                      return m_q.sub(pb, pb+3);
01209                      break;
01210                  }
01211         case 3 : {
01212                      double mass = (m_p.sub(pa, pa))[0];        
01213                      double phi = m_q.sub(pb, pb)[0];
01214                      double lambda = m_q.sub(pb+1, pb+1)[0];
01215                      double E = m_q.sub(pb+2, pb+2)[0];
01216                      double p0 = sqrt(E*E - mass*mass);
01217                      HepVector p4(4,0);
01218                      p4[0] = p0*cos(phi)/sqrt(1 + lambda*lambda);
01219                      p4[1] = p0*sin(phi)/sqrt(1 + lambda*lambda);
01220                      p4[2] = p0*lambda/sqrt(1 + lambda*lambda);
01221                      p4[3] = sqrt(p0*p0 + mass*mass);
01222                      return p4;
01223                      break;
01224                  }      
01225         case 4 : {
01226                      double phi = m_p.sub(pa, pa)[0];
01227                      double lambda = m_p.sub(pa+1, pa+1)[0];
01228                      double mass = m_q.sub(pb, pb)[0];
01229                      double E = m_q.sub(pb+1, pb+1)[0];
01230                      double p0 = sqrt(E*E - mass*mass);
01231                      HepVector p4(4,0);
01232                      p4[0] = p0*cos(phi)/sqrt(1 + lambda*lambda);
01233                      p4[1] = p0*sin(phi)/sqrt(1 + lambda*lambda);
01234                      p4[2] = p0*lambda/sqrt(1 + lambda*lambda);
01235                      p4[3] = sqrt(p0*p0 + mass*mass);
01236                      return p4; 
01237                      break;
01238                  }
01239         case 5 : {
01240                      double phi = m_p.sub(pa, pa)[0];
01241                      double lambda = m_p.sub(pa+1, pa+1)[0];
01242                      double mass = m_p.sub(pa+2, pa+2)[0];
01243                      double p0 = m_q.sub(pb, pb)[0];
01244                      HepVector p4(4,0);
01245                      p4[0] = p0*cos(phi)/sqrt(1 + lambda*lambda);
01246                      p4[1] = p0*sin(phi)/sqrt(1 + lambda*lambda);
01247                      p4[2] = p0*lambda/sqrt(1 + lambda*lambda);
01248                      p4[3] = sqrt(p0*p0 + mass*mass);
01249                      return p4;
01250                      break;
01251                  }
01252         case 6 : {
01253                      double x = m_p.sub(pa, pa)[0] - m_q.sub(pb, pb)[0];
01254                      double y = m_p.sub(pa+1, pa+1)[0] - m_q.sub(pb+1, pb+1)[0];
01255                      double z = m_p.sub(pa+2, pa+2)[0] - m_q.sub(pb+2, pb+2)[0];
01256                      double p0 = m_p.sub(pa+3, pa+3)[0];
01257                      double R = sqrt(x*x + y*y + z*z);
01258                      HepVector p4(4,0);
01259                      p4[0] = p0*x/R;
01260                      p4[1] = p0*y/R;
01261                      p4[2] = p0*z/R;
01262                      p4[3] = p0;
01263                      return p4;
01264                      break; 
01265                  }
01266         case 7 : {  
01267                      double mass = m_p.sub(pa+3, pa+3)[0];
01268                      HepVector p4(4,0);
01269                      p4[0] = m_p.sub(pa,pa)[0];
01270                      p4[1] = m_p.sub(pa+1, pa+1)[0];
01271                      p4[2] = m_p.sub(pa+2, pa+2)[0];
01272                      p4[3] = sqrt(p4[0]*p4[0] + p4[1]*p4[1] + p4[2]*p4[2] + mass * mass);
01273                      return p4;
01274                      break;
01275                  }
01276     }
01277 }

HepVector KalmanKinematicFit::pOrigin ( int  i  )  const [private]

Definition at line 1280 of file KalmanKinematicFit.cxx.

References cos(), lambda, m_p0, m_q0, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), mass, rb::R(), sin(), and x.

Referenced by gda(), and p4Origin().

01280                                                  {
01281     int pa = mappositionA()[n] + 1;
01282     int pb = mappositionB()[n] + 1;
01283     int ptype = mapkinematic()[n]; 
01284     switch(ptype) {
01285         case 0 : {
01286                      double mass = m_p0.sub(pa+3, pa+3)[0];
01287                      HepVector p4(4,0);
01288                      p4[0] = m_p0.sub(pa,pa)[0];
01289                      p4[1] = m_p0.sub(pa+1, pa+1)[0];
01290                      p4[2] = m_p0.sub(pa+2, pa+2)[0];
01291                      p4[3] = sqrt(p4[0]*p4[0] + p4[1]*p4[1] + p4[2]*p4[2] + mass * mass);
01292                      return p4;
01293                      break;
01294                  }
01295         case 1 : {
01296                      double phi = m_p0.sub(pa, pa)[0];
01297                      double lambda = m_p0.sub(pa+1, pa+1)[0];
01298                      double mass = m_p0.sub(pa+2, pa+2)[0];
01299                      double E = m_p0.sub(pa+3, pa+3)[0];
01300                      double p0 = sqrt(E*E - mass*mass);
01301                      HepVector p4(4,0);
01302                      p4[0] = p0*cos(phi)/sqrt(1 + lambda*lambda);
01303                      p4[1] = p0*sin(phi)/sqrt(1 + lambda*lambda);
01304                      p4[2] = p0*lambda/sqrt(1 + lambda*lambda);
01305                      p4[3] = sqrt(p0*p0 + mass*mass);
01306                      return p4;
01307                      break;
01308                  }      
01309         case 2 : {
01310                      return m_q0.sub(pb, pb+3);
01311                      break;
01312                  }
01313         case 3 : {
01314                      double mass = (m_p0.sub(pa, pa))[0];       
01315                      double phi = m_q0.sub(pb, pb)[0];
01316                      double lambda = m_q0.sub(pb+1, pb+1)[0];
01317                      double E = m_q0.sub(pb+2, pb+2)[0];
01318                      double p0 = sqrt(E*E - mass*mass);
01319                      HepVector p4(4,0);
01320                      p4[0] = p0*cos(phi)/sqrt(1 + lambda*lambda);
01321                      p4[1] = p0*sin(phi)/sqrt(1 + lambda*lambda);
01322                      p4[2] = p0*lambda/sqrt(1 + lambda*lambda);
01323                      p4[3] = sqrt(p0*p0 + mass*mass);
01324                      return p4;
01325                      break;
01326                  }      
01327         case 4 : {
01328                      double phi = m_p0.sub(pa, pa)[0];
01329                      double lambda = m_p0.sub(pa+1, pa+1)[0];
01330                      double mass = m_q0.sub(pb, pb)[0];
01331                      double E = m_q0.sub(pb+1, pb+1)[0];
01332                      double p0 = sqrt(E*E - mass*mass);
01333                      HepVector p4(4,0);
01334                      p4[0] = p0*cos(phi)/sqrt(1 + lambda*lambda);
01335                      p4[1] = p0*sin(phi)/sqrt(1 + lambda*lambda);
01336                      p4[2] = p0*lambda/sqrt(1 + lambda*lambda);
01337                      p4[3] = sqrt(p0*p0 + mass*mass);
01338                      return p4; 
01339                      break;
01340                  }
01341         case 5 : {
01342                      double phi = m_p0.sub(pa, pa)[0];
01343                      double lambda = m_p0.sub(pa+1, pa+1)[0];
01344                      double mass = m_p0.sub(pa+2, pa+2)[0];
01345                      double p0 = m_q0.sub(pb, pb)[0];
01346                      HepVector p4(4,0);
01347                      p4[0] = p0*cos(phi)/sqrt(1 + lambda*lambda);
01348                      p4[1] = p0*sin(phi)/sqrt(1 + lambda*lambda);
01349                      p4[2] = p0*lambda/sqrt(1 + lambda*lambda);
01350                      p4[3] = sqrt(p0*p0 + mass*mass);
01351                      return p4;
01352                      break;
01353                  }
01354         case 6 : {
01355                      double x = m_p0.sub(pa, pa)[0] - m_q0.sub(pb, pb)[0];
01356                      double y = m_p0.sub(pa+1, pa+1)[0] - m_q0.sub(pb+1, pb+1)[0];
01357                      double z = m_p0.sub(pa+2, pa+2)[0] - m_q0.sub(pb+2, pb+2)[0];
01358                      double p0 = m_p0.sub(pa+3, pa+3)[0];
01359                      double R = sqrt(x*x + y*y + z*z);
01360                      HepVector p4(4,0);
01361                      p4[0] = p0*x/R;
01362                      p4[1] = p0*y/R;
01363                      p4[2] = p0*z/R;
01364                      p4[3] = p0;
01365                      return p4;
01366                      break;  
01367                  }
01368         case 7 : {
01369                      double mass = m_p0.sub(pa+3, pa+3)[0];
01370                      HepVector p4(4,0);
01371                      p4[0] = m_p0.sub(pa,pa)[0];
01372                      p4[1] = m_p0.sub(pa+1, pa+1)[0];
01373                      p4[2] = m_p0.sub(pa+2, pa+2)[0];
01374                      p4[3] = sqrt(p4[0]*p4[0] + p4[1]*p4[1] + p4[2]*p4[2] + mass * mass);
01375                      return p4;
01376                      break;
01377                  }
01378     }
01379 }

HepVector KalmanKinematicFit::pull ( int  n  ) 

Definition at line 1061 of file KalmanKinematicFit.cxx.

References a0, abs, HTrackParameter::eHel(), getCInfit(), getCOrigin(), HTrackParameter::hel(), genRecEmupikp::i, ganga-rec::j, m_p, m_p0, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), p4Infit(), p4Origin(), pInfit(), WTrackParameter::setEw(), WTrackParameter::setW(), TrackPool::setWTrackInfit(), upCovmtx(), w, TrackPool::wTrackInfit(), and TrackPool::wTrackOrigin().

01061                                         {
01062     upCovmtx();
01063     int pa = mappositionA()[n] + 1;
01064     int pb = mappositionB()[n] + 1 ;
01065     int ptype = mapkinematic()[n];
01066     switch(ptype) {
01067         case 0 :{
01068                     HepVector W(7,0);
01069                     HepSymMatrix Ew(7,0);
01070                     HepVector W1(7,0);
01071                     HepSymMatrix Ew1(7,0);
01072                     WTrackParameter wtrk = wTrackOrigin(n);
01073                     W = wTrackOrigin(n).w();
01074                     Ew = wTrackOrigin(n).Ew();
01075                     for(int i=0; i<4; i++) {
01076                         W[i] = pInfit(n)[i];
01077                     }
01078                     for(int j=0; j<4; j++) {
01079                         for(int k=0; k<4; k++) {
01080                             Ew[j][k] = getCInfit(n)[j][k];
01081                         }
01082                     }
01083                     W1 = W;
01084                     double px = p4Infit(n).px();
01085                     double py = p4Infit(n).py();
01086                     double pz = p4Infit(n).pz();
01087                     double m =  p4Infit(n).m();
01088                     double e =  p4Infit(n).e();
01089                     HepMatrix J(7, 7, 0);
01090                     J[0][0] = 1;
01091                     J[1][1] = 1;
01092                     J[2][2] = 1;
01093                     J[3][0] = px/e;
01094                     J[3][1] = py/e;
01095                     J[3][2] = pz/e;
01096                     J[3][3] = m/e;
01097                     J[4][4] = 1;
01098                     J[5][5] = 1;
01099                     J[6][6] = 1;
01100                     Ew1 = Ew.similarity(J);
01101 
01102                     wtrk.setW(W1);
01103                     wtrk.setEw(Ew1);
01104                     setWTrackInfit(n, wtrk);
01105 
01106                     HTrackParameter horigin = HTrackParameter(wTrackOrigin(n));
01107                     HTrackParameter hinfit = HTrackParameter(wTrackInfit(n));
01108                     HepVector a0 = horigin.hel();
01109                     HepVector a1 = hinfit.hel();
01110                     HepSymMatrix v0 = horigin.eHel();
01111                     HepSymMatrix v1 = hinfit.eHel(); 
01112                     HepVector pull(9,0);
01113                     for (int k=0; k<5; k++) {
01114                         pull[k] = (a0[k]-a1[k])/sqrt(abs(v0[k][k]-v1[k][k]));
01115                     }
01116                     for (int l=5; l<9; l++) {
01117                         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]));
01118                     }
01119                     return pull;
01120                     break;        
01121                 }
01122         case 1 : {
01123                      HepVector a0(4,0);
01124                      HepVector a1(4,0);
01125                      a0 = m_p0.sub(pa, pa+3);
01126                      a1 = m_p.sub(pa, pa+3);
01127                      HepSymMatrix v1 = getCInfit(n);
01128                      HepSymMatrix v0 = getCOrigin(n);
01129                      HepVector pull(3,0);
01130                      for (int k=0; k<2; k++) {
01131                          pull[k] = (a0[k]-a1[k])/sqrt(v0[k][k]-v1[k][k]);
01132                      }
01133                      pull[2] = (a0[3]-a1[3])/sqrt(v0[3][3]-v1[3][3]);
01134                      return pull;
01135                      break;
01136                  }
01137                  //        case 2 : {
01138                  //        return pull;
01139                  //        break;
01140                  //        }
01141                  //        case 3 : {
01142                  //        return pull;
01143                  //        break;
01144                  //        }
01145                  //        case 4 : {
01146                  //        return pull;
01147                  //        break;
01148                  //        }
01149         case 5 : {
01150                      HepLorentzVector p0 = p4Origin(n);
01151                      HepLorentzVector p1 = p4Infit(n);
01152                      HepVector a0(2,0);
01153                      HepVector a1(2,0);
01154                      a0[0] = p4Origin(n).phi();
01155                      a1[0] = p4Infit(n).phi();
01156                      a0[1] = p4Origin(n).pz()/p4Origin(n).perp();
01157                      a1[1] = p4Infit(n).pz()/p4Infit(n).perp();
01158                      HepMatrix Jacobi(2, 4, 0);
01159                      Jacobi[0][0] = - p4Infit(n).py()/p4Infit(n).perp2();
01160                      Jacobi[0][1] =   p4Infit(n).px()/p4Infit(n).perp2();
01161                      Jacobi[1][0] = - (p4Infit(n).px()/p4Infit(n).perp()) * (p4Infit(n).pz()/p4Infit(n).perp2());
01162                      Jacobi[1][1] = - (p4Infit(n).py()/p4Infit(n).perp()) * (p4Infit(n).pz()/p4Infit(n).perp2());
01163                      Jacobi[1][2] = 1/p4Infit(n).perp();
01164                      HepSymMatrix v1 = getCInfit(n).similarity(Jacobi);
01165                      HepSymMatrix v0 = wTrackOrigin(n).Vplm().sub(1,2);
01166                      HepVector pull(2,0);
01167                      for (int k=0; k<2; k++) {
01168                          pull[k] = (a0[k]-a1[k])/sqrt(v0[k][k]-v1[k][k]);
01169                      }
01170                      return pull;
01171                      break;
01172                  }
01173     }        
01174 }

void KalmanKinematicFit::setA ( int  ic,
int  itk,
const HepMatrix &  p 
) [inline, private]

Definition at line 196 of file KalmanKinematicFit.h.

References m_A.

Referenced by updateConstraints().

00196 {m_A.sub(ic+1, itk, p);}

void KalmanKinematicFit::setAT ( int  itk,
int  ic,
const HepMatrix &  p 
) [inline, private]

Definition at line 198 of file KalmanKinematicFit.h.

References m_AT.

Referenced by updateConstraints().

00198 { m_AT.sub(itk, ic+1, p);}

void KalmanKinematicFit::setB ( int  ic,
int  itk,
const HepMatrix &  p 
) [inline, private]

Definition at line 205 of file KalmanKinematicFit.h.

References m_B.

Referenced by updateConstraints().

00205 {m_B.sub(ic+1, itk, p);}

void TrackPool::setBeamPosition ( const HepPoint3D  BeamPosition  )  [inline, inherited]

Definition at line 143 of file TrackPool.h.

References TrackPool::m_BeamPosition.

Referenced by Gam4pikp::execute(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00143 {m_BeamPosition = BeamPosition;}

void KalmanKinematicFit::setBT ( int  itk,
int  ic,
const HepMatrix &  p 
) [inline, private]

Definition at line 207 of file KalmanKinematicFit.h.

References m_BT.

Referenced by updateConstraints().

00207 { m_BT.sub(itk, ic+1, p);}

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

Definition at line 132 of file KalmanKinematicFit.h.

References m_chicut, and m_chiter.

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

00132 {m_chicut = chicut;m_chiter=chiter;}

void KalmanKinematicFit::setCInfit ( int  i,
const HepSymMatrix &  D 
) [inline, private]

Definition at line 228 of file KalmanKinematicFit.h.

References m_C.

00228 {m_C.sub(i,D);}

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

Definition at line 137 of file KalmanKinematicFit.h.

References collideangle(), and m_collideangle.

void KalmanKinematicFit::setCOrigin ( int  i,
const HepSymMatrix &  D 
) [inline, private]

Definition at line 227 of file KalmanKinematicFit.h.

References m_C0.

Referenced by Fit(), and gda().

00227 {m_C0.sub(i, D);}

void KalmanKinematicFit::setDInfit ( int  i,
const HepSymMatrix &  D 
) [inline, private]

Definition at line 240 of file KalmanKinematicFit.h.

References m_D.

00240 {m_D.sub(i,D);}

void KalmanKinematicFit::setDOrigin ( int  i,
const HepSymMatrix &  D 
) [inline, private]

Definition at line 239 of file KalmanKinematicFit.h.

References m_D0.

00239 {m_D0.sub(i, D);}

void KalmanKinematicFit::setDOriginInv ( int  i,
const HepSymMatrix &  Dinv 
) [inline, private]

Definition at line 241 of file KalmanKinematicFit.h.

References m_D0inv.

Referenced by Fit().

00241 {m_D0inv.sub(i,Dinv);}

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

Definition at line 138 of file KalmanKinematicFit.h.

References dynamicerror(), and m_dynamicerror.

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

Definition at line 136 of file KalmanKinematicFit.h.

References espread(), and m_espread.

00136 {m_espread = espread;}

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

Definition at line 130 of file KalmanKinematicFit.h.

References m_flag.

00130 {m_flag = flag;}

void TrackPool::setGammaShape ( const GammaShape  gammashape  )  [inline, inherited]

Definition at line 136 of file TrackPool.h.

References TrackPool::m_gammashape.

00136 {m_gammashape.push_back(gammashape);}

void TrackPool::setGammaShape ( const int  n,
const GammaShape  gammashape 
) [inline, inherited]

Definition at line 135 of file TrackPool.h.

References TrackPool::m_gammashape.

Referenced by TrackPool::AddMissTrack(), TrackPool::AddTrack(), and TrackPool::AddTrackVertex().

00135 {m_gammashape[n] = gammashape;}

void TrackPool::setGammaShapeList ( const int  n  )  [inline, inherited]

Definition at line 137 of file TrackPool.h.

References TrackPool::m_lgammashape.

Referenced by TrackPool::AddMissTrack(), TrackPool::AddTrack(), and TrackPool::AddTrackVertex().

00137 {m_lgammashape.push_back(n);}

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

Definition at line 131 of file KalmanKinematicFit.h.

References m_niter.

00131 {m_niter = niter;}

void TrackPool::setMapkinematic ( const int  n  )  [inline, inherited]

Definition at line 128 of file TrackPool.h.

References TrackPool::m_mapkinematic.

Referenced by TrackPool::AddMissTrack(), TrackPool::AddTrack(), and TrackPool::AddTrackVertex().

00128 {m_mapkinematic.push_back(n);}

void TrackPool::setMappositionA ( const int  n  )  [inline, inherited]

Definition at line 129 of file TrackPool.h.

References TrackPool::m_mappositionA.

Referenced by TrackPool::AddMissTrack(), TrackPool::AddTrack(), and TrackPool::AddTrackVertex().

00129 {m_mappositionA.push_back(n);}

void TrackPool::setMappositionB ( const int  n  )  [inline, inherited]

Definition at line 130 of file TrackPool.h.

References TrackPool::m_mappositionB.

Referenced by TrackPool::AddMissTrack(), TrackPool::AddTrack(), and TrackPool::AddTrackVertex().

00130 {m_mappositionB.push_back(n);}

void KalmanKinematicFit::setPInfit ( int  i,
const HepVector &  p 
) [inline, private]

Definition at line 226 of file KalmanKinematicFit.h.

References m_p.

Referenced by Fit().

00226 {m_p.sub(i, p);}

void KalmanKinematicFit::setPOrigin ( int  i,
const HepVector &  p 
) [inline, private]

Definition at line 225 of file KalmanKinematicFit.h.

References m_p0.

Referenced by Fit().

00225 { m_p0.sub(i, p);}

void KalmanKinematicFit::setQInfit ( int  i,
const HepVector &  q 
) [inline, private]

Definition at line 238 of file KalmanKinematicFit.h.

References m_q.

Referenced by Fit().

00238 {m_q.sub(i, q);}

void KalmanKinematicFit::setQOrigin ( int  i,
const HepVector &  q 
) [inline, private]

Definition at line 237 of file KalmanKinematicFit.h.

References m_q0.

Referenced by Fit().

00237 { m_q0.sub(i, q);}

void KalmanKinematicFit::setTgraph ( TGraph2D *  graph2d  )  [inline]

Definition at line 139 of file KalmanKinematicFit.h.

References m_graph2d.

00139 {m_graph2d = graph2d;}    

void TrackPool::setVBeamPosition ( const HepSymMatrix  VBeamPosition  )  [inline, inherited]

Definition at line 144 of file TrackPool.h.

References TrackPool::m_VBeamPosition.

Referenced by Gam4pikp::execute(), KinematicFit::init(), init(), and TrackPool::TrackPool().

00144 {m_VBeamPosition = VBeamPosition;} 

void TrackPool::setWTrackInfit ( const WTrackParameter  wtrk  )  [inline, inherited]

Definition at line 108 of file TrackPool.h.

References TrackPool::m_wtrk_infit.

00108 {m_wtrk_infit.push_back(wtrk);}

void TrackPool::setWTrackInfit ( const int  n,
const WTrackParameter  wtrk 
) [inline, inherited]

Definition at line 106 of file TrackPool.h.

References TrackPool::m_wtrk_infit.

Referenced by TrackPool::AddMissTrack(), TrackPool::AddTrack(), TrackPool::AddTrackVertex(), VertexFit::BeamFit(), KinematicFit::covMatrix(), VertexFit::Fit(), KinematicFit::Fit(), Fit(), KinematicFit::pull(), pull(), VertexFit::swimVertex(), and KinematicFit::upCovmtx().

00106 {m_wtrk_infit[n] = wtrk;}

void TrackPool::setWTrackList ( const int  n  )  [inline, inherited]

Definition at line 109 of file TrackPool.h.

References TrackPool::m_lwtrk.

Referenced by TrackPool::AddMissTrack(), TrackPool::AddTrack(), and TrackPool::AddTrackVertex().

00109 {m_lwtrk.push_back(n);}

void TrackPool::setWTrackOrigin ( const WTrackParameter  wtrk  )  [inline, inherited]

Definition at line 107 of file TrackPool.h.

References TrackPool::m_wtrk_origin.

00107 {m_wtrk_origin.push_back(wtrk);}

void TrackPool::setWTrackOrigin ( const int  n,
const WTrackParameter  wtrk 
) [inline, inherited]

Definition at line 105 of file TrackPool.h.

References TrackPool::m_wtrk_origin.

Referenced by TrackPool::AddMissTrack(), TrackPool::AddTrack(), and TrackPool::AddTrackVertex().

00105 {m_wtrk_origin[n] = wtrk;}

void KalmanKinematicFit::upCovmtx (  )  [private]

Definition at line 456 of file KalmanKinematicFit.cxx.

References m_A, m_C, m_C0, m_Dinv, m_KQ, m_W, TrackPool::numberone(), TrackPool::numbertwo(), and T.

Referenced by BuildVirtualParticle(), and pull().

00456                                   {
00457     HepMatrix E(numberone(), numbertwo(), 0);
00458     E = -m_C0 * m_A.T() * m_KQ.T();
00459     m_C = m_C0 - m_W.similarity((m_A*m_C0).T()) + m_Dinv.similarity(E);
00460 }    

void KalmanKinematicFit::updateConstraints ( KinematicConstraints  kc  )  [private]

Definition at line 1450 of file KalmanKinematicFit.cxx.

References dc, EqualMass, KinematicConstraints::etot(), FourMomentum, genRecEmupikp::i, ganga-rec::j, lambda, KinematicConstraints::Ltrk(), m_B, m_G, m_nc, m_p, m_q, TrackPool::mapkinematic(), TrackPool::mappositionA(), TrackPool::mappositionB(), KinematicConstraints::mres(), n1, n2, KinematicConstraints::nc(), NTRKPAR, KinematicConstraints::numEqual(), KinematicConstraints::p3(), KinematicConstraints::p4(), p4Infit(), KinematicConstraints::ptot(), rb::R(), Resonance, setA(), setAT(), setB(), setBT(), delete_small_size::size, ThreeMomentum, TotalEnergy, TotalMomentum, KinematicConstraints::Type(), type, and x.

Referenced by Fit().

01450                                                                   {
01451     KinematicConstraints kc = k;
01452 
01453 
01454     int type = kc.Type();
01455     switch(type) {
01456         case  Resonance: {
01457                              //
01458                              //  E^2 - px^2 - py^2 - pz^2 = mres^2
01459                              //
01460                              double mres = kc.mres();
01461                              HepLorentzVector pmis;
01462                              for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
01463                                  int n = (kc.Ltrk())[j];
01464                                  pmis = pmis + p4Infit(n);
01465                              }
01466                              for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
01467                                  int n = (kc.Ltrk())[j];
01468                                  double lambda = p4Infit(n).pz()/p4Infit(n).perp();
01469                                  double a1 = 1 + lambda*lambda;
01470                                  int pa = mappositionA()[n] + 1;
01471                                  int pb = mappositionB()[n] + 1;
01472                                  int ptype = mapkinematic()[n];
01473                                  switch(ptype) {
01474                                      case 0 :{
01475                                                  HepMatrix ta(1, NTRKPAR, 0);
01476                                                  ta[0][0] = -2 * pmis.px() + 2 * pmis.e() * p4Infit(n).px() / p4Infit(n).e();
01477                                                  ta[0][1] = -2 * pmis.py() + 2 * pmis.e() * p4Infit(n).py() / p4Infit(n).e();
01478                                                  ta[0][2] = -2 * pmis.pz() + 2 * pmis.e() * p4Infit(n).pz() / p4Infit(n).e();
01479                                                  ta[0][3] = 2 * pmis.e() * p4Infit(n).m() / p4Infit(n).e();
01480                                                  setA(m_nc,pa,ta);
01481                                                  setAT(pa, m_nc, ta.T());
01482                                                  break;
01483                                              }
01484                                      case 1 :  {
01485                                                    HepMatrix ta(1, NTRKPAR, 0);
01486                                                    double a1 = lambda * lambda + 1;
01487                                                    ta[0][0] = 2 * pmis.px() * p4Infit(n).py() - 2 * pmis.py() * p4Infit(n).px();
01488                                                    ta[0][1] = 2 * pmis.px() * p4Infit(n).px() * lambda/sqrt(a1) + 2 * pmis.py() * (p4Infit(n)).py() * lambda/sqrt(a1) - 2 * pmis.pz() * (p4Infit(n)).pz() /(sqrt(a1) * lambda);
01489                                                    ta[0][2] =  2 * pmis.px() * (p4Infit(n)).px() * p4Infit(n).m() /((p4Infit(n)).rho() * p4Infit(n).rho()) + 2 * pmis.py() * (p4Infit(n)).py() * p4Infit(n).m()/((p4Infit(n)).rho() * p4Infit(n).rho())+ 2 * pmis.pz() * (p4Infit(n)).pz() * p4Infit(n).m()/((p4Infit(n)).rho() * p4Infit(n).rho());
01490                                                    ta[0][3] = 2 * pmis.e()  - 2 * pmis.px() * (p4Infit(n)).px() * p4Infit(n).e() /((p4Infit(n)).rho() * p4Infit(n).rho())- 2 * pmis.py() * (p4Infit(n)).py() * p4Infit(n).e()/((p4Infit(n)).rho() * p4Infit(n).rho())- 2 * pmis.pz() * (p4Infit(n)).pz() * p4Infit(n).e()/((p4Infit(n)).rho() * p4Infit(n).rho());
01491                                                    setA(m_nc,pa,ta);
01492                                                    setAT(pa, m_nc, ta.T());
01493                                                    break;
01494                                                }
01495                                      case 2 :  {
01496                                                    HepMatrix tb(1, 4, 0);
01497                                                    tb[0][0] = -2 * pmis.px();
01498                                                    tb[0][1] = -2 * pmis.py();
01499                                                    tb[0][2] = -2 * pmis.pz();
01500                                                    tb[0][3] = 2 * pmis.e();
01501                                                    setB(m_nc,pb,tb);
01502                                                    setBT(pb,m_nc,tb.T());
01503                                                    break;
01504                                                }
01505                                      case 3 :  {
01506                                                    HepMatrix ta(1, 1, 0);
01507                                                    double a1 = lambda * lambda + 1;
01508                                                    ta[0][0] =  2 * pmis.px() * (p4Infit(n)).px() * p4Infit(n).m() /((p4Infit(n)).rho() * p4Infit(n).rho()) + 2 * pmis.py() * (p4Infit(n)).py() * p4Infit(n).m()/((p4Infit(n)).rho() * p4Infit(n).rho())+ 2 * pmis.pz() * (p4Infit(n)).pz() * p4Infit(n).m()/((p4Infit(n)).rho() * p4Infit(n).rho());
01509                                                    setA(m_nc,pa,ta);
01510                                                    setAT(pa, m_nc, ta.T());
01511                                                    HepMatrix tb(1, 3, 0);
01512                                                    tb[0][0] = 2 * pmis.px() * p4Infit(n).py() - 2 * pmis.py() * p4Infit(n).px();
01513                                                    tb[0][1] = 2 * pmis.px() * p4Infit(n).px() * lambda/sqrt(a1) + 2 * pmis.py() * (p4Infit(n)).py() * lambda/sqrt(a1) - 2 * pmis.pz() * (p4Infit(n)).pz() /(sqrt(a1) * lambda);
01514                                                    tb[0][2] = 2 * pmis.e()  - 2 * pmis.px() * (p4Infit(n)).px() * p4Infit(n).e() /((p4Infit(n)).rho() * p4Infit(n).rho())- 2 * pmis.py() * (p4Infit(n)).py() * p4Infit(n).e()/((p4Infit(n)).rho() * p4Infit(n).rho())- 2 * pmis.pz() * (p4Infit(n)).pz() * p4Infit(n).e()/((p4Infit(n)).rho() * p4Infit(n).rho());
01515                                                    setB(m_nc,pb,tb);
01516                                                    setBT(pb,m_nc,tb.T());
01517                                                    break;
01518                                                }
01519                                      case 4 :  {
01520                                                    HepMatrix ta(1, 2, 0);
01521                                                    double a1 = lambda * lambda + 1;
01522                                                    ta[0][0] = 2 * pmis.px() * p4Infit(n).py() - 2 * pmis.py() * p4Infit(n).px();
01523                                                    ta[0][1] = 2 * pmis.px() * p4Infit(n).px() * lambda/sqrt(a1) + 2 * pmis.py() * (p4Infit(n)).py() * lambda/sqrt(a1) - 2 * pmis.pz() * (p4Infit(n)).pz() /(sqrt(a1) * lambda);
01524                                                    setA(m_nc,pa,ta);
01525                                                    setAT(pa, m_nc, ta.T());
01526 
01527                                                    HepMatrix tb(1, 2, 0);
01528                                                    tb[0][0] =  2 * pmis.px() * (p4Infit(n)).px() * p4Infit(n).m() /((p4Infit(n)).rho() * p4Infit(n).rho()) + 2 * pmis.py() * (p4Infit(n)).py() * p4Infit(n).m()/((p4Infit(n)).rho() * p4Infit(n).rho())+ 2 * pmis.pz() * (p4Infit(n)).pz() * p4Infit(n).m()/((p4Infit(n)).rho() * p4Infit(n).rho());
01529                                                    tb[0][1] = 2 * pmis.e()  - 2 * pmis.px() * (p4Infit(n)).px() * p4Infit(n).e() /((p4Infit(n)).rho() * p4Infit(n).rho())- 2 * pmis.py() * (p4Infit(n)).py() * p4Infit(n).e()/((p4Infit(n)).rho() * p4Infit(n).rho())- 2 * pmis.pz() * (p4Infit(n)).pz() * p4Infit(n).e()/((p4Infit(n)).rho() * p4Infit(n).rho());
01530                                                    setB(m_nc,pb,tb);
01531                                                    setBT(pb, m_nc, tb.T());
01532                                                    break;
01533                                                }
01534                                      case 5 :  {
01535                                                    HepMatrix ta(1, 3, 0);
01536                                                    ta[0][0] = 2 * pmis.px() * p4Infit(n).py() - 2 * pmis.py() * p4Infit(n).px();
01537                                                    ta[0][1] = 2 * pmis.px() * p4Infit(n).px() * lambda/sqrt(a1)+ 2 * pmis.py() * (p4Infit(n)).py() * lambda/sqrt(a1) - 2 * pmis.pz() * (p4Infit(n)).pz() /(sqrt(a1) * lambda);
01538                                                    ta[0][2] = 2 * pmis.e() * (p4Infit(n)).m()/(p4Infit(n)).e();
01539                                                    setA(m_nc,pa,ta);
01540                                                    setAT(pa, m_nc, ta.T());
01541                                                    HepMatrix tb(1, 1, 0);
01542                                                    tb[0][0] = 2 * pmis.e() * (p4Infit(n)).rho()/(p4Infit(n)).e() - 2 * pmis.px() * (p4Infit(n)).px()/(p4Infit(n)).rho() - 2 * pmis.py() * (p4Infit(n)).py()/(p4Infit(n)).rho() - 2 * pmis.pz() * (p4Infit(n)).pz()/(p4Infit(n)).rho();
01543                                                    setB(m_nc,pb,tb);
01544                                                    setBT(pb, m_nc, tb.T());
01545                                                    break;
01546                                                }       
01547                                      case 7 :{
01548                                                  HepMatrix ta(1, NTRKPAR, 0);
01549                                                  ta[0][0] = -2 * pmis.px() + 2 * pmis.e() * p4Infit(n).px() / p4Infit(n).e();
01550                                                  ta[0][1] = -2 * pmis.py() + 2 * pmis.e() * p4Infit(n).py() / p4Infit(n).e();
01551                                                  ta[0][2] = -2 * pmis.pz() + 2 * pmis.e() * p4Infit(n).pz() / p4Infit(n).e();
01552                                                  ta[0][3] = 2 * pmis.e() * p4Infit(n).m() / p4Infit(n).e();
01553                                                  setA(m_nc,pa,ta);
01554                                                  setAT(pa, m_nc, ta.T());
01555                                                  break;
01556                                              }
01557                                  }   
01558                              }
01559 
01560                              HepVector dc(1, 0);
01561                              dc[0] = pmis.m2() - mres * mres;
01562                              m_G[m_nc] = dc[0];
01563                              m_nc+=1;
01564 
01565                              break;
01566                          }
01567         case TotalEnergy: {
01568                               //
01569                               //  E - Etot = 0
01570                               //
01571                               double etot = kc.etot();
01572                               HepLorentzVector pmis;
01573                               for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++){
01574                                   int n = (kc.Ltrk())[j];
01575                                   pmis = pmis + p4Infit(n);
01576                               }
01577 
01578                               for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
01579                                   int n = (kc.Ltrk())[j];
01580                                   int pa = mappositionA()[n] + 1;
01581                                   int pb = mappositionB()[n] + 1;
01582                                   int ptype = mapkinematic()[n];
01583                                   switch(ptype) {
01584                                       case 0 :{
01585                                                   HepMatrix ta(1, NTRKPAR, 0);
01586                                                   ta[0][0] = p4Infit(n).px()/p4Infit(n).e();
01587                                                   ta[0][1] = p4Infit(n).py()/p4Infit(n).e();
01588                                                   ta[0][2] = p4Infit(n).pz()/p4Infit(n).e();
01589                                                   ta[0][3] = p4Infit(n).m()/p4Infit(n).e();
01590                                                   setA(m_nc,pa,ta);
01591                                                   setAT(pa, m_nc, ta.T());
01592                                                   break;
01593                                               }
01594                                       case 1: {
01595                                                   HepMatrix ta(1, NTRKPAR, 0);
01596                                                   ta[0][3] = 1.0;
01597                                                   setA(m_nc,pa,ta);
01598                                                   setAT(pa, m_nc, ta.T());
01599                                                   break;
01600                                               }
01601                                       case 2: {
01602                                                   HepMatrix tb(1, 4, 0);
01603                                                   tb[0][3] = 1.0;
01604                                                   setA(m_nc,pb,tb);
01605                                                   setAT(pb, m_nc, tb.T());
01606                                                   break;
01607                                               }
01608                                       case 3: {
01609                                                   HepMatrix ta(1, 1, 0);
01610                                                   ta[0][0] = p4Infit(n).m()/p4Infit(n).e();
01611                                                   setA(m_nc,pa,ta);
01612                                                   setAT(pa, m_nc, ta.T());
01613 
01614                                                   HepMatrix tb(1, 3, 0);
01615                                                   setB(m_nc,pb,tb);
01616                                                   setBT(pb, m_nc, tb.T());
01617                                                   break;
01618                                               }
01619                                       case 4: {
01620                                                   HepMatrix ta(1, 2, 0);
01621                                                   setA(m_nc,pa,ta);
01622                                                   setAT(pa, m_nc, ta.T());
01623 
01624                                                   HepMatrix tb(1, 2, 0);
01625                                                   tb[0][0] = 0.0;
01626                                                   tb[0][1] = 1.0;
01627                                                   //   tb[0][0] = p4Infit(n).m()/p4Infit(n).e();
01628                                                   //   tb[0][1] = p4Infit(n).rho()/p4Infit(n).e();
01629                                                   setB(m_nc,pb,tb);
01630                                                   setBT(pb, m_nc, tb.T());
01631                                                   break;
01632                                               }
01633                                       case 5: {
01634                                                   HepMatrix ta(1, 3, 0);
01635                                                   ta[0][2] = p4Infit(n).m()/p4Infit(n).e();
01636                                                   setA(m_nc,pa,ta);
01637                                                   setAT(pa, m_nc, ta.T());
01638 
01639                                                   HepMatrix tb(1, 1, 0);
01640                                                   tb[0][0] = p4Infit(n).rho()/p4Infit(n).e();
01641                                                   setB(m_nc,pb,tb);
01642                                                   setBT(pb, m_nc, tb.T());
01643                                                   break;
01644                                               } 
01645                                       case 7 :{
01646                                                   HepMatrix ta(1, NTRKPAR, 0);
01647                                                   ta[0][0] = p4Infit(n).px()/p4Infit(n).e();
01648                                                   ta[0][1] = p4Infit(n).py()/p4Infit(n).e();
01649                                                   ta[0][2] = p4Infit(n).pz()/p4Infit(n).e();
01650                                                   ta[0][3] = p4Infit(n).m()/p4Infit(n).e();
01651                                                   setA(m_nc,pa,ta);
01652                                                   setAT(pa, m_nc, ta.T());
01653                                                   break;
01654                                               }
01655                                   }     
01656 
01657                               }
01658 
01659                               HepVector dc(1, 0);
01660                               dc[0] = pmis.e() - etot;
01661                               m_G[m_nc] = dc[0];
01662                               m_nc+=1;
01663                               break;
01664                           }
01665         case TotalMomentum: {
01666                                 //
01667                                 //  sqrt(px^2+py^2+pz^2) - ptot = 0
01668                                 //
01669                                 double ptot = kc.ptot();
01670                                 HepLorentzVector pmis;
01671                                 for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
01672                                     int n = (kc.Ltrk())[j];
01673                                     pmis = pmis + p4Infit(n);
01674                                 }
01675 
01676                                 for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
01677                                     int n = (kc.Ltrk())[j];
01678                                     int pa = mappositionA()[n] + 1;
01679                                     int pb = mappositionB()[n] + 1;
01680                                     int ptype = mapkinematic()[n];
01681                                     double lambda = p4Infit(n).pz()/p4Infit(n).perp();
01682                                     switch(ptype) {
01683                                         case 0 : {
01684                                                      HepMatrix ta(1, NTRKPAR, 0);
01685                                                      ta[0][0] = pmis.px()/pmis.rho();
01686                                                      ta[0][1] = pmis.py()/pmis.rho();
01687                                                      ta[0][2] = pmis.pz()/pmis.rho();
01688                                                      setA(m_nc,pa,ta);
01689                                                      setAT(pa, m_nc, ta.T());
01690                                                      break;
01691                                                  }
01692                                         case 1 : {
01693                                                      HepMatrix ta(1, NTRKPAR, 0);
01694                                                      ta[0][0] = - (pmis.px()/pmis.rho()) * p4Infit(n).py() + (pmis.px()/pmis.rho())*p4Infit(n).px();
01695                                                      ta[0][1] = - (pmis.px()/pmis.rho()) * p4Infit(n).px() * (lambda/(1 + lambda*lambda)) - (pmis.py()/pmis.rho()) * p4Infit(n).py() * (lambda/(1 + lambda*lambda)) + (pmis.pz()/pmis.rho()) * p4Infit(n).pz() * (1/(lambda * (1 + lambda*lambda)));
01696                                                      ta[0][2] =  -((pmis.px()/pmis.rho()) * p4Infit(n).m()/(p4Infit(n).rho()*p4Infit(n).rho())) * (p4Infit(n).px() + p4Infit(n).py() +p4Infit(n).pz());
01697                                                      ta[0][3] = ((pmis.px()/pmis.rho()) * p4Infit(n).e()/(p4Infit(n).rho()*p4Infit(n).rho())) * (p4Infit(n).px() + p4Infit(n).py() +
01698                                                              p4Infit(n).pz()); 
01699 
01700                                                      setA(m_nc,pa,ta);
01701                                                      setAT(pa, m_nc, ta.T());
01702                                                      break;
01703                                                  }
01704                                         case 2 : {
01705                                                      HepMatrix tb(1, 4, 0);
01706                                                      tb[0][0] = pmis.px()/pmis.rho();
01707                                                      tb[0][1] = pmis.py()/pmis.rho();
01708                                                      tb[0][2] = pmis.pz()/pmis.rho();
01709                                                      setB(m_nc,pb,tb);
01710                                                      setBT(pb, m_nc, tb.T());
01711                                                      break;
01712                                                  }
01713                                         case 3 : {
01714                                                      HepMatrix ta(1, 1, 0); 
01715                                                      setA(m_nc,pa,ta);
01716                                                      setAT(pa, m_nc, ta.T());
01717                                                      HepMatrix tb(1, 3, 0);
01718                                                      tb[0][0] = pmis.px()/pmis.rho();
01719                                                      tb[0][1] = pmis.py()/pmis.rho();
01720                                                      tb[0][2] = pmis.pz()/pmis.rho();
01721                                                      setB(m_nc,pb,tb);
01722                                                      setBT(pb, m_nc, tb.T());
01723                                                      break;
01724                                                  }
01725                                         case 4 : {
01726                                                      HepMatrix ta(1, 2, 0);
01727                                                      ta[0][0] = - (pmis.px()/pmis.rho()) * p4Infit(n).py() + (pmis.px()/pmis.rho())*p4Infit(n).px();
01728                                                      ta[0][1] = - (pmis.px()/pmis.rho()) * p4Infit(n).px() * (lambda/(1 + lambda*lambda)) - (pmis.py()/pmis.rho()) * p4Infit(n).py() * (lambda/(1 + lambda*lambda)) + (pmis.pz()/pmis.rho()) * p4Infit(n).pz() * (1/(lambda * (1 + lambda*lambda)));
01729                                                      setA(m_nc,pa,ta);
01730                                                      setAT(pa, m_nc, ta.T());
01731 
01732                                                      HepMatrix tb(1, 2, 0);
01733                                                      tb[0][0] =  -((pmis.px()/pmis.rho()) * p4Infit(n).m()/(p4Infit(n).rho()*p4Infit(n).rho())) * (p4Infit(n).px() + p4Infit(n).py() +p4Infit(n).pz());
01734                                                      tb[0][1] = ((pmis.px()/pmis.rho()) * p4Infit(n).e()/(p4Infit(n).rho()*p4Infit(n).rho())) * (p4Infit(n).px() + p4Infit(n).py() +
01735                                                              p4Infit(n).pz());
01736                                                      //             tb[0][1] =  (pmis.px()/pmis.rho()) * (p4Infit(n).px()/p4Infit(n).rho()) + (pmis.py()/pmis.rho()) * (p4Infit(n).py()/p4Infit(n).rho()) + (pmis.pz()/pmis.rho()) * (p4Infit(n).pz()/p4Infit(n).rho());
01737                                                      setB(m_nc,pb,tb);
01738                                                      setBT(pb, m_nc, tb.T());                
01739                                                      break;
01740                                                  }
01741                                         case 5 : {
01742                                                      HepMatrix ta(1, 3, 0);
01743                                                      ta[0][0] = - (pmis.px()/pmis.rho()) * p4Infit(n).py() + (pmis.px()/pmis.rho())*p4Infit(n).px();
01744                                                      ta[0][1] = - (pmis.px()/pmis.rho()) * p4Infit(n).px() * (lambda/(1 + lambda*lambda)) - (pmis.py()/pmis.rho()) * p4Infit(n).py() * (lambda/(1 + lambda*lambda)) + (pmis.pz()/pmis.rho()) * p4Infit(n).pz() * (1/(lambda * (1 + lambda*lambda)));   
01745                                                      setA(m_nc,pa,ta);
01746                                                      setAT(pa, m_nc, ta.T());
01747 
01748                                                      HepMatrix tb(1, 1, 0);
01749                                                      tb[0][0] =  (pmis.px()/pmis.rho()) * (p4Infit(n).px()/p4Infit(n).rho()) + (pmis.py()/pmis.rho()) * (p4Infit(n).py()/p4Infit(n).rho()) + (pmis.pz()/pmis.rho()) * (p4Infit(n).pz()/p4Infit(n).rho());
01750                                                      setB(m_nc,pb,tb);
01751                                                      setBT(pb, m_nc, tb.T()); 
01752                                                      break;
01753                                                  }
01754                                         case 7 : {
01755                                                      HepMatrix ta(1, NTRKPAR, 0);
01756                                                      ta[0][0] = pmis.px()/pmis.rho();
01757                                                      ta[0][1] = pmis.py()/pmis.rho();
01758                                                      ta[0][2] = pmis.pz()/pmis.rho();
01759                                                      setA(m_nc,pa,ta);
01760                                                      setAT(pa, m_nc, ta.T());
01761                                                      break;
01762                                                  }
01763                                     }    
01764                                 }
01765 
01766 
01767                                 HepVector dc(1, 0);
01768                                 dc[0] = pmis.rho() - ptot;
01769                                 m_G[m_nc] = dc[0];
01770                                 m_nc+=1;     
01771                                 break;
01772                             }
01773 
01774 
01775         case ThreeMomentum: {
01776                                 //
01777                                 //  px - p3x = 0
01778                                 //  py - p3y = 0
01779                                 //  pz - p3z = 0
01780                                 //
01781                                 Hep3Vector p3 = kc.p3();
01782                                 HepLorentzVector pmis;
01783                                 for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
01784                                     int n = (kc.Ltrk())[j];
01785                                     pmis = pmis + p4Infit(n);
01786                                 }
01787                                 for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
01788                                     int n = (kc.Ltrk())[j];
01789                                     int pa = mappositionA()[n] + 1;
01790                                     int pb = mappositionB()[n] + 1;
01791                                     int ptype = mapkinematic()[n];
01792                                     double lambda = p4Infit(n).pz()/p4Infit(n).perp();
01793                                     switch(ptype) {
01794                                         case 0 : {
01795                                                      HepMatrix ta(kc.nc(), NTRKPAR, 0);
01796                                                      ta[0][0] = 1.0;
01797                                                      ta[1][1] = 1.0;
01798                                                      ta[2][2] = 1.0;
01799                                                      setA(m_nc, pa, ta);
01800                                                      setAT(pa, m_nc, ta.T());
01801                                                      break;
01802                                                  }
01803                                         case 1 : {
01804                                                      HepMatrix ta(kc.nc(), NTRKPAR, 0);
01805                                                      ta[0][0] = -p4Infit(n).py();
01806                                                      ta[0][1] = -p4Infit(n).px()*(lambda/sqrt(1 + lambda*lambda));
01807                                                      ta[0][2] = -p4Infit(n).m()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
01808                                                      ta[0][3] = p4Infit(n).e()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
01809                                                      ta[1][0] = p4Infit(n).px();
01810                                                      ta[1][1] = -p4Infit(n).py()*(lambda/sqrt(1 + lambda*lambda));
01811                                                      ta[1][2] = -p4Infit(n).m()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
01812                                                      ta[1][3] = p4Infit(n).e()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
01813                                                      ta[2][0] = 0;
01814                                                      ta[2][1] = p4Infit(n).pz()*(1/(lambda * (1 + lambda*lambda)));
01815                                                      ta[2][2] = -p4Infit(n).m()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
01816                                                      ta[2][3] = p4Infit(n).e()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
01817                                                      //             ta[0][0] = 1.0;
01818                                                      //             ta[1][1] = 1.0;
01819                                                      //             ta[2][2] = 1.0;
01820                                                      setA(m_nc, pa, ta);
01821                                                      setAT(pa, m_nc, ta.T()); 
01822                                                      break;
01823                                                  }
01824                                         case 2 : {
01825                                                      HepMatrix tb(kc.nc(), 4, 0);
01826                                                      tb[0][0] = 1.0;
01827                                                      tb[1][1] = 1.0;
01828                                                      tb[2][2] = 1.0;
01829                                                      setB(m_nc, pb, tb);
01830                                                      setBT(pb, m_nc, tb.T());
01831                                                      break;
01832                                                  }
01833                                         case 3 : {
01834                                                      HepMatrix ta(kc.nc(), 1, 0);
01835                                                      setA(m_nc, pa, ta);
01836                                                      setAT(pa, m_nc, ta.T()); 
01837 
01838                                                      HepMatrix tb(kc.nc(), 3, 0);
01839                                                      tb[0][0] = 1.0;
01840                                                      tb[1][1] = 1.0;
01841                                                      tb[2][2] = 1.0;
01842                                                      setB(m_nc, pb, tb);
01843                                                      setBT(pb, m_nc, tb.T());
01844 
01845                                                      break;
01846                                                  }
01847                                         case 4 : {
01848                                                      HepMatrix ta(kc.nc(), 2, 0);
01849                                                      ta[0][0] = -p4Infit(n).py(); 
01850                                                      ta[0][1] = -p4Infit(n).px()*(lambda/sqrt(1 + lambda*lambda));
01851                                                      ta[1][0] =  p4Infit(n).px(); 
01852                                                      ta[1][1] = -p4Infit(n).py()*(lambda/sqrt(1 + lambda*lambda));
01853                                                      ta[2][0] =  0;
01854                                                      ta[2][1] =  p4Infit(n).pz()*(1/(lambda * (1 + lambda*lambda)));
01855                                                      setA(m_nc, pa, ta);
01856                                                      setAT(pa, m_nc, ta.T()); 
01857 
01858                                                      HepMatrix tb(kc.nc(), 2, 0);
01859                                                      tb[0][1] = -p4Infit(n).m()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
01860                                                      tb[1][1] = -p4Infit(n).m()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
01861                                                      tb[2][1] = -p4Infit(n).m()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
01862                                                      setB(m_nc, pb, tb);
01863                                                      setBT(pb, m_nc, tb.T());
01864                                                      break;
01865                                                  }
01866                                         case 5 : {
01867                                                      HepMatrix ta(kc.nc(), 3, 0);
01868                                                      ta[0][0] = -p4Infit(n).py(); 
01869                                                      ta[0][1] = -p4Infit(n).px()*(lambda/sqrt(1 + lambda*lambda));
01870                                                      ta[1][0] =  p4Infit(n).px(); 
01871                                                      ta[1][1] = -p4Infit(n).py()*(lambda/sqrt(1 + lambda*lambda));
01872                                                      ta[2][0] =  0;
01873                                                      ta[2][1] =  p4Infit(n).pz()*(1/(lambda * (1 + lambda*lambda)));
01874                                                      setA(m_nc, pa, ta);
01875                                                      setAT(pa, m_nc, ta.T()); 
01876 
01877                                                      HepMatrix tb(kc.nc(), 1, 0);
01878                                                      tb[0][0] = p4Infit(n).px()/p4Infit(n).rho();
01879                                                      tb[1][0] = p4Infit(n).py()/p4Infit(n).rho();
01880                                                      tb[2][0] = p4Infit(n).pz()/p4Infit(n).rho();
01881                                                      setB(m_nc, pb, tb);
01882                                                      setBT(pb, m_nc, tb.T());
01883                                                      break;
01884                                                  }
01885                                         case 7 : {
01886                                                      HepMatrix ta(kc.nc(), NTRKPAR, 0);
01887                                                      ta[0][0] = 1.0;
01888                                                      ta[1][1] = 1.0;
01889                                                      ta[2][2] = 1.0;
01890                                                      setA(m_nc, pa, ta);
01891                                                      setAT(pa, m_nc, ta.T());
01892                                                      break;
01893                                                  }
01894                                     }
01895                                 }    
01896                                 HepVector dc(kc.nc(), 0);
01897                                 dc[0] = pmis.px() - p3.x();
01898                                 dc[1] = pmis.py() - p3.y();
01899                                 dc[2] = pmis.pz() - p3.z();
01900                                 for(int i = 0; i < kc.nc(); i++) {
01901                                     m_G[m_nc+i] = dc[i];
01902                                 }        
01903 
01904                                 m_nc += 3; 
01905 
01906                                 break;
01907                             }
01908         case EqualMass: {
01909                             //
01910                             //  (E_1 ^2 - Px_1 ^2 - Py_1 ^2 - Pz_1 ^2) - (E_2 ^2 - Px_2 ^2 - Py_2 ^2 - Pz_2 ^2) = 0
01911                             //
01912 
01913                             int isiz = (kc.numEqual())[0];
01914                             HepLorentzVector pmis1, pmis2;
01915                             for(int n = 0; n < isiz; n++) {
01916                                 int n1 = (kc.Ltrk())[n]; 
01917                                 pmis1 = pmis1 + p4Infit(n1);
01918                             }
01919 
01920                             int jsiz = (kc.numEqual())[1];
01921                             for(int n = 0; n < jsiz; n++){
01922                                 int n2 = (kc.Ltrk())[n+isiz];
01923                                 pmis2 = pmis2 + p4Infit(n2);
01924                             }
01925 
01926                             for(int i = 0; i < isiz; i++) {
01927                                 int n1 = (kc.Ltrk())[i];
01928                                 double lambda = p4Infit(n1).pz()/p4Infit(n1).perp();
01929                                 int pa = mappositionA()[n1] + 1;
01930                                 int pb = mappositionB()[n1] + 1;
01931                                 int ptype = mapkinematic()[n1];
01932                                 switch(ptype) {
01933                                     case 0: {
01934                                                 HepMatrix ta(1, NTRKPAR, 0);
01935                                                 ta[0][0] = -2 * pmis1.px() + 2 * pmis1.e() * p4Infit(n1).px() / p4Infit(n1).e();
01936                                                 ta[0][1] = -2 * pmis1.py() + 2 * pmis1.e() * p4Infit(n1).py() / p4Infit(n1).e();
01937                                                 ta[0][2] = -2 * pmis1.pz() + 2 * pmis1.e() * p4Infit(n1).pz() / p4Infit(n1).e();
01938                                                 ta[0][3] = 2 * pmis1.e() *  p4Infit(n1).m() / p4Infit(n1).e();
01939                                                 setA(m_nc,pa,ta);
01940                                                 setAT(pa, m_nc, ta.T());
01941                                                 break;
01942                                             }
01943                                     case 1 :  {
01944                                                   HepMatrix ta(1, NTRKPAR, 0);
01945                                                   double a1 = lambda * lambda + 1;
01946                                                   ta[0][0] = 2 * pmis1.px() * p4Infit(n1).py() - 2 * pmis1.py() * p4Infit(n1).px();
01947                                                   ta[0][1] = 2 * pmis1.px() * p4Infit(n1).px() * lambda/sqrt(a1) + 2 * pmis1.py() * (p4Infit(n1)).py() * lambda/sqrt(a1) - 2 * pmis1.pz() * (p4Infit(n1)).pz() /(sqrt(a1) * lambda);
01948                                                   ta[0][2] = 2 * pmis1.px() * (p4Infit(n1)).px() * p4Infit(n1).m() /((p4Infit(n1)).rho() * p4Infit(n1).rho()) + 2 * pmis1.py() * (p4Infit(n1)).py() * p4Infit(n1).m()/((p4Infit(n1)).rho() * p4Infit(n1).rho())+ 2 * pmis1.pz() * (p4Infit(n1)).pz() * p4Infit(n1).m()/((p4Infit(n1)).rho() * p4Infit(n1).rho());
01949                                                   ta[0][3] = 2 * pmis1.e()  - 2 * pmis1.px() * (p4Infit(n1)).px() * p4Infit(n1).e() /((p4Infit(n1)).rho() * p4Infit(n1).rho())- 2 * pmis1.py() * (p4Infit(n1)).py() * p4Infit(n1).e()/((p4Infit(n1)).rho() * p4Infit(n1).rho())- 2 * pmis1.pz() * (p4Infit(n1)).pz() * p4Infit(n1).e()/((p4Infit(n1)).rho() * p4Infit(n1).rho());
01950                                                   setA(m_nc,pa,ta);
01951                                                   setAT(pa, m_nc, ta.T());
01952                                                   break;
01953                                               }
01954                                     case 2 :  {
01955                                                   HepMatrix tb(1, 4, 0);
01956                                                   tb[0][0] = -2 * pmis1.px();
01957                                                   tb[0][1] = -2 * pmis1.py();
01958                                                   tb[0][2] = -2 * pmis1.pz();
01959                                                   tb[0][3] = 2 * pmis1.e();
01960                                                   setB(m_nc,pb,tb);
01961                                                   setBT(pb,m_nc,tb.T());
01962                                                   break;
01963                                               }
01964                                     case 3 :  {
01965                                                   HepMatrix ta(1, 1, 0);
01966                                                   ta[0][0] = 2 * pmis1.e() * (p4Infit(n1).m()/p4Infit(n1).e());
01967                                                   setA(m_nc,pa,ta);
01968                                                   setAT(pa, m_nc, ta.T());
01969                                                   HepMatrix tb(1, 3, 0);
01970                                                   tb[0][0] = -2 * pmis1.px();
01971                                                   tb[0][1] = -2 * pmis1.py();
01972                                                   tb[0][2] = -2 * pmis1.pz();
01973                                                   setB(m_nc,pb,tb);
01974                                                   setBT(pb,m_nc,tb.T());
01975                                                   break;
01976                                               }
01977                                     case 4 :  {
01978                                                   HepMatrix ta(1, 2, 0);
01979                                                   double a1 = lambda * lambda + 1;
01980                                                   ta[0][0] = 2 * pmis1.px() * p4Infit(n1).py() - 2 * pmis1.py() * p4Infit(n1).px();
01981                                                   ta[0][1] = 2 * pmis1.px() * p4Infit(n1).px() * lambda/sqrt(a1) + 2 * pmis1.py() * (p4Infit(n1)).py() * lambda/sqrt(a1) - 2 * pmis1.pz() * (p4Infit(n1)).pz() /(sqrt(a1) * lambda);
01982                                                   setA(m_nc,pa,ta);
01983                                                   setAT(pa, m_nc, ta.T());
01984 
01985                                                   HepMatrix tb(1, 2, 0);
01986                                                   tb[0][0] =  2 * pmis1.px() * (p4Infit(n1)).px() * p4Infit(n1).m() /((p4Infit(n1)).rho() * p4Infit(n1).rho()) + 2 * pmis1.py() * (p4Infit(n1)).py() * p4Infit(n1).m()/((p4Infit(n1)).rho() * p4Infit(n1).rho())+ 2 * pmis1.pz() * (p4Infit(n1)).pz() * p4Infit(n1).m()/((p4Infit(n1)).rho() * p4Infit(n1).rho());
01987                                                   tb[0][1] = 2 * pmis1.e()  - 2 * pmis1.px() * (p4Infit(n1)).px() * p4Infit(n1).e() /((p4Infit(n1)).rho() * p4Infit(n1).rho())- 2 * pmis1.py() * (p4Infit(n1)).py() * p4Infit(n1).e()/((p4Infit(n1)).rho() * p4Infit(n1).rho())- 2 * pmis1.pz() * (p4Infit(n1)).pz() * p4Infit(n1).e()/((p4Infit(n1)).rho() * p4Infit(n1).rho());
01988                                                   setB(m_nc,pb,tb);
01989                                                   setBT(pb, m_nc, tb.T());
01990                                                   break;
01991                                               }
01992                                     case 5 :  {
01993                                                   HepMatrix ta(1, 3, 0);
01994                                                   double a1 = lambda * lambda + 1;
01995                                                   ta[0][0] = 2 * pmis1.px() * p4Infit(n1).py() - 2 * pmis1.py() * p4Infit(n1).px();
01996                                                   ta[0][1] = 2 * pmis1.px() * p4Infit(n1).px() * lambda/sqrt(a1)+ 2 * pmis1.py() * (p4Infit(n1)).py() * lambda/sqrt(a1) - 2 * pmis1.pz() * (p4Infit(n1)).pz() /(sqrt(a1) * lambda);
01997                                                   ta[0][2] = 2 * pmis1.e() * (p4Infit(n1)).m()/(p4Infit(n1)).e();
01998                                                   setA(m_nc,pa,ta);
01999                                                   setAT(pa, m_nc, ta.T());
02000                                                   HepMatrix tb(1, 1, 0);
02001                                                   tb[0][0] = 2 * pmis1.e() * (p4Infit(n1)).rho()/(p4Infit(n1)).e() - 2 * pmis1.px() * (p4Infit(n1)).px()/(p4Infit(n1)).rho() - 2 * pmis1.py() * (p4Infit(n1)).py()/(p4Infit(n1)).rho() - 2 * pmis1.pz() * (p4Infit(n1)).pz()/(p4Infit(n1)).rho();
02002                                                   setB(m_nc,pb,tb);
02003                                                   setBT(pb, m_nc, tb.T());
02004                                                   break;
02005                                               }       
02006                                     case 7: {
02007                                                 HepMatrix ta(1, NTRKPAR, 0);
02008                                                 ta[0][0] = -2 * pmis1.px() + 2 * pmis1.e() * p4Infit(n1).px() / p4Infit(n1).e();
02009                                                 ta[0][1] = -2 * pmis1.py() + 2 * pmis1.e() * p4Infit(n1).py() / p4Infit(n1).e();
02010                                                 ta[0][2] = -2 * pmis1.pz() + 2 * pmis1.e() * p4Infit(n1).pz() / p4Infit(n1).e();
02011                                                 ta[0][3] = 2 * pmis1.e() *  p4Infit(n1).m() / p4Infit(n1).e();
02012                                                 setA(m_nc,pa,ta);
02013                                                 setAT(pa, m_nc, ta.T());
02014                                                 break;
02015                                             }
02016                                 }   
02017                             }
02018 
02019                             for(int i = isiz; i < isiz+jsiz; i++) {
02020                                 int n2 = (kc.Ltrk())[i];
02021                                 double lambda = p4Infit(n2).pz()/p4Infit(n2).perp();
02022                                 int pa = mappositionA()[n2] + 1;
02023                                 int pb = mappositionB()[n2] + 1;
02024                                 int ptype = mapkinematic()[n2];
02025                                 switch(ptype) {
02026                                     case 0 : {
02027                                                  HepMatrix ta(1, NTRKPAR, 0);
02028                                                  ta[0][0] = -2 * pmis2.px() + 2 * pmis2.e() * p4Infit(n2).px() / p4Infit(n2).e();
02029                                                  ta[0][1] = -2 * pmis2.py() + 2 * pmis2.e() * p4Infit(n2).py() / p4Infit(n2).e();
02030                                                  ta[0][2] = -2 * pmis2.pz() + 2 * pmis2.e() * p4Infit(n2).pz() / p4Infit(n2).e();
02031                                                  ta[0][3] = 2 * pmis2.e() * p4Infit(n2).m() / p4Infit(n2).e();
02032                                                  setA(m_nc,pa,-ta);
02033                                                  setAT(pa, m_nc, -ta.T());
02034                                                  break;
02035                                              }
02036                                     case 1 :  {
02037                                                   HepMatrix ta(1, NTRKPAR, 0);
02038                                                   double a1 = lambda * lambda + 1;
02039                                                   ta[0][0] = 2 * pmis2.px() * p4Infit(n2).py() - 2 * pmis2.py() * p4Infit(n2).px();
02040                                                   ta[0][1] = 2 * pmis2.px() * p4Infit(n2).px() * lambda/sqrt(a1) + 2 * pmis2.py() * (p4Infit(n2)).py() * lambda/sqrt(a1) - 2 * pmis2.pz() * (p4Infit(n2)).pz() /(sqrt(a1) * lambda);
02041                                                   ta[0][2] =  2 * pmis2.px() * (p4Infit(n2)).px() * p4Infit(n2).m() /((p4Infit(n2)).rho() * p4Infit(n2).rho()) + 2 * pmis2.py() * (p4Infit(n2)).py() * p4Infit(n2).m()/((p4Infit(n2)).rho() * p4Infit(n2).rho())+ 2 * pmis2.pz() * (p4Infit(n2)).pz() * p4Infit(n2).m()/((p4Infit(n2)).rho() * p4Infit(n2).rho());
02042                                                   ta[0][3] = 2 * pmis2.e()  - 2 * pmis2.px() * (p4Infit(n2)).px() * p4Infit(n2).e() /((p4Infit(n2)).rho() * p4Infit(n2).rho())- 2 * pmis2.py() * (p4Infit(n2)).py() * p4Infit(n2).e()/((p4Infit(n2)).rho() * p4Infit(n2).rho())- 2 * pmis2.pz() * (p4Infit(n2)).pz() * p4Infit(n2).e()/((p4Infit(n2)).rho() * p4Infit(n2).rho());
02043                                                   setA(m_nc,pa,-ta);
02044                                                   setAT(pa, m_nc, -ta.T());
02045                                                   break;
02046                                               }
02047                                     case 2 :  {
02048                                                   HepMatrix tb(1, 4, 0);
02049                                                   tb[0][0] = -2 * pmis2.px();
02050                                                   tb[0][1] = -2 * pmis2.py();
02051                                                   tb[0][2] = -2 * pmis2.pz();
02052                                                   tb[0][3] = 2 * pmis2.e();
02053                                                   setB(m_nc,pb,-tb);
02054                                                   setBT(pb,m_nc,-tb.T());
02055                                                   break;
02056                                               }
02057                                     case 3 :  {
02058                                                   HepMatrix ta(1, 1, 0);
02059                                                   ta[0][0] = 2 * pmis2.e() * (p4Infit(n2).m()/p4Infit(n2).e());
02060                                                   setA(m_nc,pa,-ta);
02061                                                   setAT(pa, m_nc, -ta.T());
02062                                                   HepMatrix tb(1, 3, 0);
02063                                                   tb[0][0] = -2 * pmis2.px();
02064                                                   tb[0][1] = -2 * pmis2.py();
02065                                                   tb[0][2] = -2 * pmis2.pz();
02066                                                   setB(m_nc,pb,-tb);
02067                                                   setBT(pb,m_nc,-tb.T());
02068                                                   break;
02069                                               }
02070                                     case 4 :  {
02071                                                   HepMatrix ta(1, 2, 0);
02072                                                   double a1 = lambda * lambda + 1;
02073                                                   ta[0][0] = 2 * pmis2.px() * p4Infit(n2).py() - 2 * pmis2.py() * p4Infit(n2).px();
02074                                                   ta[0][1] = 2 * pmis2.px() * p4Infit(n2).px() * lambda/sqrt(a1) + 2 * pmis2.py() * (p4Infit(n2)).py() * lambda/sqrt(a1) - 2 * pmis2.pz() * (p4Infit(n2)).pz() /(sqrt(a1) * lambda);
02075                                                   setA(m_nc,pa,-ta);
02076                                                   setAT(pa, m_nc, -ta.T());
02077 
02078                                                   HepMatrix tb(1, 2, 0);
02079                                                   tb[0][0] =  2 * pmis2.px() * (p4Infit(n2)).px() * p4Infit(n2).m() /((p4Infit(n2)).rho() * p4Infit(n2).rho()) + 2 * pmis2.py() * (p4Infit(n2)).py() * p4Infit(n2).m()/((p4Infit(n2)).rho() * p4Infit(n2).rho())+ 2 * pmis2.pz() * (p4Infit(n2)).pz() * p4Infit(n2).m()/((p4Infit(n2)).rho() * p4Infit(n2).rho());
02080                                                   tb[0][1] = 2 * pmis2.e()  - 2 * pmis2.px() * (p4Infit(n2)).px() * p4Infit(n2).e() /((p4Infit(n2)).rho() * p4Infit(n2).rho())- 2 * pmis2.py() * (p4Infit(n2)).py() * p4Infit(n2).e()/((p4Infit(n2)).rho() * p4Infit(n2).rho())- 2 * pmis2.pz() * (p4Infit(n2)).pz() * p4Infit(n2).e()/((p4Infit(n2)).rho() * p4Infit(n2).rho());
02081                                                   setB(m_nc,pb,-tb);
02082                                                   setBT(pb, m_nc, -tb.T());
02083                                                   break;
02084                                               }
02085                                     case 5 :  {
02086                                                   HepMatrix ta(1, 3, 0);
02087                                                   double a1 = lambda * lambda + 1;
02088                                                   ta[0][0] = 2 * pmis2.px() * p4Infit(n2).py() - 2 * pmis2.py() * p4Infit(n2).px();
02089                                                   ta[0][1] = 2 * pmis2.px() * p4Infit(n2).px() * lambda/sqrt(a1) + 2 * pmis2.py() * (p4Infit(n2)).py() * lambda/sqrt(a1) - 2 * pmis2.pz() * (p4Infit(n2)).pz() /(sqrt(a1) * lambda);
02090                                                   ta[0][2] = 2 * pmis2.e() * (p4Infit(n2)).m()/(p4Infit(n2)).e();
02091                                                   setA(m_nc,pa,-ta);
02092                                                   setAT(pa, m_nc, -ta.T());
02093                                                   HepMatrix tb(1, 1, 0);
02094                                                   tb[0][0] = 2 * pmis2.e() * (p4Infit(n2)).rho()/(p4Infit(n2)).e() - 2 * pmis2.px() * (p4Infit(n2)).px()/(p4Infit(n2)).rho() - 2 * pmis2.py() * (p4Infit(n2)).py()/(p4Infit(n2)).rho() - 2 * pmis2.pz() * (p4Infit(n2)).pz()/(p4Infit(n2)).rho();
02095                                                   setB(m_nc,pb,-tb);
02096                                                   setBT(pb, m_nc, -tb.T());
02097                                                   break;
02098                                               }       
02099                                     case 7 : {
02100                                                  HepMatrix ta(1, NTRKPAR, 0);
02101                                                  ta[0][0] = -2 * pmis2.px() + 2 * pmis2.e() * p4Infit(n2).px() / p4Infit(n2).e();
02102                                                  ta[0][1] = -2 * pmis2.py() + 2 * pmis2.e() * p4Infit(n2).py() / p4Infit(n2).e();
02103                                                  ta[0][2] = -2 * pmis2.pz() + 2 * pmis2.e() * p4Infit(n2).pz() / p4Infit(n2).e();
02104                                                  ta[0][3] = 2 * pmis2.e() * p4Infit(n2).m() / p4Infit(n2).e();
02105                                                  setA(m_nc,pa,-ta);
02106                                                  setAT(pa, m_nc, -ta.T());
02107                                                  break;
02108                                              }
02109                                 }   
02110                             } 
02111 
02112 
02113 
02114 
02115                             HepVector dc(1, 0);
02116                             dc[0] = pmis1.m2() - pmis2.m2();
02117                             m_G[m_nc] = dc[0];
02118 
02119                             m_nc+=1;
02120 
02121                             break;
02122                         }
02123 
02124 
02125         case FourMomentum: 
02126         default: {
02127                      //
02128                      //  px - p4x = 0
02129                      //  py - p4y = 0
02130                      //  pz - p4z = 0
02131                      //  e  - p4e = 0
02132                      //
02133                      HepLorentzVector p4 = kc.p4();
02134                      HepLorentzVector pmis;
02135                      for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
02136                          int n = (kc.Ltrk())[j];
02137                          pmis = pmis + p4Infit(n);
02138                      }
02139                      for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
02140                          int n = (kc.Ltrk())[j];
02141                          double lambda = p4Infit(n).pz()/p4Infit(n).perp();
02142                          int pa = mappositionA()[n] + 1;
02143                          int pb = mappositionB()[n] + 1;
02144                          int ptype = mapkinematic()[n];
02145                          switch(ptype) {
02146                              case 0 : {
02147                                           HepMatrix ta(kc.nc(), NTRKPAR, 0);
02148                                           ta[0][0] = 1.0;
02149                                           ta[1][1] = 1.0;
02150                                           ta[2][2] = 1.0;
02151                                           ta[3][0] = p4Infit(n).px() / p4Infit(n).e();
02152                                           ta[3][1] = p4Infit(n).py() / p4Infit(n).e();
02153                                           ta[3][2] = p4Infit(n).pz() / p4Infit(n).e();
02154                                           ta[3][3] = p4Infit(n).m() / p4Infit(n).e();
02155                                           setA(m_nc, pa, ta);
02156                                           setAT(pa, m_nc, ta.T());
02157                                           break;
02158                                       }
02159                              case 1 : {
02160                                           HepMatrix ta(kc.nc(), NTRKPAR, 0);
02161                                           ta[0][0] = -p4Infit(n).py();
02162                                           ta[0][1] = -p4Infit(n).px()*(lambda/(1 + lambda*lambda));
02163                                           ta[0][2] = -p4Infit(n).m()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
02164                                           ta[0][3] = p4Infit(n).e()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
02165                                           ta[1][0] = p4Infit(n).px();
02166                                           ta[1][1] = -p4Infit(n).py()*(lambda/(1 + lambda*lambda));
02167                                           ta[1][2] = -p4Infit(n).m()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
02168                                           ta[1][3] = p4Infit(n).e()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
02169                                           ta[2][0] = 0;
02170                                           ta[2][1] = p4Infit(n).pz()*(1/(lambda * (1 + lambda*lambda)));
02171                                           ta[2][2] = -p4Infit(n).m()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
02172                                           ta[2][3] = p4Infit(n).e()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
02173                                           ta[3][0] = 0;
02174                                           ta[3][1] = 0;
02175                                           ta[3][2] = 0;
02176                                           ta[3][3] = 1.0;
02177                                           setA(m_nc, pa, ta);
02178                                           setAT(pa, m_nc, ta.T()); 
02179                                           break;
02180                                       }
02181                              case 2 : {
02182                                           HepMatrix tb(kc.nc(), 4, 0);
02183                                           tb[0][0] = 1.0;
02184                                           tb[1][1] = 1.0;
02185                                           tb[2][2] = 1.0;
02186                                           tb[3][3] = 1.0;
02187                                           setB(m_nc, pb, tb);
02188                                           setBT(pb, m_nc, tb.T());
02189                                           break;
02190                                       }
02191                              case 3 : {
02192                                           HepMatrix ta(kc.nc(), 1, 0);
02193                                           ta[0][0] = -p4Infit(n).m()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
02194                                           ta[1][0] = -p4Infit(n).m()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
02195                                           ta[2][0] = -p4Infit(n).m()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
02196                                           ta[3][0] = 0;
02197                                           setA(m_nc, pa, ta);
02198                                           setAT(pa, m_nc, ta.T()); 
02199 
02200                                           HepMatrix tb(kc.nc(), 3, 0);
02201                                           tb[0][0] = -p4Infit(n).py();
02202                                           tb[0][1] = -p4Infit(n).px()*(lambda/(1 + lambda*lambda));
02203                                           tb[0][2] = p4Infit(n).e()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
02204                                           tb[1][0] = p4Infit(n).px();
02205                                           tb[1][1] = -p4Infit(n).py()*(lambda/(1 + lambda*lambda));
02206                                           tb[1][2] = p4Infit(n).e()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
02207                                           tb[2][0] = 0;
02208                                           tb[2][1] = p4Infit(n).pz()*(1/(lambda * (1 + lambda*lambda)));
02209                                           tb[2][2] = p4Infit(n).e()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
02210                                           tb[3][0] = 0;
02211                                           tb[3][1] = 0;
02212                                           tb[3][2] = 1.0;
02213 
02214                                           setB(m_nc, pb, tb);
02215                                           setBT(pb, m_nc, tb.T());
02216 
02217                                           break;
02218                                       }
02219                              case 4 : {
02220                                           HepMatrix ta(kc.nc(), 2, 0);
02221                                           ta[0][0] = -p4Infit(n).py(); 
02222                                           ta[0][1] = -p4Infit(n).px()*(lambda/sqrt(1 + lambda*lambda));
02223                                           ta[1][0] =  p4Infit(n).px(); 
02224                                           ta[1][1] = -p4Infit(n).py()*(lambda/sqrt(1 + lambda*lambda));
02225                                           ta[2][0] =  0;
02226                                           ta[2][1] =  p4Infit(n).pz()*(1/(lambda * (1 + lambda*lambda)));
02227 
02228                                           setA(m_nc, pa, ta);
02229                                           setAT(pa, m_nc, ta.T()); 
02230 
02231                                           HepMatrix tb(kc.nc(), 2, 0);
02232                                           //  tb[3][0] = p4Infit(n).m()/p4Infit(n).e();
02233                                           //  tb[0][1] = p4Infit(n).px()/p4Infit(n).rho();
02234                                           //  tb[1][1] = p4Infit(n).py()/p4Infit(n).rho();
02235                                           //  tb[2][1] = p4Infit(n).pz()/p4Infit(n).rho();
02236                                           //  tb[3][1] = p4Infit(n).rho()/p4Infit(n).e();
02237                                           tb[0][0] = -p4Infit(n).m()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
02238                                           tb[1][0] = -p4Infit(n).m()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
02239                                           tb[2][0] = -p4Infit(n).m()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
02240                                           tb[0][1] = p4Infit(n).e()*p4Infit(n).px()/(p4Infit(n).rho()*p4Infit(n).rho());
02241                                           tb[1][1] = p4Infit(n).e()*p4Infit(n).py()/(p4Infit(n).rho()*p4Infit(n).rho());
02242                                           tb[2][1] = p4Infit(n).e()*p4Infit(n).pz()/(p4Infit(n).rho()*p4Infit(n).rho());
02243                                           tb[3][1] = 1;
02244                                           setB(m_nc, pb, tb);
02245                                           setBT(pb, m_nc, tb.T());
02246                                           break;
02247                                       }
02248                              case 5 : {
02249                                           HepMatrix ta(kc.nc(), 3, 0);
02250                                           ta[0][0] = -p4Infit(n).py();
02251                                           ta[0][1] = -p4Infit(n).px()*(lambda/sqrt(1 + lambda*lambda));
02252                                           ta[1][0] =  p4Infit(n).px(); 
02253                                           ta[1][1] = -p4Infit(n).py()*(lambda/sqrt(1 + lambda*lambda));
02254                                           ta[2][0] =  0;
02255                                           ta[2][1] =  p4Infit(n).pz()*(1/(lambda * (1 + lambda*lambda)));
02256                                           ta[3][2] =  p4Infit(n).m()/p4Infit(n).e();
02257                                           setA(m_nc, pa, ta);
02258                                           setAT(pa, m_nc, ta.T()); 
02259 
02260                                           HepMatrix tb(kc.nc(), 1, 0);
02261                                           tb[0][0] = p4Infit(n).px()/p4Infit(n).rho();
02262                                           tb[1][0] = p4Infit(n).py()/p4Infit(n).rho();
02263                                           tb[2][0] = p4Infit(n).pz()/p4Infit(n).rho();
02264                                           tb[3][0] = p4Infit(n).rho()/p4Infit(n).e();
02265                                           setB(m_nc, pb, tb);
02266                                           setBT(pb, m_nc, tb.T());
02267                                           break;
02268                                       }
02269                              case 6 : {
02270                                           double ptrk = m_p.sub(pa+3, pa+3)[0];
02271                                           double x = m_p.sub(pa, pa)[0] - m_q.sub(pb, pb)[0];
02272                                           double y = m_p.sub(pa+1, pa+1)[0] - m_q.sub(pb+1, pb+1)[0];
02273                                           double z = m_p.sub(pa+2, pa+2)[0] - m_q.sub(pb+2, pb+2)[0];
02274                                           double R = sqrt(x*x + y*y + z*z);
02275                                           HepMatrix ta(kc.nc(), 4, 0);
02276                                           ta[0][0] = ptrk*(y*y + z*z)/(R*R*R);
02277                                           ta[0][1] = -ptrk*x*y/(R*R*R);
02278                                           ta[0][2] = -ptrk*x*z/(R*R*R);
02279                                           ta[0][3] = x/R;
02280                                           ta[1][0] = -ptrk*y*x/(R*R*R);
02281                                           ta[1][1] = ptrk*(x*x + z*z)/(R*R*R);
02282                                           ta[1][2] = -ptrk*y*z/(R*R*R);
02283                                           ta[1][3] = y/R;
02284                                           ta[2][0] = -ptrk*z*x/(R*R*R);
02285                                           ta[2][1] = -ptrk*z*y/(R*R*R);
02286                                           ta[2][2] = ptrk*(x*x + y*y)/(R*R*R);
02287                                           ta[2][3] = z/R;
02288                                           ta[3][3] = 1;
02289                                           setA(m_nc, pa, ta);
02290                                           setAT(pa, m_nc, ta.T());
02291 
02292                                           HepMatrix tb(kc.nc(), 3, 0);
02293                                           tb[0][0] = -ptrk*(y*y + z*z)/(R*R*R);
02294                                           tb[0][1] = ptrk*x*y/(R*R*R);
02295                                           tb[0][2] = ptrk*x*z/(R*R*R);
02296                                           tb[1][0] = ptrk*y*x/(R*R*R);
02297                                           tb[1][1] = -ptrk*(x*x + z*z)/(R*R*R);
02298                                           tb[1][2] = ptrk*y*z/(R*R*R);
02299                                           tb[2][0] = ptrk*z*x/(R*R*R);
02300                                           tb[2][1] = ptrk*z*y/(R*R*R);
02301                                           tb[2][2] = -ptrk*(x*x + y*y)/(R*R*R);
02302                                           HepMatrix tbp = m_B.sub(1, 4, 1, 3);
02303                                           tb = tbp + tb;
02304                                           setB(m_nc, pb, tb);
02305                                           setBT(pb, m_nc, tb.T());
02306                                           break;
02307                                       }
02308                              case 7 : {
02309                                           HepMatrix ta(kc.nc(), NTRKPAR, 0);
02310                                           ta[0][0] = 1.0;
02311                                           ta[1][1] = 1.0;
02312                                           ta[2][2] = 1.0;
02313                                           ta[3][0] = p4Infit(n).px() / p4Infit(n).e();
02314                                           ta[3][1] = p4Infit(n).py() / p4Infit(n).e();
02315                                           ta[3][2] = p4Infit(n).pz() / p4Infit(n).e();
02316                                           ta[3][3] = p4Infit(n).m() / p4Infit(n).e();
02317                                           setA(m_nc, pa, ta);
02318                                           setAT(pa, m_nc, ta.T());
02319                                           break;
02320                                       }
02321                          }
02322                      }  
02323 
02324                      HepVector dc(kc.nc(), 0);
02325                      dc[0] = pmis.px()  - p4.px();
02326                      dc[1] = pmis.py()  - p4.py();
02327                      dc[2] = pmis.pz()  - p4.pz();
02328                      dc[3] = pmis.e()  - p4.e();
02329                      for(int i = 0; i < kc.nc(); i++) {
02330                          m_G[m_nc+i] = dc[i];
02331                      }           
02332 
02333                      m_nc += 4;
02334 
02335                      break;
02336                  }
02337     }
02338 }

void KalmanKinematicFit::upTrkpar (  )  [private]

WTrackParameter TrackPool::wTrackInfit ( int  n  )  const [inline, inherited]

Definition at line 76 of file TrackPool.h.

References TrackPool::m_wtrk_infit.

00076 {return m_wtrk_infit[n];}

std::vector<WTrackParameter> TrackPool::wTrackInfit (  )  const [inline, inherited]

Definition at line 73 of file TrackPool.h.

References TrackPool::m_wtrk_infit.

Referenced by VertexFit::BeamFit(), VertexFit::BuildVirtualParticle(), KinematicFit::BuildVirtualParticle(), BuildVirtualParticle(), KinematicFit::covMatrix(), VertexFit::Ew(), KinematicFit::infit(), infit(), VertexFit::pfit(), KinematicFit::pull(), pull(), VertexFit::swimVertex(), KinematicFit::upCovmtx(), VertexFit::w(), VertexFit::wtrk(), and VertexFit::xfit().

00073 {return m_wtrk_infit;}

int TrackPool::wTrackList ( int  n  )  const [inline, inherited]

Definition at line 77 of file TrackPool.h.

References TrackPool::m_lwtrk.

00077 {return m_lwtrk[n];}

std::vector<int> TrackPool::wTrackList (  )  const [inline, inherited]

Definition at line 74 of file TrackPool.h.

References TrackPool::m_lwtrk.

00074 {return m_lwtrk;}

WTrackParameter TrackPool::wTrackOrigin ( int  n  )  const [inline, inherited]

Definition at line 75 of file TrackPool.h.

References TrackPool::m_wtrk_origin.

00075 {return m_wtrk_origin[n];}

std::vector<WTrackParameter> TrackPool::wTrackOrigin (  )  const [inline, inherited]

Definition at line 72 of file TrackPool.h.

References TrackPool::m_wtrk_origin.

Referenced by VertexFit::AddVertex(), VertexFit::BeamFit(), VertexFit::BuildVirtualParticle(), KinematicFit::covMatrix(), VertexFit::Fit(), SecondVertexFit::Fit(), KinematicFit::Fit(), Fit(), KinematicFit::gda(), gda(), KinematicFit::origin(), origin(), VertexFit::pull(), KinematicFit::pull(), pull(), VertexFit::swimVertex(), KinematicFit::upCovmtx(), and VertexFit::UpdateConstraints().

00072 {return m_wtrk_origin;}

WTrackParameter KalmanKinematicFit::wVirtualTrack ( int  n  )  const [inline]

Definition at line 174 of file KalmanKinematicFit.h.

References m_virtual_wtrk.

00174 {return m_virtual_wtrk[n];}

HepVector KalmanKinematicFit::xfit (  )  [inline]

Definition at line 158 of file KalmanKinematicFit.h.

References m_q.

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


Member Data Documentation

const int KalmanKinematicFit::EqualMass = 64 [static, private]

Definition at line 268 of file KalmanKinematicFit.h.

Referenced by updateConstraints().

const int KalmanKinematicFit::FourMomentum = 32 [static, private]

Definition at line 267 of file KalmanKinematicFit.h.

Referenced by updateConstraints().

HepMatrix KalmanKinematicFit::m_A [private]

Definition at line 195 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), setA(), and upCovmtx().

HepMatrix KalmanKinematicFit::m_AT [private]

Definition at line 197 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), and setAT().

HepMatrix KalmanKinematicFit::m_B [private]

Definition at line 204 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), setB(), and updateConstraints().

HepMatrix KalmanKinematicFit::m_BT [private]

Definition at line 206 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), and setBT().

HepSymMatrix KalmanKinematicFit::m_C [private]

Definition at line 218 of file KalmanKinematicFit.h.

Referenced by BuildVirtualParticle(), Fit(), getCInfit(), setCInfit(), and upCovmtx().

HepSymMatrix KalmanKinematicFit::m_C0 [private]

Definition at line 217 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), getCOrigin(), setCOrigin(), and upCovmtx().

double KalmanKinematicFit::m_chi [private]

Definition at line 193 of file KalmanKinematicFit.h.

Referenced by chisq(), Fit(), fit(), and init().

double KalmanKinematicFit::m_chicut [private]

Definition at line 251 of file KalmanKinematicFit.h.

Referenced by Fit(), init(), and setChisqCut().

std::vector<double> KalmanKinematicFit::m_chisq [private]

Definition at line 192 of file KalmanKinematicFit.h.

Referenced by chisq(), Fit(), fit(), and init().

double KalmanKinematicFit::m_chiter [private]

Definition at line 252 of file KalmanKinematicFit.h.

Referenced by Fit(), init(), and setChisqCut().

double KalmanKinematicFit::m_collideangle [private]

Definition at line 255 of file KalmanKinematicFit.h.

Referenced by AddFourMomentum(), collideangle(), init(), and setCollideangle().

HepVector KalmanKinematicFit::m_cpu [private]

Definition at line 257 of file KalmanKinematicFit.h.

Referenced by cpu(), Fit(), fit(), and init().

HepSymMatrix KalmanKinematicFit::m_D [private]

Definition at line 233 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), and setDInfit().

HepSymMatrix KalmanKinematicFit::m_D0 [private]

Definition at line 232 of file KalmanKinematicFit.h.

Referenced by setDOrigin().

HepSymMatrix KalmanKinematicFit::m_D0inv [private]

Definition at line 234 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), and setDOriginInv().

HepSymMatrix KalmanKinematicFit::m_Dinv [private]

Definition at line 235 of file KalmanKinematicFit.h.

Referenced by fit(), and upCovmtx().

bool KalmanKinematicFit::m_dynamicerror [private]

Definition at line 259 of file KalmanKinematicFit.h.

Referenced by dynamicerror(), fit(), init(), and setDynamicerror().

double KalmanKinematicFit::m_espread [private]

Definition at line 254 of file KalmanKinematicFit.h.

Referenced by AddFourMomentum(), espread(), init(), and setEspread().

bool KalmanKinematicFit::m_flag [private]

Definition at line 250 of file KalmanKinematicFit.h.

Referenced by init(), and setFlag().

HepVector KalmanKinematicFit::m_G [private]

Definition at line 199 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), and updateConstraints().

TGraph2D* KalmanKinematicFit::m_graph2d [private]

Definition at line 271 of file KalmanKinematicFit.h.

Referenced by init(), and setTgraph().

std::vector<KinematicConstraints> KalmanKinematicFit::m_kc [private]

Definition at line 191 of file KalmanKinematicFit.h.

Referenced by AddEqualMass(), AddFourMomentum(), AddResonance(), AddThreeMomentum(), AddTotalEnergy(), AddTotalMomentum(), BuildVirtualParticle(), Fit(), fit(), and init().

HepMatrix KalmanKinematicFit::m_KP [private]

Definition at line 201 of file KalmanKinematicFit.h.

Referenced by fit().

HepMatrix KalmanKinematicFit::m_KQ [private]

Definition at line 210 of file KalmanKinematicFit.h.

Referenced by fit(), and upCovmtx().

int KalmanKinematicFit::m_nc [private]

Definition at line 211 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), init(), and updateConstraints().

int KalmanKinematicFit::m_niter [private]

Definition at line 249 of file KalmanKinematicFit.h.

Referenced by Fit(), init(), and setIterNumber().

int KalmanKinematicFit::m_nktrk [private]

Definition at line 212 of file KalmanKinematicFit.h.

Referenced by Fit().

HepVector KalmanKinematicFit::m_p [private]

Definition at line 216 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), pInfit(), pull(), setPInfit(), and updateConstraints().

HepVector KalmanKinematicFit::m_p0 [private]

Definition at line 215 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), pOrigin(), pull(), and setPOrigin().

KalmanKinematicFit * KalmanKinematicFit::m_pointer = 0 [static, private]

Definition at line 247 of file KalmanKinematicFit.h.

Referenced by instance(), and ~KalmanKinematicFit().

HepVector KalmanKinematicFit::m_q [private]

Definition at line 231 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), pInfit(), setQInfit(), updateConstraints(), and xfit().

HepVector KalmanKinematicFit::m_q0 [private]

Definition at line 230 of file KalmanKinematicFit.h.

Referenced by Fit(), fit(), pOrigin(), and setQOrigin().

std::vector<WTrackParameter> KalmanKinematicFit::m_virtual_wtrk [private]

Definition at line 178 of file KalmanKinematicFit.h.

Referenced by BuildVirtualParticle(), init(), and wVirtualTrack().

HepSymMatrix KalmanKinematicFit::m_Vm [private]

Definition at line 194 of file KalmanKinematicFit.h.

Referenced by Fit(), and fit().

HepSymMatrix KalmanKinematicFit::m_W [private]

Definition at line 200 of file KalmanKinematicFit.h.

Referenced by fit(), and upCovmtx().

const int KalmanKinematicFit::NKFPAR [static, private]

Definition at line 262 of file KalmanKinematicFit.h.

const int KalmanKinematicFit::NTRKPAR = 4 [static, private]

Definition at line 261 of file KalmanKinematicFit.h.

Referenced by Fit(), gda(), getCInfit(), getCOrigin(), and updateConstraints().

const int KalmanKinematicFit::Position = 8 [static, private]

Definition at line 269 of file KalmanKinematicFit.h.

const int KalmanKinematicFit::Resonance = 1 [static, private]

Definition at line 263 of file KalmanKinematicFit.h.

Referenced by updateConstraints().

const int KalmanKinematicFit::ThreeMomentum = 16 [static, private]

Definition at line 266 of file KalmanKinematicFit.h.

Referenced by updateConstraints().

const int KalmanKinematicFit::TotalEnergy = 2 [static, private]

Definition at line 264 of file KalmanKinematicFit.h.

Referenced by updateConstraints().

const int KalmanKinematicFit::TotalMomentum = 4 [static, private]

Definition at line 265 of file KalmanKinematicFit.h.

Referenced by updateConstraints().


Generated on Tue Nov 29 23:19:56 2016 for BOSS_7.0.2 by  doxygen 1.4.7