CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
OptOCOPS Class Reference

#include <OptOCOPS.h>

Inheritance diagram for OptOCOPS:
OpticalObject

Public Member Functions

void constructSolidShape () override
 
ALIdoubleconvertPointToLocalCoordinates (const CLHEP::Hep3Vector &point)
 
void defaultBehaviour (LightRay &lightray, Measurement &meas) override
 
void fastTraversesLightRay (LightRay &lightray) override
 
void makeMeasurement (LightRay &lightray, Measurement &meas) override
 
 OptOCOPS ()
 
 OptOCOPS (OpticalObject *parent, const ALIstring &type, const ALIstring &name, const ALIbool copy_data)
 
 ~OptOCOPS () override
 
- Public Member Functions inherited from OpticalObject
void addCoordinateEntryToList (Entry *entry)
 
void addExtraEntryToList (Entry *entry)
 
void addExtraEntryValueOriginalOriginalToList (ALIdouble entry_value)
 
void addExtraEntryValueOriginalToList (ALIdouble entry_value)
 
void addExtraEntryValueToList (ALIdouble entry_value)
 
double addPii (double val)
 
double approxTo0 (double val)
 
CLHEP::HepRotation buildRmFromEntryValuesOriginalOriginal ()
 
const CLHEP::Hep3Vector & centreGlob () const
 
const CLHEP::Hep3Vector & centreGlobal () const
 
const CLHEP::Hep3Vector & centreGlobOriginal () const
 
const CLHEP::Hep3Vector & centreGlobOriginalOriginal () const
 
const CLHEP::Hep3Vector centreLocal () const
 
int checkMatrixEquations (double angleX, double angleY, double angleZ, CLHEP::HepRotation *rot=nullptr)
 
void construct ()
 
void constructFromOptAligInfo (const OpticalAlignInfo &oaInfo)
 
virtual void constructMaterial ()
 
const std::vector< Entry * > & CoordinateEntryList () const
 
void createComponentOptOsFromOptAlignInfo ()
 
virtual void detailedDeviatesLightRay (LightRay &lightray)
 
virtual void detailedTraversesLightRay (LightRay &lightray)
 
double diff2pi (double ang1, double ang2)
 
void displaceCentreGlob (const CLHEP::Hep3Vector &dispVec)
 
void displaceCentreGlob (const XYZcoor coor, const ALIdouble disp)
 
void displaceCentreGlobOriginal (const CLHEP::Hep3Vector &dispVec)
 
void displaceCentreGlobOriginal (const XYZcoor coor, const ALIdouble disp)
 
void displaceCentreGlobOriginalOriginal (const CLHEP::Hep3Vector &dispVec)
 
void displaceCentreGlobOriginalOriginal (const XYZcoor coor, const ALIdouble disp)
 
void displaceExtraEntry (const ALIuint entryNo, const ALIdouble disp)
 
void displaceExtraEntryOriginal (const ALIuint entryNo, const ALIdouble disp)
 
void displaceExtraEntryOriginalOriginal (const ALIuint entryNo, const ALIdouble disp)
 
void displaceRmGlobAroundGlobal (OpticalObject *opto1stRotated, const XYZcoor coor, const ALIdouble disp)
 
void displaceRmGlobAroundLocal (OpticalObject *opto1stRotated, const XYZcoor coor, const ALIdouble disp)
 
void displaceRmGlobOriginal (const OpticalObject *opto1stRotated, const XYZcoor coor, const ALIdouble disp)
 
void displaceRmGlobOriginalOriginal (const OpticalObject *opto1stRotated, const XYZcoor coor, const ALIdouble disp)
 
bool eq2ang (double ang1, double ang2)
 
const std::vector< Entry * > & ExtraEntryList () const
 
const ALIint extraEntryNo (const ALIstring &entry_name) const
 
std::vector< ALIdouble > & ExtraEntryValueList ()
 
const std::vector< ALIdouble > & ExtraEntryValueOriginalList ()
 
const std::vector< ALIdouble > & ExtraEntryValueOriginalOriginalList ()
 
virtual void fastDeviatesLightRay (LightRay &lightray)
 
virtual void fillIguana ()
 
virtual void fillVRML ()
 
const ALIdouble findExtraEntryValue (const ALIstring &eename) const
 
const ALIbool findExtraEntryValueIfExists (const ALIstring &eename, ALIdouble &value) const
 
const ALIdouble findExtraEntryValueMustExist (const ALIstring &eename) const
 
const ALIuint getCmsswID () const
 
std::vector< ALIstringgetCoordinateFromOptAlignParam (const OpticalAlignParam &oaParam)
 
CLHEP::Hep3Vector getDisplacementInLocalCoordinates (const XYZcoor coor, const ALIdouble disp)
 
const double getEntryCentre (const ALIstring &coor) const
 
const double getEntryCentre (const XYZcoor coor) const
 
