test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
OptOMirror Class Reference

#include <OptOMirror.h>

Inheritance diagram for OptOMirror:
OpticalObject

Public Member Functions

void constructSolidShape ()
 
void defaultBehaviour (LightRay &lightray, Measurement &meas)
 
virtual void detailedDeviatesLightRay (LightRay &lightray)
 
virtual void detailedTraversesLightRay (LightRay &lightray)
 
virtual void fastDeviatesLightRay (LightRay &lightray)
 
virtual void fastTraversesLightRay (LightRay &lightray)
 
 OptOMirror ()
 
 OptOMirror (OpticalObject *parent, const ALIstring &type, const ALIstring &name, const ALIbool copy_data)
 
 ~OptOMirror ()
 
- 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=0)
 
void construct ()
 
void constructFromOptAligInfo (const OpticalAlignInfo &oaInfo)
 
virtual void constructMaterial ()
 
const std::vector< Entry * > & CoordinateEntryList () const
 
void createComponentOptOsFromOptAlignInfo ()
 
double diff2pi (double ang1, double ang2)
 
void displaceCentreGlob (const XYZcoor coor, const ALIdouble disp)
 
void displaceCentreGlob (const CLHEP::Hep3Vector &dispVec)
 
void displaceCentreGlobOriginal (const XYZcoor coor, const ALIdouble disp)
 
void displaceCentreGlobOriginal (const CLHEP::Hep3Vector &dispVec)
 
void displaceCentreGlobOriginalOriginal (const XYZcoor coor, const ALIdouble disp)
 
void displaceCentreGlobOriginalOriginal (const CLHEP::Hep3Vector &dispVec)
 
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 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 XYZcoor coor) const
 
const double getEntryCentre (const ALIstring &coor) const
 
const double getEntryRMangle (const XYZcoor coor) const
 
