CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Friends
DDRotation Class Reference

Represents a uniquely identifyable rotation matrix. More...

#include <DDTransform.h>

Inheritance diagram for DDRotation:
DDBase< DDName, DDRotationMatrix * >

Public Member Functions

 DDRotation ()
 refers to the unit-rotation (no rotation at all) More...
 
 DDRotation (const DDName &name)
 Creates a initialized reference-object or a reference to an allready defined rotation. More...
 
 DDRotation (const DDName &, DDRotationMatrix *)
 
DDRotationMatrixmatrix ()
 
const DDRotationMatrixrotation () const
 Returns the read-only rotation-matrix. More...
 
DDRotationMatrixrotation ()
 
- Public Member Functions inherited from DDBase< DDName, DDRotationMatrix * >
 DDBase ()
 
const DDNameddname () const
 
def_type isDefined () const
 
bool isValid () const
 true, if the wrapped pointer is valid More...
 
const DDNamename () const
 
 operator bool () const
 
bool operator< (const DDBase &b) const
 
bool operator== (const DDBase &b) const
 
bool operator> (const DDBase &b) const
 
const DDI::rep_traits< DDName,
DDRotationMatrix * >
::reference 
rep () const
 
DDI::rep_traits< DDName,
DDRotationMatrix * >
::reference 
rep ()
 
std::string toString () const
 
const DDI::rep_traits< DDName,
DDRotationMatrix * >
::reference 
val () const
 
const DDI::rep_traits< DDName,
DDRotationMatrix * >
::reference 
val ()
 
virtual ~DDBase ()
 

Private Member Functions

 DDRotation (DDRotationMatrix *)
 

Friends

DDRotation DDanonymousRot (DDRotationMatrix *)
 Defines a anonymous rotation or rotation-reflection matrix. More...
 
DDRotation DDrot (const DDName &, DDRotationMatrix *)
 Definition of a uniquely identifiable rotation matrix named by DDName name. More...
 
DDRotation DDrotReflect (const DDName &, double, double, double, double, double, double)
 Defines a rotation-reflection in the Geant3 way. More...
 
std::ostream & operator<< (std::ostream &, const DDRotation &)
 

Additional Inherited Members

- Public Types inherited from DDBase< DDName, DDRotationMatrix * >
typedef std::pair< const
DDName *, bool > 
def_type
 
typedef DDRotationMatrixpimpl_type
 
typedef DDI::rep_type< DDName,
pimpl_type > * 
prep_type
 
typedef DDI::Singleton
< DDI::Store< DDName,
DDRotationMatrix * > > 
StoreT
 
- Static Public Member Functions inherited from DDBase< DDName, DDRotationMatrix * >
static DDI::Store< DDName,
DDRotationMatrix * >::iterator 
begin ()
 
static void clear ()
 
static DDI::Store< DDName,
DDRotationMatrix * >::iterator 
end ()
 
static size_t size ()
 
- Protected Attributes inherited from DDBase< DDName, DDRotationMatrix * >
prep_type prep_
 

Detailed Description

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.

Constructor & Destructor Documentation

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_.

45 {
46  //static bool onlyOnce=true;
47  //if (onlyOnce) {
48  // static DDRotationMatrix* rm_ = new DDRotationMatrix;
49  // prep_ = StoreT::instance().create(DDName("",""), rm_ );
50  static std::string baseName("DdBlNa");
51  static int countBlank;
52  static std::ostringstream ostr;
53  ostr << countBlank++;
54  prep_ = StoreT::instance().create(DDName(baseName+ostr.str(),baseName), new DDRotationMatrix );
55  // std::cout << "making a BLANK " << baseName+ostr.str() << " named rotation, " << prep_->second << std::endl;
56  ostr.clear();
57  ostr.str("");
58 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
static value_type & instance()
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
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_.

62 {
63  prep_ = StoreT::instance().create(name);
64 
65 }
static value_type & instance()
DDRotation::DDRotation ( const DDName name,
DDRotationMatrix rot 
)
DDRotation::DDRotation ( DDRotationMatrix rot)
private

Definition at line 76 of file DDRotation.cc.

References DDI::Singleton< I >::instance(), and DDBase< DDName, DDRotationMatrix * >::prep_.

78 {
79  static std::string baseNoName("DdNoNa");
80  static int countNN;
81  static std::ostringstream ostr2;
82  ostr2 << countNN++;
83  prep_ = StoreT::instance().create(DDName(baseNoName+ostr2.str(), baseNoName), rot);
84  // std::cout << "making a NO-NAME " << baseNoName+ostr2.str() << " named rotation, " << prep_->second << std::endl;
85  ostr2.clear();
86  ostr2.str("");
87 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
static value_type & instance()

Member Function Documentation

DDRotationMatrix* DDRotation::matrix ( void  )
inline

Definition at line 94 of file DDTransform.h.

References rotation().

Referenced by WriteOneGeometryFromXML::beginRun(), TGeoMgrFromDdd::createShape(), TGeoFromDddService::createShape(), DDHtmlRoDetails::details(), DDCoreToDDXMLOutput::position(), and DDCoreToDDXMLOutput::rotation().

94 { return rotation(); }
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:90
const DDRotationMatrix* DDRotation::rotation ( void  ) const
inline
DDRotationMatrix* DDRotation::rotation ( void  )
inline

Definition at line 92 of file DDTransform.h.

References DDBase< DDName, DDRotationMatrix * >::rep().

92 { return &(rep()); }
const DDI::rep_traits< DDName, DDRotationMatrix * >::reference rep() const
Definition: DDBase.h:95

Friends And Related Function Documentation

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.

199 {
200  return DDRotation(rot);
201 }
DDRotation()
refers to the unit-rotation (no rotation at all)
Definition: DDRotation.cc:44
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.

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 }
DDRotation()
refers to the unit-rotation (no rotation at all)
Definition: DDRotation.cc:44
const DDName & ddname() const
Definition: DDBase.h:90
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.

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
Definition: DDAxes.h:10
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
DDRotation()
refers to the unit-rotation (no rotation at all)
Definition: DDRotation.cc:44
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
const DDName & ddname() const
Definition: DDBase.h:90
std::ostream& operator<< ( std::ostream &  os,
const DDRotation r 
)
friend

Definition at line 20 of file DDRotation.cc.

21 {
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
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:90
def_type isDefined() const
Definition: DDBase.h:121
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.