00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: MdcHitMapGuts.h,v 1.2 2005/07/18 03:16:11 zhangy Exp $ 00004 // 00005 // Description: 00006 // Singleton implementation of MdcHitMap. Requesting an instance either 00007 // creates one (first call) or clears the existing one (all subsequent calls). 00008 // 00009 // Environment: 00010 // Software developed for the BaBar Detector at the SLAC B-Factory. 00011 // 00012 // Author(s): Steve Schaffner 00013 // 00014 //------------------------------------------------------------------------ 00015 00016 #ifndef DCHHITMAPGUTS_HH 00017 #define DCHHITMAPGUTS_HH 00018 00019 #include <vector> 00020 class MdcHit; 00021 class MdcDetector; 00022 00023 // Class interface // 00024 class MdcHitMapGuts { 00025 00026 friend class MdcHitMap; // only one who can make one of these 00027 00028 public: 00029 virtual ~MdcHitMapGuts(); 00030 00031 MdcHit* hitWire(int lay, int wire) const { 00032 return _hits[lay][wire]; 00033 } 00034 00035 void addHit(MdcHit& theHit) ; 00036 00037 void removeHit(int lay, int wire) { 00038 // could switch to () notation to avoid overhead for bounds-checking 00039 _hits[lay][wire] = 0; 00040 } 00041 00042 void clear(); 00043 00044 private: 00045 00046 static MdcHitMapGuts* instance(const MdcDetector&); 00047 MdcHitMapGuts(const MdcDetector&); // only used internally 00048 00049 typedef std::vector<std::vector< MdcHit* > > MdcHitMap_t; 00050 MdcHitMap_t _hits; 00051 00052 // Preempt 00053 MdcHitMapGuts& operator= (const MdcHitMapGuts&); 00054 MdcHitMapGuts(const MdcHitMapGuts &); 00055 }; 00056 00057 #endif