/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/BesDChain/BesDChain-00-00-14/BesDChain/Template/CDChargedVisible.cc

Go to the documentation of this file.
00001 #ifndef CLEODCHAIN_CDCHARGEDVISIBLE_CC
00002 #define CLEODCHAIN_CDCHARGEDVISIBLE_CC
00003 // -*- C++ -*-
00004 //
00005 // Package:     CleoDChain
00006 // Module:      CDChargedVisible
00007 // 
00008 // Description: Implementation of candidate for visible charged particles
00009 //
00010 // Implimentation:
00011 //     <Notes on implimentation>
00012 //
00013 // Author:      Simon Patton
00014 // Created:     Tue Mar 18 13:23:11 EST 1997
00015 // $Id: CDChargedVisible.cc,v 1.4 2009/10/28 08:23:22 petez Exp $
00016 //
00017 // Revision history
00018 //
00019 // $Log: CDChargedVisible.cc,v $
00020 // Revision 1.4  2009/10/28 08:23:22  petez
00021 // see ChangeLog for changes to KinematicData and CDChargedVisible
00022 //
00023 // Revision 1.3  2009/06/22 14:55:48  zoujh
00024 // See ChangeLog
00025 //
00026 // Revision 1.2  2009/03/09 20:00:43  chunlei
00027 // get charge and momentum from KalTrack helix information
00028 //
00029 // Revision 1.1.1.1  2009/03/03 06:05:56  maqm
00030 // first import of BesDChain
00031 //
00032 // Revision 1.3  2004/03/05 22:01:54  chengp
00033 // implemented Monte Carlo matching
00034 //
00035 // Revision 1.2  2001/04/25 12:52:17  ajm36
00036 // plugged memory leak in ctor for pi0's, k shorts, etas
00037 //
00038 // Revision 1.1  2001/04/11 13:19:35  urner
00039 // transition to files with CD prefix. Addition of new files
00040 //
00041 // Revision 1.3  2001/04/03 17:26:46  cdj
00042 // moved builtFromCDCharged to builtFromTrack
00043 //
00044 // Revision 1.2  2001/03/23 23:05:42  urner
00045 // added pi0 eta and CDKs decay lists
00046 //
00047 // Revision 1.1.1.1  2000/12/18 22:17:27  cdj
00048 // imported CleoDChain
00049 //
00050 // Revision 1.11  1998/05/01 20:30:21  sjp
00051 // Modified include path for new placement of CO classes
00052 //
00053 // Revision 1.10  1998/05/01 20:21:35  sjp
00054 // Added necessary string include
00055 //
00056 // Revision 1.9  1998/04/21 05:18:23  sjp
00057 // Modified to use CDMud
00058 //
00059 // Revision 1.8  1998/04/17 18:50:24  sjp
00060 // Modifed to use latest CLEO types
00061 //
00062 // Revision 1.7  1997/12/23 21:54:54  sjp
00063 // Modified package to be completely templated
00064 //
00065 // Revision 1.6  1997/09/03 14:58:47  sjp
00066 // Use new report.h and KTKinematicData
00067 //
00068 // Revision 1.5  1997/08/29 17:01:24  sjp
00069 // Modified to handle new Cairn Templated classes
00070 //
00071 // Revision 1.4  1997/08/19 20:41:47  sjp
00072 // Updated to use <package>/<file>.h include structure.
00073 //   (Note: This version of the code has not been compiled)
00074 //
00075 // Revision 1.3  1997/01/31 20:10:24  sjp
00076 // Modified to use the new `bug' include files
00077 //
00078 // Revision 1.2  1997/01/21 20:30:30  sjp
00079 // Changed CPP flags and include because of library reorganization
00080 //
00081 // Revision 1.1  1996/11/04 17:15:04  sjp
00082 // Replacement for CHargedHypothesis Class
00083 //
00084 
00085 // system include files
00086 #include <string>
00087 
00088 // user include files
00089 #include "EvtRecEvent/EvtRecTrack.h"
00090 #include "MdcRecEvent/RecMdcKalTrack.h"
00091 #include "MdcRecEvent/RecMdcTrack.h"
00092 //zoujh: ...
00093 //#include "AnalEvent/BStableParticle.h"
00094 
00095 #include "BesDChain/util/KinematicData.h"
00096 #include "BesDChain/CDMud.h"
00097 
00098 #include "BesDChain/CDChargedVisible.h"
00099 
00100 using DecayChain::KinematicData;
00101 
00102 //
00103 // constructors and destructor
00104 //
00105 
00106 template < DBCandidate::Hypo H >
00107 CDChargedVisible<H>::CDChargedVisible( const EvtRecTrack* aVisible ) :
00108    CDCandidate( CDMud< EvtRecTrack >::get( aVisible ) ) ,
00109    m_visibleEvidence( aVisible )
00110 {
00111 }
00112 
00113 //zoujh: ...
00114 /*
00115 template < DBCandidate::Hypo H >
00116 CDChargedVisible<H>::CDChargedVisible( BPion* aPion ) :
00117    CDCandidate( CDMud< EvtRecTrack >::get( aPion->pionTrk()->bTrack()->dstTrack() ) ),
00118    m_visibleEvidence( aPion->pionTrk()->bTrack()->dstTrack() )
00119 {
00120 }
00121 
00122 template < DBCandidate::Hypo H >
00123 CDChargedVisible<H>::CDChargedVisible( BKaon* aKaon ) :
00124    CDCandidate( CDMud< EvtRecTrack >::get( aKaon->kaonTrk()->bTrack()->dstTrack() ) ),
00125    m_visibleEvidence( aKaon->kaonTrk()->bTrack()->dstTrack() )
00126 {
00127 }
00128 */
00129 
00130 //------ Constructor -----
00131 // copy constructor
00132 //
00133 template < DBCandidate::Hypo H >
00134 CDChargedVisible<H>::CDChargedVisible( const CDChargedVisible<H>& aOtherCDChargedHypo ) :
00135    CDCandidate( aOtherCDChargedHypo ) ,
00136    m_visibleEvidence( aOtherCDChargedHypo.m_visibleEvidence )
00137 {
00138 }
00139 
00140 //------ Destructor -----
00141 //
00142 
00143 template < DBCandidate::Hypo H >
00144 CDChargedVisible<H>::~CDChargedVisible()
00145 {
00146 }
00147 
00148 //
00149 // assignment operators
00150 //
00151 
00152 //
00153 // member functions
00154 //
00155 
00156 //
00157 // const member functions
00158 //
00159 
00160 template < DBCandidate::Hypo H >
00161 bool CDChargedVisible<H>::builtFromTrack() const
00162 {
00163    return ( 0 != m_visibleEvidence ) ;
00164 }
00165 
00166 template < DBCandidate::Hypo H >
00167 const EvtRecTrack* CDChargedVisible<H>::track() const
00168 {
00169    return m_visibleEvidence;
00170 }
00171 
00172 
00173 //------ defaultKinematicData -----
00174 // create the kinematicData for this CDCandidate
00175 //
00176 
00177 template < DBCandidate::Hypo H >
00178 KinematicData* CDChargedVisible<H>::defaultKinematicData() const
00179 {
00180    KinematicData* tmp = new KinematicData();
00181 
00182    double mass = DBCandidate::mass( static_cast<DBCandidate::Hypo>(H) );
00183    
00184    //  original set, can be used again once kalTrack has charge and momentum available in memory
00185    /* 
00186    if ( (const_cast<EvtRecTrack*>(m_visibleEvidence))->isMdcKalTrackValid() ) {
00187       RecMdcKalTrack* mdcKalTrack = (const_cast<EvtRecTrack*>(m_visibleEvidence))->mdcKalTrack();
00188       
00189       mdcKalTrack->setPidType( static_cast<RecMdcKalTrack::PidType>
00190                               (static_cast<DBCandidate::Hypo>(H) - 1) );
00191       
00192       tmp->setCharge( mdcKalTrack->charge() );
00193       //tmp->setMass( DBCandidate::mass( static_cast<DBCandidate::Hypo>(H) ) );
00194        tmp->setMomentum( Hep3Vector(mdcKalTrack->px(), mdcKalTrack->py(), mdcKalTrack->pz()) );
00195     }
00196    */
00197    //get momentume and chage from helix information directly
00198    
00199     if ( (const_cast<EvtRecTrack*>(m_visibleEvidence))->isMdcKalTrackValid() ) {
00200      RecMdcKalTrack* mdcKalTrack = (const_cast<EvtRecTrack*>(m_visibleEvidence))->mdcKalTrack();
00201      
00202      mdcKalTrack->setPidType( static_cast<RecMdcKalTrack::PidType>
00203                               (static_cast<DBCandidate::Hypo>(H) - 1) );
00204      
00205      int pid=static_cast<DBCandidate::Hypo>(H) - 1;
00206      
00207      HepVector zhelix;
00208      if(pid==0)
00209        zhelix=mdcKalTrack->getZHelixE();
00210      else if(pid==1)
00211        zhelix=mdcKalTrack->getZHelixMu();
00212      else if(pid==2)
00213        zhelix=mdcKalTrack->getZHelix();
00214      else if(pid==3)
00215        zhelix=mdcKalTrack->getZHelixK();
00216      else 
00217        zhelix=mdcKalTrack->getZHelixP();
00218      
00219           
00220      double dr(0),phi0(0),kappa(0),dz(0),tanl(0);
00221      dr=zhelix[0];
00222      phi0=zhelix[1];
00223      kappa=zhelix[2];
00224      dz=zhelix[3];
00225      tanl=zhelix[4];
00226      
00227      int charge=0;
00228      
00229      if (kappa > 0.0000000001)
00230        charge = 1;
00231      else if (kappa < -0.0000000001)
00232         charge = -1;
00233      
00234      double pxy=0;
00235      if(kappa!=0) pxy = 1.0/fabs(kappa);
00236      
00237      double px = pxy * (-sin(phi0));
00238      double py = pxy * cos(phi0);
00239      double pz = pxy * tanl;
00240 
00241      double e  = sqrt( pxy*pxy + pz*pz + mass*mass );
00242      
00243      tmp->setCharge( charge );
00244      //tmp->setMass( DBCandidate::mass( static_cast<DBCandidate::Hypo>(H) ) );
00245      tmp->setP4( HepLorentzVector(px, py, pz, e));
00246    }
00247    
00248     else {
00249      RecMdcTrack* mdcTrack = (const_cast<EvtRecTrack*>(m_visibleEvidence))->mdcTrack();
00250       tmp->setCharge( mdcTrack->charge() );
00251       double e = sqrt( mass*mass + mdcTrack->p3().mag2() );
00252       tmp->setP4( HepLorentzVector(mdcTrack->p3(), e) );
00253     }
00254 
00255    return tmp;
00256 }
00257 
00258 #endif /* CLEODCHAIN_CDCHARGEDVISIBLE_CC */

Generated on Tue Nov 29 22:58:19 2016 for BOSS_7.0.2 by  doxygen 1.4.7