--- calo/flight/CaloFranzini/src/Calib.cpp 2008/01/12 10:31:38 1.5 +++ calo/flight/CaloFranzini/src/Calib.cpp 2008/01/15 12:41:38 1.6 @@ -600,10 +600,12 @@ // // Int_t mindgf = 48; // Int_t dgf = 143; - Int_t mindgf = 0; - Int_t dgf = 191; - // Int_t mindgf = 85; - // Int_t dgf = 115; +// Int_t mindgf = 0; //tutto +// Int_t dgf = 191; //tutto +// Int_t mindgf = 94; +// Int_t dgf = 96; + Int_t mindgf = 84; + Int_t dgf = 106; Int_t cs = 0; Int_t cd = 0; Int_t mstrip = 0; @@ -716,6 +718,7 @@ // (*fmatrix[rbi])[mi][mj] += (mipv[nplane1][mstrip1] - cf->GetFullAverageAt(nplane1,mstrip1,erig)) * (mipv[nplane2][mstrip2] - cf->GetFullAverageAt(nplane2,mstrip2,erig)); // (*fnmat[rbi])[mi][mj] += 1.; (*fmatrix)[mi][mj] += (mip1 * mip2); // giusto +// (*fmatrix)[mi][mj] += (mip1 * mip2) * 1000000.; toto++; // (*fmatrix)[mi][mj] += 1.; // cf->GetFullAverageAt(nplane1,mstrip1,erig,rbi); @@ -822,8 +825,11 @@ // }; // }; // +// TMatrixF *mymat = new TMatrixF(129,129); + TMatrixF *mymat = new TMatrixF(989,989); Int_t i1 = -1; Int_t j1 = -1; + int mi,mj; Int_t nonzero = 0; Int_t nonzero1 = 0; for (Int_t ii=0; ii<43; ii++){ @@ -843,12 +849,25 @@ // if ( finmat[ii][j] > 0 ){ // (*fmatrix)[i1][j1] /= finmat[ii][j]; if ( (*fnmat[i])[ii][j] == 0. || (*fmatrix)[i1][j1] == 0. || !((*fmatrix)[i1][j1] == (*fmatrix)[i1][j1]) ){ - (*fmatrix)[i1][j1] = 0.; + (*fmatrix)[i1][j1] = 1.; } else { (*fmatrix)[i1][j1] /= (*fnmat[i])[ii][j]; nonzero++; if ( i1 == 0 ) nonzero1++; }; + // if ( j>=94 && j <=96 && jj >=94 && jj<=96 ){ + // mi = (ii*3) + j -94; + // mj = (iij*3) + jj -94; + // (*mymat)[mi][mj] = (*fmatrix)[i1][j1]; + // }; + + + if ( j>=84 && j <=106 && jj >=84 && jj<=106 ){ + mi = (ii*3) + j -84; + mj = (iij*3) + jj -84; + (*mymat)[mi][mj] = (*fmatrix)[i1][j1]; + }; + }; }; }; @@ -900,6 +919,18 @@ printf(" Bin %i determinant is %f \n",i,det); cf->WriteInvertedFullMatrix((TMatrixF)invmatrix,i); }; + + if ( mymat->Determinant() == 0. ){ + printf(" ERROR: the matrix at bin %i is singular, determinant = 0., it cannot be inverted! \n",i); + } else { + Double_t det = 0.; + TMatrixF invmatrix = (TMatrixF)(mymat->Invert(&det)); + printf(" Bin %i determinant is %f \n",i,det); + cf->WriteInvertedFullMatrix((TMatrixF)invmatrix,i); + }; + cf->WriteFullMatrix(mymat, 99); + + // cf->UnLoadFullMatrix(i); // cf->UnLoadFullNMatrix(i);