KinematicFit Class Reference

#include <KinematicFit.h>

Inheritance diagram for KinematicFit:

TrackPool List of all members.

Public Member Functions

 ~KinematicFit ()
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 setKalman (const int kalman)
void setEspread (const double espread=0.0009)
void setCollideangle (const double collideangle=11e-3)
void setDynamicerror (const bool dynamicerror=1)
bool Fit ()
bool Fit (int n)
double chisq () const
double chisq (int n) const
HepLorentzVector pfit (int n) const
HepLorentzVector pfit1 (int n) const
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
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 KinematicFitinstance ()

Private Member Functions

void updateConstraints (KinematicConstraints kc)
void fits ()
void fit ()
void upCovmtx ()
void fit (int n)
void covMatrix (int n)
void gda ()
HepMatrix D (int ic, int itk) const
void setD (int ic, int itk, const HepMatrix &p)
HepMatrix DT (int itk, int ic) const
void setDT (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)
HepSymMatrix covOrigin (int i) const
HepSymMatrix covInfit (int i) const
void setCovOrigin (int i, const HepSymMatrix &c)
void setCovInfit (int i, const HepSymMatrix &c)
void setMassvector (int i, const double mass)
 KinematicFit ()

Private Attributes

std::vector< WTrackParameterm_virtual_wtrk
std::vector< KinematicConstraintsm_kc
std::vector< double > m_chisq
double m_chi
HepMatrix m_D
HepMatrix m_DT
HepVector m_d
HepSymMatrix m_VD
HepMatrix m_KP
int m_nc
int m_nktrk
HepVector m_pOrigin
HepVector m_pInfit
HepSymMatrix m_covOrigin
HepSymMatrix m_covInfit
HepVector m_massvector
int m_niter
bool m_flag
double m_chicut
double m_chiter
int m_kalman
double m_espread
double m_collideangle
HepVector m_cpu
bool m_dynamicerror

Static Private Attributes

static KinematicFitm_pointer = 0
static const int NTRKPAR = 3
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 10 of file KinematicFit.h.


Constructor & Destructor Documentation

KinematicFit::~KinematicFit (  ) 

Definition at line 28 of file KinematicFit.cxx.

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

KinematicFit::KinematicFit (  )  [private]

Definition at line 26 of file KinematicFit.cxx.

Referenced by instance().

00026 {;}


Member Function Documentation

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

Definition at line 322 of file KinematicFit.cxx.

References KinematicConstraints::EqualMassConstraints(), and m_kc.

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

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

Definition at line 379 of file KinematicFit.cxx.

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

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

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

Definition at line 354 of file KinematicFit.cxx.

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

Referenced by CalibEventSelect::execute(), JsiLL::execute(), DQARhopi::execute(), DQAKsKpi::execute(), and Ppjrhopi::execute().

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

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(), AddResonance(), KalmanKinematicFit::AddResonance(), AddTotalEnergy(), KalmanKinematicFit::AddTotalEnergy(), AddTotalMomentum(), KalmanKinematicFit::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 KinematicFit::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 136 of file KinematicFit.cxx.

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

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

void KinematicFit::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 129 of file KinematicFit.cxx.

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

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

void KinematicFit::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 122 of file KinematicFit.cxx.

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

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

void KinematicFit::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 116 of file KinematicFit.cxx.

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

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

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

Definition at line 110 of file KinematicFit.cxx.

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

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

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

Definition at line 104 of file KinematicFit.cxx.

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

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

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

Definition at line 98 of file KinematicFit.cxx.

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

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

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

Definition at line 92 of file KinematicFit.cxx.

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

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

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

Definition at line 87 of file KinematicFit.cxx.

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

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

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

Definition at line 82 of file KinematicFit.cxx.

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

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

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

Definition at line 77 of file KinematicFit.cxx.

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

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

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

Definition at line 72 of file KinematicFit.cxx.

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

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

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

Definition at line 143 of file KinematicFit.cxx.

References m_kc, and KinematicConstraints::ResonanceConstraints().

Referenced by AddResonance(), Pi0EtaToGGRecAlg::execute(), and Pi0::Pi0ListToTDS().

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

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

Definition at line 335 of file KinematicFit.cxx.

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

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

void KinematicFit::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 304 of file KinematicFit.cxx.

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

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

void KinematicFit::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 297 of file KinematicFit.cxx.

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

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

void KinematicFit::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 289 of file KinematicFit.cxx.

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

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

void KinematicFit::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 283 of file KinematicFit.cxx.

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

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

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

Definition at line 277 of file KinematicFit.cxx.

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

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

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

Definition at line 271 of file KinematicFit.cxx.

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

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

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

Definition at line 265 of file KinematicFit.cxx.

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

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

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

Definition at line 259 of file KinematicFit.cxx.

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

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

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

Definition at line 254 of file KinematicFit.cxx.

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

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

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

Definition at line 249 of file KinematicFit.cxx.

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

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

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

Definition at line 244 of file KinematicFit.cxx.

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

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

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

Definition at line 240 of file KinematicFit.cxx.

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

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

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

Definition at line 311 of file KinematicFit.cxx.

References m_kc, and KinematicConstraints::TotalEnergyConstraints().

Referenced by AddTotalEnergy().

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

void KinematicFit::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 221 of file KinematicFit.cxx.

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

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

void KinematicFit::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 214 of file KinematicFit.cxx.

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

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

void KinematicFit::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 206 of file KinematicFit.cxx.

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

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

void KinematicFit::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 200 of file KinematicFit.cxx.

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

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

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

Definition at line 194 of file KinematicFit.cxx.

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

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

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

Definition at line 188 of file KinematicFit.cxx.

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

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

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

Definition at line 182 of file KinematicFit.cxx.

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

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

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

Definition at line 176 of file KinematicFit.cxx.

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

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

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

Definition at line 171 of file KinematicFit.cxx.

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

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

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

Definition at line 166 of file KinematicFit.cxx.

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

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

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

Definition at line 161 of file KinematicFit.cxx.

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

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

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

Definition at line 157 of file KinematicFit.cxx.

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

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

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

Definition at line 228 of file KinematicFit.cxx.

References m_kc, and KinematicConstraints::TotalMomentumConstraints().

Referenced by AddTotalMomentum().

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

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 KinematicFit::BuildVirtualParticle ( int  number  ) 

Definition at line 793 of file KinematicFit.cxx.

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

Referenced by Pi0EtaToGGRecAlg::execute().

00793                                               {
00794 //
00795 //      q = p1 + p2 + ... + pn
00796 //
00797         upCovmtx();
00798         KinematicConstraints kc = m_kc[n];
00799         int ntrk = (kc.Ltrk()).size();
00800         int charge = 0;
00801         HepVector w(7, 0);
00802         HepSymMatrix ew(7, 0);
00803         HepMatrix dwdp(7, 7, 0);
00804         dwdp[0][0] = 1;
00805         dwdp[1][1] = 1;
00806         dwdp[2][2] = 1;
00807         dwdp[3][3] = 1;
00808         dwdp[4][4] = 1;
00809         dwdp[5][5] = 1;
00810         dwdp[6][6] = 1;
00811         for (int i = 0; i < ntrk; i++) {
00812                 int itk = (kc.Ltrk())[i];
00813                 charge += wTrackInfit(itk).charge();
00814                 w[0] = w[0] + wTrackInfit(itk).w()[0];
00815                 w[1] = w[1] + wTrackInfit(itk).w()[1];
00816                 w[2] = w[2] + wTrackInfit(itk).w()[2];
00817                 w[3] = w[3] + wTrackInfit(itk).w()[3];
00818                 w[4] = 0.0;//
00819                 w[5] = 0.0;// set virtual particle's vertex at (0,0,0)
00820                 w[6] = 0.0;//
00821                 ew = ew + (wTrackInfit(itk).Ew()).similarity(dwdp);  // the  vertex matrix  of this particles is not correct, because we do not use vertex information in kinematicfit, so ...
00822         }
00823         double m = sqrt(w[3]*w[3] - w[0]*w[0] - w[1]*w[1] - w[2]*w[2]);
00824         WTrackParameter vwtrk;
00825         vwtrk.setCharge(charge);
00826         vwtrk.setW(w);
00827         vwtrk.setEw(ew);
00828         vwtrk.setMass(m);
00829         m_virtual_wtrk.push_back(vwtrk);
00830 }

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

Definition at line 151 of file KinematicFit.h.

References m_chisq.

00151 {return m_chisq[n];}

double KinematicFit::chisq (  )  const [inline]

Definition at line 150 of file KinematicFit.h.

References m_chi.

Referenced by Pi0EtaToGGRecAlg::execute(), CalibEventSelect::execute(), JsiLL::execute(), DQARhopi::execute(), DQAKsKpi::execute(), Ppjrhopi::execute(), Fit(), and Pi0::Pi0ListToTDS().

00150 {return m_chi;}

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

Definition at line 139 of file TrackPool.h.

References TrackPool::m_gammashape.

Referenced by VertexFit::init(), init(), KalmanKinematicFit::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(), init(), KalmanKinematicFit::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(), init(), KalmanKinematicFit::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(), init(), KalmanKinematicFit::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(), init(), KalmanKinematicFit::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(), init(), and KalmanKinematicFit::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(), init(), and KalmanKinematicFit::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(), init(), KalmanKinematicFit::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(), init(), KalmanKinematicFit::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(), init(), KalmanKinematicFit::init(), and TrackPool::TrackPool().

