FairRoot/PandaRoot
PndSdsSimpleStripClusterFinder.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndSdsSimpleStripClusterFinder source file -----
3 // ----- Converted 27.11.2007 from R.Jaekel by R.Kliemt -----
4 // -------------------------------------------------------------------------
5 
7 
8 // includes for sort algorithms
9 #include <algorithm>
10 #include <functional>
11 #include <vector>
12 #include "TMath.h"
13 #include "math.h"
14 
15 // enum SensorSide { kTOP, kBOTTOM };
16 
17 
19 : PndSdsStripClusterer(DigiType),
20  fRadius(1)
21 {}
23 : PndSdsStripClusterer(DigiType),
24  fRadius(rad)
25 {}
26 
28 {}
29 
30 
31 std::vector< PndSdsClusterStrip* > PndSdsSimpleStripClusterFinder::SearchClusters()
32 {
35  fClusters.clear();
36  fTopclusters.clear();
37  fBotclusters.clear();
38  fLeftDigis.clear();
39  std::vector< Int_t > onecluster;
40  Indexpair::iterator tempStrip;
41  //fSortedDigis[sensor][side][stripnr]=digiindex
42  for (Fullmap::iterator itSensors = fSortedDigis.begin();
43  itSensors != fSortedDigis.end(); ++itSensors) // iterate over sensor
44  {
45  for (std::map<SensorSide,Indextriple>::iterator itSide = (itSensors->second).begin();
46  itSide != (itSensors->second).end(); ++itSide) // iterate over sensor side
47  {
48  // std::cout<<"clsterfinder: ";
49  // if(itSide->first == kTOP) std::cout<<"top"<<std::endl;
50  // else std::cout<<"bottom"<<std::endl;
51  for (Indextriple::iterator itTime = (itSide->second).begin(); itTime != (itSide->second).end(); ++itTime)
52  { // iterate over timestamp
53 
54  // create a flagmap: for each digi (identified by iDigi, the index of the clonesarray) a flag if it is used
55  Indexpair flagmap;
56  for (Indexpair::iterator itStrip = (itTime->second).begin(); itStrip!= (itTime->second).end(); ++itStrip)
57  {flagmap[itStrip->second]=1;} // iterate over channel
58 
59  for (Indexpair::iterator itStrip = (itTime->second).begin();
60  itStrip!= (itTime->second).end();itStrip++)
61  {
62  tempStrip=itStrip;
63  if( !(1==flagmap[itStrip->second]) ) continue;
64  for(Indexpair::iterator itStrip3 = itStrip; itStrip3 != (itTime->second).end(); ++itStrip3)
65  {
66  if( !(1==flagmap[itStrip3->second]) ) continue;
67  if( std::abs(tempStrip->first - itStrip3->first) > fRadius ) continue;
68  onecluster.push_back(itStrip3->second);
69  flagmap[itStrip3->second]=-1;//do not reuse this digi
70  tempStrip=itStrip3;
71  // std::cout<<"add strip "<<itStrip3->first << " from digi "<<itStrip3->second <<std::endl;
72  }
73  AddCluster(onecluster,itSide->first);
74  onecluster.clear();
75  // std::cout<<" --- "<<std::endl;
76  } // end loop itStrip
77 
78  if (onecluster.size()>0)
79  {
80  Warning("SearchClusters","a hangover cluster of %zu digis",onecluster.size());
81  AddCluster(onecluster,itSide->first);
82  onecluster.clear();
83  }
84  for (Indexpair::iterator itflag = flagmap.begin(); itflag!= flagmap.end(); ++itflag)
85  {
86  if (1==itflag->second) fLeftDigis.push_back(itflag->first);
87  }
88  } // end loop itTime
89  }// end loop it Side
90  }// end loop sensor
91  return fClusters;
92 }
93 
95 
96 
97 //------------------------------------------------------------------------------
98 //------------------------------------------------------------------------------
99 //------------------------------------------------------------------------------
100 
101 // double PndSdsSimpleStripClusterFinder::meanColumn(std::vector<PndSdsDigiPixel*>& list){
102 // double mean = 0.;
103 // if (list.size() == 0){
104 // std::cout<<" there are no channels in list to form cluster!"<<std::endl;
105 // }
106 // else{
107 // // loop over digis to get weighted mean
108 // double sumWeights = 0.;
109 // double sumChannel = 0.;
110 // for (int loopList = 0; loopList<list.size(); loopList++) {
111 // sumWeights += list[loopList]->getTot();
112 // sumChannel += list[loopList]->getTot() * list[loopList]->getColumn();
113 // }
114 // // calc the weighted mean
115 // mean = sumChannel/sumWeights;
116 // }
117 // return mean;
118 // }
119 //
120 //
121 // double PndSdsSimpleStripClusterFinder::errMeanColumn(std::vector<PndSdsDigiPixel*>& list, double pitch){
122 //
123 // // only geometric resolution so far....
124 // double errMean = list.size()*pitch/sqrt(12);
125 // return errMean;
126 // }
127 
128 
129 
130 
std::vector< PndSdsClusterStrip * > fClusters
std::vector< PndSdsClusterStrip * > SearchClusters()
std::map< Int_t, Int_t > Indexpair
std::vector< Int_t > fLeftDigis
std::vector< Int_t > fTopclusters
std::vector< Int_t > fBotclusters
ClassImp(PndAnaContFact)
void AddCluster(const std::vector< Int_t > &onecluster, SensorSide side)