CMS 3D CMS Logo

Classes | Functions
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. More...
 
DDRotationMatrixDDcreateRotationMatrix (double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
 create a new DDRotationMatrix in the GEANT3 style. More...
 
DDRotation DDrot (const DDName &name, DDRotationMatrix *rot)
 Definition of a uniquely identifiable rotation matrix named by DDName name. More...
 
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. More...
 
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. More...
 
DDRotation DDrotReflect (const DDName &name, DDRotationMatrix *rot)
 
std::ostream & operator<< (std::ostream &, const DDRotation &)
 

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

References DDRotation::DDRotation().

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

188 {
189  return DDRotation(rot);
190 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
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 158 of file DDRotation.cc.

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

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

161 {
162  // define 3 unit std::vectors forming the new left-handed axes
163  DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
164  DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
165  DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
166 
167  double tol = 1.0e-3; // Geant4 compatible
168  double check = (x.Cross(y)).Dot(z);// in case of a LEFT-handed orthogonal system this must be -1, RIGHT-handed: +1
169  if ((1.-fabs(check))>tol) {
170  std::ostringstream o;
171  o << "matrix is not an (left or right handed) orthonormal matrix! (in deg)" << std::endl
172  << " thetaX=" << thetaX/deg << " phiX=" << phiX/deg << std::endl
173  << " thetaY=" << thetaY/deg << " phiY=" << phiY/deg << std::endl
174  << " thetaZ=" << thetaZ/deg << " phiZ=" << phiZ/deg << std::endl;
175  edm::LogError("DDRotation") << o.str() << std::endl;
176 
177 
178  throw cms::Exception("DDException") << o.str();
179  }
180 
181  return new DDRotationMatrix(x.x(),y.x(),z.x(),
182  x.y(),y.y(),z.y(),
183  x.z(),y.z(),z.z());
184 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float float float z
T x() const
Cartesian x coordinate.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def check(config)
Definition: trackerTree.py:14
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
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 90 of file DDRotation.cc.

References DDRotation::DDRotation().

Referenced by DDPixFwdBlades::computeNippleParameters(), DDHCalBarrelAlgo::constructGeneralVolume(), DDHCalEndcapAlgo::constructGeneralVolume(), DDHGCalNoTaperEndcap::createQuarter(), DDTIDModulePosAlgo::execute(), DDHCalAngular::execute(), DDPixFwdDiskAlgo::execute(), DDPixPhase1FwdDiskAlgo::execute(), DDTECOptoHybAlgo::execute(), DDPixBarStackTrigLayerAlgo::execute(), DDHCalTBCableAlgo::execute(), DDTIBLayerAlgo::execute(), DDHCalTBZposAlgo::execute(), DDHCalTestBeamAlgo::execute(), DDHCalXtalAlgo::execute(), DDPixBarLayerUpgradeAlgoCoverage::execute(), DDPixBarStackLayerAlgo::execute(), DDHGCalWaferAlgo::execute(), DDPixBarTPGStackLayerAlgo::execute(), DDTIBLayerAlgo_MTCC::execute(), DDGEMAngular::execute(), DDMuonAngular::execute(), DDPixBarLayerAlgo::execute(), DDPixBarLayerUpgradeAlgo::execute(), DDTrackerPhiAlgo::execute(), DDTrackerPhiAltAlgo::execute(), DDTECAxialCableAlgo::execute(), DDTECPhiAlgo::execute(), DDHCalFibreBundle::execute(), DDTIDAxialCableAlgo::execute(), DDTrackerAngularV1::execute(), DDTrackerAngular::execute(), DDTIDRingAlgo::execute(), DDTECPhiAltAlgo::execute(), DDLinear::execute(), DDAngular::execute(), DDTrackerRingAlgo::execute(), DDPixFwdBlades::execute(), DDDividedConsPhi::makeDDRotation(), DDDividedTubsPhi::makeDDRotation(), DDDividedPolyconePhi::makeDDRotation(), DDDividedPolyhedraPhi::makeDDRotation(), DDTBH4Algo::myrot(), DDEcalBarrelAlgo::myrot(), DDEcalBarrelNewAlgo::myrot(), DDEcalEndcapAlgo::myrot(), DDLRotationSequence::processElement(), DDLRotationByAxis::processElement(), DDLRotationAndReflection::processElement(), DDLPosPart::processElement(), regressionTest_first(), and regressionTest_setup().

91 {
92  // memory of rot goes sto DDRotationImpl!!
93  return DDRotation(ddname, rot);
94 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
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 97 of file DDRotation.cc.

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

101 {
102  // define 3 unit std::vectors
103  DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
104  DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
105  DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
106 
107  double tol = 1.0e-3; // Geant4 compatible
108  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
109  if (fabs(1.-check)>tol) {
110  edm::LogError("DDRotation") << ddname << " is not a RIGHT-handed orthonormal matrix!" << std::endl;
111  throw cms::Exception("DDException") << ddname.name() << " is not RIGHT-handed!";
112  }
113 
114  DDRotationMatrix* rot = new DDRotationMatrix(x.x(),y.x(),z.x(),
115  x.y(),y.y(),z.y(),
116  x.z(),y.z(),z.z());
117 
118  return DDRotation(ddname, rot);
119 
120 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float float float z
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
T x() const
Cartesian x coordinate.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def check(config)
Definition: trackerTree.py:14
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
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 131 of file DDRotation.cc.

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

Referenced by DDLRotationAndReflection::processElement().

135 {
136 
137  // define 3 unit std::vectors forming the new left-handed axes
138  DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
139  DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
140  DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
141 
142  double tol = 1.0e-3; // Geant4 compatible
143  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
144  if (fabs(1.+check)>tol) {
145  edm::LogError("DDRotation") << ddname << " is not a LEFT-handed orthonormal matrix!" << std::endl;
146  throw cms::Exception("DDException") << ddname.name() << " is not LEFT-handed!";
147  }
148 
149  DDRotationMatrix* rot = new DDRotationMatrix(x.x(),y.x(),z.x(),
150  x.y(),y.y(),z.y(),
151  x.z(),y.z(),z.z());
152 
153  return DDRotation(ddname, rot);
154 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float float float z
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
T x() const
Cartesian x coordinate.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def check(config)
Definition: trackerTree.py:14
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
DDRotation DDrotReflect ( const DDName name,
DDRotationMatrix rot 
)

Definition at line 123 of file DDRotation.cc.

References DDRotation::DDRotation().

124 {
125  // memory of rot goes sto DDRotationImpl!!
126  return DDRotation(ddname, rot);
127 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
std::ostream& operator<< ( std::ostream &  ,
const DDRotation  
)

Definition at line 21 of file DDRotation.cc.

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

22 {
23  DDBase<DDName,DDRotationMatrix*>::def_type defined(r.isDefined());
24  if (defined.first) {
25  os << *(defined.first) << " ";
26  if (defined.second) {
27  const DDRotationMatrix & rm = *(r.rotation());
28  DDAxisAngle ra(rm);
29  os << "t=" << ra.Axis().Theta()/deg << "deg "
30  << "p=" << ra.Axis().Phi()/deg << "deg "
31  << "a=" << ra.Angle()/deg << "deg";
32  }
33  else {
34  os << "* rotation not defined * ";
35  }
36  }
37  else {
38  os << "* rotation not declared * ";
39  }
40  return os;
41 }
Definition: DDBase.h:10
rm
Definition: submit.py:76
ROOT::Math::AxisAngle DDAxisAngle
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.