CMS 3D CMS Logo

DDMuonAngular.cc
Go to the documentation of this file.
1 // File: DDMuonAngular.cc
3 // Description: Position inside the mother according to (eta,phi)
5 
6 #include <cmath>
7 #include <algorithm>
8 
13 #include "CLHEP/Units/GlobalSystemOfUnits.h"
14 
16  edm::LogInfo("MuonGeom") << "DDMuonAngular test: Creating an instance";
17 }
18 
20 
22  const DDVectorArguments & ,
23  const DDMapArguments & ,
24  const DDStringArguments & sArgs,
25  const DDStringVectorArguments & ) {
26 
27  startAngle = nArgs["startAngle"];
28  stepAngle = nArgs["stepAngle"];
29  zoffset = nArgs["zoffset"];
30  n = int (nArgs["n"]);
31  startCopyNo = int (nArgs["startCopyNo"]);
32  incrCopyNo = int (nArgs["incrCopyNo"]);
33  edm::LogInfo("MuonGeom") << "DDMuonAngular debug: Parameters for positioning-- "
34  << n << " copies in steps of " << stepAngle/CLHEP::deg
35  << " from " << startAngle/CLHEP::deg << " \tZoffest "
36  << zoffset << "\tStart and inremental copy nos "
37  << startCopyNo << ", " << incrCopyNo;
38 
39  rotns = sArgs["RotNameSpace"];
41  childName = sArgs["ChildName"];
42  DDName parentName = parent().name();
43  edm::LogInfo("MuonGeom") << "DDMuonAngular debug: Parent " << parentName
44  << "\tChild " << childName << "\tNameSpace "
45  << idNameSpace << "\tRotation Namespace " << rotns;
46 }
47 
49 
50  double phi = startAngle;
51  int copyNo = startCopyNo;
52 
53  for (int ii=0; ii<n; ii++) {
54 
55  double phideg = phi/CLHEP::deg;
56  int iphi;
57  if (phideg > 0) iphi = int(phideg+0.1);
58  else iphi = int(phideg-0.1);
59  if (iphi >= 360) iphi -= 360;
60  phideg = iphi;
62  std::string rotstr("NULL");
63 
64  if (iphi != 0) {
65  rotstr = "R";
66  if (phideg >=0 && phideg < 10) rotstr = "R00";
67  else if (phideg < 100) rotstr = "R0";
68  rotstr = rotstr + std::to_string(phideg);
69  rotation = DDRotation(DDName(rotstr, rotns));
70  if (!rotation) {
71  edm::LogInfo("MuonGeom") << "DDMuonAngular test: Creating a new rotation "
72  << DDName(rotstr, idNameSpace) << "\t90, "
73  << phideg << ", 90, " << (phideg+90) << ", 0, 0";
74  rotation = DDrot(DDName(rotstr, rotns), 90*CLHEP::deg,
75  phideg*CLHEP::deg, 90*CLHEP::deg,
76  (90+phideg)*CLHEP::deg, 0*CLHEP::deg, 0*CLHEP::deg);
77  }
78  }
79 
80  DDTranslation tran(0, 0, zoffset);
81 
82  DDName parentName = parent().name();
83  cpv.position(DDName(childName,idNameSpace), parentName, copyNo, tran, rotation);
84  edm::LogInfo("MuonGeom") << "DDMuonAngular test: "
85  << DDName(childName, idNameSpace) << " number "
86  << copyNo << " positioned in " << parentName << " at "
87  << tran << " with " << rotstr << " " << rotation;
88  phi += stepAngle;
89  copyNo += incrCopyNo;
90  }
91 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
static std::string & ns()
double startAngle
Definition: DDMuonAngular.h:26
type of data representation of DDCompactView
Definition: DDCompactView.h:90
~DDMuonAngular() override
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
std::string rotns
Definition: DDMuonAngular.h:33
void execute(DDCompactView &cpv) override
std::string childName
Definition: DDMuonAngular.h:35
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
ii
Definition: cuy.py:588
double stepAngle
Definition: DDMuonAngular.h:27
std::string idNameSpace
Definition: DDMuonAngular.h:34
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override