23 if(
verbose >= 3)
std::cout <<
"DeviationsFromFileSensor2D::readFile " <<
this << ifdevi.
name() << std::endl;
32 std::vector<ALIstring> wl;
47 if(ifdevi.
eof() )
break;
61 if( fabs( dev->
posX() - oldposX ) > fabs( dev->
posY() - oldposY ) ) {
62 std::cerr <<
"!!!EXITING first scan direction has to be Y for the moment " << ifdevi.
name() << std::endl;
68 if( dev->
posY() > oldposY ) {
75 if( dev->
posX() > oldposX ) {
95 if( dev->
posY() > oldposY ) {
102 if( dev->
posX() > oldposX ) {
111 oldposX = dev->
posX();
112 oldposY = dev->
posY();
115 vcol.push_back( dev );
124 if( vsiz != dvsiz ) {
125 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;
142 if(
verbose >= 4)
std::cout <<
" entering getdevis " << intersX <<
" " <<intersY <<
" " <<
this << std::endl;
143 vvd::iterator vvdite;
157 unsigned int* yrows =
new unsigned int[
theNPoints ];
162 for( vdite = (*vvdite).begin(); vdite != ((*vvdite).end()-1); ++vdite ){
163 if(
verbose >= 5 )
std::cout <<
" check posy " << (*(vdite))->posY() <<
" " << (*(vdite+1))->posY() <<
" " << (*(vdite)) << std::endl;
171 yrows[
ii] = vdite - (*vvdite).begin();
172 if(
verbose >= 3 )
std::cout << intersY <<
" DeviationsFromFileSensor2D yrows " << ii <<
" " << yrows[
ii] <<
" : " << (*(vdite))->posY() << std::endl;
179 if(insideMatrix == 0) {
180 std::cerr <<
"!!EXITING intersection in Y outside matrix of deviations from file " << intersY << std::endl;
198 thePoints.push_back( dev1 );
199 thePoints.push_back( dev2 );
201 if(
verbose >= 3 )
std::cout <<
" column up " << ii <<
" " << dev1->
posX() <<
" " << dev2->
posX() <<
" : " << intersX << std::endl;
205 if(rn == theNPoints) rn = theNPoints-1;
207 rn = yrows[ii+1] + 1;
208 if(rn == theNPoints) rn = theNPoints-1;
212 thePoints.push_back( dev1 );
213 thePoints.push_back( dev2 );
214 if(
verbose >= 3 )
std::cout <<
" column down " << ii <<
" " << dev1->
posX() <<
" " << dev2->
posX() <<
" : " << intersX << std::endl;
217 if( thePoints.size() == 4 )
break;
221 if(insideMatrix == 0) {
222 std::cerr <<
"!!EXITING intersection in X outside matrix of deviations from file " << intersX << std::endl;
229 ALIdouble dist, disttot=0, deviX=0, deviY=0;
231 if(
verbose >= 4)
std::cout <<
" thepoints size " << thePoints.size() << std::endl;
233 for( ii = 0; ii < 4; ii++) {
234 dist =
sqrt(
pow(thePoints[ii]->posX() - intersX, 2 ) +
pow(thePoints[ii]->posY() - intersY, 2 ) );
236 deviX += thePoints[
ii]->devX()/dist;
237 deviY += thePoints[
ii]->devY()/dist;
240 std::cout << ii <<
" distances: " << dist <<
" " << deviX <<
" " << deviY <<
" devX " << thePoints[
ii]->devX() <<
" devY " << thePoints[
ii]->devY() << std::endl;
250 std::cout <<
" devisX/Y: " << deviX <<
" " << deviY
251 <<
" intersX/Y " << intersX <<
" " << intersY << std::endl;
257 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
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)