CMS 3D CMS Logo

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, std::unique_ptr< 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 &, std::unique_ptr< DDRotationMatrix >)
 
DDRotationMatrixmatrix ()
 
const DDRotationMatrixrotation () const
 Returns the read-only rotation-matrix. More...
 
DDRotationMatrixrotation ()
 
- Public Member Functions inherited from DDBase< DDName, std::unique_ptr< DDRotationMatrix > >
void create (const DDName &name, std::unique_ptr< DDRotationMatrix > vals)
 
void create (const DDName &name)
 
 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, std::unique_ptr< DDRotationMatrix > >::reference rep () const
 
DDI::rep_traits< DDName, std::unique_ptr< DDRotationMatrix > >::reference rep ()
 
std::string toString () const
 
const DDI::rep_traits< DDName, std::unique_ptr< DDRotationMatrix > >::reference val () const
 
const DDI::rep_traits< DDName, std::unique_ptr< DDRotationMatrix > >::reference val ()
 
virtual ~DDBase ()
 

Private Member Functions

 DDRotation (std::unique_ptr< DDRotationMatrix >)
 

Friends

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

Additional Inherited Members

- Public Types inherited from DDBase< DDName, std::unique_ptr< DDRotationMatrix > >
using def_type = std::pair< const DDName *, bool >
 
using StoreT = DDI::Singleton< DDI::Store< DDName, std::unique_ptr< DDRotationMatrix > > >
 
- Static Public Member Functions inherited from DDBase< DDName, std::unique_ptr< DDRotationMatrix > >
static auto begin ()
 
static auto end ()
 

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 ROOT Rotation3D.

Definition at line 68 of file DDTransform.h.

Constructor & Destructor Documentation

DDRotation::DDRotation ( )

refers to the unit-rotation (no rotation at all)

Definition at line 43 of file DDRotation.cc.

References constexpr, and DDBase< DDName, std::unique_ptr< DDRotationMatrix > >::create().

Referenced by DDanonymousRot(), DDrot(), DDrotReflect(), and matrix().

45 {
46  constexpr char const* baseName = "DdBlNa";
47  // In this particular case, we do not really care about multiple threads
48  // using the same counter, we simply need to have a unique id for the
49  // blank matrix being created, so just making this static an atomic should do
50  // the trick. In order to ensure repeatibility one should also include some
51  // some run specific Id, I guess. Not sure it really matters.
52  static std::atomic<int> countBlank;
53  char buf[64];
54  snprintf( buf, 64, "%s%i", baseName, countBlank++ );
55  create( DDName( buf, baseName ), std::make_unique<DDRotationMatrix>());
56 }
Definition: DDBase.h:10
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
#define constexpr
void create(const DDName &name, std::unique_ptr< DDRotationMatrix > vals)
Definition: DDBase.h:121
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 58 of file DDRotation.cc.

References DDBase< DDName, std::unique_ptr< DDRotationMatrix > >::create().

60 {
61  create( name );
62 }
Definition: DDBase.h:10
void create(const DDName &name, std::unique_ptr< DDRotationMatrix > vals)
Definition: DDBase.h:121
DDRotation::DDRotation ( const DDName name,
std::unique_ptr< DDRotationMatrix rot 
)

Definition at line 64 of file DDRotation.cc.

References DDBase< DDName, std::unique_ptr< DDRotationMatrix > >::create(), and eostools::move().

66 {
67  create( name, std::move( rot ));
68 }
Definition: DDBase.h:10
def move(src, dest)
Definition: eostools.py:511
void create(const DDName &name, std::unique_ptr< DDRotationMatrix > vals)
Definition: DDBase.h:121
DDRotation::DDRotation ( std::unique_ptr< DDRotationMatrix rot)
private

Definition at line 70 of file DDRotation.cc.

References DDBase< DDName, std::unique_ptr< DDRotationMatrix > >::create(), and eostools::move().

72 {
73  static std::atomic<int> countNN;
74  char buf[64];
75  snprintf(buf, 64, "DdNoNa%i", countNN++);
76  create( DDName( buf, "DdNoNa" ), std::move( rot ));
77 }
Definition: DDBase.h:10
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
def move(src, dest)
Definition: eostools.py:511
void create(const DDName &name, std::unique_ptr< DDRotationMatrix > vals)
Definition: DDBase.h:121

Member Function Documentation

DDRotationMatrix& DDRotation::matrix ( void  )
inline

Definition at line 97 of file DDTransform.h.

References DDRotation(), and rotation().

Referenced by TGeoMgrFromDdd::createShape(), TGeoFromDddService::createShape(), DDHtmlRoDetails::details(), and DDTrackerRingAlgo::execute().

97 { return rotation(); }
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:93
const DDRotationMatrix& DDRotation::rotation ( void  ) const
inline
DDRotationMatrix& DDRotation::rotation ( void  )
inline

Definition at line 95 of file DDTransform.h.

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

95 { return rep(); }
const DDI::rep_traits< DDName, std::unique_ptr< DDRotationMatrix > >::reference rep() const
Definition: DDBase.h:80

Friends And Related Function Documentation

DDRotation DDanonymousRot ( std::unique_ptr< 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 177 of file DDRotation.cc.

178 {
179  return DDRotation( std::move( rot ));
180 }
DDRotation()
refers to the unit-rotation (no rotation at all)
Definition: DDRotation.cc:43
def move(src, dest)
Definition: eostools.py:511
DDRotation DDrot ( const DDName name,
std::unique_ptr< 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 80 of file DDRotation.cc.

81 {
82  // memory of rot goes sto DDRotationImpl!!
83  return DDRotation(ddname, std::move( rot ));
84 }
DDRotation()
refers to the unit-rotation (no rotation at all)
Definition: DDRotation.cc:43
def move(src, dest)
Definition: eostools.py:511
std::unique_ptr<DDRotation> DDrotPtr ( const DDName name,
std::unique_ptr< DDRotationMatrix rot 
)
friend

Definition at line 87 of file DDRotation.cc.

88 {
89  // memory of rot goes sto DDRotationImpl!!
90  return std::make_unique<DDRotation>( ddname, std::move( rot ));
91 }
def move(src, dest)
Definition: eostools.py:511
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 124 of file DDRotation.cc.

128 {
129  // define 3 unit std::vectors forming the new left-handed axes
130  DD3Vector x(cos(phiX)*sin(thetaX), sin(phiX)*sin(thetaX), cos(thetaX));
131  DD3Vector y(cos(phiY)*sin(thetaY), sin(phiY)*sin(thetaY), cos(thetaY));
132  DD3Vector z(cos(phiZ)*sin(thetaZ), sin(phiZ)*sin(thetaZ), cos(thetaZ));
133 
134  double tol = 1.0e-3; // Geant4 compatible
135  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system this must be -1
136  if (fabs(1.+check)>tol) {
137  edm::LogError("DDRotation") << ddname << " is not a LEFT-handed orthonormal matrix!" << std::endl;
138  throw cms::Exception("DDException") << ddname.name() << " is not LEFT-handed!";
139  }
140 
141  return DDRotation( ddname,
142  std::make_unique<DDRotationMatrix>(x.x(),y.x(),z.x(),
143  x.y(),y.y(),z.y(),
144  x.z(),y.z(),z.z()));
145 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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
DDRotation()
refers to the unit-rotation (no rotation at all)
Definition: DDRotation.cc:43
def check(config)
Definition: trackerTree.py:14
const std::string & name() const
Returns the name.
Definition: DDName.cc:53