24 if(
verbose >= 3)
std::cout <<
"DeviationsFromFileSensor2D::readFile " <<
this << ifdevi.
name() << std::endl;
33 std::vector<ALIstring> wl;
48 if(ifdevi.
eof() )
break;
63 std::cerr <<
"!!!EXITING first scan direction has to be Y for the moment " << ifdevi.
name() << std::endl;
69 if( dev->
posY() > oldposY ) {
76 if( dev->
posX() > oldposX ) {
96 if( dev->
posY() > oldposY ) {
103 if( dev->
posX() > oldposX ) {
112 oldposX = dev->
posX();
113 oldposY = dev->
posY();
116 vcol.push_back( dev );
125 if( vsiz != dvsiz ) {
126 if(
ALIUtils::debug >= 0)
std::cerr <<
"!!WARNING: error reading deviation file: number of X points <> number of Y points : Number of points in X " << dvsiz <<
" nl " << nl-1 <<
" file " << ifdevi.
name() << std::endl;
143 if(
verbose >= 4)
std::cout <<
" entering getdevis " << intersX <<
" " <<intersY <<
" " <<
this << std::endl;
144 vvd::iterator vvdite;
158 unsigned int* yrows =
new unsigned int[
theNPoints ];
163 for( vdite = (*vvdite).begin(); vdite != ((*vvdite).end()-1); ++vdite ){
164 if(
verbose >= 5 )
std::cout <<
" check posy " << (*(vdite))->posY() <<
" " << (*(vdite+1))->posY() <<
" " << (*(vdite)) << std::endl;
172 yrows[
ii] = vdite - (*vvdite).begin();
173 if(
verbose >= 3 )
std::cout << intersY <<
" DeviationsFromFileSensor2D yrows " << ii <<
" " << yrows[
ii] <<
" : " << (*(vdite))->posY() << std::endl;
180 if(insideMatrix == 0) {
181 std::cerr <<
"!!EXITING intersection in Y outside matrix of deviations from file " << intersY << std::endl;
199 thePoints.push_back( dev1 );
200 thePoints.push_back( dev2 );
202 if(
verbose >= 3 )
std::cout <<
" column up " << ii <<
" " << dev1->
posX() <<
" " << dev2->
posX() <<
" : " << intersX << std::endl;
206 if(rn == theNPoints) rn = theNPoints-1;
208 rn = yrows[ii+1] + 1;
209 if(rn == theNPoints) rn = theNPoints-1;
213 thePoints.push_back( dev1 );
214 thePoints.push_back( dev2 );
215 if(
verbose >= 3 )
std::cout <<
" column down " << ii <<
" " << dev1->
posX() <<
" " << dev2->
posX() <<
" : " << intersX << std::endl;
218 if( thePoints.size() == 4 )
break;
222 if(insideMatrix == 0) {
223 std::cerr <<
"!!EXITING intersection in X outside matrix of deviations from file " << intersX << std::endl;
230 ALIdouble dist, disttot=0, deviX=0, deviY=0;
232 if(
verbose >= 4)
std::cout <<
" thepoints size " << thePoints.size() << std::endl;
234 for( ii = 0; ii < 4; ii++) {
235 dist =
sqrt(
pow(thePoints[ii]->posX() - intersX, 2 ) +
pow(thePoints[ii]->posY() - intersY, 2 ) );
237 deviX += thePoints[
ii]->devX()/dist;
238 deviY += thePoints[
ii]->devY()/dist;
241 std::cout << ii <<
" distances: " << dist <<
" " << deviX <<
" " << deviY <<
" devX " << thePoints[
ii]->devX() <<
" devY " << thePoints[
ii]->devY() << std::endl;
251 std::cout <<
" devisX/Y: " << deviX <<
" " << deviY
252 <<
" intersX/Y " << intersX <<
" " << intersY << std::endl;
258 return std::pair< ALIdouble, ALIdouble>( deviX*1.e-6, deviY*1
e-6 );
std::pair< ALIdouble, ALIdouble > getDevis(ALIdouble intersX, ALIdouble intersY)
void readFile(ALIFileIn &ifdevi)
std::vector< DeviationSensor2D * > vd
Abs< T >::type abs(const T &t)
ALIint getWordsInLine(std::vector< ALIstring > &wl)
void fillData(const std::vector< ALIstring > &wl)
static void dumpVS(const std::vector< ALIstring > &wl, const std::string &msg, std::ostream &outs=std::cout)
dumps a vector of strings with a message to outs
Power< A, B >::type pow(const A &a, const B &b)