const double getEntryRMangle (const ALIstring &coor) const
 
const double getEntryRMangle (const XYZcoor coor) const
 
std::vector< double > getLocalRotationAngles (const std::vector< Entry * > &entries) const
 
CocoaMaterialElementarygetMaterial () const
 
ALIPlane getPlate (const ALIbool forwardPlate, const ALIbool applyWedge)
 
std::vector< double > getRotationAnglesFromMatrix (CLHEP::HepRotation &rmLocal, const std::vector< Entry * > &entries) const
 
std::vector< double > getRotationAnglesInOptOFrame (const OpticalObject *optoAncestor, const std::vector< Entry * > &entries) const
 
CocoaSolidShapegetSolidShape () const
 
CLHEP::Hep3Vector getZAxis ()
 
const ALIuint ID () const
 
const ALIstring longName () const
 
Measurementmeas ()
 
const ALIstringname () const
 
 OpticalObject ()
 
 OpticalObject (OpticalObject *parent, const ALIstring &type, const ALIstring &name, const ALIbool copy_data)
 
const OpticalObjectparent () const
 
virtual void participateInMeasurement (LightRay &lightray, Measurement &meas, const ALIstring &behav)
 
void propagateGlobalRMOriginalOriginalChangeToChildren (const CLHEP::HepRotation &rmorioriold, const CLHEP::HepRotation &rmoriorinew)
 
void resetGlobalCoordinates ()
 
void resetOriginalOriginalCoordinates ()
 
const CLHEP::HepRotation & rmGlob () const
 
const CLHEP::HepRotation & rmGlobOriginal () const
 
const CLHEP::HepRotation & rmGlobOriginalOriginal () const
 
const CLHEP::HepRotation rmLocal () const
 
void setCmsswID (ALIuint id)
 
void setExtraEntryValue (const ALIuint entryNo, const ALIdouble disp)
 
void setGlobalCoordinates ()
 
void setGlobalRMOriginalOriginal (const CLHEP::HepRotation &rmoriori)
 
void setID (ALIuint id)
 
void setMeas (Measurement *meas)
 set current measurement More...
 
void setOriginalEntryValues ()
 
void setRmGlobal (const CLHEP::HepRotation &rm)
 
void setRmGlobalOriginal (const CLHEP::HepRotation &rm)
 
void setType (const ALIstring &type)
 
const ALIstring shortName () const
 
const ALIstringtype () const
 
virtual void userDefinedBehaviour (LightRay &lightray, Measurement &meas, const ALIstring &behav)
 
virtual ~OpticalObject ()
 

Private Member Functions

ALIdouble getMeasFromInters (ALILine &line_xhair, ALILine &ccd, CLHEP::Hep3Vector &cops_line)
 

Private Attributes

ALILine ccds [4]
 
DeviationsFromFileSensor2DdeviFromFile
 
ALIbool fdevi_from_file
 

Additional Inherited Members

- Protected Member Functions inherited from OpticalObject
virtual void fillExtraEntry (std::vector< ALIstring > &wordlist)
 
- Protected Attributes inherited from OpticalObject
CocoaMaterialElementarytheMaterial
 
CocoaSolidShapetheSolidShape
 
ALIint verbose
 

Detailed Description

Definition at line 20 of file OptOCOPS.h.

Constructor & Destructor Documentation

◆ OptOCOPS() [1/2]

OptOCOPS::OptOCOPS ( )
inline

Definition at line 23 of file OptOCOPS.h.

23 {};

◆ OptOCOPS() [2/2]

OptOCOPS::OptOCOPS ( OpticalObject parent,
const ALIstring type,
const ALIstring name,
const ALIbool  copy_data 
)
inline

Definition at line 24 of file OptOCOPS.h.

25  : OpticalObject(parent, type, name, copy_data), fdevi_from_file(false){};

◆ ~OptOCOPS()

OptOCOPS::~OptOCOPS ( )
inlineoverride

Definition at line 26 of file OptOCOPS.h.

26 {};

Member Function Documentation

◆ constructSolidShape()

void OptOCOPS::constructSolidShape ( )
overridevirtual

Reimplemented from OpticalObject.

Definition at line 536 of file OptOCOPS.cc.

536  {
537  ALIdouble go;
539  gomgr->getGlobalOptionValue("VisScale", go);
540 
542  "Box", go * 5. * cm / m, go * 5. * cm / m, go * 1. * cm / m); //COCOA internal units are meters
543 }

References GlobalOptionMgr::getGlobalOptionValue(), GlobalOptionMgr::getInstance(), and visualization-live-secondInstance_cfg::m.

◆ convertPointToLocalCoordinates()

ALIdouble * OptOCOPS::convertPointToLocalCoordinates ( const CLHEP::Hep3Vector &  point)

Definition at line 395 of file OptOCOPS.cc.

