Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
//   COCOA class implementation file
//Id:  OptOPinhole.cc
//CAT: Model
//
//   History: v1.0
//   Pedro Arce

#include "Alignment/CocoaModel/interface/OptOPinhole.h"
#include "Alignment/CocoaModel/interface/LightRay.h"
#include "Alignment/CocoaModel/interface/Measurement.h"
#include <iostream>
#include <iomanip>
#ifdef COCOA_VIS
#include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
#include "Alignment/CocoaVisMgr/interface/ALIColour.h"
#endif
#include <CLHEP/Units/SystemOfUnits.h>
#include "Alignment/CocoaDDLObjects/interface/CocoaSolidShapeTubs.h"
#include "Alignment/CocoaUtilities/interface/GlobalOptionMgr.h"

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@ Traverse pinhole
//@@ 1. the lightray direction is changed to the one that makes the ray traverse the pinhole
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOPinhole::defaultBehaviour(LightRay& lightray, Measurement& meas) {
  if (ALIUtils::debug >= 2)
    std::cout << "LR: TRAVERSE PINHOLE  " << name() << std::endl;

  //----------- Direction is the one that links the source and the pinhole
  CLHEP::Hep3Vector source = lightray.point();
  CLHEP::Hep3Vector pinhole = centreGlob();
  lightray.setDirection(pinhole - source);
  lightray.setPoint(pinhole);

  if (ALIUtils::debug >= 4) {
    ALIUtils::dump3v(source, " source centre ");
    ALIUtils::dump3v(pinhole, " pinhole centre ");
  }
  if (ALIUtils::debug >= 3) {
    lightray.dumpData("lightray at pinhole ");
  }
}

#ifdef COCOA_VIS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOPinhole::fillIguana() {
  ALIColour* col = new ALIColour(1., 1., 1., 0.);
  std::vector<ALIdouble> spar;
  spar.push_back(0.2);
  spar.push_back(0.5);
  CLHEP::HepRotation rm;
  rm.rotateX(90. * deg);
  IgCocoaFileMgr::getInstance().addSolid(*this, "CYLINDER", spar, col, CLHEP::Hep3Vector(), rm);
}

#endif

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOPinhole::constructSolidShape() {
  ALIdouble go;
  GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
  gomgr->getGlobalOptionValue("VisScale", go);

  theSolidShape = new CocoaSolidShapeTubs("Tubs",
                                          go * 0. * CLHEP::cm / CLHEP::m,
                                          go * 1. * CLHEP::cm / CLHEP::m,
                                          go * 1. * CLHEP::cm / CLHEP::m);  //COCOA internal units are meters
}