CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
OptOOpticalSquare Class Reference

#include <OptOOpticalSquare.h>

Inheritance diagram for OptOOpticalSquare:
OpticalObject

Public Member Functions

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

Private Member Functions

void calculateFaces (ALIbool isDetailed)
 

Private Attributes

CLHEP::Hep3Vector faceP [5]
 
CLHEP::Hep3Vector faceV [5]
 

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 OptOOpticalSquare.h.

Constructor & Destructor Documentation

◆ OptOOpticalSquare() [1/2]

OptOOpticalSquare::OptOOpticalSquare ( )
inline

Definition at line 21 of file OptOOpticalSquare.h.

21 {};

◆ OptOOpticalSquare() [2/2]

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

Definition at line 22 of file OptOOpticalSquare.h.

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

◆ ~OptOOpticalSquare()

OptOOpticalSquare::~OptOOpticalSquare ( )
inlineoverride

Definition at line 24 of file OptOOpticalSquare.h.

24 {};

Member Function Documentation

◆ calculateFaces()

void OptOOpticalSquare::calculateFaces ( ALIbool  isDetailed)
private

Definition at line 146 of file OptOOpticalSquare.cc.

146  {
147  ALIint numberOfFaces = 5;
148 
149  //----- useful variables
150  CLHEP::Hep3Vector opto_centre = centreGlob();
151  if (ALIUtils::debug >= 3)
152  std::cout << "opto_centre " << opto_centre << std::endl;
153  const ALIdouble hlen1 = findExtraEntryValueMustExist("length1") / 2.;
154  const ALIdouble hlen2 = findExtraEntryValueMustExist("length2") / 2.;
155  ALIdouble ang = 67.5 * acos(0.) / 90.;
156 
157  //- if( ALIUtils::debug >= 3) std::cout << "length 1 " << 2*hlen1 << " length 2 " << hlen2 * 2 << std::endl;
158  faceP[0] = CLHEP::Hep3Vector(0, 0, -hlen1);
159  faceV[0] = CLHEP::Hep3Vector(0, 0, -1);
160  faceP[1] = CLHEP::Hep3Vector(0, hlen1 - hlen2 * sin(ang), hlen1 + hlen2 * cos(ang));
161  faceV[1] = CLHEP::Hep3Vector(0, cos(ang), sin(ang));
162 
163  faceP[2] = CLHEP::Hep3Vector(0, -hlen1 - hlen2 * cos(ang), -hlen1 + hlen2 * sin(ang));
164  faceV[2] = CLHEP::Hep3Vector(0, -sin(ang), -cos(ang));
165  faceP[3] = CLHEP::Hep3Vector(0, hlen1, 0);
166  faceV[3] = CLHEP::Hep3Vector(0, 1, 0);
167 
168  // face of added piece (so that light when traversing finds parallel surfaces at entry and exit)
169  faceP[4] = CLHEP::Hep3Vector(0, 0, hlen1 + 2 * hlen2 * cos(ang));
170  faceV[4] = CLHEP::Hep3Vector(0, 0, 1);
171 
172  //--------- Put faces in global reference frame
173  CLHEP::HepRotation rmt = rmGlob();
174  ALIint ii;
175  if (ALIUtils::debug >= 3) {
176  std::cout << " optical_square centre" << opto_centre << std::endl;
177  }
178  for (ii = 0; ii < numberOfFaces; ii++) {
179  faceP[ii] = rmt * faceP[ii];
180  faceP[ii] += opto_centre;
181  faceV[ii] = rmt * faceV[ii];
182  if (ALIUtils::debug >= 3) {
183  std::cout << "point at face " << ii << ": " << faceP[ii] << std::endl;
184  std::cout << "normal at face " << ii << ": " << faceV[ii] << std::endl;
185  }
186  }
187 
188  //----------- Correct faces 1 & 2 by wedge: rotate each face normal 1/2 of the wedge around two axis perpendicular to normal
189  if (isDetailed) {
190  ALIdouble wedge, wedgeX, wedgeY;
191  const ALIbool wxy = findExtraEntryValueIfExists("wedge", wedge);
192  if (!wxy) {
193  wedgeX = findExtraEntryValue("wedgeX");
194  wedgeY = findExtraEntryValue("wedgeY");
195  } else {
196  wedgeX = wedge;
197  wedgeY = wedge;
198  }
199 
200  //----- One axis is along X axis for the two faces (X belong to both faces)
201  if (ALIUtils::debug >= 4)
202  std::cout << "OptOOpticalSquare calculateFaces: wedgeX " << wedgeX << " wedgeY " << wedgeY << std::endl;
203  CLHEP::Hep3Vector Axis1(1., 0., 0.);
204  Axis1 = rmt * Axis1;
205  if (ALIUtils::debug >= 4) {
206  ALIUtils::dump3v(faceV[1], "faceV[1] before wedge");
207  ALIUtils::dump3v(faceV[2], "faceV[2] before wedge");
208  }
209  faceV[1].rotate(0.5 * wedgeX, Axis1);
210  if (ALIUtils::debug >= 4)
211  ALIUtils::dump3v(Axis1, " Axis1 in faceV[1] ");
212  faceV[2].rotate(-0.5 * wedgeX, Axis1);
213  if (ALIUtils::debug >= 4) {
214  ALIUtils::dump3v(Axis1, " Axis1 in faceV[2] ");
215  ALIUtils::dump3v(faceV[1], "faceV[1] after wedge X");
216  ALIUtils::dump3v(faceV[2], "faceV[2] after wedge X");
217  }
218 
219  //----- Other axis perpendicular to first and to normal of each face
220  CLHEP::Hep3Vector Axis2 = Axis1;
221  Axis2 = Axis2.cross(faceV[1]);
222  faceV[1].rotate(0.5 * wedgeY, Axis2);
223  if (ALIUtils::debug >= 4)
224  ALIUtils::dump3v(Axis2, " Axis2 in faceV[1] ");
225  Axis2 = Axis1;
226  Axis2 = Axis2.cross(faceV[2]);
227  faceV[2].rotate(-0.5 * wedgeY, Axis2);
228  if (ALIUtils::debug >= 4) {
229  ALIUtils::dump3v(Axis2, " Axis2 in faceV[2] ");
230  ALIUtils::dump3v(faceV[1], "faceV[1] after wedge Y");
231  ALIUtils::dump3v(faceV[2], "faceV[2] after wedge Y");
232  }
233  }
234 }

