CMS 3D CMS Logo

DDBHMAngular.cc
Go to the documentation of this file.
1 // File: DDBHMAngular.cc
3 // Description: Position inside the mother according to phi
5 
6 #include <cmath>
7 #include <algorithm>
8 
9 #include "DDBHMAngular.h"
15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 
17 DDBHMAngular::DDBHMAngular() { LogDebug("BHMGeom") << "DDBHMAngular test: Creating an instance"; }
18 
20 
22  const DDVectorArguments&,
23  const DDMapArguments&,
24  const DDStringArguments& sArgs,
25  const DDStringVectorArguments&) {
26  units = int(nArgs["number"]);
27  rr = nArgs["radius"];
28  dphi = nArgs["deltaPhi"];
29  LogDebug("BHMGeom") << "DDBHMAngular debug: Parameters for positioning-- " << units << " copies at radius "
30  << rr / CLHEP::cm << " cm with delta(phi) " << dphi / CLHEP::deg;
31 
32  rotMat = sArgs["Rotation"];
33  childName = sArgs["ChildName"];
34  LogDebug("BHMGeom") << "DDBHMAngular debug: Parent " << parent().name() << "\tChild " << childName
35  << "\tRotation matrix " << rotMat;
36 }
37 
40  DDName parentName = parent().name();
41  std::string rotstr = DDSplit(rotMat).first;
43  if (rotstr != "NULL") {
44  std::string rotns = DDSplit(rotMat).second;
45  rot = DDRotation(DDName(rotstr, rotns));
46  }
47 
48  for (int jj = 0; jj < units; jj++) {
49  double driverX(0), driverY(0), driverZ(0);
50  if (jj < 16) {
51  driverX = rr * cos((jj + 0.5) * dphi);
52  driverY = sqrt(rr * rr - driverX * driverX);
53  } else if (jj == 16) {
54  driverX = rr * cos(15.5 * dphi);
55  driverY = -sqrt(rr * rr - driverX * driverX);
56  } else if (jj == 17) {
57  driverX = rr * cos(14.5 * dphi);
58  driverY = -sqrt(rr * rr - driverX * driverX);
59  } else if (jj == 18) {
60  driverX = rr * cos(0.5 * dphi);
61  driverY = -sqrt(rr * rr - driverX * driverX);
62  } else if (jj == 19) {
63  driverX = rr * cos(1.5 * dphi);
64  driverY = -sqrt(rr * rr - driverX * driverX);
65  }
66  DDTranslation tran(driverX, driverY, driverZ);
67 
68  cpv.position(child, parentName, jj + 1, tran, rot);
69  LogDebug("BHMGeom") << "DDBHMAngular test: " << child << " number " << jj + 1 << " positioned in " << parentName
70  << " at " << tran << " with " << rot;
71  }
72 }
#define LogDebug(id)
~DDBHMAngular() override
Definition: DDBHMAngular.cc:19
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDBHMAngular.cc:21
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::string rotMat
Definition: DDBHMAngular.h:29
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
void execute(DDCompactView &cpv) override
Definition: DDBHMAngular.cc:38
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::Rotation3D DDRotation
std::string childName
Definition: DDBHMAngular.h:30