CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTECPhiAltAlgo.cc
Go to the documentation of this file.
1 // File: DDTECPhiAltAlgo.cc
3 // Description: Position n copies inside and outside Z at alternate phi values
5 
6 #include <cmath>
7 #include <algorithm>
8 
14 #include "CLHEP/Units/GlobalPhysicalConstants.h"
15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 
17 
19  LogDebug("TECGeom") << "DDTECPhiAltAlgo info: Creating an instance";
20 }
21 
23 
25  const DDVectorArguments & ,
26  const DDMapArguments & ,
27  const DDStringArguments & sArgs,
28  const DDStringVectorArguments & ) {
29 
30  startAngle = nArgs["StartAngle"];
31  incrAngle = nArgs["IncrAngle"];
32  radius = nArgs["Radius"];
33  zIn = nArgs["ZIn"];
34  zOut = nArgs["ZOut"];
35  number = int (nArgs["Number"]);
36  startCopyNo= int (nArgs["StartCopyNo"]);
37  incrCopyNo = int (nArgs["IncrCopyNo"]);
38 
39  LogDebug("TECGeom") << "DDTECPhiAltAlgo debug: Parameters for "
40  << "positioning--" << "\tStartAngle "
41  << startAngle/CLHEP::deg << "\tIncrAngle "
42  << incrAngle/CLHEP::deg << "\tRadius " << radius
43  << "\tZ in/out " << zIn << ", " << zOut
44  << "\tCopy Numbers " << number << " Start/Increment "
45  << startCopyNo << ", " << incrCopyNo;
46 
48  childName = sArgs["ChildName"];
49  DDName parentName = parent().name();
50  LogDebug("TECGeom") << "DDTECPhiAltAlgo debug: Parent " << parentName
51  << "\tChild " << childName << " NameSpace "
52  << idNameSpace;
53 }
54 
56 
57  if (number > 0) {
58  double theta = 90.*CLHEP::deg;
59  int copyNo = startCopyNo;
60 
61  DDName mother = parent().name();
63  for (int i=0; i<number; i++) {
64  double phiz = startAngle + i*incrAngle;
65  double phix = phiz + 90.*CLHEP::deg;
66  double phideg = phiz/CLHEP::deg;
67 
69  std::string rotstr = DDSplit(childName).first+dbl_to_string(phideg*10.);
70  rotation = DDRotation(DDName(rotstr, idNameSpace));
71  if (!rotation) {
72  LogDebug("TECGeom") << "DDTECPhiAltAlgo test: Creating a new "
73  << "rotation " << rotstr << "\t"
74  << theta/CLHEP::deg << ", " << phix/CLHEP::deg
75  << ", 0, 0, " << theta/CLHEP::deg << ", "
76  << phiz/CLHEP::deg;
77  rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, 0., 0.,
78  theta, phiz);
79  }
80 
81  double xpos = radius*cos(phiz);
82  double ypos = radius*sin(phiz);
83  double zpos;
84  if (i%2 == 0) zpos = zIn;
85  else zpos = zOut;
86  DDTranslation tran(xpos, ypos, zpos);
87 
88  cpv.position(child, mother, copyNo, tran, rotation);
89  LogDebug("TECGeom") << "DDTECPhiAltAlgo test: " << child <<" number "
90  << copyNo << " positioned in " << mother <<" at "
91  << tran << " with " << rotation;
92  copyNo += incrCopyNo;
93  }
94  }
95 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
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
std::string childName
type of data representation of DDCompactView
Definition: DDCompactView.h:77
void execute(DDCompactView &cpv)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
U second(std::pair< T, U > const &p)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual ~DDTECPhiAltAlgo()
bool first
Definition: L1TdeRCT.cc:75
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
std::string idNameSpace