CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::LightRay ( )

Definition at line 18 of file LightRay.cc.

References _direction, and _point.

19 {
20  _point = CLHEP::Hep3Vector(0.,0.,0.);
21  _direction = CLHEP::Hep3Vector(0.,0.,1.);
22 }
CLHEP::Hep3Vector _point
Definition: LightRay.h:79
CLHEP::Hep3Vector _direction
Definition: LightRay.h:78
LightRay::LightRay ( OpticalObject p1,
OpticalObject p2 
)

Definition at line 51 of file LightRay.cc.

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

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

Definition at line 72 of file LightRay.cc.

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

73 {
74  CLHEP::Hep3Vector dir = vec2 - vec1;
75  dir *= 1./dir.mag();
76  setDirection( dir );
77  setPoint( vec1 );
78  if (ALIUtils::debug >= 9) {
79  dumpData(" ");
80  }
81 }
static ALIint debug
Definition: ALIUtils.h:35
void setDirection(const CLHEP::Hep3Vector &direc)
Definition: LightRay.h:61
void setPoint(const CLHEP::Hep3Vector &point)
Definition: LightRay.h:64
std::vector< double > vec1
Definition: HCALResponse.h:15
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:381
dbl *** dir
Definition: mlp_gen.cc:35
std::vector< vec1 > vec2
Definition: HCALResponse.h:16
LightRay::~LightRay ( )
inline

Definition at line 28 of file LightRay.h.

28 {};

Member Function Documentation

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

Definition at line 55 of file LightRay.h.

References _direction.

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

55  {
56  return _direction;
57  }
CLHEP::Hep3Vector _direction
Definition: LightRay.h:78
void LightRay::dumpData ( const ALIstring str) const

Definition at line 381 of file LightRay.cc.

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

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().

382 {
383  std::cout << str << std::endl;
384  ALIUtils::dump3v( _point, "$$ LightRay point: ");
385  ALIUtils::dump3v( _direction, "$$ LightRay direction: ");
386  /*
387  CLHEP::Hep3Vector dirn = _direction;
388  dirn.rotateZ( -23.72876*3.1415926/180.);
389  ALIUtils::dump3v( dirn, "$$ LightRay direction: ");
390  */
391 }
CLHEP::Hep3Vector _point
Definition: LightRay.h:79
CLHEP::Hep3Vector _direction
Definition: LightRay.h:78
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:61
tuple cout
Definition: gather_cfg.py:121
void LightRay::intersect ( const ALIPlane plane)

Definition at line 100 of file LightRay.cc.

References _direction, _point, dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, ALIUtils::debug, direction(), ALIUtils::dump3v(), cmsRelvalreport::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().

101 {
102  if(ALIUtils::debug >= 4) std::cout << "% LR INTERSECT WITH PLANE" << std::endl;
103  if(ALIUtils::debug >= 4) {
104  ALIUtils::dump3v( plane.point(), "plane point");
105  ALIUtils::dump3v( plane.normal(), "plane normal");
106  //- dumpData(" ");
107  }
108 
109  //---------- Check that they intersect
110  if( fabs( plane.normal()*direction() ) < 1.E-10 ) {
111  std::cerr << " !!!! INTERSECTION NOT POSSIBLE: LightRay is perpendicular to plane " << std::endl;
112  std::cerr << " plane.normal()*direction() = " << plane.normal()*direction() << std::endl;
113  ALIUtils::dump3v( direction(), "LightRay direction ");
114  ALIUtils::dump3v( plane.normal(), "plane normal ");
115  exit(1);
116  }
117 
118  //---------- Get intersection point between LightRay and plane
119  CLHEP::Hep3Vector vtemp = plane.point() - _point;
120  if(ALIUtils::debug >= 5) ALIUtils::dump3v( vtemp, "n_r = point - point_plane");
121  ALIdouble dtemp = _direction * plane.normal();
122  if(ALIUtils::debug >= 5) std::cout << " lightray* plate normal" << dtemp << std::endl;
123  if ( dtemp != 0. ) {
124  dtemp = (vtemp * plane.normal()) / dtemp;
125  if(ALIUtils::debug >= 5) std::cout << " n_r*plate normal" << dtemp << std::endl;
126  } else {
127  std::cerr << "!!! LightRay: Intersect With Plane: plane and light ray parallel: no intersection" << std::endl;
128  }
129  vtemp = _direction * dtemp;
130  if(ALIUtils::debug >= 5) ALIUtils::dump3v( vtemp, "n_r scaled");
131  CLHEP::Hep3Vector inters = vtemp + _point;
132  if(ALIUtils::debug >= 3) ALIUtils::dump3v( inters, "INTERSECTION point ");
133 
134  _point = inters;
135 }
CLHEP::Hep3Vector _point
Definition: LightRay.h:79
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:35
const CLHEP::Hep3Vector & point() const
Definition: ALIPlane.h:23
CLHEP::Hep3Vector _direction
Definition: LightRay.h:78
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:61
tuple cout
Definition: gather_cfg.py:121
const CLHEP::Hep3Vector & normal() const
Definition: ALIPlane.h:24
const CLHEP::Hep3Vector & direction() const
Definition: LightRay.h:55
void LightRay::intersect ( const OpticalObject opto)

