#include <Alignment/CocoaModel/interface/MeasurementDistancemeter.h>
Public Member Functions | |
virtual void | calculateSimulatedValue (ALIbool firstTime) |
virtual void | correctValueAndSigma () |
MeasurementDistancemeter () | |
MeasurementDistancemeter (const ALIint measdim, ALIstring &type, ALIstring &name) | |
virtual void | setConversionFactor (const std::vector< ALIstring > &wordlist) |
~MeasurementDistancemeter () | |
Private Attributes | |
ALIdouble | theFactor |
ALIdouble | theFactorSigma |
Definition at line 18 of file MeasurementDistancemeter.h.
MeasurementDistancemeter::MeasurementDistancemeter | ( | const ALIint | measdim, | |
ALIstring & | type, | |||
ALIstring & | name | |||
) | [inline] |
Definition at line 21 of file MeasurementDistancemeter.h.
00022 : Measurement( measdim, type, name ), theFactor(1.), theFactorSigma(0.){};
MeasurementDistancemeter::MeasurementDistancemeter | ( | ) | [inline] |
MeasurementDistancemeter::~MeasurementDistancemeter | ( | ) | [inline] |
Reimplemented from Measurement.
Definition at line 25 of file MeasurementDistancemeter.cc.
References begin, TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, ALIUtils::debug, Measurement::DumpBadOrderOptOs(), lat::endl(), exception, ALIUtils::getFirstTime(), GlobalOptionMgr::getInstance(), Measurement::getMeasuringBehaviour(), GlobalOptionMgr::GlobalOptions(), Measurement::name(), Measurement::OptOList(), LightRay::point(), Measurement::printStartCalculateSimulatedValue(), size, and Measurement::type().
00026 { 00027 00028 if( ALIUtils::debug >= 2) printStartCalculateSimulatedValue( this ); // important for Examples/FakeMeas 00029 00030 //---------- Loop list of OptO that take part in measurement 00031 std::vector<OpticalObject*>::const_iterator vocite = OptOList().begin(); 00032 if( ALIUtils::debug >= 5) std::cout << "OptOList size" <<OptOList().size() << std::endl; 00033 00034 //----- Check that there are only two measurements that are 'distance_target' and 'distancemeter' 00035 ALIbool right_objects = 0; 00036 if( OptOList().size() == 2 ) { 00037 if( (*vocite)->type() == "distance_target" 00038 && ( (*(vocite+1))->type() == "distancemeter" || 00039 (*(vocite+1))->type() == "distancemeter1dim" ) ) { 00040 right_objects = 1; 00041 } 00042 } 00043 if( !right_objects ) { 00044 std::cerr << "!!! ERROR in MeasurementDistancemeter: " << name() << " There should only be two objects of type 'distance_target' and 'distancemeter' " << std::endl; 00045 std::cerr << " 1st " << (*vocite)->name() << " 2nd " << (*vocite+1)->name() << std::endl; 00046 std::cerr << " 1st " << (*vocite)->type() << " 2nd " << (*vocite+1)->type() << std::endl; 00047 00048 DumpBadOrderOptOs(); 00049 std::exception(); 00050 } 00051 00052 #ifdef COCOA_VIS 00053 ALIVisLightPath* vispath = 0; 00054 if( ALIUtils::getFirstTime() ) { 00055 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance(); 00056 if(gomgr->GlobalOptions()["VisWriteIguana"] > 1) { 00057 vispath = IgCocoaFileMgr::getInstance().newLightPath( name() ); 00058 } 00059 } 00060 #endif 00061 00062 ALIuint isec = 0; //security variable to check OptOList().size() 00063 for( vocite = OptOList().begin(); vocite != OptOList().end(); vocite++) { 00064 if( ALIUtils::debug >= 2) std::cout << std::endl << "@@@@ LR:OBJECT " << (*vocite)->name() << std::endl; 00065 isec ++; 00066 00067 //---------- Get the behaviour of the object w.r.t the measurement (if it reflects the light, let it traverse it, ...) 00068 ALIstring behav = getMeasuringBehaviour(vocite); 00069 00070 //---------- participate in measurement 00071 LightRay lightray; //it is not used in this measurement type 00072 (*vocite)->participateInMeasurement( lightray, *this, behav); 00073 00074 #ifdef COCOA_VIS 00075 if( ALIUtils::getFirstTime() ) { 00076 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance(); 00077 if(gomgr->GlobalOptions()["VisWriteVRML"] > 1) { 00078 ALIVRMLMgr::getInstance().addLightPoint( lightray.point() ); 00079 if(ALIUtils::debug >= 5)std::cout << "ALIVRMLMg addLightPoint " << lightray.point() << (*vocite)->name() << std::endl; 00080 } 00081 if(gomgr->GlobalOptions()["VisWriteIguana"] > 1) { 00082 vispath->addLightPoint( lightray.point(), *vocite ); 00083 } 00084 } 00085 #endif 00086 00087 if ( isec > OptOList().size() ) { 00088 std::cerr << "ERROR DE PROGRAMACION EN GetSimulatedValue" << std::endl; 00089 std::exception(); 00090 } 00091 } 00092 00093 if(ALIUtils::debug >= 5) std::cout << "end calculateSimulatedValue" <<std::endl; 00094 00095 }
void MeasurementDistancemeter::correctValueAndSigma | ( | ) | [virtual] |
Reimplemented from Measurement.
Definition at line 138 of file MeasurementDistancemeter.cc.
References GenMuonPlsPt100GeV_cfg::cout, ALIUtils::debug, lat::endl(), Measurement::setSigma(), Measurement::setValue(), Measurement::sigma(), theFactor, and Measurement::value().
00139 { 00140 ALIdouble val = value()[0]; 00141 ALIdouble sig = sigma()[0]; 00142 if(ALIUtils::debug >= 4) std::cout << "MeasurementDistancemeter::correctValueAndSigma: old value" << val << " +- " << sig << std::endl; 00143 00144 //- std::cout << "FACTOR " << theFactor << "correct " << val << " " << thePedestal << std::endl; 00145 val *= theFactor; 00146 //-------- Do not correct the sigma!!!! 00147 //- sig *= theFactor; 00148 if(ALIUtils::debug >= 4) std::cout << "MeasuremenDistancemeter::correctValueAndSigma: new value " << val << " +- " << sig << std::endl; 00149 setValue( 0, val ); 00150 setSigma( 0, sig ); 00151 00152 }
void MeasurementDistancemeter::setConversionFactor | ( | const std::vector< ALIstring > & | wordlist | ) | [virtual] |
Reimplemented from Measurement.
Definition at line 103 of file MeasurementDistancemeter.cc.
References TestMuL1L2Filter_cff::cerr, ALIUtils::dumpVS(), lat::endl(), exception, GlobalOptionMgr::getInstance(), GlobalOptionMgr::GlobalOptions(), ALIUtils::IsNumber(), theFactor, and theFactorSigma.
00104 { 00105 //--------- Check that the format is OK 00106 if(wordlist.size() == 1) return; 00107 if( wordlist.size() != 4 00108 || !ALIUtils::IsNumber(wordlist[1]) || !ALIUtils::IsNumber(wordlist[3]) 00109 || wordlist[2] != ALIstring("+-") ){ 00110 std::cerr << "!! Distancemeter Measurement setConversionFactor: WRONG FORMAT "<< std::endl 00111 << "It should be: DISTANCEMETER factor +- error " << std::endl 00112 << "It is: "; 00113 ALIUtils::dumpVS( wordlist, " ", std::cerr ); 00114 std::exception(); 00115 } 00116 theFactor = atof(wordlist[1].c_str()); 00117 //------ correct by dimension of value of tiltmeter 00118 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance(); 00119 ALIint dimfac = ALIint( gomgr->GlobalOptions()[ ALIstring("distancemeter_meas_value_dimension") ] ); 00120 if( dimfac == 0 ) { 00121 theFactor *= 1.; 00122 } else if( dimfac == 1 ) { 00123 theFactor *= 1.E-3; 00124 } else if( dimfac == 2 ) { 00125 theFactor *= 1.E-6; 00126 } else { 00127 std::cerr << " !!!EXITING: error in global option distancemeter_meas_value_dimension, it can only take values 0,1,2, not " << dimfac; 00128 std::exception(); 00129 } 00130 theFactorSigma = atof(wordlist[3].c_str()); 00131 00132 }
ALIdouble MeasurementDistancemeter::theFactor [private] |
Definition at line 36 of file MeasurementDistancemeter.h.
Referenced by correctValueAndSigma(), and setConversionFactor().