CMS 3D CMS Logo

OptOMirror Class Reference

#include <Alignment/CocoaModel/interface/OptOMirror.h>

Inheritance diagram for OptOMirror:

OpticalObject

List of all members.

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 (OpticalObject *parent, const ALIstring &type, const ALIstring &name, const ALIbool copy_data)
 OptOMirror ()
 ~OptOMirror ()


Detailed Description

Definition at line 18 of file OptOMirror.h.


Constructor & Destructor Documentation

OptOMirror::OptOMirror (  )  [inline]

Definition at line 23 of file OptOMirror.h.

00023 { };

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

Definition at line 24 of file OptOMirror.h.

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

OptOMirror::~OptOMirror (  )  [inline]

Definition at line 26 of file OptOMirror.h.

00026 { };


Member Function Documentation

void OptOMirror::constructSolidShape (  )  [virtual]

Reimplemented from OpticalObject.

Definition at line 230 of file OptOMirror.cc.

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

00231 {
00232   ALIdouble go;
00233   GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
00234   gomgr->getGlobalOptionValue("VisScale", go );
00235 
00236   theSolidShape = new CocoaSolidShapeBox( "Box", go*5.*cm/m, go*5.*cm/m, go*1.*cm/m ); //COCOA internal units are meters
00237 }

void OptOMirror::defaultBehaviour ( LightRay lightray,
Measurement meas 
) [virtual]

Reimplemented from OpticalObject.

Definition at line 22 of file OptOMirror.cc.

References detailedDeviatesLightRay().

00023 {
00024   detailedDeviatesLightRay( lightray );
00025 }

void OptOMirror::detailedDeviatesLightRay ( LightRay lightray  )  [virtual]

Reimplemented from OpticalObject.

Definition at line 31 of file OptOMirror.cc.

References ALI_DBL_MAX, OpticalObject::centreGlob(), GenMuonPlsPt100GeV_cfg::cout, ALIUtils::debug, LightRay::direction(), ALIUtils::dump3v(), LightRay::dumpData(), lat::endl(), OpticalObject::findExtraEntryValue(), OpticalObject::findExtraEntryValueMustExist(), OpticalObject::getPlate(), OpticalObject::getZAxis(), LightRay::intersect(), muonGeometry::mag(), OpticalObject::name(), LightRay::point(), OpticalObject::rmGlob(), rmt, LightRay::setDirection(), and width.

Referenced by defaultBehaviour().

