Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:01

0001 //   COCOA class implementation file

0002 //Id:  ALIPlane.cc

0003 //CAT: Fit

0004 //

0005 //   History: v1.0

0006 //   Pedro Arce

0007 
0008 #include "Alignment/CocoaModel/interface/ALIPlane.h"
0009 #include "Alignment/CocoaUtilities/interface/CocoaGlobals.h"
0010 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
0011 
0012 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0013 //@@ Constructor

0014 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0015 ALIPlane::ALIPlane(const CLHEP::Hep3Vector& point, const CLHEP::Hep3Vector& normal) : _point(point) {
0016   _normal = normal * (1. / normal.mag());
0017   if (ALIUtils::debug >= 5) {
0018     ALIUtils::dump3v(_point, " Created ALIplane: point");
0019     ALIUtils::dump3v(_normal, " Created ALIPlane: normal");
0020   }
0021 }
0022 
0023 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0024 //@@ Project a std::vector onto this plane:

0025 //@@   Project on normal to plane and substract this projection to vec

0026 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0027 CLHEP::Hep3Vector ALIPlane::project(const CLHEP::Hep3Vector& vec) {
0028   //---------- Project vec on normal to plane

0029   ALIdouble proj = vec.dot(_normal) * (1. / vec.mag());
0030   //---------- Substract this projection to vec

0031   CLHEP::Hep3Vector vecproj = vec - (proj * _normal);
0032   //-  ALIUtils::dump3v( _normal, "plane _normal");

0033   //- std::cout << " proj on normal " << proj << std::endl;

0034   //- ALIUtils::dump3v( vec , "std::vector");

0035   return vecproj;
0036 }
0037 
0038 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0039 //@@ Project a std::vector onto this plane:

0040 //@@   Project on normal to plane and substract this projection to vec

0041 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0042 ALILine ALIPlane::lineProject(const CLHEP::Hep3Vector& vec) {
0043   //---------- Project vec on normal to plane

0044   ALIdouble proj = vec.dot(_normal) * (1. / vec.mag());
0045   //---------- Substract this projection to vec

0046   CLHEP::Hep3Vector vecproj = vec - (proj * _normal);
0047   //-  ALIUtils::dump3v( _normal, "plane _normal");

0048   //- std::cout << " proj on normal " << proj << std::endl;

0049   //- ALIUtils::dump3v( vec , "std::vector");

0050   return ALILine(this->_point, vecproj);
0051 }