16 #include "Alignment/CocoaVisMgr/interface/ALIVRMLMgr.h" 17 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h" 29 using namespace CLHEP;
36 makeMeasurement( lightray, meas);
55 CLHEP::Hep3Vector ZAxis(0.,0,1.);
56 CLHEP::HepRotation rmt = rmGlob();
64 CLHEP::Hep3Vector inters = lightray.
point();
67 interslc = convertPointToLocalCoordinates( inters );
82 CLHEP::Hep3Vector measvv( meas.
value()[0], meas.
value()[1], 0.);
90 <<
" DIFF= " << detH-1000*meas.
value()[0] <<
" " << detV-1000*meas.
value()[1] << std::endl;
94 << chrg <<
" " << meas.
valueType(1) <<
": " << detV
95 <<
" (mm) " << (
this)->
name() << std::endl;
105 ALIUtils::dump3v( 1000.*(inters - centreGlob()) ,
" $$$$$$SIMU inters - centre");
128 CLHEP::Hep3Vector ZAxis(0.,0,1.);
129 CLHEP::HepRotation rmt = rmGlob();
132 CLHEP::Hep3Vector inters = lightray.
point();
140 std::cout <<
"fdeviFromFile" << fdevi_from_file << std::endl;
147 for( ii = 0; ii < measv.size(); ii++ ) {
149 if( measv[ii]->sensorName() ==
name() ) {
155 std::cerr <<
"!!!EXITING OptOSensor2D::fastTraversesLightRay: meas " <<
name() <<
" not found " << std::endl;
165 interslcx = interslcx/df + 0.010/df;
166 interslcy = interslcy/df + 0.010/df;
170 std::pair< ALIdouble, ALIdouble> devis = deviFromFile->getDevis( interslcx, interslcy );
171 deviX = devis.second;
172 deviY = -devis.first;
180 ALIuint entryNo = extraEntryNo(
"deviX" );
182 Entry* entryDeviX = *(ExtraEntryList().begin()+entryNo);
183 entryDeviX->setValue( deviX );
185 std::vector< ALIdouble > eevil = ExtraEntryValueOriginalList();
187 std::vector< ALIdouble >::iterator eevolite = eevil.begin();
189 *(eevolite+entryNo) = deviX;
190 if(
verbose >= 3 )
std::cout<<
" entryDeviX name " << entryDeviX->name() << entryDeviX->value() << std::endl;
191 entryNo = extraEntryNo(
"deviY" );
192 Entry* entryDeviY = *(ExtraEntryList().begin()+entryNo);
194 entryDeviY->setValue( deviY );
195 *(eevolite+entryNo) = deviY;
199 deviX = findExtraEntryValue(
"deviX");
200 deviY = findExtraEntryValue(
"deviY");
203 if( fdevi_from_file ) {
205 ALIuint entryNo = extraEntryNo(
"deviX" );
206 Entry* entryDeviX = *(ExtraEntryList().begin()+entryNo);
207 if(
verbose >= 3 )
std::cout<< entryDeviX <<
" entryDeviX name " << entryDeviX->name() << entryDeviX->value() << std::endl;
208 deviX = entryDeviX->value();
209 entryNo = extraEntryNo(
"deviY" );
210 Entry* entryDeviY = *(ExtraEntryList().begin()+entryNo);
211 if(
verbose >= 3 )
std::cout<< entryDeviY <<
" entryDeviY name " << entryDeviY->name() << entryDeviY->value() << std::endl;
212 deviY = entryDeviY->value();
215 ALIbool bb = findExtraEntryValueIfExists(
"devi", devi);
223 std::cout <<
"devi " << devi <<
" devi x " << deviX <<
" devi y " << deviY << std::endl;
230 lightray.
dumpData(
"Shifted and Deviated");
245 if(
ALIUtils::debug >= 0 )
std::cerr <<
"!!WARNING: sensor " <<
name() <<
" has read deviation from file and it will not be taken into account. Please use FAST TRAVERSES" << deviFromFile << std::endl;
252 CLHEP::Hep3Vector ZAxis(0.,0,1.);
253 CLHEP::HepRotation rmt = rmGlob();
256 CLHEP::Hep3Vector inters = lightray.
point();
259 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
269 ALIdouble refra_ind2 = findExtraEntryValueMustExist(
"refra_ind");
270 lightray.
refract( plate, refra_ind1, refra_ind2 );
274 plate = getPlate(0, 1);
276 lightray.
refract( plate, refra_ind2, refra_ind1 );
278 CLHEP::Hep3Vector inters = lightray.
point();
282 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
302 if( wordlist.size() >= 4) {
328 std::vector<ALIstring> wl;
330 sensor1_name = wl[0];
331 sensor2_name = wl[1];
332 sensor_dist = atof( wl[2].c_str() );
334 if(sensor1_name[sensor1_name.size()-2] ==
'c') {
335 sensor1_name = sensor1_name.substr(0,sensor1_name.size()-1);
337 if(sensor2_name[sensor2_name.size()-2] ==
'c') {
338 sensor2_name = sensor2_name.substr(0,sensor2_name.size()-1);
340 if(
ALIUtils::debug >= 5)
std::cout <<
"sensor1_name " << sensor1_name <<
" sensor2_name " << sensor2_name <<
" sensor_dist " << sensor_dist <<
" unknown " << wl[3] << std::endl;
343 prec_deviX = atof( wl[0].c_str() );
344 prec_deviY = atof( wl[1].c_str() );
350 if( wl.size() == 5 ) {
353 deviFromFile->setOffset( offsetX, offsetY );
355 deviFromFile->readFile( ifdevi );
361 std::vector<ALIstring> wlo;
363 wlo.push_back( wordlist[0] );
364 wlo.push_back(
"deviX");
366 gcvt( prec_deviX, 10, chartmp );
368 wlo.push_back(
"cal");
369 std::vector<ALIstring> wl2(wlo);
373 gcvt( prec_deviY, 10, chartmp );
391 CLHEP::HepRotation rmt = rmGlob();
392 CLHEP::Hep3Vector XAxism(1.,0.,0.);
398 interslc[0] = (point - (
this)->centreGlob() ) * XAxism;
401 CLHEP::Hep3Vector YAxism(0.,1.,0.);
405 interslc[1] = (point - (
this)->centreGlob() ) * YAxism;
408 std::cout <<
" intersection in local coordinates: X= " << interslc[0] <<
" Y= " << interslc[1] << std::endl;
419 ALIVRMLMgr& vrmlmgr = ALIVRMLMgr::getInstance();
420 ALIColour*
col =
new ALIColour( 0., 0., 1., 0. );
421 vrmlmgr.AddBox( *
this, 1., 1., .2, col);
422 vrmlmgr.SendReferenceFrame( *
this, 0.6);
423 vrmlmgr.SendName( *
this, 0.1 );
430 ALIColour*
col =
new ALIColour( 0., 0., 1., 0. );
431 std::vector<ALIdouble> spar;
435 IgCocoaFileMgr::getInstance().addSolid( *
this,
"BOX", spar, col);
static ALIFileIn & getInstance(const ALIstring &name)
virtual void fillExtraEntry(std::vector< ALIstring > &wordlist)
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
const ALIstring valueType(ALIuint ii) const
static void dumprm(const CLHEP::HepRotation &rm, const std::string &msg, std::ostream &out=std::cout)
static const ALIbool apply()
void refract(const ALIPlane &plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
static GlobalOptionMgr * getInstance()
static double getFloat(const ALIstring &str)
Convert a string to an float, checking that it is really a number.
virtual void makeMeasurement(LightRay &lightray, Measurement &meas)
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found
void setPoint(const CLHEP::Hep3Vector &point)
const CLHEP::Hep3Vector & point() const
void setLightRayPosition(const CLHEP::Hep3Vector &lightRayPosition)
virtual void fastTraversesLightRay(LightRay &lightray)
Abs< T >::type abs(const T &t)
void setValueSimulated(ALIint coor, ALIdouble value)
virtual void defaultBehaviour(LightRay &lightray, Measurement &meas)
void setLightRayDirection(const CLHEP::Hep3Vector &lightRayDirection)
static void setApply(ALIbool val)
virtual void fillExtraEntry(std::vector< ALIstring > &wordlist)
ALIint getWordsInLine(std::vector< ALIstring > &wl)
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
void intersect(const ALIPlane &plane)
virtual void fillIguana()
const ALIdouble * value() const
void dumpData(const ALIstring &str) const
const ALIdouble valueSimulated(ALIuint ii) const
virtual void detailedTraversesLightRay(LightRay &lightray)
ALIdouble * convertPointToLocalCoordinates(const CLHEP::Hep3Vector &point)
void constructSolidShape()
const CLHEP::Hep3Vector & direction() const
static std::vector< Measurement * > & MeasurementList()
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
static ALIdouble LengthValueDimensionFactor()