#include <DetectorDescription/Core/interface/DDTransform.h>
Public Member Functions | |
DDRotation (const DDName &, DDRotationMatrix *) | |
DDRotation (const DDName &name) | |
Creates a initialized reference-object or a reference to an allready defined rotation. | |
DDRotation () | |
refers to the unit-rotation (no rotation at all) | |
DDRotationMatrix * | matrix () |
DDRotationMatrix * | rotation () |
const DDRotationMatrix * | rotation () const |
Returns the read-only rotation-matrix. | |
Static Public Member Functions | |
static void | clear () |
Private Member Functions | |
DDRotation (DDRotationMatrix *) | |
Friends | |
DDRotation | DDanonymousRot (DDRotationMatrix *) |
Defines a anonymous rotation or rotation-reflection matrix. | |
DDRotation | DDrot (const DDName &, DDRotationMatrix *) |
Definition of a uniquely identifiable rotation matrix named by DDName name. | |
DDRotation | DDrotReflect (const DDName &, double, double, double, double, double, double) |
Defines a rotation-reflection in the Geant3 way. | |
std::ostream & | operator<< (std::ostream &, const DDRotation &) |
An object of this class is a reference-object and thus leightweighted. It is uniquely identified by its DDName. Further details concerning reference-objects can be found in the documentation of DDLogicalPart.
DDRotation encapsulates CLHEP HepRotation.
Definition at line 66 of file DDTransform.h.
DDRotation::DDRotation | ( | ) |
refers to the unit-rotation (no rotation at all)
Definition at line 44 of file DDRotation.cc.
References DDI::Singleton< I >::instance(), and DDBase< N, C >::prep_.
Referenced by DDanonymousRot(), DDrot(), and DDrotReflect().
00044 : DDBase<DDName,DDRotationMatrix*>() 00045 { 00046 //static bool onlyOnce=true; 00047 //if (onlyOnce) { 00048 // static DDRotationMatrix* rm_ = new DDRotationMatrix; 00049 // prep_ = StoreT::instance().create(DDName("",""), rm_ ); 00050 static std::string baseName("DdBlNa"); 00051 static int countBlank; 00052 static std::ostringstream ostr; 00053 ostr << countBlank++; 00054 prep_ = StoreT::instance().create(DDName(baseName+ostr.str(),baseName), new DDRotationMatrix ); 00055 // std::cout << "making a BLANK " << baseName+ostr.str() << " named rotation, " << prep_->second << std::endl; 00056 ostr.clear(); 00057 ostr.str(""); 00058 }
DDRotation::DDRotation | ( | const DDName & | name | ) |
Creates a initialized reference-object or a reference to an allready defined rotation.
A reference-object to a defined rotation is created if a rotation was already defined usind DDrot(). Otherwise a (default) initialized reference-object named name is created. At any later stage the rotation matrix can be defined using DDrot(). All initialized-reference object referring to the same name will then immidialtely refere to the matrix created by DDrot().
DDRotation is a lightweighted reference-object. For further details concerning reference-object refere to the documentation of DDLogicalPart.
Definition at line 61 of file DDRotation.cc.
References DDI::Singleton< I >::instance(), and DDBase< N, C >::prep_.
00061 : DDBase<DDName,DDRotationMatrix*>() 00062 { 00063 prep_ = StoreT::instance().create(name); 00064 00065 }
DDRotation::DDRotation | ( | const DDName & | name, | |
DDRotationMatrix * | rot | |||
) |
Definition at line 68 of file DDRotation.cc.
References DDI::Singleton< I >::instance(), and DDBase< N, C >::prep_.
00069 : DDBase<DDName,DDRotationMatrix*>() 00070 { 00071 prep_ = StoreT::instance().create(name,rot); 00072 00073 }
DDRotation::DDRotation | ( | DDRotationMatrix * | rot | ) | [private] |
Definition at line 76 of file DDRotation.cc.
References DDI::Singleton< I >::instance(), and DDBase< N, C >::prep_.
00077 : DDBase<DDName,DDRotationMatrix*>() 00078 { 00079 static std::string baseNoName("DdNoNa"); 00080 static int countNN; 00081 static std::ostringstream ostr2; 00082 ostr2 << countNN++; 00083 prep_ = StoreT::instance().create(DDName(baseNoName+ostr2.str(), baseNoName), rot); 00084 // std::cout << "making a NO-NAME " << baseNoName+ostr2.str() << " named rotation, " << prep_->second << std::endl; 00085 ostr2.clear(); 00086 ostr2.str(""); 00087 }
Reimplemented from DDBase< N, C >.
Definition at line 89 of file DDRotation.cc.
References DDI::Singleton< I >::instance().
Referenced by DDCompactView::clear().
00090 { 00091 StoreT::instance().clear(); 00092 }
DDRotationMatrix* DDRotation::matrix | ( | void | ) | [inline] |
Definition at line 94 of file DDTransform.h.
References rotation().
Referenced by WriteOneGeometryFromXML::beginJob(), DDHtmlRoDetails::details(), DDDToPersFactory::position(), and DDDToPersFactory::rotation().
00094 { return rotation(); }
DDRotationMatrix* DDRotation::rotation | ( | void | ) | [inline] |
Definition at line 92 of file DDTransform.h.
References DDBase< N, C >::rep().
00092 { return &(rep()); }
const DDRotationMatrix* DDRotation::rotation | ( | void | ) | const [inline] |
Returns the read-only rotation-matrix.
Definition at line 90 of file DDTransform.h.
References DDBase< N, C >::rep().
Referenced by dd_rot_out(), DDPixFwdBlades::execute(), DDG4SolidConverter::intersection(), matrix(), operator<<(), DDPosData::rot(), global_simpleAngular_2::rotation(), global_simpleAngular_1::rotation(), global_simpleAngular_0::rotation(), DDPosData::rotation(), DDG4SolidConverter::subtraction(), and DDG4SolidConverter::unionsolid().
00090 { return &(rep()); }
DDRotation DDanonymousRot | ( | DDRotationMatrix * | rot | ) | [friend] |
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.
00199 { 00200 return DDRotation(rot); 00201 }
DDRotation DDrot | ( | const DDName & | name, | |
DDRotationMatrix * | rot | |||
) | [friend] |
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.
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, | |
double | thetaX, | |||
double | phiX, | |||
double | thetaY, | |||
double | phiY, | |||
double | thetaZ, | |||
double | phiZ | |||
) | [friend] |
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.
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 & | os, | |
const DDRotation & | r | |||
) | [friend] |
Definition at line 20 of file DDRotation.cc.
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 }