const double getEntryRMangle (const ALIstring &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
 
virtual void makeMeasurement (LightRay &lightray, Measurement &meas)
 
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 ()
 

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 18 of file OptOMirror.h.

Constructor & Destructor Documentation

OptOMirror::OptOMirror ( )
inline

Definition at line 23 of file OptOMirror.h.

23 { };
OptOMirror::OptOMirror ( OpticalObject parent,
const ALIstring type,
const ALIstring name,
const ALIbool  copy_data 
)
inline

Definition at line 24 of file OptOMirror.h.

24  :
25  OpticalObject( parent, type, name, copy_data){ };
type
Definition: HCALResponse.h:21
const ALIstring & name() const
Definition: OpticalObject.h:60
OptOMirror::~OptOMirror ( )
inline

Definition at line 26 of file OptOMirror.h.

26 { };

Member Function Documentation

void OptOMirror::constructSolidShape ( )
virtual

Reimplemented from OpticalObject.

Definition at line 213 of file OptOMirror.cc.

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

214 {
215  ALIdouble go;
217  gomgr->getGlobalOptionValue("VisScale", go );
218 
219  theSolidShape = new CocoaSolidShapeBox( "Box", go*5.*cm/m, go*5.*cm/m, go*1.*cm/m ); //COCOA internal units are meters
220 }
long double ALIdouble
Definition: CocoaGlobals.h:11
CocoaSolidShape * theSolidShape
static GlobalOptionMgr * getInstance()
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found
void OptOMirror::defaultBehaviour ( LightRay lightray,
Measurement meas 
)
virtual

Reimplemented from OpticalObject.

Definition at line 24 of file OptOMirror.cc.

25 {
26  detailedDeviatesLightRay( lightray );
27 }
virtual void detailedDeviatesLightRay(LightRay &lightray)
Definition: OptOMirror.cc:33
void OptOMirror::detailedDeviatesLightRay ( LightRay lightray)
virtual

Reimplemented from OpticalObject.

Definition at line 33 of file OptOMirror.cc.

References ALI_DBL_MAX, gather_cfg::cout, ALIUtils::debug, LightRay::direction(), HLT_25ns14e33_v1_cff::distance, ALIUtils::dump3v(), LightRay::dumpData(), LightRay::intersect(), mag(), mergeVDriftHistosByStation::name, LightRay::point(), LightRay::setDirection(), and create_public_lumi_plots::width.

34 {
35  if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED REFLECTION IN MIRROR " << name() << std::endl;
36  if (ALIUtils::debug >= 3) ALIUtils::dump3v( centreGlob(), " centre Global ");
37 
38  //---------- Get forward plate and intersect lightray with it
39  ALIPlane plate = getPlate(1, 0);
40  lightray.intersect( plate );
41  CLHEP::Hep3Vector inters = lightray.point( );
42 
43  //---------- Get centre of forward plate
44  //----- Get Z axis
45  CLHEP::Hep3Vector ZAxis = getZAxis();
46  CLHEP::HepRotation rmt = rmGlob();
47  ZAxis = rmt * ZAxis;
48  //----- Get centre
50  CLHEP::Hep3Vector plate_centre = centreGlob() - 0.5 * width * ZAxis;
51  //- if(ALIUtils::debug >= 4) std::cout << " mirror width " << width << std::endl;
52 
53  //---------- Get the distance between the intersection point and the centre of the forward plate
54  ALIdouble distance = ( plate_centre - inters ).mag();
55 
56  //---------- Get normal to mirror at intersection point
57  //------- Get angle of mirror surface (angle between plate centre and intersection)
58  ALIdouble flatness = findExtraEntryValue("flatness");
59  //-- flatness is defined as number of 632 nm wavelengths
60  flatness *= 632.E-9;
61  ALIdouble length = 0.;
62 
63  ALIdouble curvature_radius;
64  ALIdouble angFlatness;
65  if( flatness != 0) {
66  length = findExtraEntryValueMustExist("length");
67  curvature_radius = (flatness*flatness + length*length) / (2*flatness);
68  angFlatness = asin( distance / curvature_radius);
69  } else {
70  curvature_radius = ALI_DBL_MAX;
71  angFlatness = 0;
72  }
73 
74  if (ALIUtils::debug >= 3) {
75  std::cout << " intersection with plate " << inters << std::endl;
76  std::cout << " plate_centre " << plate_centre << std::endl;
77  std::cout << " distance plate_centre - intersection " << distance << std::endl;
78  std::cout << " flatness " << flatness << ", length " << length;
79  std::cout << ", curvature radius " << curvature_radius << " angle of flatness " << angFlatness << std::endl;
80  }
81 
82  //----- Axis of rotation is perpendicular to Z Axis and to line plate_centre - intersection
83  CLHEP::Hep3Vector ipcV = inters - plate_centre;
84  if( ipcV.mag() != 0) ipcV *= 1./ipcV.mag();
85  CLHEP::HepRotation rtm = rmGlob();
86  ipcV = rtm*ipcV;
87  CLHEP::Hep3Vector rotationAxis = ipcV.cross(ZAxis);
88  //----- normal is object normal rotated around this axis
89  CLHEP::Hep3Vector inters_normal = CLHEP::Hep3Vector(0.,0.,1.);
90  inters_normal.rotate( angFlatness, rotationAxis );
91  inters_normal = rmt * inters_normal;
92 
93  if (ALIUtils::debug >= 2) {
94  ALIUtils::dump3v( ipcV, " intersection - plate_centre std::vector ");
95  std::cout << "rotation Axis " << rotationAxis << std::endl;
96  std::cout << " plate normal at intersection point " << inters_normal << std::endl;
97 }
98  //---------- Reflect in plate
99  ALIdouble cosang = -( inters_normal * lightray.direction() ) /
100  inters_normal.mag() / lightray.direction().mag();
101  CLHEP::Hep3Vector lrold = lightray.direction();
102  lightray.setDirection( lightray.direction() + inters_normal*2*cosang );
103 
104  if (ALIUtils::debug >= 2) {
105  lightray.dumpData("Reflected in mirror");
106  }
107 
108 }
long double ALIdouble
Definition: CocoaGlobals.h:11
const ALIdouble findExtraEntryValueMustExist(const ALIstring &eename) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
static ALIint debug
Definition: ALIUtils.h:35
const CLHEP::HepRotation & rmGlob() const
void setDirection(const CLHEP::Hep3Vector &direc)
Definition: LightRay.h:61
const CLHEP::Hep3Vector & point() const
Definition: LightRay.h:52
const ALIdouble findExtraEntryValue(const ALIstring &eename) const
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:61
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:100
CLHEP::Hep3Vector getZAxis()
const CLHEP::Hep3Vector & centreGlob() const
Definition: OpticalObject.h:85
ALIPlane getPlate(const ALIbool forwardPlate, const ALIbool applyWedge)
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 CLHEP::Hep3Vector & direction() const
Definition: LightRay.h:55
const double ALI_DBL_MAX
Definition: CocoaGlobals.h:24
void OptOMirror::detailedTraversesLightRay ( LightRay lightray)
virtual

Reimplemented from OpticalObject.

Definition at line 138 of file OptOMirror.cc.

References gather_cfg::cout, ALIUtils::debug, LightRay::dumpData(), mergeVDriftHistosByStation::name, LightRay::refract(), and create_public_lumi_plots::width.

139 {
140  if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED TRAVERSE IN MIRROR " << name() << std::endl;
141 
142  //---------- Get forward plate
143  ALIPlane plate = getPlate(1, 1);
144  //---------- If width is 0, just keep the same point
146  if( width == 0 ) {
147  if(ALIUtils::debug >= 3) lightray.dumpData("Traversed with 0 width");
148  return;
149  }
150 
151  //---------- Refract while entering mirror
152  ALIdouble refra_ind1 = 1.;
153  ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
154  lightray.refract( plate, refra_ind1, refra_ind2 );
155  if (ALIUtils::debug >= 2) {
156  lightray.dumpData("Refracted in first plate");
157  }
158 
159  //---------- Get backward plate
160  plate = getPlate(0, 1);
161  //---------- Refract while exiting mirror
162  lightray.refract( plate, refra_ind2, refra_ind1 );
163  if (ALIUtils::debug >= 2) {
164  lightray.dumpData("Refracted in first plate");
165  }
166 
167 }
long double ALIdouble
Definition: CocoaGlobals.h:11
void refract(const ALIPlane &plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
Definition: LightRay.cc:162
static ALIint debug
Definition: ALIUtils.h:35
const ALIdouble findExtraEntryValue(const ALIstring &eename) const
ALIPlane getPlate(const ALIbool forwardPlate, const ALIbool applyWedge)
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
void OptOMirror::fastDeviatesLightRay ( LightRay lightray)
virtual

Reimplemented from OpticalObject.

Definition at line 114 of file OptOMirror.cc.

References gather_cfg::cout, ALIUtils::debug, LightRay::dumpData(), mergeVDriftHistosByStation::name, LightRay::reflect(), and LightRay::shiftAndDeviateWhileTraversing().

115 {
116  if (ALIUtils::debug >= 2) std::cout << "LR: FAST REFLECTION IN MIRROR " << name() << std::endl;
117 
118  //---------- Get forward plate
119  ALIPlane plate = getPlate(1, 0);
120 
121  //---------- Reflect in plate (including intersection with it)
122  lightray.reflect( plate );
123  if (ALIUtils::debug >= 2) {
124  lightray.dumpData("Reflected in plate");
125  }
126  //---------- Deviate Lightray
127  // ALIdouble deviX = findExtraEntryValue("deviX");
128  // ALIdouble deviY = findExtraEntryValue("deviY");
129  // lightray.shiftAndDeviateWhileTraversing( this, 0., 0., 0., deviX, deviY, 0.);
130  lightray.shiftAndDeviateWhileTraversing( this, 'R' );
131  if (ALIUtils::debug >= 2) {
132  lightray.dumpData("Deviated ");
133  }
134 
135 }
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
Definition: LightRay.cc:240
static ALIint debug
Definition: ALIUtils.h:35
ALIPlane getPlate(const ALIbool forwardPlate, const ALIbool applyWedge)
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
void reflect(const ALIPlane &plane)
Definition: LightRay.cc:141
void OptOMirror::fastTraversesLightRay ( LightRay lightray)
virtual

Reimplemented from OpticalObject.

Definition at line 171 of file OptOMirror.cc.

References gather_cfg::cout, ALIUtils::debug, LightRay::dumpData(), LightRay::intersect(), mergeVDriftHistosByStation::name, and LightRay::shiftAndDeviateWhileTraversing().

172 {
173  if (ALIUtils::debug >= 2) std::cout << "LR: TRAVERSE MIRROR " << name() << std::endl;
174 
175  //---------- Get backward plate
176  ALIPlane plate = getPlate(0, 0);
177  lightray.intersect( plate );
178  if (ALIUtils::debug >= 2) {
179  lightray.dumpData("Intersected with plate");
180  }
181  //---------- Shift and Deviate
182  lightray.shiftAndDeviateWhileTraversing( this, 'T' );
183  if (ALIUtils::debug >= 2) {
184  lightray.dumpData("Shifted and Deviated");
185  }
186 
187 }
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
Definition: LightRay.cc:240
static ALIint debug
Definition: ALIUtils.h:35
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:100
ALIPlane getPlate(const ALIbool forwardPlate, const ALIbool applyWedge)
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