395  {
396  if (ALIUtils::debug >= 1)
397  std::cout << "***** OptOCOPS::convertPointToLocalCoordinates" << std::endl;
398  ALIdouble* interslc = new ALIdouble[2];
399 
400  //----- X value
401  CLHEP::HepRotation rmt = rmGlob();
402  CLHEP::Hep3Vector XAxism(1., 0., 0.);
403  XAxism *= rmt;
404  if (ALIUtils::debug >= 5)
405  ALIUtils::dump3v((this)->centreGlob(), "centre glob sensor2D");
406  if (ALIUtils::debug >= 5)
407  ALIUtils::dumprm(rmt, "rotation matrix sensor2D");
408  //t ALIUtils::dump3v(point - (this)->centreGlob() , "inters - (this)->centreGlob()");
409  //t ALIUtils::dump3v(XAxism , "XAxism");
410  interslc[0] = (point - (this)->centreGlob()) * XAxism;
411 
412  //----- Y value
413  CLHEP::Hep3Vector YAxism(0., 1., 0.);
414  YAxism *= rmt;
415  //t ALIUtils::dump3v(YAxism , "YAxism");
416  interslc[1] = (point - (this)->centreGlob()) * YAxism;
417 
418  if (ALIUtils::debug >= 5) {
419  std::cout << " intersection in local coordinates: X= " << interslc[0] << " Y= " << interslc[1] << std::endl;
420  }
421  return interslc;
422 }

References gather_cfg::cout, ALIUtils::debug, ALIUtils::dump3v(), ALIUtils::dumprm(), and point.

◆ defaultBehaviour()

void OptOCOPS::defaultBehaviour ( LightRay lightray,
Measurement meas 
)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 33 of file OptOCOPS.cc.

33  {
34  if (ALIUtils::debug >= 5)
35  std::cout << "***** OptOCOPS::defaultBehaviour" << std::endl;
36  makeMeasurement(lightray, meas);
37 }

References gather_cfg::cout, and ALIUtils::debug.

◆ fastTraversesLightRay()

void OptOCOPS::fastTraversesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 375 of file OptOCOPS.cc.

375  {
376  if (ALIUtils::debug >= 5)
377  std::cout << "***** OptOCOPS::fastTraversesLightRay" << std::endl;
378  if (ALIUtils::debug >= 2)
379  std::cout << "LR: FAST TRAVERSES COPS " << name() << std::endl;
380 
381  //---------- Get intersection
382  CLHEP::Hep3Vector ZAxis(0., 0, 1.);
383  CLHEP::HepRotation rmt = rmGlob();
384  ZAxis = rmt * ZAxis;
385  lightray.intersect(ALIPlane(centreGlob(), ZAxis));
386  CLHEP::Hep3Vector inters = lightray.point();
387  lightray.setPoint(inters);
388 
389  if (ALIUtils::debug >= 2) {
390  lightray.dumpData(" after COPS ");
391  }
392 }

References gather_cfg::cout, ALIUtils::debug, LightRay::dumpData(), LightRay::intersect(), Skims_PA_cff::name, LightRay::point(), and LightRay::setPoint().

◆ getMeasFromInters()

ALIdouble OptOCOPS::getMeasFromInters ( ALILine line_xhair,
ALILine ccd,
CLHEP::Hep3Vector &  cops_line 
)
private

Definition at line 425 of file OptOCOPS.cc.

425  {
426  if (ALIUtils::debug >= 5)
427  std::cout << "***** OptOCOPS::getMeasFromInters" << std::endl;
428  CLHEP::Hep3Vector inters = line_xhair.intersect(ccd, false) - ccd.pt();
429  ALIdouble sign = inters * ccd.vec();
430  if (sign != 0) {
431  sign = std::abs(sign) / sign;
432  // std::cout << " @@@@@@@@@@@@ sign = " << sign << std::endl;
433  // ALIUtils::dump3v(inters, " intersection " );
434  // ALIUtils::dump3v( ccd.vec(), " cops_line ");
435  } //sign can be zero only if inters is 0, because they are parallel
436  return sign * inters.mag();
437 }

References funct::abs(), gather_cfg::cout, ALIUtils::debug, ALILine::intersect(), ALILine::pt(), Validation_hcalonly_cfi::sign, and ALILine::vec().

◆ makeMeasurement()

void OptOCOPS::makeMeasurement ( LightRay lightray,
Measurement meas 
)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 42 of file OptOCOPS.cc.

