CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DDAngular Class Reference
Inheritance diagram for DDAngular:

Public Member Functions

 DDAngular ()
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) 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 21 of file DDAngular.cc.

Constructor & Destructor Documentation

DDAngular::DDAngular ( )
inline

Definition at line 24 of file DDAngular.cc.

References cmsIgProf_Analysis::execute(), initialize(), and theta().

25  : m_n( 1 ),
26  m_startCopyNo( 1 ),
27  m_incrCopyNo( 1 ),
28  m_startAngle( 0. ),
29  m_rangeAngle( 360._deg ),
30  m_radius( 0. ),
31  m_delta( 0. )
32  {}
double m_radius
Definition: DDAngular.cc:49
double m_delta
Definition: DDAngular.cc:50
int m_incrCopyNo
Definition: DDAngular.cc:46
double m_rangeAngle
Definition: DDAngular.cc:48
int m_startCopyNo
Definition: DDAngular.cc:45
double m_startAngle
Definition: DDAngular.cc:47

Member Function Documentation

void DDAngular::execute ( DDCompactView cpv)
override

Definition at line 136 of file DDAngular.cc.

References CONVERT_TO, popcon2dropbox::copy(), funct::cos(), DDcreateRotationMatrix(), DDrot(), mps_fire::i, LogDebug, class-composition::parent, DDCompactView::position(), idealTransformation::rotation, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and theta().

137 {
138  DDName mother = parent().name();
139  DDName ddname( m_childNmNs.first, m_childNmNs.second );
140  double theta = 90._deg;
141  int copy = m_startCopyNo;
142  double phi = m_startAngle;
143 
144  for( int i = 0; i < m_n; ++i )
145  {
146  double phix = phi;
147  double phiy = phix + 90._deg;
148  double phideg = CONVERT_TO( phix, deg );
149 
150  std::string rotstr = m_childNmNs.first + "_" + std::to_string( phideg * 10.);
152  if( !rotation )
153  {
154  LogDebug( "DDAlgorithm" ) << "DDAngular: Creating a new "
155  << "rotation: " << rotstr << "\t90., "
156  << CONVERT_TO( phix, deg ) << ", 90.,"
157  << CONVERT_TO( phiy, deg ) << ", 0, 0";
158 
159  rotation = DDrot( DDName( rotstr, m_idNameSpace ),
160  std::make_unique<DDRotationMatrix>( *DDcreateRotationMatrix( theta, phix, theta, phiy,
161  0., 0. ) * m_solidRot ));
162  }
163 
164  double xpos = m_radius * cos( phi ) + m_center[0];
165  double ypos = m_radius * sin( phi ) + m_center[1];
166  double zpos = m_center[2];
167  DDTranslation tran( xpos, ypos, zpos );
168 
169  cpv.position( ddname, mother, copy, tran, rotation );
170  LogDebug( "DDAlgorithm" ) << "DDAngular: child " << m_childNmNs.second << ":" << m_childNmNs.first << " number "
171  << copy << " positioned in " << mother << " at "
172  << tran << " with " << rotation << "\n";
173  copy += m_incrCopyNo;
174  phi += m_delta;
175  }
176 }
#define LogDebug(id)
def copy(args, dbName)
double m_radius
Definition: DDAngular.cc:49
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
#define CONVERT_TO(_x, _y)
Definition: DDUnits.h:6
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDRotationMatrix m_solidRot
Definition: DDAngular.cc:58
double m_delta
Definition: DDAngular.cc:50
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int m_incrCopyNo
Definition: DDAngular.cc:46
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:80
std::unique_ptr< 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:149
std::vector< double > m_center
Definition: DDAngular.cc:51
std::string m_idNameSpace
Definition: DDAngular.cc:54
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.cc:55
int m_startCopyNo
Definition: DDAngular.cc:45
double m_startAngle
Definition: DDAngular.cc:47
DD3Vector DDAngular::fUnitVector ( double  theta,
double  phi 
)
private

Definition at line 179 of file DDAngular.cc.

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