References funct::cos(), gather_cfg::cout, ALIUtils::debug, ALIUtils::dump3v(), cuy::ii, and funct::sin().

◆ constructSolidShape()

void OptOOpticalSquare::constructSolidShape ( )
overridevirtual

Reimplemented from OpticalObject.

Definition at line 257 of file OptOOpticalSquare.cc.

257  {
258  ALIdouble go;
260  gomgr->getGlobalOptionValue("VisScale", go);
261 
263  "Box", go * 5. * cm / m, go * 5. * cm / m, go * 5. * cm / m); //COCOA internal units are meters
264 }

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

◆ detailedDeviatesLightRay()

void OptOOpticalSquare::detailedDeviatesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 28 of file OptOOpticalSquare.cc.

28  {
29  if (ALIUtils::debug >= 2)
30  std::cout << "LR: DETAILED DEVIATION IN OPTICAL SQUARE " << name() << std::endl;
31 
32  calculateFaces(true);
33 
34  //---------- Deviate in prism
35  //---------- Refract after entering face 0, reflect in face 1, reflect in face 2, refract after face 3
36  const ALIdouble refra_ind = findExtraEntryValueMustExist("refra_ind");
37  const ALIdouble refra_ind0 = 1.;
38 
39  ALIint ii;
40  for (ii = 0; ii < 4; ii++) {
41  if (ii == 0) {
42  if (ALIUtils::debug >= 3)
43  std::cout << "## OPTOOPTICALSQUARE: refract in face " << ii << std::endl;
44  lightray.refract(ALIPlane(faceP[ii], faceV[ii]), refra_ind0, refra_ind);
45  } else if (ii == 3) {
46  //---- interchange refraction index for exiting instead of entering
47  lightray.refract(ALIPlane(faceP[ii], faceV[ii]), refra_ind, refra_ind0);
48  } else {
49  lightray.reflect(ALIPlane(faceP[ii], faceV[ii]));
50  }
51  if (ALIUtils::debug >= 3) {
52  lightray.dumpData("After face ");
53  }
54  }
55 
56  //----- checks that it is inside prism and the order of faces hit is the good one
57  //
58 }

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

◆ detailedTraversesLightRay()

void OptOOpticalSquare::detailedTraversesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 64 of file OptOOpticalSquare.cc.

64  {
65  if (ALIUtils::debug >= 2)
66  std::cout << "LR: DETAILED TRAVERSES OPTICAL SQUARE " << name() << std::endl;
67 
68  calculateFaces(true);
69  const ALIdouble refra_ind = findExtraEntryValueMustExist("refra_ind");
70  const ALIdouble refra_ind0 = 1.;
71 
72  lightray.refract(ALIPlane(faceP[0], faceV[0]), refra_ind0, refra_ind);
73  lightray.refract(ALIPlane(faceP[4], faceV[4]), refra_ind, refra_ind0);
74 }

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

◆ fastDeviatesLightRay()

void OptOOpticalSquare::fastDeviatesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 81 of file OptOOpticalSquare.cc.

