Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ClusterFit.cxx

Go to the documentation of this file.
00001 // $Id: ClusterFit.cxx,v 1.6 2000/12/07 20:10:01 burnett Exp $
00002 
00003 
00004 #include "reconstruction/ClusterFit.h"
00005 
00006 //#include "instrument/SiTracker.h"
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     // Inputs: 
00019     //          HitMap Pos - map of coordinates using the ModId and Plane #
00020     //
00021     // Computes the LSQ fit using the hits contained in Pos
00022     //  First finds all clusters of hits - within one strip pitch of each other in a plane
00023     //  Then computes the LSQ fit of all the hits in clusters.
00024     
00025     const int num_conv = number_of_trays-1;
00026     numHitsUsed = 0; // initialize 
00027     float strip_pitch = si_strip_pitch;
00028     // loop thru all towers and planes and hits
00029     int modID, iplane;
00030     HitMap cluster;
00031     unsigned int min_cluster_size = 6; //SiTracker::siMinCluster(); not updating instrument
00032     const int maxModId = (xNum * yNum) - 1;
00033 
00034     for (modID = 0; modID <= maxModId; modID++) {
00035         for (iplane = 0; iplane < num_conv; iplane++) {
00036             // find a cluster of min_cluster_size or more within one plane
00037             bool flag=false;
00038             float lastHit, lastZ = 99999.99f; // make sure it gets reset
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;   // just pick up the first hit in this plane and go get the 2nd
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 {  // No cluster OR we need to load the current cluster and delete the map
00053                     if (cluster.size() >= min_cluster_size) {
00054                         for(HitMap::const_iterator it = cluster.begin(); it != cluster.end(); it++){
00055                             // Change weights based on cluster size?
00056                             addData((*it).first, (*it).second, 1/(strip_pitch*strip_pitch));
00057                             ++numHitsUsed;
00058                         }
00059                     }
00060                     cluster.clear();
00061                 } // end if
00062                 lastHit = xP;
00063                 lastZ = zP;
00064             }  // end for
00065         }  // end for
00066     }  // end for
00067 
00068     doFit();  // call LSQfit
00069 }

Generated at Wed Nov 21 12:20:43 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000