CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
LightRay Class Reference

#include <LightRay.h>

Public Member Functions

const CLHEP::Hep3Vector & direction () const
 
void dumpData (const ALIstring &str) const
 
void intersect (const ALIPlane &plane)
 
void intersect (const OpticalObject &opto)
 
CLHEP::Hep3Vector IntersectWithOptOPlane (const OpticalObject *optoplane)
 
CLHEP::Hep3Vector IntersectWithPlane (const CLHEP::Hep3Vector &plane_point, const CLHEP::Hep3Vector &plane_normal)
 
 LightRay ()
 
 LightRay (OpticalObject *p1, OpticalObject *p2)
 
 LightRay (CLHEP::Hep3Vector &vec1, CLHEP::Hep3Vector &vec2)
 
const CLHEP::Hep3Vector & point () const
 
void reflect (const ALIPlane &plane)
 
void refract (const ALIPlane &plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
 
void setDirection (const CLHEP::Hep3Vector &direc)
 
void setPoint (const CLHEP::Hep3Vector &point)
 
void shiftAndDeviateWhileTraversing (const OpticalObject *opto, char behav)
 
void shiftAndDeviateWhileTraversing (const OpticalObject *opto, ALIdouble shiftX, ALIdouble shiftY, ALIdouble shiftZ, ALIdouble deviX, ALIdouble deviY, ALIdouble deviZ)
 
void startLightRay (OpticalObject *opto)
 
 ~LightRay ()
 

Public Attributes

CLHEP::Hep3Vector _direction
 
CLHEP::Hep3Vector _point
 

Detailed Description

Definition at line 20 of file LightRay.h.

Constructor & Destructor Documentation

◆ LightRay() [1/3]

LightRay::LightRay ( )

Definition at line 18 of file LightRay.cc.

References _direction, and _point.

18  {
19  _point = CLHEP::Hep3Vector(0., 0., 0.);
20  _direction = CLHEP::Hep3Vector(0., 0., 1.);
21 }
CLHEP::Hep3Vector _point
Definition: LightRay.h:74
CLHEP::Hep3Vector _direction
Definition: LightRay.h:73

◆ LightRay() [2/3]

LightRay::LightRay ( OpticalObject p1,
OpticalObject p2 
)

Definition at line 48 of file LightRay.cc.

References OpticalObject::centreGlob(), gather_cfg::cout, ALIUtils::debug, dumpData(), OpticalObject::name(), setDirection(), and setPoint().

48  {
49  if (ALIUtils::debug >= 7)
50  std::cout << std::endl << "LR:CREATE LIGHTRAY FROM SOURCE" << opto2->name() << std::endl;
51 
52  CLHEP::Hep3Vector _ZAxis(0., 0., 1.);
53  //- LightRay* linetmp;
54  //-linetmp = new LightRay;
55  //---------- set direction and point
56  setDirection(opto2->centreGlob() - opto1->centreGlob());
57  setPoint(opto1->centreGlob());
58 
59  if (ALIUtils::debug >= 9)
60  std::cout << "OPT" << opto1 << opto1->name() << std::endl;
61  //- std::cout << "centre glob" << &p1->aff()->centre_glob() << std::endl;
62  if (ALIUtils::debug >= 9) {
63  dumpData(" ");
64  }
65 }
static ALIint debug
Definition: ALIUtils.h:34
void setDirection(const CLHEP::Hep3Vector &direc)
Definition: LightRay.h:62
void setPoint(const CLHEP::Hep3Vector &point)
Definition: LightRay.h:63
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:374

◆ LightRay() [3/3]

LightRay::LightRay ( CLHEP::Hep3Vector &  vec1,
CLHEP::Hep3Vector &  vec2 
)

Definition at line 68 of file LightRay.cc.

References ALIUtils::debug, DeadROC_duringRun::dir, dumpData(), setDirection(), and setPoint().

68  {
69  CLHEP::Hep3Vector dir = vec2 - vec1;
70  dir *= 1. / dir.mag();
72  setPoint(vec1);
73  if (ALIUtils::debug >= 9) {
74  dumpData(" ");
75  }
76 }
static ALIint debug
Definition: ALIUtils.h:34
void setDirection(const CLHEP::Hep3Vector &direc)
Definition: LightRay.h:62
void setPoint(const CLHEP::Hep3Vector &point)
Definition: LightRay.h:63
std::vector< double > vec1
Definition: HCALResponse.h:15
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:374
std::vector< vec1 > vec2
Definition: HCALResponse.h:16

◆ ~LightRay()

LightRay::~LightRay ( )
inline

Definition at line 27 of file LightRay.h.

27 {};

Member Function Documentation

◆ direction()

const CLHEP::Hep3Vector& LightRay::direction ( ) const
inline

Definition at line 58 of file LightRay.h.

References _direction.

Referenced by OptOMirror::detailedDeviatesLightRay(), intersect(), OptOSensor2D::makeMeasurement(), refract(), and OptOUserDefined::userDefinedBehaviour().

58 { return _direction; }
CLHEP::Hep3Vector _direction
Definition: LightRay.h:73

◆ dumpData()

void LightRay::dumpData ( const ALIstring str) const

Definition at line 374 of file LightRay.cc.

References _direction, _point, gather_cfg::cout, ALIUtils::dump3v(), and str.

Referenced by OptOPinhole::defaultBehaviour(), OptOPlateSplitter::detailedDeviatesLightRay(), OptOMirror::detailedDeviatesLightRay(), OptOOpticalSquare::detailedDeviatesLightRay(), OptOCubeSplitter::detailedDeviatesLightRay(), OptOModifiedRhomboidPrism::detailedDeviatesLightRay(), OptOPlateSplitter::detailedTraversesLightRay(), OptOCubeSplitter::detailedTraversesLightRay(), OptOModifiedRhomboidPrism::detailedTraversesLightRay(), OptOSensor2D::detailedTraversesLightRay(), OptOMirror::detailedTraversesLightRay(), OptOModifiedRhomboidPrism::fastDeviatesLightRay(), OptOCubeSplitter::fastDeviatesLightRay(), OptOOpticalSquare::fastDeviatesLightRay(), OptOPlateSplitter::fastDeviatesLightRay(), OptOMirror::fastDeviatesLightRay(), OptOModifiedRhomboidPrism::fastTraversesLightRay(), OptOOpticalSquare::fastTraversesLightRay(), OptOCubeSplitter::fastTraversesLightRay(), OptOSensor2D::fastTraversesLightRay(), OptOPlateSplitter::fastTraversesLightRay(), OptOCOPS::fastTraversesLightRay(), OptOMirror::fastTraversesLightRay(), LightRay(), reflect(), refract(), startLightRay(), and OptOUserDefined::userDefinedBehaviour().

374  {
375  std::cout << str << std::endl;
376  ALIUtils::dump3v(_point, "$$ LightRay point: ");
377  ALIUtils::dump3v(_direction, "$$ LightRay direction: ");
378  /*
379  CLHEP::Hep3Vector dirn = _direction;
380  dirn.rotateZ( -23.72876*3.1415926/180.);
381  ALIUtils::dump3v( dirn, "$$ LightRay direction: ");
382  */
383 }
CLHEP::Hep3Vector _point
Definition: LightRay.h:74
CLHEP::Hep3Vector _direction
Definition: LightRay.h:73
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
#define str(s)

◆ intersect() [1/2]

void LightRay::intersect ( const ALIPlane plane)

Definition at line 93 of file LightRay.cc.

References _direction, _point, funct::abs(), DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, direction(), ALIUtils::dump3v(), beamvalidation::exit(), ALIPlane::normal(), and ALIPlane::point().

Referenced by OptOMirror::detailedDeviatesLightRay(), OptOSensor2D::detailedTraversesLightRay(), OptOModifiedRhomboidPrism::fastDeviatesLightRay(), OptOOpticalSquare::fastDeviatesLightRay(), OptOModifiedRhomboidPrism::fastTraversesLightRay(), OptOCubeSplitter::fastTraversesLightRay(), OptOOpticalSquare::fastTraversesLightRay(), OptOSensor2D::fastTraversesLightRay(), OptOCOPS::fastTraversesLightRay(), OptOPlateSplitter::fastTraversesLightRay(), OptOMirror::fastTraversesLightRay(), intersect(), OptOSensor2D::makeMeasurement(), OptOCOPS::makeMeasurement(), reflect(), refract(), and OptOUserDefined::userDefinedBehaviour().

93  {
94  if (ALIUtils::debug >= 4)
95  std::cout << "% LR INTERSECT WITH PLANE" << std::endl;
96  if (ALIUtils::debug >= 4) {
97  ALIUtils::dump3v(plane.point(), "plane point");
98  ALIUtils::dump3v(plane.normal(), "plane normal");
99  //- dumpData(" ");
100  }
101 
102  //---------- Check that they intersect
103  if (std::abs(plane.normal() * direction()) < 1.E-10) {
104  std::cerr << " !!!! INTERSECTION NOT POSSIBLE: LightRay is perpendicular to plane " << std::endl;
105  std::cerr << " plane.normal()*direction() = " << plane.normal() * direction() << std::endl;
106  ALIUtils::dump3v(direction(), "LightRay direction ");
107  ALIUtils::dump3v(plane.normal(), "plane normal ");
108  exit(1);
109  }
110 
111  //---------- Get intersection point between LightRay and plane
112  CLHEP::Hep3Vector vtemp = plane.point() - _point;
113  if (ALIUtils::debug >= 5)
114  ALIUtils::dump3v(vtemp, "n_r = point - point_plane");
115  ALIdouble dtemp = _direction * plane.normal();
116  if (ALIUtils::debug >= 5)
117  std::cout << " lightray* plate normal" << dtemp << std::endl;
118  if (dtemp != 0.) {
119  dtemp = (vtemp * plane.normal()) / dtemp;
120  if (ALIUtils::debug >= 5)
121  std::cout << " n_r*plate normal" << dtemp << std::endl;
122  } else {
123  std::cerr << "!!! LightRay: Intersect With Plane: plane and light ray parallel: no intersection" << std::endl;
124  }
125  vtemp = _direction * dtemp;
126  if (ALIUtils::debug >= 5)
127  ALIUtils::dump3v(vtemp, "n_r scaled");
128  CLHEP::Hep3Vector inters = vtemp + _point;
129  if (ALIUtils::debug >= 3)
130  ALIUtils::dump3v(inters, "INTERSECTION point ");
131 
132  _point = inters;
133 }
CLHEP::Hep3Vector _point
Definition: LightRay.h:74
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:34
const CLHEP::Hep3Vector & direction() const
Definition: LightRay.h:58
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CLHEP::Hep3Vector _direction
Definition: LightRay.h:73
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
const CLHEP::Hep3Vector & point() const
Definition: ALIPlane.h:22
const CLHEP::Hep3Vector & normal() const
Definition: ALIPlane.h:23
def exit(msg="")

◆ intersect() [2/2]

void LightRay::intersect ( const OpticalObject opto)

Definition at line 80 of file LightRay.cc.

References OpticalObject::centreGlob(), gather_cfg::cout, ALIUtils::debug, intersect(), and OpticalObject::rmGlob().

80  {
81  if (ALIUtils::debug >= 3)
82  std::cout << "% LR INTERSECT WITH OPTO" << std::endl;
83  CLHEP::Hep3Vector ZAxis(0., 0., 1.);
84  const CLHEP::HepRotation& rmt = opto.rmGlob();
85  ZAxis = rmt * ZAxis;
86  ALIPlane optoPlane(opto.centreGlob(), ZAxis);
87  intersect(optoPlane);
88 }
const CLHEP::Hep3Vector & centreGlob() const
Definition: OpticalObject.h:75
static ALIint debug
Definition: ALIUtils.h:34
const CLHEP::HepRotation & rmGlob() const
Definition: OpticalObject.h:83
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:93

◆ IntersectWithOptOPlane()

CLHEP::Hep3Vector LightRay::IntersectWithOptOPlane ( const OpticalObject optoplane)

◆ IntersectWithPlane()

CLHEP::Hep3Vector LightRay::IntersectWithPlane ( const CLHEP::Hep3Vector &  plane_point,
const CLHEP::Hep3Vector &  plane_normal 
)

◆ point()

const CLHEP::Hep3Vector& LightRay::point ( ) const
inline

◆ reflect()

void LightRay::reflect ( const ALIPlane plane)

Definition at line 138 of file LightRay.cc.

References _direction, gather_cfg::cout, ALIUtils::debug, ALIUtils::dump3v(), dumpData(), intersect(), and ALIPlane::normal().

Referenced by OptOPlateSplitter::detailedDeviatesLightRay(), OptOModifiedRhomboidPrism::detailedDeviatesLightRay(), OptOOpticalSquare::detailedDeviatesLightRay(), OptOCubeSplitter::detailedDeviatesLightRay(), OptOOpticalSquare::fastDeviatesLightRay(), OptOCubeSplitter::fastDeviatesLightRay(), OptOPlateSplitter::fastDeviatesLightRay(), and OptOMirror::fastDeviatesLightRay().

138  {
139  intersect(plane);
140  if (ALIUtils::debug >= 4)
141  std::cout << "% LR: REFLECT IN PLANE " << std::endl;
142  ALIdouble cosang = -(plane.normal() * _direction) / plane.normal().mag() / _direction.mag();
143  if (ALIUtils::debug >= 5) {
144  std::cout << " cosang = " << cosang << std::endl;
145  ALIUtils::dump3v(plane.normal(), " plane normal");
146  }
147  _direction += plane.normal() * 2 * cosang;
148  if (ALIUtils::debug >= 5)
149  dumpData("LightRay after reflection: ");
150 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:34
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:374
CLHEP::Hep3Vector _direction
Definition: LightRay.h:73
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:93
const CLHEP::Hep3Vector & normal() const
Definition: ALIPlane.h:23

◆ refract()

void LightRay::refract ( const ALIPlane plate,
const ALIdouble  refra_ind1,
const ALIdouble  refra_ind2 
)

Definition at line 157 of file LightRay.cc.

References funct::abs(), DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, direction(), ALIUtils::dump3v(), dumpData(), beamvalidation::exit(), intersect(), ALIPlane::normal(), setDirection(), and mathSSE::sqrt().

Referenced by OptOCubeSplitter::detailedDeviatesLightRay(), OptOModifiedRhomboidPrism::detailedDeviatesLightRay(), OptOOpticalSquare::detailedDeviatesLightRay(), OptOPlateSplitter::detailedTraversesLightRay(), OptOCubeSplitter::detailedTraversesLightRay(), OptOModifiedRhomboidPrism::detailedTraversesLightRay(), OptOOpticalSquare::detailedTraversesLightRay(), OptOSensor2D::detailedTraversesLightRay(), and OptOMirror::detailedTraversesLightRay().

157  {
158  if (ALIUtils::debug >= 5) {
159  std::cout << "% LR REFRACT: "
160  << "refra_ind1 = " << refra_ind1 << " refra_ind2 = " << refra_ind2 << std::endl;
161  std::cout << "@ First intersect with plate plane " << std::endl;
162  }
163 
164  intersect(plate);
165 
166  //---------- First plane: formed by plate normal and lightray, but get two ortonormal std::vectors in this plane (one of it plate normal)
167  CLHEP::Hep3Vector Axis1 = plate.normal().cross(direction());
168  //----- Check lightray is not parallel to plate normal
169  if (Axis1.mag() < 1.E-6) {
170  if (ALIUtils::debug >= 3) {
171  std::cout << " light ray normal to plane, no refraction " << std::endl;
172  }
173  if (ALIUtils::debug >= 2) {
174  dumpData("LightRay after refraction: ");
175  }
176 
177  return;
178  }
179 
180  if (ALIUtils::debug >= 5) {
181  ALIUtils::dump3v(Axis1, " axis 1 temp ");
182  }
183  Axis1 = Axis1.cross(plate.normal());
184  Axis1 *= 1. / Axis1.mag();
185  //----- Project lightray on this plane
186  if (ALIUtils::debug >= 4) {
187  ALIUtils::dump3v(plate.normal(), " plate normal ");
188  ALIUtils::dump3v(Axis1, " axis 1 ");
189  }
190 
191  //----- Angle between LightRay and plate_normal before traversing
192  ALIdouble cosang = -(plate.normal() * direction()) / plate.normal().mag() / direction().mag();
193  ALIdouble sinang = sqrt(1. - cosang * cosang);
194 
195  //----- Angle between LightRay projection and plate normal after traversing (refracted)
196  ALIdouble sinangp = sinang * refra_ind1 / refra_ind2;
197  if (std::abs(sinangp) > 1.) {
198  std::cerr << " !!!EXITING LightRay::refract: incidence ray on plane too close to face, refraction will not allow "
199  "entering "
200  << std::endl;
201  ALIUtils::dump3v(plate.normal(), " plate normal ");
202  ALIUtils::dump3v(direction(), " light ray direction ");
203  std::cout << " refraction index first medium " << refra_ind1 << " refraction index second medium " << refra_ind2
204  << std::endl;
205  exit(1);
206  }
207 
208  if (ALIUtils::debug >= 4) {
209  std::cout << "LightRay refract on plane 1: sin(ang) before = " << sinang << " sinang after " << sinangp
210  << std::endl;
211  }
212  ALIdouble cosangp = sqrt(1. - sinangp * sinangp);
213  //----- Change Lightray direction in this plane
214  //--- Get sign of projections in plate normal and axis1
215  ALIdouble signN = direction() * plate.normal();
216  signN /= std::abs(signN);
217  ALIdouble sign1 = direction() * Axis1;
218  sign1 /= std::abs(sign1);
219  if (ALIUtils::debug >= 4) {
220  dumpData("LightRay refract: direction before plate");
221  std::cout << " sign projection on plate normal " << signN << " sign projection on Axis1 " << sign1 << std::endl;
222  }
223  setDirection(signN * cosangp * plate.normal() + sign1 * sinangp * Axis1);
224  //- std::cout << " " << signN << " " << cosangp << " " << plate.normal() << " " << sign1 << " " << sinangp << " " << Axis1 << std::endl;
225 
226  if (ALIUtils::debug >= 3) {
227  dumpData("LightRay refract: direction after plate");
228  }
229 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:34
void setDirection(const CLHEP::Hep3Vector &direc)
Definition: LightRay.h:62
const CLHEP::Hep3Vector & direction() const
Definition: LightRay.h:58
T sqrt(T t)
Definition: SSEVec.h:23
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:374
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:93
const CLHEP::Hep3Vector & normal() const
Definition: ALIPlane.h:23
def exit(msg="")

◆ setDirection()

void LightRay::setDirection ( const CLHEP::Hep3Vector &  direc)
inline

◆ setPoint()

void LightRay::setPoint ( const CLHEP::Hep3Vector &  point)
inline

◆ shiftAndDeviateWhileTraversing() [1/2]

void LightRay::shiftAndDeviateWhileTraversing ( const OpticalObject opto,
char  behav 
)

Definition at line 235 of file LightRay.cc.

References gather_cfg::cout, ALIUtils::debug, and OpticalObject::findExtraEntryValue().

Referenced by OptOCubeSplitter::fastDeviatesLightRay(), OptOModifiedRhomboidPrism::fastDeviatesLightRay(), OptOOpticalSquare::fastDeviatesLightRay(), OptOPlateSplitter::fastDeviatesLightRay(), OptOMirror::fastDeviatesLightRay(), OptOOpticalSquare::fastTraversesLightRay(), OptOCubeSplitter::fastTraversesLightRay(), OptOModifiedRhomboidPrism::fastTraversesLightRay(), OptOSensor2D::fastTraversesLightRay(), OptOPlateSplitter::fastTraversesLightRay(), and OptOMirror::fastTraversesLightRay().

235  {
236  ALIstring ename("devi X");
237  ename[4] = behav;
238  ename[5] = 'X';
239  ALIdouble deviX = opto->findExtraEntryValue(ename);
240  ename[5] = 'Y';
241  ALIdouble deviY = opto->findExtraEntryValue(ename);
242  ename[5] = 'Z';
243  ALIdouble deviZ = opto->findExtraEntryValue(ename);
244 
245  ename = "shift X";
246  ename[5] = behav;
247  ename[6] = 'X';
248  ALIdouble shiftX = opto->findExtraEntryValue(ename);
249  ename[6] = 'Y';
250  ALIdouble shiftY = opto->findExtraEntryValue(ename);
251  ename[6] = 'Z';
252  ALIdouble shiftZ = opto->findExtraEntryValue(ename);
253 
254  if (ALIUtils::debug >= 3) {
255  //- std::cout << " shift X " << shiftX << " shiftY " << shiftY << " shiftZ " << shiftZ << std::endl;
256  //- std::cout << " deviX " << deviX << " deviY " << deviY << " deviZ " << deviZ << std::endl;
257  std::cout << " shift X " << shiftX << " shift Y " << shiftY << std::endl;
258  std::cout << " devi X " << deviX << " devi Y " << deviY << std::endl;
259  }
260 
261  shiftAndDeviateWhileTraversing(opto, shiftX, shiftY, shiftZ, deviX, deviY, deviZ);
262  // shiftAndDeviateWhileTraversing( shiftX, shiftY, deviX, deviY );
263 }
const ALIdouble findExtraEntryValue(const ALIstring &eename) const
long double ALIdouble
Definition: CocoaGlobals.h:11
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
Definition: LightRay.cc:235
static ALIint debug
Definition: ALIUtils.h:34
std::string ALIstring
Definition: CocoaGlobals.h:9

◆ shiftAndDeviateWhileTraversing() [2/2]

void LightRay::shiftAndDeviateWhileTraversing ( const OpticalObject opto,
ALIdouble  shiftX,
ALIdouble  shiftY,
ALIdouble  shiftZ,
ALIdouble  deviX,
ALIdouble  deviY,
ALIdouble  deviZ 
)

Definition at line 265 of file LightRay.cc.

References _direction, _point, gather_cfg::cout, ALIUtils::debug, ALIUtils::dump3v(), and OpticalObject::rmGlob().

271  {
272  //----- Get local opto X, Y and Z axis
273  CLHEP::Hep3Vector XAxis(1., 0., 0.);
274  CLHEP::Hep3Vector YAxis(0., 1., 0.);
275  CLHEP::Hep3Vector ZAxis(0., 0., 1.);
276  const CLHEP::HepRotation& rmt = opto->rmGlob();
277  XAxis = rmt * XAxis;
278  YAxis = rmt * YAxis;
279  ZAxis = rmt * ZAxis;
280 
281  if (ALIUtils::debug >= 5) {
282  ALIUtils::dump3v(XAxis, "X axis of opto");
283  ALIUtils::dump3v(YAxis, "Y axis of opto");
284  ALIUtils::dump3v(ZAxis, "Z axis of opto");
285  }
286 
287  //---------- Shift
288  CLHEP::Hep3Vector pointold = _point;
289  _point += shiftX * XAxis;
290  _point += shiftY * YAxis;
291  _point += shiftZ * ZAxis;
292  if (_point != pointold && ALIUtils::debug >= 3) {
293  ALIUtils::dump3v(_point - pointold, "CHANGE point");
294  }
295 
296  //---------- Deviate
297  CLHEP::Hep3Vector direcold = _direction;
298  if (ALIUtils::debug >= 5) {
299  ALIUtils::dump3v(XAxis, "XAxis");
300  ALIUtils::dump3v(YAxis, "YAxis");
301  ALIUtils::dump3v(ZAxis, "ZAxis");
302  ALIUtils::dump3v(_direction, "LightRay direction");
303  }
304 
305  _direction.rotate(deviX, XAxis);
306  if (_direction != direcold && ALIUtils::debug >= 3) {
307  std::cout << " deviX " << deviX << std::endl;
308  ALIUtils::dump3v(_direction - direcold, "CHANGE direction");
309  }
310  _direction.rotate(deviY, YAxis);
311  if (_direction != direcold && ALIUtils::debug >= 3) {
312  std::cout << " deviY " << deviY << std::endl;
313  ALIUtils::dump3v(_direction - direcold, "CHANGE direction");
314  }
315  _direction.rotate(deviZ, ZAxis);
316  if (_direction != direcold && ALIUtils::debug >= 3) {
317  std::cout << " deviZ " << deviZ << std::endl;
318  ALIUtils::dump3v(_direction - direcold, "CHANGE direction");
319  }
320 
321  if (_direction != direcold && ALIUtils::debug >= 3) {
322  ALIUtils::dump3v(_direction - direcold, "CHANGE direction");
323  }
324 }
CLHEP::Hep3Vector _point
Definition: LightRay.h:74
static ALIint debug
Definition: ALIUtils.h:34
CLHEP::Hep3Vector _direction
Definition: LightRay.h:73
const CLHEP::HepRotation & rmGlob() const
Definition: OpticalObject.h:83
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58

◆ startLightRay()

void LightRay::startLightRay ( OpticalObject opto)

Definition at line 26 of file LightRay.cc.

References OpticalObject::centreGlob(), gather_cfg::cout, ALIUtils::debug, dumpData(), ALIUtils::dumprm(), OpticalObject::name(), OpticalObject::rmGlob(), setDirection(), setPoint(), and OpticalObject::type().

Referenced by OptOLaser::defaultBehaviour(), OptOXLaser::defaultBehaviour(), OptOSource::defaultBehaviour(), and FittedEntriesManager::GetDifferentBetweenLasers().

26  {
27  if (ALIUtils::debug >= 3)
28  std::cout << std::endl << "LR: CREATE LIGHTRAY " << opto->name() << " OptO type is " << opto->type() << std::endl;
29 
30  //---------- Get Z axis of opto
31  CLHEP::Hep3Vector ZAxis(0., 0., 1.);
32  const CLHEP::HepRotation& rmt = opto->rmGlob();
33  ZAxis = rmt * ZAxis;
34 
35  //---------- By convention, direction of LightRay = opto_ZAxis
36  setDirection(ZAxis);
37  setPoint(opto->centreGlob());
38 
39  if (ALIUtils::debug >= 3) {
40  dumpData(" LightRay at creation ");
41  }
42  if (ALIUtils::debug >= 5) {
43  ALIUtils::dumprm(rmt, "laser Rotation matrix");
44  }
45 }
const CLHEP::Hep3Vector & centreGlob() const
Definition: OpticalObject.h:75
static void dumprm(const CLHEP::HepRotation &rm, const std::string &msg, std::ostream &out=std::cout)
Definition: ALIUtils.cc:71
static ALIint debug
Definition: ALIUtils.h:34
const ALIstring & name() const
Definition: OpticalObject.h:58
void setDirection(const CLHEP::Hep3Vector &direc)
Definition: LightRay.h:62
void setPoint(const CLHEP::Hep3Vector &point)
Definition: LightRay.h:63
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:374
const CLHEP::HepRotation & rmGlob() const
Definition: OpticalObject.h:83
const ALIstring & type() const
Definition: OpticalObject.h:59

Member Data Documentation

◆ _direction

CLHEP::Hep3Vector LightRay::_direction

◆ _point

CLHEP::Hep3Vector LightRay::_point