16 #include "Alignment/CocoaVisMgr/interface/ALIVRMLMgr.h"
17 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
30 using namespace CLHEP;
51 CLHEP::Hep3Vector ZAxis(0., 0, 1.);
52 CLHEP::HepRotation rmt = rmGlob();
60 CLHEP::Hep3Vector inters = lightray.
point();
63 interslc = convertPointToLocalCoordinates(inters);
78 CLHEP::Hep3Vector measvv(meas.
value()[0], meas.
value()[1], 0.);
79 measvv = rmt * measvv;
91 <<
" DIFF= " << detH - 1000 * meas.
value()[0] <<
" " << detV - 1000 * meas.
value()[1] << std::endl;
95 << detH << chrg <<
" " << meas.
valueType(1) <<
": " << detV <<
" (mm) " << (
this)->
name() << std::endl;
105 ALIUtils::dump3v(1000. * (inters - centreGlob()),
" $$$$$$SIMU inters - centre");
122 std::cout <<
"LR: FAST TRAVERSES SENSOR2D " <<
name() << std::endl;
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()) {
153 if (omeas ==
nullptr) {
154 throw cms::Exception(
"LogicError") <<
"@SUB=OptOSensor2D::fastTraversesLightRay\n"
155 <<
"meas " <<
name() <<
" not found";
161 std::cout <<
" interslcx " << interslcx <<
" interslcy " << interslcy << std::endl;
166 interslcx = interslcx / df + 0.010 /
df;
167 interslcy = interslcy / df + 0.010 /
df;
169 std::cout <<
" interslcx " << interslcx <<
" interslcy " << interslcy << std::endl;
172 std::pair<ALIdouble, ALIdouble> devis = deviFromFile->getDevis(interslcx, interslcy);
173 deviX = devis.second;
174 deviY = -devis.first;
182 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;
194 std::cout <<
" entryDeviX name " << entryDeviX->name() << entryDeviX->value() << std::endl;
195 entryNo = extraEntryNo(
"deviY");
196 Entry* entryDeviY = *(ExtraEntryList().begin() + entryNo);
198 entryDeviY->setValue(deviY);
199 *(eevolite + entryNo) = deviY;
203 deviX = findExtraEntryValue(
"deviX");
204 deviY = findExtraEntryValue(
"deviY");
207 if (fdevi_from_file) {
209 std::cout <<
"fdeviFromFile" << fdevi_from_file << std::endl;
210 ALIuint entryNo = extraEntryNo(
"deviX");
211 Entry* entryDeviX = *(ExtraEntryList().begin() + entryNo);
213 std::cout << entryDeviX <<
" entryDeviX name " << entryDeviX->name() << entryDeviX->value() << std::endl;
214 deviX = entryDeviX->value();
215 entryNo = extraEntryNo(
"deviY");
216 Entry* entryDeviY = *(ExtraEntryList().begin() + entryNo);
218 std::cout << entryDeviY <<
" entryDeviY name " << entryDeviY->name() << entryDeviY->value() << std::endl;
219 deviY = entryDeviY->value();
222 ALIbool bb = findExtraEntryValueIfExists(
"devi", devi);
228 std::cout <<
"devi " << devi <<
" devi x " << deviX <<
" devi y " << deviY << std::endl;
233 std::cout <<
" devi x " << deviX <<
" devi y " << deviY << std::endl;
240 lightray.
dumpData(
"Shifted and Deviated");
249 std::cout <<
"%%% LR: DETAILED TRAVERSES SENSOR2D " <<
name() << std::endl;
255 <<
" has read deviation from file and it will not be taken into account. Please use FAST TRAVERSES"
256 << deviFromFile << std::endl;
260 ALIdouble width = findExtraEntryValue(
"width");
263 CLHEP::Hep3Vector ZAxis(0., 0, 1.);
264 CLHEP::HepRotation rmt = rmGlob();
267 CLHEP::Hep3Vector inters = lightray.
point();
270 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
276 std::cout << std::endl <<
"$$$ LR: REFRACTION IN FORWARD PLATE " << std::endl;
278 ALIPlane plate = getPlate(
true,
true);
281 ALIdouble refra_ind2 = findExtraEntryValueMustExist(
"refra_ind");
282 lightray.
refract(plate, refra_ind1, refra_ind2);
285 std::cout << std::endl <<
"$$$ LR: REFRACTION IN BACKWARD PLATE " << std::endl;
287 plate = getPlate(
false,
true);
289 lightray.
refract(plate, refra_ind2, refra_ind1);
291 CLHEP::Hep3Vector inters = lightray.
point();
295 lightray.
dumpData(
"LightRay Sensor2D traversed: ");
304 std::cout <<
"OptOSensor2D fillExtraEntry wordlist[1] " << wordlist[1] << std::endl;
306 fdevi_from_file =
false;
311 if (wordlist.size() >= 4) {
324 std::cout <<
"Opening deviation file: " << fnam << std::endl;
331 fdevi_from_file =
true;
333 std::cout <<
"deviFromFile " << deviFromFile << std::endl;
339 std::vector<ALIstring> wl;
341 sensor1_name = wl[0];
342 sensor2_name = wl[1];
343 sensor_dist = atof(wl[2].c_str());
345 if (sensor1_name[sensor1_name.size() - 2] ==
'c') {
346 sensor1_name = sensor1_name.substr(0, sensor1_name.size() - 1);
348 if (sensor2_name[sensor2_name.size() - 2] ==
'c') {
349 sensor2_name = sensor2_name.substr(0, sensor2_name.size() - 1);
352 std::cout <<
"sensor1_name " << sensor1_name <<
" sensor2_name " << sensor2_name <<
" sensor_dist " << sensor_dist
353 <<
" unknown " << wl[3] << std::endl;
356 prec_deviX = atof(wl[0].c_str());
357 prec_deviY = atof(wl[1].c_str());
360 std::cout <<
"prec_deviX " << prec_deviX <<
" prec_deviY " << prec_deviY << std::endl;
364 if (wl.size() == 5) {
367 deviFromFile->setOffset(offsetX, offsetY);
369 deviFromFile->readFile(ifdevi);
370 fdevi_from_file =
true;
372 std::cout <<
"deviFromFile " << deviFromFile << std::endl;
375 std::vector<ALIstring> wlo;
377 wlo.push_back(wordlist[0]);
378 wlo.push_back(
"deviX");
380 gcvt(prec_deviX, 10, chartmp);
382 wlo.push_back(
"cal");
383 std::vector<ALIstring> wl2(wlo);
387 gcvt(prec_deviY, 10, chartmp);
403 CLHEP::HepRotation rmt = rmGlob();
404 CLHEP::Hep3Vector XAxism(1., 0., 0.);
413 interslc[0] = (point - (
this)->centreGlob()) * XAxism;
416 CLHEP::Hep3Vector YAxism(0., 1., 0.);
420 interslc[1] = (point - (
this)->centreGlob()) * YAxism;
423 std::cout <<
" intersection in local coordinates: X= " << interslc[0] <<
" Y= " << interslc[1] << std::endl;
433 ALIVRMLMgr& vrmlmgr = ALIVRMLMgr::getInstance();
434 ALIColour*
col =
new ALIColour(0., 0., 1., 0.);
435 vrmlmgr.AddBox(*
this, 1., 1., .2, col);
436 vrmlmgr.SendReferenceFrame(*
this, 0.6);
437 vrmlmgr.SendName(*
this, 0.1);
442 ALIColour* col =
new ALIColour(0., 0., 1., 0.);
443 std::vector<ALIdouble> spar;
447 IgCocoaFileMgr::getInstance().addSolid(*
this,
"BOX", spar, col);
458 "Box", go * 4. * cm /
m, go * 4. * cm /
m, go * 1. * cm /
m);
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)
static constexpr int verbose
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
static std::vector< Measurement * > & MeasurementList()
ALIdouble * convertPointToLocalCoordinates(const CLHEP::Hep3Vector &point)
const CLHEP::Hep3Vector & direction() const
*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()