CMS 3D CMS Logo

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, DDRotationMatrix *rot)
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.
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 198 of file DDRotation.cc.

References DDRotation::DDRotation().

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

00199 {
00200   return DDRotation(rot);
00201 }

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 169 of file DDRotation.cc.

References HcalDataFrameFilter_impl::check(), funct::cos(), lat::endl(), funct::sin(), x, y, and z.

Referenced by DDTIBLayerAlgo::execute().

00172 {
00173    // define 3 unit std::vectors forming the new left-handed axes 
00174    DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
00175    DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
00176    DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
00177    
00178    double tol = 1.0e-3; // Geant4 compatible
00179    double check = (x.Cross(y)).Dot(z);// in case of a LEFT-handed orthogonal system this must be -1, RIGHT-handed: +1
00180    if ((1.-fabs(check))>tol) {
00181      std::ostringstream o;
00182      o << "matrix is not an (left or right handed) orthonormal matrix! (in deg)" << std::endl
00183        << " thetaX=" << thetaX/deg << " phiX=" << phiX/deg << std::endl
00184        << " thetaY=" << thetaY/deg << " phiY=" << phiY/deg << std::endl
00185        << " thetaZ=" << thetaZ/deg << " phiZ=" << phiZ/deg << std::endl;
00186      edm::LogError("DDRotation") << o.str() << std::endl;
00187      
00188      
00189      throw DDException( o.str() );
00190    }
00191    
00192    return new DDRotationMatrix(x.x(),y.x(),z.x(),
00193                                x.y(),y.y(),z.y(),
00194                                x.z(),y.z(),z.z());
00195 }                        

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 103 of file DDRotation.cc.

References HcalDataFrameFilter_impl::check(), funct::cos(), DDRotation::DDRotation(), lat::endl(), DDName::name(), rot, funct::sin(), x, y, and z.

00107 {
00108    // define 3 unit std::vectors
00109    DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
00110    DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
00111    DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
00112    
00113    double tol = 1.0e-3; // Geant4 compatible
00114    double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
00115    if (fabs(1.-check)>tol) {
00116      edm::LogError("DDRotation") << ddname << " is not a RIGHT-handed orthonormal matrix!" << std::endl;
00117      throw DDException( ddname.name() + std::string(" is not RIGHT-handed!" ) );
00118    }
00119 
00120    DDRotationMatrix* rot = new DDRotationMatrix(x.x(),y.x(),z.x(),
00121                                                 x.y(),y.y(),z.y(),
00122                                                 x.z(),y.z(),z.z());
00123 
00124    return DDRotation(ddname, rot);  
00125    
00126 }

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 94 of file DDRotation.cc.

References DDRotation::DDRotation().

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

00095 {
00096    // memory of rot goes sto DDRotationImpl!!
00097    //DCOUT('c', "DDrot: new rotation " << ddname);
00098    //if (rot) rot->invert();
00099    return DDRotation(ddname, rot);
00100 }

DDRotation DDrotReflect ( const DDName name,
DDRotationMatrix rot 
)

Definition at line 129 of file DDRotation.cc.

References DDRotation::DDRotation().

00130 {
00131    // memory of rot goes sto DDRotationImpl!!
00132    //DCOUT('c', "DDrot: new rotation " << ddname);
00133 //    if (rot) rot->invert();
00134    return DDRotation(ddname, rot);
00135 }

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 139 of file DDRotation.cc.

References HcalDataFrameFilter_impl::check(), funct::cos(), DDRotation::DDRotation(), lat::endl(), DDName::name(), rot, funct::sin(), x, y, and z.

Referenced by DDLRotationAndReflection::processElement(), and DDPersToDDDFactory::rotation().

00143 {
00144    
00145    // define 3 unit std::vectors forming the new left-handed axes 
00146    DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
00147    DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
00148    DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
00149    
00150    double tol = 1.0e-3; // Geant4 compatible
00151    double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
00152    if (fabs(1.+check)>tol) {
00153      edm::LogError("DDRotation") << ddname << " is not a LEFT-handed orthonormal matrix!" << std::endl;
00154      throw DDException( ddname.name() + std::string(" is not LEFT-handed!" ) );
00155    }
00156    
00157    DDRotationMatrix* rot = new DDRotationMatrix(x.x(),y.x(),z.x(),
00158                                                 x.y(),y.y(),z.y(),
00159                                                 x.z(),y.z(),z.z());
00160 
00161    //DCOUT('c', "DDrotReflect: new reflection " << ddname);
00162    //rot->invert();
00163    return DDRotation(ddname, rot);  
00164                                                                                          
00165 }               

std::ostream& operator<< ( std::ostream &  ,
const DDRotation  
)

Definition at line 20 of file DDRotation.cc.

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

00021 {
00022   DDBase<DDName,DDRotationMatrix*>::def_type defined(r.isDefined());
00023   if (defined.first) {
00024     os << *(defined.first) << " ";
00025     if (defined.second) {
00026       const DDRotationMatrix & rm = *(r.rotation());
00027       DDAxisAngle   ra(rm);
00028       os << "t=" << ra.Axis().Theta()/deg << "deg "
00029          << "p=" << ra.Axis().Phi()/deg << "deg "
00030          << "a=" << ra.Angle()/deg << "deg"; 
00031       DCOUT_V('R', rm);
00032     }
00033     else {
00034       os << "* rotation not defined * ";  
00035     }
00036   }  
00037   else {
00038     os << "* rotation not declared * ";  
00039   }  
00040   return os;
00041 }


Generated on Tue Jun 9 17:52:34 2009 for CMSSW by  doxygen 1.5.4