00001 #include <cassert> 00002 #include <set> 00003 #include "DigitVector.h" 00004 #include "CandDigit/CandDigitListHandle.h" 00005 #include "RecoBase/CandStripListHandle.h" 00006 #include "RecoBase/CandSliceHandle.h" 00007 #include "RecoBase/CandStripHandle.h" 00008 00009 // Copy constructor from a CandDigitListHandle pointer 00010 00011 void 00012 DigitVector::FillFrom(const CandHandle *ch_ptr, Bool_t nodupe) 00013 { 00014 // Recursive. 00015 assert(ch_ptr); 00016 00017 TIter chItr = ch_ptr->GetDaughterIterator(); 00018 while(CandHandle *ch = dynamic_cast<CandHandle*>(chItr.Next())) { 00019 if(const CandDigitHandle* cdh = dynamic_cast<const CandDigitHandle*>(ch)) 00020 AddDigit(*cdh, nodupe); 00021 else 00022 FillFrom(ch); 00023 } 00024 } 00025 00026 00027 void 00028 DigitVector::FillFrom(const DigitVector& list, 00029 UInt_t start, 00030 UInt_t stop, 00031 Bool_t nodupe) 00032 00033 { 00035 assert( (stop<=list.size()) ); 00036 00037 this->reserve(this->size() + (stop-start) ); 00038 for(UInt_t i=start; i<stop; i++) { 00039 AddDigit(list[i],nodupe); 00040 } 00041 } 00042 00043 00044 void 00045 DigitVector::AddDigit(CandDigitHandle cdh, Bool_t nodupe) 00046 { 00047 if(nodupe) { // reject duplicates. 00048 for(UInt_t i=0; i<size(); i++) { 00049 if(cdh == operator[](i)) return; 00050 } 00051 } 00052 00053 push_back(cdh); 00054 }
1.3.9.1