00111 {m_wtrk_origin.clear();}

double KinematicFit::collideangle (  )  const [inline]

Definition at line 166 of file KinematicFit.h.

References m_collideangle.

Referenced by setCollideangle().

00166 {return m_collideangle;} 

HepSymMatrix KinematicFit::covInfit ( int  i  )  const [inline, private]

Definition at line 215 of file KinematicFit.h.

References m_covInfit, and NTRKPAR.

Referenced by pull().

00215 {return m_covInfit.sub(i*NTRKPAR+1, (i+1)*NTRKPAR);}

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

Definition at line 558 of file KinematicFit.cxx.

References D(), KinematicConstraints::Dc(), genRecEmupikp::i, ganga-rec::j, KinematicConstraints::Ltrk(), m_kc, KinematicConstraints::nc(), WTrackParameter::setEw(), TrackPool::setWTrackInfit(), delete_small_size::size, KinematicConstraints::VD(), w, TrackPool::wTrackInfit(), and TrackPool::wTrackOrigin().

00558                                   {
00559     KinematicConstraints kc = m_kc[n];
00560     int nc = kc.nc();
00561     int ntrk = (kc.Ltrk()).size();
00562     HepSymMatrix Va0(7*ntrk, 0);
00563     for (int i = 0; i < ntrk; i++) {
00564         int itk = (kc.Ltrk())[i];
00565         for(int j = 0; j < 7; j++) 
00566             for (int k = 0; k < 7; k++)
00567                 Va0[7*i+j][7*i+k] = (wTrackOrigin(itk).Ew())[j][k];
00568 
00569     }
00570     HepMatrix D(nc, 7*ntrk, 0);
00571     int ncc = 0;
00572     for(int j = 0; j < kc.nc(); j++) {
00573         for(int l = 0; l < ntrk; l++) { 
00574             for(int k = 0; k < 7; k++)
00575                 D[ncc][7*l+k] = (kc.Dc()[l])[j][k];
00576         }
00577         ncc++;
00578     }
00579 
00580 
00581     HepSymMatrix VD(nc, 0);
00582     VD = kc.VD()[0];
00583     HepSymMatrix Va(7*ntrk, 0);
00584     Va = Va0 - (VD.similarity(D.T())).similarity(Va0);
00585     for(int i = 0; i < ntrk; i++) {
00586         int itk = (kc.Ltrk())[i];
00587         HepVector w(7, 0);
00588         HepSymMatrix Ew(7, 0);
00589         for(int j = 0; j < 7; j++) {
00590             for(int k = 0; k < 7; k++) 
00591                 Ew[j][k] = Va[7*i + j] [7*i + k];
00592         }
00593         WTrackParameter wtrk = wTrackInfit(itk);
00594         wtrk.setEw(Ew);
00595         setWTrackInfit(itk, wtrk);
00596     }
00597     m_kc[n] = kc;
00598 
00599 }

HepSymMatrix KinematicFit::covOrigin ( int  i  )  const [inline, private]

Definition at line 214 of file KinematicFit.h.

References m_covOrigin, and NTRKPAR.

00214 {return m_covOrigin.sub(i*NTRKPAR+1, (i+1)*NTRKPAR);}

HepVector KinematicFit::cpu (  )  const [inline]

Definition at line 169 of file KinematicFit.h.

References m_cpu.

00169 {return m_cpu;}

HepMatrix KinematicFit::D ( int  ic,
int  itk 
) const [inline, private]

Definition at line 192 of file KinematicFit.h.

References m_D, and NTRKPAR.

Referenced by covMatrix().

00192 {return m_D.sub(ic+1, ic+1, itk*NTRKPAR+1, (itk+1)*NTRKPAR);}

HepMatrix KinematicFit::DT ( int  itk,
int  ic 
) const [inline, private]

Definition at line 195 of file KinematicFit.h.

References m_DT, and NTRKPAR.

00195 {return m_DT.sub(itk*NTRKPAR+1, (itk+1)*NTRKPAR, ic+1, ic+1);}

bool KinematicFit::dynamicerror (  )  const [inline]

Definition at line 167 of file KinematicFit.h.

References m_dynamicerror.

Referenced by setDynamicerror().

00167 {return m_dynamicerror;}

double KinematicFit::espread (  )  const [inline]

Definition at line 165 of file KinematicFit.h.

References m_espread.

Referenced by setEspread().

00165 {return m_espread;}

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

Definition at line 533 of file KinematicFit.cxx.

References genRecEmupikp::i, m_chisq, m_covOrigin, m_d, m_D, m_DT, m_kc, m_KP, m_nc, m_nktrk, m_pInfit, m_pOrigin, m_VD, NTRKPAR, and TrackPool::numberWTrack().

00533                             {
00534 
00535     if(m_chisq.size() == 0) {
00536         for(unsigned int i = 0; i < m_kc.size(); i++)
00537             m_chisq.push_back(9999.0);
00538     }
00539     KinematicConstraints kc;
00540     int nc = m_nc;
00541     int ntrk = numberWTrack();
00542 
00543     m_VD = HepSymMatrix(m_nc, 0);
00544     m_VD = m_covOrigin.similarity(m_D);
00545     int ifail;
00546     m_VD.invert(ifail);
00547     HepVector G(m_nc, 0);
00548     G = m_D * (m_pOrigin - m_pInfit) + m_d; 
00549     m_KP = HepMatrix(NTRKPAR*m_nktrk, m_nc, 0);
00550     m_KP = m_covOrigin * m_DT * m_VD;
00551     m_chisq[n]  = (m_VD.similarity(G.T()))[0][0];
00552     m_pInfit = m_pOrigin - m_KP * G;
00553 
00554 }

void KinematicFit::fit (  )  [private]

Definition at line 422 of file KinematicFit.cxx.

References gda(), m_chi, m_covOrigin, m_cpu, m_d, m_D, m_DT, m_dynamicerror, m_KP, m_nc, m_nktrk, m_pInfit, m_pOrigin, m_VD, NTRKPAR, TrackPool::numberWTrack(), and timer.

Referenced by Fit().

00422                        {
00423 
00424     KinematicConstraints kc;
00425     int nc = m_nc;
00426     int ntrk = numberWTrack();
00427 
00428     TStopwatch timer;
00429     timer.Start();
00430 
00431     m_VD = HepSymMatrix(m_nc, 0);
00432     m_VD = m_covOrigin.similarity(m_D);
00433     timer.Stop();
00434     m_cpu[1] += timer.CpuTime();
00435     timer.Start();
00436     
00437     int ifail;
00438     m_VD.invert(ifail);
00439     
00440     timer.Stop();
00441     m_cpu[2] += timer.CpuTime();
00442     timer.Start();
00443 
00444     HepVector G(m_nc, 0);
00445     G = m_D * (m_pOrigin - m_pInfit) + m_d; 
00446 
00447     m_KP = HepMatrix(NTRKPAR*m_nktrk, m_nc, 0);
00448     m_KP = m_covOrigin * m_DT * m_VD;
00449     m_chi = (m_VD.similarity(G.T()))[0][0];
00450 
00451 
00452     timer.Stop();
00453     m_cpu[3] += timer.CpuTime();
00454     timer.Start();
00455 
00456     m_pInfit = m_pOrigin - m_KP * G;
00457 
00458     //  ===== gamma dynamic adjustment====
00459 
00460     timer.Stop();
00461     m_cpu[4] += timer.CpuTime();
00462 
00463     timer.Start();
00464     if(m_dynamicerror ==1) 
00465         gda(); 
00466 
00467     timer.Stop();
00468     m_cpu[6] += timer.CpuTime();
00469 }

bool KinematicFit::Fit ( int  n  ) 

Definition at line 741 of file KinematicFit.cxx.

References chisq(), fit(), genRecEmupikp::i, m_chicut, m_chisq, m_chiter, m_covInfit, m_covOrigin, m_d, m_D, m_DT, m_kc, m_massvector, m_nc, m_niter, m_nktrk, m_pInfit, m_pOrigin, mass, NTRKPAR, TrackPool::numberWTrack(), setCovOrigin(), setMassvector(), setPInfit(), setPOrigin(), TrackPool::setWTrackInfit(), updateConstraints(), w, and TrackPool::wTrackOrigin().

