CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 23 of file DDAngular.cc.

24  : m_n(1), m_startCopyNo(1), m_incrCopyNo(1), m_startAngle(0.), m_rangeAngle(360._deg), m_radius(0.), m_delta(0.) {}
double m_radius
Definition: DDAngular.cc:41
double m_delta
Definition: DDAngular.cc:42
int m_incrCopyNo
Definition: DDAngular.cc:38
double m_rangeAngle
Definition: DDAngular.cc:40
int m_startCopyNo
Definition: DDAngular.cc:37
double m_startAngle
Definition: DDAngular.cc:39

Member Function Documentation

void DDAngular::execute ( DDCompactView cpv)
override

Definition at line 113 of file DDAngular.cc.

References angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), DDcreateRotationMatrix(), DDrot(), mps_fire::i, LogDebug, SpecificationBuilder_cfi::parent(), DDCompactView::position(), idealTransformation::rotation, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and theta().

113  {
114  DDName mother = parent().name();
115  DDName ddname(m_childNmNs.first, m_childNmNs.second);
116  double theta = 90._deg;
117  int copy = m_startCopyNo;
118  double phi = m_startAngle;
119 
120  for (int i = 0; i < m_n; ++i) {
121  double phix = phi;
122  double phiy = phix + 90._deg;
123  double phideg = convertRadToDeg(phix);
124 
125  std::string rotstr = m_childNmNs.first + "_" + std::to_string(phideg * 10.);
127  if (!rotation) {
128  LogDebug("DDAlgorithm") << "DDAngular: Creating a new "
129  << "rotation: " << rotstr << "\t90., " << convertRadToDeg(phix) << ", 90.,"
130  << convertRadToDeg(phiy) << ", 0, 0";
131 
132  rotation = DDrot(
133  DDName(rotstr, m_idNameSpace),
134  std::make_unique<DDRotationMatrix>(*DDcreateRotationMatrix(theta, phix, theta, phiy, 0., 0.) * m_solidRot));
135  }
136 
137  double xpos = m_radius * cos(phi) + m_center[0];
138  double ypos = m_radius * sin(phi) + m_center[1];
139  double zpos = m_center[2];
140  DDTranslation tran(xpos, ypos, zpos);
141 
142  cpv.position(ddname, mother, copy, tran, rotation);
143  LogDebug("DDAlgorithm") << "DDAngular: child " << m_childNmNs.second << ":" << m_childNmNs.first << " number "
144  << copy << " positioned in " << mother << " at " << tran << " with " << rotation << "\n";
145  copy += m_incrCopyNo;
146  phi += m_delta;
147  }
148 }
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
double m_radius
Definition: DDAngular.cc:41
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
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:17
DDRotationMatrix m_solidRot
Definition: DDAngular.cc:50
double m_delta
Definition: DDAngular.cc:42
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int m_incrCopyNo
Definition: DDAngular.cc:38
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:67
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:120
std::vector< double > m_center
Definition: DDAngular.cc:43
std::string m_idNameSpace
Definition: DDAngular.cc:46
std::pair< std::string, std::string > m_childNmNs
Definition: DDAngular.cc:47
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
int m_startCopyNo
Definition: DDAngular.cc:37
double m_startAngle
Definition: DDAngular.cc:39
#define LogDebug(id)
DD3Vector DDAngular::fUnitVector ( double  theta,
double  phi 
)
private

Definition at line 150 of file DDAngular.cc.

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

150  {
151  return DD3Vector(cos(phi) * sin(theta), sin(phi) * sin(theta), cos(theta));
152 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
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
void DDAngular::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 53 of file DDAngular.cc.

References funct::abs(), angle_units::operators::convertRadToDeg(), DDSplit(), mps_fire::i, LogDebug, DDCurrentNamespace::ns(), SpecificationBuilder_cfi::parent(), and groupFilesInBlocks::temp.

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

Member Data Documentation

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

Definition at line 43 of file DDAngular.cc.

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

Definition at line 47 of file DDAngular.cc.

double DDAngular::m_delta
private

Definition at line 42 of file DDAngular.cc.

std::string DDAngular::m_idNameSpace
private

Definition at line 46 of file DDAngular.cc.

int DDAngular::m_incrCopyNo
private

Definition at line 38 of file DDAngular.cc.

int DDAngular::m_n
private

Definition at line 36 of file DDAngular.cc.

double DDAngular::m_radius
private

Definition at line 41 of file DDAngular.cc.

double DDAngular::m_rangeAngle
private

Definition at line 40 of file DDAngular.cc.

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

Definition at line 44 of file DDAngular.cc.

DDRotationMatrix DDAngular::m_solidRot
private

Definition at line 50 of file DDAngular.cc.

double DDAngular::m_startAngle
private

Definition at line 39 of file DDAngular.cc.

int DDAngular::m_startCopyNo
private

Definition at line 37 of file DDAngular.cc.