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::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.) {}

Member Function Documentation

◆ execute()

void DDAngular::execute ( DDCompactView cpv)
override

Definition at line 113 of file DDAngular.cc.

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 }

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

◆ fUnitVector()

DD3Vector DDAngular::fUnitVector ( double  theta,
double  phi 
)
private

Definition at line 150 of file DDAngular.cc.

150  {
151  return DD3Vector(cos(phi) * sin(theta), sin(phi) * sin(theta), cos(theta));
152 }

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

◆ initialize()

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.

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 }

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

Member Data Documentation

◆ m_center

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

Definition at line 43 of file DDAngular.cc.

◆ m_childNmNs

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

Definition at line 47 of file DDAngular.cc.

◆ m_delta

double DDAngular::m_delta
private

Definition at line 42 of file DDAngular.cc.

◆ m_idNameSpace

std::string DDAngular::m_idNameSpace
private

Definition at line 46 of file DDAngular.cc.

◆ m_incrCopyNo

int DDAngular::m_incrCopyNo
private

Definition at line 38 of file DDAngular.cc.

◆ m_n

int DDAngular::m_n
private

Definition at line 36 of file DDAngular.cc.

◆ m_radius

double DDAngular::m_radius
private

Definition at line 41 of file DDAngular.cc.

◆ m_rangeAngle

double DDAngular::m_rangeAngle
private

Definition at line 40 of file DDAngular.cc.

◆ m_rotateSolid

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

Definition at line 44 of file DDAngular.cc.

◆ m_solidRot

DDRotationMatrix DDAngular::m_solidRot
private

Definition at line 50 of file DDAngular.cc.

◆ m_startAngle

double DDAngular::m_startAngle
private

Definition at line 39 of file DDAngular.cc.

◆ m_startCopyNo

int DDAngular::m_startCopyNo
private

Definition at line 37 of file DDAngular.cc.

mps_fire.i
i
Definition: mps_fire.py:355
DDrot
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
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
DDAngular::m_childNmNs
std::pair< std::string, std::string > m_childNmNs
Definition: DDAngular.cc:47
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: DDAngular.cc:14
DDAngular::m_startCopyNo
int m_startCopyNo
Definition: DDAngular.cc:37
DDAngular::m_solidRot
DDRotationMatrix m_solidRot
Definition: DDAngular.cc:50
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
DDAngular::m_incrCopyNo
int m_incrCopyNo
Definition: DDAngular.cc:38
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDAngular::fUnitVector
DD3Vector fUnitVector(double theta, double phi)
Definition: DDAngular.cc:150
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDAngular::m_delta
double m_delta
Definition: DDAngular.cc:42
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDAngular::m_rangeAngle
double m_rangeAngle
Definition: DDAngular.cc:40
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
DDAngular::m_radius
double m_radius
Definition: DDAngular.cc:41
createfilelist.int
int
Definition: createfilelist.py:10
DDAngular::m_n
int m_n
Definition: DDAngular.cc:36
DDAxisAngle
ROOT::Math::AxisAngle DDAxisAngle
Definition: DDRotationMatrix.h:9
DDAxes::phi
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
DDcreateRotationMatrix
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
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDAngular::m_startAngle
double m_startAngle
Definition: DDAngular.cc:39
DDAngular::m_rotateSolid
std::vector< double > m_rotateSolid
Definition: DDAngular.cc:44
DDAngular::m_idNameSpace
std::string m_idNameSpace
Definition: DDAngular.cc:46
class-composition.parent
parent
Definition: class-composition.py:88
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:66
DDRotation
ROOT::Math::Rotation3D DDRotation
Definition: DDEcalEndcapAlgo.cc:18
DDAngular::m_center
std::vector< double > m_center
Definition: DDAngular.cc:43