00741                             {
00742     bool okfit = false;
00743     if(n < 0 || (unsigned int)n >= m_kc.size()) return okfit;
00744 
00745     m_nktrk = numberWTrack();
00746     m_pOrigin = HepVector(m_nktrk * NTRKPAR, 0);
00747     m_pInfit = HepVector(m_nktrk * NTRKPAR, 0);
00748     m_covOrigin = HepSymMatrix(m_nktrk * NTRKPAR, 0);
00749     m_covInfit = HepSymMatrix(m_nktrk * NTRKPAR, 0);
00750     m_massvector = HepVector(m_nktrk * NTRKPAR, 0);
00751     for(int i = 0; i < numberWTrack(); i++) {
00752         setWTrackInfit(i, wTrackOrigin(i));
00753         setPOrigin(i, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
00754         setPInfit(i, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
00755         setCovOrigin(i, (wTrackOrigin(i).Ew()).sub(1, NTRKPAR));
00756         setMassvector(i, wTrackOrigin(i).mass());
00757     }
00758 
00759     //
00760     // iteration loop
00761     //
00762 
00763     std::vector<double> chisq;
00764     chisq.clear();
00765 
00766     m_D = HepMatrix(m_kc[n].nc(), m_nktrk * NTRKPAR, 0);
00767     m_DT = HepMatrix(m_nktrk * NTRKPAR, m_kc[n].nc(), 0);
00768     m_d = HepVector(m_kc[n].nc(), 0);
00769 
00770     for(int it = 0; it < m_niter; it++) {
00771         m_nc = 0;
00772         KinematicConstraints kc = m_kc[n];
00773         updateConstraints(kc);
00774         //     m_kc[n] = kc;
00775         fit(n);
00776 
00777         chisq.push_back(m_chisq[n]);
00778         if(it > 0) {
00779             double delchi = chisq[it]- chisq[it-1];
00780             if(fabs(delchi) < m_chiter) 
00781                 break;
00782         }
00783     }
00784 
00785     if(m_chisq[n] >= m_chicut) return okfit;
00786     //    ====update cov====
00787     //   upCovmtx();
00788     okfit = true;
00789     return okfit;
00790 }

bool KinematicFit::Fit (  ) 

Definition at line 604 of file KinematicFit.cxx.

References chisq(), fit(), genRecEmupikp::i, m_chi, m_chicut, m_chiter, m_covInfit, m_covOrigin, m_cpu, m_d, m_D, m_DT, m_kc, m_massvector, m_nc, m_niter, m_nktrk, m_pInfit, m_pOrigin, mass, NTRKPAR, TrackPool::numberWTrack(), setCovOrigin(), setMassvector(), setPInfit(), setPOrigin(), TrackPool::setWTrackInfit(), timer, updateConstraints(), w, and TrackPool::wTrackOrigin().

Referenced by Pi0EtaToGGRecAlg::execute(), CalibEventSelect::execute(), JsiLL::execute(), DQARhopi::execute(), DQAKsKpi::execute(), Ppjrhopi::execute(), and Pi0::Pi0ListToTDS().

00604                        {
00605     bool okfit = false;
00606     TStopwatch timer;
00607     m_nktrk = numberWTrack();
00608     m_pOrigin = HepVector(m_nktrk * NTRKPAR, 0);
00609     m_pInfit = HepVector(m_nktrk * NTRKPAR, 0);
00610     m_covOrigin = HepSymMatrix(m_nktrk * NTRKPAR, 0);
00611     m_covInfit = HepSymMatrix(m_nktrk * NTRKPAR, 0);
00612     m_massvector = HepVector(m_nktrk, 0);
00613     for(int i = 0; i < numberWTrack(); i++) {
00614         setWTrackInfit(i, wTrackOrigin(i));
00615         setPOrigin(i, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
00616         setPInfit(i, (wTrackOrigin(i).w()).sub(1, NTRKPAR));
00617         setCovOrigin(i, (wTrackOrigin(i).Ew()).sub(1, NTRKPAR));
00618         setMassvector(i, wTrackOrigin(i).mass());
00619     }
00620     
00621     //
00622     // iteration
00623     //
00624     //    cout<<"m_pInfit ="<<m_pInfit<<endl;
00625     //    cout<<"m_covOrigin="<<m_covOrigin<<endl;
00626     //    cout<<"m_massvector ="<<m_massvector<<endl;
00627 
00628     std::vector<double> chisq;
00629     chisq.clear();
00630     int nc = 0;
00631     for(int i = 0; i < m_kc.size(); i++)
00632         nc += m_kc[i].nc();
00633 
00634     m_D = HepMatrix(nc, m_nktrk * NTRKPAR, 0);
00635     m_DT = HepMatrix(m_nktrk * NTRKPAR, nc, 0);
00636     m_d = HepVector(nc, 0);
00637 
00638     for(int it = 0; it < m_niter; it++) {
00639 
00640         timer.Start();
00641         m_nc = 0;
00642         for(unsigned int i = 0; i < m_kc.size(); i++) {
00643             KinematicConstraints kc = m_kc[i];
00644             //      std::vector<WTrackParameter> wlis;
00645             //      std::vector<WTrackParameter> wlis_V;
00646             //      wlis.clear();
00647             //      wlis_V.clear();
00648             //      for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
00649             //  int n = (kc.Ltrk())[j];
00650             //  WTrackParameter wtrk = wTrackInfit(n);
00651             //       if(m_espread!=0)    wtrk = wTrackOrigin(n);
00652             //  wlis.push_back(wtrk);
00653             //      } 
00654             //      for(unsigned int j = 0; j < (kc.Ltrk_V()).size(); j++) {
00655             //  int n = (kc.Ltrk_V())[j];
00656             //  WTrackParameter wtrk = wTrackInfit_V(n);
00657             //  wlis_V.push_back(wtrk);
00658             //      } 
00659             //      kc.UpdateConstraints(wlis, wlis_V);
00660             //      m_kc[i] = kc;
00661             //cout<<"wlis_V ="<<(wlis_V[0].w())[0]<<endl;     
00662             updateConstraints(kc);
00663             //      std::cout << "updata OK " << m_d << std::endl;
00664         }
00665         timer.Stop();
00666         m_cpu[0] += timer.CpuTime();
00667 
00668         fit();  
00669         chisq.push_back(m_chi);
00670         if(it > 0) {
00671             double delchi = chisq[it]- chisq[it-1];
00672             if(fabs(delchi) < m_chiter) 
00673                 break;
00674         }
00675     }
00676     if(m_chi >= m_chicut) {
00677 
00678         return okfit;
00679     }
00680     // update track parameter and its covariance matrix
00681     //    upTrkpar();
00682     //    covMatrix();
00683     timer.Start();
00684     //upCovmtx();
00685     timer.Stop();
00686     m_cpu[5] += timer.CpuTime();
00687 
00688     okfit = true;
00689 
00690     /*
00691        for (int i = 0; i<numberWTrack(); i++){
00692        if (wTrackOrigin(i).charge()==0) continue ;
00693        HTrackParameter horigin = HTrackParameter(wTrackOrigin(i));
00694        HTrackParameter hinfit = HTrackParameter(wTrackInfit(i));
00695 
00696        HepVector a0 = horigin.hel();
00697        HepVector a1 = hinfit.hel();
00698        HepSymMatrix v0 = horigin.eHel();
00699        HepSymMatrix v1 = hinfit.eHel(); 
00700        HepVector pull(5,0);
00701        for (int k=0; k<5; k++) {
00702        pull[k] = (a0[k]-a1[k])/sqrt(abs(v0[k][k]-v1[k][k]));
00703        }
00704 
00705        WTrackParameter wtrk2 = wTrackInfit(i);
00706        wtrk2.setPull(pull);
00707     //    for (int l=0;l<5; l++) {
00708     //(wTrackInfit(i).pull())[l]=(wtrk2.pull())[l];
00709     //   }
00710     setWTrackInfit(i, wtrk2);
00711     }
00712     */
00713     /*/
00714 
00715       for (int i = 0; i<numberWTrack_V(); i++){ 
00716     //if (wTrackOrigin(i).charge()==0) continue ;
00717     HTrackParameter horigin_V = HTrackParameter(wTrackOrigin_V(i));
00718     HTrackParameter hinfit_V = HTrackParameter(wTrackInfit_V(i));
00719 
00720     HepVector a0 = horigin.hel();
00721     HepVector a1 = hinfit.hel();
00722     HepSymMatrix v0 = horigin.eHel();
00723     HepSymMatrix v1 = hinfit.eHel();
00724     HepVector pull(5,0);
00725     for (int k=0; k<5; k++) {
00726     pull[k] = (a0[k]-a1[k])/sqrt(abs(v0[k][k]-v1[k][k]));
00727     }
00728 
00729     WTrackParameter wtrk2 = wTrackInfit(i);
00730     wtrk2.setPull(pull);
00731     //    for (int l=0;l<5; l++) {
00732     //(wTrackInfit(i).pull())[l]=(wtrk2.pull())[l];
00733     //   }
00734     setWTrackInfit(i, wtrk2);
00735     }  
00736     */
00737 
00738     return okfit;
00739 }

void KinematicFit::fits (  )  [private]

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 gda(), and KalmanKinematicFit::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 gda(), and KalmanKinematicFit::gda().

00095 {return m_gammashape;}

void KinematicFit::gda (  )  [private]

Definition at line 834 of file KinematicFit.cxx.

References TrackPool::GammaShapeList(), TrackPool::GammaShapeValue(), genRecEmupikp::i, ganga-rec::j, NTRKPAR, TrackPool::numberGammaShape(), TrackPool::numberWTrack(), p4Infit(), pOrigin(), setCovOrigin(), type, and TrackPool::wTrackOrigin().

Referenced by fit().

00834                       {
00835         for(int i = 0; i < numberWTrack(); i++) {
00836 
00837                 if ((wTrackOrigin(i)).type() == 2 ){
00838                         int n ;
00839                         for(int j = 0; j < numberGammaShape(); j++) {
00840                                 if(i==GammaShapeList(j))  n = j;
00841                         }
00842                         HepSymMatrix Ew(NTRKPAR, 0);
00843                         HepLorentzVector p1 = p4Infit(i);
00844                         double eorigin = pOrigin(i)[3];
00845                         //cout<<"p1 ="<<p1<<endl;
00846                         HepMatrix dwda1(NTRKPAR, 3, 0);
00847                         dwda1[0][0] = -p1.py();
00848                         dwda1[1][0] = p1.px();
00849                         dwda1[0][1] = p1.px()*p1.pz()/p1.perp();
00850                         dwda1[1][1] = p1.py()*p1.pz()/p1.perp();
00851                         dwda1[2][1] = -p1.perp();
00852                         dwda1[0][2] = p1.px()/p1.rho();
00853                         dwda1[1][2] = p1.py()/p1.rho();
00854                         dwda1[2][2] = p1.pz()/p1.rho();
00855                         dwda1[3][2] = p1.rho()/p1.e();
00856                         HepSymMatrix emcmea1(3, 0);
00857                         double pk = p1[3];
00858                         emcmea1[0][0] = GammaShapeValue(n).getdphi() * GammaShapeValue(n).getdphi();
00859                         emcmea1[1][1] = GammaShapeValue(n).getdthe() * GammaShapeValue(n).getdthe();
00860                         emcmea1[2][2] = GammaShapeValue(n).de(eorigin,pk) * GammaShapeValue(n).de(eorigin,pk);
00861                         Ew = emcmea1.similarity(dwda1);
00862                         //cout<<"emcmea1 ="<<emcmea1<<endl;
00863                         //cout<<"Ew ="<<Ew<<endl;
00864                         setCovOrigin(i, Ew); 
00865                 } 
00866         }
00867 }

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

Definition at line 147 of file TrackPool.h.

References TrackPool::m_BeamPosition.

Referenced by KalmanKinematicFit::Fit().

00147 {return m_BeamPosition;}

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

Definition at line 148 of file TrackPool.h.

References TrackPool::m_VBeamPosition.

Referenced by KalmanKinematicFit::Fit().

00148 {return m_VBeamPosition;}

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

Definition at line 161 of file KinematicFit.h.

References TrackPool::wTrackInfit().

00161 {return wTrackInfit(n);}

void KinematicFit::init (  ) 

Definition at line 33 of file KinematicFit.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_kalman, m_kc, m_massvector, m_nc, m_niter, m_virtual_wtrk, TrackPool::setBeamPosition(), and TrackPool::setVBeamPosition().

Referenced by Pi0EtaToGGRecAlg::execute(), CalibEventSelect::execute(), JsiLL::execute(), DQARhopi::execute(), DQAKsKpi::execute(), Ppjrhopi::execute(), and Pi0::Pi0ListToTDS().

00033                         {
00034     clearWTrackOrigin();
00035     clearWTrackInfit();
00036     clearWTrackList();
00037     //For Virtual Particles
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     //=============  
00050     m_kc.clear();
00051     m_chisq.clear();
00052     m_chi = 9999.;
00053     m_niter = 10;
00054     m_chicut = 200.;
00055     m_chiter = 0.005;
00056     m_espread = 0.0;
00057     m_kalman = 0;
00058     m_collideangle = 11e-3;
00059     m_flag = 0;
00060     m_dynamicerror = 0; 
00061     m_nc = 0;
00062     m_cpu = HepVector(10, 0);
00063     m_massvector = HepVector(12,0);
00064     m_virtual_wtrk.clear(); 
00065 }

KinematicFit * KinematicFit::instance (  )  [static]

Definition at line 20 of file KinematicFit.cxx.

References KinematicFit(), and m_pointer.

Referenced by Pi0EtaToGGRecAlg::execute(), CalibEventSelect::execute(), JsiLL::execute(), DQARhopi::execute(), DQAKsKpi::execute(), Ppjrhopi::execute(), and Pi0::Pi0ListToTDS().

00020                                       {
00021     if(m_pointer) return m_pointer;
00022     m_pointer = new KinematicFit();
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 KalmanKinematicFit::Fit(), KalmanKinematicFit::gda(), KalmanKinematicFit::getCInfit(), KalmanKinematicFit::getCOrigin(), KalmanKinematicFit::pInfit(), KalmanKinematicFit::pOrigin(), KalmanKinematicFit::pull(), and KalmanKinematicFit::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 KalmanKinematicFit::Fit(), KalmanKinematicFit::gda(), KalmanKinematicFit::getCInfit(), KalmanKinematicFit::getCOrigin(), KalmanKinematicFit::pInfit(), KalmanKinematicFit::pOrigin(), KalmanKinematicFit::pull(), and KalmanKinematicFit::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 KalmanKinematicFit::Fit(), KalmanKinematicFit::gda(), KalmanKinematicFit::getCInfit(), KalmanKinematicFit::getCOrigin(), KalmanKinematicFit::pInfit(), KalmanKinematicFit::pOrigin(), KalmanKinematicFit::pull(), and KalmanKinematicFit::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 gda(), and KalmanKinematicFit::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 KalmanKinematicFit::BuildVirtualParticle(), KalmanKinematicFit::Fit(), KalmanKinematicFit::fit(), and KalmanKinematicFit::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 KalmanKinematicFit::Fit(), KalmanKinematicFit::fit(), and KalmanKinematicFit::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 AddFourMomentum(), KalmanKinematicFit::AddFourMomentum(), AddThreeMomentum(), KalmanKinematicFit::AddThreeMomentum(), TrackPool::AddTrack(), TrackPool::AddTrackVertex(), VertexFit::Fit(), Fit(), fit(), KalmanKinematicFit::Fit(), KalmanKinematicFit::fit(), gda(), KalmanKinematicFit::gda(), and upCovmtx().

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

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

Definition at line 160 of file KinematicFit.h.

References TrackPool::wTrackOrigin().

Referenced by p4Infit(), and p4Origin().

00160 {return wTrackOrigin(n);}

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

Definition at line 211 of file KinematicFit.h.

References mass, origin(), and pInfit().

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

00211 { HepVector p(3, 0); p = pInfit(i);  double E = sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2] + origin(i).mass() * origin(i).mass());  return HepLorentzVector(p[0], p[1], p[2], E); }   //modified by yanl 2010.7.26 for changing the wtrackparameters

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

Definition at line 209 of file KinematicFit.h.

References mass, origin(), and pOrigin().

Referenced by pfit1().

00209 { HepVector p(3, 0); p = pOrigin(i); double E = sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2] + origin(i).mass() * origin(i).mass());return HepLorentzVector(p[0], p[1], p[2], E);}  //modified by yanl 2010.7.26 for changing the wtrackparameters

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