42  {
43  if (ALIUtils::debug >= 4)
44  std::cout << "***** OptOCOPS::makeMeasurement(lightray, meas) " << std::endl;
45  //---------- Centre of COPS is at dowel point 2
46  CLHEP::Hep3Vector dowel2 = centreGlob();
47  //---------- Coordinates of dowel point 1 are given with respect to dowel point 2 (in local reference frame)
48  ALIdouble posx12 = findExtraEntryValue("dowel1X");
49  // Changed default value to .045 from .03
50  if (posx12 == 0.)
51  posx12 = -0.045; //samir changed sign to correct the dowel 1st pixel
52  CLHEP::Hep3Vector dowel1(posx12, findExtraEntryValue("dowel1Y"), 0.);
53  CLHEP::HepRotation rmt = rmGlob();
54  dowel1 = rmt * dowel1;
55  dowel1 += dowel2;
56  if (ALIUtils::debug >= 3) {
57  ALIUtils::dump3v(dowel2, " dowel2");
58  ALIUtils::dump3v(dowel1, " dowel1");
59  }
60 
61  //---------- Get line joining dowel1-dowel2 and perpendicular to it inside cops
62  // CLHEP::Hep3Vector line_dowel21 = - (dowel1-dowel2 ); //////
63  CLHEP::Hep3Vector line_dowel21 = (dowel1 - dowel2); // samir changed sign to correct the dowel 1st pixel
64  CLHEP::Hep3Vector ZAxis(0., 0, 1.);
65  ZAxis = rmt * ZAxis;
66  CLHEP::Hep3Vector line_dowel21_perp = ZAxis.cross(line_dowel21);
67  if (ALIUtils::debug >= 3) {
68  ALIUtils::dump3v(line_dowel21, " line_dowel21");
69  ALIUtils::dump3v(line_dowel21_perp, " line_dowel21_perp");
70  }
71 
72  //---------- Position four CCDs (locally, i.e. with respect to centre)
73  //----- Get first CCD length, that will be used to give a default placement to the CCDs
74  ALIdouble CCDlength = findExtraEntryValue("CCDlength");
75  if (CCDlength == 0.)
76  CCDlength = 2048 * 14 * 1.E-6; // (in meters, the default unit)
77 
78  // global / local output of ccd location in RF was reversed, I am swapping
79 
80  //----- Upper CCD (leftmost point & direction dowel1-dowel2)
81  if (ALIUtils::debug >= 3)
82  std::cout << std::endl << "***** UP CCD *****" << std::endl << "******************" << std::endl << std::endl;
83  ALIdouble posX = findExtraEntryValue("upCCDXtoDowel2");
85  ALIbool eexists = findExtraEntryValueIfExists("upCCDYtoDowel2", posY);
86  if (!eexists)
87  posY = CCDlength + 0.004;
88  //if(!eexists) posY = 0.004;
89  CLHEP::Hep3Vector posxy(posX, posY, 0);
90  if (ALIUtils::debug >= 3)
91  std::cout << " %%%% CCD distances to Dowel2: " << std::endl;
92  if (ALIUtils::debug >= 3)
93  std::cout << " up ccd in local RF " << posxy << std::endl;
94  posxy = rmt * posxy;
95  if (ALIUtils::debug >= 3)
96  std::cout << " up ccd in global RF " << posxy << std::endl;
97  // ALILine upCCD( dowel2 + posxy, -line_dowel21 );
98  // ccds[0] = ALILine( posxy, -line_dowel21 );
99  ALILine upCCD(dowel2 + posxy, line_dowel21); // Samir changed sign to correct the dowel 1st pixel
100  ccds[0] = ALILine(posxy, line_dowel21); // samir changed sign to correct the dowel 1st pixel
101  //----- Lower CCD (leftmost point & direction dowel2-dowel1)
102  if (ALIUtils::debug >= 3)
103  std::cout << std::endl << "***** DOWN CCD *****" << std::endl << "********************" << std::endl << std::endl;
104  posX = findExtraEntryValue("downCCDXtoDowel2");
105  eexists = findExtraEntryValueIfExists("downCCDYtoDowel2", posY);
106  if (!eexists)
107  posY = 0.002;
108  posxy = CLHEP::Hep3Vector(posX, posY, 0);
109  if (ALIUtils::debug >= 3)
110  std::cout << " down ccd in local RF " << posxy << std::endl;
111  posxy = rmt * posxy;
112  if (ALIUtils::debug >= 3)
113  std::cout << " down ccd in global RF " << posxy << std::endl;
114  // ALILine downCCD( dowel2 + posxy, -line_dowel21 );
115  // ccds[1] = ALILine( posxy, -line_dowel21 );
116 
117  ALILine downCCD(dowel2 + posxy, line_dowel21); //samir changed signto correct the dowel 1st pixel
118  ccds[1] = ALILine(posxy, line_dowel21); // samir changed sign to correct the dowel 1st pixel
119 
120  //----- left CCD (uppermost point & direction perpendicular to dowel2-dowel1)
121 
122  if (ALIUtils::debug >= 3)
123  std::cout << std::endl << "***** LEFT CCD *****" << std::endl << "********************" << std::endl << std::endl;
124  eexists = findExtraEntryValueIfExists("leftCCDXtoDowel2", posX);
125  // if(!eexists) posX = -0.002;
126  if (!eexists)
127  posX = -CCDlength - 0.002; // Samir changed sign to correct the dowel 1st pixel
128  posY = findExtraEntryValue("leftCCDYtoDowel2");
129  posxy = CLHEP::Hep3Vector(posX, posY, 0);
130  if (ALIUtils::debug >= 3)
131  std::cout << " left ccd in local RF " << posxy << std::endl;
132  posxy = rmt * posxy;
133  if (ALIUtils::debug >= 3)
134  std::cout << " left ccd in global RF " << posxy << std::endl;
135  // ALILine leftCCD( dowel2 + posxy, line_dowel21_perp );
136  // ccds[2] = ALILine( posxy, line_dowel21_perp );
137 
138  ALILine leftCCD(dowel2 + posxy, -line_dowel21_perp); //samir changed sign to correct the dowel 1st pixel
139  ccds[2] = ALILine(posxy, -line_dowel21_perp); //samir changed sign to correct the dowel 1st pixel
140 
141  //----- right CCD (uppermost point & direction perpendicular to dowel2-dowel1)
142  if (ALIUtils::debug >= 3)
143  std::cout << std::endl << "***** RIGHT CCD *****" << std::endl << "*********************" << std::endl << std::endl;
144  eexists = findExtraEntryValueIfExists("rightCCDXtoDowel2", posX);
145  // if(!eexists) posX = -CCDlength - 0.004;
146  if (!eexists)
147  posX = -0.004; // samir tried to change in order to adjust the position of 1 st pixel.
148  posY = findExtraEntryValue("rightCCDYtoDowel2");
149  posxy = CLHEP::Hep3Vector(posX, posY, 0);
150  if (ALIUtils::debug >= 3)
151  std::cout << " right ccd in local RF " << posxy << std::endl;
152  posxy = rmt * posxy;
153  if (ALIUtils::debug >= 3)
154  std::cout << " right ccd in global RF " << posxy << std::endl << std::endl;
155  // ALILine rightCCD( dowel2 + posxy, line_dowel21_perp );
156  // ccds[3] = ALILine( posxy, line_dowel21_perp );
157 
158  ALILine rightCCD(dowel2 + posxy, -line_dowel21_perp); //samir changed sign to correct the dowel 1st pixel
159  ccds[3] = ALILine(posxy, -line_dowel21_perp); //samir changed sign to correct the dowel 1st pixel
160 
161  if (ALIUtils::debug >= 3) {
162  std::cout << " %%% Positions of CCDs in global RF: " << std::endl << std::endl;
163  std::cout << " upCCD: " << upCCD << std::endl;
164  std::cout << " downCCD: " << downCCD << std::endl;
165  std::cout << " leftCCD: " << leftCCD << std::endl;
166  std::cout << " rightCCD: " << rightCCD << std::endl << std::endl;
167  }
168 
169  //---------- Intersect x-hair laser with COPS
170  if (ALIUtils::debug >= 3)
171  std::cout << " %%% Intersecting x-hair laser with COPS: " << std::endl;
172  ALIPlane copsPlane(centreGlob(), ZAxis);
173  lightray.intersect(*this);
174  CLHEP::Hep3Vector inters = lightray.point();
175  if (ALIUtils::debug >= 3) {
176  ALIUtils::dump3v(inters, " Intersection of x-hair laser with COPS ");
177  }
178 
179  //---------- Get cross of x-hair laser:
180  if (ALIUtils::debug >= 5)
181  std::cout << "1. Get the OptO x-hair laser from the measurement list of OptOs" << std::endl;
182 
183  OpticalObject* xhairOptO = *(meas.OptOList().begin());
184 
185  if (ALIUtils::debug >= 35)
186  std::cout << "2. Get the Y of the laser and project it on the COPS" << std::endl;
187  CLHEP::Hep3Vector YAxis_xhair(0., 1., 0.);
188  const CLHEP::HepRotation& rmtx = xhairOptO->rmGlob();
189  YAxis_xhair = rmtx * YAxis_xhair;
190  ALILine Yline_xhair(inters, copsPlane.project(YAxis_xhair));
191  if (ALIUtils::debug >= 3) {
192  std::cout << " %%%% Projecting x-hair laser on COPS: " << std::endl;
193  ALIUtils::dump3v(YAxis_xhair, " Y direction of laser ");
194  std::cout << " Y line of laser projected on COPS " << Yline_xhair << std::endl;
195  }
196 
197  if (ALIUtils::debug >= 5)
198  std::cout << " 3. Get the X of the laser (correct it if cross is not 90o) and project it on the COPS" << std::endl;
199 
200  ALIdouble anglebx;
201  eexists = xhairOptO->findExtraEntryValueIfExists("angleBetweenAxis", anglebx);
202  if (!eexists)
203  anglebx = PI / 2.;
204  CLHEP::Hep3Vector XAxis_xhair = YAxis_xhair;
205 
206  // if (ALIUtils::debug >= 3) ALIUtils::dump3v(XAxis_xhair," X of laser1 ");
207  ZAxis = CLHEP::Hep3Vector(0., 0., 1.);
208  ZAxis = rmtx * ZAxis;
209  XAxis_xhair.rotate(anglebx, ZAxis);
210  ALILine Xline_xhair(inters, copsPlane.project(XAxis_xhair));
211  if (ALIUtils::debug >= 3) {
212  std::cout << "angleBetweenAxis = " << anglebx << std::endl;
213  ALIUtils::dump3v(XAxis_xhair, " X direction of laser ");
214  std::cout << " X line of laser projected on COPS " << Xline_xhair << std::endl;
215  }
216 
217  //---------- Get measurement as intersection with four CCDs
218  if (ALIUtils::debug >= 3)
219  std::cout << " Getting measurements as intersection with four CCDs: " << std::endl;
220 
221  if (ALIUtils::debug >= 4)
222  std::cout << "intersecting with upCCD " << std::endl;
223  ALIdouble measv[4][2];
224 
225  // swap Y and X line_xhair by exchanging second index
226 
227  if (ALIUtils::debug >= 5)
228  std::cout << "$@S@ measv[0][0] upccd " << std::endl;
229  measv[0][0] = getMeasFromInters(Yline_xhair, upCCD, line_dowel21);
230  if (ALIUtils::debug >= 5)
231  std::cout << "$@$@ measv[0][1] upccd " << std::endl;
232  measv[0][1] = getMeasFromInters(Xline_xhair, upCCD, line_dowel21);
233 
234  //---- check if postive or negative:
235  if (ALIUtils::debug >= 4)
236  std::cout << "intersecting with downCCD " << std::endl;
237  measv[1][0] = getMeasFromInters(Yline_xhair, downCCD, line_dowel21);
238  measv[1][1] = getMeasFromInters(Xline_xhair, downCCD, line_dowel21);
239 
240  //
241 
242  if (ALIUtils::debug >= 4)
243  std::cout << "intersecting with leftCCD " << std::endl;
244  measv[2][0] = getMeasFromInters(Xline_xhair, leftCCD, line_dowel21_perp);
245  measv[2][1] = getMeasFromInters(Yline_xhair, leftCCD, line_dowel21_perp);
246  if (ALIUtils::debug >= 4)
247  std::cout << "intersecting with rightCCD " << std::endl;
248  measv[3][0] = getMeasFromInters(Xline_xhair, rightCCD, line_dowel21_perp);
249  measv[3][1] = getMeasFromInters(Yline_xhair, rightCCD, line_dowel21_perp);
250 
251  /* Both X and Y axis of the x-laser are intersected with each CCD and it checks that one of
252  the two is inside the CCD(less than CCDlength/2). If no one is inside, it will give an
253  exception. If both are inside (a strange case where, for example, the laser centre is very
254  close and forms 45 degrees with the CCD) it will also make an exception (if you prefer, I can
255  put a warning saying that you have two measurements, but I guess this should never happen for
256  you, so I better give an exception and you don't risk to overpass this warning).
257 
258  Then it is mandatory that you put the CCDlength parameter (I could put a default one if
259  you prefer).
260 
261 
262  ALIbool measInCCD[2];
263  ALIuint ii,jj;
264  for( ii = 0; ii < 4; ii++ ) {
265  for( jj = 0; jj < 2; jj++ ) {
266  measInCCD[jj] = std::abs( measv[ii][jj] ) < CCDlength/2;
267  }
268  if (ALIUtils::debug >= 2) std::cout << "$@$@ CHECK CCD = " << ii << std::endl;
269  if( measInCCD[0] && measInCCD[1] ){
270  std::cerr << "!!!EXITING: both lasers lines of x-hair laser intersect with same CCD " << measNames[ii] << " one at " << measv[ii][0] << " another one at " << measv[ii][1] << "CCDhalfLegth " << CCDlength/2 << std::endl;
271  exit(1);
272  } else if( !(measInCCD[0] || measInCCD[1]) ){
273  std::cerr << "!!!EXITING: none of the lasers lines of x-hair laser intersect with CCD " << measNames[ii] << ", one at " << measv[ii][0] << " another one at " << measv[ii][1] << "CCDhalfLegth " << CCDlength/2 << std::endl;
274  exit(1);
275  } else {
276  measInCCD[0] ? meas.setValueSimulated( ii, measv[ii][0] ) :
277  meas.setValueSimulated( ii, measv[ii][1] );
278  }
279  }
280  */
281 
282  ALIstring measNames[4] = {"up", "down", "left", "right"};
283  ALIbool laserLine;
284  if (ALIUtils::debug >= 2)
285  std::cout << std::endl
286  << "--> Now comparing measurement in ccds by x and y laser lines (will always choose the smaller one) "
287  << std::endl;
288 
289  unsigned int ii;
290  for (ii = 0; ii < 4; ii++) {
291  if (ALIUtils::debug >= 2)
292  std::cout << "\tmeas CCD " << measNames[ii] << " ii=(" << ii
293  << ") \t Values: "
294  //<< (std::abs( measv[ii][0] ) < std::abs( measv[ii][1])
295  << " " << std::abs(measv[ii][0]) << " " << std::abs(measv[ii][1])
296  << " edm::isNotFinite() = " << edm::isNotFinite(measv[ii][1]) << std::endl;
297 
298  if (meas.xlaserLine(ii) != -1) {
299  laserLine = ALIbool(meas.xlaserLine(ii));
300  } else {
301  // Problem here !!!
302  //
303  // Somehow measv[][1] can occasionally return value of 'nan'
304  // which is interpretted as less than any real value
305  //
306  if (edm::isNotFinite(measv[ii][1]) != 0) {
307  measv[ii][1] = 1e99;
308  if (ALIUtils::debug >= 2)
309  std::cout << " --> Swapping for " << measv[ii][1] << "(inf)" << std::endl;
310  }
311 
312  laserLine = std::abs(measv[ii][0]) < std::abs(measv[ii][1]);
313 
314  meas.setXlaserLine(ii, int(laserLine));
315  }
316  laserLine ? meas.setValueSimulated(ii, measv[ii][0]) : meas.setValueSimulated(ii, measv[ii][1]);
317  }
318 
319  if (ALIUtils::debug >= 2)
320  std::cout << std::endl; //Keep format of debug output reasonable
321 
322  // try to identify pathological cases: up and down CCD are intersected by the same
323  // laser line (say X) and the same for the left and right CCD
324 
325  if (ALIUtils::debug >= 2)
326  std::cout << "***** OptOCOPS::makeMeasurement - identify pathological cases U and D intersected by same line"
327  << std::endl;
328  ALIbool xlaserDir[4];
329  for (ii = 0; ii < 4; ii++) {
330  // xlaserDir[ii] = std::abs( measv[ii][0] ) < std::abs( measv[ii][1] );
331  xlaserDir[ii] = ALIbool(meas.xlaserLine(ii));
332  }
333  if (xlaserDir[0] ^ xlaserDir[1]) {
334  std::cerr << "!!EXITING up and down CCDs intersected by different x-laser line " << xlaserDir[0] << " "
335  << xlaserDir[1] << std::endl;
336  exit(1);
337  }
338  if (xlaserDir[2] ^ xlaserDir[3]) {
339  std::cerr << "!!EXITING right and left CCDs intersected by different x-laser line " << xlaserDir[0] << " "
340  << xlaserDir[1] << std::endl;
341  exit(1);
342  }
343 
344  if (ALIUtils::debug >= 5)
345  std::cout << "***** OptOCOPS::makeMeasurement - now output sim values" << std::endl;
346 
347  if (ALIUtils::debug >= 1) {
348  ALIstring chrg = "";
349  std::cout << "REAL value: " << chrg << "U: " << 1000 * meas.value()[0] << chrg << " D: " << 1000 * meas.value()[1]
350  << " L: " << 1000 * meas.value()[2] << " R: " << 1000 * meas.value()[3] << " (mm) " << (this)->name()
351  << std::endl;
352  ALIdouble detU = 1000 * meas.valueSimulated(0);
353  if (std::abs(detU) <= 1.e-9)
354  detU = 0.;
355  ALIdouble detD = 1000 * meas.valueSimulated(1);
356  if (std::abs(detD) <= 1.e-9)
357  detD = 0.;
358  ALIdouble detL = 1000 * meas.valueSimulated(2);
359  if (std::abs(detL) <= 1.e-9)
360  detL = 0.;
361  ALIdouble detR = 1000 * meas.valueSimulated(3);
362  if (std::abs(detR) <= 1.e-9)
363  detR = 0.;
364  std::cout << "SIMU value: " << chrg
365  << "U: "
366  // << setprecision(3) << setw(4)
367  << detU << chrg << " D: " << detD << chrg << " L: " << detL << chrg << " R: " << detR << " (mm) "
368  << (this)->name() << std::endl;
369  }
370 }

