/*----------------------------------------------------------------*/ /* Routines which find the Shower Detector Plane Normal Vector. Version 11-00. Brian Fick and Paul Sommers */ #include #include #include #include #include "shwaxis.h" #include "PlaneFit.h" float cen[3], top[3] ; void GuessPlane(void) ; void DoPlaneFit(void) ; void PlaneFit(void) ; /*----------------------------------------------------------------*/ void DoPlaneFit(void){ /* Makes the interface between the global data structures and the local data used by the fitting routines. */ int i, j ; /* Isolate the variables to be used by the fitting routine */ npix = event.ntb ; for(i=0;i summax) { for (j=0;j<3;++j) { pln[j] = vec[i][j] ; } summax = sum ; } } } /*----------------------------------------------------------------*/ /* Figure of merit function for best plane fit */ /* The two components of *xp are coefficients for directions cen and top */ float FunNormal(float *xp) { int i ; float pl[3] ; float adif ; float wt ; float val ; val = 0.0 ; wt = 0.0 ; pl[0] = pln[0]+*xp*cen[0]+*(xp+1)*top[0] ; pl[1] = pln[1]+*xp*cen[1]+*(xp+1)*top[1] ; pl[2] = pln[2]+*xp*cen[2]+*(xp+1)*top[2] ; v_norm(pl) ; for (i=0; i