Definition at line 154 of file KinematicFit.h.

References p4Infit().

Referenced by Pi0EtaToGGRecAlg::execute(), JsiLL::execute(), DQARhopi::execute(), DQAKsKpi::execute(), Ppjrhopi::execute(), and Pi0::Pi0ListToTDS().

00154 {return p4Infit(n);}

HepLorentzVector KinematicFit::pfit1 ( int  n  )  const [inline]

Definition at line 157 of file KinematicFit.h.

References p4Origin().

00157 {return p4Origin(n);}

HepVector KinematicFit::pInfit ( int  i  )  const [inline, private]

Definition at line 210 of file KinematicFit.h.

References m_pInfit, and NTRKPAR.

Referenced by p4Infit(), and pull().

00210 {return m_pInfit.sub(i*NTRKPAR+1, (i+1)*NTRKPAR);}

HepVector KinematicFit::pOrigin ( int  i  )  const [inline, private]

Definition at line 208 of file KinematicFit.h.

References m_pOrigin, and NTRKPAR.

Referenced by gda(), and p4Origin().

00208 {return m_pOrigin.sub(i*NTRKPAR+1, (i+1)*NTRKPAR);}

HepVector KinematicFit::pull ( int  n  ) 

Definition at line 870 of file KinematicFit.cxx.

References a0, abs, covInfit(), HTrackParameter::eHel(), HTrackParameter::hel(), genRecEmupikp::i, ganga-rec::j, p4Infit(), pInfit(), WTrackParameter::setEw(), WTrackParameter::setW(), TrackPool::setWTrackInfit(), upCovmtx(), w, TrackPool::wTrackInfit(), and TrackPool::wTrackOrigin().

