CMS 3D CMS Logo

List of all members | Public Member Functions
OptOMirror Class Reference

#include <OptOMirror.h>

Inheritance diagram for OptOMirror:
OpticalObject

Public Member Functions

void constructSolidShape () override
 
void defaultBehaviour (LightRay &lightray, Measurement &meas) override
 
void detailedDeviatesLightRay (LightRay &lightray) override
 
void detailedTraversesLightRay (LightRay &lightray) override
 
void fastDeviatesLightRay (LightRay &lightray) override
 
void fastTraversesLightRay (LightRay &lightray) override
 
 OptOMirror ()
 
 OptOMirror (OpticalObject *parent, const ALIstring &type, const ALIstring &name, const ALIbool copy_data)
 
 ~OptOMirror () 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 ()
 
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 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
 
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() [1/2]

OptOMirror::OptOMirror ( )
inline

Definition at line 21 of file OptOMirror.h.

21 {};

◆ OptOMirror() [2/2]

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

Definition at line 22 of file OptOMirror.h.

23  : OpticalObject(parent, type, name, copy_data){};

◆ ~OptOMirror()

OptOMirror::~OptOMirror ( )
inlineoverride

Definition at line 24 of file OptOMirror.h.

24 {};

Member Function Documentation

◆ constructSolidShape()

void OptOMirror::constructSolidShape ( )
overridevirtual

Reimplemented from OpticalObject.

Definition at line 203 of file OptOMirror.cc.

203  {
204  ALIdouble go;
206  gomgr->getGlobalOptionValue("VisScale", go);
207 
209  "Box", go * 5. * cm / m, go * 5. * cm / m, go * 1. * cm / m); //COCOA internal units are meters
210 }

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

◆ defaultBehaviour()

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

Reimplemented from OpticalObject.

Definition at line 24 of file OptOMirror.cc.

24 { detailedDeviatesLightRay(lightray); }

◆ detailedDeviatesLightRay()

void OptOMirror::detailedDeviatesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 29 of file OptOMirror.cc.

29  {
30  if (ALIUtils::debug >= 2)
31  std::cout << "LR: DETAILED REFLECTION IN MIRROR " << name() << std::endl;
32  if (ALIUtils::debug >= 3)
33  ALIUtils::dump3v(centreGlob(), " centre Global ");
34 
35  //---------- Get forward plate and intersect lightray with it
36  ALIPlane plate = getPlate(true, false);
37  lightray.intersect(plate);
38  CLHEP::Hep3Vector inters = lightray.point();
39 
40  //---------- Get centre of forward plate
41  //----- Get Z axis
42  CLHEP::Hep3Vector ZAxis = getZAxis();
43  CLHEP::HepRotation rmt = rmGlob();
44  ZAxis = rmt * ZAxis;
45  //----- Get centre
47  CLHEP::Hep3Vector plate_centre = centreGlob() - 0.5 * width * ZAxis;
48  //- if(ALIUtils::debug >= 4) std::cout << " mirror width " << width << std::endl;
49 
50  //---------- Get the distance between the intersection point and the centre of the forward plate
51  ALIdouble distance = (plate_centre - inters).mag();
52 
53  //---------- Get normal to mirror at intersection point
54  //------- Get angle of mirror surface (angle between plate centre and intersection)
55  ALIdouble flatness = findExtraEntryValue("flatness");
56  //-- flatness is defined as number of 632 nm wavelengths
57  flatness *= 632.E-9;
58  ALIdouble length = 0.;
59 
60  ALIdouble curvature_radius;
61  ALIdouble angFlatness;
62  if (flatness != 0) {
63  length = findExtraEntryValueMustExist("length");
64  curvature_radius = (flatness * flatness + length * length) / (2 * flatness);
65  angFlatness = asin(distance / curvature_radius);
66  } else {
67  curvature_radius = ALI_DBL_MAX;
68  angFlatness = 0;
69  }
70 
71  if (ALIUtils::debug >= 3) {
72  std::cout << " intersection with plate " << inters << std::endl;
73  std::cout << " plate_centre " << plate_centre << std::endl;
74  std::cout << " distance plate_centre - intersection " << distance << std::endl;
75  std::cout << " flatness " << flatness << ", length " << length;
76  std::cout << ", curvature radius " << curvature_radius << " angle of flatness " << angFlatness << std::endl;
77  }
78 
79  //----- Axis of rotation is perpendicular to Z Axis and to line plate_centre - intersection
80  CLHEP::Hep3Vector ipcV = inters - plate_centre;
81  if (ipcV.mag() != 0)
82  ipcV *= 1. / ipcV.mag();
83  CLHEP::HepRotation rtm = rmGlob();
84  ipcV = rtm * ipcV;
85  CLHEP::Hep3Vector rotationAxis = ipcV.cross(ZAxis);
86  //----- normal is object normal rotated around this axis
87  CLHEP::Hep3Vector inters_normal = CLHEP::Hep3Vector(0., 0., 1.);
88  inters_normal.rotate(angFlatness, rotationAxis);
89  inters_normal = rmt * inters_normal;
90 
91  if (ALIUtils::debug >= 2) {
92  ALIUtils::dump3v(ipcV, " intersection - plate_centre std::vector ");
93  std::cout << "rotation Axis " << rotationAxis << std::endl;
94  std::cout << " plate normal at intersection point " << inters_normal << std::endl;
95  }
96  //---------- Reflect in plate
97  ALIdouble cosang = -(inters_normal * lightray.direction()) / inters_normal.mag() / lightray.direction().mag();
98  CLHEP::Hep3Vector lrold = lightray.direction();
99  lightray.setDirection(lightray.direction() + inters_normal * 2 * cosang);
100 
101  if (ALIUtils::debug >= 2) {
102  lightray.dumpData("Reflected in mirror");
103  }
104 }

