00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: MdcHitMapGuts.cxx,v 1.4 2009/09/22 06:28:08 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 #include "MdcData/MdcHitMapGuts.h" 00015 #include "MdcData/MdcHit.h" 00016 #include "MdcGeom/MdcDetector.h" 00017 #include "MdcGeom/MdcLayer.h" 00018 #include <iostream> 00019 00020 MdcHitMapGuts::MdcHitMapGuts(const MdcDetector& gm) 00021 : _hits(gm.nLayer()) 00022 { 00023 unsigned n = _hits.size(); 00024 for (unsigned l = 0; l < n; ++l) { 00025 const MdcLayer* lay = gm.Layer(l); 00026 _hits[l].resize(lay->nWires(),0); // resizes and zeroes 00027 } 00028 } 00029 00030 MdcHitMapGuts::~MdcHitMapGuts() 00031 { 00032 } 00033 00034 MdcHitMapGuts* 00035 MdcHitMapGuts::instance(const MdcDetector& gm) 00036 { 00037 static MdcHitMapGuts theInstance(gm); 00038 theInstance.clear(); 00039 return &theInstance; 00040 } 00041 00042 void 00043 MdcHitMapGuts::clear() 00044 { 00045 for (MdcHitMap_t::iterator j = _hits.begin(); j != _hits.end(); ++j) { 00046 std::fill(j->begin(),j->end(),static_cast<MdcHit *>(0)); 00047 } 00048 } 00049 00050 void 00051 MdcHitMapGuts::addHit(MdcHit& theHit) 00052 { 00053 _hits[theHit.layernumber()][theHit.wirenumber()] = &theHit; 00054 } 00055