00870                                  {
00871         upCovmtx();
00872 
00873         if (wTrackOrigin(n).charge()!=0){
00874                 HepVector W(6,0);
00875                 HepSymMatrix Ew(6,0);
00876                 HepVector W1(7,0);
00877                 HepSymMatrix Ew1(7,0);
00878                 WTrackParameter wtrk = wTrackOrigin(n);
00879                 //                W = wTrackOrigin(n).w();
00880                 //                Ew = wTrackOrigin(n).Ew();
00881                 //cout<<"===Origin status==="<<endl;
00882                 //cout<<"W = "<<W<<endl;
00883                 //cout<<"Ew ="<<Ew<<endl; 
00884                 for(int i=0; i<3; i++) {
00885                         W[i] = pInfit(n)[i];
00886                 }
00887                 W[3] = wTrackOrigin(n).w()[4];
00888                 W[4] = wTrackOrigin(n).w()[5];
00889                 W[5] = wTrackOrigin(n).w()[6];
00890                 for(int j=0; j<3; j++) {
00891                         for(int k=0; k<3; k++) {
00892                                 Ew[j][k] = covInfit(n)[j][k];
00893                         }
00894                 }
00895 
00896                 for(int j=3; j<6; j++) {
00897                         for(int k=3; k<6; k++) {
00898                                 Ew[j][k] = wTrackOrigin(n).Ew()[j+1][k+1];
00899                         }
00900                 }
00901                 //
00902                 // define J matrix to transfer 3 parameters to 4 parameters
00903                 // 
00904                 double px = p4Infit(n).px();
00905                 double py = p4Infit(n).py();
00906                 double pz = p4Infit(n).pz();
00907                 double e  = p4Infit(n).e(); 
00908                 HepMatrix J(7, 6, 0);
00909                 J[0][0] = 1;
00910                 J[1][1] = 1;
00911                 J[2][2] = 1;
00912                 J[3][0] = px/e;
00913                 J[3][1] = py/e;
00914                 J[3][2] = pz/e;
00915                 J[4][3] = 1;
00916                 J[5][4] = 1;
00917                 J[6][5] = 1;
00918                 W1 = J * W;
00919                 Ew1 = Ew.similarity(J) ;
00920 
00921 
00922 
00923                 // cout<<"===Infiddt status==="<<endl;
00924                 // cout<<"p4 ="<<p4Infit(n)<<endl;
00925                 // cout<<"W ="<<wTrackOrigin(n).w()<<endl;
00926                 // cout<<"W1 ="<<W1<<endl;
00927                 // cout<<"Ew ="<<wTrackOrigin(n).Ew()<<endl;
00928                 // cout<<"Ew1 ="<<Ew1<<endl;
00929 
00930                 wtrk.setW(W1);
00931                 wtrk.setEw(Ew1);
00932                 setWTrackInfit(n, wtrk); 
00933                 HTrackParameter horigin = HTrackParameter(wTrackOrigin(n));
00934                 HTrackParameter hinfit = HTrackParameter(wTrackInfit(n));
00935 
00936                 HepVector a0 = horigin.hel();
00937                 HepVector a1 = hinfit.hel();
00938                 HepSymMatrix v0 = horigin.eHel();
00939                 HepSymMatrix v1 = hinfit.eHel(); 
00940                 HepVector pull(11,0);
00941                 for (int k=0; k<5; k++) {
00942                         pull[k] = (a0[k]-a1[k])/sqrt(abs(v0[k][k]-v1[k][k]));
00943                 //      cout<<"pull ["<<k<<"] ="<<pull[k]<<endl;
00944                 }
00945                 for (int l=5; l<9; l++) {
00946                         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]));
00947                         //        cout<<"pull ["<<l<<"] ="<<pull[l]<<endl;
00948                 }
00949                 
00950                 //                pull[9] = wTrackOrigin(n).w()[3] - wTrackInfit(n).w()[3];
00951                 //                pull[10] =1/sqrt(abs(wTrackOrigin(n).Ew()[3][3] - wTrackInfit(n).Ew()[3][3]));  
00952                 return pull;  
00953         }else {
00954                 HepVector pull(3,0);
00955                 for (int m=0; m<3; m++) {
00956                         pull[m] = (wTrackOrigin(n).w()[m] - wTrackInfit(n).w()[m])/sqrt(abs(wTrackOrigin(n).Ew()[m][m] - wTrackInfit(n).Ew()[m][m]));
00957                 }
00958                 return pull;
00959         }
00960 }

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

Definition at line 143 of file TrackPool.h.

References TrackPool::m_BeamPosition.

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

00143 {m_BeamPosition = BeamPosition;}

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

Definition at line 132 of file KinematicFit.h.

References m_chicut, and m_chiter.

00132 {m_chicut = chicut;m_chiter=chiter;}

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

Definition at line 138 of file KinematicFit.h.

References collideangle(), and m_collideangle.

void KinematicFit::setCovInfit ( int  i,
const HepSymMatrix &  c 
) [inline, private]

Definition at line 217 of file KinematicFit.h.

References m_covInfit, and NTRKPAR.

00217 {m_covInfit.sub(i*NTRKPAR+1,c);}

void KinematicFit::setCovOrigin ( int  i,
const HepSymMatrix &  c 
) [inline, private]

Definition at line 216 of file KinematicFit.h.

References m_covOrigin, and NTRKPAR.

Referenced by Fit(), and gda().

00216 {m_covOrigin.sub(i*NTRKPAR+1, c);}

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

Definition at line 193 of file KinematicFit.h.

References m_D, and NTRKPAR.

Referenced by updateConstraints().

00193 {m_D.sub(ic+1, itk*NTRKPAR+1, p);}

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

Definition at line 196 of file KinematicFit.h.

References m_DT, and NTRKPAR.

Referenced by updateConstraints().

00196 { m_DT.sub(itk*NTRKPAR+1, ic+1, p);}

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

Definition at line 139 of file KinematicFit.h.

References dynamicerror(), and m_dynamicerror.

Referenced by DQARhopi::execute(), and Ppjrhopi::execute().

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

Definition at line 137 of file KinematicFit.h.

References espread(), and m_espread.

00137 {m_espread = espread;}

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

Definition at line 130 of file KinematicFit.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 KinematicFit::setIterNumber ( const int  niter = 5  )  [inline]

Definition at line 131 of file KinematicFit.h.

References m_niter.

Referenced by Pi0EtaToGGRecAlg::execute().

00131 {m_niter = niter;}

void KinematicFit::setKalman ( const int  kalman  )  [inline]

Definition at line 136 of file KinematicFit.h.

References m_kalman.

00136 {m_kalman = kalman;}

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 KinematicFit::setMassvector ( int  i,
const double  mass 
) [inline, private]

Definition at line 218 of file KinematicFit.h.

References m_massvector.

Referenced by Fit().

00218 {m_massvector[i] = mass;}

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

Definition at line 213 of file KinematicFit.h.

References m_pInfit, and NTRKPAR.

Referenced by Fit().

00213 {m_pInfit.sub(i*NTRKPAR+1, p);}

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

Definition at line 212 of file KinematicFit.h.

References m_pOrigin, and NTRKPAR.

Referenced by Fit().

00212 { m_pOrigin.sub(i*NTRKPAR+1, p);}

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

Definition at line 144 of file TrackPool.h.

References TrackPool::m_VBeamPosition.

Referenced by Gam4pikp::execute(), init(), KalmanKinematicFit::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(), covMatrix(), VertexFit::Fit(), Fit(), KalmanKinematicFit::Fit(), pull(), KalmanKinematicFit::pull(), VertexFit::swimVertex(), and 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 KinematicFit::upCovmtx (  )  [private]

Definition at line 475 of file KinematicFit.cxx.

References genRecEmupikp::i, I, ganga-rec::j, m_covInfit, m_covOrigin, m_D, m_KP, m_nktrk, NTRKPAR, TrackPool::numberWTrack(), p4Infit(), WTrackParameter::setEw(), WTrackParameter::setW(), TrackPool::setWTrackInfit(), TrackPool::wTrackInfit(), and TrackPool::wTrackOrigin().

Referenced by BuildVirtualParticle(), and pull().

00475                             {
00476 
00477     int ntrk = numberWTrack();
00478     HepSymMatrix I(NTRKPAR*m_nktrk, 1);
00479     m_covInfit = m_covOrigin.similarity(I - m_KP*m_D);
00480     for(int i = 0; i < m_nktrk; i++) {
00481         HepSymMatrix ew3 (3, 0);          
00482         HepSymMatrix ew6 (6, 0);
00483         HepSymMatrix Ew1 (7, 0);
00484         ew3 = m_covInfit.sub(i*NTRKPAR + 1, (i+1)*NTRKPAR);
00485         for(int j = 0; j < NTRKPAR; j++) {
00486             for(int k = 0; k < NTRKPAR; k++) {
00487                 ew6[j][k] = ew3[j][k];
00488             }
00489         }
00490         for(int m = NTRKPAR; m < 6; m++) {
00491             for(int n = NTRKPAR; n < 6; n++) {
00492                 ew6[m][n] = 0;//(wTrackOrigin(i).Ew())[m+1][n+1];
00493             }
00494         }
00495         double px = p4Infit(i).px();
00496         double py = p4Infit(i).py();
00497         double pz = p4Infit(i).pz();
00498         double m =  p4Infit(i).m();
00499         double e =  p4Infit(i).e();
00500 
00501         HepMatrix J(7, 6, 0);
00502         J[0][0] = 1;
00503         J[1][1] = 1;
00504         J[2][2] = 1;
00505         J[3][0] = px/e;
00506         J[3][1] = py/e;
00507         J[3][2] = pz/e;
00508         J[4][3] = 1;
00509         J[5][4] = 1;
00510         J[6][5] = 1;
00511         Ew1 = ew6.similarity(J);
00512 
00513         HepVector W(7, 0);
00514         for(int j=0; j<4; j++) {
00515             W[j] = p4Infit(i)[j];
00516         }
00517         W[4] = wTrackOrigin(i).w()[4];
00518         W[5] = wTrackOrigin(i).w()[5];
00519         W[6] = wTrackOrigin(i).w()[6];
00520         
00521 
00522         WTrackParameter wtrk = wTrackInfit(i);
00523         wtrk.setEw(Ew1);
00524         wtrk.setW(W);
00525         setWTrackInfit(i, wtrk);
00526     }
00527 
00528 
00529 }    

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

