//////////////////////////////////////////////////////////// // $Id: IHitSelection.cxx,v 1.9 2010/08/03 21:58:34 mcgrew Exp $ // #include #include "IHitSelection.hxx" ClassImp(COMET::IHitSelection); COMET::IHitSelection::IHitSelection(const char* name, const char* title) : COMET::IDatum(name,title) { } COMET::IHitSelection::~IHitSelection() { } void COMET::IHitSelection::push_back(const COMET::IHandle& hit) { if (!hit) { COMETSevere("Attempting to add a NULL hit"); throw COMET::EInvalidHit(); } std::vector< COMET::IHandle >::push_back(hit); } void COMET::IHitSelection::AddHit(const COMET::IHandle& hit) { COMET::IHitSelection::iterator location = std::find(begin(), end(), hit); if (location == end()) push_back(hit); } void COMET::IHitSelection::RemoveHit(const COMET::IHandle& hit) { COMET::IHitSelection::iterator location = std::find(begin(), end(), hit); if (location != end()) erase(location); } void COMET::IHitSelection::ls(Option_t* opt) const { COMET::IDatum::ls(opt); std::string option(opt); if (option.find("dump") != std::string::npos) { TROOT::IncreaseDirLevel(); for (const_iterator v = begin(); v != end(); ++v) { v->ls(opt); } TROOT::DecreaseDirLevel(); } }