16 #include "Alignment/CocoaVisMgr/interface/ALIVRMLMgr.h"
17 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
28 using namespace CLHEP;
35 makeMeasurement( lightray, meas);
54 CLHEP::Hep3Vector ZAxis(0.,0,1.);
55 CLHEP::HepRotation rmt = rmGlob();
63 CLHEP::Hep3Vector inters = lightray.
point();
66 interslc = convertPointToLocalCoordinates( inters );
81 CLHEP::Hep3Vector measvv( meas.
value()[0], meas.
value()[1], 0.);
89 <<
" DIFF= " << detH-1000*meas.
value()[0] <<
" " << detV-1000*meas.
value()[1] << std::endl;
93 << chrg <<
" " << meas.
valueType(1) <<
": " << detV
94 <<
" (mm) " << (
this)->
name() << std::endl;
104 ALIUtils::dump3v( 1000.*(inters - centreGlob()) ,
" $$$$$$SIMU inters - centre");
127 CLHEP::Hep3Vector ZAxis(0.,0,1.);
128 CLHEP::HepRotation rmt = rmGlob();
131 CLHEP::Hep3Vector inters = lightray.
point();
139 std::cout <<
"fdeviFromFile" << fdevi_from_file << std::endl;
146 for( ii = 0; ii < measv.size(); ii++ ) {
148 if( measv[ii]->sensorName() ==
name() ) {
154 std::cerr <<
"!!!EXITING OptOSensor2D::fastTraversesLightRay: meas " <<
name() <<
" not found " << std::endl;
164 interslcx = interslcx/df + 0.010/df;
165 interslcy = interslcy/df + 0.010/df;
169 std::pair< ALIdouble, ALIdouble> devis = deviFromFile->getDevis( interslcx, interslcy );
170 deviX = devis.second;
171 deviY = -devis.first;
179 ALIuint entryNo = extraEntryNo(
"deviX" );
181 Entry* entryDeviX = *(ExtraEntryList().begin()+entryNo);
184 std::vector< ALIdouble > eevil = ExtraEntryValueOriginalList();
186 std::vector< ALIdouble >::iterator eevolite = eevil.begin();
188 *(eevolite+entryNo) = deviX;
190 entryNo = extraEntryNo(
"deviY" );
191 Entry* entryDeviY = *(ExtraEntryList().begin()+entryNo);
194 *(eevolite+entryNo) = deviY;
198 deviX = findExtraEntryValue(
"deviX");
199 deviY = findExtraEntryValue(
"deviY");
202 if( fdevi_from_file ) {
204 ALIuint entryNo = extraEntryNo(
"deviX" );
205 Entry* entryDeviX = *(ExtraEntryList().begin()+entryNo);
206 if(
verbose >= 3 )
std::cout<< entryDeviX <<
" entryDeviX name " << entryDeviX->
name() << entryDeviX->
value() << std::endl;
207 deviX = entryDeviX->
value();
208 entryNo = extraEntryNo(
"deviY" );
209 Entry* entryDeviY = *(ExtraEntryList().begin()+entryNo);
210 if(
verbose >= 3 )
std::cout<< entryDeviY <<
" entryDeviY name " << entryDeviY->
name() << entryDeviY->
value() << std::endl;
211 deviY = entryDeviY->
value();
214 ALIbool bb = findExtraEntryValueIfExists(
"devi", devi);
222 std::cout <<
"devi " << devi <<
" devi x " << deviX <<
" devi y " << deviY << std::endl;
229 lightray.
dumpData(
"Shifted and Deviated");
244 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;
251 CLHEP::Hep3Vector ZAxis(0.,0,1.);
252 CLHEP::HepRotation rmt = rmGlob();
255 CLHEP::Hep3Vector inters = lightray.
point();
258 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
268 ALIdouble refra_ind2 = findExtraEntryValueMustExist(
"refra_ind");
269 lightray.
refract( plate, refra_ind1, refra_ind2 );
273 plate = getPlate(0, 1);
275 lightray.
refract( plate, refra_ind2, refra_ind1 );
277 CLHEP::Hep3Vector inters = lightray.
point();
281 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
301 if( wordlist.size() >= 4) {
327 std::vector<ALIstring> wl;
329 sensor1_name = wl[0];
330 sensor2_name = wl[1];
331 sensor_dist = atof( wl[2].c_str() );
333 if(sensor1_name[sensor1_name.size()-2] ==
'c') {
334 sensor1_name = sensor1_name.substr(0,sensor1_name.size()-1);
336 if(sensor2_name[sensor2_name.size()-2] ==
'c') {
337 sensor2_name = sensor2_name.substr(0,sensor2_name.size()-1);
339 if(
ALIUtils::debug >= 5)
std::cout <<
"sensor1_name " << sensor1_name <<
" sensor2_name " << sensor2_name <<
" sensor_dist " << sensor_dist <<
" unknown " << wl[3] << std::endl;
342 prec_deviX = atof( wl[0].c_str() );
343 prec_deviY = atof( wl[1].c_str() );
349 if( wl.size() == 5 ) {
352 deviFromFile->setOffset( offsetX, offsetY );
354 deviFromFile->readFile( ifdevi );
360 std::vector<ALIstring> wlo;
362 wlo.push_back( wordlist[0] );
363 wlo.push_back(
"deviX");
365 gcvt( prec_deviX, 10, chartmp );
367 wlo.push_back(
"cal");
368 std::vector<ALIstring> wl2(wlo);
372 gcvt( prec_deviY, 10, chartmp );
390 CLHEP::HepRotation rmt = rmGlob();
391 CLHEP::Hep3Vector XAxism(1.,0.,0.);
397 interslc[0] = (point - (
this)->centreGlob() ) * XAxism;
400 CLHEP::Hep3Vector YAxism(0.,1.,0.);
404 interslc[1] = (point - (
this)->centreGlob() ) * YAxism;
407 std::cout <<
" intersection in local coordinates: X= " << interslc[0] <<
" Y= " << interslc[1] << std::endl;
418 ALIVRMLMgr& vrmlmgr = ALIVRMLMgr::getInstance();
419 ALIColour* col =
new ALIColour( 0., 0., 1., 0. );
420 vrmlmgr.AddBox( *
this, 1., 1., .2, col);
421 vrmlmgr.SendReferenceFrame( *
this, 0.6);
422 vrmlmgr.SendName( *
this, 0.1 );
429 ALIColour* col =
new ALIColour( 0., 0., 1., 0. );
430 std::vector<ALIdouble> spar;
434 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 setValue(ALIdouble val)
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)
void setValueSimulated(ALIint coor, ALIdouble value)
virtual void defaultBehaviour(LightRay &lightray, Measurement &meas)
void setLightRayDirection(const CLHEP::Hep3Vector &lightRayDirection)
void refract(const ALIPlane plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
static void setApply(ALIbool val)
const ALIstring & name() const
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()