Definition at line 963 of file KinematicFit.cxx.

References dc, EqualMass, KinematicConstraints::etot(), FourMomentum, genRecEmupikp::i, ganga-rec::j, KinematicConstraints::Ltrk(), m_d, m_nc, KinematicConstraints::mres(), n1, n2, KinematicConstraints::nc(), NTRKPAR, KinematicConstraints::numEqual(), KinematicConstraints::p3(), KinematicConstraints::p4(), p4Infit(), KinematicConstraints::ptot(), Resonance, setD(), setDT(), delete_small_size::size, T, ThreeMomentum, TotalEnergy, TotalMomentum, KinematicConstraints::Type(), and type.

Referenced by Fit().

00963                                                             {
00964         KinematicConstraints kc = k;
00965 
00966         //   std::vector<HepLorentzVector> wlis;
00967         //   std::vector<WTrackParameter> wlis_V;
00968         //   wlis.clear();
00969         //   wlis_V.clear();
00970         //   for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
00971         //      int n = (kc.Ltrk())[j];
00972         //        HepVec wtrk = wTrackInfit(n);
00973         //       if(m_espread!=0)        wtrk = wTrackOrigin(n);
00974 
00975         //       wlis.push_back(p4Infit(n));
00976         //   }
00977         //    for(unsigned int j = 0; j < (kc.Ltrk_V()).size(); j++) {
00978         //      int n = (kc.Ltrk_V())[j];
00979         //      WTrackParameter wtrk = wTrackInfit_V(n);
00980         //       wlis_V.push_back(wtrk);
00981         //  }
00982 
00983 
00984         int type = kc.Type();
00985         switch(type) {
00986                 case  Resonance: {
00987                                          //
00988                                          //  E^2 - px^2 - py^2 - pz^2 = mres^2
00989                                          //
00990                                          double mres = kc.mres();
00991                                          HepLorentzVector pmis;
00992                                          for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
00993                                                  int n = (kc.Ltrk())[j];
00994 
00995                                                  pmis = pmis + p4Infit(n);
00996                                          }
00997                                          //    for(unsigned int i = 0; i < wlis_V.size(); i++)
00998                                          //      pmis = pmis + wlis_V[i].p();
00999                                          for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
01000                                                  int n = (kc.Ltrk())[j];
01001                                                  HepMatrix Dc(1, NTRKPAR, 0);
01002                                                  Dc[0][0] = -2 * pmis.px() + 2 * pmis.e() * p4Infit(n).px() / p4Infit(n).e();
01003                                                  Dc[0][1] = -2 * pmis.py() + 2 * pmis.e() * p4Infit(n).py() / p4Infit(n).e();
01004                                                  Dc[0][2] = -2 * pmis.pz() + 2 * pmis.e() * p4Infit(n).pz() / p4Infit(n).e();
01005                                                  //                                              Dc[0][3] = 2 * pmis.e();
01006                                                  setD(m_nc,n,Dc);
01007                                                  setDT(n, m_nc, Dc.T());
01008                                          }      
01009 
01010                                          // for(unsigned int i = 0; i < wlis_V.size(); i++) {
01011                                          //      HepMatrix Dc_V(1, 7, 0);
01012                                          //      Dc_V[0][0] = -2 * pmis.px();
01013                                          //      Dc_V[0][1] = -2 * pmis.py();
01014                                          //      Dc_V[0][2] = -2 * pmis.pz();
01015                                          //     Dc_V[0][3] = 2 * pmis.e();
01016                                          //      m_Dc_V.push_back(Dc_V);
01017                                          //    }
01018 
01019 
01020                                          HepVector dc(1, 0);
01021                                          dc[0] = pmis.m2() - mres * mres;
01022                                          m_d[m_nc] = dc[0];
01023                                          m_nc+=1;
01024                                          //    std::cout << "etot = " << dc[0] <<" , " << mres<< std::endl;
01025                                          //    m_dc.push_back(dc);
01026                                          //    HepVector lambda(1, 0);
01027                                          //    m_lambda.push_back(lambda);
01028                                          //    HepSymMatrix vd(1, 0);
01029                                          //    m_VD.push_back(vd);
01030                                          //    HepSymMatrix V6 = m_Vre;
01031                                          //    m_Vm.push_back(V6);
01032 
01033                                          break;
01034                                  }
01035                 case TotalEnergy: {
01036                                           //
01037                                           //  E - Etot = 0
01038                                           //
01039                                           double etot = kc.etot();
01040                                           HepLorentzVector pmis;
01041                                           for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++){
01042                                                   int n = (kc.Ltrk())[j];
01043                                                   pmis = pmis + p4Infit(n);
01044                                           }
01045                                           //    for(unsigned int i = 0; i < wlis.size(); i++)
01046                                           //      pmis = pmis + wlis[i].p();
01047                                           for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
01048                                                   int n = (kc.Ltrk())[j];
01049                                                   HepMatrix Dc(1, NTRKPAR, 0);
01050                                                   Dc[0][0] = p4Infit(n).px()/p4Infit(n).e();
01051                                                   Dc[0][1] = p4Infit(n).py()/p4Infit(n).e();
01052                                                   Dc[0][2] = p4Infit(n).pz()/p4Infit(n).e();
01053                                                   //      Dc[0][3] = 1.0;
01054                                                   setD(m_nc,n,Dc);
01055                                                   setDT(n, m_nc, Dc.T());
01056                                           }
01057                                           HepVector dc(1, 0);
01058                                           dc[0] = pmis.e() - etot;
01059                                           m_d[m_nc] = dc[0];
01060                                           m_nc+=1;
01061                                           //    m_dc.push_back(dc);
01062                                           //    HepVector lambda(1, 0);
01063                                           //    m_lambda.push_back(lambda);
01064                                           //    HepSymMatrix vd(1, 0);
01065                                           //    m_VD.push_back(vd);
01066                                           break;
01067                                   }
01068                 case TotalMomentum: {
01069                                             //
01070                                             //  sqrt(px^2+py^2+pz^2) - ptot = 0
01071                                             //
01072                                             double ptot = kc.ptot();
01073                                             HepLorentzVector pmis;
01074                                             for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
01075                                                     int n = (kc.Ltrk())[j];
01076                                                     pmis = pmis + p4Infit(n);
01077                                             }
01078 
01079                                             //    for(unsigned int i = 0; i < wlis.size(); i++)
01080                                             //      pmis = pmis + wlis[i].p();
01081                                             for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
01082                                                     int n = (kc.Ltrk())[j];
01083                                                     HepMatrix Dc(1, NTRKPAR, 0);
01084                                                     Dc[0][0] = pmis.px()/pmis.rho();
01085                                                     Dc[0][1] = pmis.py()/pmis.rho();
01086                                                     Dc[0][2] = pmis.pz()/pmis.rho();
01087                                                     setD(m_nc,n,Dc);
01088                                                     setDT(n, m_nc, Dc.T());
01089                                                     //      m_Dc.push_back(Dc);
01090                                             }
01091                                             HepVector dc(1, 0);
01092                                             dc[0] = pmis.rho() - ptot;
01093                                             m_d[m_nc] = dc[0];
01094                                             m_nc+=1;     
01095                                             //    m_dc.push_back(dc);
01096                                             //    HepVector lambda(1, 0);
01097                                             //    m_lambda.push_back(lambda);
01098                                             //    HepSymMatrix vd(1, 0);
01099                                             //    m_VD.push_back(vd);
01100                                             break;
01101                                     }
01102                                     /*
01103                                        case kc.typePoint(): {
01104                                        HepPoint3D point = kc.point();
01105                                        double flightpath;
01106                                        HepMatrix p(2,3,0);
01107 
01108                                        HepSymMatrix Vp(2,0);
01109                                        for(unsigned int i = 0; i < wlis.size(); i++) {
01110                                        HepMatrix Dc(2, 7, 0);
01111                                        m_Dc.push_back(Dc);
01112                                        }
01113                                     // wlis_V.size() should be 1
01114                                     for(unsigned int i = 0; i < wlis_V.size(); i++) {
01115                                     //      HepMatrix Dc(3, 7, 0);
01116                                     //      m_Dc.push_back(Dc);
01117                                     HepMatrix Dc_V(2, 7, 0);
01118                                     HepSymMatrix Vclus(3, 0); 
01119                                     for(unsigned int j = 0; j < 3; j++){
01120                                     for(unsigned int k = j; k < 3; k++){
01121                                     Vclus[j][k] = wlis_V[i].Ew()[j+4][k+4];
01122                                     }
01123                                     }
01124                                     cout<<"Vclus ="<<Vclus<<endl;       
01125                                     p[0][0] = wlis_V[i].w()[1];
01126                                     p[0][1] = -wlis_V[i].w()[0];
01127                                     p[1][0] = wlis_V[i].w()[2];
01128                                     p[1][2] = -wlis_V[i].w()[0];
01129                                     Vp = Vclus.similarity(p);   
01130                                     cout<<"Vp ="<<Vp<<endl;
01131                                     Dc_V[0][0] = -(wlis_V[i].w()[5] - point[1]);
01132                                     Dc_V[0][1] = wlis_V[i].w()[4] - point[0];
01133                                     Dc_V[0][4] = wlis_V[i].w()[1];
01134                                     Dc_V[0][5] = -wlis_V[i].w()[0];
01135 
01136                                     Dc_V[1][0] = -(wlis_V[i].w()[6] - point[2]);
01137                                     Dc_V[1][2] = wlis_V[i].w()[4] - point[0];
01138                                     Dc_V[1][4] = wlis_V[i].w()[2];
01139                                     Dc_V[1][6] = -wlis_V[i].w()[0];
01140 
01141                                     //      HepMatrix q_x(3,1,0) ;
01142                                     //      q_x[0][0] = 1;
01143                                     //      HepMatrix deltaX_x(3,1,0) ;
01144                                     //      deltaX_x[0][0] = 1;
01145                                     //      HepMatrix p1_x = -(q_x.T()*Vclus.inverse(iver)*deltaX)*p2 + p1*(q_x.T()*Vclus.inverse(iver)*q + q.T()*Vclus.inverse(iver)*q_x);
01146                                     //      HepMatrix p2_x = p2*p2;
01147 
01148                                     //      HepMatrix q_y(3,1,0) ;
01149                                     //      q_y[1][0] = 1;
01150                                     //      HepMatrix deltaX_y(3,1,0);
01151                                     //      deltaX_y[1][0] = 1;
01152                                     //      HepMatrix p1_y = -(q_y.T()*Vclus.inverse(iver)*deltaX)*p2 + p1*(q_y.T()*Vclus.inverse(iver)*q + q.T()*Vclus.inverse(iver)*q_y);
01153                                     //      HepMatrix p2_y = p2*p2;
01154 
01155                                     //      HepMatrix q_z(3,1,0);
01156                                     //      q_z[2][0] = 1;
01157                                     //      HepMatrix deltaX_z(3,1,0);
01158                                     //      deltaX_z[2][0] = 1;
01159                                     //      Hw()[0]<<endl;
01160                                     //cout<<"dc[0] ="<<dc[0]<<endl; 
01161                                     dc[1] = (wlis_V[i].w()[4] - point[0])*wlis_V[i].w()[2] - (wlis_V[i].w()[6] - point[2])*wlis_V[i].w()[0];
01162                                     m_dc.push_back(dc);
01163                                     }
01164                                     HepSymMatrix V3 = Vp;
01165                                     m_Vm.push_back(V3);
01166                                     break;
01167                                     } 
01168                                     */
01169 
01170                 case ThreeMomentum: {
01171                                             //
01172                                             //  px - p3x = 0
01173                                             //  py - p3y = 0
01174                                             //  pz - p3z = 0
01175                                             //
01176                                             Hep3Vector p3 = kc.p3();
01177                                             HepLorentzVector pmis;
01178                                             for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
01179                                                     int n = (kc.Ltrk())[j];
01180                                                     pmis = pmis + p4Infit(n);
01181                                             }
01182                                             //    for(unsigned int i = 0; i < wlis.size(); i++)
01183                                             //      pmis = pmis + wlis[i].p();
01184                                             for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
01185                                                     int n = (kc.Ltrk())[j];
01186 
01187                                                     HepMatrix Dc(kc.nc(), NTRKPAR, 0);
01188                                                     Dc[0][0] = 1.0;
01189                                                     Dc[1][1] = 1.0;
01190                                                     Dc[2][2] = 1.0;
01191                                                     HepVector dc(kc.nc(), 0);
01192                                                     dc[0] = pmis.px() - p3.x();
01193                                                     dc[1] = pmis.py() - p3.y();
01194                                                     dc[2] = pmis.pz() - p3.z();
01195                                                     for(int i = 0; i < kc.nc(); i++) {
01196                                                             setD(m_nc+i, n, Dc.sub(i+1, i+1, 1, NTRKPAR));
01197                                                             setDT(n, m_nc+i, (Dc.sub(i+1, i+1, 1, NTRKPAR)).T());
01198                                                             m_d[m_nc+i] = dc[i];
01199                                                     }
01200                                                     //    m_Dc.push_back(Dc);
01201                                             }
01202                                             m_nc += 3; 
01203 
01204                                             //    HepVector dc(3, 0);
01205                                             //    dc[0] = pmis.px() - p3.x();
01206                                             //    dc[1] = pmis.py() - p3.y();
01207                                             //    dc[2] = pmis.pz() - p3.z();
01208                                             //    m_dc.push_back(dc);
01209                                             //    HepVector lambda(3, 0);
01210                                             //    m_lambda.push_back(lambda);
01211                                             //    HepSymMatrix vd(3, 0);
01212                                             //    m_VD.push_back(vd);
01213                                             break;
01214                                     }
01215                 case EqualMass: {
01216                                         //
01217                                         //  (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
01218                                         //
01219 
01220                                         int isiz = (kc.numEqual())[0];
01221                                         HepLorentzVector pmis1, pmis2;
01222                                         for(int n = 0; n < isiz; n++) {
01223                                                 int n1 = (kc.Ltrk())[n];
01224                                                 pmis1 = pmis1 + p4Infit(n1);
01225                                         }
01226                                         int jsiz = (kc.numEqual())[1];
01227                                         for(int n = 0; n < jsiz; n++){
01228                                                 int n2 = (kc.Ltrk())[n+isiz];
01229                                                 pmis2 = pmis2 + p4Infit(n2);
01230                                         }
01231                                         for(int i = 0; i < isiz; i++) {
01232                                                 int n1 = (kc.Ltrk())[i];
01233                                                 HepMatrix Dc(1, NTRKPAR, 0);
01234                                                 Dc[0][0] = -2 * pmis1.px() + 2 * pmis1.e() * p4Infit(n1).px() / p4Infit(n1).e();
01235                                                 Dc[0][1] = -2 * pmis1.py() + 2 * pmis1.e() * p4Infit(n1).py() / p4Infit(n1).e();
01236                                                 Dc[0][2] = -2 * pmis1.pz() + 2 * pmis1.e() * p4Infit(n1).pz() / p4Infit(n1).e();
01237                                                 //      Dc[0][3] = 2 * pmis1.e();
01238                                                 setD(m_nc,n1,Dc);
01239                                                 setDT(n1,m_nc,Dc.T());
01240                                         }
01241                                         for(int i = 0; i < jsiz; i++) {
01242                                                 int n2 = (kc.Ltrk())[i+isiz];
01243                                                 HepMatrix Dc(1, NTRKPAR, 0);
01244                                                 Dc[0][0] = 2 * pmis2.px() - 2 * pmis2.e() * p4Infit(n2).px() / p4Infit(n2).e();
01245                                                 Dc[0][1] = 2 * pmis2.py() - 2 * pmis2.e() * p4Infit(n2).py() / p4Infit(n2).e();
01246                                                 Dc[0][2] = 2 * pmis2.pz() - 2 * pmis2.e() * p4Infit(n2).pz() / p4Infit(n2).e();
01247                                                 Dc[0][3] = -2 * pmis2.e();
01248                                                 setD(m_nc,n2,Dc);
01249                                                 setDT(n2,m_nc,Dc.T());
01250                                         }
01251                                         //    int isiz_V = m_nequal_V[0];
01252                                         //    HepLorentzVector pmis1_V, pmis2_V;
01253                                         //    if(isiz_V > 0){
01254                                         //    for(int n = 0; n < isiz_V; n++) {
01255                                         //      pmis1_V = pmis1_V + wlis_V[n].p();
01256                                         //    } 
01257                                         //    } 
01258                                         //    int jsiz_V = m_nequal_V[1];
01259                                         //    if(jsiz_V > 0) {
01260                                         //    for(int n = 0; n < jsiz_V; n++) 
01261                                         //      pmis2_V = pmis2_V + wlis_V[isiz_V+n].p();
01262                                         //    }
01263 
01264                                         //    for(int i = 0; i < isiz_V; i++) {
01265                                         //      HepMatrix Dc_V(1, 7, 0);
01266                                         //      Dc_V[0][0] = -2 * pmis1_V.px();
01267                                         //      Dc_V[0][1] = -2 * pmis1_V.py();
01268                                         //      Dc_V[0][2] = -2 * pmis1_V.pz();
01269                                         //      Dc_V[0][3] = 2 * pmis1_V.e();
01270                                         //      m_Dc_V.push_back(Dc_V);
01271                                         //    }
01272                                         //    for(int i = isiz_V; i < isiz_V+jsiz_V; i++) {
01273                                         //      HepMatrix Dc_V(1, 7, 0);
01274                                         //      Dc_V[0][0] = 2 * pmis2_V.px();
01275                                         //      Dc_V[0][1] = 2 * pmis2_V.py();
01276                                         //      Dc_V[0][2] = 2 * pmis2_V.pz();
01277                                         //      Dc_V[0][3] = -2 * pmis2_V.e();
01278                                         //      m_Dc_V.push_back(Dc_V);
01279                                         //    }
01280                                         HepVector dc(1, 0);
01281                                         dc[0] = pmis1.m2() - pmis2.m2();// + pmis1_V.m2() - pmis2_V.m2();
01282                                         m_d[m_nc] = dc[0];
01283 
01284                                         m_nc+=1;
01285                                         //    m_dc.push_back(dc);
01286                                         //    HepVector lambda(1, 0);
01287                                         //    m_lambda.push_back(lambda);
01288                                         //    HepSymMatrix vd(1, 0);
01289                                         //    m_VD.push_back(vd);
01290                                         //    HepSymMatrix V2 = m_Vne;
01291                                         //    m_Vm.push_back(V2);
01292                                         //    std::cout <<"m_Vm[0] ="<<m_Vm[0]<<std::endl;
01293                                         break;
01294                                 }
01295                 case FourMomentum: 
01296                 default: {
01297                                  //
01298                                  //  px - p4x = 0
01299                                  //  py - p4y = 0
01300                                  //  pz - p4z = 0
01301                                  //  e  - p4e = 0
01302                                  //
01303                                  HepLorentzVector p4 = kc.p4();
01304                                  HepLorentzVector pmis;
01305                                  for(unsigned int j = 0; j< (kc.Ltrk()).size(); j++){
01306                                          int n = (kc.Ltrk())[j];
01307                                          pmis = pmis + p4Infit(n);
01308                                  }
01309                                  //    HepLorentzVector pmis_V;
01310                                  for(unsigned int j = 0; j < (kc.Ltrk()).size(); j++) {
01311                                          int n = (kc.Ltrk())[j];
01312                                          HepMatrix Dc(kc.nc(), NTRKPAR, 0);
01313                                          Dc[0][0] = 1.0;
01314                                          Dc[1][1] = 1.0;
01315                                          Dc[2][2] = 1.0;
01316                                          Dc[3][0] = p4Infit(n).px() / p4Infit(n).e();
01317                                          Dc[3][1] = p4Infit(n).py() / p4Infit(n).e();
01318                                          Dc[3][2] = p4Infit(n).pz() / p4Infit(n).e();
01319                                          //                                      Dc[3][3] = 1.0;
01320 
01321                                          //      m_Dc.push_back(Dc);
01322                                          HepVector dc(kc.nc(), 0);
01323                                          dc[0] = pmis.px()  - p4.px();
01324                                          dc[1] = pmis.py()  - p4.py();
01325                                          dc[2] = pmis.pz()  - p4.pz();
01326                                          dc[3] = pmis.e()  - p4.e();
01327                                          for(int i = 0; i < kc.nc(); i++) {
01328                                                  setD(m_nc+i, n, Dc.sub(i+1, i+1, 1, NTRKPAR));
01329                                                  setDT(n, m_nc+i, (Dc.sub(i+1, i+1, 1, NTRKPAR)).T());
01330                                                  m_d[m_nc+i] = dc[i];
01331                                          }
01332                                  }
01333                                  m_nc += 4;
01334                                  //    for(unsigned int i = 0; i < wlis_V.size(); i++)
01335                                  //     pmis_V = pmis_V + wlis_V[i].p();
01336                                  //    for(unsigned int i = 0; i < wlis_V.size(); i++) {
01337                                  //      HepMatrix Dc_V(4, 7, 0);
01338                                  //      Dc_V[0][0] = 1.0;
01339                                  //      Dc_V[1][1] = 1.0;
01340                                  //      Dc_V[2][2] = 1.0;
01341                                  //      Dc_V[3][3] = 1.0;
01342                                  //      m_Dc_V.push_back(Dc_V);
01343                                  //    }
01344 
01345                                  //    HepVector dc(4, 0);
01346                                  //   dc[0] = pmis.px() + pmis_V.px() - p4.px();
01347                                  //    dc[1] = pmis.py() + pmis_V.py() - p4.py();
01348                                  //    dc[2] = pmis.pz() + pmis_V.pz() - p4.pz();
01349                                  //    dc[3] = pmis.e() + pmis_V.e() - p4.e();
01350                                  //    m_dc.push_back(dc);
01351 
01352                                  //    HepSymMatrix V1 = m_Vme;
01353                                  //    m_Vm.push_back(V1);
01354                                  //    HepVector lambda(4, 0);
01355                                  //    m_lambda.push_back(lambda);
01356                                  //   HepSymMatrix vd(4, 0);
01357                                  //    m_VD.push_back(vd);
01358 
01359                                  break;
01360                          }
01361         }
01362 }

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(), BuildVirtualParticle(), KalmanKinematicFit::BuildVirtualParticle(), covMatrix(), VertexFit::Ew(), infit(), KalmanKinematicFit::infit(), VertexFit::pfit(), pull(), KalmanKinematicFit::pull(), VertexFit::swimVertex(), 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(), covMatrix(), VertexFit::Fit(), SecondVertexFit::Fit(), Fit(), KalmanKinematicFit::Fit(), gda(), KalmanKinematicFit::gda(), origin(), KalmanKinematicFit::origin(), VertexFit::pull(), pull(), KalmanKinematicFit::pull(), VertexFit::swimVertex(), upCovmtx(), and VertexFit::UpdateConstraints().

