CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTECPhiAlgo.cc
Go to the documentation of this file.
1 // File: DDTECPhiAlgo.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") << "DDTECPhiAlgo 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  zIn = nArgs["ZIn"];
33  zOut = nArgs["ZOut"];
34  number = int (nArgs["Number"]);
35  startCopyNo= int (nArgs["StartCopyNo"]);
36  incrCopyNo = int (nArgs["IncrCopyNo"]);
37 
38  LogDebug("TECGeom") << "DDTECPhiAlgo debug: Parameters for "
39  << "positioning--" << "\tStartAngle "
40  << startAngle/CLHEP::deg << "\tIncrAngle "
41  << incrAngle/CLHEP::deg << "\tZ in/out " << zIn << ", "
42  << zOut << "\tCopy Numbers " << number
43  << " Start/Increment " << startCopyNo << ", "
44  << incrCopyNo;
45 
47  childName = sArgs["ChildName"];
48  DDName parentName = parent().name();
49  LogDebug("TECGeom") << "DDTECPhiAlgo debug: Parent " << parentName
50  << "\tChild " << childName << " NameSpace "
51  << idNameSpace;
52 }
53 
55 
56  if (number > 0) {
57  double theta = 90.*CLHEP::deg;
58  int copyNo = startCopyNo;
59 
60  DDName mother = parent().name();
62  for (int i=0; i<number; i++) {
63  double phix = startAngle + i*incrAngle;
64  double phiy = phix + 90.*CLHEP::deg;
65  double phideg = phix/CLHEP::deg;
66 
67  DDRotation rotation;
68  std::string rotstr = DDSplit(childName).first+dbl_to_string(phideg*10.);
69  rotation = DDRotation(DDName(rotstr, idNameSpace));
70  if (!rotation) {
71  LogDebug("TECGeom") << "DDTECPhiAlgo test: Creating a new "
72  << "rotation " << rotstr << "\t"
73  << theta/CLHEP::deg << ", " << phix/CLHEP::deg
74  << ", " << theta/CLHEP::deg << ", "
75  << phiy/CLHEP::deg << ", 0, 0";
76  rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
77  0., 0.);
78  }
79 
80  double zpos = zOut;
81  if (i%2 == 0) zpos = zIn;
82  DDTranslation tran(0., 0., zpos);
83 
84  cpv.position(child, mother, copyNo, tran, rotation);
85  LogDebug("TECGeom") << "DDTECPhiAlgo test: " << child <<" number "
86  << copyNo << " positioned in " << mother <<" at "
87  << tran << " with " << rotation;
88  copyNo += incrCopyNo;
89  }
90  }
91 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
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
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
Definition: DDTECPhiAlgo.cc:24
double incrAngle
Definition: DDTECPhiAlgo.h:28
type of data representation of DDCompactView
Definition: DDCompactView.h:81
std::string idNameSpace
Definition: DDTECPhiAlgo.h:35
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)
void execute(DDCompactView &cpv)
Definition: DDTECPhiAlgo.cc:54
virtual ~DDTECPhiAlgo()
Definition: DDTECPhiAlgo.cc:22
bool first
Definition: L1TdeRCT.cc:79
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:94
double startAngle
Definition: DDTECPhiAlgo.h:27
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
std::string childName
Definition: DDTECPhiAlgo.h:36