00032 {
00033   if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED REFLECTION IN MIRROR " << name() << std::endl;
00034   if (ALIUtils::debug >= 3) ALIUtils::dump3v( centreGlob(), " centre Global ");
00035 
00036   //---------- Get forward plate and intersect lightray with it
00037   ALIPlane plate = getPlate(1, 0);
00038   lightray.intersect( plate );
00039   CLHEP::Hep3Vector inters = lightray.point( );
00040 
00041   //---------- Get centre of forward plate
00042   //----- Get Z axis
00043   CLHEP::Hep3Vector ZAxis = getZAxis();
00044   CLHEP::HepRotation rmt = rmGlob();
00045   ZAxis = rmt * ZAxis;
00046   //----- Get centre
00047   ALIdouble width = findExtraEntryValue("width");
00048   CLHEP::Hep3Vector plate_centre = centreGlob() - 0.5 * width * ZAxis; 
00049   //-  if(ALIUtils::debug >= 4) std::cout << " mirror width " << width << std::endl;
00050 
00051   //---------- Get the distance between the intersection point and the centre of the forward plate
00052   ALIdouble distance = ( plate_centre - inters ).mag();
00053 
00054   //---------- Get normal to mirror at intersection point 
00055   //------- Get angle of mirror surface (angle between plate centre and intersection)
00056   ALIdouble flatness = findExtraEntryValue("flatness");
00057   //-- flatness is defined as number of 632 nm wavelengths
00058   flatness *= 632.E-9;
00059   ALIdouble length = 0.;
00060 
00061   ALIdouble curvature_radius;
00062   ALIdouble angFlatness;
00063   if( flatness != 0) {
00064     length = findExtraEntryValueMustExist("length");
00065     curvature_radius = (flatness*flatness + length*length) / (2*flatness);
00066     angFlatness = asin( distance / curvature_radius);
00067   } else {
00068     curvature_radius = ALI_DBL_MAX;
00069     angFlatness = 0;
00070   }
00071 
00072   if (ALIUtils::debug >= 3) {
00073     std::cout << " intersection with plate " << inters << std::endl;
00074     std::cout << " plate_centre " << plate_centre << std::endl;
00075     std::cout << " distance plate_centre - intersection " << distance << std::endl;
00076     std::cout << " flatness " << flatness << ", length " << length;
00077     std::cout << ", curvature radius " << curvature_radius << " angle of flatness " << angFlatness << std::endl;
00078   }
00079 
00080   //----- Axis of rotation is perpendicular to Z Axis and to line plate_centre - intersection
00081   CLHEP::Hep3Vector ipcV = inters - plate_centre;
00082   if( ipcV.mag() != 0) ipcV *= 1./ipcV.mag();
00083   CLHEP::HepRotation rtm = rmGlob();
00084   ipcV = rtm*ipcV;
00085   CLHEP::Hep3Vector rotationAxis = ipcV.cross(ZAxis);
00086   //----- normal is object normal rotated around this axis
00087   CLHEP::Hep3Vector inters_normal = CLHEP::Hep3Vector(0.,0.,1.);
00088   inters_normal.rotate( angFlatness, rotationAxis );  
00089   inters_normal = rmt * inters_normal;
00090 
00091   if (ALIUtils::debug >= 2) {
00092      ALIUtils::dump3v( ipcV, " intersection -  plate_centre std::vector ");
00093      std::cout << "rotation Axis " << rotationAxis << std::endl;
00094      std::cout << " plate normal at intersection point " << inters_normal << std::endl;
00095 }
00096   //---------- Reflect in plate 
00097   ALIdouble cosang = -( inters_normal * lightray.direction() ) / 
00098            inters_normal.mag() / lightray.direction().mag();
00099   CLHEP::Hep3Vector lrold = lightray.direction();
00100   lightray.setDirection( lightray.direction() + inters_normal*2*cosang );
00101 
00102   if (ALIUtils::debug >= 2) {
00103     lightray.dumpData("Reflected in mirror"); 
00104   }
00105 
00106 }

void OptOMirror::detailedTraversesLightRay ( LightRay lightray  )  [virtual]

Reimplemented from OpticalObject.

Definition at line 136 of file OptOMirror.cc.

References GenMuonPlsPt100GeV_cfg::cout, ALIUtils::debug, LightRay::dumpData(), lat::endl(), OpticalObject::findExtraEntryValue(), OpticalObject::getPlate(), OpticalObject::name(), LightRay::refract(), and width.

00137 {
00138   if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED TRAVERSE IN MIRROR " << name() << std::endl;
00139 
00140   //---------- Get forward plate
00141   ALIPlane plate = getPlate(1, 1);
00142   //---------- If width is 0, just keep the same point 
00143   ALIdouble width = findExtraEntryValue("width");
00144   if( width == 0 ) {
00145     if(ALIUtils::debug >= 3) lightray.dumpData("Traversed with 0 width"); 
00146     return;
00147   }
00148 
00149   //---------- Refract while entering mirror
00150   ALIdouble refra_ind1 = 1.;
00151   ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
00152   lightray.refract( plate, refra_ind1, refra_ind2 );
00153   if (ALIUtils::debug >= 2) {
00154     lightray.dumpData("Refracted in first plate"); 
00155   }
00156 
00157   //---------- Get backward plate
00158   plate = getPlate(0, 1);
00159   //---------- Refract while exiting mirror
00160   lightray.refract( plate, refra_ind2, refra_ind1 );
00161   if (ALIUtils::debug >= 2) {
00162     lightray.dumpData("Refracted in first plate"); 
00163   }
00164 
00165 }