180 {
181  return DD3Vector( cos( phi ) * sin( theta ),
182  sin( phi ) * sin( theta ),
183  cos( theta ));
184 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: DDAngular.cc:12
void DDAngular::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 62 of file DDAngular.cc.

References funct::abs(), CONVERT_TO, DDSplit(), mps_fire::i, createfilelist::int, LogDebug, DDCurrentNamespace::ns(), class-composition::parent, and groupFilesInBlocks::temp.

67 {
68  m_n = int(nArgs["N"]);
69  m_startCopyNo = int(nArgs["StartCopyNo"]);
70  m_incrCopyNo = int(nArgs["IncrCopyNo"]);
71  m_rangeAngle = nArgs["RangeAngle"];
72  m_startAngle = nArgs["StartAngle"];
73  m_radius = nArgs["Radius"];
74  m_center = vArgs["Center"];
75  m_rotateSolid = vArgs["RotateSolid"];
76 
78 
79  if( std::abs( m_rangeAngle - 360.0_deg ) < 0.001_deg )
80  {
81  m_delta = m_rangeAngle / double( m_n );
82  }
83  else
84  {
85  if( m_n > 1 )
86  {
87  m_delta = m_rangeAngle / double( m_n - 1 );
88  }
89  else
90  {
91  m_delta = 0.;
92  }
93  }
94 
95  LogDebug( "DDAlgorithm" ) << "DDAngular: Parameters for position"
96  << "ing:: n " << m_n << " Start, Range, Delta "
97  << CONVERT_TO( m_startAngle, deg ) << " "
98  << CONVERT_TO( m_rangeAngle, deg ) << " " << CONVERT_TO( m_delta, deg )
99  << " Radius " << m_radius << " Centre " << m_center[0]
100  << ", " << m_center[1] << ", " << m_center[2];
101 
102  //======= collect data concerning the rotation of the solid
103  using sz_type = std::map<std::string, std::vector<double> >::mapped_type::size_type;
104  sz_type sz = m_rotateSolid.size();
105  if( sz%3 )
106  {
107  LogDebug( "DDAlgorithm" ) << "\trotateSolid must occur 3*n times (defining n subsequent rotations)\n"
108  << "\t currently it appears " << sz << " times!\n";
109  }
110  for( sz_type i = 0; i < sz; i += 3 )
111  {
112  if(( m_rotateSolid[i] > 180._deg ) || ( m_rotateSolid[i] < 0._deg ))
113  {
114  LogDebug( "DDAlgorithm" ) << "\trotateSolid \'theta\' must be in range [0,180*deg]\n"
115  << "\t currently it is " << CONVERT_TO( m_rotateSolid[i], deg )
116  << "*deg in rotateSolid[" << double(i) << "]!\n";
117  }
119  m_rotateSolid[i + 2] );
120  LogDebug( "DDAlgorithm" ) << " rotsolid[" << i << "] axis=" << temp.Axis() << " rot.angle=" << CONVERT_TO( temp.Angle(), deg );
122  }
123 
125  m_childNmNs = DDSplit( sArgs["ChildName"] );
126  if( m_childNmNs.second.empty())
128 
129  DDName parentName = parent().name();
130  LogDebug( "DDAlgorithm" ) << "DDAngular: Parent " << parentName
131  << "\tChild " << m_childNmNs.first << "\tNameSpace "
132  << m_childNmNs.second;
133 }
#define LogDebug(id)
double m_radius
Definition: DDAngular.cc:49
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
#define CONVERT_TO(_x, _y)
Definition: DDUnits.h:6
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:179
uint16_t size_type
DDRotationMatrix m_solidRot
Definition: DDAngular.cc:58
double m_delta
Definition: DDAngular.cc:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int m_incrCopyNo
Definition: DDAngular.cc:46
std::vector< double > m_rotateSolid
Definition: DDAngular.cc:52
std::vector< double > m_center
Definition: DDAngular.cc:51
std::string m_idNameSpace
Definition: DDAngular.cc:54
double m_rangeAngle
Definition: DDAngular.cc:48
std::pair< std::string, std::string > m_childNmNs
Definition: DDAngular.cc:55
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
int m_startCopyNo
Definition: DDAngular.cc:45
double m_startAngle
Definition: DDAngular.cc:47

Member Data Documentation

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

Definition at line 51 of file DDAngular.cc.

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

Definition at line 55 of file DDAngular.cc.

double DDAngular::m_delta
private

Definition at line 50 of file DDAngular.cc.

std::string DDAngular::m_idNameSpace
private

Definition at line 54 of file DDAngular.cc.

int DDAngular::m_incrCopyNo
private

Definition at line 46 of file DDAngular.cc.

int DDAngular::m_n
private

Definition at line 44 of file DDAngular.cc.

double DDAngular::m_radius
private

Definition at line 49 of file DDAngular.cc.

double DDAngular::m_rangeAngle
private

Definition at line 48 of file DDAngular.cc.

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

Definition at line 52 of file DDAngular.cc.

DDRotationMatrix DDAngular::m_solidRot
private

Definition at line 58 of file DDAngular.cc.

double DDAngular::m_startAngle
private

Definition at line 47 of file DDAngular.cc.

int DDAngular::m_startCopyNo
private

Definition at line 45 of file DDAngular.cc.