Represents a uniquely identifyable rotation matrix. More...
#include <DDTransform.h>
Public Member Functions | |
DDRotation () | |
refers to the unit-rotation (no rotation at all) | |
DDRotation (const DDName &name) | |
Creates a initialized reference-object or a reference to an allready defined rotation. | |
DDRotation (const DDName &, DDRotationMatrix *) | |
DDRotationMatrix * | matrix () |
DDRotationMatrix * | rotation () |
const DDRotationMatrix * | rotation () const |
Returns the read-only rotation-matrix. | |
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 &) |
Represents a uniquely identifyable rotation matrix.
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 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< DDName, DDRotationMatrix * >::prep_.
: DDBase<DDName,DDRotationMatrix*>() { //static bool onlyOnce=true; //if (onlyOnce) { // static DDRotationMatrix* rm_ = new DDRotationMatrix; // prep_ = StoreT::instance().create(DDName("",""), rm_ ); static std::string baseName("DdBlNa"); static int countBlank; static std::ostringstream ostr; ostr << countBlank++; prep_ = StoreT::instance().create(DDName(baseName+ostr.str(),baseName), new DDRotationMatrix ); // std::cout << "making a BLANK " << baseName+ostr.str() << " named rotation, " << prep_->second << std::endl; ostr.clear(); ostr.str(""); }
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< DDName, DDRotationMatrix * >::prep_.
: DDBase<DDName,DDRotationMatrix*>() { prep_ = StoreT::instance().create(name); }
DDRotation::DDRotation | ( | const DDName & | name, |
DDRotationMatrix * | rot | ||
) |
Definition at line 68 of file DDRotation.cc.
References DDI::Singleton< I >::instance(), and DDBase< DDName, DDRotationMatrix * >::prep_.
: DDBase<DDName,DDRotationMatrix*>() { prep_ = StoreT::instance().create(name,rot); }
DDRotation::DDRotation | ( | DDRotationMatrix * | rot | ) | [private] |
Definition at line 76 of file DDRotation.cc.
References DDI::Singleton< I >::instance(), and DDBase< DDName, DDRotationMatrix * >::prep_.
: DDBase<DDName,DDRotationMatrix*>() { static std::string baseNoName("DdNoNa"); static int countNN; static std::ostringstream ostr2; ostr2 << countNN++; prep_ = StoreT::instance().create(DDName(baseNoName+ostr2.str(), baseNoName), rot); // std::cout << "making a NO-NAME " << baseNoName+ostr2.str() << " named rotation, " << prep_->second << std::endl; ostr2.clear(); ostr2.str(""); }
DDRotationMatrix* DDRotation::matrix | ( | void | ) | [inline] |
Definition at line 94 of file DDTransform.h.
References rotation().
Referenced by WriteOneGeometryFromXML::beginRun(), TGeoMgrFromDdd::createShape(), TGeoFromDddService::createShape(), DDCoreToDDXMLOutput::position(), and DDCoreToDDXMLOutput::rotation().
{ return rotation(); }
const DDRotationMatrix* DDRotation::rotation | ( | void | ) | const [inline] |
Returns the read-only rotation-matrix.
Definition at line 90 of file DDTransform.h.
References DDBase< DDName, DDRotationMatrix * >::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().
{ return &(rep()); }
DDRotationMatrix* DDRotation::rotation | ( | void | ) | [inline] |
Definition at line 92 of file DDTransform.h.
References DDBase< DDName, DDRotationMatrix * >::rep().
{ 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.
{ return DDRotation(rot); }
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.
{ // memory of rot goes sto DDRotationImpl!! //DCOUT('c', "DDrot: new rotation " << ddname); //if (rot) rot->invert(); return DDRotation(ddname, rot); }
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.
{ // 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 DDException( ddname.name() + std::string(" 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); }
std::ostream& operator<< | ( | std::ostream & | os, |
const DDRotation & | r | ||
) | [friend] |
Definition at line 20 of file DDRotation.cc.
{ 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; }