// ------------------------------------------------------------------------- // ----- PndSdsSimpleStripClusterFinder source file ----- // ----- Converted 27.11.2007 from R.Jaekel by R.Kliemt ----- // ------------------------------------------------------------------------- #include "PndSdsSimpleStripClusterFinder.h" // includes for sort algorithms #include #include #include #include "TMath.h" #include "math.h" // enum SensorSide { kTOP, kBOTTOM }; PndSdsSimpleStripClusterFinder::PndSdsSimpleStripClusterFinder(Int_t DigiType): PndSdsStripClusterer(DigiType) { // dummy fRadius = 1; } PndSdsSimpleStripClusterFinder::PndSdsSimpleStripClusterFinder(Int_t DigiType, Int_t rad): PndSdsStripClusterer(DigiType) { fRadius = rad; } PndSdsSimpleStripClusterFinder::~PndSdsSimpleStripClusterFinder() { } std::vector< PndSdsClusterStrip* > PndSdsSimpleStripClusterFinder::SearchClusters() { /// ----- search for clusters ----- /// Take neighbouring fired strips. fClusters.clear(); fTopclusters.clear(); fBotclusters.clear(); fLeftDigis.clear(); std::vector< Int_t > onecluster; Indexpair::iterator tempStrip; //fSortedDigis[sensor][side][stripnr]=digiindex for (Fullmap::iterator itSensors = fSortedDigis.begin(); itSensors != fSortedDigis.end(); ++itSensors) // iterate over sensor { for (std::map::iterator itSide = (itSensors->second).begin(); itSide != (itSensors->second).end(); ++itSide) // iterate over sensor side { // std::cout<<"clsterfinder: "; // if(itSide->first == kTOP) std::cout<<"top"<second).begin(); itTime != (itSide->second).end(); ++itTime) { // iterate over timestamp // create a flagmap: for each digi (identified by iDigi, the index of the clonesarray) a flag if it is used Indexpair flagmap; for (Indexpair::iterator itStrip = (itTime->second).begin(); itStrip!= (itTime->second).end(); ++itStrip) {flagmap[itStrip->second]=1;} // iterate over channel for (Indexpair::iterator itStrip = (itTime->second).begin(); itStrip!= (itTime->second).end();itStrip++) { tempStrip=itStrip; if( !(1==flagmap[itStrip->second]) ) continue; for(Indexpair::iterator itStrip3 = itStrip; itStrip3 != (itTime->second).end(); ++itStrip3) { if( !(1==flagmap[itStrip3->second]) ) continue; if( fabs(tempStrip->first - itStrip3->first) > fRadius ) continue; onecluster.push_back(itStrip3->second); flagmap[itStrip3->second]=-1;//do not reuse this digi tempStrip=itStrip3; // std::cout<<"add strip "<first << " from digi "<second <first); onecluster.clear(); // std::cout<<" --- "<0) { Warning("SearchClusters","a hangover cluster of %i digis",onecluster.size()); AddCluster(onecluster,itSide->first); onecluster.clear(); } for (Indexpair::iterator itflag = flagmap.begin(); itflag!= flagmap.end(); ++itflag) { if (1==itflag->second) fLeftDigis.push_back(itflag->first); } } // end loop itTime }// end loop it Side }// end loop sensor return fClusters; } ClassImp(PndSdsSimpleStripClusterFinder); //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // double PndSdsSimpleStripClusterFinder::meanColumn(std::vector& list){ // double mean = 0.; // if (list.size() == 0){ // std::cout<<" there are no channels in list to form cluster!"<getTot(); // sumChannel += list[loopList]->getTot() * list[loopList]->getColumn(); // } // // calc the weighted mean // mean = sumChannel/sumWeights; // } // return mean; // } // // // double PndSdsSimpleStripClusterFinder::errMeanColumn(std::vector& list, double pitch){ // // // only geometric resolution so far.... // double errMean = list.size()*pitch/sqrt(12); // return errMean; // }