Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

KalFitAlg Class Reference

#include <KalFitAlg.h>

List of all members.

Kalman filter method related member functions

void clearTables ()
void complete_track (MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol)
void complete_track (MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol, int flagsmooth)
void extToAnyPoint (KalFitTrack &trk, const HepPoint3D &point)
void fillTds (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 with results got at the inner Mdc hit
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass, RecMdcKalHelixSegCol *segcol, int smoothflag)
 for smoother process
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass, RecMdcKalHelixSegCol *segcol)
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass)
 with results got at the outer Mdc hit
void fillTds_ip (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 with results got at (0,0,0)
void fillTds_lead (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
int getWallMdcNumber (const HepPoint3D &point)
void kalman_fitting_anal (void)
void kalman_fitting_calib (void)
void kalman_fitting_csmalign (void)
void kalman_fitting_MdcxReco_Csmc_Sew (void)
void sameas (RecMdcKalTrack *trk, int l_mass, int imain)
 complete the RecMdcKalTrackCol
void setBesFromGdml (void)
std::vector< KalFitMaterial_BesKalmanFitMaterials
std::vector< KalFitCylinder_BesKalmanFitWalls
KalFitLayer_Mdc_layer
KalFitSuper_Mdc_superLayer
KalFitWire_wire
NTuple::Item< double > m_anal_dr
NTuple::Item< double > m_anal_dz
NTuple::Item< double > m_anal_ea_dr
NTuple::Item< double > m_anal_ea_dz
NTuple::Item< double > m_anal_ea_kappa
NTuple::Item< double > m_anal_ea_phi0
NTuple::Item< double > m_anal_ea_tanl
NTuple::Item< double > m_anal_kappa
NTuple::Item< double > m_anal_phi0
NTuple::Item< double > m_anal_tanl
NTuple::Item< double > m_chi2direct
NTuple::Matrix< double > m_chisq
NTuple::Item< double > m_dchi2
NTuple::Item< double > m_dchisq0
NTuple::Item< double > m_dchisq1
NTuple::Item< double > m_dchisq10
NTuple::Item< double > m_dchisq11
NTuple::Item< double > m_dchisq12
NTuple::Item< double > m_dchisq13
NTuple::Item< double > m_dchisq14
NTuple::Item< double > m_dchisq15
NTuple::Item< double > m_dchisq16
NTuple::Item< double > m_dchisq17
NTuple::Item< double > m_dchisq18
NTuple::Item< double > m_dchisq19
NTuple::Item< double > m_dchisq2
NTuple::Item< double > m_dchisq20
NTuple::Item< double > m_dchisq21
NTuple::Item< double > m_dchisq22
NTuple::Item< double > m_dchisq23
NTuple::Item< double > m_dchisq24
NTuple::Item< double > m_dchisq25
NTuple::Item< double > m_dchisq26
NTuple::Item< double > m_dchisq27
NTuple::Item< double > m_dchisq28
NTuple::Item< double > m_dchisq29
NTuple::Item< double > m_dchisq3
NTuple::Item< double > m_dchisq30
NTuple::Item< double > m_dchisq31
NTuple::Item< double > m_dchisq32
NTuple::Item< double > m_dchisq33
NTuple::Item< double > m_dchisq34
NTuple::Item< double > m_dchisq35
NTuple::Item< double > m_dchisq36
NTuple::Item< double > m_dchisq37
NTuple::Item< double > m_dchisq38
NTuple::Item< double > m_dchisq39
NTuple::Item< double > m_dchisq4
NTuple::Item< double > m_dchisq40
NTuple::Item< double > m_dchisq41
NTuple::Item< double > m_dchisq42
NTuple::Item< double > m_dchisq5
NTuple::Item< double > m_dchisq6
NTuple::Item< double > m_dchisq7
NTuple::Item< double > m_dchisq8
NTuple::Item< double > m_dchisq9
NTuple::Item< double > m_dd
NTuple::Item< double > m_delp
NTuple::Item< double > m_delphi
NTuple::Item< double > m_delpx
NTuple::Item< double > m_delpy
NTuple::Item< double > m_delpz
NTuple::Item< double > m_delthe
NTuple::Item< double > m_delx
NTuple::Item< double > m_dely
NTuple::Item< double > m_delz
NTuple::Item< double > m_docaExc
NTuple::Item< double > m_docaInc
NTuple::Item< double > m_dtdc0
NTuple::Item< double > m_dtdc1
NTuple::Item< double > m_dtdc10
NTuple::Item< double > m_dtdc11
NTuple::Item< double > m_dtdc12
NTuple::Item< double > m_dtdc13
NTuple::Item< double > m_dtdc14
NTuple::Item< double > m_dtdc15
NTuple::Item< double > m_dtdc16
NTuple::Item< double > m_dtdc17
NTuple::Item< double > m_dtdc18
NTuple::Item< double > m_dtdc19
NTuple::Item< double > m_dtdc2
NTuple::Item< double > m_dtdc20
NTuple::Item< double > m_dtdc21
NTuple::Item< double > m_dtdc22
NTuple::Item< double > m_dtdc23
NTuple::Item< double > m_dtdc24
NTuple::Item< double > m_dtdc25
NTuple::Item< double > m_dtdc26
NTuple::Item< double > m_dtdc27
NTuple::Item< double > m_dtdc28
NTuple::Item< double > m_dtdc29
NTuple::Item< double > m_dtdc3
NTuple::Item< double > m_dtdc30
NTuple::Item< double > m_dtdc31
NTuple::Item< double > m_dtdc32
NTuple::Item< double > m_dtdc33
NTuple::Item< double > m_dtdc34
NTuple::Item< double > m_dtdc35
NTuple::Item< double > m_dtdc36
NTuple::Item< double > m_dtdc37
NTuple::Item< double > m_dtdc38
NTuple::Item< double > m_dtdc39
NTuple::Item< double > m_dtdc4
NTuple::Item< double > m_dtdc40
NTuple::Item< double > m_dtdc41
NTuple::Item< double > m_dtdc42
NTuple::Item< double > m_dtdc5
NTuple::Item< double > m_dtdc6
NTuple::Item< double > m_dtdc7
NTuple::Item< double > m_dtdc8
NTuple::Item< double > m_dtdc9
NTuple::Item< double > m_dtrack0
NTuple::Item< double > m_dtrack1
NTuple::Item< double > m_dtrack10
NTuple::Item< double > m_dtrack11
NTuple::Item< double > m_dtrack12
NTuple::Item< double > m_dtrack13
NTuple::Item< double > m_dtrack14
NTuple::Item< double > m_dtrack15
NTuple::Item< double > m_dtrack16
NTuple::Item< double > m_dtrack17
NTuple::Item< double > m_dtrack18
NTuple::Item< double > m_dtrack19
NTuple::Item< double > m_dtrack2
NTuple::Item< double > m_dtrack20
NTuple::Item< double > m_dtrack21
NTuple::Item< double > m_dtrack22
NTuple::Item< double > m_dtrack23
NTuple::Item< double > m_dtrack24
NTuple::Item< double > m_dtrack25
NTuple::Item< double > m_dtrack26
NTuple::Item< double > m_dtrack27
NTuple::Item< double > m_dtrack28
NTuple::Item< double > m_dtrack29
NTuple::Item< double > m_dtrack3
NTuple::Item< double > m_dtrack30
NTuple::Item< double > m_dtrack31
NTuple::Item< double > m_dtrack32
NTuple::Item< double > m_dtrack33
NTuple::Item< double > m_dtrack34
NTuple::Item< double > m_dtrack35
NTuple::Item< double > m_dtrack36
NTuple::Item< double > m_dtrack37
NTuple::Item< double > m_dtrack38
NTuple::Item< double > m_dtrack39
NTuple::Item< double > m_dtrack4
NTuple::Item< double > m_dtrack40
NTuple::Item< double > m_dtrack41
NTuple::Item< double > m_dtrack42
NTuple::Item< double > m_dtrack5
NTuple::Item< double > m_dtrack6
NTuple::Item< double > m_dtrack7
NTuple::Item< double > m_dtrack8
NTuple::Item< double > m_dtrack9
NTuple::Item< long > m_eventNo
NTuple::Item< long > m_evtid
NTuple::Array< double > m_ferror
NTuple::Array< double > m_ferrore
NTuple::Array< double > m_ferrork
NTuple::Array< double > m_ferrormu
NTuple::Array< double > m_ferrorp
NTuple::Array< double > m_fhelix
NTuple::Array< double > m_fhelixe
NTuple::Array< double > m_fhelixk
NTuple::Array< double > m_fhelixmu
NTuple::Array< double > m_fhelixp
NTuple::Item< double > m_fitchi2
NTuple::Item< double > m_fpt
NTuple::Item< double > m_fpte
NTuple::Item< double > m_fptk
NTuple::Item< double > m_fptmu
NTuple::Item< double > m_fptot
NTuple::Item< double > m_fptote
NTuple::Item< double > m_fptotk
NTuple::Item< double > m_fptotmu
NTuple::Item< double > m_fptotp
NTuple::Item< double > m_fptp
NTuple::Item< long > m_layer
NTuple::Item< long > m_layerid
NTuple::Array< double > m_length
NTuple::Array< double > m_lerror
NTuple::Array< double > m_lerrore
NTuple::Array< double > m_lerrork
NTuple::Array< double > m_lerrormu
NTuple::Array< double > m_lerrorp
NTuple::Array< double > m_lhelix
NTuple::Array< double > m_lhelixe
NTuple::Array< double > m_lhelixk
NTuple::Array< double > m_lhelixmu
NTuple::Array< double > m_lhelixp
NTuple::Item< double > m_lpt
NTuple::Item< double > m_lpte
NTuple::Item< double > m_lptk
NTuple::Item< double > m_lptmu
NTuple::Item< double > m_lptot
NTuple::Item< double > m_lptote
NTuple::Item< double > m_lptotk
NTuple::Item< double > m_lptotmu
NTuple::Item< double > m_lptotp
NTuple::Item< double > m_lptp
NTuple::Item< double > m_lr
NTuple::Item< long > m_masshyp
NTuple::Array< double > m_mchelix
NTuple::Item< long > m_mcpid
NTuple::Item< double > m_mcptot
const MdcCalibFunSvcm_mdcCalibFunSvc_
const IMagneticFieldSvcm_MFSvc_
NTuple::Matrix< double > m_ndf
NTuple::Array< double > m_nhits
NTuple::Tuple * m_nt1
NTuple::Tuple * m_nt2
NTuple::Tuple * m_nt3
NTuple::Tuple * m_nt4
NTuple::Tuple * m_nt5
NTuple::Tuple * m_nt6
NTuple::Item< double > m_orichi2
HepPDT::ParticleDataTable * m_particleTable
NTuple::Item< double > m_prob
NTuple::Item< double > m_residest
NTuple::Item< double > m_residnew
NTuple::Item< double > m_residualExc
NTuple::Item< double > m_residualInc
NTuple::Matrix< double > m_stat
NTuple::Item< double > m_tdrift
NTuple::Array< double > m_tof
NTuple::Item< long > m_trackid
NTuple::Item< double > m_trkchisq
NTuple::Item< double > m_trkdelp
NTuple::Item< double > m_trkdelphi
NTuple::Item< double > m_trkdelthe
NTuple::Item< double > m_trkdelx
NTuple::Item< double > m_trkdely
NTuple::Item< double > m_trkdelz
NTuple::Array< double > m_trkerror
NTuple::Array< double > m_trkhelix
NTuple::Item< double > m_trkndf
NTuple::Item< double > m_trkptot
NTuple::Item< double > m_trksigp
NTuple::Item< double > m_yposition
NTuple::Array< double > m_zerror
NTuple::Array< double > m_zerrore
NTuple::Array< double > m_zerrork
NTuple::Array< double > m_zerrormu
NTuple::Array< double > m_zerrorp
NTuple::Array< double > m_zhelix
NTuple::Array< double > m_zhelixe
NTuple::Array< double > m_zhelixk
NTuple::Array< double > m_zhelixmu
NTuple::Array< double > m_zhelixp
NTuple::Item< double > m_zpt
NTuple::Item< double > m_zpte
NTuple::Item< double > m_zptk
NTuple::Item< double > m_zptmu
NTuple::Item< double > m_zptot
NTuple::Item< double > m_zptote
NTuple::Item< double > m_zptotk
NTuple::Item< double > m_zptotmu
NTuple::Item< double > m_zptotp
NTuple::Item< double > m_zptp
NTuple::Item< double > m_zsigp
NTuple::Item< double > m_zsigpe
NTuple::Item< double > m_zsigpk
NTuple::Item< double > m_zsigpmu
NTuple::Item< double > m_zsigpp
bool order_rechits (const SmartRef< RecMdcHit > &m1, const SmartRef< RecMdcHit > &m2)
IMdcGeomSvcimdcGeomSvc_

Kalman filter method related member functions

void clearTables ()
void complete_track (MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol)
void complete_track (MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol, int flagsmooth)
void extToAnyPoint (KalFitTrack &trk, const HepPoint3D &point)
void fillTds (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 with results got at the inner Mdc hit
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass, RecMdcKalHelixSegCol *segcol, int smoothflag)
 for smoother process
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass, RecMdcKalHelixSegCol *segcol)
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass)
 with results got at the outer Mdc hit
void fillTds_ip (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 with results got at (0,0,0)
void fillTds_lead (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
int getWallMdcNumber (const HepPoint3D &point)
void kalman_fitting_anal (void)
void kalman_fitting_calib (void)
void kalman_fitting_csmalign (void)
void kalman_fitting_MdcxReco_Csmc_Sew (void)
void sameas (RecMdcKalTrack *trk, int l_mass, int imain)
 complete the RecMdcKalTrackCol
void setBesFromGdml (void)
int activeonly_
int back_
 flag to perform smoothing
int choice_
string cylfile_
double dchi2cut_inner_
double dchi2cut_layid2_
double dchi2cut_layid3_
double dchi2cut_mid1_
double dchi2cut_mid2_
double dchi2cut_outer_
double dchi2cutf_
double dchi2cuts_
int debug_
 Debug flag for the track finder part.
int debug_kft_
 Debug flag for the track finder part.
int drifttime_choice_
int enhance_
 flag to enhance the error matrix at the inner hit of Mdc (cosmic)
int eventNo
int eventno
double fac_h1_
double fac_h2_
double fac_h3_
double fac_h4_
double fac_h5_
int fitnocut_
double fstrag_
 factor of energy loss straggling for electron
double gain1_
double gain2_
double gain3_
double gain4_
double gain5_
int i_back_
 mass assumption for backward filter (if <0 means use leading mass)
int i_front_
int inner_steps_
int iqual_back_
int iqual_front_ [5]
int lead_
 leading mass assumption
int loss_
int lr_
int m_csmflag
double m_dangcut
double m_dphicut
int m_usevtxdb
string matfile_
double matrixg_
int mhyp_
int muls_
int ntuple_
 Fill ntuples of KalFit.
int numf_
int numf_in_
int numf_out_
int numfcor_
int outer_steps_
int pathl_
double pe_cut_
 value of the momentum cut to decide refit
double pk_cut_
 value of the momentum cut to decide refit
double pmu_cut_
 value of the momentum cut to decide refit
double pp_cut_
 value of the momentum cut to decide refit
double ppi_cut_
 value of the momentum cut to decide refit
double pT_
 value of the pT cut for backward filter
double pt_cut_
int resolution_
int steplev_
int Tds_back_no
double theta_cut_
int tof_hyp_
int tofflag_
int tprop_
 propagation correction
int usage_
int wsag_
 flag to take account the wire sag into account
std::vector< KalFitMaterial_BesKalmanFitMaterials
std::vector< KalFitCylinder_BesKalmanFitWalls
KalFitLayer_Mdc_layer
KalFitSuper_Mdc_superLayer
KalFitWire_wire
NTuple::Item< double > m_anal_dr
NTuple::Item< double > m_anal_dz
NTuple::Item< double > m_anal_ea_dr
NTuple::Item< double > m_anal_ea_dz
NTuple::Item< double > m_anal_ea_kappa
NTuple::Item< double > m_anal_ea_phi0
NTuple::Item< double > m_anal_ea_tanl
NTuple::Item< double > m_anal_kappa
NTuple::Item< double > m_anal_phi0
NTuple::Item< double > m_anal_tanl
NTuple::Item< double > m_chi2direct
NTuple::Matrix< double > m_chisq
NTuple::Item< double > m_dchi2
NTuple::Item< double > m_dchisq0
NTuple::Item< double > m_dchisq1
NTuple::Item< double > m_dchisq10
NTuple::Item< double > m_dchisq11
NTuple::Item< double > m_dchisq12
NTuple::Item< double > m_dchisq13
NTuple::Item< double > m_dchisq14
NTuple::Item< double > m_dchisq15
NTuple::Item< double > m_dchisq16
NTuple::Item< double > m_dchisq17
NTuple::Item< double > m_dchisq18
NTuple::Item< double > m_dchisq19
NTuple::Item< double > m_dchisq2
NTuple::Item< double > m_dchisq20
NTuple::Item< double > m_dchisq21
NTuple::Item< double > m_dchisq22
NTuple::Item< double > m_dchisq23
NTuple::Item< double > m_dchisq24
NTuple::Item< double > m_dchisq25
NTuple::Item< double > m_dchisq26
NTuple::Item< double > m_dchisq27
NTuple::Item< double > m_dchisq28
NTuple::Item< double > m_dchisq29
NTuple::Item< double > m_dchisq3
NTuple::Item< double > m_dchisq30
NTuple::Item< double > m_dchisq31
NTuple::Item< double > m_dchisq32
NTuple::Item< double > m_dchisq33
NTuple::Item< double > m_dchisq34
NTuple::Item< double > m_dchisq35
NTuple::Item< double > m_dchisq36
NTuple::Item< double > m_dchisq37
NTuple::Item< double > m_dchisq38
NTuple::Item< double > m_dchisq39
NTuple::Item< double > m_dchisq4
NTuple::Item< double > m_dchisq40
NTuple::Item< double > m_dchisq41
NTuple::Item< double > m_dchisq42
NTuple::Item< double > m_dchisq5
NTuple::Item< double > m_dchisq6
NTuple::Item< double > m_dchisq7
NTuple::Item< double > m_dchisq8
NTuple::Item< double > m_dchisq9
NTuple::Item< double > m_dd
NTuple::Item< double > m_delp
NTuple::Item< double > m_delphi
NTuple::Item< double > m_delpx
NTuple::Item< double > m_delpy
NTuple::Item< double > m_delpz
NTuple::Item< double > m_delthe
NTuple::Item< double > m_delx
NTuple::Item< double > m_dely
NTuple::Item< double > m_delz
NTuple::Item< double > m_docaExc
NTuple::Item< double > m_docaInc
NTuple::Item< double > m_dtdc0
NTuple::Item< double > m_dtdc1
NTuple::Item< double > m_dtdc10
NTuple::Item< double > m_dtdc11
NTuple::Item< double > m_dtdc12
NTuple::Item< double > m_dtdc13
NTuple::Item< double > m_dtdc14
NTuple::Item< double > m_dtdc15
NTuple::Item< double > m_dtdc16
NTuple::Item< double > m_dtdc17
NTuple::Item< double > m_dtdc18
NTuple::Item< double > m_dtdc19
NTuple::Item< double > m_dtdc2
NTuple::Item< double > m_dtdc20
NTuple::Item< double > m_dtdc21
NTuple::Item< double > m_dtdc22
NTuple::Item< double > m_dtdc23
NTuple::Item< double > m_dtdc24
NTuple::Item< double > m_dtdc25
NTuple::Item< double > m_dtdc26
NTuple::Item< double > m_dtdc27
NTuple::Item< double > m_dtdc28
NTuple::Item< double > m_dtdc29
NTuple::Item< double > m_dtdc3
NTuple::Item< double > m_dtdc30
NTuple::Item< double > m_dtdc31
NTuple::Item< double > m_dtdc32
NTuple::Item< double > m_dtdc33
NTuple::Item< double > m_dtdc34
NTuple::Item< double > m_dtdc35
NTuple::Item< double > m_dtdc36
NTuple::Item< double > m_dtdc37
NTuple::Item< double > m_dtdc38
NTuple::Item< double > m_dtdc39
NTuple::Item< double > m_dtdc4
NTuple::Item< double > m_dtdc40
NTuple::Item< double > m_dtdc41
NTuple::Item< double > m_dtdc42
NTuple::Item< double > m_dtdc5
NTuple::Item< double > m_dtdc6
NTuple::Item< double > m_dtdc7
NTuple::Item< double > m_dtdc8
NTuple::Item< double > m_dtdc9
NTuple::Item< double > m_dtrack0
NTuple::Item< double > m_dtrack1
NTuple::Item< double > m_dtrack10
NTuple::Item< double > m_dtrack11
NTuple::Item< double > m_dtrack12
NTuple::Item< double > m_dtrack13
NTuple::Item< double > m_dtrack14
NTuple::Item< double > m_dtrack15
NTuple::Item< double > m_dtrack16
NTuple::Item< double > m_dtrack17
NTuple::Item< double > m_dtrack18
NTuple::Item< double > m_dtrack19
NTuple::Item< double > m_dtrack2
NTuple::Item< double > m_dtrack20
NTuple::Item< double > m_dtrack21
NTuple::Item< double > m_dtrack22
NTuple::Item< double > m_dtrack23
NTuple::Item< double > m_dtrack24
NTuple::Item< double > m_dtrack25
NTuple::Item< double > m_dtrack26
NTuple::Item< double > m_dtrack27
NTuple::Item< double > m_dtrack28
NTuple::Item< double > m_dtrack29
NTuple::Item< double > m_dtrack3
NTuple::Item< double > m_dtrack30
NTuple::Item< double > m_dtrack31
NTuple::Item< double > m_dtrack32
NTuple::Item< double > m_dtrack33
NTuple::Item< double > m_dtrack34
NTuple::Item< double > m_dtrack35
NTuple::Item< double > m_dtrack36
NTuple::Item< double > m_dtrack37
NTuple::Item< double > m_dtrack38
NTuple::Item< double > m_dtrack39
NTuple::Item< double > m_dtrack4
NTuple::Item< double > m_dtrack40
NTuple::Item< double > m_dtrack41
NTuple::Item< double > m_dtrack42
NTuple::Item< double > m_dtrack5
NTuple::Item< double > m_dtrack6
NTuple::Item< double > m_dtrack7
NTuple::Item< double > m_dtrack8
NTuple::Item< double > m_dtrack9
NTuple::Item< long > m_eventNo
NTuple::Item< long > m_evtid
NTuple::Array< double > m_ferror
NTuple::Array< double > m_ferrore
NTuple::Array< double > m_ferrork
NTuple::Array< double > m_ferrormu
NTuple::Array< double > m_ferrorp
NTuple::Array< double > m_fhelix
NTuple::Array< double > m_fhelixe
NTuple::Array< double > m_fhelixk
NTuple::Array< double > m_fhelixmu
NTuple::Array< double > m_fhelixp
NTuple::Item< double > m_fitchi2
NTuple::Item< double > m_fpt
NTuple::Item< double > m_fpte
NTuple::Item< double > m_fptk
NTuple::Item< double > m_fptmu
NTuple::Item< double > m_fptot
NTuple::Item< double > m_fptote
NTuple::Item< double > m_fptotk
NTuple::Item< double > m_fptotmu
NTuple::Item< double > m_fptotp
NTuple::Item< double > m_fptp
NTuple::Item< long > m_layer
NTuple::Item< long > m_layerid
NTuple::Array< double > m_length
NTuple::Array< double > m_lerror
NTuple::Array< double > m_lerrore
NTuple::Array< double > m_lerrork
NTuple::Array< double > m_lerrormu
NTuple::Array< double > m_lerrorp
NTuple::Array< double > m_lhelix
NTuple::Array< double > m_lhelixe
NTuple::Array< double > m_lhelixk
NTuple::Array< double > m_lhelixmu
NTuple::Array< double > m_lhelixp
NTuple::Item< double > m_lpt
NTuple::Item< double > m_lpte
NTuple::Item< double > m_lptk
NTuple::Item< double > m_lptmu
NTuple::Item< double > m_lptot
NTuple::Item< double > m_lptote
NTuple::Item< double > m_lptotk
NTuple::Item< double > m_lptotmu
NTuple::Item< double > m_lptotp
NTuple::Item< double > m_lptp
NTuple::Item< double > m_lr
NTuple::Item< long > m_masshyp
NTuple::Array< double > m_mchelix
NTuple::Item< long > m_mcpid
NTuple::Item< double > m_mcptot
const MdcCalibFunSvcm_mdcCalibFunSvc_
const IMagneticFieldSvcm_MFSvc_
NTuple::Matrix< double > m_ndf
NTuple::Array< double > m_nhits
NTuple::Tuple * m_nt1
NTuple::Tuple * m_nt2
NTuple::Tuple * m_nt3
NTuple::Tuple * m_nt4
NTuple::Tuple * m_nt5
NTuple::Tuple * m_nt6
NTuple::Item< double > m_orichi2
HepPDT::ParticleDataTable * m_particleTable
NTuple::Item< double > m_prob
NTuple::Item< double > m_residest
NTuple::Item< double > m_residnew
NTuple::Item< double > m_residualExc
NTuple::Item< double > m_residualInc
NTuple::Matrix< double > m_stat
NTuple::Item< double > m_tdrift
NTuple::Array< double > m_tof
NTuple::Item< long > m_trackid
NTuple::Item< double > m_trkchisq
NTuple::Item< double > m_trkdelp
NTuple::Item< double > m_trkdelphi
NTuple::Item< double > m_trkdelthe
NTuple::Item< double > m_trkdelx
NTuple::Item< double > m_trkdely
NTuple::Item< double > m_trkdelz
NTuple::Array< double > m_trkerror
NTuple::Array< double > m_trkhelix
NTuple::Item< double > m_trkndf
NTuple::Item< double > m_trkptot
NTuple::Item< double > m_trksigp
NTuple::Item< double > m_yposition
NTuple::Array< double > m_zerror
NTuple::Array< double > m_zerrore
NTuple::Array< double > m_zerrork
NTuple::Array< double > m_zerrormu
NTuple::Array< double > m_zerrorp
NTuple::Array< double > m_zhelix
NTuple::Array< double > m_zhelixe
NTuple::Array< double > m_zhelixk
NTuple::Array< double > m_zhelixmu
NTuple::Array< double > m_zhelixp
NTuple::Item< double > m_zpt
NTuple::Item< double > m_zpte
NTuple::Item< double > m_zptk
NTuple::Item< double > m_zptmu
NTuple::Item< double > m_zptot
NTuple::Item< double > m_zptote
NTuple::Item< double > m_zptotk
NTuple::Item< double > m_zptotmu
NTuple::Item< double > m_zptotp
NTuple::Item< double > m_zptp
NTuple::Item< double > m_zsigp
NTuple::Item< double > m_zsigpe
NTuple::Item< double > m_zsigpk
NTuple::Item< double > m_zsigpmu
NTuple::Item< double > m_zsigpp
bool order_rechits (const SmartRef< RecMdcHit > &m1, const SmartRef< RecMdcHit > &m2)
IMdcGeomSvcimdcGeomSvc_ = 0
const double RIW = 6.35

Public Member Functions

Main member functions
StatusCode beginRun ()
void clean (void)
StatusCode execute ()
 event function
StatusCode finalize ()
void hist_def (void)
 hist definition
StatusCode initialize ()
 initialize
 KalFitAlg (const std::string &name, ISvcLocator *pSvcLocator)
 constructor
 ~KalFitAlg (void)
 destructor
Main member functions
StatusCode beginRun ()
void clean (void)
StatusCode execute ()
 event function
StatusCode finalize ()
void hist_def (void)
 hist definition
StatusCode initialize ()
 initialize
 KalFitAlg (const std::string &name, ISvcLocator *pSvcLocator)
 constructor
 ~KalFitAlg (void)
 destructor
Kalman filter method related member functions
void filter_fwd_anal (KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
 Kalman filter (forward) in Mdc.
void filter_fwd_calib (KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
void init_matrix (int k, MdcRec_trk &trk, HepSymMatrix &Ea)
void init_matrix (MdcRec_trk &trk, HepSymMatrix &Ea)
void innerwall (KalFitTrack &trk, int l_mass, int way)
 Take the inner walls (eloss and mult scat) into account.
void smoother_anal (KalFitTrack &trk, int way)
 Kalman filter (smoothing or backward part).
void smoother_calib (KalFitTrack &trk, int way)
void start_seed (KalFitTrack &track, int lead_, int way, MdcRec_trk &trk)
Kalman filter method related member functions
void filter_fwd_anal (KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
 Kalman filter (forward) in Mdc.
void filter_fwd_calib (KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
void init_matrix (int k, MdcRec_trk &trk, HepSymMatrix &Ea)
void init_matrix (MdcRec_trk &trk, HepSymMatrix &Ea)
void innerwall (KalFitTrack &trk, int l_mass, int way)
 Take the inner walls (eloss and mult scat) into account.
void smoother_anal (KalFitTrack &trk, int way)
 Kalman filter (smoothing or backward part).
void smoother_calib (KalFitTrack &trk, int way)
void start_seed (KalFitTrack &track, int lead_, int way, MdcRec_trk &trk)
Set up the description of the Mdc
void getEventStarTime (void)
void set_Mdc (void)
 Set up the wires, layers and superlayers...
void setCalibSvc_init (void)
 initialize for the services
void setCylinder_Mdc (void)
 Initialize the cylinders (walls and cathodes) for Mdc.
void setDchisqCut (void)
void setGeomSvc_init (void)
void setMagneticFieldSvc_init (void)
void setMaterial_Mdc (void)
 Initialize the material for Mdc.
Set up the description of the Mdc
void getEventStarTime (void)
void set_Mdc (void)
 Set up the wires, layers and superlayers...
void setCalibSvc_init (void)
 initialize for the services
void setCylinder_Mdc (void)
 Initialize the cylinders (walls and cathodes) for Mdc.
void setDchisqCut (void)
void setGeomSvc_init (void)
void setMagneticFieldSvc_init (void)
void setMaterial_Mdc (void)
 Initialize the material for Mdc.


Constructor & Destructor Documentation

KalFitAlg::KalFitAlg const std::string &  name,
ISvcLocator *  pSvcLocator
 

constructor

00085                                                                    :
00086         Algorithm(name, pSvcLocator), m_mdcCalibFunSvc_(0),m_MFSvc_(0),
00087         _wire(0), _layer(0), _superLayer(0),
00088         pathl_(1), wsag_(4), back_(1), pT_(0.0), lead_(2), mhyp_(31),
00089         pe_cut_(2.0), pmu_cut_(2.0), ppi_cut_(2.0), pk_cut_(2.0), pp_cut_(2.0),   
00090         muls_(1), loss_(1), enhance_(0),drifttime_choice_(0),choice_(0),
00091         fac_h1_(1),fac_h2_(1),fac_h3_(1),fac_h4_(1),fac_h5_(1),
00092         i_back_(-1), debug_kft_(0), debug_(0), ntuple_(0),eventno(-1),
00093         Tds_back_no(0),m_nt1(0),m_nt2(0),m_nt3(0),m_nt4(0),m_nt5(0),
00094         iqual_back_(1),tprop_(1),
00095         dchi2cut_inner_(0),dchi2cut_outer_(0),
00096         dchi2cut_mid1_(0),dchi2cut_mid2_(0),
00097         dchi2cut_layid2_(0),dchi2cut_layid3_(0),m_usevtxdb(0),m_dangcut(10),m_dphicut(10)
00098 {
00099         declareProperty("dchi2cut_layid2",dchi2cut_layid2_ = 10);
00100         declareProperty("dchi2cut_layid3",dchi2cut_layid3_ = 10);
00101         declareProperty("dchi2cut_inner",dchi2cut_inner_ = 10);
00102         declareProperty("dchi2cut_mid1",dchi2cut_mid1_ = 10);
00103         declareProperty("dchi2cut_mid2",dchi2cut_mid2_ = 10);
00104         declareProperty("dchi2cut_outer",dchi2cut_outer_ = 10);
00105         declareProperty("gain1",gain1_ = 1.);
00106         declareProperty("gain2",gain2_ = 1.);
00107         declareProperty("gain3",gain3_ = 1.);
00108         declareProperty("gain4",gain4_ = 1.);
00109         declareProperty("gain5",gain5_ = 1.);
00110         declareProperty("fitnocut",fitnocut_ = 5);
00111         declareProperty("inner_steps",inner_steps_ = 3);
00112         declareProperty("outer_steps",outer_steps_ = 3);
00113         declareProperty("choice",choice_ = 0);
00114         declareProperty("numfcor",numfcor_ = 0);
00115         declareProperty("numf",numf_ = 0);
00116         declareProperty("steplev",steplev_ = 2);
00117         declareProperty("usage",usage_=0);
00118         declareProperty("i_front",i_front_=1);
00119         declareProperty("lead",lead_=2);
00120         declareProperty("muls",muls_=1);
00121         declareProperty("loss",loss_=1);
00122         declareProperty("matrixg",matrixg_=100.0);
00123         declareProperty("lr",lr_=1);  
00124         declareProperty("debug_kft",debug_kft_=0);
00125         declareProperty("debug",debug_=0);  
00126         declareProperty("ntuple",ntuple_=0);  
00127         declareProperty("activeonly",activeonly_=0);  
00128         declareProperty("matfile",matfile_="geomdc_material.dat"); 
00129         declareProperty("cylfile",cylfile_="geomdc_cylinder.dat"); 
00130         declareProperty("dchi2cutf",dchi2cutf_=1000.0);
00131         declareProperty("dchi2cuts",dchi2cuts_=1000.0);
00132         declareProperty("pt",pT_=0.0);
00133         declareProperty("pe_cut",pe_cut_=2.0);
00134         declareProperty("pmu_cut",pmu_cut_=2.0);
00135         declareProperty("ppi_cut",ppi_cut_=2.0);
00136         declareProperty("pk_cut",pk_cut_=2.0);
00137         declareProperty("pp_cut",pp_cut_=2.0); 
00138         declareProperty("wsag",wsag_=4);
00139         declareProperty("back",back_=1);
00140         declareProperty("i_back",i_back_=1);
00141         declareProperty("tofflag",tofflag_=1);
00142         declareProperty("tof_hyp",tof_hyp_=1);
00143         declareProperty("resolution",resolution_=1);
00144         declareProperty("fstrag",fstrag_=0.9);
00145         declareProperty("drifttime_choice",drifttime_choice_=0);
00146         declareProperty("tprop",tprop_=1);
00147         declareProperty("pt_cut",pt_cut_= 0.2);
00148         declareProperty("theta_cut",theta_cut_= 0.8);
00149         declareProperty("usevtxdb",m_usevtxdb= 0);
00150         declareProperty("cosmicflag",m_csmflag= 0);
00151         declareProperty("dangcut",m_dangcut=10.);
00152         declareProperty("dphicut",m_dphicut=10.);
00153 }

KalFitAlg::~KalFitAlg void   ) 
 

destructor

00157 {
00158         MsgStream log(msgSvc(), name());
00159         log << MSG::INFO <<" Start cleaning, delete  Mdc geometry objects" << endreq;
00160         clean();
00161         log << MSG::INFO << "End cleaning " << endreq;
00162 }

KalFitAlg::KalFitAlg const std::string &  name,
ISvcLocator *  pSvcLocator
 

constructor

KalFitAlg::~KalFitAlg void   ) 
 

destructor


Member Function Documentation

StatusCode KalFitAlg::beginRun  ) 
 

StatusCode KalFitAlg::beginRun  ) 
 

00298 {
00299         MsgStream log(msgSvc(), name());  
00300         log << MSG::INFO << "in beginRun()" << endreq;
00301         log << MSG::INFO << "Present Parameters: muls: " << muls_ <<"  loss:  "
00302                 << " activeonly "<< activeonly_ << endreq;
00303 
00304         // initialize the MdcGeomSvc
00305         setGeomSvc_init();
00306         // Wires, Layers and SuperLayers of Mdc :
00307         set_Mdc();
00308 
00309         IMagneticFieldSvc* IMFSvc;
00310         StatusCode sc = service ("MagneticFieldSvc",IMFSvc);
00311         if(sc!=StatusCode::SUCCESS) {
00312                 log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
00313         }
00314 
00315         // Nominal magnetic field :
00316         if (KalFitTrack::numfcor_){
00317                 KalFitTrack::Bznom_ = (IMFSvc->getReferField())*10000; //unit is KGauss
00318                 if(0 == KalFitTrack::Bznom_)   KalFitTrack::Bznom_ = -10;
00319 
00320                 if(4 == debug_){  
00321                         std::cout<<" beginRun, referField from MagneticFieldSvc:"<< (IMFSvc->getReferField())*10000 <<std::endl;
00322                         std::cout<<" magnetic field: "<<KalFitTrack::Bznom_<<std::endl;
00323                 }
00324         }
00325 
00326         return StatusCode::SUCCESS;  
00327 }

void KalFitAlg::clean void   ) 
 

delete C++ objects, necessary to clean before begin_run or inside destructor

void KalFitAlg::clean void   ) 
 

delete C++ objects, necessary to clean before begin_run or inside destructor

00165 {
00166         // delete all Mdc objects :
00167         _BesKalmanFitWalls.clear();
00168         _BesKalmanFitMaterials.clear();
00169         if(_wire)free(_wire);
00170         if(_layer)free(_layer);
00171         if(_superLayer)free(_superLayer);
00172 }

void KalFitAlg::clearTables  ) 
 

void KalFitAlg::clearTables  ) 
 

05837                              {
05838 
05839         if(debug_ == 4) cout<<"Begining to clear Tables ...."<<endl;
05840         vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();                 
05841         vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol(); 
05842         vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();  
05843         vector<MdcRec_trk>::iterator tit=mdcMgr->begin();
05844         for( ; tit != mdcMgr->end(); tit++) {
05845                 vector<MdcRec_wirhit*>::iterator vit= tit->hitcol.begin() ;
05846                 for(; vit != tit->hitcol.end(); vit++) {
05847                         delete (*vit);
05848                 }
05849         }
05850 
05851         mdcMgr->clear();
05852         mdc_addMgr->clear();
05853         whMgr->clear();
05854 
05855         //   delete mdcMgr;
05856         //   delete mdc_addMgr;
05857         //   delete whMgr;
05858         //   mdcMgr = 0;
05859         //   mdc_addMgr = 0;
05860         //   whMgr = 0;
05861 
05862 }

void KalFitAlg::complete_track MdcRec_trk TrasanTRK,
MdcRec_trk_add TrasanTRK_add,
KalFitTrack track_lead,
RecMdcKalTrack kaltrk,
RecMdcKalTrackCol kalcol,
RecMdcKalHelixSegCol segcol
 

void KalFitAlg::complete_track MdcRec_trk TrasanTRK,
MdcRec_trk_add TrasanTRK_add,
KalFitTrack track_lead,
RecMdcKalTrack kaltrk,
RecMdcKalTrackCol kalcol,
RecMdcKalHelixSegCol segcol,
int  flagsmooth
 

void KalFitAlg::complete_track MdcRec_trk TrasanTRK,
MdcRec_trk_add TrasanTRK_add,
KalFitTrack track_lead,
RecMdcKalTrack kaltrk,
RecMdcKalTrackCol kalcol,
RecMdcKalHelixSegCol segcol
 

fill tds with results got at (0,0,0)

05426 {
05427         static int nmass = KalFitTrack::nmass();
05428         int way(1);
05429         MsgStream log(msgSvc(), name());
05430         KalFitTrack track_first(track_lead);
05431         KalFitTrack track_ip(track_lead);
05432 
05433         if (debug_ == 4){
05434                 cout << "track_first  pivot "<<track_first.pivot()<< " helix "<<track_first.a()<<endl;
05435         }
05436         if(usage_==1)  innerwall(track_ip, lead_, way); 
05437         // Fill Tds
05438         fillTds_ip(TrasanTRK, track_ip, kaltrk, lead_);
05439 
05440         if (debug_ == 4) {
05441                 cout << "after inner wall, track_ip  pivot "<<track_first.pivot()<< " helix "<<track_first.a()<<endl;
05442         }
05443 
05444         fillTds_lead(TrasanTRK, track_first, kaltrk, lead_);
05445 
05446         // Refit for different mass assumptions :  
05447         double pp = track_lead.momentum().mag();
05448 
05449         //w  if (!KalFitDSSD::cosmic_)
05450         if(!(i_front_<0)){
05451 
05452                 for(int l_mass = 0, flg = 1; l_mass < nmass;
05453                                 l_mass++, flg <<= 1) {
05454 
05455                         if (!(mhyp_ & flg))  continue;
05456                         if (l_mass == lead_) continue;
05457 
05458                         // Check the mom. to decide of the refit with this mass assumption
05459                         if ((lead_ != 0 && l_mass==0 && pp > pe_cut_) || 
05460                                         (lead_ != 1 && l_mass==1 && pp > pmu_cut_) ||
05461                                         (lead_ != 2 && l_mass==2 && pp > ppi_cut_) ||
05462                                         (lead_ != 3 && l_mass==3 && pp > pk_cut_) ||
05463                                         (lead_ != 4 && l_mass==4 && pp > pp_cut_)) 
05464                                 continue;
05465 
05466                         if(debug_ == 4) {
05467                                 cout<<"complete_track..REFIT ASSUMPION " << l_mass << endl;
05468                         }
05469 
05470                         // Initialisation :
05471                         double chiSq = 0;
05472                         int nhits = 0;
05473 
05474                         // Initialisation : (x, a, ea)
05475                         HepPoint3D x_trasan(TrasanTRK.pivot[0],
05476                                         TrasanTRK.pivot[1],
05477                                         TrasanTRK.pivot[2]);
05478 
05479                         HepVector a_trasan(5);
05480                         for(int i = 0; i < 5; i++){
05481                                 a_trasan[i] = TrasanTRK.helix[i];
05482                         }
05483 
05484                         HepSymMatrix ea_trasan(5);
05485                         for(int i = 0, k = 0; i < 5; i++) {
05486                                 for(int j = 0; j <= i; j++) {
05487                                         ea_trasan[i][j] = matrixg_*TrasanTRK.error[k++];
05488                                         ea_trasan[j][i] = ea_trasan[i][j];
05489                                 }
05490                         }
05491 
05492                         KalFitTrack track(x_trasan,a_trasan, ea_trasan, l_mass, chiSq, nhits);
05493                         track.HitsMdc(track_lead.HitsMdc());    
05494 
05495                         double fiTerm = TrasanTRK.fiTerm;
05496                         track.pivot(track.x(fiTerm));
05497 
05498                         HepSymMatrix Eakal(5,0);
05499 
05500                         double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
05501                         if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
05502                                 choice_ = 6;
05503                         }
05504 
05505                         init_matrix(choice_, TrasanTRK, Eakal);
05506 
05507                         filter_fwd_calib(track, l_mass, way, Eakal);
05508 
05509                         KalFitTrack track_z(track);
05511                         innerwall(track_z, l_mass, way);     
05512                         fillTds_ip(TrasanTRK, track_z, kaltrk, l_mass);  
05513                         // Fill tds
05514                         fillTds(TrasanTRK, track, kaltrk, l_mass);     
05515                 }
05516         }  //end of if (!(i_front<0))
05517 
05518         // Refit with an enhancement of the error matrix at Mdc level :
05519 
05520         if (enhance_) {
05521                 HepPoint3D x_first(0, 0, 0);
05522                 HepVector a_first(kaltrk->getFHelix());
05523                 HepSymMatrix ea_first(kaltrk->getFError());
05524                 HepVector fac(5);
05525                 fac[0]=fac_h1_; fac[1]=fac_h2_; fac[2]=fac_h3_; fac[3]=fac_h4_; fac[4]=fac_h5_;
05526 
05527                 for(int i = 0; i < 5; i++)
05528                         for(int j = 0; j <= i; j++)
05529                                 ea_first[i][j] = fac[i]*fac[j]*ea_first[i][j];
05530                 KalFitTrack track(x_first, a_first, ea_first, 2, 0, 0);
05531         }
05532 
05533         // Backward filter 
05534         // Attention, the initial error matrix of track_back is the error matrix
05535         // that after filter_fwd_calib(...) course of track_lead. So one thing need
05536         // more consideration that how to chose the inital error matrix of this smoother,
05537         // to put it by hand or use the error matrix after filter_fwd_calib. I think
05538         // it should be to refer R.G.Brown's book.
05539 
05540         KalFitTrack track_back(track_lead);
05541 
05542         //track_back(track);
05543 
05544 
05545         if (debug_ == 4) {
05546                 cout << " Backward fitting flag:" << back_<< endl;
05547                 cout << "track_back pivot " << track_back.pivot() 
05548                         << " track_lead kappa " << track_lead.a()[2]
05549                         <<endl;
05550         }
05551 
05552         if (back_ && track_lead.a()[2] != 0 && 
05553                         1/fabs(track_lead.a()[2]) > pT_) {
05554                 track_back.HitsMdc(track_lead.HitsMdc());
05555 
05556                 if (KalFitTrack::tofall_) {
05557 
05558                         double p_kaon(0), p_proton(0);
05559 
05560                         if (!(kaltrk->getStat(0,3))) {
05561                                 p_kaon = 1 / fabs(kaltrk->getZHelixK()[2]) * 
05562                                         sqrt(1 + kaltrk->getZHelixK()[4]*kaltrk->getZHelixK()[4]);
05563                                 track_back.p_kaon(p_kaon);
05564                         } else {
05565                                 p_kaon = 1 / fabs(track_back.a()[2]) *
05566                                         sqrt(1 + track_back.a()[4]*track_back.a()[4]);
05567                                 track_back.p_kaon(p_kaon);        
05568                         }
05569                         if (!(kaltrk->getStat(0,4))) {
05570                                 p_proton = 1 / fabs(kaltrk->getZHelixP()[2]) * 
05571                                         sqrt(1 + kaltrk->getZHelixP()[4]*kaltrk->getZHelixP()[4]);
05572                                 track_back.p_proton(p_proton);
05573                         } else {
05574                                 p_proton = 1 / fabs(track_back.a()[2]) *
05575                                         sqrt(1 + track_back.a()[4]*track_back.a()[4]);
05576                                 track_back.p_proton(p_proton);
05577                         }
05578 
05579                 }
05580 
05581 
05582                 if (!(i_back_<0)) {
05583                         for(int l_mass = 0; l_mass < nmass; l_mass++) {
05584                                 KalFitTrack track_seed(track_back);
05585                                 track_seed.chgmass(l_mass);     
05586                                 smoother_calib(track_seed, -way); 
05587                                 // fill TDS  for backward filter :
05588                                 fillTds_back(track_seed, kaltrk, TrasanTRK, l_mass,segcol);
05589                         }
05590                 } else {
05591 
05592                         smoother_calib(track_back, -way); 
05593                         // fill TDS  for backward filter , for leading particle hypothesis :
05594                         fillTds_back(track_back, kaltrk, TrasanTRK, lead_,segcol);
05595                         // fillTds_helixsegs(track_back,TrasanTRK);
05596                 }
05597         }
05598 
05599         /*
05600         // Take care of the pointers (use lead. hyp results by default)
05601         for(int pid = 0; pid < nmass;
05602         pid++) {
05603         if (pid == lead_) continue;
05604         if (kaltrk->getStat(1,pid)) 
05605         sameas(kaltrk, pid, lead_);
05606         }
05607          */
05608 
05609         //check: before register into TDS
05610 
05611         log << MSG::DEBUG << "registered MDC Kalmantrack:"
05612                 << "Track Id: " << kaltrk->getTrackId()
05613                 << " Mass of the fit: "<< kaltrk->getMass(2)<< endreq
05614                 << "Length of the track: "<< kaltrk->getLength(2)
05615                 << "  Tof of the track: "<< kaltrk->getTof(2) << endreq
05616                 << "Chisq of the fit: "<< kaltrk->getChisq(0,2)
05617                 <<"  "<< kaltrk->getChisq(1,2) << endreq
05618                 << "Ndf of the fit: "<< kaltrk->getNdf(0,2)
05619                 <<"  "<< kaltrk->getNdf(1,2) << endreq
05620                 << "Helix " << kaltrk->getZHelix()[2]
05621                 <<endreq;
05622 
05623         kalcol->push_back(kaltrk);
05624         track_lead.HitsMdc().clear();
05625         track_back.HelixSegs().clear();
05626         //  ??ATTENTION!! should track_back.HelixSegs() be cleared ??
05627 }

void KalFitAlg::complete_track MdcRec_trk TrasanTRK,
MdcRec_trk_add TrasanTRK_add,
KalFitTrack track_lead,
RecMdcKalTrack kaltrk,
RecMdcKalTrackCol kalcol,
RecMdcKalHelixSegCol segcol,
int  flagsmooth
 

fill tds with results got at (0,0,0)

05247 {
05248         static int nmass = KalFitTrack::nmass();
05249         int way(1);
05250         MsgStream log(msgSvc(), name());
05251         KalFitTrack track_first(track_lead);
05252         KalFitTrack track_ip(track_lead);
05253         innerwall(track_ip, lead_, way); 
05254         // Fill Tds
05255         fillTds_ip(TrasanTRK, track_ip, kaltrk, lead_);
05256         // std::cout<<"track_first nster"<<track_first.nster()<<std::endl;
05257 
05258         fillTds_lead(TrasanTRK, track_first, kaltrk, lead_);
05259         // Refit for different mass assumptions :  
05260         double pp = track_lead.momentum().mag();
05261 
05262         if(!(i_front_<0)){
05263 
05264                 for(int l_mass = 0, flg = 1; l_mass < nmass;
05265                                 l_mass++, flg <<= 1) {
05266 
05267                         if (!(mhyp_ & flg)) continue;
05268                         if (l_mass == lead_) continue;
05269 
05270                         // Check the mom. to decide of the refit with this mass assumption
05271                         if ((lead_ != 0 && l_mass==0 && pp > pe_cut_) || 
05272                                         (lead_ != 1 && l_mass==1 && pp > pmu_cut_) ||
05273                                         (lead_ != 2 && l_mass==2 && pp > ppi_cut_) ||
05274                                         (lead_ != 3 && l_mass==3 && pp > pk_cut_) ||
05275                                         (lead_ != 4 && l_mass==4 && pp > pp_cut_)) 
05276                                 continue;
05277                         if(debug_ == 4) cout<<"complete_track..REFIT ASSUMPION " << l_mass << endl;
05278                         // Initialisation :
05279                         double chiSq = 0;
05280                         int nhits = 0;
05281 
05282                         // Initialisation : (x, a, ea)
05283                         HepPoint3D x_trasan(TrasanTRK.pivot[0],
05284                                         TrasanTRK.pivot[1],
05285                                         TrasanTRK.pivot[2]);
05286                         HepVector a_trasan(5);
05287                         for(int i = 0; i < 5; i++)
05288                                 a_trasan[i] = TrasanTRK.helix[i];
05289 
05290                         HepSymMatrix ea_trasan(5);
05291                         for(int i = 0, k = 0; i < 5; i++) {
05292                                 for(int j = 0; j <= i; j++) {
05293                                         ea_trasan[i][j] = matrixg_*TrasanTRK.error[k++];
05294                                         ea_trasan[j][i] = ea_trasan[i][j];
05295                                 }
05296                         }
05297 
05298                         KalFitTrack track(x_trasan,a_trasan, ea_trasan, l_mass, chiSq, nhits);
05299                         track.HitsMdc(track_lead.HitsMdc());    
05300                         double fiTerm = TrasanTRK.fiTerm;
05301                         track.pivot(track.x(fiTerm));
05302                         HepSymMatrix Eakal(5,0);
05303 
05304                         double costheta = track.a()[4] / sqrt(1.0 + track.a()[4]*track.a()[4]);
05305                         if( (1.0/fabs(track.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
05306                                 choice_ = 6;
05307                         }
05308 
05309                         init_matrix(choice_,TrasanTRK, Eakal);
05310                         filter_fwd_anal(track, l_mass, way, Eakal);
05311                         KalFitTrack track_z(track);
05313                         innerwall(track_z, l_mass, way);     
05314                         fillTds_ip(TrasanTRK, track_z, kaltrk, l_mass);  
05315                         // Fill tds
05316                         fillTds(TrasanTRK, track, kaltrk, l_mass);     
05317                 }
05318         } // end of //end of if (!(i_front<0))
05319 
05320 
05321         // Refit with an enhancement of the error matrix at Mdc level :
05322         if (enhance_) {
05323 
05324                 HepPoint3D x_first(0, 0, 0);
05325                 HepVector a_first(kaltrk->getFHelix());
05326                 HepSymMatrix ea_first(kaltrk->getFError());
05327                 HepVector fac(5);
05328                 fac[0]=fac_h1_; fac[1]=fac_h2_; fac[2]=fac_h3_; fac[3]=fac_h4_; fac[4]=fac_h5_;
05329                 for(int i = 0; i < 5; i++)
05330                         for(int j = 0; j <= i; j++)
05331                                 ea_first[i][j] = fac[i]*fac[j]*ea_first[i][j];
05332                 KalFitTrack track(x_first, a_first, ea_first, 2, 0, 0);
05333         }
05334 
05335         // Backward filter :  
05336         KalFitTrack track_back(track_lead);
05337         if (debug_ == 4) {
05338                 cout << " Backward fitting flag:" << back_<< endl;
05339                 cout << "track_back pivot " << track_back.pivot() 
05340                         << " track_lead kappa " << track_lead.a()[2]
05341                         <<endl;
05342         }
05343 
05344         if (back_ && track_lead.a()[2] != 0 && 
05345                         1/fabs(track_lead.a()[2]) > pT_) {
05346                 track_back.HitsMdc(track_lead.HitsMdc());
05347 
05348                 if (KalFitTrack::tofall_) {
05349                         double p_kaon(0), p_proton(0);
05350                         if (!(kaltrk->getStat(0,3))) {
05351                                 p_kaon = 1 / fabs(kaltrk->getZHelixK()[2]) * 
05352                                         sqrt(1 + kaltrk->getZHelixK()[4]*kaltrk->getZHelixK()[4]);
05353                                 track_back.p_kaon(p_kaon);
05354                         } else {
05355                                 p_kaon = 1 / fabs(track_back.a()[2]) *
05356                                         sqrt(1 + track_back.a()[4]*track_back.a()[4]);
05357                                 track_back.p_kaon(p_kaon);        
05358                         }
05359                         if (!(kaltrk->getStat(0,4))) {
05360                                 p_proton = 1 / fabs(kaltrk->getZHelixP()[2]) * 
05361                                         sqrt(1 + kaltrk->getZHelixP()[4]*kaltrk->getZHelixP()[4]);
05362                                 track_back.p_proton(p_proton);
05363                         } else {
05364                                 p_proton = 1 / fabs(track_back.a()[2]) *
05365                                         sqrt(1 + track_back.a()[4]*track_back.a()[4]);
05366                                 track_back.p_proton(p_proton);
05367                         }
05368                 }
05369 
05370                 if (!(i_back_<0)) {
05371                         //cout<<" *** in smoothing process ***"<<endl;
05372                         for(int l_mass = 0; l_mass < nmass; l_mass++) {
05373                                 //cout<<" --- in hypothesis "<<l_mass<<" :"<<endl;
05374                                 KalFitTrack track_seed(track_back);
05375                                 track_seed.chgmass(l_mass);     
05376                                 smoother_anal(track_seed, -way); 
05377                                 // if( usage_ == 1) smoother_calib(track_seed, -way);
05378                                 //cout<<"fillTds_back 1"<<endl;
05379                                 // fill TDS  for backward filter :
05380                                 fillTds_back(track_seed, kaltrk, TrasanTRK, l_mass, segcol, 1);
05381                                 //cout<<"nHits: "<<kaltrk->getVecHelixSegs().size()<<endl;
05382                         }
05383                 } else {
05384                         smoother_anal(track_back, -way);
05385                         //smoother_calib(track_back, -way);
05386                         // smoother(track_back, -way); 
05387                         // fill TDS  for backward filter :
05388                         //cout<<"fillTds_back 2"<<endl;
05389                         fillTds_back(track_back, kaltrk, TrasanTRK, lead_, segcol, 1);
05390                 }
05391         }
05392         /*
05393         // Take care of the pointers (use lead. hyp results by default)
05394         for(int pid = 0; pid < nmass;
05395         pid++) {
05396         if (pid == lead_) continue;
05397         if (kaltrk->getStat(1,pid)) 
05398         sameas(kaltrk, pid, lead_);
05399         }
05400          */
05401 
05402         //check: before register into TDS
05403 
05404         log << MSG::DEBUG << "registered MDC Kalmantrack:"
05405                 << "Track Id: " << kaltrk->getTrackId()
05406                 << " Mass of the fit: "<< kaltrk->getMass(2)<< endreq
05407                 << "Length of the track: "<< kaltrk->getLength(2)
05408                 << "  Tof of the track: "<< kaltrk->getTof(2) << endreq
05409                 << "Chisq of the fit: "<< kaltrk->getChisq(0,2)
05410                 <<"  "<< kaltrk->getChisq(1,2) << endreq
05411                 << "Ndf of the fit: "<< kaltrk->getNdf(0,2)
05412                 <<"  "<< kaltrk->getNdf(1,2) << endreq
05413                 << "Helix " << kaltrk->getZHelix()[2]
05414                 <<endreq;
05415 
05416         kalcol->push_back(kaltrk);
05417         track_lead.HitsMdc().clear();
05418 }

StatusCode KalFitAlg::execute  ) 
 

event function

StatusCode KalFitAlg::execute  ) 
 

event function

00645 {
00646         MsgStream log(msgSvc(), name());
00647         log << MSG::INFO << "in execute()" << endreq;
00648         //std::cout<<"begin to deal with EVENT  ..."<<(++eventno)<<std::endl;
00649         for(int i=0; i<5; i++) iqual_front_[i] = 1;
00650         iqual_back_ = 1;
00651 
00653         IMagneticFieldSvc* IMFSvc; 
00654         StatusCode sc = service ("MagneticFieldSvc",IMFSvc);
00655         if(sc!=StatusCode::SUCCESS) {
00656                 log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq; 
00657         }
00658 
00659         // Nominal magnetic field : 
00660         if (KalFitTrack::numfcor_){
00661                 KalFitTrack::Bznom_ = (IMFSvc->getReferField())*10000; //unit is KGauss
00662                 if(0 == KalFitTrack::Bznom_)   KalFitTrack::Bznom_ = -10;
00663 
00664                 if(4 == debug_){
00665                         std::cout<<" execute, referField from MagneticFieldSvc: "<< (IMFSvc->getReferField())*10000 <<std::endl;
00666                         std::cout<<" magnetic field: "<<KalFitTrack::Bznom_<<std::endl;
00667                 }
00668         }
00669 
00670         RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;
00671 
00672         IDataProviderSvc* evtSvc = NULL;
00673         Gaudi::svcLocator()->service("EventDataSvc", evtSvc);
00674         if (evtSvc) {
00675                 log << MSG::INFO << "makeTds:event Svc has been found" << endreq;
00676         } else {
00677                 log << MSG::FATAL << "makeTds:Could not find eventSvc" << endreq;
00678                 return StatusCode::SUCCESS;
00679         }
00680 
00681         StatusCode kalsc;
00682         IDataManagerSvc *dataManSvc;
00683         dataManSvc= dynamic_cast<IDataManagerSvc*>(evtSvc);
00684         DataObject *aKalTrackCol;
00685         evtSvc->findObject("/Event/Recon/RecMdcKalTrackCol",aKalTrackCol);
00686         if(aKalTrackCol != NULL) {
00687                 dataManSvc->clearSubTree("/Event/Recon/RecMdcKalTrackCol");
00688                 evtSvc->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
00689         }
00690 
00691         kalsc = evtSvc->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
00692         if( kalsc.isFailure() ) {
00693                 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
00694                 return StatusCode::SUCCESS;
00695         }
00696         log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
00697 
00698         DataObject *aKalHelixSegCol;
00699         evtSvc->findObject("/Event/Recon/RecMdcKalHelixSegCol", aKalHelixSegCol);
00700         if(aKalHelixSegCol != NULL){
00701                 dataManSvc->clearSubTree("/Event/Recon/RecMdcKalHelixSegCol");
00702                 evtSvc->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
00703         }
00704         RecMdcKalHelixSegCol *helixsegcol = new RecMdcKalHelixSegCol;  
00705         kalsc = evtSvc->registerObject("/Event/Recon/RecMdcKalHelixSegCol", helixsegcol);
00706         if( kalsc.isFailure()){
00707                 log<< MSG::FATAL << "Could not register RecMdcKalHelixSeg" <<endreq;
00708                 return StatusCode::SUCCESS;
00709         }
00710         log << MSG::INFO << "RecMdcKalHelixSegCol register successfully!" <<endreq;
00711 
00712 
00713         /*IMdcGeomSvc* geosvc;
00714           StatusCode sc = service("MdcGeomSvc", geosvc);
00715           if (sc ==  StatusCode::SUCCESS) {
00716           } else {
00717           return sc;
00718           }*/
00719 
00720         MdcGeomSvc* const geosvc = dynamic_cast<MdcGeomSvc*>(imdcGeomSvc_);
00721         if(!geosvc) {
00722                 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitAlg::execute ...!!"<<std::endl; 
00723         }
00724 
00725         SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00726         if (!eventHeader) {
00727                 log << MSG::WARNING << "Could not find Event Header" << endreq;
00728                 return StatusCode::FAILURE;
00729         }
00730         int eventNo = eventHeader->eventNumber();
00731         int runNo = eventHeader->runNumber();
00732         if(runNo>0) wsag_=4;
00733         else wsag_=0;
00734 
00735         double t0=0.;
00736         SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
00737         if (estimeCol && estimeCol->size()) {
00738                 RecEsTimeCol::iterator iter_evt = estimeCol->begin();
00739                 t0 =  (*iter_evt)->getTest();
00740                 // t0Stat = (*iter_evt)->getStat();
00741         }else{
00742                 log << MSG::WARNING << "Could not find EvTimeCol" << endreq;
00743                 return StatusCode::SUCCESS;
00744         }
00745 
00746 
00747         if(debug_==4) {
00748                 std::cout<<"in KalFitAlg , we get the event start time = "<<t0<<std::endl;
00749         } 
00750         KalFitTrack::setT0(t0);
00751 
00752         SmartDataPtr<MdcDigiCol> mdcDigiCol(evtSvc,"/Event/Digi/MdcDigiCol");
00753         if (sc!=StatusCode::SUCCESS) {
00754                 log << MSG::FATAL << "Could not find MdcDigiCol!" << endreq;
00755                 return StatusCode::SUCCESS;
00756         }
00757         KalFitTrack::setMdcDigiCol(mdcDigiCol);
00758 
00759         // register RecMdcTrack and MdcRecHit collection 
00760 
00761         if((ntuple_&16)&&(ntuple_&1)) {
00762                 // McTruth infor,Retrieve MC track truth
00763                 // bool mcstat = true;
00764                 // more research needed ...
00765 
00766                 m_evtid = eventHeader->eventNumber();
00767                 bool mcstat = true;
00768 
00769                 SmartDataPtr<McParticleCol> mcPartCol(eventSvc(),"/Event/MC/McParticleCol");
00770                 if (!mcPartCol) {
00771                         log << MSG::WARNING << "Could not find McParticle" << endreq;
00772                         mcstat = false;
00773                 }
00774 
00775                 if(mcstat) {
00776                         McParticleCol::iterator i_mcTrk = mcPartCol->begin();
00777                         for (;i_mcTrk != mcPartCol->end(); i_mcTrk++) {
00778                                 if(!(*i_mcTrk)->primaryParticle()) continue;
00779                                 const HepLorentzVector& mom((*i_mcTrk)->initialFourMomentum());
00780                                 const HepLorentzVector& pos = (*i_mcTrk)->initialPosition();
00781                                 log << MSG::DEBUG << "MCINFO:particleId=" << (*i_mcTrk)->particleProperty()
00782                                         << " theta=" << mom.theta() <<" phi="<< mom.phi()
00783                                         <<" px="<< mom.px() <<" py="<< mom.py() <<" pz="<< mom.pz()
00784                                         << endreq;
00785                                 double charge = 0.0;
00786                                 int pid = (*i_mcTrk)->particleProperty();
00787                                 if( pid >0 ) { 
00788                                         charge = m_particleTable->particle( pid )->charge();
00789                                 } else if ( pid <0 ) {
00790                                         charge = m_particleTable->particle( -pid )->charge();
00791                                         charge *= -1;
00792                                 } else {
00793                                         log << MSG::WARNING << "wrong particle id, please check data" <<endreq;
00794                                 }
00795                                 HepPoint3D pos2(pos.x(),pos.y(),pos.z());
00796                                 Hep3Vector mom2(mom.px(),mom.py(),mom.pz());
00797 
00798                                 Helix mchelix(pos2, mom2, charge);
00799                                 log << MSG::DEBUG << "charge of the track " << charge << endreq;
00800                                 if( debug_ == 4) cout<< "helix: "<<mchelix.a()<<endl;
00801                                 mchelix.pivot( HepPoint3D(0,0,0) );
00802                                 for( int j =0; j<5; j++) {
00803                                         m_mchelix[j] = mchelix.a()[j];
00804                                 }
00805                                 m_mcpid = pid;
00806                                 m_mcptot = sqrt(1+pow(m_mchelix[4],2))/m_mchelix[2];
00807                         }       
00808                 }
00809         }
00810 
00811         Identifier mdcid;
00812 
00813         //retrieve  RecMdcTrackCol from TDS
00814         SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
00815         if (!newtrkCol) {
00816                 log << MSG::FATAL << "Could not find RecMdcTrackCol" << endreq;
00817                 return( StatusCode::SUCCESS);
00818         }
00819         log << MSG::INFO << "Begin to make MdcRecTrkCol and MdcRecWirhitCol"<<endreq;
00820 
00821         vector<MdcRec_trk>* mtrk_mgr = MdcRecTrkCol::getMdcRecTrkCol();
00822         mtrk_mgr->clear(); 
00823         vector<MdcRec_trk_add>* mtrkadd_mgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
00824         mtrkadd_mgr->clear();    
00825         vector<MdcRec_wirhit>* mhit_mgr = MdcRecWirhitCol::getMdcRecWirhitCol();
00826         mhit_mgr->clear();
00827 
00828         double trkx1,trkx2,trky1,trky2,trkz1,trkz2,trkthe1,trkthe2,trkphi1,trkphi2,trkp1,trkp2,trkr1,trkr2,trkkap1,trkkap2,trktanl1,trktanl2; 
00829         Hep3Vector csmp3[2];
00830         double csmphi[2];
00831         int status_temp=0;
00832         RecMdcTrackCol::iterator iter_trk = newtrkCol->begin();
00833         for(int kj = 1; iter_trk != newtrkCol->end(); iter_trk++,kj++) {
00834                 if(kj<3){
00835                         csmp3[kj-1]=(*iter_trk)->p3();
00836                         csmphi[kj-1] = (*iter_trk)->phi();
00837                 }
00838                 if(ntuple_&2) {
00839                         //check trackcol, track level
00840                         for( int j = 0, ij = 0; j<5; j++) {
00841                                 m_trkhelix[j] = (*iter_trk)->helix()[j];
00842                                 if(ntuple_&32) {
00843                                         for(int k=0; k<=j; k++,ij++) {
00844                                                 m_trkerror[ij] = (*iter_trk)->err()[j][k];
00845                                         }
00846                                 }
00847                         }
00848                         m_trkptot = sqrt(1+pow(m_trkhelix[4],2))/m_trkhelix[2];
00849                         if(ntuple_&32){
00850                                 m_trksigp = sqrt(pow((m_trkptot/m_trkhelix[2]),2)*m_trkerror[5]+
00851                                                 pow((m_trkhelix[4]/m_trkptot),2)*pow((1/m_trkhelix[2]),4)*m_trkerror[14]-
00852                                                 2*m_trkhelix[4]*m_trkerror[12]*pow((1/m_trkhelix[2]),3));
00853                         }
00854                         m_trkndf =  (*iter_trk)->ndof();
00855                         m_trkchisq =  (*iter_trk)->chi2();
00856 
00857                         if (debug_ == 4) cout<<"Ea from RecMdcTrackCol..." <<(*iter_trk)->err()<<endl;
00858 
00859                         StatusCode sc3 = m_nt3->write();
00860                         if( sc3.isFailure() ) cout<<"Ntuple3 filling failed!"<<endl;
00861                 }
00862                 //end of track level check and prepare evt check
00863                 if(ntuple_&4) {
00864                         /*
00865                            if(kj == 1) {
00866                            trkphi1 = (*iter_trk)->getFi0();
00867                            trkr1 = (*iter_trk)->getDr();
00868                            trkz1 = (*iter_trk)->getDz();        
00869                            trkkap1 = (*iter_trk)->getCpa();     
00870                            trktanl1 = (*iter_trk)->getTanl();   
00871                            trkx1 = trkr1*cos(trkphi1);
00872                            trky1 = trkr1*sin(trkphi1);
00873                            trkp1 = sqrt(1+trktanl1*trktanl1)/trkkap1;
00874                            trkthe1 = M_PI/2-atan(trktanl1);
00875                            } else if(kj == 2) {
00876                            trkphi2 = (*iter_trk)->getFi0();
00877                            trkr2 = (*iter_trk)->getDr();
00878                            trkz2 = (*iter_trk)->getDz();        
00879                            trkkap2 = (*iter_trk)->getCpa();     
00880                            trktanl2 = (*iter_trk)->getTanl();   
00881                            trkx2 = trkr2*cos(trkphi2);
00882                            trky2 = trkr2*sin(trkphi2);
00883                            trkp2 = sqrt(1+trktanl2*trktanl2)/trkkap1;
00884                            trkthe2 = M_PI/2-atan(trktanl2);
00885                            }
00886                          */
00887                 }
00888                 //end prepare   
00889 
00890                 log << MSG::DEBUG << "retrieved MDC tracks:"
00891                         << "   Nhits " <<(*iter_trk)->getNhits()
00892                         << "   Nster " <<(*iter_trk)->nster() <<endreq;
00893                 // so ,use this to get the hits vector belong to this track ... 
00894                 HitRefVec gothits = (*iter_trk)->getVecHits();
00895 
00896                 MdcRec_trk* rectrk = new MdcRec_trk;
00897 
00898                 rectrk->id = (*iter_trk)->trackId();
00899                 rectrk->chiSq = (*iter_trk)->chi2();
00900                 rectrk->ndf = (*iter_trk)->ndof();
00901                 rectrk->fiTerm = (*iter_trk)->getFiTerm();
00902                 rectrk->nhits = (*iter_trk)->getNhits();
00903                 rectrk->nster = (*iter_trk)->nster();
00904                 rectrk->nclus = 0;
00905                 rectrk->stat = (*iter_trk)->stat();
00906                 status_temp = (*iter_trk)->stat();
00907                 MdcRec_trk_add* trkadd = new MdcRec_trk_add;
00908                 trkadd->id = (*iter_trk)->trackId(); 
00909                 trkadd->quality = 0;
00910                 trkadd->kind = 1;
00911                 trkadd->decision = 0;
00912                 trkadd->body = rectrk;
00913                 rectrk->add = trkadd;
00914 
00915                 for ( int i=0; i<5; i++) {
00916                         rectrk->helix[i] = (*iter_trk)->helix()[i];
00917                         if( i<3 ) rectrk->pivot[i] = (*iter_trk)->getPivot()[i];
00918                         for( int j = 1; j<i+2;j++) {
00919                                 rectrk->error[i*(i+1)/2+j-1] = (*iter_trk)->err()(i+1,j);
00920                         }
00921                 }
00922                 std::sort(gothits.begin(),  gothits.end(),  order_rechits);
00923                 HitRefVec::iterator it_gothit = gothits.begin();
00924                 for( ; it_gothit != gothits.end(); it_gothit++) {
00925 
00926                         if( (*it_gothit)->getStat() != 1 ) {
00927                                 if(activeonly_) {
00928                                         log<<MSG::WARNING<<"this hit is not used in helix fitting!"<<endreq; 
00929                                         continue;
00930                                 }
00931                         }
00932 
00933                         log << MSG::DEBUG << "retrieved hits in MDC tracks:"
00934                                 << "   hits DDL " <<(*it_gothit)->getDriftDistLeft()
00935                                 << "   hits DDR " <<(*it_gothit)->getDriftDistRight()
00936                                 << "   error DDL " <<(*it_gothit)->getErrDriftDistLeft()
00937                                 << "   error DDR " <<(*it_gothit)->getErrDriftDistRight()
00938                                 << "   id of hit "<<(*it_gothit)->getId() 
00939                                 << "   track id of hit "<<(*it_gothit)->getTrkId()
00940                                 << "   hits ADC " <<(*it_gothit)->getAdc() << endreq;
00941 
00942                         MdcRec_wirhit* whit = new MdcRec_wirhit;
00943                         whit->id = (*it_gothit)->getId();
00944                         whit->ddl = (*it_gothit)->getDriftDistLeft();
00945                         whit->ddr = (*it_gothit)->getDriftDistRight();
00946                         whit->erddl = (*it_gothit)->getErrDriftDistLeft();
00947                         whit->erddr = (*it_gothit)->getErrDriftDistRight();
00948                         whit->pChiSq = (*it_gothit)->getChisqAdd();
00949                         whit->lr = (*it_gothit)->getFlagLR();
00950                         whit->stat = (*it_gothit)->getStat();
00951                         mdcid = (*it_gothit)->getMdcId();
00952                         int layid =  MdcID::layer(mdcid);
00953                         int localwid = MdcID::wire(mdcid);
00954                         int w0id = geosvc->Layer(layid)->Wirst();
00955                         int wid = w0id + localwid;
00956                         log << MSG::INFO
00957                                 << "lr from PR: "<<whit->lr
00958                                 << " layerId = " << layid
00959                                 << " wireId = " << localwid
00960                                 << endreq;
00961 
00962                         const MdcGeoWire * const wirgeo = geosvc->Wire(wid); 
00963 
00964                         //std::cout<<"the track id of *it_gothit... "<<(*it_gothit)->getTrackId()<<std::endl; 
00965                         whit->rechitptr = *it_gothit;
00966                         whit->geo = wirgeo;
00967                         whit->dat = 0;
00968                         whit->trk = rectrk;
00969                         whit->tdc = (*it_gothit)->getTdc();
00970                         whit->adc= (*it_gothit)->getAdc();
00971                         rectrk->hitcol.push_back(whit);
00972                         mhit_mgr->push_back(*whit);
00973                 }
00974                 mtrk_mgr->push_back(*rectrk);
00975                 mtrkadd_mgr->push_back(*trkadd);
00976 
00977                 delete rectrk;
00978                 delete trkadd;
00979         }
00980 
00981         // check trkcol: evt level
00982         if(ntuple_&4) {
00983                 m_trkdelx = trkx1 - trkx2;
00984                 m_trkdely = trky1 - trky2;
00985                 m_trkdelz = trkz1 - trkz2;
00986                 m_trkdelthe = trkthe1 + trkthe2;
00987                 m_trkdelphi = trkphi1- trkphi2;
00988                 m_trkdelp = trkp1 - trkp2;
00989                 StatusCode sc4 = m_nt4->write();
00990                 if( sc4.isFailure() ) cout<<"Ntuple4 filling failed!"<<endl;
00991         }
00992 
00993         if(debug_ == 4) { std::cout<<"before refit,ntrk,nhits,nadd..."<<mtrk_mgr->size()
00994                 <<"********"<<mhit_mgr->size()<<"****"<<mtrkadd_mgr->size()<<endl;
00995         }
00996         // Actual fitter procedure :
00997 
00998         if(usage_ == 0) kalman_fitting_anal();
00999         if(usage_ == 1) kalman_fitting_calib();
01000         double mdang = 180.0 - csmp3[0].angle(csmp3[1].unit())*180.0/M_PI;
01001         double mdphi = 180.0 - fabs(csmphi[0]-csmphi[1])*180.0/M_PI;
01002         //std::cout<<"before refit,ntrk,nhits,nadd..."<<mtrk_mgr->size()<<" , "<<mhit_mgr->size()<<" , "<<mtrkadd_mgr->size()<<endl;
01003         if(usage_ == 2 && (mtrk_mgr->size())==2 && fabs(mdang)<m_dangcut && fabs(mdphi)<m_dphicut) kalman_fitting_csmalign();
01004         if(usage_ == 3 && (mtrk_mgr->size())==1 && status_temp==-1) kalman_fitting_MdcxReco_Csmc_Sew();
01005 
01006         log << MSG::DEBUG <<"after kalman_fitting(),but in execute...."<<endreq;
01007         clearTables();   
01008 
01009 
01010         /*  
01011         // --- test for songxy
01012         MdcID mdcId;
01013         SmartDataPtr<RecMdcKalTrackCol> recmdckaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
01014         cout<<"------------------------ new event ---------------------"<<endl;
01015         cout<<"recmdckaltrkCol->size()="<<recmdckaltrkCol->size()<<endl;
01016         cout<<"--------------------------------------------------------"<<endl;
01017         RecMdcKalTrack::setPidType(RecMdcKalTrack::electron);
01018         RecMdcKalTrackCol::iterator KalTrk= recmdckaltrkCol->begin();
01019         int i_trk=0;
01020         for(;KalTrk !=recmdckaltrkCol->end();KalTrk++){
01021         cout<<"*** track "<<i_trk++<<" ***"<<endl;
01022         HelixSegRefVec gothelixsegs = (*KalTrk)->getVecHelixSegs();
01023         HelixSegRefVec::iterator iter_hit = gothelixsegs.begin();
01024         if(iter_hit == gothelixsegs.end())cout<<"iter_hit == gothelixsegs.end()"<<endl;
01025         int nhitofthistrk=0;
01026         for( ; iter_hit != gothelixsegs.end(); iter_hit++){
01027         nhitofthistrk++;
01028         //cout<<"layerId: "<<(*iter_hit)->getLayerId()<<endl;
01029         //cout<<"Identifier: "<<(*iter_hit)->getMdcId()<<endl;
01030         cout<<"layerId: "<<mdcId.layer((*iter_hit)->getMdcId())<<endl;
01031         cout<<"getDT: "<<(*iter_hit)->getDT()<<endl;
01032         }
01033         iter_hit=gothelixsegs.begin();
01034         //for(int m=0; m<nhitofthistrk/5;m++){
01035         //      identifier = (*iter_hit) -> getMdcId();
01036         //}
01037         }
01038          */     
01039 
01040         // --- test for getStat(2, pid)
01041         /*
01042         SmartDataPtr<RecMdcKalTrackCol> recmdckaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
01043         SmartDataPtr<RecMdcTrackCol> mdcTrkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
01044         //RecMdcKalTrack::setPidType(RecMdcKalTrack::electron);
01045         RecMdcKalTrackCol::iterator KalTrk= recmdckaltrkCol->begin();
01046         int i_trk=0;
01047         for(RecMdcTrackCol::iterator mdcTrk = mdcTrkCol->begin(); KalTrk !=recmdckaltrkCol->end(); KalTrk++, mdcTrk++){
01048                 cout<<"*** track "<<i_trk++<<" ***"<<endl;
01049                 cout<<"trackId mdc: "<<(*mdcTrk)->trackId()<<endl;
01050                 cout<<"trackId kal: "<<(*KalTrk)->trackId()<<endl;
01051                 bool KalIsValid = true;
01052                 for(int i_pid=0; i_pid<5; i_pid++) {
01053                         cout<<"pid "<<i_pid<<" state 0 : "<<(*KalTrk)->getStat(0, i_pid)<<endl;
01054                         cout<<"pid "<<i_pid<<" state 1 : "<<(*KalTrk)->getStat(1, i_pid)<<endl;
01055                         if((*KalTrk)->getStat(0, i_pid)==1) {
01056                                 KalIsValid = false;
01057                                 switch(i_pid) {
01058                                         case 0: RecMdcKalTrack::setPidType(RecMdcKalTrack::electron);
01059                                                 break;
01060                                         case 1: RecMdcKalTrack::setPidType(RecMdcKalTrack::muon);
01061                                                 break;
01062                                         case 2: RecMdcKalTrack::setPidType(RecMdcKalTrack::pion);
01063                                                 break;
01064                                         case 3: RecMdcKalTrack::setPidType(RecMdcKalTrack::kaon);
01065                                                 break;
01066                                         case 4: RecMdcKalTrack::setPidType(RecMdcKalTrack::proton);
01067                                                 break;
01068                                 }
01069                                 cout<<"Helix Kal: "<<(*KalTrk)->helix()<<endl;
01070                                 cout<<"Helix Kal err: "<<(*KalTrk)->err()<<endl;
01071                         }
01072                 }
01073                 if(!KalIsValid) {
01074                         cout<<"Helix Mdc: "<<(*mdcTrk)->helix()<<endl;
01075                         cout<<"Helix Mdc err: "<<(*mdcTrk)->err()<<endl;
01076                 }
01077         }
01078         */
01079 
01080 
01081         return StatusCode::SUCCESS;
01082 }

void KalFitAlg::extToAnyPoint KalFitTrack trk,
const HepPoint3D point
 

void KalFitAlg::extToAnyPoint KalFitTrack trk,
const HepPoint3D point
 

void KalFitAlg::fillTds MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass
 

with results got at the inner Mdc hit

void KalFitAlg::fillTds MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass
 

with results got at the inner Mdc hit

01086                                                   {
01087 
01088         HepPoint3D IP(0,0,0);
01089         track.pivot(IP);
01090         // Fit quality
01091         int iqual(1);
01092         int trasster = TrasanTRK.nster, trakster = track.nster(),
01093             trasax(TrasanTRK.nhits-trasster), trakax(track.nchits()-trakster);
01094         if (TrasanTRK.nhits-track.nchits()>fitnocut_ || 
01095                         TrasanTRK.helix[2]*track.a()[2]<0)
01096                 iqual = 0;
01097 
01098         if (debug_ == 4) {
01099                 cout<< "trasster trakster trasax trakax  TrasK      trackK  iqual"<<endl
01100                         <<trasster<<"        "<<trakster<<"        "<<trasax<<"        "<<trakax
01101                         <<"   "<<TrasanTRK.helix[2]<<"   "<<track.a()[2]<<"   "<<iqual<<endl;  
01102                 cout<<"FillTds> track.chiSq..."<<track.chiSq()<<" nchits "<<track.nchits()
01103                         <<" nster "<<track.nster()<<" iqual "<<iqual<<" track.Ea "<< track.Ea()<<endl; 
01104 
01105                 cout<<"fillTds>.....track.Ea[2][2] "<<track.Ea()[2][2]<<endl;
01106                 cout << " TRASAN stereo = " << trasster
01107                         << " and KalFitTrack = " << trakster << std::endl;
01108                 cout << " TRASAN axial = " << trasax 
01109                         << " and KalFitTrack = " << trakax << std::endl;
01110 
01111                 if (!iqual) {
01112                         cout << "...there is a problem during fit !! " << std::endl;
01113                         if (trasster-trakster>5) 
01114                                 cout << " because stereo " << trasster-trakster << std::endl;
01115                         if (trasax-trakax >5)   
01116                                 cout << " because axial " << std::endl;
01117                         if (TrasanTRK.helix[2]*track.a()[2]<0)
01118                                 cout << " because kappa sign " << std::endl;
01119                 }
01120         }
01121         // Protection : if any problem, we keep the original information !!!!
01122         if (track.nchits() > 5 && track.nster() > 1 && 
01123                         track.nchits()-track.nster() > 2 && track.chiSq() > 0 &&
01124                         track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 && 
01125                         track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 && 
01126                         track.Ea()[4][4] > 0 && iqual) {
01127                 if(debug_ == 4) cout<<"fillTds>.....going on "<<endl;
01128                 trk->setStat(0,0,l_mass);
01129                 trk->setMass(track.mass(),l_mass);
01130 
01131                 // chisq & ndf 
01132                 trk->setChisq(track.chiSq(),0,l_mass);
01133                 trk->setNdf(track.nchits()-5,0,l_mass);
01134                 trk->setNhits(track.nchits(),l_mass);
01135 
01136                 trk->setFHelix(track.a(),l_mass);
01137                 trk->setFError(track.Ea(),l_mass);
01138 
01139         } else {
01140 
01141                 if(debug_) cout<<"ALARM: FillTds Not refit with KalFilter!!!"<<endl;
01142                 // NOT refit with Kalman filter :
01143                 trk->setStat(1,0,l_mass);
01144                 trk->setMass(KalFitTrack::mass(l_mass),l_mass);
01145                 // chisq & ndf (0 : filter ; 1 : smoother;)
01146                 trk->setChisq(TrasanTRK.chiSq,0,l_mass);
01147                 trk->setNdf(TrasanTRK.nhits-5,0,l_mass);
01148                 // nhits  
01149                 trk->setNhits(TrasanTRK.nhits,l_mass);
01150                 double a_trasan[5], ea_trasan[15];
01151                 for( int i =0 ; i <5; i++){
01152                         a_trasan[i] = TrasanTRK.helix[i];
01153                 }
01154                 for( int j =0 ; j <15; j++){
01155                         ea_trasan[j] = TrasanTRK.error[j];
01156                 }
01157                 trk->setFHelix(a_trasan, l_mass);
01158                 trk->setFError(ea_trasan,l_mass);
01159         }
01160 }

void KalFitAlg::fillTds_back KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass,
RecMdcKalHelixSegCol segcol,
int  smoothflag
 

for smoother process

void KalFitAlg::fillTds_back KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass,
RecMdcKalHelixSegCol segcol
 

void KalFitAlg::fillTds_back KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass
 

with results got at the outer Mdc hit

void KalFitAlg::fillTds_back KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass,
RecMdcKalHelixSegCol segcol,
int  smoothflag
 

for smoother process

right???

01834 {
01835 
01836         HepPoint3D IP(0,0,0);
01837 
01838         // attention  the pivot problem of the HelixSeg ... ???
01839         //track.pivot(IP);
01840         // Fit quality
01841         //int iqual(1);
01842         //if ((trk->getNdf(0,2))-(track.ndf_back()-5)>5)
01843         // form getNdf(0,2) to getNdf(0,1) for muon hypothesis  
01844 
01845         iqual_back_ = 1;
01846         if ((trk->getNdf(0,l_mass))-(track.ndf_back()-5)>5){
01847                 iqual_back_ = 0;
01848         }
01849 
01850         if(debug_ == 4){ 
01851                 std::cout<< "fillTds_back> mass "<<trk->getMass(2)<<" ndf[0][l_mass] "<<trk->getNdf(0,l_mass)<<endl;
01852                 std::cout<<"ndf_back  "<< track.ndf_back() << " chi2_back " << track.chiSq_back()<<endl;
01853         } 
01854 
01855 
01856         if (track.ndf_back() > 5 && track.chiSq_back() > 0 &&
01857                         track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 && 
01858                         track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 && 
01859                         track.Ea()[4][4] > 0 && fabs(track.a()[0]) < DBL_MAX && 
01860                         fabs(track.a()[1]) < DBL_MAX && fabs(track.a()[2]) < DBL_MAX && 
01861                         fabs(track.a()[3]) < DBL_MAX && fabs(track.a()[4]) < DBL_MAX && iqual_front_[l_mass] && iqual_back_){ 
01862 
01863                 // chisq ( for backward filter)
01864                 //std::cout<<"begin to fillTds_back track no. : "<<(++Tds_back_no)<<std::endl;
01865 
01866 
01867                 HelixSegRefVec helixsegrefvec;
01868                 for (vector<KalFitHelixSeg>::iterator it = track.HelixSegs().begin(); it!=track.HelixSegs().end();it ++)
01869                 {
01870 
01871                         //std::cout<<" alpha of KalFitHelixSeg: "<<it->alpha()<<std::endl;       
01872                         //std::cout<<" doca1 of KalFitHelixSeg: "<<(it->approach(*(it->HitMdc()),false))<<std::endl;
01873 
01874                         it->pivot(IP);
01875 
01876                         //std::cout<<" doca2 of KalFitHelixSeg: "<<(it->approach(*(it->HitMdc()),false))<<std::endl;
01877 
01878                         RecMdcKalHelixSeg* helixseg = new RecMdcKalHelixSeg;
01879                         helixseg->setResIncl(it->residual_include());
01880                         helixseg->setResExcl(it->residual_exclude());    
01881                         if(debug_ == 4) { 
01882                                 std::cout<<"helixseg->Res_inc ..."<<helixseg->getResIncl()<<std::endl;
01883                         }
01884                         //      helixseg->setDrIncl(it->a_include()[0]);  
01885                         //      helixseg->setFi0Incl(it->a_include()[1]);  
01886                         //      helixseg->setCpaIncl(it->a_include()[2]);  
01887                         //      helixseg->setDzIncl(it->a_include()[3]);  
01888                         //      helixseg->setTanlIncl(it->a_include()[4]);
01889                         //
01890                         //
01891                         //      helixseg->setDrExcl(it->a_exclude()[0]);
01892                         //      helixseg->setFi0Excl(it->a_exclude()[1]);             
01893                         //      helixseg->setCpaExcl(it->a_exclude()[2]);                        
01894                         //      helixseg->setDzExcl(it->a_exclude()[3]);                                 
01895                         //      helixseg->setTanlExcl(it->a_exclude()[4]);                                       
01896 
01897                         helixseg->setHelixIncl(it->a_include());
01898                         //helixseg->setErrorIncl(it->Ea_include());
01899 
01900                         //Helix temp(IP, it->a(), it->Ea());
01901 
01902                         //std::cout<<" doca3 of KalFitHelixSeg: "<<(temp.approach(*(it->HitMdc()),false))<<std::endl;
01903 
01904                         helixseg->setHelixExcl(it->a_exclude());
01905                         //helixseg->setErrorExcl(it->Ea_exclude());
01906                         //helixseg->setLayerId(it->layer());
01907 
01908                         if(debug_ == 4) {
01909                                 std::cout<<"KalFitHelixSeg track id .."<<it->HitMdc()->rechitptr()->getTrkId()<<std::endl; 
01910                                 std::cout<<"helixseg a: "<<it->a()<<std::endl;
01911                                 std::cout<<"helixseg a_excl: "<<helixseg->getHelixExcl()<<std::endl;
01912                                 std::cout<<"helixseg a_incl: "<<helixseg->getHelixIncl()<<std::endl;
01913 
01914                                 std::cout<<"helixseg Ea: "<<it->Ea()<<std::endl;
01915                                 std::cout<<"helixseg Ea_excl: "<<helixseg->getErrorExcl()<<std::endl;
01916                                 std::cout<<"helixseg Ea_incl: "<<helixseg->getErrorIncl()<<std::endl;
01917 
01918                                 std::cout<<"helixseg layer: "<<it->layer()<<std::endl;
01919                         }    
01920 
01921 
01922                         helixseg->setTrackId(it->HitMdc()->rechitptr()->getTrkId());
01923                         helixseg->setMdcId(it->HitMdc()->rechitptr()->getMdcId());
01924                         helixseg->setFlagLR(it->HitMdc()->LR());
01925                         helixseg->setTdc(it->HitMdc()->rechitptr()->getTdc());
01926                         helixseg->setAdc(it->HitMdc()->rechitptr()->getAdc());
01927                         helixseg->setZhit(it->HitMdc()->rechitptr()->getZhit());
01928                         helixseg->setTof(it->tof());
01929                         helixseg->setDocaIncl(it->doca_include());
01930                         helixseg->setDocaExcl(it->doca_exclude());
01931                         helixseg->setDD(it->dd());
01932                         helixseg->setEntra(it->HitMdc()->rechitptr()->getEntra());
01933                         helixseg->setDT(it->dt());
01934                         //cout<<"setDT( "<<it->dt()<<" )"<<endl;
01935                         segcol->push_back(helixseg);
01936                         SmartRef<RecMdcKalHelixSeg> refhelixseg(helixseg);
01937                         helixsegrefvec.push_back(refhelixseg);
01938                         if(ntuple_&8){
01939                                 m_docaInc = helixseg -> getDocaIncl();
01940                                 m_docaExc = helixseg -> getDocaExcl();
01941                                 m_residualInc = helixseg -> getResIncl();
01942                                 m_residualExc = helixseg -> getResExcl();
01943                                 m_dd = helixseg -> getDD();
01944                                 m_lr = helixseg->getFlagLR();
01945                                 m_tdrift = helixseg -> getDT();
01946                                 m_layerid = helixseg -> getLayerId();
01947                                 m_yposition= it->HitMdc()->wire().fwd().y();
01948                                 m_eventNo = eventNo;
01949                                 StatusCode sc6 = m_nt6->write();
01950                                 if( sc6.isFailure() ) cout<<"Ntuple6 helixseg filling failed!"<<endl;
01951 
01952                         }
01953                 }
01954 
01955                 trk->setVecHelixSegs(helixsegrefvec);
01956                 //cout<<"setVecHelixSegs with Kalman hits"<<endl;
01957                 if(debug_ == 4) {
01958                         std::cout<<"trk->getVecHelixSegs size..."<<(trk->getVecHelixSegs()).size()<<std::endl;
01959                 }
01960                 trk->setStat(0,1,l_mass);
01961                 trk->setChisq(track.chiSq_back(),1,l_mass);
01962                 trk->setNdf(track.ndf_back()-5,1,l_mass);
01963                 //   add setNhits ,maybe some problem
01964                 trk->setNhits(track.ndf_back(),l_mass);
01965                 if(!(track.ndf_back()==track.HelixSegs().size())) {
01966                         std::cout<<"THEY ARE NOT EQUALL!!!"<<std::endl;
01967                 } 
01968                 trk->setLength(track.pathip(),l_mass);
01969                 if(debug_ == 4) {
01970                         std::cout<<"l_mass "<<l_mass<<" path set as "<<track.pathip()<<endl;      
01971                 }   
01972                 trk->setTof(track.tof(),l_mass);
01973                 if (KalFitTrack::tofall_){
01974                         if(l_mass == 3) trk->setTof(track.tof_kaon(),l_mass);
01975                         if(l_mass == 4) trk->setTof(track.tof_proton(),l_mass);
01976                 }
01977                 // Path length in each MDC layer :
01978                 if (pathl_) 
01979                         for (int i = 0; i<43; i++) {
01980                                 trk->setPathl(track.pathl()[i],i);
01981                         }
01982                 trk->setLHelix(track.a(),l_mass);
01983                 trk->setLError(track.Ea(),l_mass);
01984                 trk->setLPivot(track.pivot(),l_mass);
01985 
01986                 trk->setLPoint(track.point_last(),l_mass);
01987                 trk->setPathSM(track.getPathSM(),l_mass);
01988                 trk->setTof(track.getTofSM(),l_mass);
01989                 trk->setFiTerm(track.getFiTerm(),l_mass);
01990                 double a_trasan[5], ea_trasan[15];
01991                 for( int i =0 ; i <5; i++){
01992                         a_trasan[i] = TrasanTRK.helix[i];
01993                 }
01994                 for( int j =0 ; j <15; j++){
01995                         ea_trasan[j] = TrasanTRK.helix[j];
01996                 }
01997                 trk->setTHelix(a_trasan);
01998                 trk->setTError(ea_trasan);
01999 
02000                 if(4 == debug_){
02001                         std::cout<<" last pivot: "<< trk->getLPivot(0)<<std::endl;
02002                         std::cout<<" pathl in SM: "<< trk->getPathSM(0)<<std::endl;
02003                         std::cout<<" fiTerm: "<< trk->getFiTerm(0)<<std::endl;
02004                         std::cout<<" last point: "<< trk->getLPoint(0)<<std::endl;
02005                 }
02006 
02007         } else {
02008 
02009                 if(debug_) cout<<"ALARM: FillTds_back Not refit with KalFilter!!!"<<endl;
02010                 // NOT refit with Kalman filter :
02011                 trk->setStat(1,1,l_mass);
02012 
02013                 HepPoint3D piv(TrasanTRK.pivot[0],
02014                                 TrasanTRK.pivot[1],
02015                                 TrasanTRK.pivot[2]);
02016 
02017                 HepVector a(5);
02018                 for(int i = 0; i < 5; i++)
02019                         a[i] = TrasanTRK.helix[i];
02020 
02021                 HepSymMatrix ea(5);
02022                 for(int i = 0, k = 0; i < 5; i++) {
02023                         for(int j = 0; j <= i; j++) {
02024                                 ea[i][j] = matrixg_*TrasanTRK.error[k++];
02025                                 ea[j][i] = ea[i][j];
02026                         }
02027                 }
02028 
02029                 KalFitTrack track_rep(piv, a, ea, lead_, 
02030                                 TrasanTRK.chiSq, TrasanTRK.nhits);
02031                 double fiTerm = TrasanTRK.fiTerm;
02032 
02033                 double fi0 = track_rep.phi0();
02034                 HepPoint3D  xc(track_rep.kappa()/fabs(track_rep.kappa())* 
02035                                 track_rep.center() );
02036                 double x = xc.x();
02037                 double y = xc.y();
02038                 double phi_x;
02039                 if( fabs( x ) > 1.0e-10 ){
02040                         phi_x = atan2( y, x );
02041                         if( phi_x < 0 ) phi_x += 2*M_PI;
02042                 } else {
02043                         phi_x = ( y > 0 ) ? M_PI_4: 3.0*M_PI_4;
02044                 }
02045                 if(debug_ == 4) cout<<"fiterm "<<fiTerm<<" fi0 "<<fi0<<" phi_x "<<phi_x<<endl;
02046                 double dphi = fabs( fiTerm + fi0 - phi_x );
02047                 if( dphi >= 2*M_PI ) dphi -= 2*M_PI;
02048                 double tanl = track_rep.tanl();
02049                 double cosl_inv = sqrt( tanl*tanl + 1.0 );
02050                 if(debug_ == 4) { 
02051                         cout<<"tanl= "<<tanl<<" radius "<<track_rep.radius()<<" dphi "<<dphi<<endl;
02052                         cout<<" cosl_inv  "<<cosl_inv<<"  radius_numf  "<<track_rep.radius_numf()<<endl;
02053                 }
02054                 //double track_len(fabs( track_rep.radius() * dphi * cosl_inv ));
02055                 double track_len(fabs( track_rep.radius() * fiTerm * cosl_inv )); // 2010-11-26 added by wangll
02056                 //cout<<"track radius : "<<track_rep.radius()<<"  "<<track.radius()<<endl;
02057                 double light_speed( 29.9792458 );     // light speed in cm/nsec
02058                 double pt( 1.0 / track_rep.kappa() );
02059                 double p( pt * sqrt( 1.0 + tanl*tanl ) );
02060 
02061 
02062                 // chisq (2 : for backward filter)
02063 
02064                 trk->setStat(1,1,l_mass);
02065                 trk->setChisq(TrasanTRK.chiSq,1,l_mass);
02066                 if(debug_ == 4) { 
02067                         std::cout<<".....fillTds_back...chiSq..."<< TrasanTRK.chiSq<<std::endl;
02068                         std::cout<<"...track_len..."<<track_len<<" ndf[1] "<< trk->getNdf(0,l_mass)<<std::endl;
02069                 }    
02070                 trk->setNdf(TrasanTRK.nhits-5,1,l_mass);
02071                 trk->setLength(track_len,l_mass);
02072                 double mass_over_p( KalFitTrack::mass(l_mass)/ p );
02073                 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
02074                 trk->setTof(track_len / ( light_speed * beta ), l_mass) ;
02075 
02076                 //track_rep.pivot(IP);
02077                 HepPoint3D LPiovt = track_rep.x(fiTerm);
02078                 track_rep.pivot(LPiovt);
02079 
02080                 trk->setLHelix(track_rep.a(),l_mass);         
02081                 trk->setLError(track_rep.Ea(),l_mass);
02082                 //trk->setLPivot(track.pivot(),l_mass); // commented 2010-09-02
02083                 //trk->setLPivot(IP, l_mass); // add 2010-09-02
02084                 trk->setLPivot(LPiovt, l_mass); // add 2010-11-25
02085 
02087                 trk->setLPoint(track.point_last(),l_mass);
02088                 //trk->setPathSM(track.getPathSM(),l_mass);// commented 2010-11-25 by wangll
02089                 trk->setPathSM(track_len,l_mass);// added 2010-11-25 by wangll
02090                 //trk->setTof(track.getTofSM(),l_mass);// commented 2010-11-25 by wangll
02091                 // trk->setFiTerm(track.getFiTerm(),l_mass); // commented 2010-11-25 by wangll
02092                 trk->setFiTerm(fiTerm,l_mass); // added by wangll 2010-11-25
02093                 trk->setTHelix(track_rep.a());         
02094                 trk->setTError(track_rep.Ea());
02095 
02096                 /*
02097                 // --- check track id   by wangll 2010-08-15
02098                 if(l_mass==lead_) {
02099                         //cout<<" ----- bad smooth track -----"<<endl;
02100                         //cout<<"l_mass = "<<l_mass<<endl;
02101                         int trkId = trk->trackId();
02102                         //
02103                         // cout<<"track id = "<<trkId<<endl;
02104                         // cout<<"THelix: "<<trk->getTHelix()<<endl;
02105                         // cout<<"FHelix: "<<trk->getFHelix()<<endl;
02106                         // cout<<"size of VecHelixSegs: "<<trk->getVecHelixSegs().size()<<endl;
02107                         // 
02108                         SmartDataPtr<RecMdcTrackCol> mdcTrkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
02109                         //int nMdcTrk = mdcTrkCol.size();
02110                         //cout<<"number of Mdc Tracks: "<<nMdcTrk<<endl;
02111                         RecMdcTrackCol::iterator iter_mdcTrk = mdcTrkCol->begin();
02112                         bool findMdcTrk = false;
02113                         for(; iter_mdcTrk != mdcTrkCol->end(); iter_mdcTrk++) {
02114                                 if(trkId==(*iter_mdcTrk)->trackId()) {
02115                                         findMdcTrk = true;
02116                                         break;
02117                                 }
02118                         }
02119                         if(findMdcTrk) {
02120                                 HitRefVec mdcVecHits = (*iter_mdcTrk)->getVecHits();
02121                                 int nHits = mdcVecHits.size();
02122                                 //cout<<"number of Mdc Hits: "<<nHits<<endl;
02123                                 HelixSegRefVec helixsegrefvec;
02124                                 HitRefVec::iterator iter_mdcHit = mdcVecHits.begin();
02125                                 for(int iii=0; iter_mdcHit!=mdcVecHits.end(); iter_mdcHit++,iii++) {
02126                                         RecMdcKalHelixSeg* helixseg = new RecMdcKalHelixSeg;
02127                                         //cout<<"hit "<<iii<<endl;
02128                                         //cout<<"getMdcId: "<<(*iter_mdcHit)->getMdcId()<<endl;
02129                                         //cout<<"getAdc: "<<(*iter_mdcHit)->getAdc()<<endl;
02130                                         //cout<<"getTdc: "<<(*iter_mdcHit)->getTdc()<<endl;
02131                                         //cout<<"getDriftT: "<<(*iter_mdcHit)->getDriftT()<<endl;
02132                                         //cout<<"getZhit: "<<(*iter_mdcHit)->getZhit()<<endl;
02133                                         //cout<<"getFlagLR: "<<(*iter_mdcHit)->getFlagLR()<<endl;
02134                                         //cout<<"getDriftDistLeft: "<<(*iter_mdcHit)->getDriftDistLeft()<<endl;
02135                                         //cout<<"getDriftDistRight: "<<(*iter_mdcHit)->getDriftDistRight()<<endl;
02136                                         //cout<<"getDoca: "<<(*iter_mdcHit)->getDoca()<<endl;
02137                                         //cout<<"getEntra: "<<(*iter_mdcHit)->getEntra()<<endl;
02138                                         // 
02139                                         helixseg->setMdcId((*iter_mdcHit)->getMdcId());
02140                                         helixseg->setAdc((*iter_mdcHit)->getAdc());
02141                                         helixseg->setTdc((*iter_mdcHit)->getTdc());
02142                                         helixseg->setZhit((*iter_mdcHit)->getZhit());
02143                                         helixseg->setFlagLR((*iter_mdcHit)->getFlagLR());
02144                                         if((*iter_mdcHit)->getFlagLR()==0) helixseg->setDD((*iter_mdcHit)->getDriftDistLeft());
02145                                         if((*iter_mdcHit)->getFlagLR()==1) helixseg->setDD((*iter_mdcHit)->getDriftDistRight());
02146                                         helixseg->setDocaIncl((*iter_mdcHit)->getDoca());
02147                                         helixseg->setEntra((*iter_mdcHit)->getEntra());
02148                                         helixseg->setDT((*iter_mdcHit)->getDriftT());
02149                                         segcol->push_back(helixseg);
02150                                         SmartRef<RecMdcKalHelixSeg> refhelixseg(helixseg);
02151                                         helixsegrefvec.push_back(refhelixseg);
02152                                 }
02153                                 trk->setVecHelixSegs(helixsegrefvec); 
02154                                 cout<<"setVecHelixSegs with Mdc hits"<<endl;
02155                         }
02156                         else cout<<"not find the Mdc Track!";       
02157                         //cout<<"size of VecHelixSegs: "<<trk->getVecHelixSegs().size()<<endl;
02158                 }
02159                 */
02160 
02161         }
02162 
02163         // test--------
02164         if(debug_ == 4) {
02165                 cout<<"Now let us see results after smoothering at IP:........."<<endl;
02166                 cout << " dr = " << track.a()[0] 
02167                         << ", Er_dr = " << sqrt(track.Ea()[0][0]) << std::endl;
02168                 cout<< " phi0 = " << track.a()[1] 
02169                         << ", Er_phi0 = " << sqrt(track.Ea()[1][1]) << std::endl;
02170                 cout << " PT = " << 1/track.a()[2] 
02171                         << ", Er_kappa = " << sqrt(track.Ea()[2][2]) << std::endl;
02172                 cout << " dz = " << track.a()[3] 
02173                         << ", Er_dz = " << sqrt(track.Ea()[3][3]) << std::endl;
02174                 cout << " tanl = " << track.a()[4] 
02175                         << ", Er_tanl = " << sqrt(track.Ea()[4][4]) << std::endl;
02176                 cout << " Ea = " << track.Ea() <<endl;
02177         }
02178         // test end ----------
02179 }

void KalFitAlg::fillTds_back KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass,
RecMdcKalHelixSegCol segcol
 

right???

01556 {
01557 
01558         HepPoint3D IP(0,0,0);
01559 
01560         // attention  the pivot problem of the HelixSeg ... ???
01561         track.pivot(IP);
01562         // Fit quality
01563         //int iqual(1);
01564         //if ((trk->getNdf(0,2))-(track.ndf_back()-5)>5)
01565         // form getNdf(0,2) to getNdf(0,1) for muon hypothesis  
01566 
01567         if ((trk->getNdf(0,l_mass))-(track.ndf_back()-5)>5){
01568                 iqual_back_ = 0;
01569         }
01570         if(usage_>1){
01571                 for(int i=0; i<5; i++) iqual_front_[i] = 1;
01572                 iqual_back_ = 1;
01573         }
01574         if(debug_ == 4){ 
01575                 std::cout<< "fillTds_back> mass "<<trk->getMass(2)<<" ndf[0][l_mass] "<<trk->getNdf(0,l_mass)<<endl;
01576                 std::cout<<"ndf_back  "<< track.ndf_back() << " chi2_back " << track.chiSq_back()<<endl;
01577                 std::cout<<"track.ndf_back(), track.chiSq_back(), track.Ea()[5][5], track.a()[5], iqual_front_, iqual_back_: "<<track.ndf_back()<<" , "<<track.chiSq_back()<<" , "<<track.Ea()<<" , "<<track.a()<<" , "<<iqual_front_[l_mass]<<" , "<<iqual_back_<<std::endl;
01578         } 
01579 
01580         if (track.ndf_back() > 5 && track.chiSq_back() > 0 &&
01581                         track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 && 
01582                         track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 && 
01583                         track.Ea()[4][4] > 0 && fabs(track.a()[0]) < DBL_MAX && 
01584                         fabs(track.a()[1]) < DBL_MAX && fabs(track.a()[2]) < DBL_MAX && 
01585                         fabs(track.a()[3]) < DBL_MAX && fabs(track.a()[4]) < DBL_MAX && iqual_front_[l_mass] && iqual_back_){ 
01586 
01587                 // chisq ( for backward filter)
01588                 //std::cout<<"begin to fillTds_back track no. : "<<(++Tds_back_no)<<std::endl;
01589 
01590 
01591                 HelixSegRefVec helixsegrefvec;
01592                 for (vector<KalFitHelixSeg>::iterator it = track.HelixSegs().begin(); it!=track.HelixSegs().end();it ++)
01593                 {
01594 
01595                         //std::cout<<" alpha of KalFitHelixSeg: "<<it->alpha()<<std::endl;       
01596                         //std::cout<<" doca1 of KalFitHelixSeg: "<<(it->approach(*(it->HitMdc()),false))<<std::endl;
01597 
01598                         it->pivot(IP);
01599 
01600                         //std::cout<<" doca2 of KalFitHelixSeg: "<<(it->approach(*(it->HitMdc()),false))<<std::endl;
01601 
01602                         RecMdcKalHelixSeg* helixseg = new RecMdcKalHelixSeg;
01603                         helixseg->setResIncl(it->residual_include());
01604                         helixseg->setResExcl(it->residual_exclude());    
01605                         if(debug_ == 4) { 
01606                                 std::cout<<"helixseg->Res_inc ..."<<helixseg->getResIncl()<<std::endl;
01607                         }
01608                         helixseg->setDrIncl(it->a_include()[0]);  
01609                         helixseg->setFi0Incl(it->a_include()[1]);  
01610                         helixseg->setCpaIncl(it->a_include()[2]);  
01611                         helixseg->setDzIncl(it->a_include()[3]);  
01612                         helixseg->setTanlIncl(it->a_include()[4]);
01613 
01614 
01615                         helixseg->setDrExcl(it->a_exclude()[0]);
01616                         helixseg->setFi0Excl(it->a_exclude()[1]);             
01617                         helixseg->setCpaExcl(it->a_exclude()[2]);                        
01618                         helixseg->setDzExcl(it->a_exclude()[3]);                                 
01619                         helixseg->setTanlExcl(it->a_exclude()[4]);                                       
01620 
01621                         helixseg->setHelixIncl(it->a_include());
01622                         helixseg->setErrorIncl(it->Ea_include());
01623 
01624                         //Helix temp(IP, it->a(), it->Ea());
01625 
01626                         //std::cout<<" doca3 of KalFitHelixSeg: "<<(temp.approach(*(it->HitMdc()),false))<<std::endl;
01627 
01628                         helixseg->setHelixExcl(it->a_exclude());
01629                         helixseg->setErrorExcl(it->Ea_exclude());
01630                         helixseg->setLayerId(it->layer());
01631 
01632                         if(debug_ == 4) {
01633                                 std::cout<<"KalFitHelixSeg track id .."<<it->HitMdc()->rechitptr()->getTrkId()<<std::endl; 
01634                                 std::cout<<"helixseg a: "<<it->a()<<std::endl;
01635                                 std::cout<<"helixseg a_excl: "<<helixseg->getHelixExcl()<<std::endl;
01636                                 std::cout<<"helixseg a_incl: "<<helixseg->getHelixIncl()<<std::endl;
01637 
01638                                 std::cout<<"helixseg Ea: "<<it->Ea()<<std::endl;
01639                                 std::cout<<"helixseg Ea_excl: "<<helixseg->getErrorExcl()<<std::endl;
01640                                 std::cout<<"helixseg Ea_incl: "<<helixseg->getErrorIncl()<<std::endl;
01641 
01642                                 std::cout<<"helixseg layer: "<<it->layer()<<std::endl;
01643                         }    
01644 
01645 
01646                         helixseg->setTrackId(it->HitMdc()->rechitptr()->getTrkId());
01647                         helixseg->setMdcId(it->HitMdc()->rechitptr()->getMdcId());
01648                         helixseg->setFlagLR(it->HitMdc()->LR());
01649                         helixseg->setTdc(it->HitMdc()->rechitptr()->getTdc());
01650                         helixseg->setAdc(it->HitMdc()->rechitptr()->getAdc());
01651                         helixseg->setZhit(it->HitMdc()->rechitptr()->getZhit());
01652                         helixseg->setTof(it->tof());
01653                         helixseg->setDocaIncl(it->doca_include());
01654                         helixseg->setDocaExcl(it->doca_exclude());
01655                         helixseg->setDD(it->dd());
01656                         helixseg->setEntra(it->HitMdc()->rechitptr()->getEntra());
01657                         helixseg->setDT(it->dt());
01658                         segcol->push_back(helixseg);
01659                         SmartRef<RecMdcKalHelixSeg> refhelixseg(helixseg);
01660                         helixsegrefvec.push_back(refhelixseg);
01661 
01662                         if(ntuple_&8){
01663                                 m_docaInc = helixseg -> getDocaIncl();
01664                                 m_docaExc = helixseg -> getDocaExcl();
01665                                 m_residualInc = helixseg -> getResIncl();
01666                                 m_residualExc = helixseg -> getResExcl();
01667                                 m_dd = helixseg -> getDD();
01668                                 m_lr = helixseg->getFlagLR();
01669                                 m_tdrift = helixseg -> getDT();
01670                                 m_layerid = helixseg -> getLayerId();
01671                                 m_yposition= it->HitMdc()->wire().fwd().y();
01672                                 m_eventNo = eventNo;
01673                                 StatusCode sc6 = m_nt6->write();
01674                                 if( sc6.isFailure() ) cout<<"Ntuple6 helixseg filling failed!"<<endl;
01675 
01676                         }
01677                 }
01678 
01679                 trk->setVecHelixSegs(helixsegrefvec); 
01680                 if(debug_ == 4) {
01681                         std::cout<<"trk->getVecHelixSegs size..."<<(trk->getVecHelixSegs()).size()<<std::endl;
01682                 }
01683                 trk->setStat(0,1,l_mass);
01684                 trk->setChisq(track.chiSq_back(),1,l_mass);
01685                 trk->setNdf(track.ndf_back()-5,1,l_mass);
01686                 //   add setNhits ,maybe some problem
01687                 trk->setNhits(track.ndf_back(),l_mass);
01688                 if(!(track.ndf_back()==track.HelixSegs().size())) {
01689                         std::cout<<"THEY ARE NOT EQUALL!!!"<<std::endl;
01690                 } 
01691                 trk->setLength(track.pathip(),l_mass);
01692                 if(debug_ == 4) {
01693                         std::cout<<"l_mass "<<l_mass<<" path set as "<<track.pathip()<<endl;      
01694                 }   
01695                 trk->setTof(track.tof(),l_mass);
01696                 if (KalFitTrack::tofall_){
01697                         if(l_mass == 3) trk->setTof(track.tof_kaon(),l_mass);
01698                         if(l_mass == 4) trk->setTof(track.tof_proton(),l_mass);
01699                 }
01700                 // Path length in each MDC layer :
01701                 if (pathl_) 
01702                         for (int i = 0; i<43; i++) {
01703                                 trk->setPathl(track.pathl()[i],i);
01704                         }
01705                 trk->setLHelix(track.a(),l_mass);
01706                 trk->setLError(track.Ea(),l_mass);
01707                 trk->setLPivot(track.pivot(),l_mass);
01708 
01709                 trk->setLPoint(track.point_last(),l_mass);
01710                 trk->setPathSM(track.getPathSM(),l_mass);
01711                 trk->setTof(track.getTofSM(),l_mass);
01712                 trk->setFiTerm(track.getFiTerm(),l_mass);
01713                 double a_trasan[5], ea_trasan[15];
01714                 for( int i =0 ; i <5; i++){
01715                         a_trasan[i] = TrasanTRK.helix[i];
01716                 }
01717                 for( int j =0 ; j <15; j++){
01718                         ea_trasan[j] = TrasanTRK.helix[j];
01719                 }
01720                 trk->setTHelix(a_trasan);
01721                 trk->setTError(ea_trasan);
01722 
01723                 if(4 == debug_){
01724                         std::cout<<" last pivot: "<< trk->getLPivot(0)<<std::endl;
01725                         std::cout<<" pathl in SM: "<< trk->getPathSM(0)<<std::endl;
01726                         std::cout<<" fiTerm: "<< trk->getFiTerm(0)<<std::endl;
01727                         std::cout<<" last point: "<< trk->getLPoint(0)<<std::endl;
01728                 }
01729 
01730         } else {
01731 
01732                 if(debug_) cout<<"ALARM: FillTds_back Not refit with KalFilter!!!"<<endl;
01733                 // NOT refit with Kalman filter :
01734                 trk->setStat(1,1,l_mass);
01735 
01736                 HepPoint3D piv(TrasanTRK.pivot[0],
01737                                 TrasanTRK.pivot[1],
01738                                 TrasanTRK.pivot[2]);
01739 
01740                 HepVector a(5);
01741                 for(int i = 0; i < 5; i++)
01742                         a[i] = TrasanTRK.helix[i];
01743 
01744                 HepSymMatrix ea(5);
01745                 for(int i = 0, k = 0; i < 5; i++) {
01746                         for(int j = 0; j <= i; j++) {
01747                                 ea[i][j] = matrixg_*TrasanTRK.error[k++];
01748                                 ea[j][i] = ea[i][j];
01749                         }
01750                 }
01751 
01752                 KalFitTrack track_rep(piv, a, ea, lead_, 
01753                                 TrasanTRK.chiSq, TrasanTRK.nhits);
01754                 double fiTerm = TrasanTRK.fiTerm;
01755 
01756                 double fi0 = track_rep.phi0();
01757                 HepPoint3D  xc(track_rep.kappa()/fabs(track_rep.kappa())* 
01758                                 track_rep.center() );
01759                 double x = xc.x();
01760                 double y = xc.y();
01761                 double phi_x;
01762                 if( fabs( x ) > 1.0e-10 ){
01763                         phi_x = atan2( y, x );
01764                         if( phi_x < 0 ) phi_x += 2*M_PI;
01765                 } else {
01766                         phi_x = ( y > 0 ) ? M_PI_4: 3.0*M_PI_4;
01767                 }
01768                 if(debug_ == 4) cout<<"fiterm "<<fiTerm<<" fi0 "<<fi0<<" phi_x "<<phi_x<<endl;
01769                 double dphi = fabs( fiTerm + fi0 - phi_x );
01770                 if( dphi >= 2*M_PI ) dphi -= 2*M_PI;
01771                 double tanl = track_rep.tanl();
01772                 double cosl_inv = sqrt( tanl*tanl + 1.0 );
01773                 if(debug_ == 4) { 
01774                         cout<<"tanl= "<<tanl<<" radius "<<track_rep.radius()<<" dphi "<<dphi<<endl;
01775                         cout<<" cosl_inv  "<<cosl_inv<<"  radius_numf  "<<track_rep.radius_numf()<<endl;
01776                 }
01777                 double track_len(fabs( track_rep.radius() * dphi * cosl_inv ));
01778                 double light_speed( 29.9792458 );     // light speed in cm/nsec
01779                 double pt( 1.0 / track_rep.kappa() );
01780                 double p( pt * sqrt( 1.0 + tanl*tanl ) );
01781 
01782 
01783                 // chisq (2 : for backward filter)
01784 
01785                 trk->setStat(1,1,l_mass);
01786                 trk->setChisq(TrasanTRK.chiSq,1,l_mass);
01787                 if(debug_ == 4) { 
01788                         std::cout<<".....fillTds_back...chiSq..."<< TrasanTRK.chiSq<<std::endl;
01789                         std::cout<<"...track_len..."<<track_len<<" ndf[1] "<< trk->getNdf(0,l_mass)<<std::endl;
01790                 }    
01791                 trk->setNdf(TrasanTRK.nhits-5,1,l_mass);
01792                 trk->setLength(track_len,l_mass);
01793                 double mass_over_p( KalFitTrack::mass(l_mass)/ p );
01794                 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
01795                 trk->setTof(track_len / ( light_speed * beta ), l_mass) ;
01796 
01797                 track_rep.pivot(IP);
01798 
01799                 trk->setLHelix(track_rep.a(),l_mass);         
01800                 trk->setLError(track_rep.Ea(),l_mass);
01801                 trk->setLPivot(track.pivot(),l_mass);
01802 
01804                 trk->setLPoint(track.point_last(),l_mass);
01805                 trk->setPathSM(track.getPathSM(),l_mass);
01806                 trk->setTof(track.getTofSM(),l_mass);
01807                 trk->setFiTerm(track.getFiTerm(),l_mass);
01808                 trk->setTHelix(track_rep.a());         
01809                 trk->setTError(track_rep.Ea());
01810 
01811         }
01812 
01813         // test--------
01814         if(debug_ == 4) {
01815                 cout<<"Now let us see results after smoothering at IP:........."<<endl;
01816                 cout << " dr = " << track.a()[0] 
01817                         << ", Er_dr = " << sqrt(track.Ea()[0][0]) << std::endl;
01818                 cout<< " phi0 = " << track.a()[1] 
01819                         << ", Er_phi0 = " << sqrt(track.Ea()[1][1]) << std::endl;
01820                 cout << " PT = " << 1/track.a()[2] 
01821                         << ", Er_kappa = " << sqrt(track.Ea()[2][2]) << std::endl;
01822                 cout << " dz = " << track.a()[3] 
01823                         << ", Er_dz = " << sqrt(track.Ea()[3][3]) << std::endl;
01824                 cout << " tanl = " << track.a()[4] 
01825                         << ", Er_tanl = " << sqrt(track.Ea()[4][4]) << std::endl;
01826                 cout << " Ea = " << track.Ea() <<endl;
01827         }
01828         // test end ----------
01829 }

void KalFitAlg::fillTds_back KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass
 

with results got at the outer Mdc hit

right???

01397 {
01398 
01399         HepPoint3D IP(0,0,0);
01400         //track.pivot(IP);
01401 
01402         // Fit quality
01403         int iqual(1);
01404 
01405         if ((trk->getNdf(0,l_mass))-(track.ndf_back()-5)>5)   iqual = 0;
01406 
01407         if(debug_ == 4) cout<< "fillTds_back> mass "<<trk->getMass(2)<<" ndf[0] "<<trk->getNdf(0,2)<<endl;
01408         if(debug_ == 4) cout<<"ndf_back  "<< track.ndf_back() << " chi2_back " << track.chiSq_back()<<endl;
01409 
01410         if (track.ndf_back() > 5 && track.chiSq_back() > 0 &&
01411                         track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 && 
01412                         track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 && 
01413                         track.Ea()[4][4] > 0 && fabs(track.a()[0]) < DBL_MAX && 
01414                         fabs(track.a()[1]) < DBL_MAX && fabs(track.a()[2]) < DBL_MAX && 
01415                         fabs(track.a()[3]) < DBL_MAX && fabs(track.a()[4]) < DBL_MAX &&
01416                         iqual) {
01417 
01418                 // chisq ( for backward filter)
01419 
01420                 trk->setStat(0,1,l_mass);
01421                 trk->setChisq(track.chiSq_back(),1,l_mass);
01422                 trk->setNdf(track.ndf_back()-5,1,l_mass);
01423                 trk->setLength(track.pathip(),l_mass);
01424                 if(debug_ == 4) cout<<"l_mass "<<l_mass<<" path set as "<<track.pathip()<<endl;      
01425                 trk->setTof(track.tof(),l_mass);
01426 
01427                 if (KalFitTrack::tofall_){
01428                         if(l_mass == 3) trk->setTof(track.tof_kaon(),l_mass);
01429                         if(l_mass == 4) trk->setTof(track.tof_proton(),l_mass);
01430                 }
01431 
01432                 // Path length in each MDC layer :
01433                 if (pathl_) 
01434                         for (int i = 0; i<43; i++) {
01435                                 trk->setPathl(track.pathl()[i],i);
01436                         }
01437 
01438                 trk->setLHelix(track.a(),l_mass);
01439                 trk->setLError(track.Ea(),l_mass);
01440                 trk->setLPivot(track.pivot(),l_mass);
01441 
01442                 trk->setLPoint(track.point_last(),l_mass);  
01443                 trk->setPathSM(track.getPathSM(),l_mass);
01444                 trk->setTof(track.getTofSM(),l_mass);
01445                 trk->setFiTerm(track.getFiTerm(),l_mass);
01446 
01447                 if(4 == debug_){
01448                         std::cout<<" last pivot: "<< trk->getLPivot(0)<<std::endl;
01449                         std::cout<<" pathl in SM: "<< trk->getPathSM(0)<<std::endl;
01450                         std::cout<<" fiTerm: "<< trk->getFiTerm(0)<<std::endl;    
01451                         std::cout<<" last point: "<< trk->getLPoint(0)<<std::endl;
01452                 }
01453 
01454         } else {
01455                 if(debug_) cout<<"ALARM: FillTds_back Not refit with KalFilter!!!"<<endl;
01456                 // NOT refit with Kalman filter :
01457                 trk->setStat(1,1,l_mass);
01458                 HepPoint3D piv(TrasanTRK.pivot[0],
01459                                 TrasanTRK.pivot[1],
01460                                 TrasanTRK.pivot[2]);
01461 
01462                 HepVector a(5);
01463                 for(int i = 0; i < 5; i++)
01464                         a[i] = TrasanTRK.helix[i];
01465 
01466                 HepSymMatrix ea(5);
01467                 for(int i = 0, k = 0; i < 5; i++) {
01468                         for(int j = 0; j <= i; j++) {
01469                                 ea[i][j] = matrixg_*TrasanTRK.error[k++];
01470                                 ea[j][i] = ea[i][j];
01471                         }
01472                 }
01473 
01474                 KalFitTrack track_rep(piv, a, ea, lead_, 
01475                                 TrasanTRK.chiSq, TrasanTRK.nhits);
01476                 double fiTerm = TrasanTRK.fiTerm;
01477 
01478                 double fi0 = track_rep.phi0();
01479                 HepPoint3D  xc(track_rep.kappa()/fabs(track_rep.kappa())* 
01480                                 track_rep.center() );
01481                 double x = xc.x();
01482                 double y = xc.y();
01483                 double phi_x;
01484                 if( fabs( x ) > 1.0e-10 ){
01485                         phi_x = atan2( y, x );
01486                         if( phi_x < 0 ) phi_x += 2*M_PI;
01487                 } else {
01488                         phi_x = ( y > 0 ) ? M_PI_4: 3.0*M_PI_4;
01489                 }
01490                 if(debug_ == 4) cout<<"fiterm "<<fiTerm<<" fi0 "<<fi0<<" phi_x "<<phi_x<<endl;
01491                 double dphi = fabs( fiTerm + fi0 - phi_x );
01492                 if( dphi >= 2*M_PI ) dphi -= 2*M_PI;
01493                 double tanl = track_rep.tanl();
01494                 double cosl_inv = sqrt( tanl*tanl + 1.0 );
01495                 if(debug_ == 4) { 
01496                         cout<<"tanl= "<<tanl<<" radius "<<track_rep.radius()<<" dphi "<<dphi<<endl;
01497                         cout<<" cosl_inv  "<<cosl_inv<<"  radius_numf  "<<track_rep.radius_numf()<<endl;
01498                 }
01499                 double track_len(fabs( track_rep.radius() * dphi * cosl_inv ));
01500                 double light_speed( 29.9792458 );     // light speed in cm/nsec
01501                 double pt( 1.0 / track_rep.kappa() );
01502                 double p( pt * sqrt( 1.0 + tanl*tanl ) );
01503 
01504                 // chisq (2 : for backward filter)
01505                 trk->setStat(1,1,l_mass);
01506                 trk->setChisq(TrasanTRK.chiSq,1,l_mass);
01507                 if(debug_ == 4) {
01508                         std::cout<<".....fillTds_back...chiSq..."<< TrasanTRK.chiSq<<endl;
01509                         std::cout<<"...track_len..."<<track_len<<" ndf[1] "<< trk->getNdf(0,l_mass)<<endl;
01510                 }
01511                 trk->setNdf(TrasanTRK.nhits-5,1,l_mass);
01512                 trk->setLength(track_len,l_mass);
01513                 double mass_over_p( KalFitTrack::mass(l_mass)/ p );
01514                 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
01515                 trk->setTof(track_len / ( light_speed * beta ), l_mass) ;
01516 
01517                 track_rep.pivot(IP);
01518 
01519                 trk->setLHelix(track_rep.a(),l_mass);      
01520                 trk->setLError(track_rep.Ea(),l_mass);
01521                 trk->setLPivot(track.pivot(),l_mass);
01522 
01524                 trk->setLPoint(track.point_last(),l_mass);
01525                 trk->setPathSM(track.getPathSM(),l_mass);
01526                 trk->setTof(track.getTofSM(),l_mass);
01527                 trk->setFiTerm(track.getFiTerm(),l_mass);
01528         }
01529 
01530         // test--------
01531         if(debug_ == 4) {
01532 
01533                 std::cout<<" last point: "<< trk->getLPoint(0)<<std::endl;
01534                 std::cout<<" pathl in SM: "<< trk->getPathSM(0)<<std::endl;
01535                 std::cout<<" fiTerm: "<< trk->getFiTerm(0)<<std::endl;
01536 
01537                 cout<<"Now let us see results after smoothering at IP:........."<<endl;
01538                 cout << " dr = " << track.a()[0] 
01539                         << ", Er_dr = " << sqrt(track.Ea()[0][0]) << std::endl;
01540                 cout<< " phi0 = " << track.a()[1] 
01541                         << ", Er_phi0 = " << sqrt(track.Ea()[1][1]) << std::endl;
01542                 cout << " PT = " << 1/track.a()[2] 
01543                         << ", Er_kappa = " << sqrt(track.Ea()[2][2]) << std::endl;
01544                 cout << " dz = " << track.a()[3] 
01545                         << ", Er_dz = " << sqrt(track.Ea()[3][3]) << std::endl;
01546                 cout << " tanl = " << track.a()[4] 
01547                         << ", Er_tanl = " << sqrt(track.Ea()[4][4]) << std::endl;
01548                 cout << " Ea = " << track.Ea() <<endl;
01549         }
01550         // test end ----------
01551 }

void KalFitAlg::fillTds_ip MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass
 

with results got at (0,0,0)

void KalFitAlg::fillTds_ip MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass
 

with results got at (0,0,0)

01257 {
01258         HepPoint3D IP(0,0,0);
01259         track.pivot(IP);
01260 
01261         if (debug_ == 4&& l_mass==lead_) {
01262                 cout << "fillTds_IP>......"<<endl;
01263                 cout << " dr = " << track.a()[0] 
01264                         << ", Er_dr = " << sqrt(track.Ea()[0][0]) << std::endl;
01265                 cout << " phi0 = " << track.a()[1] 
01266                         << ", Er_phi0 = " << sqrt(track.Ea()[1][1]) << std::endl;
01267                 cout << " PT = " << 1/track.a()[2] 
01268                         << ", Er_kappa =" << sqrt(track.Ea()[2][2]) << std::endl;
01269                 cout << " dz = " << track.a()[3] 
01270                         << ", Er_dz = " << sqrt(track.Ea()[3][3]) << std::endl;
01271                 cout << " tanl = " << track.a()[4] 
01272                         << ", Er_tanl = " << sqrt(track.Ea()[4][4]) << std::endl;
01273         }
01274 
01275         if (TrasanTRK.nhits-track.nchits()>fitnocut_ ||
01276                         TrasanTRK.helix[2]*track.a()[2]<0)
01277                 iqual_front_[l_mass] = 0;
01278 
01279 
01280         if (track.nchits() > 5 && track.nster() > 1 &&
01281                         track.nchits()-track.nster() > 2 && track.chiSq() > 0 &&
01282                         track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 &&
01283                         track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 &&
01284                         track.Ea()[4][4] > 0 && iqual_front_[l_mass]) {
01285 
01286                 // fill track information
01287                 double dr    = track.a()[0];
01288                 double phi0  = track.a()[1];
01289                 double kappa = track.a()[2];
01290                 double dz    = track.a()[3];
01291                 double tanl  = track.a()[4];
01292 
01293                 // vertex of the track
01294                 double vx = dr*cos(phi0); 
01295                 double vy = dr*sin(phi0);
01296                 double vz = dz;
01297 
01298                 // see Belle note148 for the formulas
01299                 // initial momentum of the track
01300                 if(0==kappa) kappa = 10e-10;
01301                 double px = -sin(phi0)/fabs(kappa);
01302                 double py = cos(phi0)/fabs(kappa);
01303                 double pz = tanl/fabs(kappa);
01304 
01305                 trk->setX(vx, l_mass);
01306                 trk->setY(vy, l_mass);
01307                 trk->setZ(vz, l_mass);
01308                 trk->setPx(px, l_mass);
01309                 trk->setPy(py, l_mass);
01310                 trk->setPz(pz, l_mass);
01311 
01312                 const HepPoint3D poca(dr*cos(phi0),dr*sin(phi0),dz); 
01313                 trk->setPoca(poca,l_mass);
01314 
01315                 trk->setZHelix(track.a(),l_mass);
01316                 trk->setZError(track.Ea(),l_mass);
01317 
01318 
01319                 //set charge
01320                 int charge=0;
01321                 if (kappa > 0.0000000001)
01322                         charge = 1;
01323                 else if (kappa < -0.0000000001)
01324                         charge = -1;
01325                 trk->setCharge(charge,l_mass);
01326 
01327                 //set theta
01328                 double ptot = sqrt(px*px+py*py+pz*pz);
01329                 trk->setTheta(acos(pz/ptot),l_mass);
01330         }
01331 
01332         else{
01333                 //cout<<"copy Mdc Helix in fillTds_ip()"<<endl;
01334 
01335                 // fill track information
01336                 double dr    = TrasanTRK.helix[0];
01337                 double phi0  = TrasanTRK.helix[1];
01338                 double kappa = TrasanTRK.helix[2];
01339                 double dz    = TrasanTRK.helix[3];
01340                 double tanl  = TrasanTRK.helix[4];
01341 
01342                 double vx = dr*cos(phi0); 
01343                 double vy = dr*sin(phi0);
01344                 double vz = dz;
01345 
01346                 if(0==kappa) kappa = 10e-10;
01347                 double px = -sin(phi0)/fabs(kappa);
01348                 double py = cos(phi0)/fabs(kappa);
01349                 double pz = tanl/fabs(kappa);
01350 
01351                 trk->setX(vx, l_mass);
01352                 trk->setY(vy, l_mass);
01353                 trk->setZ(vz, l_mass);
01354 
01355                 trk->setPx(px, l_mass);
01356                 trk->setPy(py, l_mass);
01357                 trk->setPz(pz, l_mass);
01358 
01359                 const HepPoint3D poca(dr*cos(phi0),dr*sin(phi0),dz); 
01360 
01361                 trk->setPoca(poca,l_mass);                               
01362                 //trk->setZHelix(TrasanTRK.helix,l_mass);
01363                 //trk->setZError(TrasanTRK.error,l_mass);
01364                 double a_trasan[5], ea_trasan[15];
01365                 for( int i =0 ; i <5; i++){
01366                         a_trasan[i] = TrasanTRK.helix[i];
01367                 }
01368                 for( int j =0 ; j <15; j++){
01369                         ea_trasan[j] = TrasanTRK.error[j];
01370                 }
01371                 trk->setZHelix(a_trasan,l_mass);
01372                 trk->setZError(ea_trasan,l_mass);
01373 
01374                 //set charge
01375                 int charge=0;
01376                 if (kappa > 0.0000000001)
01377                         charge = 1;
01378                 else if (kappa < -0.0000000001)
01379                         charge = -1;
01380                 trk->setCharge(charge,l_mass);
01381 
01382                 //set theta
01383                 double ptot = sqrt(px*px+py*py+pz*pz);
01384                 trk->setTheta(acos(pz/ptot),l_mass);
01385         }
01386 
01387         if(4==debug_) {
01388                 RecMdcKalTrack::setPidType(RecMdcKalTrack::electron);
01389                 std::cout<<"px: "<<trk->px()<<" py: "<<trk->py()<<" pz: "<<trk->pz()<<std::endl;
01390                 std::cout<<"vx: "<<trk->x()<<" vy: "<<trk->y()<<" vz: "<<trk->z()<<std::endl;
01391         }
01392 }

void KalFitAlg::fillTds_lead MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass
 

void KalFitAlg::fillTds_lead MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass
 

01164                                                   {
01165 
01166         HepPoint3D IP(0,0,0);
01167         track.pivot(IP);    
01168         // Fit quality
01169         // int iqual(1);
01170         int trasster = TrasanTRK.nster, trakster = track.nster(),
01171             trasax(TrasanTRK.nhits-trasster), trakax(track.nchits()-trakster);
01172         if (TrasanTRK.nhits-track.nchits()>fitnocut_ || 
01173                         TrasanTRK.helix[2]*track.a()[2]<0)
01174                 iqual_front_[l_mass] = 0;
01175         if (debug_ == 4) {
01176 
01177                 cout<<"Nhit from PR "<<TrasanTRK.nhits<<"  nhit  "<<track.nchits()<<endl;
01178                 cout<< "trasster trakster trasax trakax  TrasK      trackK  iqual"<<endl
01179                         <<trasster<<"        "<<trakster<<"        "<<trasax<<"        "<<trakax
01180                         <<"   "<<TrasanTRK.helix[2]<<"   "<<track.a()[2]<<"   "<<iqual_front_[l_mass]<<endl;  
01181                 cout<<"FillTds_lead> track.chiSq..."<<track.chiSq()<<" nchits "<<track.nchits()
01182                         <<" nster "<<track.nster()<<" iqual_front_[l_mass] "<<iqual_front_[l_mass]<<"  track.Ea "<<track.Ea()<<endl; 
01183 
01184                 cout << " TRASAN stereo = " << trasster
01185                         << " and KalFitTrack = " << trakster << std::endl;
01186                 cout << " TRASAN axial = " << trasax 
01187                         << " and KalFitTrack = " << trakax << std::endl;
01188 
01189                 if (!iqual_front_[l_mass]) {
01190                         cout << "...there is a problem during fit !! " << std::endl;
01191                         if (trasster-trakster>5) 
01192                                 cout << " because stereo " << trasster-trakster << std::endl;
01193                         if (trasax-trakax >5)   
01194                                 cout << " because axial " << std::endl;
01195                         if (TrasanTRK.helix[2]*track.a()[2]<0)
01196                                 cout << " because kappa sign " << std::endl;
01197                 }
01198         }
01199         // Protection : if any problem, we keep the original information !!!!
01200         if (track.nchits() > 5 && track.nster() > 1 && 
01201                         track.nchits()-track.nster() > 2 && track.chiSq() > 0 &&
01202                         track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 && 
01203                         track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 && 
01204                         track.Ea()[4][4] > 0 && iqual_front_[l_mass]) {
01205 
01206                 trk->setStat(0,0,l_mass);
01207                 trk->setMass(track.mass(),l_mass);
01208                 trk->setChisq(track.chiSq(),0,l_mass);
01209                 trk->setNdf(track.nchits()-5,0,l_mass);
01210                 trk->setNhits(track.nchits(),l_mass);
01211                 //trkid
01212                 trk->setTrackId(TrasanTRK.id);
01213 
01214                 if (debug_ == 4) cout<<" trasan id...1 "<<TrasanTRK.id<<endl;    
01215 
01216                 trk->setFHelix(track.a(),l_mass);
01217                 trk->setFError(track.Ea(),l_mass);
01218 
01219         } else {
01220                 
01221                 //cout<<"copy Mdc Helix in fillTds_lead()"<<endl;
01222 
01223                 if(debug_) cout<<"ALARM: FillTds_forMdc Not refit with KalFilter!!!"<<endl;
01224                 // NOT refit with Kalman filter :
01225                 trk->setStat(1,0,l_mass);
01226                 trk->setMass(KalFitTrack::mass(l_mass),l_mass);
01227 
01228                 // chisq & ndf 
01229                 trk->setChisq(TrasanTRK.chiSq,0,l_mass);
01230                 trk->setNdf(TrasanTRK.nhits-5,0,l_mass);
01231                 //trkid
01232                 trk->setTrackId(TrasanTRK.id);
01233 
01234                 if (debug_ ==4) cout<<" trasan id...2 "<<TrasanTRK.id<<endl;    
01235 
01236                 // nhits 
01237                 trk->setNhits(TrasanTRK.nhits,l_mass);
01238                 double a_trasan[5], ea_trasan[15];
01239                 for( int i =0 ; i <5; i++){
01240                         a_trasan[i] = TrasanTRK.helix[i];
01241                 }
01242                 for( int j =0 ; j <15; j++){
01243                         ea_trasan[j] = TrasanTRK.error[j];
01244                 }
01245                 trk->setFHelix(a_trasan,l_mass);
01246                 trk->setFError(ea_trasan,l_mass);
01247                 // trk->setFHelix(TrasanTRK.helix,l_mass);
01248                 // trk->setFError(TrasanTRK.error,l_mass);
01249         }
01250 }

void KalFitAlg::filter_fwd_anal KalFitTrack trk,
int  l_mass,
int  way,
HepSymMatrix &  Eakal
 

Kalman filter (forward) in Mdc.

void KalFitAlg::filter_fwd_anal KalFitTrack track,
int  l_mass,
int  way,
HepSymMatrix &  Eakal
 

Kalman filter (forward) in Mdc.

get the doca from another other independent method

02537 {
02538 
02539         // retrieve Mdc  geometry information
02540 
02541         IMdcGeomSvc* igeomsvc;
02542         StatusCode sc = Gaudi::svcLocator()->service("MdcGeomSvc", igeomsvc);
02543         if(sc==StatusCode::FAILURE) cout << "GeoSvc failing!!!!!!!SC=" << sc << endl; 
02544         MdcGeomSvc* geomsvc = dynamic_cast<MdcGeomSvc*>(igeomsvc);
02545         if(!geomsvc){
02546                 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitTrack.cxx !!"<<std::endl;
02547         }
02548 
02549         Hep3Vector x0inner(track.pivot());
02550         HepVector pos_old(3,0);
02551         double r0kal_prec(0);
02552         int  nhits_read(0);
02553         int nhit = track.HitsMdc().size();
02554         if(debug_ == 4) cout<<"filter_fwd..........111 nhit="<<nhit<<endl;
02555         for( int i=0 ; i < nhit; i++ ) {
02556                 KalFitHitMdc& HitMdc = track.HitMdc(i);
02557                 // veto on some hits :
02558                 if (HitMdc.chi2()<0) continue;    
02559                 const KalFitWire& Wire = HitMdc.wire();
02560                 int layerf = Wire.layer().layerId();
02561 
02562                 //std::cout<<"in layer: "<<layerf<<std::endl;
02563 
02564                 int wireid = Wire.geoID();
02565                 nhits_read++;
02566                 HepPoint3D fwd(Wire.fwd());
02567                 HepPoint3D bck(Wire.bck());
02568                 Hep3Vector wire = (CLHEP::Hep3Vector)fwd -(CLHEP::Hep3Vector)bck;
02569                 Helix work = *(Helix*)&track;
02570                 work.ignoreErrorMatrix();
02571                 work.pivot((fwd + bck) * .5);
02572 
02573                 //std::cout<<" (fwd + bck) * .5: "<<(fwd + bck)*.5<<std::endl;
02574                 //std::cout<<" track.x(0): "<<track.x(0)<<std::endl;
02575                 //std::cout<<" work.x(0): "<<work.x(0)<<std::endl;
02576                 //std::cout<<" bck: "<<bck<<std::endl;
02577 
02578                 HepPoint3D x0kal = (work.x(0).z() - bck.z())/ wire.z() * wire + bck;
02579 
02580                 if(4 == debug_) std::cout<<" x0kal before sag: "<<x0kal<<std::endl;
02581 
02582                 // Modification to take account of the wire sag :
02583                 /*
02584                    if (wsag_==1) {
02585                    double A(1.2402E-6);
02586                    if (nhits_read != 1 && r0kal_prec > RMW && x0kal.perp() < RMW)
02587                    A = 8.5265E-7;
02588                    HepPoint3D x0kal_up(x0kal);
02589                    double length = sqrt(wire.x()*wire.x()+wire.z()*wire.z());
02590                    double zp = (x0kal.z() - bck.z())*length/wire.z();
02591 
02592                    x0kal_up.setX(wire.x()*(x0kal.z()-bck.z())/wire.z()+bck.x());
02593                    x0kal_up.setY((A*(zp-length)+wire.y()/length)*zp+bck.y());
02594                    double slopex = wire.x()/wire.z();
02595                    double slopey = (A*(2*zp-length)*length+wire.y())/wire.z();
02596 
02597                    x0kal = x0kal_up;
02598                    wire.setX(slopex);
02599                    wire.setY(slopey);
02600                    wire.setZ(1);
02601 
02602                    } else if (wsag_ == 2 || wsag_ == 3){
02603                    double slopex = wire.x()/wire.z();
02604                    double slopey(0), zinit(x0kal.z());
02605                    double pos[3], yb_sag(0), yf_sag(0);
02606                    int wire_ID = Wire.geoID();
02607                    if (wsag_ == 2)
02608                    calcdc_sag2_(&wire_ID, &zinit, pos, &slopey, &yb_sag, &yf_sag);
02609 
02610                    else
02611                    calcdc_sag3_(&wire_ID, &zinit, pos, &slopey, &yb_sag, &yf_sag);
02612 
02613                    wire.setX(slopex);
02614                    wire.setY(slopey);
02615                    wire.setZ(1);
02616                    x0kal.setX(pos[0]);
02617                    x0kal.setY(pos[1]);
02618                    } else 
02619                  */
02620 
02621                 if (wsag_ == 4){
02622                         Hep3Vector result;
02623                         const MdcGeoWire* geowire = geomsvc->Wire(wireid); 
02624                         double tension = geowire->Tension();
02625                         //std::cout<<" tension: "<<tension<<std::endl;
02626                         double zinit(x0kal.z()), lzx(Wire.lzx());
02627                         // double A(Wire.Acoef());
02628                         double A = 47.35E-6/tension;
02629                         double Zp = (zinit - bck.z())*lzx/wire.z();
02630 
02631                         if(4 == debug_){
02632                                 std::cout<<" sag in filter_fwd_anal: "<<std::endl;
02633                                 std::cout<<" x0kal.x(): "<<std::setprecision(10)<<x0kal.x()<<std::endl;
02634                                 std::cout<<"zinit: "<<zinit<<" bck.z(): "<<bck.z()<<std::endl;
02635                                 std::cout<<" wire.x()*(zinit-bck.z())/wire.z(): "<<std::setprecision(10)
02636                                                                                    <<(wire.x()*(zinit-bck.z())/wire.z())<<std::endl;  
02637                                 std::cout<<"bck.x(): "<<std::setprecision(10)<<bck.x()<<std::endl;
02638                                 std::cout<<" wire.x()*(zinit-bck.z())/wire.z() + bck.x(): "<<std::setprecision(10)
02639                                                                                              <<(wire.x()*(zinit-bck.z())/wire.z() + bck.x())<<std::endl;
02640                         }
02641 
02642                         result.setX(wire.x()*(zinit-bck.z())/wire.z() + bck.x());
02643                         result.setY((A*(Zp-lzx)+wire.y()/lzx)*Zp+bck.y());
02644                         result.setZ((A*(2*Zp-lzx)*lzx+wire.y())/wire.z());
02645 
02646                         wire.setX(wire.x()/wire.z());
02647                         wire.setY(result.z());
02648                         wire.setZ(1);
02649                         x0kal.setX(result.x());
02650                         x0kal.setY(result.y());
02651                 }
02652 
02653                 if(4 == debug_) std::cout<<" x0kal after sag: "<<x0kal<<std::endl;
02654 
02655                 // If x0kal is after the inner wall and x0kal_prec before :
02656                 double r0kal = x0kal.perp();
02657 
02658                 // change PIVOT :
02659                 double pathl(0);
02660 
02661                 track.pivot_numf(x0kal, pathl);
02662 
02663                 if (nhits_read == 1) { 
02664                         track.Ea(Eakal);
02665                 } else {
02666                         if(KalFitElement::muls()) track.msgasmdc(pathl, way);
02667                         if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
02668                 }
02669 
02670                 double dtracknew = 0.;
02671                 double dtrack = 0.;
02672                 double dtdc = 0.;
02673                 // Add info hit wire :
02674                 if(track.kappa()) {
02675                         Hep3Vector meas = track.momentum(0).cross(wire).unit();
02676                         double diff_chi2 = track.chiSq();
02677                         Hep3Vector IP(0,0,0);
02678                         Helix work_bef = *(Helix*)&track;
02679                         work_bef.ignoreErrorMatrix();
02680                         work_bef.pivot(IP);
02681                         int inext(-1);
02682                         if (i+1<nhit)
02683                                 for( unsigned k=i+1 ; k < nhit; k++ )
02684                                         if (!(track.HitMdc(k).chi2()<0)) {
02685                                                 inext = (signed) k;
02686                                                 break;
02687                                         }
02688                         double dchi2 = -1.0;
02689 
02690                         double chi2 = track.update_hits(HitMdc,inext,meas,way,dchi2,dtrack,dtracknew,dtdc,m_csmflag);
02691 
02692 
02694 
02695                         /*
02696                            std::cout<<" step0: "<<std::endl;
02697                            KalFitTrack temp2(track);
02698                            std::cout<<" step1: "<<std::endl;
02699 
02700                            Helix       temp3(track.pivot(),track.a(),track.Ea());
02701                            Helix       temp4(track.pivot(),track.a(),track.Ea());
02702 
02703                            std::cout<<" step2: "<<std::endl;
02704                            double doca25 = temp2.approach(HitMdc, false);
02705                            std::cout<<" step3: "<<std::endl;
02706 
02707                            temp2.pivot(IP);
02708                            std::cout<<" a2: "<<temp2.a()<<std::endl;
02709 
02710                            std::cout<<" step4: "<<std::endl;
02711 
02712                            double doca26 = temp3.approach(HitMdc, false);
02713                            std::cout<<" another doca2.6: "<<doca26<<std::endl;
02714 
02715                            temp3.pivot(IP);
02716                            std::cout<<" a3: "<<temp3.a()<<std::endl;
02717 
02718                            temp4.bFieldZ(-10);
02719                            temp4.pivot(IP);
02720                            std::cout<<" a4: "<<temp4.a()<<std::endl;
02721 
02722                            std::cout<<" step5: "<<std::endl;
02723 
02724                            double doca1 = track.approach(HitMdc, false);
02725                            double doca2 = temp2.approach(HitMdc, false);
02726                            double doca3 = temp3.approach(HitMdc, false);
02727                            double doca4 = temp4.approach(HitMdc, false);
02728 
02729                            std::cout<<" dtrack: "<<dtrack<<std::endl;
02730                            std::cout<<" another doca1: "<<doca1<<std::endl;
02731                            std::cout<<" another doca2: "<<doca2<<std::endl;
02732                            std::cout<<" another doca2.5: "<<doca25<<std::endl;
02733                            std::cout<<" another doca3: "<<doca3<<std::endl;
02734                            std::cout<<" another doca4: "<<doca4<<std::endl;
02735                          */  
02736 
02737 
02738                         if( dchi2 <0 ) {
02739                                 std::cout<<" ... ERROR OF dchi2... "<<std::endl;
02740                         }
02741 
02742                         if (ntuple_&8) {
02743                                 m_dchi2 = dchi2;
02744                                 m_masshyp = l_mass;
02745                                 m_residest = dtrack-dtdc;
02746                                 m_residnew = dtracknew -dtdc;
02747                                 m_layer =  Wire.layer().layerId();
02748                                 Helix worktemp = *(Helix*)&track;
02749                                 m_anal_dr = worktemp.a()[0];
02750                                 m_anal_phi0 = worktemp.a()[1]; 
02751                                 m_anal_kappa = worktemp.a()[2];
02752                                 m_anal_dz = worktemp.a()[3]; 
02753                                 m_anal_tanl = worktemp.a()[4]; 
02754                                 m_anal_ea_dr = worktemp.Ea()[0][0];
02755                                 m_anal_ea_phi0 = worktemp.Ea()[1][1];
02756                                 m_anal_ea_kappa = worktemp.Ea()[2][2];
02757                                 m_anal_ea_dz = worktemp.Ea()[3][3];
02758                                 m_anal_ea_tanl = worktemp.Ea()[4][4];
02759                                 StatusCode sc5 = m_nt5->write();
02760                                 if( sc5.isFailure() ) cout<<"Ntuple5 filling failed!"<<endl;     
02761                         }
02762                         Helix work_aft = *(Helix*)&track;
02763                         work_aft.ignoreErrorMatrix();
02764                         work_aft.pivot(IP);
02765                         diff_chi2 = chi2 - diff_chi2; 
02766                         HitMdc.chi2(diff_chi2);
02767                 }
02768                 r0kal_prec = r0kal;
02769         }
02770 }

void KalFitAlg::filter_fwd_calib KalFitTrack trk,
int  l_mass,
int  way,
HepSymMatrix &  Eakal
 

void KalFitAlg::filter_fwd_calib KalFitTrack trk,
int  l_mass,
int  way,
HepSymMatrix &  Eakal
 

02775 {
02776 
02777         // retrieve Mdc  geometry information
02778         IMdcGeomSvc* igeomsvc;
02779         StatusCode sc = Gaudi::svcLocator()->service("MdcGeomSvc", igeomsvc);
02780         if(sc==StatusCode::FAILURE) cout << "GeoSvc failing!!!!!!!SC=" << sc << endl;
02781         MdcGeomSvc* geomsvc = dynamic_cast<MdcGeomSvc*>(igeomsvc);
02782         if(!geomsvc){
02783                 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitTrack.cxx !!"<<std::endl;
02784         }
02785 
02786         if(debug_ == 4) {
02787                 std::cout<<"filter_fwd_calib starting ...the inital error Matirx is "<<track.Ea()<<std::endl;
02788         }
02789         Hep3Vector x0inner(track.pivot());
02790         HepVector pos_old(3,0);
02791         double r0kal_prec(0);
02792         int  nhits_read(0);
02793 
02794         unsigned int nhit = track.HitsMdc().size();
02795         if(debug_ == 4) cout<<"filter_fwd..........111 nhit="<<nhit<<endl;
02796         for( unsigned i=0 ; i < nhit; i++ ) {
02797 
02798                 KalFitHitMdc& HitMdc = track.HitMdc(i);
02799                 if(debug_ == 4)
02800                         cout<<"filter_fwd...........222 chi2="<<HitMdc.chi2()<<endl;
02801                 // veto on some hits :
02802                 if (HitMdc.chi2()<0) continue;    
02803                 const KalFitWire& Wire = HitMdc.wire();
02804 
02805                 int wireid = Wire.geoID();
02806                 nhits_read++;
02807 
02808                 //    if (nhits_read == 1) track.Ea(Eakal);
02809                 HepPoint3D fwd(Wire.fwd());
02810                 HepPoint3D bck(Wire.bck());
02811                 Hep3Vector wire = (CLHEP::Hep3Vector)fwd -(CLHEP::Hep3Vector)bck;
02812                 Helix work = *(Helix*)&track;
02813                 work.ignoreErrorMatrix();
02814                 work.pivot((fwd + bck) * .5);
02815                 HepPoint3D x0kal = (work.x(0).z() - bck.z())/ wire.z() * wire + bck;
02816 
02817                 if(4 == debug_)
02818                         std::cout<<" x0kal before sag: "<<x0kal<<std::endl;
02819 
02820                 if (wsag_ == 4){
02821                         Hep3Vector result;
02822                         const MdcGeoWire* geowire = geomsvc->Wire(wireid); 
02823                         double tension = geowire->Tension();
02824                         //std::cout<<" tension: "<<tension<<std::endl;
02825                         double zinit(x0kal.z()), lzx(Wire.lzx());
02826                         // double A(Wire.Acoef());
02827                         double A = 47.35E-6/tension;
02828                         double Zp = (zinit - bck.z())*lzx/wire.z();
02829 
02830                         if(4 == debug_){
02831 
02832                                 std::cout<<" sag in filter_fwd_calib: "<<std::endl;
02833                                 std::cout<<" x0kal.x(): "<<std::setprecision(10)<<x0kal.x()<<std::endl;
02834                                 std::cout<<" wire.x()*(zinit-bck.z())/wire.z(): "<<std::setprecision(10)
02835                                                                                    <<(wire.x()*(zinit-bck.z())/wire.z())<<std::endl;
02836                                 std::cout<<"bck.x(): "<<std::setprecision(10)<<bck.x()<<std::endl;
02837                                 std::cout<<" wire.x()*(zinit-bck.z())/wire.z() + bck.x(): "<<std::setprecision(10)
02838                                                                                              <<(wire.x()*(zinit-bck.z())/wire.z() + bck.x())<<std::endl;
02839                         }
02840 
02841                         result.setX(wire.x()*(zinit-bck.z())/wire.z() + bck.x());
02842                         result.setY((A*(Zp-lzx)+wire.y()/lzx)*Zp+bck.y());
02843                         result.setZ((A*(2*Zp-lzx)*lzx+wire.y())/wire.z());
02844                         wire.setX(wire.x()/wire.z());
02845                         wire.setY(result.z());
02846                         wire.setZ(1);
02847                         x0kal.setX(result.x());
02848                         x0kal.setY(result.y());
02849                 }
02850 
02851                 if(4 == debug_)
02852                         std::cout<<" x0kal after sag: "<<x0kal<<std::endl;
02853 
02854                 // If x0kal is after the inner wall and x0kal_prec before :
02855                 double r0kal = x0kal.perp();
02856 
02857                 // change PIVOT :
02858                 double pathl(0);
02859 
02860                 //std::cout<<" track a3: "<<track.a()<<std::endl;
02861                 //std::cout<<" track p3: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
02862 
02863                 if (debug_ == 4)
02864                         cout << "*** move from " << track.pivot() << " ( Kappa = "
02865                                 << track.a()[2] << ")" << endl;
02866                 track.pivot_numf(x0kal, pathl); //see the code , the error matrix has been changed in this function ..
02867 
02868                 //std::cout<<" track a4: "<<track.a()<<std::endl;    
02869                 //std::cout<<" track p4: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
02870 
02871 
02872                 if (debug_ == 4)
02873                         cout << "*** to " << track.pivot() << " ( Kappa = "
02874                                 << track.a()[2] << ")" << std::endl;
02875 
02876                 if (nhits_read == 1) { 
02877                         track.Ea(Eakal);
02878                         if(debug_==4) cout << "filter_fwd::Ea = " << track.Ea()<<endl;
02879 
02880 
02881                 } else {
02882                         if(KalFitElement::muls()) track.msgasmdc(pathl, way);
02883                         if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
02884                 }
02885 
02886 
02887                 //std::cout<<" track a5: "<<track.a()<<std::endl;
02888                 //std::cout<<" track p5: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
02889 
02890                 // Add info hit wire :
02891                 if(track.kappa()) {
02892                         Hep3Vector meas = track.momentum(0).cross(wire).unit();
02893 
02894                         double diff_chi2 = track.chiSq();
02895 
02896                         Hep3Vector IP(0,0,0);
02897                         Helix work_bef = *(Helix*)&track;
02898                         work_bef.ignoreErrorMatrix();
02899                         work_bef.pivot(IP);
02900                         int inext(-1);
02901                         if (i+1<nhit)
02902                                 for( unsigned k=i+1 ; k < nhit; k++ )
02903                                         if (!(track.HitMdc(k).chi2()<0)) {
02904                                                 inext = (signed) k;
02905                                                 break;
02906                                         }
02907                         double dchi2 = -1.0;
02908 
02909                         if (debug_ == 4) {
02910                                 std::cout<<"the value of x0kal is "<<x0kal<<std::endl;
02911                                 std::cout<<"the value of track.pivot() is "<<track.pivot()<<std::endl;
02912                         }
02913 
02914                         HepVector Va(5,0);
02915                         HepSymMatrix Ma(5,0);
02916                         KalFitHelixSeg  HelixSeg(&HitMdc,x0kal,Va,Ma);   
02917 
02918                         if(debug_ == 4) {
02919                                 std::cout<<"HelixSeg.Ea_pre_fwd() ..."<<HelixSeg.Ea_pre_fwd()<<std::endl;
02920                                 std::cout<<"HelixSeg.a_pre_fwd() ..."<<HelixSeg.a_pre_fwd()<<std::endl;
02921                                 std::cout<<"HelixSeg.Ea_filt_fwd() ..."<<HelixSeg.Ea_filt_fwd()<<std::endl;
02922                         }
02923 
02924                         //std::cout<<" track a1: "<<track.a()<<std::endl;
02925                         //std::cout<<" track p1: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
02926 
02927                         double chi2=0.;
02928                         if(usage_>1) chi2=track.update_hits_csmalign(HelixSeg, inext, meas, way, dchi2, m_csmflag); 
02929                         else   chi2 = track.update_hits(HelixSeg, inext, meas, way, dchi2, m_csmflag);
02930 
02931                         //std::cout<<" track a2: "<<track.a()<<std::endl;
02932                         //std::cout<<" track p2: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
02933 
02934                         if(debug_ ==4 )  cout<<"layer, cell, dchi2,chi2, a, p: "<<HitMdc.wire().layer().layerId()<<" , "<<HitMdc.wire().localId()<<" , "<<dchi2<<" , "<<chi2<<" , "<<track.a()<<" , "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<endl;
02935 
02936                         if(debug_ == 4) cout<< "****inext***"<<inext<<" !!!!  dchi2=  "<< dchi2
02937                                 << " chisq= "<< chi2<< endl;
02938 
02939                         if (ntuple_&8) {
02940                                 m_dchi2 = dchi2;
02941                                 m_masshyp = l_mass;
02942                                 StatusCode sc5 = m_nt5->write();
02943                                 if( sc5.isFailure() ) cout<<"Ntuple5 filling failed!"<<endl;     
02944                         }
02945 
02946                         Helix work_aft = *(Helix*)&track;
02947                         work_aft.ignoreErrorMatrix();
02948                         work_aft.pivot(IP);
02949                         diff_chi2 = chi2 - diff_chi2; 
02950                         HitMdc.chi2(diff_chi2);
02951 
02952                         if(debug_ == 4) {
02953 
02954                                 cout << " -> after include meas = " << meas                        
02955                                         << " at R = " << track.pivot().perp() << std::endl;           
02956                                 cout << "    chi2 = " << chi2 << ", diff_chi2 = "                  
02957                                         << diff_chi2 << ", LR = "                                     
02958                                         << HitMdc.LR() << ", stereo = " << HitMdc.wire().stereo()     
02959                                         << ", layer = " << HitMdc.wire().layer().layerId() << std::endl;       
02960                                 cout<<"filter_fwd..........HitMdc.chi2... "<<HitMdc.chi2()<<endl;
02961                         }
02962 
02963                         if(dchi2>0.0 && (way!=999)) {
02964                                 track.HelixSegs().push_back(HelixSeg);
02965                         }
02966                 }
02967                 r0kal_prec = r0kal;
02968         }
02969 }

StatusCode KalFitAlg::finalize  ) 
 

StatusCode KalFitAlg::finalize  ) 
 

00292 {
00293         return StatusCode::SUCCESS;                                                  
00294 }                       

void KalFitAlg::getEventStarTime void   ) 
 

void KalFitAlg::getEventStarTime void   ) 
 

int KalFitAlg::getWallMdcNumber const HepPoint3D point  ) 
 

int KalFitAlg::getWallMdcNumber const HepPoint3D point  ) 
 

void KalFitAlg::hist_def void   ) 
 

hist definition

void KalFitAlg::hist_def void   ) 
 

hist definition

00334 {
00335         if(ntuple_&1) {               
00336                 NTuplePtr  nt1(ntupleSvc(),"FILE104/n101");
00337                 StatusCode status;
00338                 if ( nt1 ) m_nt1 = nt1;                                                    
00339                 else {                                                                     
00340                         m_nt1= ntupleSvc()->book("FILE104/n101",CLID_ColumnWiseTuple,"KalFit");
00341                         if ( m_nt1 )  { 
00342 
00343                                 status = m_nt1->addItem("trackid",m_trackid);
00344                                 status = m_nt1->addItem("stat",5,2,m_stat);
00345                                 status = m_nt1->addItem("ndf",5,2,m_ndf);
00346                                 status = m_nt1->addItem("chisq",5,2,m_chisq);
00347                                 status = m_nt1->addItem("length",5,m_length);
00348                                 status = m_nt1->addItem("tof",5,m_tof);
00349                                 status = m_nt1->addItem("nhits",5,m_nhits);
00350                                 status = m_nt1->addItem("zhelix",5,m_zhelix);
00351                                 status = m_nt1->addItem("zhelixe",5,m_zhelixe);
00352                                 status = m_nt1->addItem("zhelixmu",5,m_zhelixmu);
00353                                 status = m_nt1->addItem("zhelixk",5,m_zhelixk);
00354                                 status = m_nt1->addItem("zhelixp",5,m_zhelixp);
00355                                 status = m_nt1->addItem("zptot",m_zptot);
00356                                 status = m_nt1->addItem("zptote",m_zptote);
00357                                 status = m_nt1->addItem("zptotmu",m_zptotmu);
00358                                 status = m_nt1->addItem("zptotk",m_zptotk);
00359                                 status = m_nt1->addItem("zptotp",m_zptotp);
00360 
00361                                 status = m_nt1->addItem("zpt",m_zpt);
00362                                 status = m_nt1->addItem("zpte",m_zpte);
00363                                 status = m_nt1->addItem("zptmu",m_zptmu);
00364                                 status = m_nt1->addItem("zptk",m_zptk);
00365                                 status = m_nt1->addItem("zptp",m_zptp);
00366 
00367                                 status = m_nt1->addItem("fptot",m_fptot);
00368                                 status = m_nt1->addItem("fptote",m_fptote);
00369                                 status = m_nt1->addItem("fptotmu",m_fptotmu);
00370                                 status = m_nt1->addItem("fptotk",m_fptotk);
00371                                 status = m_nt1->addItem("fptotp",m_fptotp);
00372                                 status = m_nt1->addItem("fpt",m_fpt);
00373                                 status = m_nt1->addItem("fpte",m_fpte);
00374                                 status = m_nt1->addItem("fptmu",m_fptmu);
00375                                 status = m_nt1->addItem("fptk",m_fptk);
00376                                 status = m_nt1->addItem("fptp",m_fptp);
00377 
00378                                 status = m_nt1->addItem("lptot",m_lptot);
00379                                 status = m_nt1->addItem("lptote",m_lptote);
00380                                 status = m_nt1->addItem("lptotmu",m_lptotmu);
00381                                 status = m_nt1->addItem("lptotk",m_lptotk);
00382                                 status = m_nt1->addItem("lptotp",m_lptotp);
00383                                 status = m_nt1->addItem("lpt",m_lpt);
00384                                 status = m_nt1->addItem("lpte",m_lpte);
00385                                 status = m_nt1->addItem("lptmu",m_lptmu);
00386                                 status = m_nt1->addItem("lptk",m_lptk);
00387                                 status = m_nt1->addItem("lptp",m_lptp);
00388 
00389                                 status = m_nt1->addItem("zsigp",m_zsigp);
00390                                 status = m_nt1->addItem("zsigpe",m_zsigpe);
00391                                 status = m_nt1->addItem("zsigpmu",m_zsigpmu);
00392                                 status = m_nt1->addItem("zsigpk",m_zsigpk);
00393                                 status = m_nt1->addItem("zsigpp",m_zsigpp);
00394                                 status = m_nt1->addItem("fhelix",5,m_fhelix);
00395                                 status = m_nt1->addItem("fhelixe",5,m_fhelixe);
00396                                 status = m_nt1->addItem("fhelixmu",5,m_fhelixmu);
00397                                 status = m_nt1->addItem("fhelixk",5,m_fhelixk);
00398                                 status = m_nt1->addItem("fhelixp",5,m_fhelixp);
00399                                 status = m_nt1->addItem("lhelix",5,m_lhelix);
00400                                 status = m_nt1->addItem("lhelixe",5,m_lhelixe);
00401                                 status = m_nt1->addItem("lhelixmu",5,m_lhelixmu);
00402                                 status = m_nt1->addItem("lhelixk",5,m_lhelixk);
00403                                 status = m_nt1->addItem("lhelixp",5,m_lhelixp);
00404                                 if(ntuple_&32) {
00405                                         status = m_nt1->addItem("zerror",15,m_zerror);
00406                                         status = m_nt1->addItem("zerrore",15,m_zerrore);
00407                                         status = m_nt1->addItem("zerrormu",15,m_zerrormu);
00408                                         status = m_nt1->addItem("zerrork",15,m_zerrork);
00409                                         status = m_nt1->addItem("zerrorp",15,m_zerrorp);
00410                                         status = m_nt1->addItem("ferror",15,m_ferror);
00411                                         status = m_nt1->addItem("ferrore",15,m_ferrore);
00412                                         status = m_nt1->addItem("ferrormu",15,m_ferrormu);
00413                                         status = m_nt1->addItem("ferrork",15,m_ferrork);
00414                                         status = m_nt1->addItem("ferrorp",15,m_ferrorp);
00415                                         status = m_nt1->addItem("lerror",15,m_lerror);
00416                                         status = m_nt1->addItem("lerrore",15,m_lerrore);
00417                                         status = m_nt1->addItem("lerrormu",15,m_lerrormu);
00418                                         status = m_nt1->addItem("lerrork",15,m_lerrork);
00419                                         status = m_nt1->addItem("lerrorp",15,m_lerrorp);
00420                                 }
00421                                 if((ntuple_&16)&&(ntuple_&1)) {
00422                                         status = m_nt1->addItem("evtid",m_evtid);
00423                                         status = m_nt1->addItem("mchelix",5,m_mchelix);
00424                                         status = m_nt1->addItem("mcptot",m_mcptot);
00425                                         status = m_nt1->addItem("mcpid",m_mcpid);
00426                                 }
00427                                 if( status.isFailure() ) cout<<"Ntuple1 add item failed!"<<endl;       
00428                         }                                                                        
00429                 }
00430         }
00431 
00432         if(ntuple_&4) {  
00433                 NTuplePtr  nt2(ntupleSvc(),"FILE104/n102");
00434                 StatusCode status2;
00435                 if ( nt2 ) m_nt2 = nt2;                                                    
00436                 else {                                                                     
00437                         m_nt2= ntupleSvc()->book("FILE104/n102",CLID_ColumnWiseTuple,"KalFitComp");
00438                         if ( m_nt2 )  {
00439                                 status2 = m_nt2->addItem("delx",m_delx);
00440                                 status2 = m_nt2->addItem("dely",m_dely);
00441                                 status2 = m_nt2->addItem("delz",m_delz);
00442                                 status2 = m_nt2->addItem("delthe",m_delthe);
00443                                 status2 = m_nt2->addItem("delphi",m_delphi);
00444                                 status2 = m_nt2->addItem("delp",m_delp);                         
00445                                 status2 = m_nt2->addItem("delpx",m_delpx);
00446                                 status2 = m_nt2->addItem("delpy",m_delpy);
00447                                 status2 = m_nt2->addItem("delpz",m_delpz);
00448 
00449                                 if( status2.isFailure() ) cout<<"Ntuple2 add item failed!"<<endl; 
00450                         }
00451                 }
00452         }
00453 
00454         if(ntuple_&2) {                                            
00455                 NTuplePtr  nt3(ntupleSvc(),"FILE104/n103");
00456                 StatusCode status3;
00457                 if ( nt3 ) m_nt3 = nt3;                                                    
00458                 else {                                                                     
00459                         m_nt3= ntupleSvc()->book("FILE104/n103",CLID_ColumnWiseTuple,"PatRec");
00460                         if ( m_nt3 )  {
00461                                 status3 = m_nt3->addItem("trkhelix",5,m_trkhelix);
00462                                 status3 = m_nt3->addItem("trkptot",m_trkptot);
00463                                 if(ntuple_&32) {
00464                                         status3 = m_nt3->addItem("trkerror",15,m_trkerror);
00465                                         status3 = m_nt3->addItem("trksigp",m_trksigp);
00466                                 }
00467                                 status3 = m_nt3->addItem("trkndf",m_trkndf);
00468                                 status3 = m_nt3->addItem("trkchisq",m_trkchisq);
00469                                 if( status3.isFailure() ) cout<<"Ntuple3 add item failed!"<<endl; 
00470                         }
00471                 }
00472         }  
00473 
00474         if(ntuple_&4) {                                            
00475                 NTuplePtr  nt4(ntupleSvc(),"FILE104/n104");
00476                 StatusCode status4;
00477                 if ( nt4 ) m_nt4 = nt4;                                                    
00478                 else {                                                                     
00479                         m_nt4= ntupleSvc()->book("FILE104/n104",CLID_ColumnWiseTuple,"PatRecComp");
00480                         if ( m_nt4 )  {
00481                                 status4 = m_nt4->addItem("trkdelx",m_trkdelx);
00482                                 status4 = m_nt4->addItem("trkdely",m_trkdely);
00483                                 status4 = m_nt4->addItem("trkdelz",m_trkdelz);
00484                                 status4 = m_nt4->addItem("trkdelthe",m_trkdelthe);
00485                                 status4 = m_nt4->addItem("trkdelphi",m_trkdelphi);
00486                                 status4 = m_nt4->addItem("trkdelp",m_trkdelp);                         
00487                                 if( status4.isFailure() ) cout<<"Ntuple4 add item failed!"<<endl; 
00488                         }
00489                 }
00490         }
00491         if(ntuple_&8) {                                            
00492                 NTuplePtr  nt5(ntupleSvc(), "FILE104/n105");
00493                 StatusCode status5;
00494                 if ( nt5 ) m_nt5 = nt5;                                                    
00495                 else {                                                                     
00496                         m_nt5= ntupleSvc()->book("FILE104/n105",CLID_ColumnWiseTuple,"KalFitdChisq");
00497                         if ( m_nt5 )  {
00498                                 status5 = m_nt5->addItem("dchi2",m_dchi2);
00499                                 status5 = m_nt5->addItem("masshyp",m_masshyp);
00500                                 status5 = m_nt5->addItem("residual_estim",m_residest);
00501                                 status5 = m_nt5->addItem("residual",m_residnew);
00502                                 status5 = m_nt5->addItem("layer",m_layer);
00503                                 status5 = m_nt5->addItem("kaldr",m_anal_dr);
00504                                 status5 = m_nt5->addItem("kalphi0",m_anal_phi0);
00505                                 status5 = m_nt5->addItem("kalkappa",m_anal_kappa);
00506                                 status5 = m_nt5->addItem("kaldz",m_anal_dz);
00507                                 status5 = m_nt5->addItem("kaltanl",m_anal_tanl);
00508                                 status5 = m_nt5->addItem("dr_ea",m_anal_ea_dr);
00509                                 status5 = m_nt5->addItem("phi0_ea",m_anal_ea_phi0);
00510                                 status5 = m_nt5->addItem("kappa_ea",m_anal_ea_kappa);
00511                                 status5 = m_nt5->addItem("dz_ea",m_anal_ea_dz);
00512                                 status5 = m_nt5->addItem("tanl_ea",m_anal_ea_tanl);
00513                                 if( status5.isFailure() ) cout<<"Ntuple5 add item failed!"<<endl; 
00514                         }
00515                 }
00516                 NTuplePtr  nt6(ntupleSvc(),"FILE104/n106");
00517                 StatusCode status6;
00518                 if ( nt6 ) m_nt6 = nt6;             
00519                 else {                            
00520                         m_nt6= ntupleSvc()->book("FILE104/n106",CLID_ColumnWiseTuple,"kal seg");
00521                         if ( m_nt6 )  {
00522                                 status6 = m_nt6->addItem("docaInc",m_docaInc);
00523                                 status6 = m_nt6->addItem("docaExc",m_docaExc);
00524                                 status6 = m_nt6->addItem("tdr",m_tdrift);
00525                                 status6 = m_nt6->addItem("layerid", m_layerid);
00526                                 status6 = m_nt6->addItem("event", m_eventNo);
00527                                 status6 = m_nt6->addItem("residualInc",m_residualInc);
00528                                 status6 = m_nt6->addItem("residualExc",m_residualExc);
00529                                 status6 = m_nt6->addItem("lr",m_lr);
00530                                 status6 = m_nt6->addItem("dd",m_dd);
00531                                 status6 = m_nt6->addItem("y",m_yposition);
00532 
00533                                 if( status6.isFailure() ) cout<<"Ntuple6 add item failed!"<<endl;
00534                         }
00535                 }
00536         }
00537 }

void KalFitAlg::init_matrix int  k,
MdcRec_trk trk,
HepSymMatrix &  Ea
 

void KalFitAlg::init_matrix MdcRec_trk trk,
HepSymMatrix &  Ea
 

void KalFitAlg::init_matrix int  k,
MdcRec_trk trk,
HepSymMatrix &  Ea
 

05645 {
05646         if(0==k){
05647                 for ( int i=0; i<5; i++) {
05648                         for( int j = 1; j<i+2;j++) {
05649                                 Eakal(i+1,j) = matrixg_*(trk.error[i*(i+1)/2+j-1]);
05650                                 Eakal(j,i+1) = Eakal(i+1,j);
05651                         }
05652                         Eakal(1,1) = Eakal(1,1)* gain1_;
05653                         Eakal(2,2) = Eakal(2,2)* gain2_;
05654                         Eakal(3,3) = Eakal(3,3)* gain3_;
05655                         Eakal(4,4) = Eakal(4,4)* gain4_;
05656                         Eakal(5,5) = Eakal(5,5)* gain5_;
05657                 }
05658         }
05659         //  HepSymMatrix ea_temp(5);
05660         //    for(int i = 0, k = 0; i < 5; i++) {
05661         //      for(int j = 0; j <= i; j++) {
05662         //        ea_temp[i][j] = matrixg_*trk.error[k++];
05663         //        ea_temp[j][i] = ea_temp[i][j];
05664         //      }
05665         //    }
05666 
05667         if(1==k){
05668                 Eakal(1,1) = .2;
05669                 Eakal(2,2) = .001;
05670                 Eakal(3,3) = 1.0;
05671                 Eakal(4,4) = 10.0;
05672                 Eakal(5,5) = 0.002;
05673         }
05674 
05675         if(2==k){
05676                 Eakal(1,1) = .2;
05677                 Eakal(2,2) = 0.1;
05678                 Eakal(3,3) = 1.0;
05679                 Eakal(4,4) = 25.0;
05680                 Eakal(5,5) = 0.10;
05681         }
05682 
05683 
05684         if(3==k){
05685                 Eakal(1,1) = .2;
05686                 Eakal(2,2) = .001;
05687                 Eakal(3,3) = 1.0;
05688                 Eakal(4,4) = 25.0;
05689                 Eakal(5,5) = 0.10;
05690         }
05691 
05692         if(4==k){
05693                 Eakal(1,1) = .2;
05694                 Eakal(2,2) = .01;
05695                 Eakal(3,3) = 0.01;
05696                 Eakal(4,4) = 1.;
05697                 Eakal(5,5) = .01;
05698         }
05699 
05700         if(5==k) {
05701                 Eakal(1,1) = 2.;
05702                 Eakal(2,2) = 0.1;
05703                 Eakal(3,3) = 1.;
05704                 Eakal(4,4) = 20.;
05705                 Eakal(5,5) = 0.1;
05706         }
05707 
05708         if(6==k) {
05709                 Eakal(1,1) = 0.01;
05710                 Eakal(2,2) = 0.01;
05711                 Eakal(3,3) = 0.01;
05712                 Eakal(4,4) = 100.;
05713                 Eakal(5,5) = 0.5;
05714         }
05715 
05716         if(k!=0){
05717                 Eakal(3,3) = 0.2;
05718                 Eakal(1,1) = 1;
05719                 Eakal(4,4) = 1;
05720         }
05721 
05722         if (debug_ == 4) cout<<"initialised Eakal.. "<<Eakal<<endl;
05723 }

void KalFitAlg::init_matrix MdcRec_trk trk,
HepSymMatrix &  Ea
 

05631 {
05632         for ( int i=0; i<5; i++) {
05633                 for( int j = 1; j<i+2;j++) {
05634                         Eakal(i+1,j) = matrixg_*(trk.error[i*(i+1)/2+j-1]);
05635                         Eakal(j,i+1) = Eakal(i+1,j);
05636                 }
05637         }
05638 
05639         if (debug_ == 4) cout<<"initialised Ea.. "<<Eakal<<endl;
05640 }

StatusCode KalFitAlg::initialize  ) 
 

initialize

StatusCode KalFitAlg::initialize  ) 
 

initialize

00176 {
00177         MsgStream log(msgSvc(), name());
00178         log << MSG::INFO << "in initize()" 
00179                 << "KalFit> Initialization for current run " << endreq;
00180         log << MSG::INFO << "Present Parameters: muls: " << muls_ <<"  loss:  "
00181                 << loss_ <<" matrixg "<< matrixg_ <<" lr "<< lr_ 
00182                 << " debug " << debug_ << " ntuple " << ntuple_
00183                 << " activeonly "<< activeonly_ << endreq;
00184 
00185         KalFitTrack::LR(lr_);
00186         KalFitTrack::resol(resolution_);
00187         KalFitTrack::Tof_correc_ = tofflag_;
00188         KalFitTrack::tofall_ = tof_hyp_;
00189         KalFitTrack::chi2_hitf_ = dchi2cutf_;
00190         KalFitTrack::chi2_hits_ = dchi2cuts_;
00191         KalFitTrack::factor_strag_ = fstrag_;
00192         KalFitTrack::debug_ = debug_kft_;
00193         KalFitTrack::drifttime_choice_ = drifttime_choice_;
00194         KalFitTrack::steplev_ = steplev_;
00195         KalFitTrack::numfcor_ = numfcor_;
00196         KalFitTrack::inner_steps_ = inner_steps_;
00197         KalFitTrack::outer_steps_ = outer_steps_;
00198         KalFitTrack::tprop_ = tprop_;
00199 
00200         setDchisqCut();
00201         // Delete properly the geometry objects if already existing
00202         clean();
00203         log << MSG::INFO << ".....building Mdc " << endreq;
00204 
00205         // Set objects and material properties for Mdc detector :
00206         //setMaterial_Mdc();
00207         //setCylinder_Mdc();
00208 
00209         setBesFromGdml();
00210         // initialize the MdcCalibFunSvc 
00211         setCalibSvc_init(); 
00212         //
00213         KalFitTrack::setMagneticFieldSvc();
00214         //  // initialize the MdcGeomSvc
00215         //  setGeomSvc_init();
00216         //getEventStarTime();
00217         //  // Wires, Layers and SuperLayers of Mdc :
00218         //  set_Mdc();
00219         // define histograms and Ntuples
00220         hist_def();
00221 
00222 
00223         IMagneticFieldSvc* IMFSvc; 
00224         StatusCode sc = service ("MagneticFieldSvc",IMFSvc); 
00225         if(sc!=StatusCode::SUCCESS) { 
00226                 log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq; 
00227         }
00228 
00229         // Nominal magnetic field :
00230         if (KalFitTrack::numfcor_){
00231                 KalFitTrack::Bznom_ = (IMFSvc->getReferField())*10000; //unit is KGauss
00232                 if(0 == KalFitTrack::Bznom_)   KalFitTrack::Bznom_ = -10;
00233 
00234                 if(4 == debug_){
00235                         std::cout<<" initialize, referField from MagneticFieldSvc: "<< (IMFSvc->getReferField())*10000 <<std::endl;
00236                         std::cout<<" magnetic field: "<<KalFitTrack::Bznom_<<std::endl;
00237                 }
00238 
00239         }
00240 
00241         // Print out of the status of the flags :
00242         if (ntuple_) 
00243                 log << MSG::INFO <<" ntuple out, the option is  "<< ntuple_ <<endreq;
00244         if (debug_ >0 ) {
00245                 cout << "KalFitAlg> DEBUG open,Here is the important Parameters :\n";
00246                 cout << " Leading particule with mass hyp = " << lead_ << std::endl;
00247                 cout << " mhyp = " << mhyp_ << std::endl;
00248                 cout << "===== Effects taking into account : " << std::endl;
00249                 cout << " - multiple scattering = " << muls_ << std::endl;
00250                 cout << " - energy loss = " << loss_ << std::endl;
00251                 if (KalFitTrack::strag_)
00252                         cout << " - straggling for the energy loss " << std::endl;
00253                 cout << " - nominal Bz value = " << KalFitTrack::Bznom_ << std::endl;
00254 
00255                 if (KalFitTrack::numf_ > 19)
00256                         cout << " - non uniform magnetic field treatment " 
00257                                 << KalFitTrack::numf_ << std::endl;
00258                 cout << " - wire sag correction = " << wsag_ << std::endl;
00259                 cout << " - Tof correction = " << KalFitTrack::Tof_correc_ << std::endl;
00260                 cout << " - chi2 cut for each hit = " << KalFitTrack::chi2_hitf_ 
00261                         << std::endl << " is applied after " << KalFitTrack::nmdc_hit2_ 
00262                         << " hits included " << std::endl;
00263 
00264                 if (back_){
00265                         cout << " Backward filter is on with a pT cut value = " << pT_ << endl;
00266                 }
00267                 if(debug_ == 4) cout << " pathl = " << pathl_ << std::endl;
00268 
00269                 if (KalFitTrack::LR_==1)
00270                         cout << " Decision L/R from MdcRecHit " << std::endl;
00271         }
00272 
00273         KalFitElement::muls(muls_);
00274         KalFitElement::loss(loss_);
00275         KalFitTrack::lead(lead_);
00276         KalFitTrack::back(back_);
00277         KalFitTrack::numf(numf_);
00278         // Get the Particle Properties Service
00279         IPartPropSvc* p_PartPropSvc;
00280         static const bool CREATEIFNOTTHERE(true);
00281         StatusCode PartPropStatus = service("PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE);
00282         if (!PartPropStatus.isSuccess() || 0 == p_PartPropSvc) {
00283                 log << MSG::WARNING << " Could not initialize Particle Properties Service" << endreq;
00284                 return StatusCode::SUCCESS; 
00285         }
00286         m_particleTable = p_PartPropSvc->PDT();
00287 
00288         return StatusCode::SUCCESS; 
00289 }

void KalFitAlg::innerwall KalFitTrack trk,
int  l_mass,
int  way
 

Take the inner walls (eloss and mult scat) into account.

void KalFitAlg::innerwall KalFitTrack trk,
int  l_mass,
int  way
 

Take the inner walls (eloss and mult scat) into account.

02972                                                                 {
02973 
02974         if (debug_ ==4) cout<<"innerwall....."<<endl;
02975         for(int i = 0; i < _BesKalmanFitWalls.size(); i++) {
02976                 _BesKalmanFitWalls[i].updateTrack(track, way);
02977                 if (debug_ == 4) cout<<"Wall "<<i<<" update the track!(filter)"<<endl;
02978         }
02979 }

void KalFitAlg::kalman_fitting_anal void   ) 
 

void KalFitAlg::kalman_fitting_anal void   ) 
 

very low momentum and very big costheta angle, use special initial error matrix

chose different initial error matrix

02987 {
02988 
02989         MsgStream log(msgSvc(), name());
02990         double Pt_threshold(0.3);
02991         Hep3Vector IP(0,0,0);
02992         vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
02993         vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
02994         vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();    
02995 
02996         // Table Manager
02997         if ( !&whMgr ) return;
02998 
02999         // Get reduced chi**2 of Mdc track :
03000         int ntrk = mdcMgr->size();
03001         double* rPt = new double[ntrk];
03002         int* rOM = new int[ntrk];
03003         unsigned int* order = new unsigned int[ntrk];
03004         unsigned int* rCont = new unsigned int[ntrk];
03005         unsigned int* rGen = new unsigned int[ntrk];
03006 
03007         int index = 0;
03008         for(vector<MdcRec_trk>::iterator it  = mdcMgr->begin(),
03009                         end = mdcMgr->end(); it != end; it++) {
03010                 // Pt
03011                 rPt[index] = 0;
03012                 if (it->helix[2])
03013                         rPt[index] = 1 / fabs(it->helix[2]);
03014                 if(debug_ == 4) cout<<"rPt...[ "<<index<<" ]...."<< rPt[index] <<endl;
03015                 if(rPt[index] < 0) rPt[index] = DBL_MAX;
03016                 // Outermost layer 
03017                 std::vector<MdcRec_wirhit*> pt = it->hitcol ;
03018                 if(debug_ == 4) cout<<"ppt size:  "<< pt.size()<<endl;
03019                 int outermost(-1);
03020                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
03021                                 ii !=pt.begin()-1; ii--) {
03022                         int lyr((*ii)->geo->Lyr()->Id());
03023                         if (outermost < lyr) outermost = lyr;
03024                         if(debug_ == 4) cout<<"outmost:  "<<outermost<<"   lyr:  "<<lyr<<endl;
03025                 }
03026                 rOM[index] = outermost;
03027                 order[index] = index;
03028                 ++index;
03029         }
03030 
03031         // Sort Mdc tracks by Pt
03032         for (int j, k = ntrk - 1; k >= 0; k = j){
03033                 j = -1;
03034                 for(int i = 1; i <= k; i++)
03035                         if(rPt[i - 1] < rPt[i]){
03036                                 j = i - 1;
03037                                 std::swap(order[i], order[j]);
03038                                 std::swap(rPt[i], rPt[j]);
03039                                 std::swap(rOM[i], rOM[j]);
03040                                 std::swap(rCont[i], rCont[j]);
03041                                 std::swap(rGen[i], rGen[j]);
03042                         }
03043         }
03044         delete [] rPt;
03045 
03046         //
03047         int newcount(0);
03048         //check whether  Recon  already registered
03049         DataObject *aReconEvent;
03050         eventSvc()->findObject("/Event/Recon",aReconEvent);
03051         if(!aReconEvent) {
03052                 // register ReconEvent Data Object to TDS;
03053                 ReconEvent* recevt = new ReconEvent;
03054                 StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
03055                 if(sc!=StatusCode::SUCCESS) {
03056                         log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
03057                         return;
03058                 }
03059         }
03060 
03061         RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;   
03062         RecMdcKalHelixSegCol *segcol =new RecMdcKalHelixSegCol;
03063         //make RecMdcKalTrackCol
03064         log << MSG::INFO << "beginning to make RecMdcKalTrackCol" <<endreq;     
03065         // Loop over tracks given by trasan :
03066         for(int l = 0; l < ntrk; l++) {
03067                 
03068                 for(int i=0; i<5; i++) iqual_front_[i] = 1; // wangll 2010-11-01
03069                 
03070                 //    m_timer[3]->start();
03071                 MdcRec_trk& TrasanTRK = *(mdcMgr->begin() + order[l]);     
03072                 MdcRec_trk_add& TrasanTRK_add = *(mdc_addMgr->begin()+order[l]);
03073 
03074                 // Reject the ones with quality != 0 
03075                 int trasqual = TrasanTRK_add.quality;
03076                 if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl; 
03077                 if (trasqual) continue;
03078 
03079                 newcount++;
03080                 if (debug_ == 4)
03081                         cout << "******* KalFit NUMBER : " << newcount << std::endl;      
03082 
03083                 // What kind of KalFit ? 
03084                 int type(0);
03085                 if ((TrasanTRK_add.decision & 32) == 32 ||
03086                                 (TrasanTRK_add.decision & 64) == 64)      type = 1;
03087 
03088                 // Initialisation : (x, a, ea)
03089                 HepPoint3D x(TrasanTRK.pivot[0],
03090                                 TrasanTRK.pivot[1],
03091                                 TrasanTRK.pivot[2]);
03092 
03093                 HepVector a(5);
03094                 for(int i = 0; i < 5; i++)
03095                         a[i] = TrasanTRK.helix[i];
03096 
03097                 HepSymMatrix ea(5);
03098                 for(int i = 0, k = 0; i < 5; i++) {
03099                         for(int j = 0; j <= i; j++) {
03100                                 ea[i][j] = matrixg_*TrasanTRK.error[k++];
03101                                 ea[j][i] = ea[i][j];
03102                         }
03103                 }
03104                 double fiTerm = TrasanTRK.fiTerm;
03105                 int way(1);
03106                 // Prepare the track found :
03107                 KalFitTrack track_lead = KalFitTrack(x, a, ea, lead_, 0, 0);
03108 
03109                 track_lead.bFieldZ(KalFitTrack::Bznom_);
03110 
03111                 // Mdc Hits 
03112                 int inlyr(999), outlyr(-1);
03113                 int* rStat = new int[43];
03114                 for(int irStat=0;irStat<43;++irStat)rStat[irStat]=0;
03115                 std::vector<MdcRec_wirhit*> pt=TrasanTRK.hitcol;
03116                 int hit_in(0);
03117                 if(debug_ == 4) cout<<"*********Pt size****"<< pt.size()<<endl;
03118                 // Number of hits/layer 
03119                 int Num[43] = {0};
03120                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
03121                                 ii != pt.begin()-1; ii--) {
03122                         Num[(*ii)->geo->Lyr()->Id()]++;
03123                 }
03124                 int hit_asso(0);
03125                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
03126                                 ii != pt.begin()-1; ii--) { 
03127                         hit_asso++;
03128                         if (Num[(*ii)->geo->Lyr()->Id()]>3) {
03129                                 if (debug_ >0)
03130                                         cout << "WARNING:  I found " << Num[(*ii)->geo->Lyr()->Id()] 
03131                                                 << " hits in the layer "
03132                                                 << (*ii)->geo->Lyr()->Id() << std::endl;
03133                                 continue;
03134                         }
03135                         //       if(ii!=pt.end()-1){
03136                         //               int layer_before=(*(ii+1))->geo->Lyr()->Id();
03137                         //               if(layer_before == (*ii)->geo->Lyr()->Id()){
03138                         //                       MdcRec_wirhit * rechit_before = *(ii+1);
03139                         //                       if((*rechit_before).rechitptr->getDriftT()>450 || (**ii).rechitptr->getDriftT()>450.){
03140                         //                               if((*rechit_before).tdc < (**ii).tdc) continue;
03141                         //                               else if(track_lead.HitsMdc().size()>0 && rStat[layer_before]){
03142                         //                                       track_lead.HitsMdc().pop_back();
03143                         //                               }
03144                         //                       }
03145                         //               }
03146                         //       }
03147 
03148                         hit_in++;
03149                         MdcRec_wirhit & rechit = **ii;
03150                         double dist[2] = {rechit.ddl, rechit.ddr};
03151                         double erdist[2] = {rechit.erddl, rechit.erddr};
03152                         const MdcGeoWire* geo = rechit.geo;
03153 
03154                         int lr_decision(0);
03155                         if (KalFitTrack::LR_ == 1){
03156                                 if (rechit.lr==2 || rechit.lr==0) lr_decision=-1;
03157                                 //      if (rechit.lr==0) lr_decision=-1;
03158                                 else if (rechit.lr==1) lr_decision=1;
03159                         } 
03160 
03161                         int ind(geo->Lyr()->Id());
03162 
03163                         //  ATTENTION HERE!!!
03164                         track_lead.appendHitsMdc( KalFitHitMdc(rechit.id,
03165                                                 lr_decision, rechit.tdc,
03166                                                 dist, erdist, 
03167                                                 _wire+(geo->Id()), rechit.rechitptr));
03168                         // inner/outer layer :
03169                         rStat[ind]++;
03170                         if (inlyr>ind) inlyr = ind;
03171                         if (outlyr<ind) outlyr = ind;
03172                 }
03173                 if (debug_ == 4) 
03174                         cout << "**** NUMBER OF Mdc HITS (TRASAN) = " << hit_asso << std::endl;
03175 
03176                 // Empty layers :
03177                 int empty_between(0), empty(0);
03178                 for (int i= inlyr; i <= outlyr; i++)
03179                         if (!rStat[i]) empty_between++;
03180                 empty = empty_between+inlyr+(42-outlyr);
03181                 delete [] rStat;
03182 
03183                 // RMK high momentum track under study, probably not neeeded...
03184                 track_lead.order_wirhit(1);
03185                 //track_lead.order_hits();
03186 
03187                 for(std::vector<KalFitHitMdc>::iterator it_hit = track_lead.HitsMdc().begin(); it_hit!=track_lead.HitsMdc().end(); it_hit++){
03188                         //std::cout<<" the id of this hits after sorting in PatRec is "<<it_hit->id()<<std::endl;    
03189                         //std::cout<<" the layerid of the hit is "<<it_hit->wire().layer().layerId()<<std::endl; 
03190                         //std::cout<<" the cellid of this wire is "<<it_hit->wire().localId()<<std::endl;
03191                 }
03192 
03193                 track_lead.type(type);
03194                 unsigned int nhit = track_lead.HitsMdc().size();
03195                 if (!nhit && debug_ == 4) {
03196                         cout << " ATTENTION TRACK WITH ONLY HITS " << nhit << std::endl;
03197                         continue;
03198                 }
03199 
03200                 // Initialisation :
03201                 double  KalFitst(0), KalFitax(0), KalFitschi2(0);
03202                 // Move to the outer hit : 
03203 
03204                 Hep3Vector outer_pivot(track_lead.x(fiTerm));
03205 
03206                 track_lead.pivot(outer_pivot);
03207 
03208                 track_lead.bFieldZ(KalFitTrack::Bznom_);
03209                 // attention best_chi2 reinitialize !!! 
03210                 if (nhit>=3 && !KalFitTrack::LR_) 
03211                         start_seed(track_lead, lead_, way, TrasanTRK);
03212                 HepSymMatrix Eakal(5,0);
03213 
03215                 double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]); 
03216                 if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
03217                         choice_ = 6;
03218                 }
03219 
03221                 init_matrix(choice_,TrasanTRK, Eakal);
03222 
03223 
03224                 if (debug_ == 4){
03225                         cout << "from Mdc Pattern Recognition: " << std::endl;
03226                         HepPoint3D IP(0,0,0);
03227                         Helix work(track_lead.pivot(), 
03228                                         track_lead.a(),
03229                                         track_lead.Ea());
03230                         work.pivot(IP);
03231                         cout << " dr = " << work.a()[0] 
03232                                 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
03233                         cout << " phi0 = " << work.a()[1] 
03234                                 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
03235                         cout << " PT = " << 1/work.a()[2] 
03236                                 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
03237                         cout << " dz = " << work.a()[3] 
03238                                 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
03239                         cout << " tanl = " << work.a()[4] 
03240                                 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
03241                 }
03242 
03243                 filter_fwd_anal(track_lead, lead_, way, Eakal);
03244 
03245                 // std::cout<<" step3, track_lead.Ea: "<<track_lead.Ea()<<std::endl;
03246                 track_lead.update_forMdc();
03247 
03248                 HepPoint3D IP(0,0,0);    
03249                 if (debug_ == 4) {
03250                         cout << " Mdc FIRST KALMAN FIT " << std::endl;
03251                         Helix work(track_lead.pivot(), 
03252                                         track_lead.a(),
03253                                         track_lead.Ea());
03254                         work.pivot(IP);
03255                         cout << " dr = " << work.a()[0] 
03256                                 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
03257                         cout << " phi0 = " << work.a()[1] 
03258                                 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
03259                         cout << " PT = " << 1/work.a()[2] 
03260                                 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
03261                         cout << " dz = " << work.a()[3] 
03262                                 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
03263                         cout << " tanl = " << work.a()[4] 
03264                                 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
03265                 }
03266 
03267                 // fill TDS
03268                 RecMdcKalTrack* kaltrk = new RecMdcKalTrack;
03269                 // Complete the track (other mass assumption, backward) and 
03270                 complete_track(TrasanTRK, TrasanTRK_add, track_lead, kaltrk,kalcol,segcol,1);
03271         }
03272 
03273 
03274         IDataProviderSvc* eventSvc = NULL;
03275         Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
03276         if (eventSvc) {
03277                 log << MSG::INFO << "makeTds:event Svc has been found" << endreq;
03278         } else {
03279                 log << MSG::FATAL << "makeTds:Could not find eventSvc" << endreq;
03280                 return ;
03281         }
03282 
03283         StatusCode kalsc;
03284         IDataManagerSvc *dataManSvc;
03285         dataManSvc= dynamic_cast<IDataManagerSvc*>(eventSvc);
03286         DataObject *aKalTrackCol;
03287         eventSvc->findObject("/Event/Recon/RecMdcKalTrackCol",aKalTrackCol);
03288         if(aKalTrackCol != NULL) {
03289                 dataManSvc->clearSubTree("/Event/Recon/RecMdcKalTrackCol");
03290                 eventSvc->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
03291         }
03292 
03293         kalsc = eventSvc->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
03294         if( kalsc.isFailure() ) {
03295                 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
03296                 return ; 
03297         }
03298         log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
03299 
03300         StatusCode segsc;
03301         //check whether the RecMdcKalHelixSegCol has been already registered
03302         DataObject *aRecKalSegEvent;
03303         eventSvc->findObject("/Event/Recon/RecMdcKalHelixSegCol", aRecKalSegEvent);
03304         if(aRecKalSegEvent!=NULL) {
03305                 //then unregister RecMdcKalHelixSegCol
03306                 segsc = eventSvc->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
03307                 if(segsc != StatusCode::SUCCESS) {
03308                         log << MSG::FATAL << "Could not unregister RecMdcKalHelixSegCol collection" << endreq;
03309                         return;
03310                 }
03311         }
03312 
03313         segsc = eventSvc->registerObject("/Event/Recon/RecMdcKalHelixSegCol", segcol);
03314         if( segsc.isFailure() ) {
03315                 log << MSG::FATAL << "Could not register RecMdcKalHelixSeg" << endreq;
03316                 return;
03317         }
03318         log << MSG::INFO << "RecMdcKalHelixSegCol registered successfully!" <<endreq;
03319 
03320 
03321         double x1(0.),x2(0.),y1(0.),y2(0.),z1(0.),z2(0.),the1(0.),the2(0.),phi1(0.),phi2(0.),p1(0.),p2(0.);
03322         double r1(0.),r2(0.),kap1(999.),kap2(999.),tanl1(0),tanl2(0.); 
03323         double px1(0.),px2(0.),py1(0.),py2(0.),pz1(0.),pz2(0.),charge1(0.),charge2(0.);
03324 
03325         //check the result:RecMdcKalTrackCol   
03326         SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc,"/Event/Recon/RecMdcKalTrackCol");
03327         if (!kaltrkCol) { 
03328                 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
03329                 return;
03330         }
03331         log << MSG::INFO << "Begin to check RecMdcKalTrackCol"<<endreq; 
03332         RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
03333         for( int jj=1; iter_trk != kaltrkCol->end(); iter_trk++,jj++) {
03334                 log << MSG::DEBUG << "retrieved MDC Kalmantrack:"
03335                         << "Track Id: " << (*iter_trk)->getTrackId()
03336                         << " Mass of the fit: "<< (*iter_trk)->getMass(2)<< endreq
03337                         << " Length of the track: "<< (*iter_trk)->getLength(2)
03338                         << "  Tof of the track: "<< (*iter_trk)->getTof(2) << endreq
03339                         << " Chisq of the fit: "<< (*iter_trk)->getChisq(0,2)
03340                         <<"  "<< (*iter_trk)->getChisq(1,2) << endreq
03341                         << "Ndf of the fit: "<< (*iter_trk)->getNdf(0,2)
03342                         <<"  "<< (*iter_trk)->getNdf(1,2) << endreq
03343                         << "Kappa " << (*iter_trk)->getZHelix()[2]
03344                         << endreq;
03345                 for( int i = 0; i<43; i++) {
03346                         log << MSG::DEBUG << "retrieved pathl["<<i<<"]= "
03347                                 << (*iter_trk)->getPathl(i) <<endreq;
03348                 }
03349 
03350                 if(ntuple_&1) {
03351                         m_trackid = (*iter_trk)->getTrackId();
03352 
03353                         for( int jj =0, iii=0; jj<5; jj++) {
03354 
03355                                 m_length[jj] = (*iter_trk)->getLength(jj);
03356                                 m_tof[jj] = (*iter_trk)->getTof(jj);
03357                                 m_nhits[jj] = (*iter_trk)->getNhits(jj);
03358                                 m_zhelix[jj] = (*iter_trk)->getZHelix()[jj];
03359                                 m_zhelixe[jj] = (*iter_trk)->getZHelixE()[jj];
03360                                 m_zhelixmu[jj] = (*iter_trk)->getZHelixMu()[jj];
03361                                 m_zhelixk[jj] = (*iter_trk)->getZHelixK()[jj];
03362                                 m_zhelixp[jj] = (*iter_trk)->getZHelixP()[jj];
03363                                 m_fhelix[jj] = (*iter_trk)->getFHelix()[jj];
03364                                 m_fhelixe[jj] = (*iter_trk)->getFHelixE()[jj];
03365                                 m_fhelixmu[jj] = (*iter_trk)->getFHelixMu()[jj];
03366                                 m_fhelixk[jj] = (*iter_trk)->getFHelixK()[jj];
03367                                 m_fhelixp[jj] = (*iter_trk)->getFHelixP()[jj];
03368                                 m_lhelix[jj] = (*iter_trk)->getLHelix()[jj];
03369                                 m_lhelixe[jj] = (*iter_trk)->getLHelixE()[jj];
03370                                 m_lhelixmu[jj] = (*iter_trk)->getLHelixMu()[jj];
03371                                 m_lhelixk[jj] = (*iter_trk)->getLHelixK()[jj];
03372                                 m_lhelixp[jj] = (*iter_trk)->getLHelixP()[jj];
03373 
03374                                 if(ntuple_&32) {
03375                                         for(int kk=0; kk<=jj; kk++,iii++) {
03376                                                 m_zerror[iii] = (*iter_trk)->getZError()[jj][kk];
03377                                                 m_zerrore[iii] = (*iter_trk)->getZErrorE()[jj][kk];
03378                                                 m_zerrormu[iii] = (*iter_trk)->getZErrorMu()[jj][kk];
03379                                                 m_zerrork[iii] = (*iter_trk)->getZErrorK()[jj][kk];
03380                                                 m_zerrorp[iii] = (*iter_trk)->getZErrorP()[jj][kk];
03381                                                 m_ferror[iii] = (*iter_trk)->getFError()[jj][kk];
03382                                                 m_ferrore[iii] = (*iter_trk)->getFErrorE()[jj][kk];
03383                                                 m_ferrormu[iii] = (*iter_trk)->getFErrorMu()[jj][kk];
03384                                                 m_ferrork[iii] = (*iter_trk)->getFErrorK()[jj][kk];
03385                                                 m_ferrorp[iii] = (*iter_trk)->getFErrorP()[jj][kk];
03386                                                 m_lerror[iii] = (*iter_trk)->getLError()[jj][kk];
03387                                                 m_lerrore[iii] = (*iter_trk)->getLErrorE()[jj][kk];
03388                                                 m_lerrormu[iii] = (*iter_trk)->getLErrorMu()[jj][kk];
03389                                                 m_lerrork[iii] = (*iter_trk)->getLErrorK()[jj][kk];
03390                                                 m_lerrorp[iii] = (*iter_trk)->getLErrorP()[jj][kk];
03391                                         }
03392                                 }
03393                         }
03394 
03395                         //       // the following logic may seem peculiar, but it IS the case(for BOSS5.0 and BOSS5.1)
03396                         //       m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
03397                         //       m_chisq[0][1] = (*iter_trk)->getChisq(0,1);
03398                         //       m_chisq[1][0] = (*iter_trk)->getChisq(0,2);
03399                         //       m_chisq[1][1] = (*iter_trk)->getChisq(0,3);
03400                         //       m_chisq[2][0] = (*iter_trk)->getChisq(0,4);
03401                         //       m_chisq[2][1] = (*iter_trk)->getChisq(1,0);
03402                         //       m_chisq[3][0] = (*iter_trk)->getChisq(1,1);
03403                         //       m_chisq[3][1] = (*iter_trk)->getChisq(1,2);
03404                         //       m_chisq[4][0] = (*iter_trk)->getChisq(1,3);
03405                         //       m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
03406 
03407                         //       m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
03408                         //       m_ndf[0][1] = (*iter_trk)->getNdf(0,1);
03409                         //       m_ndf[1][0] = (*iter_trk)->getNdf(0,2);
03410                         //       m_ndf[1][1] = (*iter_trk)->getNdf(0,3);
03411                         //       m_ndf[2][0] = (*iter_trk)->getNdf(0,4);
03412                         //       m_ndf[2][1] = (*iter_trk)->getNdf(1,0);
03413                         //       m_ndf[3][0] = (*iter_trk)->getNdf(1,1);
03414                         //       m_ndf[3][1] = (*iter_trk)->getNdf(1,2);
03415                         //       m_ndf[4][0] = (*iter_trk)->getNdf(1,3);
03416                         //       m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
03417 
03418                         //       m_stat[0][0] = (*iter_trk)->getStat(0,0);
03419                         //       m_stat[0][1] = (*iter_trk)->getStat(0,1);
03420                         //       m_stat[1][0] = (*iter_trk)->getStat(0,2);
03421                         //       m_stat[1][1] = (*iter_trk)->getStat(0,3);
03422                         //       m_stat[2][0] = (*iter_trk)->getStat(0,4);
03423                         //       m_stat[2][1] = (*iter_trk)->getStat(1,0);
03424                         //       m_stat[3][0] = (*iter_trk)->getStat(1,1);
03425                         //       m_stat[3][1] = (*iter_trk)->getStat(1,2);
03426                         //       m_stat[4][0] = (*iter_trk)->getStat(1,3);
03427                         //       m_stat[4][1] = (*iter_trk)->getStat(1,4);
03428 
03429                         // RootConversion changed in BOSS6.0, so use thefollowing:
03430                         m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
03431                         m_chisq[1][0] = (*iter_trk)->getChisq(0,1);
03432                         m_chisq[2][0] = (*iter_trk)->getChisq(0,2);
03433                         m_chisq[3][0] = (*iter_trk)->getChisq(0,3);
03434                         m_chisq[4][0] = (*iter_trk)->getChisq(0,4);
03435                         m_chisq[0][1] = (*iter_trk)->getChisq(1,0);
03436                         m_chisq[1][1] = (*iter_trk)->getChisq(1,1);
03437                         m_chisq[2][1] = (*iter_trk)->getChisq(1,2);
03438                         m_chisq[3][1] = (*iter_trk)->getChisq(1,3);
03439                         m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
03440 
03441                         m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
03442                         m_ndf[1][0] = (*iter_trk)->getNdf(0,1);
03443                         m_ndf[2][0] = (*iter_trk)->getNdf(0,2);
03444                         m_ndf[3][0] = (*iter_trk)->getNdf(0,3);
03445                         m_ndf[4][0] = (*iter_trk)->getNdf(0,4);
03446                         m_ndf[0][1] = (*iter_trk)->getNdf(1,0);
03447                         m_ndf[1][1] = (*iter_trk)->getNdf(1,1);
03448                         m_ndf[2][1] = (*iter_trk)->getNdf(1,2);
03449                         m_ndf[3][1] = (*iter_trk)->getNdf(1,3);
03450                         m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
03451 
03452                         m_stat[0][0] = (*iter_trk)->getStat(0,0);
03453                         m_stat[1][0] = (*iter_trk)->getStat(0,1);
03454                         m_stat[2][0] = (*iter_trk)->getStat(0,2);
03455                         m_stat[3][0] = (*iter_trk)->getStat(0,3);
03456                         m_stat[4][0] = (*iter_trk)->getStat(0,4);
03457                         m_stat[0][1] = (*iter_trk)->getStat(1,0);
03458                         m_stat[1][1] = (*iter_trk)->getStat(1,1);
03459                         m_stat[2][1] = (*iter_trk)->getStat(1,2);
03460                         m_stat[3][1] = (*iter_trk)->getStat(1,3);
03461                         m_stat[4][1] = (*iter_trk)->getStat(1,4);
03462 
03463                         m_fptot = sqrt(1+pow(m_fhelix[4],2))/m_fhelix[2];
03464                         m_fptote = sqrt(1+pow(m_fhelixe[4],2))/m_fhelixe[2];
03465                         m_fptotmu = sqrt(1+pow(m_fhelixmu[4],2))/m_fhelixmu[2];
03466                         m_fptotk = sqrt(1+pow(m_fhelixk[4],2))/m_fhelixk[2];
03467                         m_fptotp = sqrt(1+pow(m_fhelixp[4],2))/m_fhelixp[2];
03468 
03469                         m_lptot = sqrt(1+pow(m_lhelix[4],2))/m_lhelix[2];
03470                         m_lptote = sqrt(1+pow(m_lhelixe[4],2))/m_lhelixe[2];
03471                         m_lptotmu = sqrt(1+pow(m_lhelixmu[4],2))/m_lhelixmu[2];
03472                         m_lptotk = sqrt(1+pow(m_lhelixk[4],2))/m_lhelixk[2];
03473                         m_lptotp = sqrt(1+pow(m_lhelixp[4],2))/m_lhelixp[2];
03474 
03475                         m_lpt = 1/m_lhelix[2];
03476                         m_lpte = 1/m_lhelixe[2];
03477                         m_lptmu = 1/m_lhelixmu[2];
03478                         m_lptk = 1/m_lhelixk[2];
03479                         m_lptp = 1/m_lhelixp[2];
03480 
03481                         m_fpt = 1/m_fhelix[2];
03482                         m_fpte = 1/m_fhelixe[2];
03483                         m_fptmu = 1/m_fhelixmu[2];
03484                         m_fptk = 1/m_fhelixk[2];
03485                         m_fptp = 1/m_fhelixp[2];
03486 
03487                         if(debug_ >= 3){   
03488                                 std::cout<<"                                           "<<std::endl;
03489                                 std::cout<<"in file Kalman_fitting_anal ,the  m_fpt is .."<<m_fpt<<std::endl;
03490                                 std::cout<<"in file Kalman_fitting_anal ,the  m_fpte is .."<<m_fpte<<std::endl;
03491                                 std::cout<<"in file Kalman_fitting_anal ,the  m_fptmu is .."<<m_fptmu<<std::endl;
03492                                 std::cout<<"in file Kalman_fitting_anal ,the  m_fptk is .."<<m_fptk<<std::endl;
03493                                 std::cout<<"in file Kalman_fitting_anal ,the  m_fptp is .."<<m_fptp<<std::endl;
03494                         }
03495 
03496                         m_zpt = 1/m_zhelix[2];
03497                         m_zpte = 1/m_zhelixe[2];
03498                         m_zptmu = 1/m_zhelixmu[2];
03499                         m_zptk = 1/m_zhelixk[2];
03500                         m_zptp = 1/m_zhelixp[2];
03501 
03502                         if(debug_ >= 3) {
03503                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zpt is .."<<m_zpt<<std::endl;
03504                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zpte is .."<<m_zpte<<std::endl; 
03505                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zptmu is .."<<m_zptmu<<std::endl;
03506                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zptk is .."<<m_zptk<<std::endl;   
03507                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zptp is .."<<m_zptp<<std::endl;                                           
03508                         }
03509                         m_zptot = sqrt(1+pow(m_zhelix[4],2))/m_zhelix[2];
03510                         m_zptote = sqrt(1+pow(m_zhelixe[4],2))/m_zhelixe[2];
03511                         m_zptotmu = sqrt(1+pow(m_zhelixmu[4],2))/m_zhelixmu[2];
03512                         m_zptotk = sqrt(1+pow(m_zhelixk[4],2))/m_zhelixk[2];
03513                         m_zptotp = sqrt(1+pow(m_zhelixp[4],2))/m_zhelixp[2];
03514 
03515                         if(debug_ >= 3) {
03516                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zptot is .."<<m_zptot<<std::endl;
03517                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zptote is .."<<m_zptote<<std::endl;   
03518                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zptotmu is .."<<m_zptotmu<<std::endl;
03519                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zptotk is .."<<m_zptotk<<std::endl;   
03520                                 std::cout<<"in file Kalman_fitting_anal ,the  m_zptotp is .."<<m_zptotp<<std::endl;
03521                         }
03522 
03523                         if(ntuple_&32) {
03524                                 m_zsigp = sqrt(pow((m_zptot/m_zhelix[2]),2)*m_zerror[5]+
03525                                                 pow((m_zhelix[4]/m_zptot),2)*pow((1/m_zhelix[2]),4)*m_zerror[14]-
03526                                                 2*m_zhelix[4]*m_zerror[12]*pow((1/m_zhelix[2]),3));
03527                                 m_zsigpe = sqrt(pow((m_zptote/m_zhelixe[2]),2)*m_zerrore[5]+
03528                                                 pow((m_zhelixe[4]/m_zptote),2)*pow((1/m_zhelixe[2]),4)*m_zerrore[14]-
03529                                                 2*m_zhelixe[4]*m_zerrore[12]*pow((1/m_zhelixe[2]),3));
03530                                 m_zsigpmu = sqrt(pow((m_zptotmu/m_zhelixmu[2]),2)*m_zerrormu[5]+
03531                                                 pow((m_zhelixmu[4]/m_zptotmu),2)*pow((1/m_zhelixmu[2]),4)*m_zerrormu[14]-
03532                                                 2*m_zhelixmu[4]*m_zerrormu[12]*pow((1/m_zhelixmu[2]),3));
03533                                 m_zsigpk = sqrt(pow((m_zptotk/m_zhelixk[2]),2)*m_zerrork[5]+
03534                                                 pow((m_zhelixk[4]/m_zptotk),2)*pow((1/m_zhelixk[2]),4)*m_zerrork[14]-
03535                                                 2*m_zhelixk[4]*m_zerrork[12]*pow((1/m_zhelixk[2]),3));
03536                                 m_zsigpp = sqrt(pow((m_zptotp/m_zhelixp[2]),2)*m_zerrorp[5]+
03537                                                 pow((m_zhelixp[4]/m_zptotp),2)*pow((1/m_zhelixp[2]),4)*m_zerrorp[14]-
03538                                                 2*m_zhelixp[4]*m_zerrorp[12]*pow((1/m_zhelixp[2]),3));
03539                         }
03540 
03541                         StatusCode sc1 = m_nt1->write();
03542                         if( sc1.isFailure() ) cout<<"Ntuple1 filling failed!"<<endl;     
03543                 }
03544 
03545                 if(ntuple_&4) {
03546                         if(jj == 1) {
03547                                 phi1 = (*iter_trk)->getFFi0();
03548                                 r1 = (*iter_trk)->getFDr();
03549                                 z1 = (*iter_trk)->getFDz();     
03550                                 kap1 = (*iter_trk)->getFCpa();  
03551                                 tanl1 = (*iter_trk)->getFTanl();        
03552                                 charge1 = kap1/fabs(kap1);
03553                                 x1 = r1*cos(phi1);
03554                                 y1 = r1*sin(phi1);
03555                                 p1 = sqrt(1+tanl1*tanl1)/kap1;
03556                                 the1 = M_PI/2-atan(tanl1);
03557                                 px1 = -sin(phi1)/fabs(kap1);
03558                                 py1 = cos(phi1)/fabs(kap1);
03559                                 pz1= tanl1/fabs(kap1);
03560 
03561                         } else if(jj == 2) {
03562                                 phi2 = (*iter_trk)->getFFi0();
03563                                 r2 = (*iter_trk)->getFDr();
03564                                 z2 = (*iter_trk)->getFDz();     
03565                                 kap2 = (*iter_trk)->getFCpa();  
03566                                 tanl2 = (*iter_trk)->getFTanl();        
03567                                 charge2 = kap2/fabs(kap2);
03568                                 x2 = r1*cos(phi2);
03569                                 y2 = r1*sin(phi2);
03570                                 p2 = sqrt(1+tanl2*tanl2)/kap1;
03571                                 the2 = M_PI/2-atan(tanl2);
03572                                 px2 = -sin(phi2)/fabs(kap2);
03573                                 py2 = cos(phi2)/fabs(kap2);
03574                                 pz2= tanl2/fabs(kap2);
03575                         }
03576                 }
03577         }
03578         if(ntuple_&4) {
03579                 m_delx = x1 - x2;
03580                 m_dely = y1 - y2;
03581                 m_delz = z1 - z2;
03582                 m_delthe = the1 + the2;
03583                 m_delphi = phi1- phi2;
03584                 m_delp = p1 - p2;
03585                 m_delpx = charge1*fabs(px1) + charge2*fabs(px2);
03586                 m_delpy = charge1*fabs(py1) + charge2*fabs(py2);
03587                 m_delpz = charge1*fabs(pz1) + charge2*fabs(pz2);
03588 
03589                 StatusCode sc2 = m_nt2->write();
03590                 if( sc2.isFailure() ) cout<<"Ntuple2 filling failed!"<<endl;      
03591         } 
03592 
03593         delete [] order;
03594         delete [] rCont;
03595         delete [] rGen;
03596         delete [] rOM;
03597 
03598         if (debug_ == 4)
03599                 cout << "Kalfitting finished " << std::endl;
03600 }

void KalFitAlg::kalman_fitting_calib void   ) 
 

void KalFitAlg::kalman_fitting_calib void   ) 
 

03603 {
03604 
03605         MsgStream log(msgSvc(), name());
03606         double Pt_threshold(0.3);
03607         Hep3Vector IP(0,0,0);
03608 
03609         vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
03610         vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
03611         vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();    
03612 
03613         // Table Manager
03614         if ( !&whMgr ) return;
03615 
03616         // Get reduced chi**2 of Mdc track :
03617         int ntrk = mdcMgr->size();
03618         double* rPt = new double[ntrk];
03619         int* rOM = new int[ntrk];
03620         unsigned int* order = new unsigned int[ntrk];
03621         unsigned int* rCont = new unsigned int[ntrk];
03622         unsigned int* rGen = new unsigned int[ntrk];
03623 
03624         int index = 0;
03625         for(vector<MdcRec_trk>::iterator it  = mdcMgr->begin(),
03626                         end = mdcMgr->end(); it != end; it++) {
03627                 // Pt
03628                 rPt[index] = 0;
03629                 if (it->helix[2])
03630                         rPt[index] = 1 / fabs(it->helix[2]);
03631                 if(debug_ == 4) cout<<"rPt...[ "<<index<<" ]...."<< rPt[index] <<endl;
03632                 if(rPt[index] < 0) rPt[index] = DBL_MAX;
03633                 // Outermost layer 
03634                 std::vector<MdcRec_wirhit*> pt = it->hitcol ;
03635                 if(debug_ == 4) cout<<"ppt size:  "<< pt.size()<<endl;
03636                 int outermost(-1);
03637                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
03638                                 ii !=pt.begin()-1; ii--) {
03639                         int lyr((*ii)->geo->Lyr()->Id());
03640                         if (outermost < lyr) outermost = lyr;
03641                         if(debug_ == 4) cout<<"outmost:  "<<outermost<<"   lyr:  "<<lyr<<endl;
03642                 }
03643                 rOM[index] = outermost;
03644                 order[index] = index;
03645                 ++index;
03646         }
03647 
03648         // Sort Mdc tracks by Pt
03649         for (int j, k = ntrk - 1; k >= 0; k = j){
03650                 j = -1;
03651                 for(int i = 1; i <= k; i++)
03652                         if(rPt[i - 1] < rPt[i]){
03653                                 j = i - 1;
03654                                 std::swap(order[i], order[j]);
03655                                 std::swap(rPt[i], rPt[j]);
03656                                 std::swap(rOM[i], rOM[j]);
03657                                 std::swap(rCont[i], rCont[j]);
03658                                 std::swap(rGen[i], rGen[j]);
03659                         }
03660         }
03661         delete [] rPt;
03662         //
03663         int newcount(0);
03664         //check whether  Recon  already registered
03665         DataObject *aReconEvent;
03666         eventSvc()->findObject("/Event/Recon",aReconEvent);
03667         if(!aReconEvent) {
03668                 // register ReconEvent Data Object to TDS;
03669                 ReconEvent* recevt = new ReconEvent;
03670                 StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
03671                 if(sc!=StatusCode::SUCCESS) {
03672                         log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
03673                         return;
03674                 }
03675         }
03676 
03677         RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;   
03678         RecMdcKalHelixSegCol *segcol =new RecMdcKalHelixSegCol;
03679         //make RecMdcKalTrackCol
03680         log << MSG::INFO << "beginning to make RecMdcKalTrackCol" <<endreq;     
03681 
03682         // Loop over tracks given by PatRecon :
03683         for(int l = 0; l < ntrk; l++) {
03684                 //    m_timer[3]->start();
03685                 MdcRec_trk& TrasanTRK = *(mdcMgr->begin() + order[l]);     
03686                 MdcRec_trk_add& TrasanTRK_add = *(mdc_addMgr->begin()+order[l]);
03687 
03688                 // Reject the ones with quality != 0 
03689                 int trasqual = TrasanTRK_add.quality;
03690                 if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl; 
03691                 if (trasqual) continue;
03692 
03693                 newcount++;
03694                 if (debug_ == 4)
03695                         cout << "******* KalFit NUMBER : " << newcount << std::endl;      
03696 
03697                 // What kind of KalFit ? 
03698                 int type(0);
03699                 if ((TrasanTRK_add.decision & 32) == 32 ||
03700                                 (TrasanTRK_add.decision & 64) == 64)      type = 1;
03701 
03702                 // Initialisation : (x, a, ea)
03703                 HepPoint3D x(TrasanTRK.pivot[0],
03704                                 TrasanTRK.pivot[1],
03705                                 TrasanTRK.pivot[2]);
03706 
03707                 HepVector a(5);
03708                 for(int i = 0; i < 5; i++)
03709                         a[i] = TrasanTRK.helix[i];
03710 
03711                 HepSymMatrix ea(5);
03712                 for(int i = 0, k = 0; i < 5; i++) {
03713                         for(int j = 0; j <= i; j++) {
03714                                 ea[i][j] = matrixg_*TrasanTRK.error[k++];
03715                                 ea[j][i] = ea[i][j];
03716                         }
03717                 }
03718 
03719                 KalFitTrack::setInitMatrix(ea);
03720 
03721                 double fiTerm = TrasanTRK.fiTerm;
03722                 int way(1);
03723                 // Prepare the track found :
03724                 KalFitTrack track_lead = KalFitTrack(x, a, ea, lead_, 0, 0);
03725                 track_lead.bFieldZ(KalFitTrack::Bznom_);
03726                 // Mdc Hits 
03727                 int inlyr(999), outlyr(-1);
03728                 int* rStat = new int[43];
03729                 for(int irStat=0;irStat<43;++irStat)rStat[irStat]=0;
03730                 std::vector<MdcRec_wirhit*> pt=TrasanTRK.hitcol;
03731                 int hit_in(0);
03732                 if(debug_ == 4) cout<<"*********Pt size****"<< pt.size()<<endl;
03733                 // Number of hits/layer 
03734                 int Num[43] = {0};
03735                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
03736                                 ii != pt.begin()-1; ii--) {
03737                         Num[(*ii)->geo->Lyr()->Id()]++;
03738                 }
03739 
03740                 int hit_asso(0);
03741                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
03742                                 ii != pt.begin()-1; ii--) { 
03743 
03744                         hit_asso++;
03745                         if (Num[(*ii)->geo->Lyr()->Id()]>3) {
03746                                 if (debug_ >0)
03747                                         cout << "WARNING:  I found " << Num[(*ii)->geo->Lyr()->Id()] 
03748                                                 << " hits in the layer "
03749                                                 << (*ii)->geo->Lyr()->Id() << std::endl;
03750                                 continue;
03751                         }
03752                         //    if(ii!=pt.end()-1){
03753                         //            if(42 == (*ii)->geo->Lyr()->Id() && 42 == (*(ii+1))->geo->Lyr()->Id()){
03754                         //                    MdcRec_wirhit * rechit_before = *(ii+1);
03755                         //                    if((*rechit_before).tdc < (**ii).tdc) continue;
03756                         //                    else if(track_lead.HitsMdc().size()>0 && rStat[42]){
03757                         //                            track_lead.HitsMdc().pop_back();
03758                         //                    }
03759                         //            }
03760                         //            else{
03761                         //                    int layer_before=(*(ii+1))->geo->Lyr()->Id();
03762                         //                    if(layer_before == (*ii)->geo->Lyr()->Id()){
03763                         //                            MdcRec_wirhit * rechit_before = *(ii+1);
03764                         //                            if((*rechit_before).rechitptr->getDriftT()>450 || (**ii).rechitptr->getDriftT()>450.){
03765                         //                                    if((*rechit_before).tdc < (**ii).tdc) continue;
03766                         //                                    else if(track_lead.HitsMdc().size()>0 && rStat[layer_before]){
03767                         //                                            track_lead.HitsMdc().pop_back();
03768                         //                                    }
03769                         //                            }
03770                         //                    }
03771                         //            }
03772                         //    }
03773 
03774                         hit_in++;
03775                         MdcRec_wirhit & rechit = **ii;
03776                         double dist[2] = {rechit.ddl, rechit.ddr};
03777                         double erdist[2] = {rechit.erddl, rechit.erddr};
03778                         const MdcGeoWire* geo = rechit.geo;
03779 
03780                         int lr_decision(0);
03781                         if (KalFitTrack::LR_ == 1){
03782                                 if (rechit.lr==2 || rechit.lr==0) lr_decision=-1;
03783                                 //      if (rechit.lr==0) lr_decision=-1;
03784                                 else if (rechit.lr==1) lr_decision=1;
03785                         } 
03786 
03787                         int ind(geo->Lyr()->Id());
03788                         track_lead.appendHitsMdc( KalFitHitMdc(rechit.id,
03789                                                 lr_decision, rechit.tdc,
03790                                                 dist, erdist, 
03791                                                 _wire+(geo->Id()), rechit.rechitptr));
03792                         // inner/outer layer :
03793                         rStat[ind]++;
03794                         if (inlyr>ind) inlyr = ind;
03795                         if (outlyr<ind) outlyr = ind;
03796                 }
03797                 if (debug_ == 4) 
03798                         cout << "**** NUMBER OF Mdc HITS (TRASAN) = " << hit_asso << std::endl;
03799 
03800                 // Empty layers :
03801                 int empty_between(0), empty(0);
03802                 for (int i= inlyr; i <= outlyr; i++)
03803                         if (!rStat[i]) empty_between++;
03804                 empty = empty_between+inlyr+(42-outlyr);
03805                 delete [] rStat;
03806 
03807                 // RMK high momentum track under study, probably not neeeded...
03808                 track_lead.order_wirhit(1);
03809                 track_lead.type(type);
03810                 unsigned int nhit = track_lead.HitsMdc().size();
03811                 if (!nhit && debug_ == 4) {
03812                         cout << " ATTENTION TRACK WITH ONLY HITS " << nhit << std::endl;
03813                         continue;
03814                 }
03815 
03816                 // Initialisation :
03817                 double  KalFitst(0), KalFitax(0), KalFitschi2(0);
03818                 // Move to the outer most hit :      
03819                 Hep3Vector outer_pivot(track_lead.x(fiTerm));
03820 
03821                 if(debug_ == 4) {
03822                         std::cout<<"before track_lead.pivot(outer_pivot) ,the error matrix of track_lead is .."<<track_lead.Ea()<<std::endl;
03823                 }
03824                 track_lead.pivot(outer_pivot); // hi gay, the error matrix is changed in this function!! 
03825                 track_lead.bFieldZ(KalFitTrack::Bznom_);
03826                 // attention best_chi2 reinitialize !!! 
03827                 if (nhit>=3 && !KalFitTrack::LR_) 
03828                         start_seed(track_lead, lead_, way, TrasanTRK);
03829                 HepSymMatrix Eakal(5,0);
03830 
03831                 //init_matrix(TrasanTRK, Eakal);
03832 
03833                 double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
03834                 if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
03835                         choice_ = 6;
03836                 }
03837 
03838                 init_matrix(choice_,TrasanTRK, Eakal);
03839 
03840                 //std::cout<<" Eakal be here: "<<Eakal<<std::endl;
03841 
03842                 if (debug_ == 4){
03843                         std::cout << "from Mdc Pattern Recognition: " << std::endl;
03844                         HepPoint3D IP(0,0,0);
03845                         Helix work(track_lead.pivot(), 
03846                                         track_lead.a(),
03847                                         track_lead.Ea());
03848                         work.pivot(IP);
03849                         std::cout << " dr = " << work.a()[0] 
03850                                 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
03851                         std::cout << " phi0 = " << work.a()[1] 
03852                                 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
03853                         std::cout << " PT = " << 1/work.a()[2] 
03854                                 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
03855                         std::cout << " dz = " << work.a()[3] 
03856                                 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
03857                         std::cout << " tanl = " << work.a()[4] 
03858                                 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
03859                 }
03860 
03861                 filter_fwd_calib(track_lead, lead_, way, Eakal);
03862                 track_lead.update_forMdc();
03863 
03864                 HepPoint3D IP(0,0,0);    
03865                 if (debug_ == 4) {
03866                         cout << " Mdc FIRST KALMAN FIT " << std::endl;
03867                         Helix work(track_lead.pivot(), 
03868                                         track_lead.a(),
03869                                         track_lead.Ea());
03870                         work.pivot(IP);
03871                         cout << " dr = " << work.a()[0] 
03872                                 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
03873                         cout << " phi0 = " << work.a()[1] 
03874                                 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
03875                         cout << " PT = " << 1/work.a()[2] 
03876                                 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
03877                         cout << " dz = " << work.a()[3] 
03878                                 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
03879                         cout << " tanl = " << work.a()[4] 
03880                                 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
03881                 }
03882 
03883                 // fill TDS
03884                 RecMdcKalTrack* kaltrk = new RecMdcKalTrack;
03885 
03886                 // Complete the track (other mass assumption, backward) and 
03887                 complete_track(TrasanTRK, TrasanTRK_add, track_lead, kaltrk,kalcol,segcol);
03888         }
03889 
03890 
03891         StatusCode kalsc;
03892         //check whether the RecMdcKalTrackCol has been already registered
03893         DataObject *aRecKalEvent;
03894         eventSvc()->findObject("/Event/Recon/RecMdcKalTrackCol", aRecKalEvent);
03895         if(aRecKalEvent!=NULL) {
03896                 //then unregister RecMdcKalCol
03897                 kalsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
03898                 if(kalsc != StatusCode::SUCCESS) {
03899                         log << MSG::FATAL << "Could not unregister RecMdcKalTrack collection" << endreq;
03900                         return;
03901                 }
03902         }
03903 
03904         kalsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
03905         if( kalsc.isFailure()) {
03906                 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
03907                 return; 
03908         }
03909         log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
03910 
03911 
03912 
03913         StatusCode segsc;
03914         //check whether the RecMdcKalHelixSegCol has been already registered
03915         DataObject *aRecKalSegEvent;
03916         eventSvc()->findObject("/Event/Recon/RecMdcKalHelixSegCol", aRecKalSegEvent);
03917         if(aRecKalSegEvent!=NULL) {
03918                 //then unregister RecMdcKalHelixSegCol
03919                 segsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
03920                 if(segsc != StatusCode::SUCCESS) {
03921                         log << MSG::FATAL << "Could not unregister RecMdcKalHelixSegCol collection" << endreq;
03922                         return;
03923                 }
03924         }
03925 
03926         segsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalHelixSegCol", segcol);
03927         if( segsc.isFailure() ) {
03928                 log << MSG::FATAL << "Could not register RecMdcKalHelixSeg" << endreq;
03929                 return; 
03930         }
03931         log << MSG::INFO << "RecMdcKalHelixSegCol registered successfully!" <<endreq;
03932 
03933 
03934         double x1(0.),x2(0.),y1(0.),y2(0.),z1(0.),z2(0.),the1(0.),the2(0.),phi1(0.),phi2(0.),p1(0.),p2(0.);
03935         double r1(0.),r2(0.),kap1(999.),kap2(999.),tanl1(0.),tanl2(0.); 
03936         //check the result:RecMdcKalTrackCol   
03937 
03938         SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
03939         if (!kaltrkCol) { 
03940                 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
03941                 return;
03942         }
03943         log << MSG::INFO << "Begin to check RecMdcKalTrackCol"<<endreq; 
03944         RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
03945         for( int jj=1; iter_trk != kaltrkCol->end(); iter_trk++,jj++) {
03946                 log << MSG::DEBUG << "retrieved MDC Kalmantrack:"
03947                         << "Track Id: " << (*iter_trk)->getTrackId()
03948                         << " Mass of the fit: "<< (*iter_trk)->getMass(2)<< endreq
03949                         << " Length of the track: "<< (*iter_trk)->getLength(2)
03950                         << "  Tof of the track: "<< (*iter_trk)->getTof(2) << endreq
03951                         << " Chisq of the fit: "<< (*iter_trk)->getChisq(0,2)
03952                         <<"  "<< (*iter_trk)->getChisq(1,2) << endreq
03953                         << "Ndf of the fit: "<< (*iter_trk)->getNdf(0,1)
03954                         <<"  "<< (*iter_trk)->getNdf(1,2) << endreq
03955                         << "Kappa " << (*iter_trk)->getZHelix()[2]
03956                         << endreq;
03957 
03958                 HelixSegRefVec gothelixsegs = (*iter_trk)->getVecHelixSegs();
03959                 if(debug_ == 4) { 
03960                         std::cout<<"the size of gothelixsegs ..."<<gothelixsegs.size()<<std::endl;      
03961                 }
03962 
03963                 HelixSegRefVec::iterator it_gothelixseg = gothelixsegs.begin();
03964                 for( ; it_gothelixseg != gothelixsegs.end(); it_gothelixseg++) {
03965                         if(debug_ == 4) { 
03966                                 std::cout<<"the layerId of this helixseg is ..."<<(*it_gothelixseg)->getLayerId()<<std::endl;
03967                                 std::cout<<"the residual of this helixseg exclude the meas hit"<<(*it_gothelixseg)->getResExcl()<<std::endl;
03968                                 std::cout<<"the residual of this helixseg include the meas hit"<<(*it_gothelixseg)->getResIncl()<<std::endl;
03969                                 std::cout<<"the track id of the helixseg is ..."<<(*it_gothelixseg)->getTrackId() <<std::endl;
03970                                 std::cout<<"the tof of the helixseg is ..."<<(*it_gothelixseg)->getTof()<<std::endl;
03971                                 std::cout<<"the Zhit of the helixseg is ..."<<(*it_gothelixseg)->getZhit()<<std::endl;
03972                         }
03973                 }
03974                 for( int i = 0; i<43; i++) {
03975                         log << MSG::DEBUG << "retrieved pathl["<<i<<"]= "
03976                                 << (*iter_trk)->getPathl(i) <<endreq;
03977                 }
03978 
03979                 if(ntuple_&1) {
03980                         m_trackid = (*iter_trk)->getTrackId();
03981                         for( int jj =0, iii=0; jj<5; jj++) {
03982                                 m_length[jj] = (*iter_trk)->getLength(jj);
03983                                 m_tof[jj] = (*iter_trk)->getTof(jj);
03984                                 m_nhits[jj] = (*iter_trk)->getNhits(jj);
03985                                 m_zhelix[jj] = (*iter_trk)->getZHelix()[jj];
03986                                 m_zhelixe[jj] = (*iter_trk)->getZHelixE()[jj];
03987                                 m_zhelixmu[jj] = (*iter_trk)->getZHelixMu()[jj];
03988                                 m_zhelixk[jj] = (*iter_trk)->getZHelixK()[jj];
03989                                 m_zhelixp[jj] = (*iter_trk)->getZHelixP()[jj];
03990                                 m_fhelix[jj] = (*iter_trk)->getFHelix()[jj];
03991                                 m_fhelixe[jj] = (*iter_trk)->getFHelixE()[jj];
03992                                 m_fhelixmu[jj] = (*iter_trk)->getFHelixMu()[jj];
03993                                 m_fhelixk[jj] = (*iter_trk)->getFHelixK()[jj];
03994                                 m_fhelixp[jj] = (*iter_trk)->getFHelixP()[jj];
03995                                 m_lhelix[jj] = (*iter_trk)->getLHelix()[jj];
03996                                 m_lhelixe[jj] = (*iter_trk)->getLHelixE()[jj];
03997                                 m_lhelixmu[jj] = (*iter_trk)->getLHelixMu()[jj];
03998                                 m_lhelixk[jj] = (*iter_trk)->getLHelixK()[jj];
03999                                 m_lhelixp[jj] = (*iter_trk)->getLHelixP()[jj];
04000                                 if(ntuple_&32) {
04001                                         for(int kk=0; kk<=jj; kk++,iii++) {
04002                                                 m_zerror[iii] = (*iter_trk)->getZError()[jj][kk];
04003                                                 m_zerrore[iii] = (*iter_trk)->getZErrorE()[jj][kk];
04004                                                 m_zerrormu[iii] = (*iter_trk)->getZErrorMu()[jj][kk];
04005                                                 m_zerrork[iii] = (*iter_trk)->getZErrorK()[jj][kk];
04006                                                 m_zerrorp[iii] = (*iter_trk)->getZErrorP()[jj][kk];
04007                                                 m_ferror[iii] = (*iter_trk)->getFError()[jj][kk];
04008                                                 m_ferrore[iii] = (*iter_trk)->getFErrorE()[jj][kk];
04009                                                 m_ferrormu[iii] = (*iter_trk)->getFErrorMu()[jj][kk];
04010                                                 m_ferrork[iii] = (*iter_trk)->getFErrorK()[jj][kk];
04011                                                 m_ferrorp[iii] = (*iter_trk)->getFErrorP()[jj][kk];
04012                                                 m_lerror[iii] = (*iter_trk)->getLError()[jj][kk];
04013                                                 m_lerrore[iii] = (*iter_trk)->getLErrorE()[jj][kk];
04014                                                 m_lerrormu[iii] = (*iter_trk)->getLErrorMu()[jj][kk];
04015                                                 m_lerrork[iii] = (*iter_trk)->getLErrorK()[jj][kk];
04016                                                 m_lerrorp[iii] = (*iter_trk)->getLErrorP()[jj][kk];
04017                                         }
04018 
04019                                 }
04020                         }
04021 
04022                         //       // the following logic may seem peculiar, but it IS the case(for BOSS5.0 and BOSS5.1)
04023                         //       m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
04024                         //       m_chisq[0][1] = (*iter_trk)->getChisq(0,1);
04025                         //       m_chisq[1][0] = (*iter_trk)->getChisq(0,2);
04026                         //       m_chisq[1][1] = (*iter_trk)->getChisq(0,3);
04027                         //       m_chisq[2][0] = (*iter_trk)->getChisq(0,4);
04028                         //       m_chisq[2][1] = (*iter_trk)->getChisq(1,0);
04029                         //       m_chisq[3][0] = (*iter_trk)->getChisq(1,1);
04030                         //       m_chisq[3][1] = (*iter_trk)->getChisq(1,2);
04031                         //       m_chisq[4][0] = (*iter_trk)->getChisq(1,3);
04032                         //       m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
04033 
04034                         //       m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
04035                         //       m_ndf[0][1] = (*iter_trk)->getNdf(0,1);
04036                         //       m_ndf[1][0] = (*iter_trk)->getNdf(0,2);
04037                         //       m_ndf[1][1] = (*iter_trk)->getNdf(0,3);
04038                         //       m_ndf[2][0] = (*iter_trk)->getNdf(0,4);
04039                         //       m_ndf[2][1] = (*iter_trk)->getNdf(1,0);
04040                         //       m_ndf[3][0] = (*iter_trk)->getNdf(1,1);
04041                         //       m_ndf[3][1] = (*iter_trk)->getNdf(1,2);
04042                         //       m_ndf[4][0] = (*iter_trk)->getNdf(1,3);
04043                         //       m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
04044 
04045                         //       m_stat[0][0] = (*iter_trk)->getStat(0,0);
04046                         //       m_stat[0][1] = (*iter_trk)->getStat(0,1);
04047                         //       m_stat[1][0] = (*iter_trk)->getStat(0,2);
04048                         //       m_stat[1][1] = (*iter_trk)->getStat(0,3);
04049                         //       m_stat[2][0] = (*iter_trk)->getStat(0,4);
04050                         //       m_stat[2][1] = (*iter_trk)->getStat(1,0);
04051                         //       m_stat[3][0] = (*iter_trk)->getStat(1,1);
04052                         //       m_stat[3][1] = (*iter_trk)->getStat(1,2);
04053                         //       m_stat[4][0] = (*iter_trk)->getStat(1,3);
04054                         //       m_stat[4][1] = (*iter_trk)->getStat(1,4);
04055 
04056                         // RootConversion changed in BOSS6.0, so use thefollowing:
04057                         m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
04058                         m_chisq[1][0] = (*iter_trk)->getChisq(0,1);
04059                         m_chisq[2][0] = (*iter_trk)->getChisq(0,2);
04060                         m_chisq[3][0] = (*iter_trk)->getChisq(0,3);
04061                         m_chisq[4][0] = (*iter_trk)->getChisq(0,4);
04062                         m_chisq[0][1] = (*iter_trk)->getChisq(1,0);
04063                         m_chisq[1][1] = (*iter_trk)->getChisq(1,1);
04064                         m_chisq[2][1] = (*iter_trk)->getChisq(1,2);
04065                         m_chisq[3][1] = (*iter_trk)->getChisq(1,3);
04066                         m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
04067 
04068                         m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
04069                         m_ndf[1][0] = (*iter_trk)->getNdf(0,1);
04070                         m_ndf[2][0] = (*iter_trk)->getNdf(0,2);
04071                         m_ndf[3][0] = (*iter_trk)->getNdf(0,3);
04072                         m_ndf[4][0] = (*iter_trk)->getNdf(0,4);
04073                         m_ndf[0][1] = (*iter_trk)->getNdf(1,0);
04074                         m_ndf[1][1] = (*iter_trk)->getNdf(1,1);
04075                         m_ndf[2][1] = (*iter_trk)->getNdf(1,2);
04076                         m_ndf[3][1] = (*iter_trk)->getNdf(1,3);
04077                         m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
04078 
04079                         m_stat[0][0] = (*iter_trk)->getStat(0,0);
04080                         m_stat[1][0] = (*iter_trk)->getStat(0,1);
04081                         m_stat[2][0] = (*iter_trk)->getStat(0,2);
04082                         m_stat[3][0] = (*iter_trk)->getStat(0,3);
04083                         m_stat[4][0] = (*iter_trk)->getStat(0,4);
04084                         m_stat[0][1] = (*iter_trk)->getStat(1,0);
04085                         m_stat[1][1] = (*iter_trk)->getStat(1,1);
04086                         m_stat[2][1] = (*iter_trk)->getStat(1,2);
04087                         m_stat[3][1] = (*iter_trk)->getStat(1,3);
04088                         m_stat[4][1] = (*iter_trk)->getStat(1,4);
04089 
04090                         m_fptot = sqrt(1+pow(m_fhelix[4],2))/m_fhelix[2];
04091                         m_fptote = sqrt(1+pow(m_fhelixe[4],2))/m_fhelixe[2];
04092                         m_fptotmu = sqrt(1+pow(m_fhelixmu[4],2))/m_fhelixmu[2];
04093                         m_fptotk = sqrt(1+pow(m_fhelixk[4],2))/m_fhelixk[2];
04094                         m_fptotp = sqrt(1+pow(m_fhelixp[4],2))/m_fhelixp[2];
04095 
04096                         m_zpt = 1/m_zhelix[2];
04097                         m_zpte = 1/m_zhelixe[2];
04098                         m_zptmu = 1/m_zhelixmu[2];
04099                         m_zptk = 1/m_zhelixk[2];
04100                         m_zptp = 1/m_zhelixp[2];
04101 
04102                         m_fpt = 1/m_fhelix[2];
04103                         m_fpte = 1/m_fhelixe[2];
04104                         m_fptmu = 1/m_fhelixmu[2];
04105                         m_fptk = 1/m_fhelixk[2];
04106                         m_fptp = 1/m_fhelixp[2];
04107 
04108                         m_lpt = 1/m_lhelix[2];
04109                         m_lpte = 1/m_lhelixe[2];
04110                         m_lptmu = 1/m_lhelixmu[2];
04111                         m_lptk = 1/m_lhelixk[2];
04112                         m_lptp = 1/m_lhelixp[2];
04113 
04114                         m_lptot = sqrt(1+pow(m_lhelix[4],2))/m_lhelix[2];
04115                         m_lptote = sqrt(1+pow(m_lhelixe[4],2))/m_lhelixe[2];
04116                         m_lptotmu = sqrt(1+pow(m_lhelixmu[4],2))/m_lhelixmu[2];
04117                         m_lptotk = sqrt(1+pow(m_lhelixk[4],2))/m_lhelixk[2];
04118                         m_lptotp = sqrt(1+pow(m_lhelixp[4],2))/m_lhelixp[2];
04119 
04120                         m_zptot = sqrt(1+pow(m_zhelix[4],2))/m_zhelix[2];
04121                         m_zptote = sqrt(1+pow(m_zhelixe[4],2))/m_zhelixe[2];
04122                         m_zptotmu = sqrt(1+pow(m_zhelixmu[4],2))/m_zhelixmu[2];
04123                         m_zptotk = sqrt(1+pow(m_zhelixk[4],2))/m_zhelixk[2];
04124                         m_zptotp = sqrt(1+pow(m_zhelixp[4],2))/m_zhelixp[2];
04125                         if(ntuple_&32) {
04126                                 m_zsigp = sqrt(pow((m_zptot/m_zhelix[2]),2)*m_zerror[5]+
04127                                                 pow((m_zhelix[4]/m_zptot),2)*pow((1/m_zhelix[2]),4)*m_zerror[14]-
04128                                                 2*m_zhelix[4]*m_zerror[12]*pow((1/m_zhelix[2]),3));
04129                                 m_zsigpe = sqrt(pow((m_zptote/m_zhelixe[2]),2)*m_zerrore[5]+
04130                                                 pow((m_zhelixe[4]/m_zptote),2)*pow((1/m_zhelixe[2]),4)*m_zerrore[14]-
04131                                                 2*m_zhelixe[4]*m_zerrore[12]*pow((1/m_zhelixe[2]),3));
04132                                 m_zsigpmu = sqrt(pow((m_zptotmu/m_zhelixmu[2]),2)*m_zerrormu[5]+
04133                                                 pow((m_zhelixmu[4]/m_zptotmu),2)*pow((1/m_zhelixmu[2]),4)*m_zerrormu[14]-
04134                                                 2*m_zhelixmu[4]*m_zerrormu[12]*pow((1/m_zhelixmu[2]),3));
04135                                 m_zsigpk = sqrt(pow((m_zptotk/m_zhelixk[2]),2)*m_zerrork[5]+
04136                                                 pow((m_zhelixk[4]/m_zptotk),2)*pow((1/m_zhelixk[2]),4)*m_zerrork[14]-
04137                                                 2*m_zhelixk[4]*m_zerrork[12]*pow((1/m_zhelixk[2]),3));
04138                                 m_zsigpp = sqrt(pow((m_zptotp/m_zhelixp[2]),2)*m_zerrorp[5]+
04139                                                 pow((m_zhelixp[4]/m_zptotp),2)*pow((1/m_zhelixp[2]),4)*m_zerrorp[14]-
04140                                                 2*m_zhelixp[4]*m_zerrorp[12]*pow((1/m_zhelixp[2]),3));
04141                         }
04142 
04143                         StatusCode sc1 = m_nt1->write();
04144                         if( sc1.isFailure() ) cout<<"Ntuple1 filling failed!"<<endl;     
04145                 }
04146 
04147                 if(ntuple_&4) {
04148                         if(jj == 1) { 
04149                                 phi1 = (*iter_trk)->getFFi0();
04150                                 r1 = (*iter_trk)->getFDr();
04151                                 z1 = (*iter_trk)->getFDz();     
04152                                 kap1 = (*iter_trk)->getFCpa();  
04153                                 tanl1 = (*iter_trk)->getFTanl();        
04154                                 x1 = r1*cos(phi1);
04155                                 y1 = r1*sin(phi1);
04156                                 p1 = sqrt(1+tanl1*tanl1)/kap1;
04157                                 the1 = M_PI/2-atan(tanl1);
04158                         } else if(jj == 2) {
04159                                 phi2 = (*iter_trk)->getFFi0();
04160                                 r2 = (*iter_trk)->getFDr();
04161                                 z2 = (*iter_trk)->getFDz();     
04162                                 kap2 = (*iter_trk)->getFCpa();  
04163                                 tanl2 = (*iter_trk)->getFTanl();        
04164                                 x2 = r1*cos(phi2);
04165                                 y2 = r1*sin(phi2);
04166                                 p2 = sqrt(1+tanl2*tanl2)/kap1;
04167                                 the2 = M_PI/2-atan(tanl2);
04168                         }
04169                 }
04170         }
04171         if(ntuple_&4) {
04172                 m_delx = x1 - x2;
04173                 m_dely = y1 - y2;
04174                 m_delz = z1 - z2;
04175                 m_delthe = the1 + the2;
04176                 m_delphi = phi1- phi2;
04177                 m_delp = p1 - p2;
04178                 StatusCode sc2 = m_nt2->write();
04179                 if( sc2.isFailure() ) cout<<"Ntuple2 filling failed!"<<endl;      
04180         } 
04181         delete [] order;
04182         delete [] rCont;
04183         delete [] rGen;
04184         delete [] rOM;
04185 
04186         if (debug_ == 4)
04187                 cout << "Kalfitting finished " << std::endl;
04188 }

void KalFitAlg::kalman_fitting_csmalign void   ) 
 

void KalFitAlg::kalman_fitting_csmalign void   ) 
 

04681 {
04682 
04683         MsgStream log(msgSvc(), name());
04684         double Pt_threshold(0.3);
04685         Hep3Vector IP(0,0,0);
04686 
04687         vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
04688         vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
04689         vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();    
04690 
04691         // Table Manager
04692         if ( !&whMgr ) return;
04693 
04694         // Get reduced chi**2 of Mdc track :
04695         int ntrk = mdcMgr->size();
04696         //cout<<"ntrk: "<<ntrk<<endl;
04697 
04698         int nhits = whMgr->size();
04699         //cout<<"nhits: "<<nhits<<endl;
04700 
04701 
04702         double* rY = new double[ntrk];
04703         double* rfiTerm = new double[ntrk];
04704         double* rPt = new double[ntrk];
04705         int* rOM = new int[ntrk];
04706         unsigned int* order = new unsigned int[ntrk];
04707         unsigned int* rCont = new unsigned int[ntrk];
04708         unsigned int* rGen = new unsigned int[ntrk];
04709 
04710         int index = 0;
04711         Hep3Vector csmp3[2];
04712         for(vector<MdcRec_trk>::iterator it  = mdcMgr->begin(),
04713                         end = mdcMgr->end(); it != end; it++) {
04714                 //order by phi term
04715                 rfiTerm[index]=it->fiTerm;
04716                 //cout<<"fiTerm: "<<rfiTerm[index]<<endl;
04717                 // Pt
04718                 rPt[index] = 0;
04719                 if (it->helix[2])
04720                         rPt[index] = 1 / fabs(it->helix[2]);
04721                 if(debug_ == 4) cout<<"rPt...[ "<<index<<" ]...."<< rPt[index] <<endl;
04722                 if(rPt[index] < 0) rPt[index] = DBL_MAX;
04723                 // Outermost layer 
04724                 std::vector<MdcRec_wirhit*> pt = it->hitcol ;
04725                 if(debug_ == 4) cout<<"ppt size:  "<< pt.size()<<endl;
04726                 int outermost(-1);
04727                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
04728                                 ii !=pt.begin()-1; ii--) {
04729                         int lyr((*ii)->geo->Lyr()->Id());
04730                         if (outermost < lyr) {
04731                                 outermost = lyr;
04732                                 rY[index] = (*ii)->geo->Forward().y();  
04733                         }
04734                         if(debug_ == 4) cout<<"outmost:  "<<outermost<<"   lyr:  "<<lyr<<endl;
04735                 }
04736                 rOM[index] = outermost;
04737                 order[index] = index;
04738                 ++index;
04739         }
04740 
04741         // Sort Mdc tracks by fiTerm
04742         for (int j, k = ntrk - 1; k >= 0; k = j){
04743                 j = -1; 
04744                 for(int i = 1; i <= k; i++)
04745                         if(rY[i - 1] < rY[i]){
04746                                 j = i - 1;
04747                                 std::swap(order[i], order[j]);
04748                                 std::swap(rY[i], rY[j]);
04749                                 std::swap(rOM[i], rOM[j]);
04750                                 std::swap(rCont[i], rCont[j]);
04751                                 std::swap(rGen[i], rGen[j]);
04752                         }
04753         }
04754         delete [] rPt;
04755         delete [] rY;
04756         delete [] rfiTerm;
04757         //
04758         int newcount(0);
04759         //check whether  Recon  already registered
04760         DataObject *aReconEvent;
04761         eventSvc()->findObject("/Event/Recon",aReconEvent);
04762         if(!aReconEvent) {
04763                 // register ReconEvent Data Object to TDS;
04764                 ReconEvent* recevt = new ReconEvent;
04765                 StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
04766                 if(sc!=StatusCode::SUCCESS) {
04767                         log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
04768                         return;
04769                 }
04770         }
04771 
04772         RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;   
04773         RecMdcKalHelixSegCol *segcol =new RecMdcKalHelixSegCol;
04774         //make RecMdcKalTrackCol
04775         log << MSG::INFO << "beginning to make RecMdcKalTrackCol" <<endreq;     
04776 
04777         //    m_timer[3]->start();
04778         //  MdcRec_trk& TrasanTRK;     
04779         //  MdcRec_trk_add& TrasanTRK_add;
04780 
04781         //  for(int l = 0; l < ntrk; l++) {
04782         MdcRec_trk& TrasanTRK = *(mdcMgr->begin() + order[1]);     
04783         MdcRec_trk_add& TrasanTRK_add = *(mdc_addMgr->begin()+order[1]);
04784         // Reject the ones with quality != 0 
04785         // int trasqual = TrasanTRK_add.quality;
04786         // if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl; 
04787         // if (trasqual) continue;
04788 
04789         newcount++;
04790         if (debug_ == 4)
04791                 cout << "******* KalFit NUMBER : " << newcount << std::endl;      
04792 
04793         // What kind of KalFit ? 
04794         int type(0);
04795         if ((TrasanTRK_add.decision & 32) == 32 ||
04796                         (TrasanTRK_add.decision & 64) == 64)      type = 1;
04797 
04798         // Initialisation : (x, a, ea)
04799         HepPoint3D x(TrasanTRK.pivot[0],
04800                         TrasanTRK.pivot[1],
04801                         TrasanTRK.pivot[2]);
04802 
04803         HepVector a(5);
04804         for(int i = 0; i < 5; i++)
04805                 a[i] = TrasanTRK.helix[i];
04806 
04807         HepSymMatrix ea(5);
04808         for(int i = 0, k = 0; i < 5; i++) {
04809                 for(int j = 0; j <= i; j++) {
04810                         ea[i][j] = matrixg_*TrasanTRK.error[k++];
04811                         ea[j][i] = ea[i][j];
04812                 }
04813         }
04814 
04815         KalFitTrack::setInitMatrix(ea);
04816 
04817         double fiTerm = TrasanTRK.fiTerm;
04818         int way(1);
04819         // Prepare the track found :
04820         KalFitTrack track_lead = KalFitTrack(x, a, ea, lead_, 0, 0);
04821         track_lead.bFieldZ(KalFitTrack::Bznom_);
04822 
04823         int hit_asso(0);
04824         for(int l = 0; l < ntrk; l++) {
04825                 MdcRec_trk& TrasanTRK1 = *(mdcMgr->begin() + order[l]);     
04826                 MdcRec_trk_add& TrasanTRK_add1 = *(mdc_addMgr->begin()+order[l]);
04827                 // Reject the ones with quality != 0 
04828                 int trasqual = TrasanTRK_add1.quality;
04829                 if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl; 
04830                 if (trasqual) continue;
04831                 // Mdc Hits 
04832                 int inlyr(999), outlyr(-1);
04833                 int* rStat = new int[43];
04834                 for(int irStat=0;irStat<43;++irStat)rStat[irStat]=0;
04835                 std::vector<MdcRec_wirhit*> pt=TrasanTRK1.hitcol;
04836                 int hit_in(0);
04837                 if(debug_ == 4) cout<<"*********Pt size****"<< pt.size()<<endl;
04838                 // Number of hits/layer 
04839                 int Num[43] = {0};
04840                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
04841                                 ii != pt.begin()-1; ii--) {
04842                         Num[(*ii)->geo->Lyr()->Id()]++;
04843                 }
04844 
04845                 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
04846                                 ii != pt.begin()-1; ii--) { 
04847 
04848                         hit_asso++;
04849                         if (Num[(*ii)->geo->Lyr()->Id()]>3) {
04850                                 if (debug_ >0)
04851                                         cout << "WARNING:  I found " << Num[(*ii)->geo->Lyr()->Id()] 
04852                                                 << " hits in the layer "
04853                                                 << (*ii)->geo->Lyr()->Id() << std::endl;
04854                                 continue;
04855                         }
04856 
04857                         hit_in++;
04858                         MdcRec_wirhit & rechit = **ii;
04859                         double dist[2] = {rechit.ddl, rechit.ddr};
04860                         double erdist[2] = {rechit.erddl, rechit.erddr};
04861                         const MdcGeoWire* geo = rechit.geo;
04862 
04863                         int lr_decision(0);
04864                         if (KalFitTrack::LR_ == 1){
04865                                 if (rechit.lr==2 || rechit.lr==0) lr_decision=-1;
04866                                 //      if (rechit.lr==0) lr_decision=-1;
04867                                 else if (rechit.lr==1) lr_decision=1;
04868                         } 
04869 
04870                         int ind(geo->Lyr()->Id());
04871                         track_lead.appendHitsMdc( KalFitHitMdc(rechit.id,
04872                                                 lr_decision, rechit.tdc,
04873                                                 dist, erdist, 
04874                                                 _wire+(geo->Id()), rechit.rechitptr));
04875                         // inner/outer layer :
04876                         rStat[ind]++;
04877                         if (inlyr>ind) inlyr = ind;
04878                         if (outlyr<ind) outlyr = ind;
04879                 }
04880                 // Empty layers :
04881                 int empty_between(0), empty(0);
04882                 for (int i= inlyr; i <= outlyr; i++)
04883                         if (!rStat[i]) empty_between++;
04884                 empty = empty_between+inlyr+(42-outlyr);
04885                 delete [] rStat;
04886         }
04887         if (debug_ == 4) 
04888                 cout << "**** NUMBER OF Mdc HITS (TRASAN) = " << hit_asso << std::endl;
04889 
04890 
04891         // RMK high momentum track under study, probably not neeeded...
04892         track_lead.order_wirhit(0);
04893         track_lead.type(type);
04894         unsigned int nhit = track_lead.HitsMdc().size();
04895         if (nhit<70) {
04896                 cout << " ATTENTION TRACK WITH ONLY HITS " << nhit << std::endl;
04897                 return;
04898         }
04899 
04900         // Initialisation :
04901         double  KalFitst(0), KalFitax(0), KalFitschi2(0);
04902         // Move to the outer most hit :      
04903         Hep3Vector outer_pivot(track_lead.x(fiTerm));
04904 
04905         if(debug_ == 4) {
04906                 std::cout<<"before track_lead.pivot(outer_pivot) ,the error matrix of track_lead is .."<<track_lead.Ea()<<std::endl;
04907         }
04908         track_lead.pivot(outer_pivot); // hi gay, the error matrix is changed in this function!! 
04909         track_lead.bFieldZ(KalFitTrack::Bznom_);
04910         // attention best_chi2 reinitialize !!! 
04911         if (nhit>=3 && !KalFitTrack::LR_) 
04912                 start_seed(track_lead, lead_, way, TrasanTRK);
04913         HepSymMatrix Eakal(5,0);
04914 
04915         //init_matrix(TrasanTRK, Eakal);
04916 
04917         double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
04918         if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
04919                 choice_ = 6;
04920         }
04921 
04922         init_matrix(choice_,TrasanTRK, Eakal);
04923 
04924         //std::cout<<" Eakal be here: "<<Eakal<<std::endl;
04925 
04926         if (debug_ == 4){
04927                 std::cout << "from Mdc Pattern Recognition: " << std::endl;
04928                 //HepPoint3D IP(0,0,0);
04929                 Helix work(track_lead.pivot(), 
04930                                 track_lead.a(),
04931                                 track_lead.Ea());
04932                 work.pivot(IP);
04933                 std::cout << " dr = " << work.a()[0] 
04934                         << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
04935                 std::cout << " phi0 = " << work.a()[1] 
04936                         << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
04937                 std::cout << " PT = " << 1/work.a()[2] 
04938                         << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
04939                 std::cout << " dz = " << work.a()[3] 
04940                         << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
04941                 std::cout << " tanl = " << work.a()[4] 
04942                         << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
04943         }
04944         filter_fwd_calib(track_lead, lead_, way, Eakal);
04945         track_lead.update_forMdc();
04946 
04947         //HepPoint3D IP(0,0,0);    
04948         if (debug_ == 4) {
04949                 cout << " Mdc FIRST KALMAN FIT " << std::endl;
04950                 Helix work1(track_lead.pivot(), 
04951                                 track_lead.a(),
04952                                 track_lead.Ea());
04953                 work1.pivot(IP);
04954                 cout << " dr = " << work1.a()[0] 
04955                         << ", Er_dr = " << sqrt(work1.Ea()[0][0]) << std::endl;
04956                 cout << " phi0 = " << work1.a()[1] 
04957                         << ", Er_phi0 = " << sqrt(work1.Ea()[1][1]) << std::endl;
04958                 cout << " PT = " << 1/work1.a()[2] 
04959                         << ", Er_kappa = " << sqrt(work1.Ea()[2][2]) << std::endl;
04960                 cout << " dz = " << work1.a()[3] 
04961                         << ", Er_dz = " << sqrt(work1.Ea()[3][3]) << std::endl;
04962                 cout << " tanl = " << work1.a()[4] 
04963                         << ", Er_tanl = " << sqrt(work1.Ea()[4][4]) << std::endl;
04964         }
04965 
04966         // fill TDS
04967         RecMdcKalTrack* kaltrk = new RecMdcKalTrack;
04968 
04969         // Complete the track (other mass assumption, backward) and 
04970         complete_track(TrasanTRK, TrasanTRK_add, track_lead, kaltrk,kalcol,segcol);
04971         // }
04972 
04973 
04974         StatusCode kalsc;
04975         //check whether the RecMdcKalTrackCol has been already registered
04976         DataObject *aRecKalEvent;
04977         eventSvc()->findObject("/Event/Recon/RecMdcKalTrackCol", aRecKalEvent);
04978         if(aRecKalEvent!=NULL) {
04979                 //then unregister RecMdcKalCol
04980                 kalsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
04981                 if(kalsc != StatusCode::SUCCESS) {
04982                         log << MSG::FATAL << "Could not unregister RecMdcKalTrack collection" << endreq;
04983                         return;
04984                 }
04985         }
04986 
04987         kalsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
04988         if( kalsc.isFailure()) {
04989                 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
04990                 return; 
04991         }
04992         log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
04993 
04994 
04995 
04996         StatusCode segsc;
04997         //check whether the RecMdcKalHelixSegCol has been already registered
04998         DataObject *aRecKalSegEvent;
04999         eventSvc()->findObject("/Event/Recon/RecMdcKalHelixSegCol", aRecKalSegEvent);
05000         if(aRecKalSegEvent!=NULL) {
05001                 //then unregister RecMdcKalHelixSegCol
05002                 segsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
05003                 if(segsc != StatusCode::SUCCESS) {
05004                         log << MSG::FATAL << "Could not unregister RecMdcKalHelixSegCol collection" << endreq;
05005                         return;
05006                 }
05007         }
05008 
05009         segsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalHelixSegCol", segcol);
05010         if( segsc.isFailure() ) {
05011                 log << MSG::FATAL << "Could not register RecMdcKalHelixSeg" << endreq;
05012                 return; 
05013         }
05014         log << MSG::INFO << "RecMdcKalHelixSegCol registered successfully!" <<endreq;
05015 
05016 
05017         double x1(0.),x2(0.),y1(0.),y2(0.),z1(0.),z2(0.),the1(0.),the2(0.),phi1(0.),phi2(0.),p1(0.),p2(0.);
05018         double r1(0.),r2(0.),kap1(999.),kap2(999.),tanl1(0.),tanl2(0.); 
05019         //check the result:RecMdcKalTrackCol   
05020 
05021         SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
05022         if (!kaltrkCol) { 
05023                 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
05024                 return;
05025         }
05026         log << MSG::INFO << "Begin to check RecMdcKalTrackCol"<<endreq; 
05027         RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
05028         for( int jj=1; iter_trk != kaltrkCol->end(); iter_trk++,jj++) {
05029                 log << MSG::DEBUG << "retrieved MDC Kalmantrack:"
05030                         << "Track Id: " << (*iter_trk)->getTrackId()
05031                         << " Mass of the fit: "<< (*iter_trk)->getMass(2)<< endreq
05032                         << " Length of the track: "<< (*iter_trk)->getLength(2)
05033                         << "  Tof of the track: "<< (*iter_trk)->getTof(2) << endreq
05034                         << " Chisq of the fit: "<< (*iter_trk)->getChisq(0,2)
05035                         <<"  "<< (*iter_trk)->getChisq(1,2) << endreq
05036                         << "Ndf of the fit: "<< (*iter_trk)->getNdf(0,1)
05037                         <<"  "<< (*iter_trk)->getNdf(1,2) << endreq
05038                         << "Kappa " << (*iter_trk)->getZHelix()[2]
05039                         << "zhelixmu "<<(*iter_trk)->getZHelixMu()
05040                         << endreq;
05041 
05042                 HelixSegRefVec gothelixsegs = (*iter_trk)->getVecHelixSegs();
05043                 if(debug_ == 4) { 
05044                         std::cout<<"the size of gothelixsegs ..."<<gothelixsegs.size()<<std::endl;      
05045                 }
05046 
05047                 HelixSegRefVec::iterator it_gothelixseg = gothelixsegs.begin();
05048                 for( ; it_gothelixseg != gothelixsegs.end(); it_gothelixseg++) {
05049                         if(debug_ == 4) { 
05050                                 std::cout<<"the layerId of this helixseg is ..."<<(*it_gothelixseg)->getLayerId()<<std::endl;
05051                                 std::cout<<"the residual of this helixseg exclude the meas hit"<<(*it_gothelixseg)->getResExcl()<<std::endl;
05052                                 std::cout<<"the residual of this helixseg include the meas hit"<<(*it_gothelixseg)->getResIncl()<<std::endl;
05053                                 std::cout<<"the track id of the helixseg is ..."<<(*it_gothelixseg)->getTrackId() <<std::endl;
05054                                 std::cout<<"the tof of the helixseg is ..."<<(*it_gothelixseg)->getTof()<<std::endl;
05055                                 std::cout<<"the Zhit of the helixseg is ..."<<(*it_gothelixseg)->getZhit()<<std::endl;
05056                         }
05057                 }
05058                 for( int i = 0; i<43; i++) {
05059                         log << MSG::DEBUG << "retrieved pathl["<<i<<"]= "
05060                                 << (*iter_trk)->getPathl(i) <<endreq;
05061                 }
05062 
05063                 if(ntuple_&1) {
05064                         m_trackid = (*iter_trk)->getTrackId();
05065                         for( int jj =0, iii=0; jj<5; jj++) {
05066                                 m_length[jj] = (*iter_trk)->getLength(jj);
05067                                 m_tof[jj] = (*iter_trk)->getTof(jj);
05068                                 m_nhits[jj] = (*iter_trk)->getNhits(jj);
05069                                 m_zhelix[jj] = (*iter_trk)->getZHelix()[jj];
05070                                 m_zhelixe[jj] = (*iter_trk)->getZHelixE()[jj];
05071                                 m_zhelixmu[jj] = (*iter_trk)->getZHelixMu()[jj];
05072                                 m_zhelixk[jj] = (*iter_trk)->getZHelixK()[jj];
05073                                 m_zhelixp[jj] = (*iter_trk)->getZHelixP()[jj];
05074                                 m_fhelix[jj] = (*iter_trk)->getFHelix()[jj];
05075                                 m_fhelixe[jj] = (*iter_trk)->getFHelixE()[jj];
05076                                 m_fhelixmu[jj] = (*iter_trk)->getFHelixMu()[jj];
05077                                 m_fhelixk[jj] = (*iter_trk)->getFHelixK()[jj];
05078                                 m_fhelixp[jj] = (*iter_trk)->getFHelixP()[jj];
05079                                 m_lhelix[jj] = (*iter_trk)->getLHelix()[jj];
05080                                 m_lhelixe[jj] = (*iter_trk)->getLHelixE()[jj];
05081                                 m_lhelixmu[jj] = (*iter_trk)->getLHelixMu()[jj];
05082                                 m_lhelixk[jj] = (*iter_trk)->getLHelixK()[jj];
05083                                 m_lhelixp[jj] = (*iter_trk)->getLHelixP()[jj];
05084                                 if(ntuple_&32) {
05085                                         for(int kk=0; kk<=jj; kk++,iii++) {
05086                                                 m_zerror[iii] = (*iter_trk)->getZError()[jj][kk];
05087                                                 m_zerrore[iii] = (*iter_trk)->getZErrorE()[jj][kk];
05088                                                 m_zerrormu[iii] = (*iter_trk)->getZErrorMu()[jj][kk];
05089                                                 m_zerrork[iii] = (*iter_trk)->getZErrorK()[jj][kk];
05090                                                 m_zerrorp[iii] = (*iter_trk)->getZErrorP()[jj][kk];
05091                                                 m_ferror[iii] = (*iter_trk)->getFError()[jj][kk];
05092                                                 m_ferrore[iii] = (*iter_trk)->getFErrorE()[jj][kk];
05093                                                 m_ferrormu[iii] = (*iter_trk)->getFErrorMu()[jj][kk];
05094                                                 m_ferrork[iii] = (*iter_trk)->getFErrorK()[jj][kk];
05095                                                 m_ferrorp[iii] = (*iter_trk)->getFErrorP()[jj][kk];
05096                                                 m_lerror[iii] = (*iter_trk)->getLError()[jj][kk];
05097                                                 m_lerrore[iii] = (*iter_trk)->getLErrorE()[jj][kk];
05098                                                 m_lerrormu[iii] = (*iter_trk)->getLErrorMu()[jj][kk];
05099                                                 m_lerrork[iii] = (*iter_trk)->getLErrorK()[jj][kk];
05100                                                 m_lerrorp[iii] = (*iter_trk)->getLErrorP()[jj][kk];
05101                                         }
05102 
05103                                 }
05104                         }
05105 
05106                         // RootConversion changed in BOSS6.0, so use thefollowing:
05107                         m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
05108                         m_chisq[1][0] = (*iter_trk)->getChisq(0,1);
05109                         m_chisq[2][0] = (*iter_trk)->getChisq(0,2);
05110                         m_chisq[3][0] = (*iter_trk)->getChisq(0,3);
05111                         m_chisq[4][0] = (*iter_trk)->getChisq(0,4);
05112                         m_chisq[0][1] = (*iter_trk)->getChisq(1,0);
05113                         m_chisq[1][1] = (*iter_trk)->getChisq(1,1);
05114                         m_chisq[2][1] = (*iter_trk)->getChisq(1,2);
05115                         m_chisq[3][1] = (*iter_trk)->getChisq(1,3);
05116                         m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
05117 
05118                         m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
05119                         m_ndf[1][0] = (*iter_trk)->getNdf(0,1);
05120                         m_ndf[2][0] = (*iter_trk)->getNdf(0,2);
05121                         m_ndf[3][0] = (*iter_trk)->getNdf(0,3);
05122                         m_ndf[4][0] = (*iter_trk)->getNdf(0,4);
05123                         m_ndf[0][1] = (*iter_trk)->getNdf(1,0);
05124                         m_ndf[1][1] = (*iter_trk)->getNdf(1,1);
05125                         m_ndf[2][1] = (*iter_trk)->getNdf(1,2);
05126                         m_ndf[3][1] = (*iter_trk)->getNdf(1,3);
05127                         m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
05128 
05129                         m_stat[0][0] = (*iter_trk)->getStat(0,0);
05130                         m_stat[1][0] = (*iter_trk)->getStat(0,1);
05131                         m_stat[2][0] = (*iter_trk)->getStat(0,2);
05132                         m_stat[3][0] = (*iter_trk)->getStat(0,3);
05133                         m_stat[4][0] = (*iter_trk)->getStat(0,4);
05134                         m_stat[0][1] = (*iter_trk)->getStat(1,0);
05135                         m_stat[1][1] = (*iter_trk)->getStat(1,1);
05136                         m_stat[2][1] = (*iter_trk)->getStat(1,2);
05137                         m_stat[3][1] = (*iter_trk)->getStat(1,3);
05138                         m_stat[4][1] = (*iter_trk)->getStat(1,4);
05139 
05140                         m_fptot = sqrt(1+pow(m_fhelix[4],2))/m_fhelix[2];
05141                         m_fptote = sqrt(1+pow(m_fhelixe[4],2))/m_fhelixe[2];
05142                         m_fptotmu = sqrt(1+pow(m_fhelixmu[4],2))/m_fhelixmu[2];
05143                         m_fptotk = sqrt(1+pow(m_fhelixk[4],2))/m_fhelixk[2];
05144                         m_fptotp = sqrt(1+pow(m_fhelixp[4],2))/m_fhelixp[2];
05145 
05146                         m_zpt = 1/m_zhelix[2];
05147                         m_zpte = 1/m_zhelixe[2];
05148                         m_zptmu = 1/m_zhelixmu[2];
05149                         m_zptk = 1/m_zhelixk[2];
05150                         m_zptp = 1/m_zhelixp[2];
05151 
05152                         m_fpt = 1/m_fhelix[2];
05153                         m_fpte = 1/m_fhelixe[2];
05154                         m_fptmu = 1/m_fhelixmu[2];
05155                         m_fptk = 1/m_fhelixk[2];
05156                         m_fptp = 1/m_fhelixp[2];
05157 
05158                         m_lpt = 1/m_lhelix[2];
05159                         m_lpte = 1/m_lhelixe[2];
05160                         m_lptmu = 1/m_lhelixmu[2];
05161                         m_lptk = 1/m_lhelixk[2];
05162                         m_lptp = 1/m_lhelixp[2];
05163 
05164                         m_lptot = sqrt(1+pow(m_lhelix[4],2))/m_lhelix[2];
05165                         m_lptote = sqrt(1+pow(m_lhelixe[4],2))/m_lhelixe[2];
05166                         m_lptotmu = sqrt(1+pow(m_lhelixmu[4],2))/m_lhelixmu[2];
05167                         m_lptotk = sqrt(1+pow(m_lhelixk[4],2))/m_lhelixk[2];
05168                         m_lptotp = sqrt(1+pow(m_lhelixp[4],2))/m_lhelixp[2];
05169 
05170                         m_zptot = sqrt(1+pow(m_zhelix[4],2))/m_zhelix[2];
05171                         m_zptote = sqrt(1+pow(m_zhelixe[4],2))/m_zhelixe[2];
05172                         m_zptotmu = sqrt(1+pow(m_zhelixmu[4],2))/m_zhelixmu[2];
05173                         m_zptotk = sqrt(1+pow(m_zhelixk[4],2))/m_zhelixk[2];
05174                         m_zptotp = sqrt(1+pow(m_zhelixp[4],2))/m_zhelixp[2];
05175                         if(ntuple_&32) {
05176                                 m_zsigp = sqrt(pow((m_zptot/m_zhelix[2]),2)*m_zerror[5]+
05177                                                 pow((m_zhelix[4]/m_zptot),2)*pow((1/m_zhelix[2]),4)*m_zerror[14]-
05178                                                 2*m_zhelix[4]*m_zerror[12]*pow((1/m_zhelix[2]),3));
05179                                 m_zsigpe = sqrt(pow((m_zptote/m_zhelixe[2]),2)*m_zerrore[5]+
05180                                                 pow((m_zhelixe[4]/m_zptote),2)*pow((1/m_zhelixe[2]),4)*m_zerrore[14]-
05181                                                 2*m_zhelixe[4]*m_zerrore[12]*pow((1/m_zhelixe[2]),3));
05182                                 m_zsigpmu = sqrt(pow((m_zptotmu/m_zhelixmu[2]),2)*m_zerrormu[5]+
05183                                                 pow((m_zhelixmu[4]/m_zptotmu),2)*pow((1/m_zhelixmu[2]),4)*m_zerrormu[14]-
05184                                                 2*m_zhelixmu[4]*m_zerrormu[12]*pow((1/m_zhelixmu[2]),3));
05185                                 m_zsigpk = sqrt(pow((m_zptotk/m_zhelixk[2]),2)*m_zerrork[5]+
05186                                                 pow((m_zhelixk[4]/m_zptotk),2)*pow((1/m_zhelixk[2]),4)*m_zerrork[14]-
05187                                                 2*m_zhelixk[4]*m_zerrork[12]*pow((1/m_zhelixk[2]),3));
05188                                 m_zsigpp = sqrt(pow((m_zptotp/m_zhelixp[2]),2)*m_zerrorp[5]+
05189                                                 pow((m_zhelixp[4]/m_zptotp),2)*pow((1/m_zhelixp[2]),4)*m_zerrorp[14]-
05190                                                 2*m_zhelixp[4]*m_zerrorp[12]*pow((1/m_zhelixp[2]),3));
05191                         }
05192 
05193                         StatusCode sc1 = m_nt1->write();
05194                         if( sc1.isFailure() ) cout<<"Ntuple1 filling failed!"<<endl;     
05195                 }
05196 
05197                 if(ntuple_&4) {
05198                         if(jj == 1) { 
05199                                 phi1 = (*iter_trk)->getFFi0();
05200                                 r1 = (*iter_trk)->getFDr();
05201                                 z1 = (*iter_trk)->getFDz();     
05202                                 kap1 = (*iter_trk)->getFCpa();  
05203                                 tanl1 = (*iter_trk)->getFTanl();        
05204                                 x1 = r1*cos(phi1);
05205                                 y1 = r1*sin(phi1);
05206                                 p1 = sqrt(1+tanl1*tanl1)/kap1;
05207                                 the1 = M_PI/2-atan(tanl1);
05208                         } else if(jj == 2) {
05209                                 phi2 = (*iter_trk)->getFFi0();
05210                                 r2 = (*iter_trk)->getFDr();
05211                                 z2 = (*iter_trk)->getFDz();     
05212                                 kap2 = (*iter_trk)->getFCpa();  
05213                                 tanl2 = (*iter_trk)->getFTanl();        
05214                                 x2 = r1*cos(phi2);
05215                                 y2 = r1*sin(phi2);
05216                                 p2 = sqrt(1+tanl2*tanl2)/kap1;
05217                                 the2 = M_PI/2-atan(tanl2);
05218                         }
05219                 }
05220         }
05221         if(ntuple_&4) {
05222                 m_delx = x1 - x2;
05223                 m_dely = y1 - y2;
05224                 m_delz = z1 - z2;
05225                 m_delthe = the1 + the2;
05226                 m_delphi = phi1- phi2;
05227                 m_delp = p1 - p2;
05228                 StatusCode sc2 = m_nt2->write();
05229                 if( sc2.isFailure() ) cout<<"Ntuple2 filling failed!"<<endl;      
05230         } 
05231         delete [] order;
05232         delete [] rCont;
05233         delete [] rGen;
05234         delete [] rOM;
05235 
05236         if (debug_ == 4)
05237                 cout << "Kalfitting finished " << std::endl;
05238 }

void KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew void   ) 
 

void KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew void   ) 
 

04192 {
04193 
04194         MsgStream log(msgSvc(), name());
04195         double Pt_threshold(0.3);
04196         Hep3Vector IP(0,0,0);
04197 
04198         vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
04199         vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
04200         vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();    
04201 
04202         // Table Manager
04203         if ( !&whMgr ) return;
04204 
04205         // Get reduced chi**2 of Mdc track :
04206         int ntrk = mdcMgr->size();
04207         // cout<<"ntrk: "<<ntrk<<endl;
04208 
04209         int nhits = whMgr->size();
04210         //cout<<"nhits: "<<nhits<<endl;
04211 
04212 
04213         //check whether  Recon  already registered
04214         DataObject *aReconEvent;
04215         eventSvc()->findObject("/Event/Recon",aReconEvent);
04216         if(!aReconEvent) {
04217                 // register ReconEvent Data Object to TDS;
04218                 ReconEvent* recevt = new ReconEvent;
04219                 StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
04220                 if(sc!=StatusCode::SUCCESS) {
04221                         log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
04222                         return;
04223                 }
04224         }
04225 
04226         RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;   
04227         RecMdcKalHelixSegCol *segcol =new RecMdcKalHelixSegCol;
04228         //make RecMdcKalTrackCol
04229         log << MSG::INFO << "beginning to make RecMdcKalTrackCol" <<endreq;     
04230 
04231 
04232         MdcRec_trk& TrasanTRK = *(mdcMgr->begin());     
04233         MdcRec_trk_add& TrasanTRK_add = *(mdc_addMgr->begin());
04234         // Reject the ones with quality != 0 
04235         // int trasqual = TrasanTRK_add.quality;
04236         // if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl; 
04237         // if (trasqual) continue;
04238 
04239         // What kind of KalFit ? 
04240         int type(0);
04241         if ((TrasanTRK_add.decision & 32) == 32 ||
04242                         (TrasanTRK_add.decision & 64) == 64)      type = 1;
04243 
04244         // Initialisation : (x, a, ea)
04245         HepPoint3D x(TrasanTRK.pivot[0],
04246                         TrasanTRK.pivot[1],
04247                         TrasanTRK.pivot[2]);
04248 
04249         HepVector a(5);
04250         for(int i = 0; i < 5; i++)
04251                 a[i] = TrasanTRK.helix[i];
04252 
04253         HepSymMatrix ea(5);
04254         for(int i = 0, k = 0; i < 5; i++) {
04255                 for(int j = 0; j <= i; j++) {
04256                         ea[i][j] = matrixg_*TrasanTRK.error[k++];
04257                         ea[j][i] = ea[i][j];
04258                 }
04259         }
04260 
04261         KalFitTrack::setInitMatrix(ea);
04262 
04263         double fiTerm = TrasanTRK.fiTerm;
04264         int way(1);
04265         // Prepare the track found :
04266         KalFitTrack track_lead = KalFitTrack(x, a, ea, lead_, 0, 0);
04267         track_lead.bFieldZ(KalFitTrack::Bznom_);
04268 
04269         int hit_asso(0);
04270         // Reject the ones with quality != 0 
04271         int trasqual = TrasanTRK_add.quality;
04272         if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl; 
04273         if (trasqual) return;
04274         // Mdc Hits 
04275         int inlyr(999), outlyr(-1);
04276         int* rStat = new int[43];
04277         for(int irStat=0;irStat<43;++irStat)rStat[irStat]=0;
04278         std::vector<MdcRec_wirhit*> pt=TrasanTRK.hitcol;
04279         int hit_in(0);
04280         if(debug_ == 4)    cout<<"*********Pt size****"<< pt.size()<<endl;
04281         // Number of hits/layer 
04282         int Num[43] = {0};
04283         for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
04284                         ii != pt.begin()-1; ii--) {
04285                 Num[(*ii)->geo->Lyr()->Id()]++;
04286         }
04287 
04288         for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
04289                         ii != pt.begin()-1; ii--) { 
04290 
04291                 hit_asso++;
04292                 if (Num[(*ii)->geo->Lyr()->Id()]>3) {
04293                         if (debug_ >0)
04294                                 cout << "WARNING:  I found " << Num[(*ii)->geo->Lyr()->Id()] 
04295                                         << " hits in the layer "
04296                                         << (*ii)->geo->Lyr()->Id() << std::endl;
04297                         continue;
04298                 }
04299 
04300                 hit_in++;
04301                 MdcRec_wirhit & rechit = **ii;
04302                 double dist[2] = {rechit.ddl, rechit.ddr};
04303                 double erdist[2] = {rechit.erddl, rechit.erddr};
04304                 const MdcGeoWire* geo = rechit.geo;
04305 
04306                 int lr_decision(0);
04307                 if (KalFitTrack::LR_ == 1){
04308                         if (rechit.lr==2 || rechit.lr==0) lr_decision=-1;
04309                         //      if (rechit.lr==0) lr_decision=-1;
04310                         else if (rechit.lr==1) lr_decision=1;
04311                 } 
04312 
04313                 int ind(geo->Lyr()->Id());
04314                 track_lead.appendHitsMdc( KalFitHitMdc(rechit.id,
04315                                         lr_decision, rechit.tdc,
04316                                         dist, erdist, 
04317                                         _wire+(geo->Id()), rechit.rechitptr));
04318                 // inner/outer layer :
04319                 rStat[ind]++;
04320                 if (inlyr>ind) inlyr = ind;
04321                 if (outlyr<ind) outlyr = ind;
04322         }
04323         // Empty layers :
04324         int empty_between(0), empty(0);
04325         for (int i= inlyr; i <= outlyr; i++)
04326                 if (!rStat[i]) empty_between++;
04327         empty = empty_between+inlyr+(42-outlyr);
04328         delete [] rStat;
04329 
04330         if (debug_ == 4) 
04331                 cout << "**** NUMBER OF Mdc HITS (TRASAN) = " << hit_asso << std::endl;
04332 
04333 
04334         // RMK high momentum track under study, probably not neeeded...
04335         track_lead.order_wirhit(0);
04336         track_lead.type(type);
04337         unsigned int nhit = track_lead.HitsMdc().size();
04338         if (nhit<70) {
04339                 cout << " ATTENTION TRACK WITH ONLY HITS " << nhit << std::endl;
04340                 return;
04341         }
04342 
04343         // Initialisation :
04344         double  KalFitst(0), KalFitax(0), KalFitschi2(0);
04345         // Move to the outer most hit :      
04346         Hep3Vector outer_pivot(track_lead.x(fiTerm));
04347 
04348         if(debug_ == 4) {
04349                 std::cout<<"before track_lead.pivot(outer_pivot) ,the error matrix of track_lead is .."<<track_lead.Ea()<<std::endl;
04350         }
04351         track_lead.pivot(outer_pivot); // hi gay, the error matrix is changed in this function!! 
04352         track_lead.bFieldZ(KalFitTrack::Bznom_);
04353         // attention best_chi2 reinitialize !!! 
04354         if (nhit>=3 && !KalFitTrack::LR_) 
04355                 start_seed(track_lead, lead_, way, TrasanTRK);
04356         HepSymMatrix Eakal(5,0);
04357 
04358         //init_matrix(TrasanTRK, Eakal);
04359 
04360         double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
04361         if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
04362                 choice_ = 6;
04363         }
04364 
04365         init_matrix(choice_,TrasanTRK, Eakal);
04366 
04367         //std::cout<<" Eakal be here: "<<Eakal<<std::endl;
04368 
04369         if (debug_ == 4){
04370                 std::cout << "from Mdc Pattern Recognition: " << std::endl;
04371                 //HepPoint3D IP(0,0,0);
04372                 Helix work(track_lead.pivot(), 
04373                                 track_lead.a(),
04374                                 track_lead.Ea());
04375                 work.pivot(IP);
04376                 std::cout << " dr = " << work.a()[0] 
04377                         << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
04378                 std::cout << " phi0 = " << work.a()[1] 
04379                         << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
04380                 std::cout << " PT = " << 1/work.a()[2] 
04381                         << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
04382                 std::cout << " dz = " << work.a()[3] 
04383                         << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
04384                 std::cout << " tanl = " << work.a()[4] 
04385                         << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
04386         }
04387         filter_fwd_calib(track_lead, lead_, way, Eakal);
04388         track_lead.update_forMdc();
04389 
04390         //HepPoint3D IP(0,0,0);    
04391         if (debug_ == 4) {
04392                 cout << " Mdc FIRST KALMAN FIT " << std::endl;
04393                 Helix work1(track_lead.pivot(), 
04394                                 track_lead.a(),
04395                                 track_lead.Ea());
04396                 work1.pivot(IP);
04397                 cout << " dr = " << work1.a()[0] 
04398                         << ", Er_dr = " << sqrt(work1.Ea()[0][0]) << std::endl;
04399                 cout << " phi0 = " << work1.a()[1] 
04400                         << ", Er_phi0 = " << sqrt(work1.Ea()[1][1]) << std::endl;
04401                 cout << " PT = " << 1/work1.a()[2] 
04402                         << ", Er_kappa = " << sqrt(work1.Ea()[2][2]) << std::endl;
04403                 cout << " dz = " << work1.a()[3] 
04404                         << ", Er_dz = " << sqrt(work1.Ea()[3][3]) << std::endl;
04405                 cout << " tanl = " << work1.a()[4] 
04406                         << ", Er_tanl = " << sqrt(work1.Ea()[4][4]) << std::endl;
04407         }
04408 
04409         // fill TDS
04410         RecMdcKalTrack* kaltrk = new RecMdcKalTrack;
04411 
04412         // Complete the track (other mass assumption, backward) and 
04413         complete_track(TrasanTRK, TrasanTRK_add, track_lead, kaltrk,kalcol,segcol);
04414 
04415 
04416         StatusCode kalsc;
04417         //check whether the RecMdcKalTrackCol has been already registered
04418         DataObject *aRecKalEvent;
04419         eventSvc()->findObject("/Event/Recon/RecMdcKalTrackCol", aRecKalEvent);
04420         if(aRecKalEvent!=NULL) {
04421                 //then unregister RecMdcKalCol
04422                 kalsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
04423                 if(kalsc != StatusCode::SUCCESS) {
04424                         log << MSG::FATAL << "Could not unregister RecMdcKalTrack collection" << endreq;
04425                         return;
04426                 }
04427         }
04428 
04429         kalsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
04430         if( kalsc.isFailure()) {
04431                 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
04432                 return; 
04433         }
04434         log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
04435 
04436 
04437 
04438         StatusCode segsc;
04439         //check whether the RecMdcKalHelixSegCol has been already registered
04440         DataObject *aRecKalSegEvent;
04441         eventSvc()->findObject("/Event/Recon/RecMdcKalHelixSegCol", aRecKalSegEvent);
04442         if(aRecKalSegEvent!=NULL) {
04443                 //then unregister RecMdcKalHelixSegCol
04444                 segsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
04445                 if(segsc != StatusCode::SUCCESS) {
04446                         log << MSG::FATAL << "Could not unregister RecMdcKalHelixSegCol collection" << endreq;
04447                         return;
04448                 }
04449         }
04450 
04451         segsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalHelixSegCol", segcol);
04452         if( segsc.isFailure() ) {
04453                 log << MSG::FATAL << "Could not register RecMdcKalHelixSeg" << endreq;
04454                 return; 
04455         }
04456         log << MSG::INFO << "RecMdcKalHelixSegCol registered successfully!" <<endreq;
04457 
04458 
04459         double x1(0.),x2(0.),y1(0.),y2(0.),z1(0.),z2(0.),the1(0.),the2(0.),phi1(0.),phi2(0.),p1(0.),p2(0.);
04460         double r1(0.),r2(0.),kap1(999.),kap2(999.),tanl1(0.),tanl2(0.); 
04461         //check the result:RecMdcKalTrackCol   
04462 
04463         SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
04464         if (!kaltrkCol) { 
04465                 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
04466                 return;
04467         }
04468         log << MSG::INFO << "Begin to check RecMdcKalTrackCol"<<endreq; 
04469         RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
04470         for( int jj=1; iter_trk != kaltrkCol->end(); iter_trk++,jj++) {
04471                 log << MSG::DEBUG << "retrieved MDC Kalmantrack:"
04472                         << "Track Id: " << (*iter_trk)->getTrackId()
04473                         << " Mass of the fit: "<< (*iter_trk)->getMass(2)<< endreq
04474                         << " Length of the track: "<< (*iter_trk)->getLength(2)
04475                         << "  Tof of the track: "<< (*iter_trk)->getTof(2) << endreq
04476                         << " Chisq of the fit: "<< (*iter_trk)->getChisq(0,2)
04477                         <<"  "<< (*iter_trk)->getChisq(1,2) << endreq
04478                         << "Ndf of the fit: "<< (*iter_trk)->getNdf(0,1)
04479                         <<"  "<< (*iter_trk)->getNdf(1,2) << endreq
04480                         << "Kappa " << (*iter_trk)->getZHelix()[2]
04481                         << "zhelixmu "<<(*iter_trk)->getZHelixMu()
04482                         << endreq;
04483 
04484                 HelixSegRefVec gothelixsegs = (*iter_trk)->getVecHelixSegs();
04485                 if(debug_ == 4) { 
04486                         std::cout<<"the size of gothelixsegs ..."<<gothelixsegs.size()<<std::endl;      
04487                 }
04488 
04489                 HelixSegRefVec::iterator it_gothelixseg = gothelixsegs.begin();
04490                 for( ; it_gothelixseg != gothelixsegs.end(); it_gothelixseg++) {
04491                         if(debug_ == 4) { 
04492                                 std::cout<<"the layerId of this helixseg is ..."<<(*it_gothelixseg)->getLayerId()<<std::endl;
04493                                 std::cout<<"the residual of this helixseg exclude the meas hit"<<(*it_gothelixseg)->getResExcl()<<std::endl;
04494                                 std::cout<<"the residual of this helixseg include the meas hit"<<(*it_gothelixseg)->getResIncl()<<std::endl;
04495                                 std::cout<<"the track id of the helixseg is ..."<<(*it_gothelixseg)->getTrackId() <<std::endl;
04496                                 std::cout<<"the tof of the helixseg is ..."<<(*it_gothelixseg)->getTof()<<std::endl;
04497                                 std::cout<<"the Zhit of the helixseg is ..."<<(*it_gothelixseg)->getZhit()<<std::endl;
04498                         }
04499                 }
04500                 for( int i = 0; i<43; i++) {
04501                         log << MSG::DEBUG << "retrieved pathl["<<i<<"]= "
04502                                 << (*iter_trk)->getPathl(i) <<endreq;
04503                 }
04504 
04505                 if(ntuple_&1) {
04506                         m_trackid = (*iter_trk)->getTrackId();
04507                         for( int jj =0, iii=0; jj<5; jj++) {
04508                                 m_length[jj] = (*iter_trk)->getLength(jj);
04509                                 m_tof[jj] = (*iter_trk)->getTof(jj);
04510                                 m_nhits[jj] = (*iter_trk)->getNhits(jj);
04511                                 m_zhelix[jj] = (*iter_trk)->getZHelix()[jj];
04512                                 m_zhelixe[jj] = (*iter_trk)->getZHelixE()[jj];
04513                                 m_zhelixmu[jj] = (*iter_trk)->getZHelixMu()[jj];
04514                                 m_zhelixk[jj] = (*iter_trk)->getZHelixK()[jj];
04515                                 m_zhelixp[jj] = (*iter_trk)->getZHelixP()[jj];
04516                                 m_fhelix[jj] = (*iter_trk)->getFHelix()[jj];
04517                                 m_fhelixe[jj] = (*iter_trk)->getFHelixE()[jj];
04518                                 m_fhelixmu[jj] = (*iter_trk)->getFHelixMu()[jj];
04519                                 m_fhelixk[jj] = (*iter_trk)->getFHelixK()[jj];
04520                                 m_fhelixp[jj] = (*iter_trk)->getFHelixP()[jj];
04521                                 m_lhelix[jj] = (*iter_trk)->getLHelix()[jj];
04522                                 m_lhelixe[jj] = (*iter_trk)->getLHelixE()[jj];
04523                                 m_lhelixmu[jj] = (*iter_trk)->getLHelixMu()[jj];
04524                                 m_lhelixk[jj] = (*iter_trk)->getLHelixK()[jj];
04525                                 m_lhelixp[jj] = (*iter_trk)->getLHelixP()[jj];
04526                                 if(ntuple_&32) {
04527                                         for(int kk=0; kk<=jj; kk++,iii++) {
04528                                                 m_zerror[iii] = (*iter_trk)->getZError()[jj][kk];
04529                                                 m_zerrore[iii] = (*iter_trk)->getZErrorE()[jj][kk];
04530                                                 m_zerrormu[iii] = (*iter_trk)->getZErrorMu()[jj][kk];
04531                                                 m_zerrork[iii] = (*iter_trk)->getZErrorK()[jj][kk];
04532                                                 m_zerrorp[iii] = (*iter_trk)->getZErrorP()[jj][kk];
04533                                                 m_ferror[iii] = (*iter_trk)->getFError()[jj][kk];
04534                                                 m_ferrore[iii] = (*iter_trk)->getFErrorE()[jj][kk];
04535                                                 m_ferrormu[iii] = (*iter_trk)->getFErrorMu()[jj][kk];
04536                                                 m_ferrork[iii] = (*iter_trk)->getFErrorK()[jj][kk];
04537                                                 m_ferrorp[iii] = (*iter_trk)->getFErrorP()[jj][kk];
04538                                                 m_lerror[iii] = (*iter_trk)->getLError()[jj][kk];
04539                                                 m_lerrore[iii] = (*iter_trk)->getLErrorE()[jj][kk];
04540                                                 m_lerrormu[iii] = (*iter_trk)->getLErrorMu()[jj][kk];
04541                                                 m_lerrork[iii] = (*iter_trk)->getLErrorK()[jj][kk];
04542                                                 m_lerrorp[iii] = (*iter_trk)->getLErrorP()[jj][kk];
04543                                         }
04544 
04545                                 }
04546                         }
04547 
04548                         // RootConversion changed in BOSS6.0, so use thefollowing:
04549                         m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
04550                         m_chisq[1][0] = (*iter_trk)->getChisq(0,1);
04551                         m_chisq[2][0] = (*iter_trk)->getChisq(0,2);
04552                         m_chisq[3][0] = (*iter_trk)->getChisq(0,3);
04553                         m_chisq[4][0] = (*iter_trk)->getChisq(0,4);
04554                         m_chisq[0][1] = (*iter_trk)->getChisq(1,0);
04555                         m_chisq[1][1] = (*iter_trk)->getChisq(1,1);
04556                         m_chisq[2][1] = (*iter_trk)->getChisq(1,2);
04557                         m_chisq[3][1] = (*iter_trk)->getChisq(1,3);
04558                         m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
04559 
04560                         m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
04561                         m_ndf[1][0] = (*iter_trk)->getNdf(0,1);
04562                         m_ndf[2][0] = (*iter_trk)->getNdf(0,2);
04563                         m_ndf[3][0] = (*iter_trk)->getNdf(0,3);
04564                         m_ndf[4][0] = (*iter_trk)->getNdf(0,4);
04565                         m_ndf[0][1] = (*iter_trk)->getNdf(1,0);
04566                         m_ndf[1][1] = (*iter_trk)->getNdf(1,1);
04567                         m_ndf[2][1] = (*iter_trk)->getNdf(1,2);
04568                         m_ndf[3][1] = (*iter_trk)->getNdf(1,3);
04569                         m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
04570 
04571                         m_stat[0][0] = (*iter_trk)->getStat(0,0);
04572                         m_stat[1][0] = (*iter_trk)->getStat(0,1);
04573                         m_stat[2][0] = (*iter_trk)->getStat(0,2);
04574                         m_stat[3][0] = (*iter_trk)->getStat(0,3);
04575                         m_stat[4][0] = (*iter_trk)->getStat(0,4);
04576                         m_stat[0][1] = (*iter_trk)->getStat(1,0);
04577                         m_stat[1][1] = (*iter_trk)->getStat(1,1);
04578                         m_stat[2][1] = (*iter_trk)->getStat(1,2);
04579                         m_stat[3][1] = (*iter_trk)->getStat(1,3);
04580                         m_stat[4][1] = (*iter_trk)->getStat(1,4);
04581 
04582                         m_fptot = sqrt(1+pow(m_fhelix[4],2))/m_fhelix[2];
04583                         m_fptote = sqrt(1+pow(m_fhelixe[4],2))/m_fhelixe[2];
04584                         m_fptotmu = sqrt(1+pow(m_fhelixmu[4],2))/m_fhelixmu[2];
04585                         m_fptotk = sqrt(1+pow(m_fhelixk[4],2))/m_fhelixk[2];
04586                         m_fptotp = sqrt(1+pow(m_fhelixp[4],2))/m_fhelixp[2];
04587 
04588                         m_zpt = 1/m_zhelix[2];
04589                         m_zpte = 1/m_zhelixe[2];
04590                         m_zptmu = 1/m_zhelixmu[2];
04591                         m_zptk = 1/m_zhelixk[2];
04592                         m_zptp = 1/m_zhelixp[2];
04593 
04594                         m_fpt = 1/m_fhelix[2];
04595                         m_fpte = 1/m_fhelixe[2];
04596                         m_fptmu = 1/m_fhelixmu[2];
04597                         m_fptk = 1/m_fhelixk[2];
04598                         m_fptp = 1/m_fhelixp[2];
04599 
04600                         m_lpt = 1/m_lhelix[2];
04601                         m_lpte = 1/m_lhelixe[2];
04602                         m_lptmu = 1/m_lhelixmu[2];
04603                         m_lptk = 1/m_lhelixk[2];
04604                         m_lptp = 1/m_lhelixp[2];
04605 
04606                         m_lptot = sqrt(1+pow(m_lhelix[4],2))/m_lhelix[2];
04607                         m_lptote = sqrt(1+pow(m_lhelixe[4],2))/m_lhelixe[2];
04608                         m_lptotmu = sqrt(1+pow(m_lhelixmu[4],2))/m_lhelixmu[2];
04609                         m_lptotk = sqrt(1+pow(m_lhelixk[4],2))/m_lhelixk[2];
04610                         m_lptotp = sqrt(1+pow(m_lhelixp[4],2))/m_lhelixp[2];
04611 
04612                         m_zptot = sqrt(1+pow(m_zhelix[4],2))/m_zhelix[2];
04613                         m_zptote = sqrt(1+pow(m_zhelixe[4],2))/m_zhelixe[2];
04614                         m_zptotmu = sqrt(1+pow(m_zhelixmu[4],2))/m_zhelixmu[2];
04615                         m_zptotk = sqrt(1+pow(m_zhelixk[4],2))/m_zhelixk[2];
04616                         m_zptotp = sqrt(1+pow(m_zhelixp[4],2))/m_zhelixp[2];
04617                         if(ntuple_&32) {
04618                                 m_zsigp = sqrt(pow((m_zptot/m_zhelix[2]),2)*m_zerror[5]+
04619                                                 pow((m_zhelix[4]/m_zptot),2)*pow((1/m_zhelix[2]),4)*m_zerror[14]-
04620                                                 2*m_zhelix[4]*m_zerror[12]*pow((1/m_zhelix[2]),3));
04621                                 m_zsigpe = sqrt(pow((m_zptote/m_zhelixe[2]),2)*m_zerrore[5]+
04622                                                 pow((m_zhelixe[4]/m_zptote),2)*pow((1/m_zhelixe[2]),4)*m_zerrore[14]-
04623                                                 2*m_zhelixe[4]*m_zerrore[12]*pow((1/m_zhelixe[2]),3));
04624                                 m_zsigpmu = sqrt(pow((m_zptotmu/m_zhelixmu[2]),2)*m_zerrormu[5]+
04625                                                 pow((m_zhelixmu[4]/m_zptotmu),2)*pow((1/m_zhelixmu[2]),4)*m_zerrormu[14]-
04626                                                 2*m_zhelixmu[4]*m_zerrormu[12]*pow((1/m_zhelixmu[2]),3));
04627                                 m_zsigpk = sqrt(pow((m_zptotk/m_zhelixk[2]),2)*m_zerrork[5]+
04628                                                 pow((m_zhelixk[4]/m_zptotk),2)*pow((1/m_zhelixk[2]),4)*m_zerrork[14]-
04629                                                 2*m_zhelixk[4]*m_zerrork[12]*pow((1/m_zhelixk[2]),3));
04630                                 m_zsigpp = sqrt(pow((m_zptotp/m_zhelixp[2]),2)*m_zerrorp[5]+
04631                                                 pow((m_zhelixp[4]/m_zptotp),2)*pow((1/m_zhelixp[2]),4)*m_zerrorp[14]-
04632                                                 2*m_zhelixp[4]*m_zerrorp[12]*pow((1/m_zhelixp[2]),3));
04633                         }
04634 
04635                         StatusCode sc1 = m_nt1->write();
04636                         if( sc1.isFailure() ) cout<<"Ntuple1 filling failed!"<<endl;     
04637                 }
04638 
04639                 if(ntuple_&4) {
04640                         if(jj == 1) { 
04641                                 phi1 = (*iter_trk)->getFFi0();
04642                                 r1 = (*iter_trk)->getFDr();
04643                                 z1 = (*iter_trk)->getFDz();     
04644                                 kap1 = (*iter_trk)->getFCpa();  
04645                                 tanl1 = (*iter_trk)->getFTanl();        
04646                                 x1 = r1*cos(phi1);
04647                                 y1 = r1*sin(phi1);
04648                                 p1 = sqrt(1+tanl1*tanl1)/kap1;
04649                                 the1 = M_PI/2-atan(tanl1);
04650                         } else if(jj == 2) {
04651                                 phi2 = (*iter_trk)->getFFi0();
04652                                 r2 = (*iter_trk)->getFDr();
04653                                 z2 = (*iter_trk)->getFDz();     
04654                                 kap2 = (*iter_trk)->getFCpa();  
04655                                 tanl2 = (*iter_trk)->getFTanl();        
04656                                 x2 = r1*cos(phi2);
04657                                 y2 = r1*sin(phi2);
04658                                 p2 = sqrt(1+tanl2*tanl2)/kap1;
04659                                 the2 = M_PI/2-atan(tanl2);
04660                         }
04661                 }
04662         }
04663         if(ntuple_&4) {
04664                 m_delx = x1 - x2;
04665                 m_dely = y1 - y2;
04666                 m_delz = z1 - z2;
04667                 m_delthe = the1 + the2;
04668                 m_delphi = phi1- phi2;
04669                 m_delp = p1 - p2;
04670                 StatusCode sc2 = m_nt2->write();
04671                 if( sc2.isFailure() ) cout<<"Ntuple2 filling failed!"<<endl;      
04672         } 
04673 
04674         if (debug_ == 4)
04675                 cout << "Kalfitting finished " << std::endl;
04676 }

bool KalFitAlg::order_rechits const SmartRef< RecMdcHit > &  m1,
const SmartRef< RecMdcHit > &  m2
[static, private]
 

bool KalFitAlg::order_rechits const SmartRef< RecMdcHit > &  m1,
const SmartRef< RecMdcHit > &  m2
[static, private]
 

05864                                                                                              {
05865         return  MdcID::layer(m1->getMdcId()) > MdcID::layer(m2->getMdcId());
05866 }

void KalFitAlg::sameas RecMdcKalTrack trk,
int  l_mass,
int  imain
 

complete the RecMdcKalTrackCol

void KalFitAlg::sameas RecMdcKalTrack trk,
int  l_mass,
int  imain
 

complete the RecMdcKalTrackCol

02184 {
02185         // note: for this function,only imain==lead(2) considered
02186         //std::cout<<"BEGINNING THE sameas() function ..."<<std::endl;
02187         trk->setMass(trk->getMass(imain), l_mass);
02188         trk->setLength(trk->getLength(imain), l_mass);
02189         trk->setTof(trk->getTof(imain), l_mass);
02190         trk->setNhits(trk->getNhits(imain), l_mass);
02191 
02192         for(int jj = 0; jj<2; jj++) {
02193                 trk->setStat(trk->getStat(jj,imain), jj, l_mass);
02194                 trk->setChisq(trk->getChisq(jj, l_mass), jj, l_mass);
02195                 trk->setNdf(trk->getChisq(jj, l_mass), jj, l_mass);
02196         }
02197         trk->setLHelix(trk->getFHelix(),l_mass);
02198         trk->setLError(trk->getFError(),l_mass);
02199 }

void KalFitAlg::set_Mdc void   ) 
 

Set up the wires, layers and superlayers...

void KalFitAlg::set_Mdc void   ) 
 

Set up the wires, layers and superlayers...

00115 {
00116    MdcGeomSvc * mdcGeomSvc = dynamic_cast<MdcGeomSvc* >(imdcGeomSvc_);
00117   if(! mdcGeomSvc) {
00118        std::cout<<"ERROR OCCUR when dynamic_cast in KalFitAlg2.cxx ..!!"<<std::endl;
00119    }
00120 
00121   if(debug_ == 4)  {
00122      cout << "KalFitAlg:: MDC initialisation " << std::endl;
00123    }
00124   _wire = NULL;
00125   _layer = NULL; 
00126   _superLayer = NULL;
00127 
00128   const int Nwire = mdcGeomSvc->getWireSize();
00129   const int Nlyr =  mdcGeomSvc->getLayerSize();
00130   const int Nsup =  mdcGeomSvc->getSuperLayerSize();
00131 
00132   if (!Nwire || !Nlyr || !Nsup){
00133     cout << ".....MdcGeom Objects are missing !! " << std::endl;
00134     exit(-1); 
00135   }
00136       
00137   if (!_wire) 
00138     _wire = (KalFitWire *) malloc((Nwire+1) * sizeof(KalFitWire));
00139   if (!_layer) 
00140     _layer = (KalFitLayer_Mdc *) malloc(Nlyr * sizeof(KalFitLayer_Mdc));
00141   if (!_superLayer) 
00142     _superLayer = (KalFitSuper_Mdc *) malloc(Nsup * sizeof(KalFitSuper_Mdc));
00143 
00144   if (!_wire || !_layer || !_superLayer){  
00145     std::cerr << "KalFitAlg::Cannot allocate geometries" << std::endl;
00146     std::cerr << "JOB will stop" << std::endl;
00147     exit(-1);
00148   }
00149    
00150   int superLayerID = 0;
00151   int layerID = 0;
00152   int localLayerID = 0;
00153   int localWireID = 0; 
00154   int localID = 0;
00155   int wireID;
00156 
00157   MdcGeoLayer * layer_back = NULL;
00158   MdcGeoSuper * superLayer_back = NULL;
00159   int k = 0;
00160   int Nlayer[12];
00161   int Nlocal[12];
00162   int NlocalWireID[43];
00163 
00164   for (wireID = 0;wireID <= Nwire; wireID++) {
00165     MdcGeoLayer * layer = (wireID==Nwire) ? NULL : mdcGeomSvc->Wire(wireID)->Lyr();
00166     if (layer != layer_back) {
00167       layer_back = layer;
00168       MdcGeoSuper * superLayer = (wireID==Nwire) ? NULL : mdcGeomSvc->Layer(layerID)->Sup();
00169       if (superLayer != superLayer_back) {
00170         superLayer_back = superLayer;
00171         Nlayer[k] = localLayerID;
00172         Nlocal[k] = localID;
00173         localLayerID = 0;
00174         k++;
00175       }
00176       NlocalWireID[layerID] = localWireID;
00177       localID = 0;
00178       localWireID = 0;
00179       layerID++;
00180       localLayerID++;
00181     }
00182     localID++;
00183     localWireID++;
00184   }
00185 
00186   superLayerID = -1;
00187   layerID = -1;
00188   localLayerID = 0;
00189   localID = 0;
00190   layer_back = NULL;
00191   superLayer_back = NULL;
00192   for (wireID = 0;wireID < Nwire; wireID++) {
00193     MdcGeoLayer * layer = (wireID==Nwire) ? 
00194                           NULL : mdcGeomSvc->Wire(wireID)->Lyr();
00195     if (layer != layer_back){
00196       layer_back = layer;
00197       MdcGeoSuper * superLayer = (wireID==Nwire) ? 
00198                                  NULL : mdcGeomSvc->Layer(layerID+1)->Sup();
00199       if (superLayer != superLayer_back){
00200         superLayer_back = superLayer;
00201         // initialize super-layer
00202         superLayerID++;
00203         new(_superLayer+superLayerID) KalFitSuper_Mdc(wireID,
00204                                                    Nlocal[superLayerID+1],
00205                                                    layerID+1,
00206                                                    Nlayer[superLayerID+1],
00207                                                    superLayerID);
00208         localLayerID=0;
00209       }
00210       // initialize layer
00211       layerID++;
00212       double slantWithSymbol = (mdcGeomSvc->Layer(layerID)->Slant())
00213                               *(mdcGeomSvc->Layer(layerID)->Sup()->Type());
00214       new(_layer+layerID) KalFitLayer_Mdc(_superLayer[superLayerID],
00215                                   0.1*layer->Radius(), (layer->Slant())*(layer->Sup()->Type()),
00216                                   0.1*(layer->Length()/2), 
00217                                   0.1*(-layer->Length()/2), layer->Offset(),
00218                                   layerID, localLayerID++ );
00219       localID = 0;
00220     }
00221     // initialize wire
00222 
00223     const MdcGeoWire * wire = (wireID==Nwire) ? NULL : mdcGeomSvc->Wire(wireID); 
00224     HepPoint3D fwd(0.1*wire->Backward());
00225     HepPoint3D bck(0.1*wire->Forward());
00226 
00227     if (superLayerID == 2 || superLayerID == 3  ||
00228         superLayerID == 4 || superLayerID == 9 ||
00229         superLayerID == 10) {     // axial wire
00230       new(_wire+wireID) KalFitWire(localID++,_layer[layerID],
00231                                    fwd,bck, _wire+Nwire,wire->Id(),0);
00232                               
00233     } else {                      // stereo wire
00234       new(_wire+wireID) KalFitWire(localID++,_layer[layerID],
00235                                    fwd,bck, _wire+Nwire,wire->Id(),1);
00236     }
00237   }
00238  
00239   // make virtual wire object for the pointer of boundary's neighbor
00240   new(_wire+Nwire) KalFitWire();
00241 
00242   if (debug_ == 4) cout << "MDC geometry reading done" << std::endl;  
00243 
00244   return;
00245 }

void KalFitAlg::setBesFromGdml void   ) 
 

void KalFitAlg::setBesFromGdml void   ) 
 

mdcgas

inner wall aluminium

air

outer beryllium pipe

cooling oil

inner beryllium pipe

gold

now construct the cylinders

innerwall of inner drift chamber

outer air, be attention the calculation of the radius and thick of the air cylinder is special

outer Beryllium layer

oil layer

inner Beryllium layer

gold layer

00012                                   {
00013 
00014   int i(0);
00015   double Z(0.),A(0.),Ionization(0.),Density(0.),Radlen(0.);
00016   
00017   G4LogicalVolume *logicalMdc = 0;
00018   MdcG4Geo* aMdcG4Geo = new MdcG4Geo();
00019   logicalMdc = aMdcG4Geo->GetTopVolume();   
00020 
00022   G4Material* mdcMaterial = logicalMdc->GetMaterial();  
00023 
00024   for(i=0; i<mdcMaterial->GetElementVector()->size(); i++){
00025     Z += (mdcMaterial->GetElement(i)->GetZ())*
00026          (mdcMaterial->GetFractionVector()[i]);
00027     A += (mdcMaterial->GetElement(i)->GetA())*
00028          (mdcMaterial->GetFractionVector()[i]);
00029   }
00030   Ionization = mdcMaterial->GetIonisation()->GetMeanExcitationEnergy();
00031   Density = mdcMaterial->GetDensity()/(g/cm3);
00032   Radlen = mdcMaterial->GetRadlen();
00033   std::cout<<"mdcgas: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
00034   KalFitMaterial FitMdcMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.); 
00035   _BesKalmanFitMaterials.push_back(FitMdcMaterial);
00036   KalFitTrack::mdcGasRadlen_ = Radlen/10.;
00037   
00039   G4LogicalVolume* innerwallVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalMdcSegment2"));
00040   G4Material* innerwallMaterial = innerwallVolume->GetMaterial();
00041   G4Tubs* innerwallTub = dynamic_cast<G4Tubs*>(innerwallVolume->GetSolid());
00042   
00043   Z = 0.;
00044   A = 0.;
00045   for(i=0; i<innerwallMaterial->GetElementVector()->size(); i++){    
00046     Z += (innerwallMaterial->GetElement(i)->GetZ())*
00047          (innerwallMaterial->GetFractionVector()[i]); 
00048     A += (innerwallMaterial->GetElement(i)->GetA())*    
00049          (innerwallMaterial->GetFractionVector()[i]);
00050   }
00051 
00052   Ionization = innerwallMaterial->GetIonisation()->GetMeanExcitationEnergy();
00053   Density = innerwallMaterial->GetDensity()/(g/cm3);
00054   Radlen = innerwallMaterial->GetRadlen();
00055   std::cout<<"Mdc innerwall, Al: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
00056   KalFitMaterial FitInnerwallMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
00057   _BesKalmanFitMaterials.push_back(FitInnerwallMaterial);
00058   
00060   G4LogicalVolume *logicalBes = 0;
00061   BesG4Geo* aBesG4Geo = new BesG4Geo();
00062  logicalBes = aBesG4Geo->GetTopVolume();
00063  
00065   G4LogicalVolume* logicalAirVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalWorld"));
00066   G4Material* airMaterial = logicalAirVolume->GetMaterial();
00067   Z = 0.;
00068   A = 0.;
00069   for(i=0; i<airMaterial->GetElementVector()->size(); i++){
00070     Z += (airMaterial->GetElement(i)->GetZ())*
00071          (airMaterial->GetFractionVector()[i]);
00072     A += (airMaterial->GetElement(i)->GetA())*
00073          (airMaterial->GetFractionVector()[i]);
00074   }
00075   
00076   Ionization = airMaterial->GetIonisation()->GetMeanExcitationEnergy();
00077   Density = airMaterial->GetDensity()/(g/cm3);
00078   Radlen = airMaterial->GetRadlen();
00079   std::cout<<"air: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
00080   KalFitMaterial FitAirMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
00081   _BesKalmanFitMaterials.push_back(FitAirMaterial);
00082    
00084   G4LogicalVolume* logicalOuterBeVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalouterBe"));
00085   G4Material* outerBeMaterial = logicalOuterBeVolume->GetMaterial();
00086  
00087   G4Tubs* outerBeTub = dynamic_cast<G4Tubs*>(logicalOuterBeVolume->GetSolid());
00088    Z = 0.;
00089    A = 0.;
00090    for(i=0; i<outerBeMaterial->GetElementVector()->size(); i++){   
00091      Z += (outerBeMaterial->GetElement(i)->GetZ())*
00092           (outerBeMaterial->GetFractionVector()[i]);   
00093      A += (outerBeMaterial->GetElement(i)->GetA())*   
00094           (outerBeMaterial->GetFractionVector()[i]);
00095    }
00096    Ionization =  outerBeMaterial->GetIonisation()->GetMeanExcitationEnergy();
00097    Density = outerBeMaterial->GetDensity()/(g/cm3);
00098    Radlen = outerBeMaterial->GetRadlen();
00099    std::cout<<"outer beryllium: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
00100    KalFitMaterial FitOuterBeMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
00101    _BesKalmanFitMaterials.push_back(FitOuterBeMaterial);
00102    
00103 
00105   G4LogicalVolume* logicalOilLayerVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicaloilLayer"));
00106   G4Material* oilLayerMaterial = logicalOilLayerVolume->GetMaterial();
00107   G4Tubs* oilLayerTub = dynamic_cast<G4Tubs*>(logicalOilLayerVolume->GetSolid());
00108    
00109   Z = 0.;
00110   A = 0.;
00111   for(i=0; i<oilLayerMaterial->GetElementVector()->size(); i++){        
00112     Z += (oilLayerMaterial->GetElement(i)->GetZ())*
00113          (oilLayerMaterial->GetFractionVector()[i]);             
00114     A += (oilLayerMaterial->GetElement(i)->GetA())*             
00115          (oilLayerMaterial->GetFractionVector()[i]);
00116   }
00117   Ionization = oilLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
00118   Density = oilLayerMaterial->GetDensity()/(g/cm3);
00119   Radlen = oilLayerMaterial->GetRadlen();
00120   std::cout<<"cooling oil: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
00121   KalFitMaterial FitOilLayerMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
00122  _BesKalmanFitMaterials.push_back(FitOilLayerMaterial);
00123 
00124   
00126   G4LogicalVolume* logicalInnerBeVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalinnerBe"));
00127   G4Material* innerBeMaterial = logicalInnerBeVolume->GetMaterial();
00128   G4Tubs* innerBeTub = dynamic_cast<G4Tubs*>(logicalInnerBeVolume->GetSolid());
00129   Z = 0.;
00130   A = 0.;
00131   for(i=0; i<innerBeMaterial->GetElementVector()->size(); i++){
00132     Z += (innerBeMaterial->GetElement(i)->GetZ())*
00133          (innerBeMaterial->GetFractionVector()[i]);
00134     A += (innerBeMaterial->GetElement(i)->GetA())*
00135          (innerBeMaterial->GetFractionVector()[i]);
00136   }
00137  
00138   Ionization = innerBeMaterial->GetIonisation()->GetMeanExcitationEnergy();
00139   Density = innerBeMaterial->GetDensity()/(g/cm3);
00140   Radlen = innerBeMaterial->GetRadlen();
00141   std::cout<<"inner beryllium: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
00142   KalFitMaterial FitInnerBeMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
00143   _BesKalmanFitMaterials.push_back(FitInnerBeMaterial);
00144    
00145   
00147   G4LogicalVolume* logicalGoldLayerVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalgoldLayer"));
00148   G4Material* goldLayerMaterial = logicalGoldLayerVolume->GetMaterial();
00149   G4Tubs* goldLayerTub = dynamic_cast<G4Tubs*>(logicalGoldLayerVolume->GetSolid());
00150     
00151   Z = 0.;
00152   A = 0.;
00153   for(i=0; i<goldLayerMaterial->GetElementVector()->size(); i++){
00154     Z += (goldLayerMaterial->GetElement(i)->GetZ())*
00155          (goldLayerMaterial->GetFractionVector()[i]);
00156     A += (goldLayerMaterial->GetElement(i)->GetA())*
00157          (goldLayerMaterial->GetFractionVector()[i]);
00158   }
00159   Ionization = goldLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
00160   Density = goldLayerMaterial->GetDensity()/(g/cm3);
00161   Radlen = goldLayerMaterial->GetRadlen();
00162   std::cout<<"gold layer: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
00163   KalFitMaterial FitGoldLayerMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
00164   _BesKalmanFitMaterials.push_back(FitGoldLayerMaterial);
00165   
00166 
00168   double radius, thick, length , z0;
00169  
00171   radius = innerwallTub->GetInnerRadius()/(cm);
00172   thick  = innerwallTub->GetOuterRadius()/(cm) - innerwallTub->GetInnerRadius()/(cm);
00173   length = 2.0*innerwallTub->GetZHalfLength()/(cm);
00174   z0     = 0.0;
00175   std::cout<<"innerwall: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
00176   KalFitCylinder innerwallCylinder(&_BesKalmanFitMaterials[1], radius, thick, length , z0);
00177   _BesKalmanFitWalls.push_back(innerwallCylinder);
00178  
00180   radius = outerBeTub->GetOuterRadius()/(cm);
00181   thick  = innerwallTub->GetInnerRadius()/(cm) - outerBeTub->GetOuterRadius()/(cm);
00182   length = 2.0*innerwallTub->GetZHalfLength()/(cm);
00183   z0     = 0.0;
00184   std::cout<<"outer air: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
00185   KalFitCylinder outerAirCylinder(&_BesKalmanFitMaterials[2], radius, thick, length , z0);
00186   _BesKalmanFitWalls.push_back(outerAirCylinder);
00187  
00189   radius = outerBeTub->GetInnerRadius()/(cm);
00190   thick  = outerBeTub->GetOuterRadius()/(cm) - outerBeTub->GetInnerRadius()/(cm);
00191   length = 2.0*outerBeTub->GetZHalfLength()/(cm);
00192   z0     = 0.0;
00193   std::cout<<"outer Be: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl; 
00194   KalFitCylinder outerBeCylinder(&_BesKalmanFitMaterials[3], radius, thick, length , z0);
00195   _BesKalmanFitWalls.push_back(outerBeCylinder);
00196                
00198   radius = oilLayerTub->GetInnerRadius()/(cm);
00199   thick  = oilLayerTub->GetOuterRadius()/(cm) - oilLayerTub->GetInnerRadius()/(cm);
00200   length = 2.0*oilLayerTub->GetZHalfLength()/(cm);
00201   z0     = 0.0;
00202   std::cout<<"oil layer: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl; 
00203   KalFitCylinder oilLayerCylinder(&_BesKalmanFitMaterials[4], radius, thick, length , z0);
00204   _BesKalmanFitWalls.push_back(oilLayerCylinder);
00205 
00207   radius = innerBeTub->GetInnerRadius()/(cm);
00208   thick  = innerBeTub->GetOuterRadius()/(cm) - innerBeTub->GetInnerRadius()/(cm);
00209   length = 2.0*innerBeTub->GetZHalfLength()/(cm);
00210   z0     = 0.0;
00211   std::cout<<"inner Be: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl; 
00212   KalFitCylinder innerBeCylinder(&_BesKalmanFitMaterials[5], radius, thick, length , z0);
00213   _BesKalmanFitWalls.push_back(innerBeCylinder);
00214   
00216   radius = goldLayerTub->GetInnerRadius()/(cm);
00217   thick  = goldLayerTub->GetOuterRadius()/(cm) - goldLayerTub->GetInnerRadius()/(cm);
00218   length = 2.0*goldLayerTub->GetZHalfLength()/(cm);
00219   z0     = 0.0;
00220   std::cout<<"gold layer: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl; 
00221   KalFitCylinder goldLayerCylinder(&_BesKalmanFitMaterials[6], radius, thick, length , z0);
00222   _BesKalmanFitWalls.push_back(goldLayerCylinder);
00223 }

void KalFitAlg::setCalibSvc_init void   ) 
 

initialize for the services

void KalFitAlg::setCalibSvc_init void   ) 
 

initialize for the services

00248  {
00249   IMdcCalibFunSvc* imdcCalibSvc; 
00250   MsgStream log(msgSvc(), name());
00251   StatusCode sc = service ("MdcCalibFunSvc", imdcCalibSvc);
00252   m_mdcCalibFunSvc_ = dynamic_cast<MdcCalibFunSvc*>(imdcCalibSvc);
00253   if ( sc.isFailure() ){
00254     log << MSG::FATAL << "Could not load MdcCalibFunSvc!" << endreq;
00255   }
00256  KalFitTrack::setMdcCalibFunSvc( m_mdcCalibFunSvc_);
00257  }

void KalFitAlg::setCylinder_Mdc void   ) 
 

Initialize the cylinders (walls and cathodes) for Mdc.

void KalFitAlg::setCylinder_Mdc void   ) 
 

Initialize the cylinders (walls and cathodes) for Mdc.

void KalFitAlg::setDchisqCut void   ) 
 

void KalFitAlg::setDchisqCut void   ) 
 

set dchi2cutf_anal

set dchi2cuts_anal

temporary

set dchi2cutf_calib

temporary

set dchi2cuts_calib

temporary

00542 {
00543         int layid = 0;
00544 
00546         for(layid = 0; layid<2; layid++) {
00547                 KalFitTrack::dchi2cutf_anal[layid] = dchi2cut_inner_;
00548         }
00549         KalFitTrack::dchi2cutf_anal[2] = dchi2cut_layid2_;
00550         KalFitTrack::dchi2cutf_anal[3] = dchi2cut_layid3_;
00551         for(layid = 4; layid<12; layid++) {
00552                 KalFitTrack::dchi2cutf_anal[layid] = dchi2cut_mid1_;
00553         }
00554         for(layid = 12; layid<20; layid++) {
00555                 KalFitTrack::dchi2cutf_anal[layid] = dchi2cut_mid2_;
00556         }
00557         for(layid = 20; layid<43; layid++) {
00558                 KalFitTrack::dchi2cutf_anal[layid] = dchi2cut_outer_;
00559         }
00560 
00561 
00563         for(layid = 0; layid<2; layid++) {
00564                 KalFitTrack::dchi2cuts_anal[layid] = dchi2cut_inner_;
00565         }
00566 
00567         KalFitTrack::dchi2cuts_anal[2] = dchi2cut_layid2_;
00568         KalFitTrack::dchi2cuts_anal[3] = dchi2cut_layid3_;
00569         for(layid = 4; layid<12; layid++) {
00570                 KalFitTrack::dchi2cuts_anal[layid] = dchi2cut_mid1_;
00571         }
00572         for(layid = 12; layid<20; layid++) {
00573                 KalFitTrack::dchi2cuts_anal[layid] = dchi2cut_mid2_;
00574         }
00575         for(layid = 20; layid<43; layid++) {
00576                 KalFitTrack::dchi2cuts_anal[layid] = dchi2cut_outer_;
00577         }
00578 
00580         //  for(layid = 0; layid<43; layid++) {
00581         //    KalFitTrack::dchi2cuts_anal[layid] = 10.0;
00582         //  }
00583 
00584 
00586         for(layid = 0; layid<2; layid++) {
00587                 KalFitTrack::dchi2cutf_calib[layid] = dchi2cut_inner_;
00588         }
00589 
00590         KalFitTrack::dchi2cutf_calib[2] = dchi2cut_layid2_;
00591         KalFitTrack::dchi2cutf_calib[3] = dchi2cut_layid3_;
00592 
00593         for(layid = 4; layid<12; layid++) {
00594                 KalFitTrack::dchi2cutf_calib[layid] = dchi2cut_mid1_;
00595         }
00596 
00597         for(layid = 12; layid<20; layid++) {
00598                 KalFitTrack::dchi2cutf_calib[layid] = dchi2cut_mid2_;
00599         }
00600 
00601         for(layid = 20; layid<43; layid++) {
00602                 KalFitTrack::dchi2cutf_calib[layid] = dchi2cut_outer_;
00603         }
00604 
00606         if(usage_<2){
00607                 for(layid = 0; layid<43; layid++) {
00608                         KalFitTrack::dchi2cutf_calib[layid] = 10.0;
00609                 }
00610         }
00611 
00612 
00614         for(layid = 0; layid<2; layid++) {
00615                 KalFitTrack::dchi2cuts_calib[layid] = dchi2cut_inner_;
00616         }
00617 
00618         KalFitTrack::dchi2cuts_calib[2] = dchi2cut_layid2_;
00619         KalFitTrack::dchi2cuts_calib[3] = dchi2cut_layid3_;
00620 
00621         for(layid = 4; layid<12; layid++) {
00622                 KalFitTrack::dchi2cuts_calib[layid] = dchi2cut_mid1_;
00623         }       
00624 
00625         for(layid = 12; layid<20; layid++) {
00626                 KalFitTrack::dchi2cuts_calib[layid] = dchi2cut_mid2_;
00627         }
00628 
00629         for(layid = 20; layid<43; layid++) {
00630                 KalFitTrack::dchi2cuts_calib[layid] = dchi2cut_outer_;
00631         } 
00632 
00634         if(usage_<2){
00635                 for(layid = 0; layid<43; layid++) {
00636                         KalFitTrack::dchi2cuts_calib[layid] = 10.0;
00637                 }
00638         }
00639 }

void KalFitAlg::setGeomSvc_init void   ) 
 

void KalFitAlg::setGeomSvc_init void   ) 
 

00260  {
00261   IMdcGeomSvc*  imdcGeomSvc;
00262   MsgStream log(msgSvc(), name());
00263   StatusCode sc = service ("MdcGeomSvc", imdcGeomSvc);
00264 //  m_mdcGeomSvc_ = dynamic_cast<MdcGeomSvc*>(imdcGeomSvc);
00265   if ( sc.isFailure() ){
00266     log << MSG::FATAL << "Could not load MdcGeomSvc!" << endreq;
00267   }
00268  imdcGeomSvc_ = imdcGeomSvc;
00269 
00270  KalFitTrack::setIMdcGeomSvc( imdcGeomSvc);
00271  }

void KalFitAlg::setMagneticFieldSvc_init void   ) 
 

void KalFitAlg::setMagneticFieldSvc_init void   ) 
 

void KalFitAlg::setMaterial_Mdc void   ) 
 

Initialize the material for Mdc.

void KalFitAlg::setMaterial_Mdc void   ) 
 

Initialize the material for Mdc.

void KalFitAlg::smoother_anal KalFitTrack trk,
int  way
 

Kalman filter (smoothing or backward part).

void KalFitAlg::smoother_anal KalFitTrack track,
int  way
 

Kalman filter (smoothing or backward part).

be attention to this inital error matrix of smoother, how is track.Ea() in the next sentence when use it?

oh, to be the last hit

calculate the lsat point in MDC

calculate fiTerm

for protection purpose

02203 {
02204         // retrieve Mdc  geometry information
02205         IMdcGeomSvc* igeomsvc;
02206         StatusCode sc = Gaudi::svcLocator()->service("MdcGeomSvc", igeomsvc);
02207         if(sc==StatusCode::FAILURE) cout << "GeoSvc failing!!!!!!!SC=" << sc << endl;
02208         MdcGeomSvc* geomsvc = dynamic_cast<MdcGeomSvc*>(igeomsvc);
02209         if(!geomsvc){
02210                 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitTrack.cxx !!"<<std::endl;
02211         }
02212 
02213         HepPoint3D ip(0,0,0);
02214         if(m_usevtxdb==1){
02215                 Hep3Vector xorigin(0,0,0);
02216                 IVertexDbSvc*  vtxsvc;
02217                 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
02218                 if(vtxsvc->isVertexValid()){
02219                         double* dbv = vtxsvc->PrimaryVertex(); 
02220                         double*  vv = vtxsvc->SigmaPrimaryVertex();  
02221                         xorigin.setX(dbv[0]);
02222                         xorigin.setY(dbv[1]);
02223                         xorigin.setZ(dbv[2]);
02224                 }
02225                 ip[0] = xorigin[0];
02226                 ip[1] = xorigin[1];
02227                 ip[2] = xorigin[2];
02228         }
02229 
02230         // Estimation of the path length from ip to 1st cylinder
02231 
02232         Helix work = *(Helix*)&track;
02233         work.ignoreErrorMatrix();
02234         work.pivot(ip);
02235 
02236 
02237         double tanl = track.tanl();
02238         double phi_old = work.phi0();
02239         double phi = track.phi0();
02240 
02241         if (fabs(phi - phi_old) > M_PI) {
02242                 if (phi > phi_old) phi -= 2 * M_PI;
02243                 else phi_old -= 2 * M_PI;
02244         }
02245 
02246         double path_zero = fabs(track.radius() * (phi_old-phi)* sqrt(1 + tanl * tanl));
02247         // track.addPathSM(path_zero);
02248 
02249 
02250         HepSymMatrix Eakal(5,0);
02251         track.pivot(ip);
02254         Eakal = track.Ea()*matrixg_;
02255         track.Ea(Eakal);
02256 
02257         // Mdc part :
02258         unsigned int nhit = track.HitsMdc().size();
02259         int layer_prev = -1;
02260 
02261         HepVector pos_old(3,0);
02262         double r0kal_prec(0);
02263         int  nhits_read(0);
02264         for( unsigned i=0 ; i < nhit; i++ ) {
02265                 int ihit = (nhit-1)-i;
02266                 KalFitHitMdc& HitMdc = track.HitMdc(ihit);
02267                 const KalFitWire& Wire = HitMdc.wire();
02268 
02269                 int wireid = Wire.geoID();
02270                 nhits_read++;
02271 
02272                 int layer = Wire.layer().layerId();
02273                 if (pathl_ && layer != layer_prev) {
02274 
02275                         if (debug_ == 4) cout<<"in smoother,layerid "<<layer<<"  layer_prev  "
02276                                 <<layer_prev <<"  pathl_   "<<pathl_<<endl;
02277 
02278                         // track.PathL(Wire.layer().layerId());
02279                         layer_prev = layer;
02280                 }
02281 
02282                 HepPoint3D fwd(Wire.fwd());
02283                 HepPoint3D bck(Wire.bck());
02284                 Hep3Vector wire = (CLHEP::Hep3Vector)fwd - (CLHEP::Hep3Vector)bck;
02285                 Helix work = *(Helix*)&track;
02286                 work.ignoreErrorMatrix();
02287                 work.pivot((fwd + bck) * .5);
02288                 HepPoint3D x0kal = (work.x(0).z() - bck.z()) / wire.z() * wire + bck;
02289 
02290                 if(4 == debug_) std::cout<<" x0kal before sag: "<<x0kal<<std::endl;
02291                 if (wsag_ == 4){
02292                         Hep3Vector result;
02293                         const MdcGeoWire* geowire = geomsvc->Wire(wireid); 
02294                         double tension = geowire->Tension();
02295 
02296                         //std::cout<<" tension: "<<tension<<std::endl;
02297                         double zinit(x0kal.z()), lzx(Wire.lzx());
02298 
02299                         // double A(Wire.Acoef());
02300                         double A = 47.35E-6/tension;
02301                         double Zp = (zinit - bck.z())*lzx/wire.z();
02302 
02303                         if(4 == debug_){
02304                                 std::cout<<" sag in smoother_anal: "<<std::endl;    
02305                                 std::cout<<" x0kal.x(): "<<std::setprecision(10)<<x0kal.x()<<std::endl;
02306                                 std::cout<<" wire.x()*(zinit-bck.z())/wire.z(): "<<std::setprecision(10)
02307                                                                                    <<(wire.x()*(zinit-bck.z())/wire.z())<<std::endl;
02308                                 std::cout<<"bck.x(): "<<std::setprecision(10)<<bck.x()<<std::endl;
02309                                 std::cout<<" wire.x()*(zinit-bck.z())/wire.z() + bck.x(): "<<std::setprecision(10)
02310                                                                                              <<(wire.x()*(zinit-bck.z())/wire.z() + bck.x())<<std::endl;
02311                         }
02312 
02313                         result.setX(wire.x()*(zinit-bck.z())/wire.z() + bck.x());
02314                         result.setY((A*(Zp-lzx)+wire.y()/lzx)*Zp+bck.y());
02315                         result.setZ((A*(2*Zp-lzx)*lzx+wire.y())/wire.z());
02316 
02317                         wire.setX(wire.x()/wire.z());
02318                         wire.setY(result.z());
02319                         wire.setZ(1);
02320 
02321                         x0kal.setX(result.x());
02322                         x0kal.setY(result.y());
02323                 }
02324 
02325                 if(4 == debug_) std::cout<<" x0kal after sag: "<<x0kal<<std::endl;
02326 
02327                 // If x0kal is after the inner wall and x0kal_prec before :
02328                 double r0kal = x0kal.perp();
02329                 if (debug_ == 4) {
02330                         cout<<"wire direction "<<wire<<endl;
02331                         cout<<"x0kal "<<x0kal<<endl;
02332                         cout<<"smoother::r0kal "<<r0kal<<"  r0kal_prec  "<<r0kal_prec <<endl;
02333                 }
02334 
02335                 // change PIVOT :
02336                 double pathl(0);
02337                 track.pivot_numf(x0kal, pathl);
02338                 track.addPathSM(pathl);
02339 
02340                 // calculate the tof time in this layer
02341                 double pmag( sqrt( 1.0 + track.a()[4]*track.a()[4]) / track.a()[2]);
02342                 double mass_over_p( track.mass()/ pmag );
02343                 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
02344                 double tofest = pathl / ( 29.9792458 * beta );
02345                 track.addTofSM(tofest);
02346 
02347                 // std::cout<<" in layer: "<<layer<<" pathl: "<<pathl<<" tof: "<<tofest<<std::endl;
02348 
02349                 if(KalFitElement::muls()) track.msgasmdc(pathl, way);
02350                 if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
02351 
02352                 // Add info hit wire :
02353                 if(track.kappa()) {
02354                         HepVector Va(5,0);
02355                         HepSymMatrix Ma(5,0);
02356                         KalFitHelixSeg  HelixSeg(&HitMdc,x0kal,Va,Ma);   
02357 
02358                         Hep3Vector meas = track.momentum(0).cross(wire).unit();
02359                         double dchi2=-1; 
02360                         track.smoother_Mdc(HitMdc, meas, HelixSeg, dchi2, m_csmflag);
02361                         if(dchi2>0.0) {
02362                                 track.HelixSegs().push_back(HelixSeg);
02363                         }
02364                 }
02365 
02367 
02368                 if(i == nhit-1){
02369 
02371                         HepPoint3D point;
02372                         point.setX(x0kal.x() + track.a()[0]*cos(track.a()[1]));
02373                         point.setY(x0kal.y() + track.a()[0]*sin(track.a()[1]));
02374                         point.setZ(x0kal.z() + track.a()[3]);
02375                         track.point_last(point);
02376 
02378                         double phi_old = track.a()[1];
02379                         KalFitTrack temp(x0kal, track.a(), track.Ea(), 0, 0, 0);
02380                         temp.pivot(ip);
02381                         double phi_new = temp.a()[1];            
02382                         double fi = phi_new - phi_old;
02384                         //if(fabs(fi) >= CLHEP::twopi) fi = fmod(fi+2*CLHEP::twopi,CLHEP::twopi);
02385 
02386                         if(fabs(fi) >= CLHEP::twopi) fi = fmod(fi+2*CLHEP::twopi,CLHEP::twopi);
02387 
02388                         track.fiTerm(fi);
02389                 }
02390 
02391                 if (debug_) cout<<"track----7-----"<<track.a()<<endl;
02392                 r0kal_prec = r0kal;
02393         }
02394 }

void KalFitAlg::smoother_calib KalFitTrack trk,
int  way
 

void KalFitAlg::smoother_calib KalFitTrack trk,
int  way
 

02399 {
02400 
02401         // retrieve Mdc  geometry information
02402         IMdcGeomSvc* igeomsvc;
02403         StatusCode sc = Gaudi::svcLocator()->service("MdcGeomSvc", igeomsvc);
02404         if(sc==StatusCode::FAILURE) cout << "GeoSvc failing!!!!!!!SC=" << sc << endl;
02405         MdcGeomSvc* geomsvc = dynamic_cast<MdcGeomSvc*>(igeomsvc);
02406         if(!geomsvc){
02407                 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitTrack.cxx !!"<<std::endl;
02408         }
02409 
02410         HepSymMatrix Eakal(5,0);
02411         // Estimation of the path length from ip to 1st cylinder
02412         HepPoint3D ip(0,0,0);
02413         track.pivot(ip);
02414         Eakal = track.getInitMatrix();
02415         if( debug_ == 4) {
02416                 std::cout<<"the initial error matrix in smoothing is "<<Eakal<<std::endl;
02417         }   
02418         track.Ea(Eakal);
02419 
02420         // Mdc part :
02421         unsigned int nseg = track.HelixSegs().size();
02422         int layer_prev = -1;
02423 
02424         HepVector pos_old(3,0);
02425         double r0kal_prec(0);
02426         int  nsegs_read(0);
02427         for( unsigned i=0 ; i < nseg; i++ ) {
02428 
02429                 int flag=0;
02430                 int iseg = (nseg-1)-i;
02431                 KalFitHelixSeg& HelixSeg = track.HelixSeg(iseg);
02432                 const KalFitWire& Wire = HelixSeg.HitMdc()->wire();
02433 
02434                 int wireid = Wire.geoID();
02435                 nsegs_read++;
02436 
02437                 int layer = Wire.layer().layerId();
02438                 if (pathl_ && layer != layer_prev) {
02439 
02440                         if (debug_ == 4) cout<<"in smoother,layerid "<<layer<<"  layer_prev  "
02441                                 <<layer_prev <<"  pathl_   "<<pathl_<<endl;
02442 
02443                         // track.PathL(Wire.layer().layerId());
02444                         layer_prev = layer;
02445                 }
02446 
02447                 HepPoint3D fwd(Wire.fwd());
02448                 HepPoint3D bck(Wire.bck());
02449                 Hep3Vector wire = (CLHEP::Hep3Vector)fwd -(CLHEP::Hep3Vector)bck;
02450                 Helix work = *(Helix*)&track;
02451                 work.ignoreErrorMatrix();
02452                 work.pivot((fwd + bck) * .5);
02453                 HepPoint3D x0kal = (work.x(0).z() - bck.z()) / wire.z() * wire + bck;
02454 
02455 
02456                 if(4 == debug_) std::cout<<" x0kal before sag: "<<x0kal<<std::endl;
02457 
02458                 if (wsag_ == 4){
02459 
02460                         Hep3Vector result;
02461                         const MdcGeoWire* geowire = geomsvc->Wire(wireid); 
02462                         double tension = geowire->Tension();
02463 
02464                         //std::cout<<" tension: "<<tension<<std::endl;
02465                         double zinit(x0kal.z()), lzx(Wire.lzx());
02466 
02467                         // double A(Wire.Acoef());
02468 
02469                         double A = 47.35E-6/tension;
02470                         double Zp = (zinit - bck.z())*lzx/wire.z();
02471 
02472                         if(4 == debug_){
02473 
02474                                 std::cout<<" sag in smoother_calib: "<<std::endl;
02475                                 std::cout<<" x0kal.x(): "<<std::setprecision(10)<<x0kal.x()<<std::endl;
02476                                 std::cout<<" wire.x()*(zinit-bck.z())/wire.z(): "<<std::setprecision(10)
02477                                                                                    <<(wire.x()*(zinit-bck.z())/wire.z())<<std::endl;
02478                                 std::cout<<"bck.x(): "<<std::setprecision(10)<<bck.x()<<std::endl;
02479                                 std::cout<<" wire.x()*(zinit-bck.z())/wire.z() + bck.x(): "<<std::setprecision(10)
02480                                                                                              <<(wire.x()*(zinit-bck.z())/wire.z() + bck.x())<<std::endl;
02481                         }
02482 
02483                         result.setX(wire.x()*(zinit-bck.z())/wire.z() + bck.x());
02484                         result.setY((A*(Zp-lzx)+wire.y()/lzx)*Zp+bck.y());
02485                         result.setZ((A*(2*Zp-lzx)*lzx+wire.y())/wire.z());
02486 
02487                         wire.setX(wire.x()/wire.z());
02488                         wire.setY(result.z());
02489                         wire.setZ(1);
02490 
02491                         x0kal.setX(result.x());
02492                         x0kal.setY(result.y());
02493                 }
02494 
02495                 if(4 == debug_) std::cout<<" x0kal after sag: "<<x0kal<<std::endl;
02496 
02497 
02498                 // If x0kal is after the inner wall and x0kal_prec before :
02499                 double r0kal = x0kal.perp();
02500                 if (debug_ == 4) {
02501                         cout<<"wire direction "<<wire<<endl;
02502                         cout<<"x0kal "<<x0kal<<endl;
02503                         cout<<"smoother::r0kal "<<r0kal<<"  r0kal_prec  "<<r0kal_prec <<endl;
02504                 }
02505 
02506                 // change PIVOT :
02507                 double pathl(0);
02508                 track.pivot_numf(x0kal, pathl);
02509 
02510                 if (debug_ == 4) cout<<"track----6-----"<<track.a()<<" ...path..."<<pathl
02511                         <<"momentum"<<track.momentum(0)<<endl;
02512                 if(KalFitElement::muls()) track.msgasmdc(pathl, way);
02513                 if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
02514 
02515                 // Add info hit wire :
02516                 if(track.kappa()) {
02517                         // attention to this measure value ,what is the measurement value !!
02518                         Hep3Vector meas = track.momentum(0).cross(wire).unit();
02519 
02520                         if(usage_>1) track.smoother_Mdc_csmalign(HelixSeg, meas,flag, m_csmflag);
02521                         else   track.smoother_Mdc(HelixSeg, meas,flag, m_csmflag);
02522                         // cout<<"layer, cell, track.a: "<<Wire.layer().layerId()<<" , "<<Wire.localId()<<" , "<<track.a()<<endl;
02523                 }
02524 
02525                 if (debug_) cout<<"track----7-----"<<track.a()<<endl;
02526                 r0kal_prec = r0kal;
02527                 // can this kind of operation be right??
02528                 if(flag == 0) {
02529                         track.HelixSegs().erase(track.HelixSegs().begin()+iseg);
02530                 }
02531         }
02532 }

void KalFitAlg::start_seed KalFitTrack track,
int  lead_,
int  way,
MdcRec_trk trk
 

void KalFitAlg::start_seed KalFitTrack track,
int  lead_,
int  way,
MdcRec_trk trk
 

05729 {
05730         if (debug_ == 4) 
05731                 cout << "start_seed begin... " << std::endl;
05732         // keep initial helix parameters
05733         Hep3Vector x_init(track.pivot());
05734         HepSymMatrix Ea_init(5,0);
05735         Ea_init = track.Ea();
05736         HepVector a_init(5);
05737         a_init = track.a();
05738 
05739         // LR assumption :
05740         unsigned int nhit_included(10);
05741         int LR[8][3] = { 
05742                 {1,1,1},
05743                 {1,1,-1},
05744                 {1,-1,1},
05745                 {1,-1,-1},
05746                 {-1,1,1},
05747                 {-1,1,-1},
05748                 {-1,-1,1},
05749                 {-1,-1,-1}
05750         };
05751 
05752         unsigned int nhit = track.HitsMdc().size();
05753         double chi2_min(DBL_MAX);
05754         int i_min(-1);
05755         for (int ktrial = 0; ktrial < 8; ktrial++) {
05756 
05757                 // Come back to trasan seed :
05758                 track.pivot(x_init);
05759                 track.a(a_init);
05760                 track.Ea(Ea_init);
05761 
05762                 track.chiSq(0);
05763                 track.chiSq_back(0);
05764                 track.nchits(0);
05765                 track.nster(0);
05766                 track.ndf_back(0);
05767 
05768                 HepSymMatrix Eakal(5,0);
05769 
05770                 init_matrix(choice_,TrasanTRK, Eakal);
05771                 // initialize the Mdc hits :
05772                 for( unsigned i=0 ; i < nhit; i++ ){
05773                         KalFitHitMdc& HitMdc = track.HitMdc(i);
05774                         int lr_decision(0);
05775                         if (i<3) lr_decision = LR[ktrial][i];
05776                         HitMdc.LR(lr_decision);
05777                         if (i<nhit_included)
05778                                 HitMdc.chi2(0);
05779                         else 
05780                                 HitMdc.chi2(-1);
05781                 }
05782                 // Mdc fit the ... first hits :
05783 
05784                 if(usage_==0) filter_fwd_anal(track, lead_, way, Eakal);
05785                 way=999;
05786                 if(usage_>0) filter_fwd_calib(track, lead_, way, Eakal);
05787 
05788                 // Check the chi2 
05789                 if (debug_ == 4) 
05790                         cout << "---- Result for " << ktrial << " case : chi2 = " << track.chiSq()
05791                                 << ", nhits included = " << track.nchits() << " for nhits available = "
05792                                 << nhit << std::endl;
05793 
05794                 if (track.chiSq() < chi2_min && 
05795                                 (track.nchits() == nhit_included || track.nchits() == nhit)){
05796                         chi2_min = track.chiSq();
05797                         i_min = ktrial;
05798                 }
05799         }
05800 
05801         // Initialize to the best solution :
05802         if (debug_ == 4) 
05803                 cout << "*** i_min = " << i_min << " with a chi2 = " << chi2_min << std::endl;
05804 
05805         for( unsigned i=0 ; i < nhit; i++ ){
05806                 KalFitHitMdc& HitMdc = track.HitMdc(i);
05807                 int lr_decision(0);
05808                 if (i_min >= 0 && i < 3) 
05809                         lr_decision = LR[i_min][i];
05810                 HitMdc.LR(lr_decision);
05811                 HitMdc.chi2(0);
05812                 HitMdc.chi2_back(0);
05813         }
05814         track.pivot(x_init);
05815         track.a(a_init);
05816         track.Ea(Ea_init);
05817         track.chiSq(0);
05818         track.chiSq_back(0);
05819         track.nchits(0);
05820         track.nster(0);
05821         track.ndf_back(0);
05822 
05823         // For debugging purpose :
05824         if (debug_ == 4) {
05825                 for( unsigned i=0 ; i < 3; i++ ){
05826                         KalFitHitMdc& HitMdc = track.HitMdc(i);
05827                         cout << " LR(" << i << ") = " << HitMdc.LR()
05828                                 << ", stereo = " << HitMdc.wire().stereo() 
05829                                 << ", layer = " << HitMdc.wire().layer().layerId() << std::endl;
05830                 }
05831         }
05832 }


Member Data Documentation

std::vector<KalFitMaterial> KalFitAlg::_BesKalmanFitMaterials [private]
 

std::vector<KalFitMaterial> KalFitAlg::_BesKalmanFitMaterials [private]
 

std::vector<KalFitCylinder> KalFitAlg::_BesKalmanFitWalls [private]
 

std::vector<KalFitCylinder> KalFitAlg::_BesKalmanFitWalls [private]
 

KalFitLayer_Mdc* KalFitAlg::_layer [private]
 

KalFitLayer_Mdc* KalFitAlg::_layer [private]
 

KalFitSuper_Mdc* KalFitAlg::_superLayer [private]
 

KalFitSuper_Mdc* KalFitAlg::_superLayer [private]
 

KalFitWire* KalFitAlg::_wire [private]
 

KalFitWire* KalFitAlg::_wire [private]
 

int KalFitAlg::activeonly_
 

Flag account to multiple scattering and energy loss, where lr flag from and whether use active hits only

int KalFitAlg::back_
 

flag to perform smoothing

int KalFitAlg::choice_
 

string KalFitAlg::cylfile_
 

double KalFitAlg::dchi2cut_inner_
 

double KalFitAlg::dchi2cut_layid2_
 

double KalFitAlg::dchi2cut_layid3_
 

double KalFitAlg::dchi2cut_mid1_
 

double KalFitAlg::dchi2cut_mid2_
 

double KalFitAlg::dchi2cut_outer_
 

double KalFitAlg::dchi2cutf_
 

double KalFitAlg::dchi2cuts_
 

int KalFitAlg::debug_
 

Debug flag for the track finder part.

int KalFitAlg::debug_kft_
 

Debug flag for the track finder part.

int KalFitAlg::drifttime_choice_
 

int KalFitAlg::enhance_
 

flag to enhance the error matrix at the inner hit of Mdc (cosmic)

int KalFitAlg::eventNo
 

int KalFitAlg::eventno
 

double KalFitAlg::fac_h1_
 

double KalFitAlg::fac_h2_
 

double KalFitAlg::fac_h3_
 

double KalFitAlg::fac_h4_
 

double KalFitAlg::fac_h5_
 

int KalFitAlg::fitnocut_
 

double KalFitAlg::fstrag_
 

factor of energy loss straggling for electron

double KalFitAlg::gain1_
 

double KalFitAlg::gain2_
 

double KalFitAlg::gain3_
 

double KalFitAlg::gain4_
 

double KalFitAlg::gain5_
 

int KalFitAlg::i_back_
 

mass assumption for backward filter (if <0 means use leading mass)

int KalFitAlg::i_front_
 

IMdcGeomSvc* KalFitAlg::imdcGeomSvc_ [static, private]
 

IMdcGeomSvc * KalFitAlg::imdcGeomSvc_ = 0 [static, private]
 

int KalFitAlg::inner_steps_
 

int KalFitAlg::iqual_back_
 

int KalFitAlg::iqual_front_
 

int KalFitAlg::lead_
 

leading mass assumption

int KalFitAlg::loss_
 

Flag account to multiple scattering and energy loss, where lr flag from and whether use active hits only

int KalFitAlg::lr_
 

Flag account to multiple scattering and energy loss, where lr flag from and whether use active hits only

NTuple::Item<double> KalFitAlg::m_anal_dr [private]
 

NTuple::Item<double> KalFitAlg::m_anal_dr [private]
 

NTuple::Item<double> KalFitAlg::m_anal_dz [private]
 

NTuple::Item<double> KalFitAlg::m_anal_dz [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_dr [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_dr [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_dz [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_dz [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_kappa [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_kappa [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_phi0 [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_phi0 [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_tanl [private]
 

NTuple::Item<double> KalFitAlg::m_anal_ea_tanl [private]
 

NTuple::Item<double> KalFitAlg::m_anal_kappa [private]
 

NTuple::Item<double> KalFitAlg::m_anal_kappa [private]
 

NTuple::Item<double> KalFitAlg::m_anal_phi0 [private]
 

NTuple::Item<double> KalFitAlg::m_anal_phi0 [private]
 

NTuple::Item<double> KalFitAlg::m_anal_tanl [private]
 

NTuple::Item<double> KalFitAlg::m_anal_tanl [private]
 

NTuple::Item<double> KalFitAlg::m_chi2direct [private]
 

NTuple::Item<double> KalFitAlg::m_chi2direct [private]
 

NTuple::Matrix<double> KalFitAlg::m_chisq [private]
 

NTuple::Matrix<double> KalFitAlg::m_chisq [private]
 

int KalFitAlg::m_csmflag
 

double KalFitAlg::m_dangcut
 

NTuple::Item<double> KalFitAlg::m_dchi2 [private]
 

NTuple::Item<double> KalFitAlg::m_dchi2 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq0 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq0 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq1 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq1 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq10 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq10 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq11 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq11 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq12 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq12 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq13 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq13 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq14 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq14 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq15 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq15 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq16 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq16 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq17 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq17 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq18 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq18 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq19 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq19 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq2 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq2 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq20 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq20 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq21 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq21 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq22 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq22 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq23 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq23 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq24 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq24 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq25 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq25 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq26 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq26 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq27 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq27 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq28 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq28 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq29 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq29 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq3 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq3 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq30 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq30 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq31 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq31 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq32 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq32 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq33 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq33 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq34 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq34 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq35 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq35 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq36 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq36 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq37 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq37 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq38 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq38 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq39 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq39 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq4 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq4 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq40 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq40 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq41 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq41 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq42 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq42 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq5 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq5 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq6 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq6 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq7 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq7 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq8 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq8 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq9 [private]
 

NTuple::Item<double> KalFitAlg::m_dchisq9 [private]
 

NTuple::Item<double> KalFitAlg::m_dd [private]
 

NTuple::Item<double> KalFitAlg::m_dd [private]
 

NTuple::Item<double> KalFitAlg::m_delp [private]
 

NTuple::Item<double> KalFitAlg::m_delp [private]
 

NTuple::Item<double> KalFitAlg::m_delphi [private]
 

NTuple::Item<double> KalFitAlg::m_delphi [private]
 

NTuple::Item<double> KalFitAlg::m_delpx [private]
 

NTuple::Item<double> KalFitAlg::m_delpx [private]
 

NTuple::Item<double> KalFitAlg::m_delpy [private]
 

NTuple::Item<double> KalFitAlg::m_delpy [private]
 

NTuple::Item<double> KalFitAlg::m_delpz [private]
 

NTuple::Item<double> KalFitAlg::m_delpz [private]
 

NTuple::Item<double> KalFitAlg::m_delthe [private]
 

NTuple::Item<double> KalFitAlg::m_delthe [private]
 

NTuple::Item<double> KalFitAlg::m_delx [private]
 

NTuple::Item<double> KalFitAlg::m_delx [private]
 

NTuple::Item<double> KalFitAlg::m_dely [private]
 

NTuple::Item<double> KalFitAlg::m_dely [private]
 

NTuple::Item<double> KalFitAlg::m_delz [private]
 

NTuple::Item<double> KalFitAlg::m_delz [private]
 

NTuple::Item<double> KalFitAlg::m_docaExc [private]
 

NTuple::Item<double> KalFitAlg::m_docaExc [private]
 

NTuple::Item<double> KalFitAlg::m_docaInc [private]
 

NTuple::Item<double> KalFitAlg::m_docaInc [private]
 

double KalFitAlg::m_dphicut
 

NTuple::Item<double> KalFitAlg::m_dtdc0 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc0 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc1 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc1 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc10 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc10 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc11 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc11 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc12 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc12 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc13 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc13 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc14 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc14 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc15 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc15 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc16 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc16 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc17 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc17 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc18 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc18 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc19 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc19 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc2 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc2 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc20 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc20 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc21 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc21 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc22 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc22 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc23 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc23 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc24 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc24 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc25 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc25 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc26 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc26 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc27 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc27 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc28 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc28 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc29 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc29 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc3 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc3 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc30 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc30 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc31 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc31 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc32 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc32 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc33 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc33 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc34 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc34 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc35 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc35 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc36 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc36 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc37 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc37 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc38 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc38 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc39 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc39 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc4 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc4 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc40 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc40 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc41 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc41 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc42 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc42 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc5 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc5 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc6 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc6 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc7 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc7 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc8 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc8 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc9 [private]
 

NTuple::Item<double> KalFitAlg::m_dtdc9 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack0 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack0 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack1 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack1 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack10 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack10 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack11 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack11 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack12 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack12 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack13 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack13 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack14 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack14 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack15 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack15 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack16 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack16 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack17 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack17 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack18 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack18 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack19 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack19 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack2 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack2 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack20 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack20 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack21 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack21 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack22 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack22 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack23 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack23 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack24 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack24 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack25 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack25 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack26 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack26 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack27 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack27 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack28 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack28 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack29 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack29 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack3 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack3 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack30 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack30 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack31 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack31 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack32 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack32 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack33 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack33 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack34 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack34 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack35 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack35 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack36 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack36 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack37 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack37 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack38 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack38 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack39 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack39 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack4 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack4 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack40 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack40 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack41 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack41 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack42 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack42 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack5 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack5 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack6 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack6 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack7 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack7 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack8 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack8 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack9 [private]
 

NTuple::Item<double> KalFitAlg::m_dtrack9 [private]
 

NTuple::Item<long> KalFitAlg::m_eventNo [private]
 

NTuple::Item<long> KalFitAlg::m_eventNo [private]
 

NTuple::Item<long> KalFitAlg::m_evtid [private]
 

NTuple::Item<long> KalFitAlg::m_evtid [private]
 

NTuple::Array<double> KalFitAlg::m_ferror [private]
 

NTuple::Array<double> KalFitAlg::m_ferror [private]
 

NTuple::Array<double> KalFitAlg::m_ferrore [private]
 

NTuple::Array<double> KalFitAlg::m_ferrore [private]
 

NTuple::Array<double> KalFitAlg::m_ferrork [private]
 

NTuple::Array<double> KalFitAlg::m_ferrork [private]
 

NTuple::Array<double> KalFitAlg::m_ferrormu [private]
 

NTuple::Array<double> KalFitAlg::m_ferrormu [private]
 

NTuple::Array<double> KalFitAlg::m_ferrorp [private]
 

NTuple::Array<double> KalFitAlg::m_ferrorp [private]
 

NTuple::Array<double> KalFitAlg::m_fhelix [private]
 

NTuple::Array<double> KalFitAlg::m_fhelix [private]
 

NTuple::Array<double> KalFitAlg::m_fhelixe [private]
 

NTuple::Array<double> KalFitAlg::m_fhelixe [private]
 

NTuple::Array<double> KalFitAlg::m_fhelixk [private]
 

NTuple::Array<double> KalFitAlg::m_fhelixk [private]
 

NTuple::Array<double> KalFitAlg::m_fhelixmu [private]
 

NTuple::Array<double> KalFitAlg::m_fhelixmu [private]
 

NTuple::Array<double> KalFitAlg::m_fhelixp [private]
 

NTuple::Array<double> KalFitAlg::m_fhelixp [private]
 

NTuple::Item<double> KalFitAlg::m_fitchi2 [private]
 

NTuple::Item<double> KalFitAlg::m_fitchi2 [private]
 

NTuple::Item<double> KalFitAlg::m_fpt [private]
 

NTuple::Item<double> KalFitAlg::m_fpt [private]
 

NTuple::Item<double> KalFitAlg::m_fpte [private]
 

NTuple::Item<double> KalFitAlg::m_fpte [private]
 

NTuple::Item<double> KalFitAlg::m_fptk [private]
 

NTuple::Item<double> KalFitAlg::m_fptk [private]
 

NTuple::Item<double> KalFitAlg::m_fptmu [private]
 

NTuple::Item<double> KalFitAlg::m_fptmu [private]
 

NTuple::Item<double> KalFitAlg::m_fptot [private]
 

NTuple::Item<double> KalFitAlg::m_fptot [private]
 

NTuple::Item<double> KalFitAlg::m_fptote [private]
 

NTuple::Item<double> KalFitAlg::m_fptote [private]
 

NTuple::Item<double> KalFitAlg::m_fptotk [private]
 

NTuple::Item<double> KalFitAlg::m_fptotk [private]
 

NTuple::Item<double> KalFitAlg::m_fptotmu [private]
 

NTuple::Item<double> KalFitAlg::m_fptotmu [private]
 

NTuple::Item<double> KalFitAlg::m_fptotp [private]
 

NTuple::Item<double> KalFitAlg::m_fptotp [private]
 

NTuple::Item<double> KalFitAlg::m_fptp [private]
 

NTuple::Item<double> KalFitAlg::m_fptp [private]
 

NTuple::Item<long> KalFitAlg::m_layer [private]
 

NTuple::Item<long> KalFitAlg::m_layer [private]
 

NTuple::Item<long> KalFitAlg::m_layerid [private]
 

NTuple::Item<long> KalFitAlg::m_layerid [private]
 

NTuple::Array<double> KalFitAlg::m_length [private]
 

NTuple::Array<double> KalFitAlg::m_length [private]
 

NTuple::Array<double> KalFitAlg::m_lerror [private]
 

NTuple::Array<double> KalFitAlg::m_lerror [private]
 

NTuple::Array<double> KalFitAlg::m_lerrore [private]
 

NTuple::Array<double> KalFitAlg::m_lerrore [private]
 

NTuple::Array<double> KalFitAlg::m_lerrork [private]
 

NTuple::Array<double> KalFitAlg::m_lerrork [private]
 

NTuple::Array<double> KalFitAlg::m_lerrormu [private]
 

NTuple::Array<double> KalFitAlg::m_lerrormu [private]
 

NTuple::Array<double> KalFitAlg::m_lerrorp [private]
 

NTuple::Array<double> KalFitAlg::m_lerrorp [private]
 

NTuple::Array<double> KalFitAlg::m_lhelix [private]
 

NTuple::Array<double> KalFitAlg::m_lhelix [private]
 

NTuple::Array<double> KalFitAlg::m_lhelixe [private]
 

NTuple::Array<double> KalFitAlg::m_lhelixe [private]
 

NTuple::Array<double> KalFitAlg::m_lhelixk [private]
 

NTuple::Array<double> KalFitAlg::m_lhelixk [private]
 

NTuple::Array<double> KalFitAlg::m_lhelixmu [private]
 

NTuple::Array<double> KalFitAlg::m_lhelixmu [private]
 

NTuple::Array<double> KalFitAlg::m_lhelixp [private]
 

NTuple::Array<double> KalFitAlg::m_lhelixp [private]
 

NTuple::Item<double> KalFitAlg::m_lpt [private]
 

NTuple::Item<double> KalFitAlg::m_lpt [private]
 

NTuple::Item<double> KalFitAlg::m_lpte [private]
 

NTuple::Item<double> KalFitAlg::m_lpte [private]
 

NTuple::Item<double> KalFitAlg::m_lptk [private]
 

NTuple::Item<double> KalFitAlg::m_lptk [private]
 

NTuple::Item<double> KalFitAlg::m_lptmu [private]
 

NTuple::Item<double> KalFitAlg::m_lptmu [private]
 

NTuple::Item<double> KalFitAlg::m_lptot [private]
 

NTuple::Item<double> KalFitAlg::m_lptot [private]
 

NTuple::Item<double> KalFitAlg::m_lptote [private]
 

NTuple::Item<double> KalFitAlg::m_lptote [private]
 

NTuple::Item<double> KalFitAlg::m_lptotk [private]
 

NTuple::Item<double> KalFitAlg::m_lptotk [private]
 

NTuple::Item<double> KalFitAlg::m_lptotmu [private]
 

NTuple::Item<double> KalFitAlg::m_lptotmu [private]
 

NTuple::Item<double> KalFitAlg::m_lptotp [private]
 

NTuple::Item<double> KalFitAlg::m_lptotp [private]
 

NTuple::Item<double> KalFitAlg::m_lptp [private]
 

NTuple::Item<double> KalFitAlg::m_lptp [private]
 

NTuple::Item<double> KalFitAlg::m_lr [private]
 

NTuple::Item<double> KalFitAlg::m_lr [private]
 

NTuple::Item<long> KalFitAlg::m_masshyp [private]
 

NTuple::Item<long> KalFitAlg::m_masshyp [private]
 

NTuple::Array<double> KalFitAlg::m_mchelix [private]
 

NTuple::Array<double> KalFitAlg::m_mchelix [private]
 

NTuple::Item<long> KalFitAlg::m_mcpid [private]
 

NTuple::Item<long> KalFitAlg::m_mcpid [private]
 

NTuple::Item<double> KalFitAlg::m_mcptot [private]
 

NTuple::Item<double> KalFitAlg::m_mcptot [private]
 

const MdcCalibFunSvc* KalFitAlg::m_mdcCalibFunSvc_ [private]
 

const MdcCalibFunSvc* KalFitAlg::m_mdcCalibFunSvc_ [private]
 

const IMagneticFieldSvc* KalFitAlg::m_MFSvc_ [private]
 

const IMagneticFieldSvc* KalFitAlg::m_MFSvc_ [private]
 

NTuple::Matrix<double> KalFitAlg::m_ndf [private]
 

NTuple::Matrix<double> KalFitAlg::m_ndf [private]
 

NTuple::Array<double> KalFitAlg::m_nhits [private]
 

NTuple::Array<double> KalFitAlg::m_nhits [private]
 

NTuple::Tuple* KalFitAlg::m_nt1 [private]
 

NTuple::Tuple* KalFitAlg::m_nt1 [private]
 

NTuple::Tuple* KalFitAlg::m_nt2 [private]
 

NTuple::Tuple* KalFitAlg::m_nt2 [private]
 

NTuple::Tuple* KalFitAlg::m_nt3 [private]
 

NTuple::Tuple* KalFitAlg::m_nt3 [private]
 

NTuple::Tuple* KalFitAlg::m_nt4 [private]
 

NTuple::Tuple* KalFitAlg::m_nt4 [private]
 

NTuple::Tuple* KalFitAlg::m_nt5 [private]
 

NTuple::Tuple* KalFitAlg::m_nt5 [private]
 

NTuple::Tuple* KalFitAlg::m_nt6 [private]
 

NTuple::Tuple* KalFitAlg::m_nt6 [private]
 

NTuple::Item<double> KalFitAlg::m_orichi2 [private]
 

NTuple::Item<double> KalFitAlg::m_orichi2 [private]
 

HepPDT::ParticleDataTable* KalFitAlg::m_particleTable [private]
 

HepPDT::ParticleDataTable* KalFitAlg::m_particleTable [private]
 

NTuple::Item<double> KalFitAlg::m_prob [private]
 

NTuple::Item<double> KalFitAlg::m_prob [private]
 

NTuple::Item<double> KalFitAlg::m_residest [private]
 

NTuple::Item<double> KalFitAlg::m_residest [private]
 

NTuple::Item<double> KalFitAlg::m_residnew [private]
 

NTuple::Item<double> KalFitAlg::m_residnew [private]
 

NTuple::Item<double> KalFitAlg::m_residualExc [private]
 

NTuple::Item<double> KalFitAlg::m_residualExc [private]
 

NTuple::Item<double> KalFitAlg::m_residualInc [private]
 

NTuple::Item<double> KalFitAlg::m_residualInc [private]
 

NTuple::Matrix<double> KalFitAlg::m_stat [private]
 

NTuple::Matrix<double> KalFitAlg::m_stat [private]
 

NTuple::Item<double> KalFitAlg::m_tdrift [private]
 

NTuple::Item<double> KalFitAlg::m_tdrift [private]
 

NTuple::Array<double> KalFitAlg::m_tof [private]
 

NTuple::Array<double> KalFitAlg::m_tof [private]
 

NTuple::Item<long> KalFitAlg::m_trackid [private]
 

NTuple::Item<long> KalFitAlg::m_trackid [private]
 

NTuple::Item<double> KalFitAlg::m_trkchisq [private]
 

NTuple::Item<double> KalFitAlg::m_trkchisq [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelp [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelp [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelphi [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelphi [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelthe [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelthe [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelx [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelx [private]
 

NTuple::Item<double> KalFitAlg::m_trkdely [private]
 

NTuple::Item<double> KalFitAlg::m_trkdely [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelz [private]
 

NTuple::Item<double> KalFitAlg::m_trkdelz [private]
 

NTuple::Array<double> KalFitAlg::m_trkerror [private]
 

NTuple::Array<double> KalFitAlg::m_trkerror [private]
 

NTuple::Array<double> KalFitAlg::m_trkhelix [private]
 

NTuple::Array<double> KalFitAlg::m_trkhelix [private]
 

NTuple::Item<double> KalFitAlg::m_trkndf [private]
 

NTuple::Item<double> KalFitAlg::m_trkndf [private]
 

NTuple::Item<double> KalFitAlg::m_trkptot [private]
 

NTuple::Item<double> KalFitAlg::m_trkptot [private]
 

NTuple::Item<double> KalFitAlg::m_trksigp [private]
 

NTuple::Item<double> KalFitAlg::m_trksigp [private]
 

int KalFitAlg::m_usevtxdb
 

NTuple::Item<double> KalFitAlg::m_yposition [private]
 

NTuple::Item<double> KalFitAlg::m_yposition [private]
 

NTuple::Array<double> KalFitAlg::m_zerror [private]
 

NTuple::Array<double> KalFitAlg::m_zerror [private]
 

NTuple::Array<double> KalFitAlg::m_zerrore [private]
 

NTuple::Array<double> KalFitAlg::m_zerrore [private]
 

NTuple::Array<double> KalFitAlg::m_zerrork [private]
 

NTuple::Array<double> KalFitAlg::m_zerrork [private]
 

NTuple::Array<double> KalFitAlg::m_zerrormu [private]
 

NTuple::Array<double> KalFitAlg::m_zerrormu [private]
 

NTuple::Array<double> KalFitAlg::m_zerrorp [private]
 

NTuple::Array<double> KalFitAlg::m_zerrorp [private]
 

NTuple::Array<double> KalFitAlg::m_zhelix [private]
 

NTuple::Array<double> KalFitAlg::m_zhelix [private]
 

NTuple::Array<double> KalFitAlg::m_zhelixe [private]
 

NTuple::Array<double> KalFitAlg::m_zhelixe [private]
 

NTuple::Array<double> KalFitAlg::m_zhelixk [private]
 

NTuple::Array<double> KalFitAlg::m_zhelixk [private]
 

NTuple::Array<double> KalFitAlg::m_zhelixmu [private]
 

NTuple::Array<double> KalFitAlg::m_zhelixmu [private]
 

NTuple::Array<double> KalFitAlg::m_zhelixp [private]
 

NTuple::Array<double> KalFitAlg::m_zhelixp [private]
 

NTuple::Item<double> KalFitAlg::m_zpt [private]
 

NTuple::Item<double> KalFitAlg::m_zpt [private]
 

NTuple::Item<double> KalFitAlg::m_zpte [private]
 

NTuple::Item<double> KalFitAlg::m_zpte [private]
 

NTuple::Item<double> KalFitAlg::m_zptk [private]
 

NTuple::Item<double> KalFitAlg::m_zptk [private]
 

NTuple::Item<double> KalFitAlg::m_zptmu [private]
 

NTuple::Item<double> KalFitAlg::m_zptmu [private]
 

NTuple::Item<double> KalFitAlg::m_zptot [private]
 

NTuple::Item<double> KalFitAlg::m_zptot [private]
 

NTuple::Item<double> KalFitAlg::m_zptote [private]
 

NTuple::Item<double> KalFitAlg::m_zptote [private]
 

NTuple::Item<double> KalFitAlg::m_zptotk [private]
 

NTuple::Item<double> KalFitAlg::m_zptotk [private]
 

NTuple::Item<double> KalFitAlg::m_zptotmu [private]
 

NTuple::Item<double> KalFitAlg::m_zptotmu [private]
 

NTuple::Item<double> KalFitAlg::m_zptotp [private]
 

NTuple::Item<double> KalFitAlg::m_zptotp [private]
 

NTuple::Item<double> KalFitAlg::m_zptp [private]
 

NTuple::Item<double> KalFitAlg::m_zptp [private]
 

NTuple::Item<double> KalFitAlg::m_zsigp [private]
 

NTuple::Item<double> KalFitAlg::m_zsigp [private]
 

NTuple::Item<double> KalFitAlg::m_zsigpe [private]
 

NTuple::Item<double> KalFitAlg::m_zsigpe [private]
 

NTuple::Item<double> KalFitAlg::m_zsigpk [private]
 

NTuple::Item<double> KalFitAlg::m_zsigpk [private]
 

NTuple::Item<double> KalFitAlg::m_zsigpmu [private]
 

NTuple::Item<double> KalFitAlg::m_zsigpmu [private]
 

NTuple::Item<double> KalFitAlg::m_zsigpp [private]
 

NTuple::Item<double> KalFitAlg::m_zsigpp [private]
 

string KalFitAlg::matfile_
 

double KalFitAlg::matrixg_
 

int KalFitAlg::mhyp_
 

int KalFitAlg::muls_
 

Flag account to multiple scattering and energy loss, where lr flag from and whether use active hits only

int KalFitAlg::ntuple_
 

Fill ntuples of KalFit.

int KalFitAlg::numf_
 

int KalFitAlg::numf_in_
 

int KalFitAlg::numf_out_
 

int KalFitAlg::numfcor_
 

int KalFitAlg::outer_steps_
 

int KalFitAlg::pathl_
 

double KalFitAlg::pe_cut_
 

value of the momentum cut to decide refit

double KalFitAlg::pk_cut_
 

value of the momentum cut to decide refit

double KalFitAlg::pmu_cut_
 

value of the momentum cut to decide refit

double KalFitAlg::pp_cut_
 

value of the momentum cut to decide refit

double KalFitAlg::ppi_cut_
 

value of the momentum cut to decide refit

double KalFitAlg::pT_
 

value of the pT cut for backward filter

double KalFitAlg::pt_cut_
 

int KalFitAlg::resolution_
 

const double KalFitAlg::RIW = 6.35 [static, private]
 

int KalFitAlg::steplev_
 

int KalFitAlg::Tds_back_no
 

double KalFitAlg::theta_cut_
 

int KalFitAlg::tof_hyp_
 

Flag account to multiple scattering and energy loss, where lr flag from and whether use active hits only

int KalFitAlg::tofflag_
 

Flag account to multiple scattering and energy loss, where lr flag from and whether use active hits only

int KalFitAlg::tprop_
 

propagation correction

int KalFitAlg::usage_
 

this usage is used to control the usage of this algorithm ,to be analysis or calibration.

int KalFitAlg::wsag_
 

flag to take account the wire sag into account


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:19:41 2011 for BOSS6.5.5 by  doxygen 1.3.9.1