00072 {return m_wtrk_origin;}

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

Definition at line 171 of file KinematicFit.h.

References m_virtual_wtrk.

00171 {return m_virtual_wtrk[n];}


Member Data Documentation

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

Definition at line 243 of file KinematicFit.h.

Referenced by updateConstraints().

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

Definition at line 242 of file KinematicFit.h.

Referenced by updateConstraints().

double KinematicFit::m_chi [private]

Definition at line 188 of file KinematicFit.h.

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

double KinematicFit::m_chicut [private]

Definition at line 225 of file KinematicFit.h.

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

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

Definition at line 187 of file KinematicFit.h.

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

double KinematicFit::m_chiter [private]

Definition at line 226 of file KinematicFit.h.

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

double KinematicFit::m_collideangle [private]

Definition at line 230 of file KinematicFit.h.

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

HepSymMatrix KinematicFit::m_covInfit [private]

Definition at line 206 of file KinematicFit.h.

Referenced by covInfit(), Fit(), setCovInfit(), and upCovmtx().

HepSymMatrix KinematicFit::m_covOrigin [private]

Definition at line 205 of file KinematicFit.h.

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

HepVector KinematicFit::m_cpu [private]

Definition at line 232 of file KinematicFit.h.

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

HepVector KinematicFit::m_d [private]

