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::LightRay ( )

Definition at line 19 of file LightRay.cc.

References _direction, and _point.

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

Definition at line 52 of file LightRay.cc.

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

53 {
54  if(ALIUtils::debug >= 7) std::cout << std::endl << "LR:CREATE LIGHTRAY FROM SOURCE" << opto2->name() << std::endl;
55 
56  CLHEP::Hep3Vector _ZAxis(0.,0.,1.);
57  //- LightRay* linetmp;
58  //-linetmp = new LightRay;
59  //---------- set direction and point
60  setDirection( opto2->centreGlob() - opto1->centreGlob() );
61  setPoint( opto1->centreGlob() );
62 
63  if(ALIUtils::debug >= 9) std::cout << "OPT" << opto1 << opto1->name() << std::endl;
64  //- std::cout << "centre glob" << &p1->aff()->centre_glob() << std::endl;
65  if (ALIUtils::debug >= 9) {
66  dumpData(" ");
67  }
68 
69 }
static ALIint debug
Definition: ALIUtils.h:36
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:382
LightRay::LightRay ( CLHEP::Hep3Vector &  vec1,
CLHEP::Hep3Vector &  vec2 
)

Definition at line 73 of file LightRay.cc.

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

74 {
75  CLHEP::Hep3Vector dir = vec2 - vec1;
76  dir *= 1./dir.mag();
77  setDirection( dir );
78  setPoint( vec1 );
79  if (ALIUtils::debug >= 9) {
80  dumpData(" ");
81  }
82 }
static ALIint debug
Definition: ALIUtils.h:36
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:382
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.

References intersect(), reflect(), refract(), shiftAndDeviateWhileTraversing(), and startLightRay().

28 {};

Member Function Documentation

const CLHEP::Hep3Vector& LightRay::direction ( ) const
inline
void LightRay::dumpData ( const ALIstring str) const

Definition at line 382 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(), OptOModifiedRhomboidPrism::detailedTraversesLightRay(), OptOCubeSplitter::detailedTraversesLightRay(), OptOMirror::detailedTraversesLightRay(), OptOSensor2D::detailedTraversesLightRay(), direction(), OptOModifiedRhomboidPrism::fastDeviatesLightRay(), OptOOpticalSquare::fastDeviatesLightRay(), OptOCubeSplitter::fastDeviatesLightRay(), OptOPlateSplitter::fastDeviatesLightRay(), OptOMirror::fastDeviatesLightRay(), OptOCubeSplitter::fastTraversesLightRay(), OptOModifiedRhomboidPrism::fastTraversesLightRay(), OptOOpticalSquare::fastTraversesLightRay(), OptOSensor2D::fastTraversesLightRay(), OptOPlateSplitter::fastTraversesLightRay(), OptOCOPS::fastTraversesLightRay(), OptOMirror::fastTraversesLightRay(), LightRay(), reflect(), refract(), startLightRay(), and OptOUserDefined::userDefinedBehaviour().

383 {
384  std::cout << str << std::endl;
385  ALIUtils::dump3v( _point, "$$ LightRay point: ");
386  ALIUtils::dump3v( _direction, "$$ LightRay direction: ");
387  /*
388  CLHEP::Hep3Vector dirn = _direction;
389  dirn.rotateZ( -23.72876*3.1415926/180.);
390  ALIUtils::dump3v( dirn, "$$ LightRay direction: ");
391  */
392 }
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
void LightRay::intersect ( const ALIPlane plane)

Definition at line 101 of file LightRay.cc.

References _direction, _point, funct::abs(), MessageLogger_cfi::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(), OptOCubeSplitter::fastTraversesLightRay(), OptOModifiedRhomboidPrism::fastTraversesLightRay(), OptOOpticalSquare::fastTraversesLightRay(), OptOSensor2D::fastTraversesLightRay(), OptOCOPS::fastTraversesLightRay(), OptOPlateSplitter::fastTraversesLightRay(), OptOMirror::fastTraversesLightRay(), intersect(), OptOSensor2D::makeMeasurement(), OptOCOPS::makeMeasurement(), reflect(), refract(), OptOUserDefined::userDefinedBehaviour(), and ~LightRay().

