CMS 3D CMS Logo

Classes | Functions

/data/git/CMSSW_5_3_11_patch5/src/DetectorDescription/Core/interface/DDTransform.h File Reference

#include "DetectorDescription/Core/interface/DDBase.h"
#include "DetectorDescription/Core/interface/DDName.h"
#include "DetectorDescription/Base/interface/DDRotationMatrix.h"

Go to the source code of this file.

Classes

class  DDRotation
 Represents a uniquely identifyable rotation matrix. More...

Functions

DDRotation DDanonymousRot (DDRotationMatrix *rot)
 Defines a anonymous rotation or rotation-reflection matrix.
DDRotationMatrixDDcreateRotationMatrix (double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
 create a new DDRotationMatrix in the GEANT3 style.
DDRotation DDrot (const DDName &name, double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
 Definition of a uniquely identifiable rotation matrix named by DDName name in the GEANT3 style.
DDRotation DDrot (const DDName &name, DDRotationMatrix *rot)
 Definition of a uniquely identifiable rotation matrix named by DDName name.
DDRotation DDrotReflect (const DDName &name, double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
 Defines a rotation-reflection in the Geant3 way.
DDRotation DDrotReflect (const DDName &name, DDRotationMatrix *rot)
std::ostream & operator<< (std::ostream &, const DDRotation &)

Detailed Description

Definition in file DDTransform.h.


Function Documentation

DDRotation DDanonymousRot ( DDRotationMatrix rot)

Defines a anonymous rotation or rotation-reflection matrix.

It can't be addressed by a unique DDName. Once created, it's the users responsibility to keep the reference object DDRotation! Will be mostly used by algorithmic positioning.

Definition at line 197 of file DDRotation.cc.

Referenced by DDCompactView::algoPosPart(), DDTIBLayerAlgo::execute(), and DDStreamer::pos_read().

{
  return DDRotation(rot);
}
DDRotationMatrix* DDcreateRotationMatrix ( double  thetaX,
double  phiX,
double  thetaY,
double  phiY,
double  thetaZ,
double  phiZ 
)

create a new DDRotationMatrix in the GEANT3 style.

The Matrix must be orthonormal - left or right handed - otherwise a DDException is thrown; memory of the returned pointer belongs to the caller

Definition at line 168 of file DDRotation.cc.

References CastorDataFrameFilter_impl::check(), funct::cos(), Exception, python::connectstrParser::o, funct::sin(), x, detailsBasic3DVector::y, and z.

Referenced by DDTIBLayerAlgo::execute(), and DDAngular::execute().

{
   // define 3 unit std::vectors forming the new left-handed axes 
   DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
   DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
   DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
   
   double tol = 1.0e-3; // Geant4 compatible
   double check = (x.Cross(y)).Dot(z);// in case of a LEFT-handed orthogonal system this must be -1, RIGHT-handed: +1
   if ((1.-fabs(check))>tol) {
     std::ostringstream o;
     o << "matrix is not an (left or right handed) orthonormal matrix! (in deg)" << std::endl
       << " thetaX=" << thetaX/deg << " phiX=" << phiX/deg << std::endl
       << " thetaY=" << thetaY/deg << " phiY=" << phiY/deg << std::endl
       << " thetaZ=" << thetaZ/deg << " phiZ=" << phiZ/deg << std::endl;
     edm::LogError("DDRotation") << o.str() << std::endl;
     
     
     throw cms::Exception("DDException") << o.str();
   }
   
   return new DDRotationMatrix(x.x(),y.x(),z.x(),
                               x.y(),y.y(),z.y(),
                               x.z(),y.z(),z.z());
}                        
DDRotation DDrot ( const DDName name,
double  thetaX,
double  phiX,
double  thetaY,
double  phiY,
double  thetaZ,
double  phiZ 
)

Definition of a uniquely identifiable rotation matrix named by DDName name in the GEANT3 style.

DDrot() returns a reference-object DDRotation representing the rotation matrix.

Definition at line 102 of file DDRotation.cc.

References CastorDataFrameFilter_impl::check(), funct::cos(), Exception, DDName::name(), makeMuonMisalignmentScenario::rot, funct::sin(), x, detailsBasic3DVector::y, and z.

{
   // define 3 unit std::vectors
   DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
   DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
   DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
   
   double tol = 1.0e-3; // Geant4 compatible
   double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
   if (fabs(1.-check)>tol) {
     edm::LogError("DDRotation") << ddname << " is not a RIGHT-handed orthonormal matrix!" << std::endl;
     throw cms::Exception("DDException") << ddname.name() << " is not RIGHT-handed!";
   }

   DDRotationMatrix* rot = new DDRotationMatrix(x.x(),y.x(),z.x(),
                                                x.y(),y.y(),z.y(),
                                                x.z(),y.z(),z.z());

   return DDRotation(ddname, rot);  
   
}
DDRotation DDrot ( const DDName ddname,
DDRotationMatrix rot 
)

Definition of a uniquely identifiable rotation matrix named by DDName name.

DDrot() returns a reference-object DDRotation representing the rotation matrix rot.

The user must not free memory allocated for rot!

Definition at line 93 of file DDRotation.cc.

Referenced by WriteOneGeometryFromXML::beginRun(), DDPixFwdBlades::computeNippleParameters(), DDHCalEndcapAlgo::constructGeneralVolume(), DDHCalBarrelAlgo::constructGeneralVolume(), DDPixFwdBlades::execute(), DDHCalAngular::execute(), DDTECAxialCableAlgo::execute(), DDHCalTBCableAlgo::execute(), DDHCalXtalAlgo::execute(), DDHCalTBZposAlgo::execute(), DDLinear::execute(), DDTIBLayerAlgo_MTCC::execute(), DDTECOptoHybAlgo::execute(), DDTECPhiAltAlgo::execute(), DDPixBarLayerAlgo::execute(), DDHCalTestBeamAlgo::execute(), DDTIDAxialCableAlgo::execute(), DDTrackerPhiAltAlgo::execute(), DDTIBLayerAlgo::execute(), DDTIDModulePosAlgo::execute(), DDTIDRingAlgo::execute(), DDHCalFibreBundle::execute(), DDTrackerAngular::execute(), DDTrackerPhiAlgo::execute(), DDAngular::execute(), DDTECPhiAlgo::execute(), DDDividedPolyconePhi::makeDDRotation(), DDDividedConsPhi::makeDDRotation(), DDDividedTubsPhi::makeDDRotation(), DDDividedPolyhedraPhi::makeDDRotation(), DDEcalBarrelNewAlgo::myrot(), DDEcalBarrelAlgo::myrot(), DDEcalEndcapAlgo::myrot(), DDTBH4Algo::myrot(), DDLRotationSequence::processElement(), DDLRotationAndReflection::processElement(), DDLPosPart::processElement(), DDLRotationByAxis::processElement(), regressionTest_first(), and regressionTest_setup().

{
   // memory of rot goes sto DDRotationImpl!!
   //DCOUT('c', "DDrot: new rotation " << ddname);
   //if (rot) rot->invert();
   return DDRotation(ddname, rot);
}
DDRotation DDrotReflect ( const DDName ddname,
double  thetaX,
double  phiX,
double  thetaY,
double  phiY,
double  thetaZ,
double  phiZ 
)

Defines a rotation-reflection in the Geant3 way.

The resulting matrix MUST be a LEFThanded orthonormal system, otherwise a DDException will be thrown!

Definition at line 138 of file DDRotation.cc.

References CastorDataFrameFilter_impl::check(), funct::cos(), Exception, DDName::name(), makeMuonMisalignmentScenario::rot, funct::sin(), x, detailsBasic3DVector::y, and z.

Referenced by DDLRotationAndReflection::processElement().

{
   
   // define 3 unit std::vectors forming the new left-handed axes 
   DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
   DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
   DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
   
   double tol = 1.0e-3; // Geant4 compatible
   double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
   if (fabs(1.+check)>tol) {
     edm::LogError("DDRotation") << ddname << " is not a LEFT-handed orthonormal matrix!" << std::endl;
     throw cms::Exception("DDException") << ddname.name() << " is not LEFT-handed!";
   }
   
   DDRotationMatrix* rot = new DDRotationMatrix(x.x(),y.x(),z.x(),
                                                x.y(),y.y(),z.y(),
                                                x.z(),y.z(),z.z());

   //DCOUT('c', "DDrotReflect: new reflection " << ddname);
   //rot->invert();
   return DDRotation(ddname, rot);  
                                                                                         
}               
DDRotation DDrotReflect ( const DDName name,
DDRotationMatrix rot 
)

Definition at line 128 of file DDRotation.cc.

{
   // memory of rot goes sto DDRotationImpl!!
   //DCOUT('c', "DDrot: new rotation " << ddname);
//    if (rot) rot->invert();
   return DDRotation(ddname, rot);
}
std::ostream& operator<< ( std::ostream &  ,
const DDRotation  
)

Definition at line 19 of file DDRotation.cc.

References DCOUT_V, DDBase< N, C >::isDefined(), submit::rm, and DDRotation::rotation().

{
  DDBase<DDName,DDRotationMatrix*>::def_type defined(r.isDefined());
  if (defined.first) {
    os << *(defined.first) << " ";
    if (defined.second) {
      const DDRotationMatrix & rm = *(r.rotation());
      DDAxisAngle   ra(rm);
      os << "t=" << ra.Axis().Theta()/deg << "deg "
         << "p=" << ra.Axis().Phi()/deg << "deg "
         << "a=" << ra.Angle()/deg << "deg"; 
      DCOUT_V('R', rm);
    }
    else {
      os << "* rotation not defined * ";  
    }
  }  
  else {
    os << "* rotation not declared * ";  
  }  
  return os;
}