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 
15 //#define EDM_ML_DEBUG
16 
18 #ifdef EDM_ML_DEBUG
19  edm::LogInfo("MuonGeom") << "DDMuonAngular test: Creating an instance";
20 #endif
21 }
22 
24 
26  const DDVectorArguments & ,
27  const DDMapArguments & ,
28  const DDStringArguments & sArgs,
29  const DDStringVectorArguments & ) {
30 
31  startAngle = nArgs["startAngle"];
32  stepAngle = nArgs["stepAngle"];
33  zoffset = nArgs["zoffset"];
34  n = int (nArgs["n"]);
35  startCopyNo = int (nArgs["startCopyNo"]);
36  incrCopyNo = int (nArgs["incrCopyNo"]);
37 #ifdef EDM_ML_DEBUG
38  edm::LogInfo("MuonGeom") << "DDMuonAngular debug: Parameters for positioning-- "
39  << n << " copies in steps of " << stepAngle/CLHEP::deg
40  << " from " << startAngle/CLHEP::deg << " \tZoffest "
41  << zoffset << "\tStart and inremental copy nos "
42  << startCopyNo << ", " << incrCopyNo;
43 #endif
44  rotns = sArgs["RotNameSpace"];
46  childName = sArgs["ChildName"];
47 #ifdef EDM_ML_DEBUG
48  DDName parentName = parent().name();
49  edm::LogInfo("MuonGeom") << "DDMuonAngular debug: Parent " << parentName
50  << "\tChild " << childName << "\tNameSpace "
51  << idNameSpace << "\tRotation Namespace " << rotns;
52 #endif
53 }
54 
56 
57  double phi = startAngle;
58  int copyNo = startCopyNo;
59 
60  for (int ii=0; ii<n; ii++) {
61 
62  double phideg = phi/CLHEP::deg;
63  int iphi;
64  if (phideg > 0) iphi = int(phideg+0.1);
65  else iphi = int(phideg-0.1);
66  if (iphi >= 360) iphi -= 360;
67  phideg = iphi;
69  std::string rotstr("NULL");
70 
71  if (iphi != 0) {
72  rotstr = "R";
73  if (phideg >=0 && phideg < 10) rotstr = "R00";
74  else if (phideg < 100) rotstr = "R0";
75  rotstr = rotstr + std::to_string(phideg);
76  rotation = DDRotation(DDName(rotstr, rotns));
77  if (!rotation) {
78 #ifdef EDM_ML_DEBUG
79  edm::LogInfo("MuonGeom") << "DDMuonAngular test: Creating a new rotation "
80  << DDName(rotstr, idNameSpace) << "\t90, "
81  << phideg << ", 90, " << (phideg+90) << ", 0, 0";
82 #endif
83  rotation = DDrot(DDName(rotstr, rotns), 90*CLHEP::deg,
84  phideg*CLHEP::deg, 90*CLHEP::deg,
85  (90+phideg)*CLHEP::deg, 0*CLHEP::deg, 0*CLHEP::deg);
86  }
87  }
88 
89  DDTranslation tran(0, 0, zoffset);
90 
91  DDName parentName = parent().name();
92  cpv.position(DDName(childName,idNameSpace), parentName, copyNo, tran, rotation);
93 #ifdef EDM_ML_DEBUG
94  edm::LogInfo("MuonGeom") << "DDMuonAngular test: "
95  << DDName(childName, idNameSpace) << " number "
96  << copyNo << " positioned in " << parentName
97  << " at " << tran << " with " << rotstr << " "
98  << rotation;
99 #endif
100  phi += stepAngle;
101  copyNo += incrCopyNo;
102  }
103 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
static std::string & ns()
double startAngle
Definition: DDMuonAngular.h:26
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:83
~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:589
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