CMS 3D CMS Logo

Public Member Functions

OptOCubeSplitter Class Reference

#include <OptOCubeSplitter.h>

Inheritance diagram for OptOCubeSplitter:
OpticalObject

List of all members.

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

Detailed Description

Definition at line 18 of file OptOCubeSplitter.h.


Constructor & Destructor Documentation

OptOCubeSplitter::OptOCubeSplitter ( ) [inline]

Definition at line 23 of file OptOCubeSplitter.h.

{ };
OptOCubeSplitter::OptOCubeSplitter ( OpticalObject parent,
const ALIstring type,
const ALIstring name,
const ALIbool  copy_data 
) [inline]

Definition at line 24 of file OptOCubeSplitter.h.

                                                                                                                 : 
  OpticalObject( parent, type, name, copy_data){ };
OptOCubeSplitter::~OptOCubeSplitter ( ) [inline]

Definition at line 26 of file OptOCubeSplitter.h.

{ };

Member Function Documentation

void OptOCubeSplitter::constructSolidShape ( ) [virtual]

Reimplemented from OpticalObject.

Definition at line 247 of file OptOCubeSplitter.cc.

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

{
  ALIdouble go;
  GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
  gomgr->getGlobalOptionValue("VisScale", go );

  theSolidShape = new CocoaSolidShapeBox( "Box", go*5.*cm/m, go*5.*cm/m, go*5.*cm/m ); //COCOA internal units are meters
}
void OptOCubeSplitter::detailedDeviatesLightRay ( LightRay lightray) [virtual]

Reimplemented from OpticalObject.

Definition at line 94 of file OptOCubeSplitter.cc.

References OpticalObject::centreGlob(), gather_cfg::cout, ALIUtils::debug, ALIUtils::dump3v(), LightRay::dumpData(), OpticalObject::findExtraEntryValue(), getMiddlePlate(), OpticalObject::getPlate(), getUpperPlate(), OpticalObject::name(), LightRay::reflect(), and LightRay::refract().

{
  if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED REFLECTION IN CUBE SPLITTER " << name() << std::endl;

  if(ALIUtils::debug >= 2) ALIUtils::dump3v( centreGlob(), "centreGlob");
  //---------- Get first plate
  if (ALIUtils::debug >= 3) std::cout << "%%%%% refracting at entering first plate " << std::endl; 
  if (ALIUtils::debug >= 3) std::cout << "%%% getting first plate " << std::endl; 
  ALIPlane plate = getPlate(1, 1);

  //---------- Refract  
  ALIdouble refra_ind1 = 1.;
  ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
  lightray.refract( plate, refra_ind1, refra_ind2 );

  //---------- Get middle plate
  if (ALIUtils::debug >= 3) std::cout << "%%%%% reflecting in middle plate " << std::endl; 
  if (ALIUtils::debug >= 3) std::cout << "%%% getting middle plate " << std::endl; 
  plate = getMiddlePlate();

  //---------- Reflect
  lightray.reflect( plate );
  if (ALIUtils::debug >= 2) {
    lightray.dumpData("Reflected in plate"); 
  }

  //--------- Get upper plate
  if (ALIUtils::debug >= 3) std::cout << "%%%%% getting second plate " << std::endl; 
  plate = getUpperPlate();
  if (ALIUtils::debug >= 3) std::cout << "%%%%% refracting at exiting second plate " << std::endl; 
  lightray.refract( plate, refra_ind2, refra_ind1 );

 if (ALIUtils::debug >= 2) {
    lightray.dumpData("After CubeSplitter"); 
  }

}
void OptOCubeSplitter::detailedTraversesLightRay ( LightRay lightray) [virtual]

Reimplemented from OpticalObject.

Definition at line 141 of file OptOCubeSplitter.cc.

References gather_cfg::cout, ALIUtils::debug, LightRay::dumpData(), OpticalObject::findExtraEntryValue(), OpticalObject::getPlate(), OpticalObject::name(), and LightRay::refract().

{
  if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED TRAVERSE CUBE SPLITTER " << name() << std::endl;

  //---------- Get forward plate
  ALIPlane plate = getPlate(1, 1);

  //---------- Refract while entering splitter
  ALIdouble refra_ind1 = 1.;
  ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
  lightray.refract( plate, refra_ind1, refra_ind2 );
  if (ALIUtils::debug >= 2) {
    lightray.dumpData("Refracted in first plate"); 
  }

  //---------- Get backward plate
  plate = getPlate(0, 1);
  //---------- Refract while exiting splitter
  lightray.refract( plate, refra_ind2, refra_ind1 );
  if (ALIUtils::debug >= 2) {
    lightray.dumpData("Refracted in first plate"); 
  }

}
void OptOCubeSplitter::fastDeviatesLightRay ( LightRay lightray) [virtual]

Reimplemented from OpticalObject.

Definition at line 27 of file OptOCubeSplitter.cc.

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