References funct::abs(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, gather_cfg::cout, ALIUtils::debug, ALIUtils::dump3v(), MillePedeFileConverter_cfg::e, beamvalidation::exit(), OpticalObject::findExtraEntryValueIfExists(), cuy::ii, LightRay::intersect(), edm::isNotFinite(), Skims_PA_cff::name, Measurement::OptOList(), LightRay::point(), RecoTauValidation_cfi::posX, RecoTauValidation_cfi::posY, ALIPlane::project(), OpticalObject::rmGlob(), Measurement::setValueSimulated(), Measurement::setXlaserLine(), Measurement::value(), Measurement::valueSimulated(), and Measurement::xlaserLine().

Member Data Documentation

◆ ccds

ALILine OptOCOPS::ccds[4]
private

Definition at line 49 of file OptOCOPS.h.

◆ deviFromFile

DeviationsFromFileSensor2D* OptOCOPS::deviFromFile
private

Definition at line 47 of file OptOCOPS.h.

◆ fdevi_from_file

ALIbool OptOCOPS::fdevi_from_file
private

Definition at line 48 of file OptOCOPS.h.

LightRay::dumpData
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:374
PI
Definition: PayloadInspector.h:20
OpticalObject::meas
Measurement * meas()
Definition: OpticalObject.h:200
ALIbool
bool ALIbool
Definition: CocoaGlobals.h:19
OpticalObject::findExtraEntryValue
const ALIdouble findExtraEntryValue(const ALIstring &eename) const
Definition: OpticalObject.cc:1519
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
OptOCOPS::makeMeasurement
void makeMeasurement(LightRay &lightray, Measurement &meas) override
Definition: OptOCOPS.cc:42
ALILine::intersect
CLHEP::Hep3Vector intersect(const ALILine &l2, bool notParallel=false)
Definition: ALILine.cc:27
GlobalOptionMgr
Definition: GlobalOptionMgr.h:18
OptOCOPS::getMeasFromInters
ALIdouble getMeasFromInters(ALILine &line_xhair, ALILine &ccd, CLHEP::Hep3Vector &cops_line)
Definition: OptOCOPS.cc:425
OpticalObject::name
const ALIstring & name() const
Definition: OpticalObject.h:58
GlobalOptionMgr::getInstance
static GlobalOptionMgr * getInstance()
Definition: GlobalOptionMgr.cc:18
gather_cfg.cout
cout
Definition: gather_cfg.py:144
OpticalObject::findExtraEntryValueIfExists
const ALIbool findExtraEntryValueIfExists(const ALIstring &eename, ALIdouble &value) const
Definition: OpticalObject.cc:1563
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
OptOCOPS::fdevi_from_file
ALIbool fdevi_from_file
Definition: OptOCOPS.h:48
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
GlobalOptionMgr::getGlobalOptionValue
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found
Definition: GlobalOptionMgr.cc:115
OpticalObject::theSolidShape
CocoaSolidShape * theSolidShape
Definition: OpticalObject.h:315
OpticalObject
Definition: OpticalObject.h:35
Measurement::setXlaserLine
virtual void setXlaserLine(ALIuint ii, int val)
Definition: Measurement.h:158
CocoaSolidShapeBox
Definition: CocoaSolidShapeBox.h:13
Measurement::setValueSimulated
void setValueSimulated(ALIint coor, ALIdouble value)
Definition: Measurement.h:146
OpticalObject::centreGlob
const CLHEP::Hep3Vector & centreGlob() const
Definition: OpticalObject.h:75
OpticalObject::rmGlob
const CLHEP::HepRotation & rmGlob() const
Definition: OpticalObject.h:83
LightRay::intersect
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:93
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
LightRay::point
const CLHEP::Hep3Vector & point() const
Definition: LightRay.h:57
ALIUtils::debug
static ALIint debug
Definition: ALIUtils.h:34
ALILine
Definition: ALILine.h:16
RecoTauValidation_cfi.posX
posX
Definition: RecoTauValidation_cfi.py:288
OpticalObject::OpticalObject
OpticalObject()
Definition: OpticalObject.h:40
ALIUtils::dumprm
static void dumprm(const CLHEP::HepRotation &rm, const std::string &msg, std::ostream &out=std::cout)
Definition: ALIUtils.cc:71
ALILine::pt
const CLHEP::Hep3Vector & pt() const
Definition: ALILine.h:26
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
OpticalObject::parent
const OpticalObject * parent() const
Definition: OpticalObject.h:60
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
LightRay::setPoint
void setPoint(const CLHEP::Hep3Vector &point)
Definition: LightRay.h:63
Measurement::OptOList
const std::vector< OpticalObject * > & OptOList() const
Definition: Measurement.h:101
ALIPlane
Definition: ALIPlane.h:15
ALILine::vec
const CLHEP::Hep3Vector & vec() const
Definition: ALILine.h:27
Measurement::valueSimulated
const ALIdouble valueSimulated(ALIuint ii) const
Definition: Measurement.h:105
ALIUtils::dump3v
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
Measurement::xlaserLine
virtual int xlaserLine(ALIuint ii)
Definition: Measurement.h:147
OptOCOPS::ccds
ALILine ccds[4]
Definition: OptOCOPS.h:49
Measurement::value
const ALIdouble * value() const
Definition: Measurement.h:109
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
point
*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
Definition: invegas.h:5
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
cuy.ii
ii
Definition: cuy.py:590
RecoTauValidation_cfi.posY
posY
Definition: RecoTauValidation_cfi.py:289
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37