CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 198 of file DDRotation.cc.

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

199 {
200  return DDRotation(rot);
201 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
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 CastorDataFrameFilter_impl::check(), funct::cos(), connectstrParser::o, funct::sin(), x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by DDTIBLayerAlgo::execute().

172 {
173  // define 3 unit std::vectors forming the new left-handed axes
174  DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
175  DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
176  DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
177 
178  double tol = 1.0e-3; // Geant4 compatible
179  double check = (x.Cross(y)).Dot(z);// in case of a LEFT-handed orthogonal system this must be -1, RIGHT-handed: +1
180  if ((1.-fabs(check))>tol) {
181  std::ostringstream o;
182  o << "matrix is not an (left or right handed) orthonormal matrix! (in deg)" << std::endl
183  << " thetaX=" << thetaX/deg << " phiX=" << phiX/deg << std::endl
184  << " thetaY=" << thetaY/deg << " phiY=" << phiY/deg << std::endl
185  << " thetaZ=" << thetaZ/deg << " phiZ=" << phiZ/deg << std::endl;
186  edm::LogError("DDRotation") << o.str() << std::endl;
187 
188 
189  throw DDException( o.str() );
190  }
191 
192  return new DDRotationMatrix(x.x(),y.x(),z.x(),
193  x.y(),y.y(),z.y(),
194  x.z(),y.z(),z.z());
195 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
An exception for DDD errors.
Definition: DDException.h:23
double double double z
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Definition: DDAxes.h:10
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 94 of file DDRotation.cc.

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

95 {
96  // memory of rot goes sto DDRotationImpl!!
97  //DCOUT('c', "DDrot: new rotation " << ddname);
98  //if (rot) rot->invert();
99  return DDRotation(ddname, rot);
100 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
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 CastorDataFrameFilter_impl::check(), funct::cos(), DDName::name(), funct::sin(), x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

107 {
108  // define 3 unit std::vectors
109  DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
110  DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
111  DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
112 
113  double tol = 1.0e-3; // Geant4 compatible
114  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
115  if (fabs(1.-check)>tol) {
116  edm::LogError("DDRotation") << ddname << " is not a RIGHT-handed orthonormal matrix!" << std::endl;
117  throw DDException( ddname.name() + std::string(" is not RIGHT-handed!" ) );
118  }
119 
120  DDRotationMatrix* rot = new DDRotationMatrix(x.x(),y.x(),z.x(),
121  x.y(),y.y(),z.y(),
122  x.z(),y.z(),z.z());
123 
124  return DDRotation(ddname, rot);
125 
126 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
An exception for DDD errors.
Definition: DDException.h:23
double double double z
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Definition: DDAxes.h:10
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 139 of file DDRotation.cc.

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

Referenced by DDLRotationAndReflection::processElement().

143 {
144 
145  // define 3 unit std::vectors forming the new left-handed axes
146  DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
147  DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
148  DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
149 
150  double tol = 1.0e-3; // Geant4 compatible
151  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
152  if (fabs(1.+check)>tol) {
153  edm::LogError("DDRotation") << ddname << " is not a LEFT-handed orthonormal matrix!" << std::endl;
154  throw DDException( ddname.name() + std::string(" is not LEFT-handed!" ) );
155  }
156 
157  DDRotationMatrix* rot = new DDRotationMatrix(x.x(),y.x(),z.x(),
158  x.y(),y.y(),z.y(),
159  x.z(),y.z(),z.z());
160 
161  //DCOUT('c', "DDrotReflect: new reflection " << ddname);
162  //rot->invert();
163  return DDRotation(ddname, rot);
164 
165 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
An exception for DDD errors.
Definition: DDException.h:23
double double double z
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Definition: DDAxes.h:10
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
DDRotation DDrotReflect ( const DDName name,
DDRotationMatrix rot 
)

Definition at line 129 of file DDRotation.cc.

130 {
131  // memory of rot goes sto DDRotationImpl!!
132  //DCOUT('c', "DDrot: new rotation " << ddname);
133 // if (rot) rot->invert();
134  return DDRotation(ddname, rot);
135 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
std::ostream& operator<< ( std::ostream &  ,
const DDRotation  
)

Definition at line 20 of file DDRotation.cc.

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

21 {
22  DDBase<DDName,DDRotationMatrix*>::def_type defined(r.isDefined());
23  if (defined.first) {
24  os << *(defined.first) << " ";
25  if (defined.second) {
26  const DDRotationMatrix & rm = *(r.rotation());
27  DDAxisAngle ra(rm);
28  os << "t=" << ra.Axis().Theta()/deg << "deg "
29  << "p=" << ra.Axis().Phi()/deg << "deg "
30  << "a=" << ra.Angle()/deg << "deg";
31  DCOUT_V('R', rm);
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:18
string rm
Definition: submit.py:76
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
ROOT::Math::AxisAngle DDAxisAngle
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.