16 #include "Alignment/CocoaVisMgr/interface/ALIVRMLMgr.h" 17 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h" 30 using namespace CLHEP;
37 makeMeasurement( lightray, meas);
56 CLHEP::Hep3Vector ZAxis(0.,0,1.);
57 CLHEP::HepRotation rmt = rmGlob();
65 CLHEP::Hep3Vector inters = lightray.
point();
68 interslc = convertPointToLocalCoordinates( inters );
83 CLHEP::Hep3Vector measvv( meas.
value()[0], meas.
value()[1], 0.);
91 <<
" DIFF= " << detH-1000*meas.
value()[0] <<
" " << detV-1000*meas.
value()[1] << std::endl;
95 << chrg <<
" " << meas.
valueType(1) <<
": " << detV
96 <<
" (mm) " << (
this)->
name() << std::endl;
106 ALIUtils::dump3v( 1000.*(inters - centreGlob()) ,
" $$$$$$SIMU inters - centre");
129 CLHEP::Hep3Vector ZAxis(0.,0,1.);
130 CLHEP::HepRotation rmt = rmGlob();
133 CLHEP::Hep3Vector inters = lightray.
point();
141 std::cout <<
"fdeviFromFile" << fdevi_from_file << std::endl;
148 for( ii = 0; ii < measv.size(); ii++ ) {
150 if( measv[ii]->sensorName() ==
name() ) {
155 if (omeas ==
nullptr) {
157 <<
"@SUB=OptOSensor2D::fastTraversesLightRay\n" 158 <<
"meas " <<
name() <<
" not found";
168 interslcx = interslcx/df + 0.010/df;
169 interslcy = interslcy/df + 0.010/df;
173 std::pair< ALIdouble, ALIdouble> devis = deviFromFile->getDevis( interslcx, interslcy );
174 deviX = devis.second;
175 deviY = -devis.first;
183 ALIuint entryNo = extraEntryNo(
"deviX" );
185 Entry* entryDeviX = *(ExtraEntryList().begin()+entryNo);
186 entryDeviX->setValue( deviX );
188 std::vector< ALIdouble > eevil = ExtraEntryValueOriginalList();
190 std::vector< ALIdouble >::iterator eevolite = eevil.begin();
192 *(eevolite+entryNo) = deviX;
193 if(
verbose >= 3 )
std::cout<<
" entryDeviX name " << entryDeviX->name() << entryDeviX->value() << std::endl;
194 entryNo = extraEntryNo(
"deviY" );
195 Entry* entryDeviY = *(ExtraEntryList().begin()+entryNo);
197 entryDeviY->setValue( deviY );
198 *(eevolite+entryNo) = deviY;
202 deviX = findExtraEntryValue(
"deviX");
203 deviY = findExtraEntryValue(
"deviY");
206 if( fdevi_from_file ) {
208 ALIuint entryNo = extraEntryNo(
"deviX" );
209 Entry* entryDeviX = *(ExtraEntryList().begin()+entryNo);
210 if(
verbose >= 3 )
std::cout<< entryDeviX <<
" entryDeviX name " << entryDeviX->name() << entryDeviX->value() << std::endl;
211 deviX = entryDeviX->value();
212 entryNo = extraEntryNo(
"deviY" );
213 Entry* entryDeviY = *(ExtraEntryList().begin()+entryNo);
214 if(
verbose >= 3 )
std::cout<< entryDeviY <<
" entryDeviY name " << entryDeviY->name() << entryDeviY->value() << std::endl;
215 deviY = entryDeviY->value();
218 ALIbool bb = findExtraEntryValueIfExists(
"devi", devi);
224 std::cout <<
"devi " << devi <<
" devi x " << deviX <<
" devi y " << deviY << std::endl;
229 std::cout <<
" devi x " << deviX <<
" devi y " << deviY << std::endl;
236 lightray.
dumpData(
"Shifted and Deviated");
251 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;
258 CLHEP::Hep3Vector ZAxis(0.,0,1.);
259 CLHEP::HepRotation rmt = rmGlob();
262 CLHEP::Hep3Vector inters = lightray.
point();
265 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
272 ALIPlane plate = getPlate(
true,
true);
275 ALIdouble refra_ind2 = findExtraEntryValueMustExist(
"refra_ind");
276 lightray.
refract( plate, refra_ind1, refra_ind2 );
280 plate = getPlate(
false,
true);
282 lightray.
refract( plate, refra_ind2, refra_ind1 );
284 CLHEP::Hep3Vector inters = lightray.
point();
288 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
303 fdevi_from_file =
false;
308 if( wordlist.size() >= 4) {
327 fdevi_from_file =
true;
334 std::vector<ALIstring> wl;
336 sensor1_name = wl[0];
337 sensor2_name = wl[1];
338 sensor_dist = atof( wl[2].c_str() );
340 if(sensor1_name[sensor1_name.size()-2] ==
'c') {
341 sensor1_name = sensor1_name.substr(0,sensor1_name.size()-1);
343 if(sensor2_name[sensor2_name.size()-2] ==
'c') {
344 sensor2_name = sensor2_name.substr(0,sensor2_name.size()-1);
346 if(
ALIUtils::debug >= 5)
std::cout <<
"sensor1_name " << sensor1_name <<
" sensor2_name " << sensor2_name <<
" sensor_dist " << sensor_dist <<
" unknown " << wl[3] << std::endl;
349 prec_deviX = atof( wl[0].c_str() );
350 prec_deviY = atof( wl[1].c_str() );
356 if( wl.size() == 5 ) {
359 deviFromFile->setOffset( offsetX, offsetY );
361 deviFromFile->readFile( ifdevi );
362 fdevi_from_file =
true;
367 std::vector<ALIstring> wlo;
369 wlo.push_back( wordlist[0] );
370 wlo.push_back(
"deviX");
372 gcvt( prec_deviX, 10, chartmp );
374 wlo.push_back(
"cal");
375 std::vector<ALIstring> wl2(wlo);
379 gcvt( prec_deviY, 10, chartmp );
397 CLHEP::HepRotation rmt = rmGlob();
398 CLHEP::Hep3Vector XAxism(1.,0.,0.);
404 interslc[0] = (point - (
this)->centreGlob() ) * XAxism;
407 CLHEP::Hep3Vector YAxism(0.,1.,0.);
411 interslc[1] = (point - (
this)->centreGlob() ) * YAxism;
414 std::cout <<
" intersection in local coordinates: X= " << interslc[0] <<
" Y= " << interslc[1] << std::endl;
425 ALIVRMLMgr& vrmlmgr = ALIVRMLMgr::getInstance();
426 ALIColour*
col =
new ALIColour( 0., 0., 1., 0. );
427 vrmlmgr.AddBox( *
this, 1., 1., .2, col);
428 vrmlmgr.SendReferenceFrame( *
this, 0.6);
429 vrmlmgr.SendName( *
this, 0.1 );
436 ALIColour*
col =
new ALIColour( 0., 0., 1., 0. );
437 std::vector<ALIdouble> spar;
441 IgCocoaFileMgr::getInstance().addSolid( *
this,
"BOX", spar, col);
void detailedTraversesLightRay(LightRay &lightray) override
static ALIFileIn & getInstance(const ALIstring &name)
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()
void makeMeasurement(LightRay &lightray, Measurement &meas) override
static double getFloat(const ALIstring &str)
Convert a string to an float, checking that it is really a number.
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)
Abs< T >::type abs(const T &t)
void setValueSimulated(ALIint coor, ALIdouble value)
void setLightRayDirection(const CLHEP::Hep3Vector &lightRayDirection)
void fastTraversesLightRay(LightRay &lightray) override
void defaultBehaviour(LightRay &lightray, Measurement &meas) override
static void setApply(ALIbool val)
virtual void fillExtraEntry(std::vector< ALIstring > &wordlist)
void fillExtraEntry(std::vector< ALIstring > &wordlist) override
ALIint getWordsInLine(std::vector< ALIstring > &wl)
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
void intersect(const ALIPlane &plane)
void constructSolidShape() override
virtual void fillIguana()
const ALIdouble * value() const
void dumpData(const ALIstring &str) const
const ALIdouble valueSimulated(ALIuint ii) const
ALIdouble * convertPointToLocalCoordinates(const CLHEP::Hep3Vector &point)
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()