FairRoot/PandaRoot
PndSdsStripAdvClusterFinder.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndSdsStripAdvClusterFinder 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 // enum SensorSide { kTOP, kBOTTOM };
14 
16 : PndSdsStripClusterer(DigiType),
17  fNmCh(2),
18  fNmTS(0)
19 {}
20 
21 PndSdsStripAdvClusterFinder::PndSdsStripAdvClusterFinder(Int_t DigiType, Int_t NrofmissedChannels, Int_t NrofmissedTimestamp)
22 : PndSdsStripClusterer(DigiType),
23  fNmCh(NrofmissedChannels+1),
24  fNmTS(NrofmissedTimestamp)
25 {}
26 
28 {
29 }
30 
31 
32 std::vector< PndSdsClusterStrip* > PndSdsStripAdvClusterFinder::SearchClusters()
33 {
36  fClusters.clear();
37  fTopclusters.clear();
38  fBotclusters.clear();
39  std::vector< Int_t > onecluster;
40  Indexpair::iterator tempStrip;
41  //fSortedDigis[sensor][side][stripnr]=digiindex
42  std::cout<<"beim Cluster"<<std::endl;
43  for (Fullmap::iterator itSensors = fSortedDigis.begin(); itSensors != fSortedDigis.end(); ++itSensors)
44  { // iterate over sensor
45  for (std::map<SensorSide,Indextriple>::iterator itSide = (itSensors->second).begin();
46  itSide != (itSensors->second).end(); ++itSide)
47  { // iterate over sensor side
48  //CH TS ID,Used
49  std::map<Int_t, std::map<Int_t,std::vector<Int_t> > > hitmap;
50  for (Indextriple::iterator itTime = (itSide->second).begin(); itTime != (itSide->second).end();
51  ++itTime)
52  { // iterate over timestamp
53  for (Indexpair::iterator itStrip = (itTime->second).begin(); itStrip!= (itTime->second).end();
54  ++itStrip)
55  { // iterate over channel
56  hitmap[itStrip->first][itTime->first][0]=itStrip->second; // ID store
57  hitmap[itStrip->first][itTime->first][1]=1; // used store
58  }
59  }//loop time
60 
61  // loop over channels in hitmap
62  for (std::map<Int_t, std::map<Int_t,std::vector<Int_t> > >::const_iterator ch = hitmap.begin();
63  ch!=hitmap.end(); ++ch)
64  {
65  // loop over all frames in hitmap in this channel
66  for (std::map<Int_t,std::vector<Int_t> >::const_iterator ts = ch->second.begin(); ts!=ch->second.end(); ++ts)
67  {
68  // std::vector< Int_t > onecluster;
69  ClusterIterator(ch->first,ts->first,hitmap,onecluster); // new Cluster from ch and ts
70  if (onecluster.size()>0)
71  {
72  // std::cout<<" -W- PndSdsStripAdvClusterFinder::SearchClusters(): cluster hangover? "<<onecluster.size()<<std::endl;
73  AddCluster(onecluster,itSide->first);
74  onecluster.clear();
75  }
76  } // iter time
77  } // iter channel
78  }// end loop it Side
79  }// end loop sensor
80  return fClusters;
81 }
82 
83 
84 void PndSdsStripAdvClusterFinder::ClusterIterator(Int_t newCh, Int_t newFrameID, std::map<Int_t,
85  std::map<Int_t,std::vector<Int_t> > >& hitmap, std::vector< Int_t >& onecluster)
86 {
87  if (hitmap.find(newCh) == hitmap.end()) return; // end of hitmap reached (channel)
88  if (hitmap[newCh].find(newFrameID) == hitmap[newCh].end()) return; // end of hitmap reached (frame)
89  if (hitmap[newCh][newFrameID][1]==-1) return; // already identified
90  hitmap[newCh][newFrameID][1]=-1; // now identified
91  onecluster.push_back(hitmap[newCh][newFrameID][0]); // to clusterlist
92 
93  for(Int_t channel=(newCh-fNmCh); channel!=(newCh+fNmCh); ++channel)
94  {
95  for(Int_t frame=(newFrameID-fNmTS);frame!=(newFrameID+fNmTS);++frame)
96  {
97  ClusterIterator(channel,frame,hitmap,onecluster);
98  }
99  }
100  return;
101 }
102 
103 
std::vector< PndSdsClusterStrip * > fClusters
void ClusterIterator(Int_t newCh, Int_t newFrameID, std::map< Int_t, std::map< Int_t, std::vector< Int_t > > > &hitmap, std::vector< Int_t > &onecluster)
std::vector< PndSdsClusterStrip * > SearchClusters()
PndTransMap * map
Definition: sim_emc_apd.C:99
std::vector< Int_t > fTopclusters
std::vector< Int_t > fBotclusters
Find Clusters on a strip sensor in two dimensions.
Int_t fNmCh
maximum of missing channels
ClassImp(PndAnaContFact)
void AddCluster(const std::vector< Int_t > &onecluster, SensorSide side)
PndPidEmcAssociatorTask * ts
Int_t fNmTS
maximum of missing time