00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: MdcHitUse.cxx,v 1.2 2011/09/26 00:55:50 zhangy Exp $ 00004 // 00005 // Description: 00006 // 00007 // 00008 // Environment: 00009 // Software developed for the BaBar Detector at the SLAC B-Factory. 00010 // 00011 // Author(s): Steve Schaffner 00012 // 00013 //------------------------------------------------------------------------ 00014 00015 //#include "BaBar/BaBar.h" 00016 #include "MdcData/MdcHitUse.h" 00017 #include "MdcData/MdcRecoHitOnTrack.h" 00018 #include "MdcData/MdcHit.h" 00019 00020 00021 MdcHitUse::MdcHitUse(const MdcHit& thehit, double flt, int amb, 00022 bool active, int usable) : 00023 TrkHitUse(thehit, flt, active, usable) 00024 { 00025 _ambig = amb; 00026 } 00027 00028 MdcHitUse::~MdcHitUse() 00029 { } 00030 00031 TrkHitOnTrk* 00032 MdcHitUse::createHitOnTrk(const TrkRep& rep) const 00033 //MdcHitUse::createHitOnTrk(const TrkRep& rep, bool maintainAmbiguity) const 00034 { 00035 // This is a kludge -- fix once MdcHitOnTrack gets more cleaned up 00036 // (time should not be used for anything (I hope) 00037 // Also note that I temporarily have to cast off const from TrkRep 00038 const MdcHit *h=mdcHit(); assert(h!=0); 00039 MdcRecoHitOnTrack tempHot(*h, ambig(), 0.); 00040 TrkHitOnTrk* newHot = tempHot.clone(&const_cast<TrkRep&>(rep)); 00041 newHot->setFltLen( fltLen() ); 00042 updateMeasurement(*newHot); 00043 /* 00044 //yzhang changed 2011-05-04 00045 std::cout<< __FILE__ << " " << __LINE__ << " maintainAmbiguity "<<maintainAmbiguity<<std::endl; 00046 if( maintainAmbiguity ) 00047 { 00048 std::cout<< __FILE__ << " " << __LINE__ << " 2d "<<false<<std::endl; 00049 updateMeasurement(*newHot,0, false); //2d maintainAmbiguity = false 00050 }else{ 00051 std::cout<< __FILE__ << " " << __LINE__ << " 3d "<<true<<std::endl; 00052 updateMeasurement(*newHot,0, true); //3d maintainAmbiguity = true 00053 } 00054 */ 00055 //zhangy 00056 return newHot; 00057 } 00058 00059 bool 00060 MdcHitUse::operator==(const TrkHitUse& rhs) const 00061 { 00062 // This is not going to win any design prizes: 00063 if (mdcHit() == 0 || rhs.mdcHit() ==0) return false; 00064 const MdcHitUse& x = static_cast<const MdcHitUse&>(rhs); 00065 return ( ambig() == x.ambig() && TrkHitUse::operator==(x) ); 00066 } 00067 00068 const MdcHit* 00069 MdcHitUse::mdcHit() const 00070 { 00071 return static_cast<const MdcHit*>(&(hit())); 00072 }