81  {
82  if (ALIUtils::debug >= 2)
83  std::cout << "LR: FAST DEVIATION IN OPTICAL SQUARE " << name() << std::endl;
84 
85  calculateFaces(false);
86 
87  //---------- Deviate in prism
88  lightray.reflect(ALIPlane(faceP[1], faceV[1]));
89  if (ALIUtils::debug >= 3) {
90  lightray.dumpData("After face 1");
91  }
92  lightray.reflect(ALIPlane(faceP[2], faceV[2]));
93  if (ALIUtils::debug >= 3) {
94  lightray.dumpData("After face 2");
95  }
96  lightray.intersect(ALIPlane(faceP[3], faceV[3]));
97  if (ALIUtils::debug >= 3) {
98  lightray.dumpData("intersected at face 3");
99  }
100 
101  //----- Deviates by 'devi' X & Y??
102  lightray.shiftAndDeviateWhileTraversing(this, 'R');
103  /* ALIdouble deviRX = findExtraEntryValue("deviRX");
104  ALIdouble deviRY = findExtraEntryValue("deviRY");
105  ALIdouble shiftRX = findExtraEntryValue("shiftRX");
106  ALIdouble shiftRY = findExtraEntryValue("shiftRY");
107  lightray.shiftAndDeviateWhileTraversing( this, shiftRX, shiftRY, deviRX, deviRY);
108  */
109 
110  if (ALIUtils::debug >= 2) {
111  // std::cout << " shiftRX " << shiftRX << " shiftRY " << shiftRY << std::endl;
112  // std::cout << " deviRX " << deviRX << " deviRY " << deviRY << std::endl;
113  lightray.dumpData("Deviated ");
114  }
115 }

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

◆ fastTraversesLightRay()

void OptOOpticalSquare::fastTraversesLightRay ( LightRay lightray)
overridevirtual

Reimplemented from OpticalObject.

Definition at line 123 of file OptOOpticalSquare.cc.

123  {
124  // std::cerr << " WARNING there should be an extra piece to make entering and exiting surfaces parallel (like in modified_rhomboid_prism) " << std::endl;
125 
126  calculateFaces(false);
127 
128  lightray.intersect(ALIPlane(faceP[1], faceV[1]));
129  //---------- Shift and Deviate
130  lightray.shiftAndDeviateWhileTraversing(this, 'T');
131  /* ALIdouble shiftX = findExtraEntryValue("shiftTX");
132  ALIdouble shiftY = findExtraEntryValue("shiftTY");
133  ALIdouble deviTX = findExtraEntryValue("deviTX");
134  ALIdouble deviTY = findExtraEntryValue("deviTY");
135  lightray.shiftAndDeviateWhileTraversing( this, shiftX, shiftY, deviTX, deviTY);
136  */
137  if (ALIUtils::debug >= 2) {
138  lightray.dumpData("Shifted and Deviated");
139  }
140 }

References ALIUtils::debug, LightRay::dumpData(), LightRay::intersect(), and LightRay::shiftAndDeviateWhileTraversing().

Member Data Documentation

◆ faceP

CLHEP::Hep3Vector OptOOpticalSquare::faceP[5]
private

Definition at line 45 of file OptOOpticalSquare.h.

◆ faceV

CLHEP::Hep3Vector OptOOpticalSquare::faceV[5]
private

Definition at line 46 of file OptOOpticalSquare.h.

LightRay::dumpData
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:374
ALIbool
bool ALIbool
Definition: CocoaGlobals.h:19
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
OpticalObject::findExtraEntryValueIfExists
const ALIbool findExtraEntryValueIfExists(const ALIstring &eename, ALIdouble &value) const
Definition: OpticalObject.cc:1563
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
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
OpticalObject::rmGlob
const CLHEP::HepRotation & rmGlob() const
Definition: OpticalObject.h:83
LightRay::intersect
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:93
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
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
OptOOpticalSquare::calculateFaces
void calculateFaces(ALIbool isDetailed)
Definition: OptOOpticalSquare.cc:146
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
OpticalObject::parent
const OpticalObject * parent() const
Definition: OpticalObject.h:60
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
ALIPlane
Definition: ALIPlane.h:15
OpticalObject::findExtraEntryValueMustExist
const ALIdouble findExtraEntryValueMustExist(const ALIstring &eename) const
Definition: OpticalObject.cc:1548
ALIUtils::dump3v
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
OptOOpticalSquare::faceP
CLHEP::Hep3Vector faceP[5]
Definition: OptOOpticalSquare.h:45
OptOOpticalSquare::faceV
CLHEP::Hep3Vector faceV[5]
Definition: OptOOpticalSquare.h:46
LightRay::refract
void refract(const ALIPlane &plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
Definition: LightRay.cc:157
ALIint
int ALIint
Definition: CocoaGlobals.h:15
cuy.ii
ii
Definition: cuy.py:590