Definition at line 197 of file KinematicFit.h.

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

HepMatrix KinematicFit::m_D [private]

Definition at line 191 of file KinematicFit.h.

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

HepMatrix KinematicFit::m_DT [private]

Definition at line 194 of file KinematicFit.h.

Referenced by DT(), Fit(), fit(), and setDT().

bool KinematicFit::m_dynamicerror [private]

Definition at line 234 of file KinematicFit.h.

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

double KinematicFit::m_espread [private]

Definition at line 229 of file KinematicFit.h.

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

bool KinematicFit::m_flag [private]

Definition at line 224 of file KinematicFit.h.

Referenced by init(), and setFlag().

int KinematicFit::m_kalman [private]

Definition at line 228 of file KinematicFit.h.

Referenced by init(), and setKalman().

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

Definition at line 186 of file KinematicFit.h.

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

HepMatrix KinematicFit::m_KP [private]

Definition at line 199 of file KinematicFit.h.

Referenced by fit(), and upCovmtx().

HepVector KinematicFit::m_massvector [private]

Definition at line 207 of file KinematicFit.h.

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

int KinematicFit::m_nc [private]

Definition at line 201 of file KinematicFit.h.

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

int KinematicFit::m_niter [private]

Definition at line 223 of file KinematicFit.h.

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

int KinematicFit::m_nktrk [private]

Definition at line 202 of file KinematicFit.h.

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

HepVector KinematicFit::m_pInfit [private]

Definition at line 204 of file KinematicFit.h.

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

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

Definition at line 221 of file KinematicFit.h.

Referenced by instance().

HepVector KinematicFit::m_pOrigin [private]

Definition at line 203 of file KinematicFit.h.

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

HepSymMatrix KinematicFit::m_VD [private]

Definition at line 198 of file KinematicFit.h.

Referenced by fit().

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

Definition at line 174 of file KinematicFit.h.

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

const int KinematicFit::NTRKPAR = 3 [static, private]

Definition at line 236 of file KinematicFit.h.

Referenced by covInfit(), covOrigin(), D(), DT(), Fit(), fit(), gda(), pInfit(), pOrigin(), setCovInfit(), setCovOrigin(), setD(), setDT(), setPInfit(), setPOrigin(), upCovmtx(), and updateConstraints().

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

Definition at line 244 of file KinematicFit.h.

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

Definition at line 238 of file KinematicFit.h.

Referenced by updateConstraints().

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

Definition at line 241 of file KinematicFit.h.

Referenced by updateConstraints().

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

Definition at line 239 of file KinematicFit.h.

Referenced by updateConstraints().

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

Definition at line 240 of file KinematicFit.h.

Referenced by updateConstraints().


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