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");
125 ALIdouble shiftX = findExtraEntryValue(
"shiftX");
126 ALIdouble shiftY = findExtraEntryValue(
"shiftY");
128 ALIbool bb = findExtraEntryValueIfExists(
"shift", shift);
135 CLHEP::Hep3Vector ZAxis(0.,0,1.);
136 CLHEP::HepRotation rmt = rmGlob();
139 CLHEP::Hep3Vector inters = lightray.
point();
147 std::cout <<
"fdeviFromFile" << fdevi_from_file << std::endl;
154 for( ii = 0; ii < measv.size(); ii++ ) {
156 if( measv[ii]->sensorName() ==
name() ) {
162 std::cerr <<
"!!!EXITING OptOSensor2D::fastTraversesLightRay: meas " <<
name() <<
" not found " << std::endl;
172 interslcx = interslcx/df + 0.010/df;
173 interslcy = interslcy/df + 0.010/df;
177 std::pair< ALIdouble, ALIdouble> devis = deviFromFile->getDevis( interslcx, interslcy );
178 deviX = devis.second;
179 deviY = -devis.first;
187 ALIuint entryNo = extraEntryNo(
"deviX" );
189 Entry* entryDeviX = *(ExtraEntryList().begin()+entryNo);
192 std::vector< ALIdouble > eevil = ExtraEntryValueOriginalList();
194 std::vector< ALIdouble >::iterator eevolite = eevil.begin();
196 *(eevolite+entryNo) = deviX;
198 entryNo = extraEntryNo(
"deviY" );
199 Entry* entryDeviY = *(ExtraEntryList().begin()+entryNo);
202 *(eevolite+entryNo) = deviY;
206 deviX = findExtraEntryValue(
"deviX");
207 deviY = findExtraEntryValue(
"deviY");
210 if( fdevi_from_file ) {
212 ALIuint entryNo = extraEntryNo(
"deviX" );
213 Entry* entryDeviX = *(ExtraEntryList().begin()+entryNo);
214 if(
verbose >= 3 )
std::cout<< entryDeviX <<
" entryDeviX name " << entryDeviX->
name() << entryDeviX->
value() << std::endl;
215 deviX = entryDeviX->
value();
216 entryNo = extraEntryNo(
"deviY" );
217 Entry* entryDeviY = *(ExtraEntryList().begin()+entryNo);
218 if(
verbose >= 3 )
std::cout<< entryDeviY <<
" entryDeviY name " << entryDeviY->
name() << entryDeviY->
value() << std::endl;
219 deviY = entryDeviY->
value();
222 bb = findExtraEntryValueIfExists(
"devi", devi);
230 std::cout <<
"devi " << devi <<
" devi x " << deviX <<
" devi y " << deviY << std::endl;
238 lightray.
dumpData(
"Shifted and Deviated");
253 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;
260 CLHEP::Hep3Vector ZAxis(0.,0,1.);
261 CLHEP::HepRotation rmt = rmGlob();
264 CLHEP::Hep3Vector inters = lightray.
point();
267 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
277 ALIdouble refra_ind2 = findExtraEntryValueMustExist(
"refra_ind");
278 lightray.
refract( plate, refra_ind1, refra_ind2 );
282 plate = getPlate(0, 1);
284 lightray.
refract( plate, refra_ind2, refra_ind1 );
286 CLHEP::Hep3Vector inters = lightray.
point();
290 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
310 if( wordlist.size() >= 4) {
333 ALIint sensor1_side, sensor2_side;
337 std::vector<ALIstring> wl;
339 sensor1_name = wl[0];
340 sensor2_name = wl[1];
341 sensor_dist = atof( wl[2].c_str() );
344 if(sensor1_name[sensor1_name.size()-2] ==
'c') {
346 sensor1_name = sensor1_name.substr(0,sensor1_name.size()-1);
349 if(sensor2_name[sensor2_name.size()-2] ==
'c') {
351 sensor2_name = sensor2_name.substr(0,sensor2_name.size()-1);
353 if(
ALIUtils::debug >= 5)
std::cout <<
"sensor1_name " << sensor1_name <<
" sensor2_name " << sensor2_name <<
" sensor_dist " << sensor_dist <<
" unknown " << wl[3] << std::endl;
356 prec_deviX = atof( wl[0].c_str() );
357 prec_deviY = atof( wl[1].c_str() );
363 if( wl.size() == 5 ) {
366 deviFromFile->setOffset( offsetX, offsetY );
368 deviFromFile->readFile( ifdevi );
374 std::vector<ALIstring> wlo;
376 wlo.push_back( wordlist[0] );
377 wlo.push_back(
"deviX");
379 gcvt( prec_deviX, 10, chartmp );
381 wlo.push_back(
"cal");
382 std::vector<ALIstring> wl2(wlo);
386 gcvt( prec_deviY, 10, chartmp );
404 CLHEP::HepRotation rmt = rmGlob();
405 CLHEP::Hep3Vector XAxism(1.,0.,0.);
411 interslc[0] = (point - (
this)->centreGlob() ) * XAxism;
414 CLHEP::Hep3Vector YAxism(0.,1.,0.);
418 interslc[1] = (point - (
this)->centreGlob() ) * YAxism;
421 std::cout <<
" intersection in local coordinates: X= " << interslc[0] <<
" Y= " << interslc[1] << std::endl;
432 ALIVRMLMgr& vrmlmgr = ALIVRMLMgr::getInstance();
433 ALIColour* col =
new ALIColour( 0., 0., 1., 0. );
434 vrmlmgr.AddBox( *
this, 1., 1., .2, col);
435 vrmlmgr.SendReferenceFrame( *
this, 0.6);
436 vrmlmgr.SendName( *
this, 0.1 );
443 ALIColour* col =
new ALIColour( 0., 0., 1., 0. );
444 std::vector<ALIdouble> spar;
448 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
static unsigned int const shift
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()