102 {
103  if(ALIUtils::debug >= 4) std::cout << "% LR INTERSECT WITH PLANE" << std::endl;
104  if(ALIUtils::debug >= 4) {
105  ALIUtils::dump3v( plane.point(), "plane point");
106  ALIUtils::dump3v( plane.normal(), "plane normal");
107  //- dumpData(" ");
108  }
109 
110  //---------- Check that they intersect
111  if( std::abs( plane.normal()*direction() ) < 1.E-10 ) {
112  std::cerr << " !!!! INTERSECTION NOT POSSIBLE: LightRay is perpendicular to plane " << std::endl;
113  std::cerr << " plane.normal()*direction() = " << plane.normal()*direction() << std::endl;
114  ALIUtils::dump3v( direction(), "LightRay direction ");
115  ALIUtils::dump3v( plane.normal(), "plane normal ");
116  exit(1);
117  }
118 
119  //---------- Get intersection point between LightRay and plane
120  CLHEP::Hep3Vector vtemp = plane.point() - _point;
121  if(ALIUtils::debug >= 5) ALIUtils::dump3v( vtemp, "n_r = point - point_plane");
122  ALIdouble dtemp = _direction * plane.normal();
123  if(ALIUtils::debug >= 5) std::cout << " lightray* plate normal" << dtemp << std::endl;
124  if ( dtemp != 0. ) {
125  dtemp = (vtemp * plane.normal()) / dtemp;
126  if(ALIUtils::debug >= 5) std::cout << " n_r*plate normal" << dtemp << std::endl;
127  } else {
128  std::cerr << "!!! LightRay: Intersect With Plane: plane and light ray parallel: no intersection" << std::endl;
129  }
130  vtemp = _direction * dtemp;
131  if(ALIUtils::debug >= 5) ALIUtils::dump3v( vtemp, "n_r scaled");
132  CLHEP::Hep3Vector inters = vtemp + _point;
133  if(ALIUtils::debug >= 3) ALIUtils::dump3v( inters, "INTERSECTION point ");
134 
135  _point = inters;
136 }
CLHEP::Hep3Vector _point
Definition: LightRay.h:79
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:36
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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
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 87 of file LightRay.cc.

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

88 {
89  if(ALIUtils::debug >= 3) std::cout << "% LR INTERSECT WITH OPTO" << std::endl;
90  CLHEP::Hep3Vector ZAxis(0.,0.,1.);
91  const CLHEP::HepRotation& rmt = opto.rmGlob();
92  ZAxis = rmt*ZAxis;
93  ALIPlane optoPlane(opto.centreGlob(), ZAxis);
94  intersect( optoPlane );
95 }
static ALIint debug
Definition: ALIUtils.h:36
const CLHEP::HepRotation & rmGlob() const
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:101
const CLHEP::Hep3Vector & centreGlob() const
Definition: OpticalObject.h:85
CLHEP::Hep3Vector LightRay::IntersectWithOptOPlane ( const OpticalObject optoplane)

Referenced by setPoint().

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

Referenced by setPoint().

const CLHEP::Hep3Vector& LightRay::point ( ) const
inline
void LightRay::reflect ( const ALIPlane plane)

Definition at line 142 of file LightRay.cc.

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

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

143 {
144  intersect(plane);
145  if( ALIUtils::debug >= 4 ) std::cout << "% LR: REFLECT IN PLANE " << std::endl;
146  ALIdouble cosang = -(plane.normal() * _direction) /
147  plane.normal().mag() / _direction.mag();
148  if(ALIUtils::debug >= 5) {
149  std::cout << " cosang = " << cosang << std::endl;
150  ALIUtils::dump3v( plane.normal(), " plane normal");
151  }
152  _direction += plane.normal()*2*cosang;
153  if( ALIUtils::debug >= 5 ) dumpData("LightRay after reflection: ");
154 
155 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIint debug
Definition: ALIUtils.h:36
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:101
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:382
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 163 of file LightRay.cc.

References funct::abs(), MessageLogger_cfi::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(), OptOOpticalSquare::detailedTraversesLightRay(), OptOModifiedRhomboidPrism::detailedTraversesLightRay(), OptOSensor2D::detailedTraversesLightRay(), OptOMirror::detailedTraversesLightRay(), and ~LightRay().

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

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

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

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

Definition at line 273 of file LightRay.cc.

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

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

Definition at line 28 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(), FittedEntriesManager::GetDifferentBetweenLasers(), and ~LightRay().

29 {
30  if(ALIUtils::debug >= 3) std::cout << std::endl << "LR: CREATE LIGHTRAY " << opto->name() << " OptO type is " << opto->type() << std::endl;
31 
32  //---------- Get Z axis of opto
33  CLHEP::Hep3Vector ZAxis(0.,0.,1.);
34  const CLHEP::HepRotation& rmt = opto->rmGlob();
35  ZAxis = rmt * ZAxis;
36 
37  //---------- By convention, direction of LightRay = opto_ZAxis
38  setDirection( ZAxis );
39  setPoint( opto->centreGlob() );
40 
41  if (ALIUtils::debug >= 3) {
42  dumpData(" LightRay at creation ");
43  }
44  if (ALIUtils::debug >= 5) {
45  ALIUtils::dumprm( rmt, "laser Rotation matrix");
46  }
47 
48 }
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:36
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:382
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