References ALI_DBL_MAX, gather_cfg::cout, ALIUtils::debug, LightRay::direction(), HLT_2018_cff::distance, ALIUtils::dump3v(), LightRay::dumpData(), LightRay::intersect(), mag(), Skims_PA_cff::name, LightRay::point(), LightRay::setDirection(), and ApeEstimator_cff::width.

◆ detailedTraversesLightRay()

void OptOMirror::detailedTraversesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 132 of file OptOMirror.cc.

132  {
133  if (ALIUtils::debug >= 2)
134  std::cout << "LR: DETAILED TRAVERSE IN MIRROR " << name() << std::endl;
135 
136  //---------- Get forward plate
137  ALIPlane plate = getPlate(true, true);
138  //---------- If width is 0, just keep the same point
140  if (width == 0) {
141  if (ALIUtils::debug >= 3)
142  lightray.dumpData("Traversed with 0 width");
143  return;
144  }
145 
146  //---------- Refract while entering mirror
147  ALIdouble refra_ind1 = 1.;
148  ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
149  lightray.refract(plate, refra_ind1, refra_ind2);
150  if (ALIUtils::debug >= 2) {
151  lightray.dumpData("Refracted in first plate");
152  }
153 
154  //---------- Get backward plate
155  plate = getPlate(false, true);
156  //---------- Refract while exiting mirror
157  lightray.refract(plate, refra_ind2, refra_ind1);
158  if (ALIUtils::debug >= 2) {
159  lightray.dumpData("Refracted in first plate");
160  }
161 }

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

◆ fastDeviatesLightRay()

void OptOMirror::fastDeviatesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 109 of file OptOMirror.cc.

109  {
110  if (ALIUtils::debug >= 2)
111  std::cout << "LR: FAST REFLECTION IN MIRROR " << name() << std::endl;
112 
113  //---------- Get forward plate
114  ALIPlane plate = getPlate(true, false);
115 
116  //---------- Reflect in plate (including intersection with it)
117  lightray.reflect(plate);
118  if (ALIUtils::debug >= 2) {
119  lightray.dumpData("Reflected in plate");
120  }
121  //---------- Deviate Lightray
122  // ALIdouble deviX = findExtraEntryValue("deviX");
123  // ALIdouble deviY = findExtraEntryValue("deviY");
124  // lightray.shiftAndDeviateWhileTraversing( this, 0., 0., 0., deviX, deviY, 0.);
125  lightray.shiftAndDeviateWhileTraversing(this, 'R');
126  if (ALIUtils::debug >= 2) {
127  lightray.dumpData("Deviated ");
128  }
129 }

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

◆ fastTraversesLightRay()

void OptOMirror::fastTraversesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 164 of file OptOMirror.cc.

164  {
165  if (ALIUtils::debug >= 2)
166  std::cout << "LR: TRAVERSE MIRROR " << name() << std::endl;
167 
168  //---------- Get backward plate
169  ALIPlane plate = getPlate(false, false);
170  lightray.intersect(plate);
171  if (ALIUtils::debug >= 2) {
172  lightray.dumpData("Intersected with plate");
173  }
174  //---------- Shift and Deviate
175  lightray.shiftAndDeviateWhileTraversing(this, 'T');
176  if (ALIUtils::debug >= 2) {
177  lightray.dumpData("Shifted and Deviated");
178  }
179 }

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

LightRay::dumpData
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:374
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
OpticalObject::findExtraEntryValue
const ALIdouble findExtraEntryValue(const ALIstring &eename) const
Definition: OpticalObject.cc:1519
GlobalOptionMgr
Definition: GlobalOptionMgr.h:18
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
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
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
CocoaSolidShapeBox
Definition: CocoaSolidShapeBox.h:13
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
OptOMirror::detailedDeviatesLightRay
void detailedDeviatesLightRay(LightRay &lightray) override
Definition: OptOMirror.cc:29
ALIUtils::debug
static ALIint debug
Definition: ALIUtils.h:34
LightRay::reflect
void reflect(const ALIPlane &plane)
Definition: LightRay.cc:138
LightRay::shiftAndDeviateWhileTraversing
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
Definition: LightRay.cc:235
OpticalObject::OpticalObject
OpticalObject()
Definition: OpticalObject.h:40
ALI_DBL_MAX
const double ALI_DBL_MAX
Definition: CocoaGlobals.h:24
OpticalObject::parent
const OpticalObject * parent() const
Definition: OpticalObject.h:60
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
ALIPlane
Definition: ALIPlane.h:15
LightRay::direction
const CLHEP::Hep3Vector & direction() const
Definition: LightRay.h:58
OpticalObject::findExtraEntryValueMustExist
const ALIdouble findExtraEntryValueMustExist(const ALIstring &eename) const
Definition: OpticalObject.cc:1548
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
LightRay::setDirection
void setDirection(const CLHEP::Hep3Vector &direc)
Definition: LightRay.h:62
type
type
Definition: HCALResponse.h:21
ALIUtils::dump3v
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
LightRay::refract
void refract(const ALIPlane &plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
Definition: LightRay.cc:157
OpticalObject::getPlate
ALIPlane getPlate(const ALIbool forwardPlate, const ALIbool applyWedge)
Definition: OpticalObject.cc:946
OpticalObject::getZAxis
CLHEP::Hep3Vector getZAxis()
Definition: OpticalObject.h:143