00001
00002
00003
00004 #include "reconstruction/ClusterFit.h"
00005
00006
00007
00008 #include <cmath>
00009
00010 static int number_of_trays = 19;
00011 static int xNum = 4, yNum=4;
00012 static double si_strip_pitch = 0.020848214285714;
00013
00014 ClusterFit::ClusterFit (HitMap *Pos)
00015 : LSQFit()
00016 {
00017
00018
00019
00020
00021
00022
00023
00024
00025 const int num_conv = number_of_trays-1;
00026 numHitsUsed = 0;
00027 float strip_pitch = si_strip_pitch;
00028
00029 int modID, iplane;
00030 HitMap cluster;
00031 unsigned int min_cluster_size = 6;
00032 const int maxModId = (xNum * yNum) - 1;
00033
00034 for (modID = 0; modID <= maxModId; modID++) {
00035 for (iplane = 0; iplane < num_conv; iplane++) {
00036
00037 bool flag=false;
00038 float lastHit, lastZ = 99999.99f;
00039 int index = modID*1000+iplane;
00040 for(HitMap::const_iterator it = Pos[index].begin(); it != Pos[index].end(); it++){
00041 if(!flag) {
00042 lastHit = (*it).first;
00043 lastZ = (*it).second;
00044 flag = true;
00045 continue;
00046 }
00047 float xP = (*it).first;
00048 float zP = (*it).second;
00049
00050 if ( abs(lastHit - xP) <= strip_pitch ) {
00051 cluster[lastHit] = lastZ;
00052 } else {
00053 if (cluster.size() >= min_cluster_size) {
00054 for(HitMap::const_iterator it = cluster.begin(); it != cluster.end(); it++){
00055
00056 addData((*it).first, (*it).second, 1/(strip_pitch*strip_pitch));
00057 ++numHitsUsed;
00058 }
00059 }
00060 cluster.clear();
00061 }
00062 lastHit = xP;
00063 lastZ = zP;
00064 }
00065 }
00066 }
00067
00068 doFit();
00069 }