CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DDAngular Class Reference

#include <DDAngular.h>

Inheritance diagram for DDAngular:

Public Member Functions

 DDAngular (void)
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
 
 ~DDAngular (void) override
 

Private Member Functions

DD3Vector fUnitVector (double theta, double phi)
 

Private Attributes

std::vector< double > m_center
 
std::pair< std::string, std::string > m_childNmNs
 
double m_delta
 
std::string m_idNameSpace
 
int m_incrCopyNo
 
int m_n
 
double m_radius
 
double m_rangeAngle
 
std::vector< double > m_rotateSolid
 
DDRotationMatrix m_solidRot
 
double m_startAngle
 
int m_startCopyNo
 

Detailed Description

Definition at line 15 of file DDAngular.h.

Constructor & Destructor Documentation

DDAngular::DDAngular ( void  )

Definition at line 19 of file DDAngular.cc.

References LogDebug.

20  : m_n( 1 ),
21  m_startCopyNo( 1 ),
22  m_incrCopyNo( 1 ),
23  m_startAngle( 0. ),
24  m_rangeAngle( 360*deg ),
25  m_radius( 0. ),
26  m_delta( 0. )
27 {
28  LogDebug( "DDAlgorithm" ) << "DDAngular: Creating an instance.";
29 }
#define LogDebug(id)
double m_radius
Definition: DDAngular.h:37
double m_delta
Definition: DDAngular.h:38
int m_n
Definition: DDAngular.h:32
int m_incrCopyNo
Definition: DDAngular.h:34
double m_rangeAngle
Definition: DDAngular.h:36
int m_startCopyNo
Definition: DDAngular.h:33
double m_startAngle
Definition: DDAngular.h:35
DDAngular::~DDAngular ( void  )
override

Definition at line 31 of file DDAngular.cc.

32 {}

Member Function Documentation

void DDAngular::execute ( DDCompactView cpv)
override

Definition at line 109 of file DDAngular.cc.

References popcon2dropbox::copy(), funct::cos(), DDcreateRotationMatrix(), DDrot(), mps_fire::i, LogDebug, m_center, m_childNmNs, m_delta, m_idNameSpace, m_incrCopyNo, m_n, m_radius, m_solidRot, m_startAngle, m_startCopyNo, class-composition::parent, phi, DDCompactView::position(), idealTransformation::rotation, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and theta().