void OptOMirror::fastDeviatesLightRay ( LightRay lightray  )  [virtual]

Reimplemented from OpticalObject.

Definition at line 112 of file OptOMirror.cc.

References GenMuonPlsPt100GeV_cfg::cout, ALIUtils::debug, LightRay::dumpData(), lat::endl(), OpticalObject::getPlate(), OpticalObject::name(), LightRay::reflect(), and LightRay::shiftAndDeviateWhileTraversing().

00113 {
00114   if (ALIUtils::debug >= 2) std::cout << "LR: FAST REFLECTION IN MIRROR " << name() << std::endl;
00115 
00116   //---------- Get forward plate
00117   ALIPlane plate = getPlate(1, 0);
00118 
00119   //---------- Reflect in plate (including intersection with it)
00120   lightray.reflect( plate );
00121   if (ALIUtils::debug >= 2) {
00122     lightray.dumpData("Reflected in plate"); 
00123   }
00124   //---------- Deviate Lightray 
00125   //  ALIdouble deviX = findExtraEntryValue("deviX");
00126   // ALIdouble deviY = findExtraEntryValue("deviY");
00127   //  lightray.shiftAndDeviateWhileTraversing( this, 0., 0., 0., deviX, deviY, 0.);
00128   lightray.shiftAndDeviateWhileTraversing( this, 'R' );
00129   if (ALIUtils::debug >= 2) {
00130     lightray.dumpData("Deviated ");
00131   }
00132 
00133 }

void OptOMirror::fastTraversesLightRay ( LightRay lightray  )  [virtual]

Reimplemented from OpticalObject.

Definition at line 169 of file OptOMirror.cc.

References GenMuonPlsPt100GeV_cfg::cout, ALIUtils::debug, LightRay::dumpData(), lat::endl(), OpticalObject::findExtraEntryValue(), OpticalObject::findExtraEntryValueIfExists(), OpticalObject::getPlate(), LightRay::intersect(), OpticalObject::name(), and LightRay::shiftAndDeviateWhileTraversing().

00170 {
00171   if (ALIUtils::debug >= 2) std::cout << "LR: TRAVERSE MIRROR  " << name() << std::endl;
00172   
00173   //---------- Get backward plate
00174   ALIPlane plate = getPlate(0, 0);
00175   lightray.intersect( plate );
00176   if (ALIUtils::debug >= 2) {
00177     lightray.dumpData("Intersected with plate"); 
00178   }
00179   //---------- Shift and Deviate
00180   ALIdouble shiftX = findExtraEntryValue("shiftTX");
00181   ALIdouble shiftY = findExtraEntryValue("shiftTY");
00182   ALIdouble shift;
00183   ALIbool bb = findExtraEntryValueIfExists("shiftT", shift);
00184   if( bb ) {
00185     shiftX = shift;
00186     shiftY = shift;
00187   }
00188 
00189   ALIdouble deviTX = findExtraEntryValue("deviTX");
00190   ALIdouble deviTY = findExtraEntryValue("deviTY");
00191   ALIdouble deviT;
00192   bb = findExtraEntryValueIfExists("deviT", deviT);
00193   if( bb ) {
00194     deviTX = deviT;
00195     deviTY = deviT;
00196   }
00197 
00198   //  lightray.shiftAndDeviateWhileTraversing( this, shiftX, shiftY, 0., deviTX, deviTY, 0.);
00199   lightray.shiftAndDeviateWhileTraversing( this, 'T' );
00200   if (ALIUtils::debug >= 2) {
00201     lightray.dumpData("Shifted and Deviated");
00202   }
00203 
00204 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:29:18 2009 for CMSSW by  doxygen 1.5.4