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 | Private Attributes
DDAngular Class Reference

#include <DDAngular.h>

Inheritance diagram for DDAngular:

Public Member Functions

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

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 8 of file DDAngular.h.

Constructor & Destructor Documentation

DDAngular::DDAngular ( void  )

Definition at line 8 of file DDAngular.cc.

References LogDebug.

9  : m_n( 1 ),
10  m_startCopyNo( 1 ),
11  m_incrCopyNo( 1 ),
12  m_startAngle( 0. ),
13  m_rangeAngle( 360*deg ),
14  m_radius( 0. ),
15  m_delta( 0. )
16 {
17  LogDebug( "DDAlgorithm" ) << "DDAngular: Creating an instance.";
18 }
#define LogDebug(id)
double m_radius
Definition: DDAngular.h:30
double m_delta
Definition: DDAngular.h:31
int m_n
Definition: DDAngular.h:25
int m_incrCopyNo
Definition: DDAngular.h:27
double m_rangeAngle
Definition: DDAngular.h:29
int m_startCopyNo
Definition: DDAngular.h:26
double m_startAngle
Definition: DDAngular.h:28
DDAngular::~DDAngular ( void  )
virtual

Definition at line 20 of file DDAngular.cc.

21 {}

Member Function Documentation

void DDAngular::execute ( DDCompactView cpv)

Definition at line 99 of file DDAngular.cc.

References filterCSVwithJSON::copy, funct::cos(), dbl_to_string(), DDcreateRotationMatrix(), DDrot(), i, LogDebug, m_center, m_childNmNs, m_delta, m_idNameSpace, m_incrCopyNo, m_n, m_radius, m_solidRot, m_startAngle, m_startCopyNo, dbtoconf::parent, phi, DDCompactView::position(), idealTransformation::rotation, funct::sin(), and theta().

100 {
101  DDName mother = parent().name();
102  DDName ddname( m_childNmNs.first, m_childNmNs.second );
103  double theta = 90.*CLHEP::deg;
104  int copy = m_startCopyNo;
105  double phi = m_startAngle;
106 
107  for( int i = 0; i < m_n; ++i )
108  {
109  double phix = phi;
110  double phiy = phix + 90. * CLHEP::deg;
111  double phideg = phix / CLHEP::deg;
112 
113  std::string rotstr = m_childNmNs.first + "_" + dbl_to_string( phideg * 10.);
115  if( !rotation )
116  {
117  LogDebug( "DDAlgorithm" ) << "DDAngular: Creating a new "
118  << "rotation: " << rotstr << "\t90., "
119  << phix / CLHEP::deg << ", 90.,"
120  << phiy / CLHEP::deg << ", 0, 0";
121 
122  rotation = DDrot( DDName( rotstr, m_idNameSpace ), new DDRotationMatrix(( *DDcreateRotationMatrix( theta, phix, theta, phiy,
123  0., 0. ) * m_solidRot )));
124  }
125 
126  double xpos = m_radius * cos( phi ) + m_center[0];
127  double ypos = m_radius * sin( phi ) + m_center[1];
128  double zpos = m_center[2];
129  DDTranslation tran( xpos, ypos, zpos );
130 
131  cpv.position( ddname, mother, copy, tran, rotation );
132  LogDebug( "DDAlgorithm" ) << "DDAngular: child " << m_childNmNs.second << ":" << m_childNmNs.first << " number "
133  << copy << " positioned in " << mother << " at "
134  << tran << " with " << rotation << "\n";
135  copy += m_incrCopyNo;
136  phi += m_delta;
137  }
138 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
double m_radius
Definition: DDAngular.h:30
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Definition: DDutils.cc:12
DDRotationMatrix m_solidRot
Definition: DDAngular.h:39
double m_delta
Definition: DDAngular.h:31
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
int m_n
Definition: DDAngular.h:25
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int m_incrCopyNo
Definition: DDAngular.h:27
std::vector< double > m_center
Definition: DDAngular.h:32
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:93
std::string m_idNameSpace
Definition: DDAngular.h:35
std::pair< std::string, std::string > m_childNmNs
Definition: DDAngular.h:36
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
int m_startCopyNo
Definition: DDAngular.h:26
double m_startAngle
Definition: DDAngular.h:28
Definition: DDAxes.h:10
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:168
DD3Vector DDAngular::fUnitVector ( double  theta,
double  phi 
)
private

Definition at line 141 of file DDAngular.cc.

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

Referenced by initialize().

142 {
143  return DD3Vector( cos( phi ) * sin( theta ),
144  sin( phi ) * sin( theta ),
145  cos( theta ));
146 }
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
Definition: DDAxes.h:10
void DDAngular::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 24 of file DDAngular.cc.

References DDSplit(), fUnitVector(), i, 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(), dbtoconf::parent, and groupFilesInBlocks::temp.

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

Member Data Documentation

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

Definition at line 32 of file DDAngular.h.

Referenced by execute(), and initialize().

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

Definition at line 36 of file DDAngular.h.

Referenced by execute(), and initialize().

double DDAngular::m_delta
private

Definition at line 31 of file DDAngular.h.

Referenced by execute(), and initialize().

std::string DDAngular::m_idNameSpace
private

Definition at line 35 of file DDAngular.h.

Referenced by execute(), and initialize().

int DDAngular::m_incrCopyNo
private

Definition at line 27 of file DDAngular.h.

Referenced by execute(), and initialize().

int DDAngular::m_n
private

Definition at line 25 of file DDAngular.h.

Referenced by execute(), and initialize().

double DDAngular::m_radius
private

Definition at line 30 of file DDAngular.h.

Referenced by execute(), and initialize().

double DDAngular::m_rangeAngle
private

Definition at line 29 of file DDAngular.h.

Referenced by initialize().

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

Definition at line 33 of file DDAngular.h.

Referenced by initialize().

DDRotationMatrix DDAngular::m_solidRot
private

Definition at line 39 of file DDAngular.h.

Referenced by execute(), and initialize().

double DDAngular::m_startAngle
private

Definition at line 28 of file DDAngular.h.

Referenced by execute(), and initialize().

int DDAngular::m_startCopyNo
private

Definition at line 26 of file DDAngular.h.

Referenced by execute(), and initialize().