Definition at line 86 of file LightRay.cc.

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

87 {
88  if(ALIUtils::debug >= 3) std::cout << "% LR INTERSECT WITH OPTO" << std::endl;
89  CLHEP::Hep3Vector ZAxis(0.,0.,1.);
90  CLHEP::HepRotation rmt = opto.rmGlob();
91  ZAxis = rmt*ZAxis;
92  ALIPlane optoPlane(opto.centreGlob(), ZAxis);
93  intersect( optoPlane );
94 }
static ALIint debug
Definition: ALIUtils.h:35
const CLHEP::HepRotation & rmGlob() const
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:100
const CLHEP::Hep3Vector & centreGlob() const
Definition: OpticalObject.h:85
tuple cout
Definition: gather_cfg.py:121
CLHEP::Hep3Vector LightRay::IntersectWithOptOPlane ( const OpticalObject optoplane)
CLHEP::Hep3Vector LightRay::IntersectWithPlane ( const CLHEP::Hep3Vector &  plane_point,
const CLHEP::Hep3Vector &  plane_normal 
)
const CLHEP::Hep3Vector& LightRay::point ( ) const
inline
void LightRay::reflect ( const ALIPlane plane)

Definition at line 141 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().

142 {
143  intersect(plane);
144  if( ALIUtils::debug >= 4 ) std::cout << "% LR: REFLECT IN PLANE " << std::endl;
145  ALIdouble cosang = -(plane.normal() * _direction) /
146  plane.normal().mag() / _direction.mag();
147  if(ALIUtils::debug >= 5) {
148  std::cout << " cosang = " << cosang << std::endl;
149  ALIUtils::dump3v( plane.normal(), " plane normal");
150  }
151  _direction += plane.normal()*2*cosang;
152  if( ALIUtils::debug >= 5 ) dumpData("LightRay after reflection: ");
153 
154 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:35
CLHEP::Hep3Vector _direction
Definition: LightRay.h:78
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:61
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:100
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:381
tuple cout
Definition: gather_cfg.py:121
const CLHEP::Hep3Vector & normal() const
Definition: ALIPlane.h:24
void LightRay::refract ( const ALIPlane plate,
const ALIdouble  refra_ind1,
const ALIdouble  refra_ind2 
)

Definition at line 162 of file LightRay.cc.

References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, ALIUtils::debug, direction(), ALIUtils::dump3v(), dumpData(), cmsRelvalreport::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().

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

Definition at line 61 of file LightRay.h.

References _direction.

Referenced by OptOPinhole::defaultBehaviour(), OptOMirror::detailedDeviatesLightRay(), LightRay(), refract(), startLightRay(), and OptOUserDefined::userDefinedBehaviour().

61  {
62  _direction = direc;
63  }
CLHEP::Hep3Vector _direction
Definition: LightRay.h:78
void LightRay::setPoint ( const CLHEP::Hep3Vector &  point)
inline
void LightRay::shiftAndDeviateWhileTraversing ( const OpticalObject opto,
char  behav 
)

Definition at line 240 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().

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

Definition at line 272 of file LightRay.cc.

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

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

Definition at line 27 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().

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

Member Data Documentation

CLHEP::Hep3Vector LightRay::_direction
CLHEP::Hep3Vector LightRay::_point