#include <MeasurementSensor2D.h>
Public Member Functions | |
virtual void | calculateSimulatedValue (ALIbool firstTime) |
virtual void | correctValueAndSigma () |
MeasurementSensor2D (const ALIint measdim, ALIstring &type, ALIstring &name) | |
MeasurementSensor2D () | |
virtual void | setConversionFactor (const std::vector< ALIstring > &wordlist) |
~MeasurementSensor2D () | |
Private Attributes | |
ALIdouble | theDisplaceX |
ALIdouble | theDisplaceY |
ALIdouble | theMultiplyX |
ALIdouble | theMultiplyY |
Definition at line 18 of file MeasurementSensor2D.h.
MeasurementSensor2D::MeasurementSensor2D | ( | const ALIint | measdim, |
ALIstring & | type, | ||
ALIstring & | name | ||
) | [inline] |
Definition at line 21 of file MeasurementSensor2D.h.
: Measurement( measdim, type, name ){ };
MeasurementSensor2D::MeasurementSensor2D | ( | ) | [inline] |
Definition at line 22 of file MeasurementSensor2D.h.
{ };
MeasurementSensor2D::~MeasurementSensor2D | ( | ) | [inline] |
Definition at line 23 of file MeasurementSensor2D.h.
{ };
void MeasurementSensor2D::calculateSimulatedValue | ( | ALIbool | firstTime | ) | [virtual] |
Reimplemented from Measurement.
Definition at line 25 of file MeasurementSensor2D.cc.
References benchmark_cfg::cerr, gather_cfg::cout, ALIUtils::debug, Measurement::DumpBadOrderOptOs(), end, cmsRelvalreport::exit, ALIUtils::getFirstTime(), GlobalOptionMgr::getInstance(), Measurement::getMeasuringBehaviour(), GlobalOptionMgr::GlobalOptions(), Measurement::name(), Measurement::OptOList(), LightRay::point(), Measurement::printStartCalculateSimulatedValue(), and findQualityFiles::size.
{ if( ALIUtils::debug >= 2) printStartCalculateSimulatedValue( this ); // important //---------- Create light ray LightRay* lightray = new LightRay; int isec = 0; //security variable to check OptOList().size() //---------- Loop list of OptO that take part in measurement std::vector<OpticalObject*>::const_iterator vocite = OptOList().begin(); //- if( ALIUtils::debug >= 5) std::cout << "OptOList size" <<OptOList().size() << std::endl; //----- Check that first object is 'laser' or 'source' if( (*vocite)->type() != "laser" && (*vocite)->type() != "source" ) { std::cerr << " first Optical object should be 'laser' or 'source'" << std::endl; DumpBadOrderOptOs(); exit(1); } #ifdef COCOA_VIS ALIVisLightPath* vispath = 0; if( ALIUtils::getFirstTime() ) { GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance(); if(gomgr->GlobalOptions()["VisWriteIguana"] > 1) { vispath = IgCocoaFileMgr::getInstance().newLightPath( name() ); } } #endif //- while( (*vocite) != *(OptOList().end()) ) { while( (vocite) != (OptOList().end()) ) { if( ALIUtils::debug >= 2) std::cout << std::endl << "@@@@ LR:OBJECT " << (*vocite)->name() << std::endl; isec ++; //---------- Get the behaviour of the object w.r.t the measurement (if it reflects the light, let it traverse it, ...) ALIstring behav = getMeasuringBehaviour(vocite); //---------- Check that last object is a Sensor (that makes measuremnt and kill the lightray) if( lightray ) { (*vocite)->participateInMeasurement( *lightray, *this, behav ); #ifdef COCOA_VIS if( ALIUtils::getFirstTime() ) { GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance(); if(gomgr->GlobalOptions()["VisWriteVRML"] > 1) { ALIVRMLMgr::getInstance().addLightPoint( lightray->point() ); if(ALIUtils::debug >= 5)std::cout << "ALIVRMLMg addLightPoint " << lightray->point() << (*vocite)->name() << std::endl; } if(gomgr->GlobalOptions()["VisWriteIguana"] > 1) { vispath->addLightPoint( lightray->point(), (*vocite) ); } } #endif } else { std::cerr << "!! Last object is not Sensor 2D in measurement " << name() << std::endl; DumpBadOrderOptOs(); exit(1); } vocite++; if ( isec > ALIint(OptOList().size()) ) { std::cerr << "ERROR DE PROGRAMACION EN GetSimulatedValue" << std::endl; exit(5); } //- lightray.normalizeDirection(); } delete lightray; if(ALIUtils::debug >= 9) std::cout << "end calculateSimulatedValue" <<std::endl; }
void MeasurementSensor2D::correctValueAndSigma | ( | ) | [virtual] |
Reimplemented from Measurement.
Definition at line 139 of file MeasurementSensor2D.cc.
References gather_cfg::cout, ALIUtils::debug, Measurement::setValue(), theDisplaceX, theDisplaceY, theMultiplyX, theMultiplyY, and Measurement::value().
{ //---------- Make displacement ALIdouble val = value()[0]; val += theDisplaceX; val *= theMultiplyX; //- std::cout << " theDisplaceX " << theDisplaceX << " theMultiplyX " << theMultiplyX << std::endl; if(ALIUtils::debug >= 4) std::cout << "MeasurementSensor2D::correctValueAndSigma: " << " old value X " << value()[0] << " new " << val << std::endl; setValue( 0, val ); val = value()[1]; val += theDisplaceY; val *= theMultiplyY; if(ALIUtils::debug >= 4) std::cout << "MeasurementSensor2D::correctValueAndSigma: old value Y " << value()[1] << " new " << val << std::endl; setValue( 1, val ); }
void MeasurementSensor2D::setConversionFactor | ( | const std::vector< ALIstring > & | wordlist | ) | [virtual] |
Reimplemented from Measurement.
Definition at line 106 of file MeasurementSensor2D.cc.
References benchmark_cfg::cerr, ALIUtils::dumpVS(), cmsRelvalreport::exit, ALIUtils::IsNumber(), theDisplaceX, theDisplaceY, theMultiplyX, theMultiplyY, and Measurement::valueDimensionFactor().
{ //--------- Check that the format is OK theDisplaceX = 0; theDisplaceY = 0; theMultiplyX = 1.; theMultiplyY = 1.; //- std::cout << " 0 factors for correction X = " << theDisplaceX << " Y " << theDisplaceY << std::endl; if(wordlist.size() == 1) return; if( (wordlist.size() != 3 && wordlist.size() != 5 ) || !ALIUtils::IsNumber(wordlist[1]) || !ALIUtils::IsNumber(wordlist[2]) ) { std::cerr << "!! Sensor2D Measurement setConversionFactor: WRONG FORMAT "<< std::endl << "It should be: SENSOR2D displace_X displace_Y " << std::endl << "It is: "; ALIUtils::dumpVS( wordlist, " ", std::cerr ); exit(1); } theDisplaceX = atof(wordlist[1].c_str())* valueDimensionFactor(); theDisplaceY = atof(wordlist[2].c_str())* valueDimensionFactor(); //- std::cout << " factors for correction X = " << theDisplaceX << " Y " << theDisplaceY << std::endl; if( wordlist.size() == 5 ) { theMultiplyX = atof(wordlist[3].c_str()); theMultiplyY = atof(wordlist[4].c_str()); } else { theMultiplyX = 1.; theMultiplyY = 1.; } }
ALIdouble MeasurementSensor2D::theDisplaceX [private] |
Definition at line 36 of file MeasurementSensor2D.h.
Referenced by correctValueAndSigma(), and setConversionFactor().
ALIdouble MeasurementSensor2D::theDisplaceY [private] |
Definition at line 36 of file MeasurementSensor2D.h.
Referenced by correctValueAndSigma(), and setConversionFactor().
ALIdouble MeasurementSensor2D::theMultiplyX [private] |
Definition at line 37 of file MeasurementSensor2D.h.
Referenced by correctValueAndSigma(), and setConversionFactor().
ALIdouble MeasurementSensor2D::theMultiplyY [private] |
Definition at line 37 of file MeasurementSensor2D.h.
Referenced by correctValueAndSigma(), and setConversionFactor().