110 {
111  DDName mother = parent().name();
112  DDName ddname( m_childNmNs.first, m_childNmNs.second );
113  double theta = 90.*CLHEP::deg;
114  int copy = m_startCopyNo;
115  double phi = m_startAngle;
116 
117  for( int i = 0; i < m_n; ++i )
118  {
119  double phix = phi;
120  double phiy = phix + 90. * CLHEP::deg;
121  double phideg = phix / CLHEP::deg;
122 
123  std::string rotstr = m_childNmNs.first + "_" + std::to_string( phideg * 10.);
125  if( !rotation )
126  {
127  LogDebug( "DDAlgorithm" ) << "DDAngular: Creating a new "
128  << "rotation: " << rotstr << "\t90., "
129  << phix / CLHEP::deg << ", 90.,"
130  << phiy / CLHEP::deg << ", 0, 0";
131 
132  rotation = DDrot( DDName( rotstr, m_idNameSpace ), new DDRotationMatrix(( *DDcreateRotationMatrix( theta, phix, theta, phiy,
133  0., 0. ) * m_solidRot )));
134  }
135 
136  double xpos = m_radius * cos( phi ) + m_center[0];
137  double ypos = m_radius * sin( phi ) + m_center[1];
138  double zpos = m_center[2];
139  DDTranslation tran( xpos, ypos, zpos );
140 
141  cpv.position( ddname, mother, copy, tran, rotation );
142  LogDebug( "DDAlgorithm" ) << "DDAngular: child " << m_childNmNs.second << ":" << m_childNmNs.first << " number "
143  << copy << " positioned in " << mother << " at "
144  << tran << " with " << rotation << "\n";
145  copy += m_incrCopyNo;
146  phi += m_delta;
147  }
148 }
#define LogDebug(id)
def copy(args, dbName)
double m_radius
Definition: DDAngular.h:37
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDRotationMatrix m_solidRot
Definition: DDAngular.h:46
double m_delta
Definition: DDAngular.h:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
int m_n
Definition: DDAngular.h:32
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int m_incrCopyNo
Definition: DDAngular.h:34
std::vector< double > m_center
Definition: DDAngular.h:39
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::string m_idNameSpace
Definition: DDAngular.h:42
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::pair< std::string, std::string > m_childNmNs
Definition: DDAngular.h:43
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
int m_startCopyNo
Definition: DDAngular.h:33
double m_startAngle
Definition: DDAngular.h:35
DDRotationMatrix * DDcreateRotationMatrix(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
create a new DDRotationMatrix in the GEANT3 style.
Definition: DDRotation.cc:164
DD3Vector DDAngular::fUnitVector ( double  theta,
double  phi 
)
private

Definition at line 151 of file DDAngular.cc.

References funct::cos(), and funct::sin().

Referenced by initialize().

152 {
153  return DD3Vector( cos( phi ) * sin( theta ),
154  sin( phi ) * sin( theta ),
155  cos( theta ));
156 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
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
void DDAngular::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 35 of file DDAngular.cc.

References DDSplit(), fUnitVector(), mps_fire::i, createfilelist::int, LogDebug, m_center, m_childNmNs, m_delta, m_idNameSpace, m_incrCopyNo, m_n, m_radius, m_rangeAngle, m_rotateSolid, m_solidRot, m_startAngle, m_startCopyNo, DDCurrentNamespace::ns(), class-composition::parent, and groupFilesInBlocks::temp.

40 {
41  m_n = int(nArgs["N"]);
42  m_startCopyNo = int(nArgs["StartCopyNo"]);
43  m_incrCopyNo = int(nArgs["IncrCopyNo"]);
44  m_rangeAngle = nArgs["RangeAngle"];
45  m_startAngle = nArgs["StartAngle"];
46  m_radius = nArgs["Radius"];
47  m_center = vArgs["Center"];
48  m_rotateSolid = vArgs["RotateSolid"];
49 
51 
52  if( fabs( m_rangeAngle - 360.0 * CLHEP::deg ) < 0.001 * CLHEP::deg )
53  {
54  m_delta = m_rangeAngle / double( m_n );
55  }
56  else
57  {
58  if( m_n > 1 )
59  {
60  m_delta = m_rangeAngle / double( m_n - 1 );
61  }
62  else
63  {
64  m_delta = 0.;
65  }
66  }
67 
68  LogDebug( "DDAlgorithm" ) << "DDAngular: Parameters for position"
69  << "ing:: n " << m_n << " Start, Range, Delta "
70  << m_startAngle/CLHEP::deg << " "
71  << m_rangeAngle/CLHEP::deg << " " << m_delta/CLHEP::deg
72  << " Radius " << m_radius << " Centre " << m_center[0]
73  << ", " << m_center[1] << ", " << m_center[2];
74 
75  //======= collect data concerning the rotation of the solid
76  typedef parE_type::mapped_type::size_type sz_type;
77  sz_type sz = m_rotateSolid.size();
78  if( sz%3 )
79  {
80  LogDebug( "DDAlgorithm" ) << "\trotateSolid must occur 3*n times (defining n subsequent rotations)\n"
81  << "\t currently it appears " << sz << " times!\n";
82  }
83  for( sz_type i = 0; i < sz; i += 3 )
84  {
85  if(( m_rotateSolid[i] > 180. * deg ) || ( m_rotateSolid[i] < 0. ))
86  {
87  LogDebug( "DDAlgorithm" ) << "\trotateSolid \'theta\' must be in range [0,180*deg]\n"
88  << "\t currently it is " << m_rotateSolid[i]/deg
89  << "*deg in rotateSolid[" << double(i) << "]!\n";
90  }
92  m_rotateSolid[i + 2] );
93  LogDebug( "DDAlgorithm" ) << " rotsolid[" << i << "] axis=" << temp.Axis() << " rot.angle=" << temp.Angle()/deg;
95  }
96 
98  m_childNmNs = DDSplit( sArgs["ChildName"] );
99  if( m_childNmNs.second.empty())
101 
102  DDName parentName = parent().name();
103  LogDebug( "DDAlgorithm" ) << "DDAngular: Parent " << parentName
104  << "\tChild " << m_childNmNs.first << "\tNameSpace "
105  << m_childNmNs.second;
106 }
#define LogDebug(id)
double m_radius
Definition: DDAngular.h:37
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
static std::string & ns()
DD3Vector fUnitVector(double theta, double phi)
Definition: DDAngular.cc:151
uint16_t size_type
DDRotationMatrix m_solidRot
Definition: DDAngular.h:46
double m_delta
Definition: DDAngular.h:38
int m_n
Definition: DDAngular.h:32
int m_incrCopyNo
Definition: DDAngular.h:34
std::vector< double > m_rotateSolid
Definition: DDAngular.h:40
std::vector< double > m_center
Definition: DDAngular.h:39
std::string m_idNameSpace
Definition: DDAngular.h:42
double m_rangeAngle
Definition: DDAngular.h:36
std::pair< std::string, std::string > m_childNmNs
Definition: DDAngular.h:43
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::AxisAngle DDAxisAngle
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
int m_startCopyNo
Definition: DDAngular.h:33
double m_startAngle
Definition: DDAngular.h:35

Member Data Documentation

std::vector<double> DDAngular::m_center
private

Definition at line 39 of file DDAngular.h.

Referenced by execute(), and initialize().

std::pair<std::string, std::string> DDAngular::m_childNmNs
private

Definition at line 43 of file DDAngular.h.

Referenced by execute(), and initialize().

double DDAngular::m_delta
private

Definition at line 38 of file DDAngular.h.

Referenced by execute(), and initialize().

std::string DDAngular::m_idNameSpace
private

Definition at line 42 of file DDAngular.h.

Referenced by execute(), and initialize().

int DDAngular::m_incrCopyNo
private

Definition at line 34 of file DDAngular.h.

Referenced by execute(), and initialize().

int DDAngular::m_n
private

Definition at line 32 of file DDAngular.h.

Referenced by execute(), and initialize().

double DDAngular::m_radius
private

Definition at line 37 of file DDAngular.h.

Referenced by execute(), and initialize().

double DDAngular::m_rangeAngle
private

Definition at line 36 of file DDAngular.h.

Referenced by initialize().

std::vector<double> DDAngular::m_rotateSolid
private

Definition at line 40 of file DDAngular.h.

Referenced by initialize().

DDRotationMatrix DDAngular::m_solidRot
private

Definition at line 46 of file DDAngular.h.

Referenced by execute(), and initialize().

double DDAngular::m_startAngle
private

Definition at line 35 of file DDAngular.h.

Referenced by execute(), and initialize().

int DDAngular::m_startCopyNo
private

Definition at line 33 of file DDAngular.h.

Referenced by execute(), and initialize().