25 if(
verbose >= 3)
std::cout <<
"DeviationsFromFileSensor2D::readFile " <<
this << ifdevi.
name() << std::endl;
34 std::vector<ALIstring> wl;
49 if(ifdevi.
eof() )
break;
64 std::cerr <<
"!!!EXITING first scan direction has to be Y for the moment " << ifdevi.
name() << std::endl;
70 if( dev->
posY() > oldposY ) {
77 if( dev->
posX() > oldposX ) {
97 if( dev->
posY() > oldposY ) {
104 if( dev->
posX() > oldposX ) {
113 oldposX = dev->
posX();
114 oldposY = dev->
posY();
117 vcol.push_back( dev );
126 if( vsiz != dvsiz ) {
127 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;
144 if(
verbose >= 4)
std::cout <<
" entering getdevis " << intersX <<
" " <<intersY <<
" " <<
this << std::endl;
145 vvd::iterator vvdite;
159 auto yrows = std::make_unique<unsigned int[]>(
theNPoints);
164 for( vdite = (*vvdite).begin(); vdite != ((*vvdite).end()-1); ++vdite ){
165 if(
verbose >= 5 )
std::cout <<
" check posy " << (*(vdite))->posY() <<
" " << (*(vdite+1))->posY() <<
" " << (*(vdite)) << std::endl;
173 yrows[
ii] = vdite - (*vvdite).begin();
174 if(
verbose >= 3 )
std::cout << intersY <<
" DeviationsFromFileSensor2D yrows " << ii <<
" " << yrows[
ii] <<
" : " << (*(vdite))->posY() << std::endl;
181 if(insideMatrix == 0) {
182 std::cerr <<
"!!EXITING intersection in Y outside matrix of deviations from file " << intersY << std::endl;
200 thePoints.push_back( dev1 );
201 thePoints.push_back( dev2 );
203 if(
verbose >= 3 )
std::cout <<
" column up " << ii <<
" " << dev1->
posX() <<
" " << dev2->
posX() <<
" : " << intersX << std::endl;
207 if(rn == theNPoints) rn = theNPoints-1;
209 rn = yrows[ii+1] + 1;
210 if(rn == theNPoints) rn = theNPoints-1;
214 thePoints.push_back( dev1 );
215 thePoints.push_back( dev2 );
216 if(
verbose >= 3 )
std::cout <<
" column down " << ii <<
" " << dev1->
posX() <<
" " << dev2->
posX() <<
" : " << intersX << std::endl;
219 if( thePoints.size() == 4 )
break;
223 if(insideMatrix == 0) {
224 std::cerr <<
"!!EXITING intersection in X outside matrix of deviations from file " << intersX << std::endl;
231 ALIdouble dist, disttot=0, deviX=0, deviY=0;
233 if(
verbose >= 4)
std::cout <<
" thepoints size " << thePoints.size() << std::endl;
235 for( ii = 0; ii < 4; ii++) {
236 dist =
sqrt(
pow(thePoints[ii]->
posX() - intersX, 2 ) +
pow(thePoints[ii]->
posY() - intersY, 2 ) );
238 deviX += thePoints[
ii]->devX()/dist;
239 deviY += thePoints[
ii]->devY()/dist;
242 std::cout << ii <<
" distances: " << dist <<
" " << deviX <<
" " << deviY <<
" devX " << thePoints[
ii]->devX() <<
" devY " << thePoints[
ii]->devY() << std::endl;
252 std::cout <<
" devisX/Y: " << deviX <<
" " << deviY
253 <<
" intersX/Y " << intersX <<
" " << intersY << std::endl;
259 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)