CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
virtual void detailedDeviatesLightRay (LightRay &lightray)
 
virtual void detailedTraversesLightRay (LightRay &lightray)
 
virtual void fastDeviatesLightRay (LightRay &lightray)
 
virtual void fastTraversesLightRay (LightRay &lightray)
 
 OptOOpticalSquare ()
 
 OptOOpticalSquare (OpticalObject *parent, const ALIstring &type, const ALIstring &name, const ALIbool copy_data)
 
 ~OptOOpticalSquare ()
 
- 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 ()
 
virtual void defaultBehaviour (LightRay &lightray, Measurement &meas)
 
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 (std::vector< Entry * > entries) const
 
CocoaMaterialElementarygetMaterial () const
 
ALIPlane getPlate (const ALIbool forwardPlate, const ALIbool applyWedge)
 
std::vector< double > getRotationAnglesFromMatrix (CLHEP::HepRotation &rmLocal, std::vector< Entry * > entries) const
 
std::vector< double > getRotationAnglesInOptOFrame (const OpticalObject *optoAncestor, 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::OptOOpticalSquare ( )
inline

Definition at line 23 of file OptOOpticalSquare.h.

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

Definition at line 24 of file OptOOpticalSquare.h.

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

Definition at line 26 of file OptOOpticalSquare.h.

26 { };

Member Function Documentation

void OptOOpticalSquare::calculateFaces ( ALIbool  isDetailed)
private

Definition at line 154 of file OptOOpticalSquare.cc.

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

155 {
156 
157  ALIint numberOfFaces = 5;
158 
159  //----- useful variables
160  CLHEP::Hep3Vector opto_centre = centreGlob();
161  if(ALIUtils::debug >= 3) std::cout << "opto_centre " << opto_centre << std::endl;
162  const ALIdouble hlen1 = findExtraEntryValueMustExist("length1") / 2.;
163  const ALIdouble hlen2 = findExtraEntryValueMustExist("length2") / 2.;
164  ALIdouble ang = 67.5*acos(0.)/90.;
165 
166  //- if( ALIUtils::debug >= 3) std::cout << "length 1 " << 2*hlen1 << " length 2 " << hlen2 * 2 << std::endl;
167  faceP[0] = CLHEP::Hep3Vector( 0, 0 , -hlen1 );
168  faceV[0] = CLHEP::Hep3Vector( 0, 0, -1 );
169  faceP[1] = CLHEP::Hep3Vector( 0, hlen1 - hlen2*sin(ang), hlen1 + hlen2*cos(ang) );
170  faceV[1] = CLHEP::Hep3Vector( 0, cos(ang), sin(ang) );
171 
172  faceP[2] = CLHEP::Hep3Vector( 0, -hlen1 - hlen2*cos(ang), -hlen1 + hlen2*sin(ang) );
173  faceV[2] = CLHEP::Hep3Vector( 0, -sin(ang), -cos(ang) );
174  faceP[3] = CLHEP::Hep3Vector( 0, hlen1, 0 );
175  faceV[3] = CLHEP::Hep3Vector( 0, 1, 0 );
176 
177  // face of added piece (so that light when traversing finds parallel surfaces at entry and exit)
178  faceP[4] = CLHEP::Hep3Vector( 0, 0, hlen1 + 2*hlen2*cos(ang) );
179  faceV[4] = CLHEP::Hep3Vector( 0, 0, 1 );
180 
181  //--------- Put faces in global reference frame
182  CLHEP::HepRotation rmt = rmGlob();
183  ALIint ii;
184  if (ALIUtils::debug >= 3) {
185  std::cout << " optical_square centre" << opto_centre << std::endl;
186  }
187  for( ii = 0; ii < numberOfFaces; ii++ ) {
188  faceP[ii] = rmt * faceP[ii];
189  faceP[ii] += opto_centre;
190  faceV[ii] = rmt * faceV[ii];
191  if (ALIUtils::debug >= 3) {
192  std::cout << "point at face " << ii << ": " << faceP[ii] << std::endl;
193  std::cout << "normal at face " << ii << ": " << faceV[ii] << std::endl;
194  }
195  }
196 
197  //----------- Correct faces 1 & 2 by wedge: rotate each face normal 1/2 of the wedge around two axis perpendicular to normal
198  if( isDetailed ) {
199  ALIdouble wedge, wedgeX, wedgeY;
200  const ALIbool wxy = findExtraEntryValueIfExists("wedge", wedge);
201  if( !wxy ) {
202  wedgeX = findExtraEntryValue("wedgeX");
203  wedgeY = findExtraEntryValue("wedgeY");
204  } else {
205  wedgeX = wedge;
206  wedgeY = wedge;
207  }
208 
209  //----- One axis is along X axis for the two faces (X belong to both faces)
210  if(ALIUtils::debug >= 4) std::cout << "OptOOpticalSquare calculateFaces: wedgeX " << wedgeX << " wedgeY " << wedgeY << std::endl;
211  CLHEP::Hep3Vector Axis1(1.,0.,0.);
212  Axis1 = rmt * Axis1;
213  if( ALIUtils::debug >= 4) {
214  ALIUtils::dump3v(faceV[1], "faceV[1] before wedge");
215  ALIUtils::dump3v(faceV[2], "faceV[2] before wedge");
216  }
217  faceV[1].rotate(0.5* wedgeX, Axis1);
218  if( ALIUtils::debug >= 4) ALIUtils::dump3v( Axis1, " Axis1 in faceV[1] ");
219  faceV[2].rotate(-0.5* wedgeX, Axis1);
220  if( ALIUtils::debug >= 4) {
221  ALIUtils::dump3v( Axis1, " Axis1 in faceV[2] ");
222  ALIUtils::dump3v(faceV[1], "faceV[1] after wedge X");
223  ALIUtils::dump3v(faceV[2], "faceV[2] after wedge X");
224  }
225 
226  //----- Other axis perpendicular to first and to normal of each face
227  CLHEP::Hep3Vector Axis2 = Axis1;
228  Axis2 = Axis2.cross( faceV[1] );
229  faceV[1].rotate(0.5* wedgeY, Axis2);
230  if( ALIUtils::debug >= 4) ALIUtils::dump3v( Axis2, " Axis2 in faceV[1] ");
231  Axis2 = Axis1;
232  Axis2 = Axis2.cross( faceV[2] );
233  faceV[2].rotate(-0.5* wedgeY, Axis2);
234  if( ALIUtils::debug >= 4) {
235  ALIUtils::dump3v( Axis2, " Axis2 in faceV[2] ");
236  ALIUtils::dump3v(faceV[1], "faceV[1] after wedge Y");
237  ALIUtils::dump3v(faceV[2], "faceV[2] after wedge Y");
238  }
239 
240  }
241 
242 }
long double ALIdouble
Definition: CocoaGlobals.h:11
const ALIdouble findExtraEntryValueMustExist(const ALIstring &eename) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const ALIbool findExtraEntryValueIfExists(const ALIstring &eename, ALIdouble &value) const
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:35
const CLHEP::HepRotation & rmGlob() const
bool ALIbool
Definition: CocoaGlobals.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CLHEP::Hep3Vector faceP[5]
const ALIdouble findExtraEntryValue(const ALIstring &eename) const
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:61
const CLHEP::Hep3Vector & centreGlob() const
Definition: OpticalObject.h:85
tuple cout
Definition: gather_cfg.py:121
CLHEP::Hep3Vector faceV[5]
void OptOOpticalSquare::constructSolidShape ( )
virtual

Reimplemented from OpticalObject.

Definition at line 266 of file OptOOpticalSquare.cc.

References GlobalOptionMgr::getGlobalOptionValue(), GlobalOptionMgr::getInstance(), and m.

267 {
268  ALIdouble go;
270  gomgr->getGlobalOptionValue("VisScale", go );
271 
272  theSolidShape = new CocoaSolidShapeBox( "Box", go*5.*cm/m, go*5.*cm/m, go*5.*cm/m ); //COCOA internal units are meters
273 }
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 OptOOpticalSquare::detailedDeviatesLightRay ( LightRay lightray)
virtual

Reimplemented from OpticalObject.

Definition at line 28 of file OptOOpticalSquare.cc.

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

29 {
30  if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED DEVIATION IN OPTICAL SQUARE " << name() << std::endl;
31 
32  calculateFaces( 1 );
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 ) std::cout << "## OPTOOPTICALSQUARE: refract in face " << ii << std::endl;
43  lightray.refract( ALIPlane(faceP[ii],faceV[ii]), refra_ind0, refra_ind );
44  } else if( ii == 3) {
45  //---- interchange refraction index for exiting instead of entering
46  lightray.refract( ALIPlane(faceP[ii],faceV[ii]), refra_ind, refra_ind0 );
47  } else {
48  lightray.reflect( ALIPlane(faceP[ii],faceV[ii] ));
49  }
50  if (ALIUtils::debug >= 3) {
51  lightray.dumpData( "After face ");
52  }
53  }
54 
55  //----- checks that it is inside prism and the order of faces hit is the good one
56  //
57 
58 }
long double ALIdouble
Definition: CocoaGlobals.h:11
const ALIdouble findExtraEntryValueMustExist(const ALIstring &eename) const
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:35
CLHEP::Hep3Vector faceP[5]
void refract(const ALIPlane plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
Definition: LightRay.cc:162
void calculateFaces(ALIbool isDetailed)
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
CLHEP::Hep3Vector faceV[5]
void OptOOpticalSquare::detailedTraversesLightRay ( LightRay lightray)
virtual

Reimplemented from OpticalObject.

Definition at line 65 of file OptOOpticalSquare.cc.

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

66 {
67  if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED TRAVERSES OPTICAL SQUARE " << name() << std::endl;
68 
69  calculateFaces( 1 );
70  const ALIdouble refra_ind = findExtraEntryValueMustExist("refra_ind");
71  const ALIdouble refra_ind0 = 1.;
72 
73  lightray.refract( ALIPlane(faceP[0],faceV[0]), refra_ind0, refra_ind );
74  lightray.refract( ALIPlane(faceP[4],faceV[4]), refra_ind, refra_ind0 );
75 
76 }
long double ALIdouble
Definition: CocoaGlobals.h:11
const ALIdouble findExtraEntryValueMustExist(const ALIstring &eename) const
static ALIint debug
Definition: ALIUtils.h:35
CLHEP::Hep3Vector faceP[5]
void refract(const ALIPlane plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
Definition: LightRay.cc:162
void calculateFaces(ALIbool isDetailed)
tuple cout
Definition: gather_cfg.py:121
const ALIstring & name() const
Definition: OpticalObject.h:60
CLHEP::Hep3Vector faceV[5]
void OptOOpticalSquare::fastDeviatesLightRay ( LightRay lightray)
virtual

Reimplemented from OpticalObject.

Definition at line 84 of file OptOOpticalSquare.cc.

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

85 {
86  if (ALIUtils::debug >= 2) std::cout << "LR: FAST DEVIATION IN OPTICAL SQUARE " << name() << std::endl;
87 
88  calculateFaces( 0 );
89 
90  //---------- Deviate in prism
91  lightray.reflect( ALIPlane(faceP[1],faceV[1] ));
92  if (ALIUtils::debug >= 3) {
93  lightray.dumpData( "After face 1");
94  }
95  lightray.reflect( ALIPlane(faceP[2],faceV[2] ));
96  if (ALIUtils::debug >= 3) {
97  lightray.dumpData( "After face 2");
98  }
99  lightray.intersect( ALIPlane(faceP[3],faceV[3] ));
100  if (ALIUtils::debug >= 3) {
101  lightray.dumpData( "intersected at face 3");
102  }
103 
104  //----- Deviates by 'devi' X & Y??
105  lightray.shiftAndDeviateWhileTraversing( this, 'R');
106  /* ALIdouble deviRX = findExtraEntryValue("deviRX");
107  ALIdouble deviRY = findExtraEntryValue("deviRY");
108  ALIdouble shiftRX = findExtraEntryValue("shiftRX");
109  ALIdouble shiftRY = findExtraEntryValue("shiftRY");
110  lightray.shiftAndDeviateWhileTraversing( this, shiftRX, shiftRY, deviRX, deviRY);
111  */
112 
113  if (ALIUtils::debug >= 2) {
114  // std::cout << " shiftRX " << shiftRX << " shiftRY " << shiftRY << std::endl;
115  // std::cout << " deviRX " << deviRX << " deviRY " << deviRY << std::endl;
116  lightray.dumpData("Deviated ");
117  }
118 
119 
120 }
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
Definition: LightRay.cc:240
static ALIint debug
Definition: ALIUtils.h:35
CLHEP::Hep3Vector faceP[5]
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:100
void calculateFaces(ALIbool isDetailed)
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
CLHEP::Hep3Vector faceV[5]
void OptOOpticalSquare::fastTraversesLightRay ( LightRay lightray)
virtual

Reimplemented from OpticalObject.

Definition at line 129 of file OptOOpticalSquare.cc.

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

130 {
131  // std::cerr << " WARNING there should be an extra piece to make entering and exiting surfaces parallel (like in modified_rhomboid_prism) " << std::endl;
132 
133  calculateFaces( 0 );
134 
135  lightray.intersect( ALIPlane(faceP[1],faceV[1] ));
136  //---------- Shift and Deviate
137  lightray.shiftAndDeviateWhileTraversing( this, 'T');
138  /* ALIdouble shiftX = findExtraEntryValue("shiftTX");
139  ALIdouble shiftY = findExtraEntryValue("shiftTY");
140  ALIdouble deviTX = findExtraEntryValue("deviTX");
141  ALIdouble deviTY = findExtraEntryValue("deviTY");
142  lightray.shiftAndDeviateWhileTraversing( this, shiftX, shiftY, deviTX, deviTY);
143  */
144  if (ALIUtils::debug >= 2) {
145  lightray.dumpData("Shifted and Deviated");
146  }
147 }
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
Definition: LightRay.cc:240
static ALIint debug
Definition: ALIUtils.h:35
CLHEP::Hep3Vector faceP[5]
void intersect(const ALIPlane &plane)
Definition: LightRay.cc:100
void calculateFaces(ALIbool isDetailed)
void dumpData(const ALIstring &str) const
Definition: LightRay.cc:381
CLHEP::Hep3Vector faceV[5]

Member Data Documentation

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

Definition at line 47 of file OptOOpticalSquare.h.

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

Definition at line 48 of file OptOOpticalSquare.h.