{
  if (ALIUtils::debug >= 2) std::cout << "LR: FAST REFLECTION IN CUBE SPLITTER " << name() << std::endl;

  //---------- Get forward plate
  ALIPlane plate = getMiddlePlate();
  //---------- Reflect in plate (including intersection with it)
  lightray.reflect( plate );
  if (ALIUtils::debug >= 2) {
    lightray.dumpData("Reflected in plate"); 
  }
  //---------- Deviate Lightray 
  //  ALIdouble deviRX = findExtraEntryValue("deviRX");
  // ALIdouble deviRY = findExtraEntryValue("deviRY");
  //  lightray.shiftAndDeviateWhileTraversing( this, 0., 0., 0., deviRX, deviRY, 0.);
  lightray.shiftAndDeviateWhileTraversing( this, 'R' );
  if (ALIUtils::debug >= 2) {
    lightray.dumpData("Deviated ");
  }
  
}
void OptOCubeSplitter::fastTraversesLightRay ( LightRay lightray) [virtual]

Reimplemented from OpticalObject.

Definition at line 59 of file OptOCubeSplitter.cc.

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

{
  if (ALIUtils::debug >= 2) std::cout << "LR: FAST TRAVERSE CUBE SPLITTER  " << name() << std::endl;
  
  //---------- Get backward plate
  ALIPlane plate = getPlate(0, 0);
  lightray.intersect( plate );
  if (ALIUtils::debug >= 2) {
    lightray.dumpData("Intersected with plate"); 
  }
  //---------- Shift and Deviate
  lightray.shiftAndDeviateWhileTraversing( this, 'T');
  /*  ALIdouble shiftX = findExtraEntryValue("shiftX");
  ALIdouble shiftY = findExtraEntryValue("shiftY");
  ALIdouble deviTX = findExtraEntryValue("deviTX");
  ALIdouble deviTY = findExtraEntryValue("deviTY");
  lightray.shiftAndDeviateWhileTraversing( this, shiftX, shiftY, deviTX, deviTY);*/

  if (ALIUtils::debug >= 2) {
    lightray.dumpData("Shifted and Deviated");
  }

}
ALIPlane OptOCubeSplitter::getMiddlePlate ( )

Definition at line 172 of file OptOCubeSplitter.cc.

References OpticalObject::centreGlob(), gather_cfg::cout, ALIUtils::debug, ALIUtils::dump3v(), ALIUtils::dumprm(), OpticalObject::findExtraEntryValueIfExists(), OpticalObject::name(), and OpticalObject::rmGlob().

Referenced by detailedDeviatesLightRay(), and fastDeviatesLightRay().

{
  if (ALIUtils::debug >= 4) std::cout << "%%% LR: GET MIDDLE PLATE " << name() << std::endl;
  //---------- Get centre and normal of plate
  //----- plate normal before wedge (Z axis of OptO)
  ALIdouble anglePlanes;
  ALIbool angpl = findExtraEntryValueIfExists("anglePlanes", anglePlanes);
  if( !angpl ) {
    anglePlanes = acos(0.)/2.;  //default is 45o  !!! this creates problem in 'isr_medidas_globales.txt': laser goes along X and does not intersect cube if angles Y 0, anglePlanes 45 
    if (ALIUtils::debug >= 4) std::cout << "anglePlanes default = " << anglePlanes/deg << std::endl;
  }
  CLHEP::Hep3Vector Axis(0., 0., 1.);
  CLHEP::Hep3Vector XAxis(1., 0., 0.);
  Axis.rotate( anglePlanes, XAxis);
  CLHEP::HepRotation rmt = rmGlob();
  CLHEP::Hep3Vector plate_normal = rmt*Axis;
  if (ALIUtils::debug >= 3) { 
    ALIUtils::dumprm( rmt, "rmt before wedge angles" );
    ALIUtils::dump3v( plate_normal, "plate_normal before wedge");
  }
  //----- plate centre = OptO 
  CLHEP::Hep3Vector plate_point = centreGlob();

  //---------- Return plate plane
  return ALIPlane(plate_point, plate_normal);

}
ALIPlane OptOCubeSplitter::getUpperPlate ( )

Definition at line 205 of file OptOCubeSplitter.cc.

References OpticalObject::centreGlob(), gather_cfg::cout, ALIUtils::debug, ALIUtils::dump3v(), ALIUtils::dumprm(), OpticalObject::findExtraEntryValue(), OpticalObject::name(), OpticalObject::rmGlob(), and tablePrinter::width.

Referenced by detailedDeviatesLightRay().

{
  if (ALIUtils::debug >= 4) std::cout << "LR: GET UPPER PLATE " << name() << std::endl;
  //---------- Get centre and normal of plate
  ALIdouble width = findExtraEntryValue("width");
  //----- plate normal before wedge (Y axis of OptO)
  CLHEP::Hep3Vector Axis(0., 1., 0.);
  CLHEP::HepRotation rmt = rmGlob();
  CLHEP::Hep3Vector plate_normal = rmt*Axis;
  if (ALIUtils::debug >= 3) { 
    ALIUtils::dumprm( rmt, "rmt before wedge angles" );
    ALIUtils::dump3v( plate_normal, "plate_normal before wedge");
  }
  //----- plate centre = OptO centre +1/2 width in Y direction 
  CLHEP::Hep3Vector plate_point = centreGlob();
  plate_point += width/2. * plate_normal;

  //---------- Return plate plane
  return ALIPlane(plate_point, plate_normal);

}