00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: TrkFundHit.h,v 1.4 2011/02/17 11:53:41 zhangy Exp $ 00004 // 00005 // Description: Abstract base class. Derived classes describe detector 00006 // (Svt & Mdc) hits, used as input to tracking routines. All 00007 // the base class does is provide list of pointers to HitOnTrack objects 00008 // that are currently pointing at the underlying hit. 00009 // Note: if you copy the contents 00010 // of a FundHit into another (with either the copy ctor or operator=), 00011 // the list of HOT pointers does not get copied (since the HOT points 00012 // back to the original, not the copy). 00013 // 00014 // Environment: 00015 // Software developed for the BaBar Detector at the SLAC B-Factory. 00016 // 00017 // Authors: Steve Schaffner 00018 // 00019 // Revision History: 00020 // 20000523 M. Kelsey -- Add concrete printAll() implementation which 00021 // calls through to subclass print(), then dumps HOT list. 00022 //------------------------------------------------------------------------ 00023 00024 #ifndef TRKFUNDHIT_HH 00025 #define TRKFUNDHIT_HH 00026 00027 #include "GaudiKernel/ContainedObject.h" 00028 00029 #include "TrkBase/TrkEnums.h" 00030 #include "TrkBase/TrkHitOnTrkIter.h" 00031 00032 #include <vector> 00033 #include <utility> 00034 class TrkRecoTrk; 00035 class TrkHitOnTrk; 00036 #include <iosfwd> 00037 00038 // Class interface // 00039 //class TrkFundHit : public AbsEvtObj {//yzhang temp 00040 //class TrkFundHit {//yzhang delete 00041 00042 class TrkFundHit : public ContainedObject { 00043 00044 public: 00045 typedef TrkHitOnTrkIter<TrkFundHit> hot_iterator; 00046 00047 //********************** 00048 // Constructors and such 00049 //********************** 00050 TrkFundHit(); 00051 virtual ~TrkFundHit(); 00052 00053 //********************** 00054 // Access list of HitOnTrack objects this hit is associated with 00055 //********************** 00056 int nUsedHits() const; 00057 bool usedHit(void) const {return !_hitList.empty();} 00058 00059 std::pair<TrkFundHit::hot_iterator, 00060 TrkFundHit::hot_iterator > getUsedHits() const { 00061 return std::pair<TrkFundHit::hot_iterator,TrkFundHit::hot_iterator >(begin(),end()); 00062 } 00063 inline TrkFundHit::hot_iterator begin() const; 00064 inline TrkFundHit::hot_iterator end() const; 00065 00066 // Is this hit used on track trk? 00067 bool usedOnTrack(const TrkRecoTrk *t) const {return getHitOnTrack(t) != 0;} 00068 // return HOT connecting this hit to track trk (return 0 if none) 00069 // TrkHitOnTrk* getHitOnTrack(TrkRecoTrk *trk, PdtPid::PidType) const; 00070 const TrkHitOnTrk* getHitOnTrack(const TrkRecoTrk *trk) const; 00071 00072 //********************** 00073 // Modify list of HitOnTrack objects 00074 //********************** 00075 const TrkHitOnTrk* setUsedHit(const TrkHitOnTrk *hit); // return hit if OK, 0 if not 00076 const TrkHitOnTrk* setUnusedHit(const TrkHitOnTrk *hit); // return hit if OK, 0 if not 00077 00078 //********************** 00079 // Pattern-recognition functions 00080 //********************** 00081 virtual TrkEnums::TrkViewInfo whatView() const = 0; 00082 00083 // MC truth (this may not survive until data-taking) 00084 // virtual const GTrack* getGTrack() const = 0; 00085 00086 //********************** 00087 // Dump list of HOTs (for debugging) 00088 //********************** 00089 virtual void printAll(std::ostream& os) const; 00090 00091 protected: 00092 friend class TrkHitOnTrkIter<TrkFundHit>; 00093 00094 typedef std::vector<const TrkHitOnTrk*>::iterator iterator_implementation; 00095 typedef const TrkHitOnTrk iterator_value_type; 00096 00097 std::vector<const TrkHitOnTrk*> _hitList; 00098 // Operators 00099 TrkFundHit& operator= (const TrkFundHit&); 00100 00101 private: 00102 // Copy ctor 00103 TrkFundHit(const TrkFundHit &); 00104 00105 }; 00106 00107 // Might need this again someday: 00108 // Create a HitOnTrk object of the correct type 00109 // virtual TrkHitOnTrk* makeHot(TrkRecoTrk *) = 0; 00110 00111 00112 TrkFundHit::hot_iterator 00113 TrkFundHit::begin() const 00114 { 00115 return TrkFundHit::hot_iterator(const_cast<std::vector<const TrkHitOnTrk*>&>(_hitList).begin()); 00116 } 00117 00118 TrkFundHit::hot_iterator 00119 TrkFundHit::end() const 00120 { 00121 return TrkFundHit::hot_iterator(const_cast<std::vector<const TrkHitOnTrk*>&>(_hitList).end()); 00122 } 00123 00124 #endif