CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
14 #include "CLHEP/Units/GlobalSystemOfUnits.h"
15 
17  edm::LogInfo("MuonGeom") << "DDMuonAngular test: Creating an instance";
18 }
19 
21 
23  const DDVectorArguments & ,
24  const DDMapArguments & ,
25  const DDStringArguments & sArgs,
26  const DDStringVectorArguments & ) {
27 
28  startAngle = nArgs["startAngle"];
29  stepAngle = nArgs["stepAngle"];
30  zoffset = nArgs["zoffset"];
31  n = int (nArgs["n"]);
32  startCopyNo = int (nArgs["startCopyNo"]);
33  incrCopyNo = int (nArgs["incrCopyNo"]);
34  edm::LogInfo("MuonGeom") << "DDMuonAngular debug: Parameters for positioning-- "
35  << n << " copies in steps of " << stepAngle/CLHEP::deg
36  << " from " << startAngle/CLHEP::deg << " \tZoffest "
37  << zoffset << "\tStart and inremental copy nos "
38  << startCopyNo << ", " << incrCopyNo;
39 
40  rotns = sArgs["RotNameSpace"];
42  childName = sArgs["ChildName"];
43  DDName parentName = parent().name();
44  edm::LogInfo("MuonGeom") << "DDMuonAngular debug: Parent " << parentName
45  << "\tChild " << childName << "\tNameSpace "
46  << idNameSpace << "\tRotation Namespace " << rotns;
47 }
48 
50 
51  double phi = startAngle;
52  int copyNo = startCopyNo;
53 
54  for (int ii=0; ii<n; ii++) {
55 
56  double phideg = phi/CLHEP::deg;
57  int iphi;
58  if (phideg > 0) iphi = int(phideg+0.1);
59  else iphi = int(phideg-0.1);
60  if (iphi >= 360) iphi -= 360;
61  phideg = iphi;
63  std::string rotstr("NULL");
64 
65  if (iphi != 0) {
66  rotstr = "R";
67  if (phideg >=0 && phideg < 10) rotstr = "R00";
68  else if (phideg < 100) rotstr = "R0";
69  rotstr = rotstr + dbl_to_string(phideg);
70  rotation = DDRotation(DDName(rotstr, rotns));
71  if (!rotation) {
72  edm::LogInfo("MuonGeom") << "DDMuonAngular test: Creating a new rotation "
73  << DDName(rotstr, idNameSpace) << "\t90, "
74  << phideg << ", 90, " << (phideg+90) << ", 0, 0";
75  rotation = DDrot(DDName(rotstr, rotns), 90*CLHEP::deg,
76  phideg*CLHEP::deg, 90*CLHEP::deg,
77  (90+phideg)*CLHEP::deg, 0*CLHEP::deg, 0*CLHEP::deg);
78  }
79  }
80 
81  DDTranslation tran(0, 0, zoffset);
82 
83  DDName parentName = parent().name();
84  cpv.position(DDName(childName,idNameSpace), parentName, copyNo, tran, rotation);
85  edm::LogInfo("MuonGeom") << "DDMuonAngular test: "
86  << DDName(childName, idNameSpace) << " number "
87  << copyNo << " positioned in " << parentName << " at "
88  << tran << " with " << rotstr << " " << rotation;
89  phi += stepAngle;
90  copyNo += incrCopyNo;
91  }
92 }
list parent
Definition: dbtoconf.py:74
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
static std::string & ns()
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Definition: DDutils.cc:12
double startAngle
Definition: DDMuonAngular.h:26
virtual ~DDMuonAngular()
int ii
Definition: cuy.py:588
type of data representation of DDCompactView
Definition: DDCompactView.h:77
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
std::string rotns
Definition: DDMuonAngular.h:33
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
double stepAngle
Definition: DDMuonAngular.h:27
std::string idNameSpace
Definition: DDMuonAngular.h:34
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
void execute(DDCompactView &cpv)
Definition: DDAxes.h:10