CMS 3D CMS Logo

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 
13 #include "CLHEP/Units/GlobalPhysicalConstants.h"
14 #include "CLHEP/Units/GlobalSystemOfUnits.h"
15 
16 
18  LogDebug("TECGeom") << "DDTECPhiAlgo info: Creating an instance";
19 }
20 
22 
24  const DDVectorArguments & ,
25  const DDMapArguments & ,
26  const DDStringArguments & sArgs,
27  const DDStringVectorArguments & ) {
28 
29  startAngle = nArgs["StartAngle"];
30  incrAngle = nArgs["IncrAngle"];
31  zIn = nArgs["ZIn"];
32  zOut = nArgs["ZOut"];
33  number = int (nArgs["Number"]);
34  startCopyNo= int (nArgs["StartCopyNo"]);
35  incrCopyNo = int (nArgs["IncrCopyNo"]);
36 
37  LogDebug("TECGeom") << "DDTECPhiAlgo debug: Parameters for "
38  << "positioning--" << "\tStartAngle "
39  << startAngle/CLHEP::deg << "\tIncrAngle "
40  << incrAngle/CLHEP::deg << "\tZ in/out " << zIn << ", "
41  << zOut << "\tCopy Numbers " << number
42  << " Start/Increment " << startCopyNo << ", "
43  << incrCopyNo;
44 
46  childName = sArgs["ChildName"];
47  DDName parentName = parent().name();
48  LogDebug("TECGeom") << "DDTECPhiAlgo debug: Parent " << parentName
49  << "\tChild " << childName << " NameSpace "
50  << idNameSpace;
51 }
52 
54 
55  if (number > 0) {
56  double theta = 90.*CLHEP::deg;
57  int copyNo = startCopyNo;
58 
59  DDName mother = parent().name();
61  for (int i=0; i<number; i++) {
62  double phix = startAngle + i*incrAngle;
63  double phiy = phix + 90.*CLHEP::deg;
64  double phideg = phix/CLHEP::deg;
65 
67  std::string rotstr = DDSplit(childName).first + std::to_string(phideg*10.);
68  rotation = DDRotation(DDName(rotstr, idNameSpace));
69  if (!rotation) {
70  LogDebug("TECGeom") << "DDTECPhiAlgo test: Creating a new "
71  << "rotation " << rotstr << "\t"
72  << theta/CLHEP::deg << ", " << phix/CLHEP::deg
73  << ", " << theta/CLHEP::deg << ", "
74  << phiy/CLHEP::deg << ", 0, 0";
75  rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
76  0., 0.);
77  }
78 
79  double zpos = zOut;
80  if (i%2 == 0) zpos = zIn;
81  DDTranslation tran(0., 0., zpos);
82 
83  cpv.position(child, mother, copyNo, tran, rotation);
84  LogDebug("TECGeom") << "DDTECPhiAlgo test: " << child <<" number "
85  << copyNo << " positioned in " << mother <<" at "
86  << tran << " with " << rotation;
87  copyNo += incrCopyNo;
88  }
89  }
90 }
#define LogDebug(id)
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:15
static std::string & ns()
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
Definition: DDTECPhiAlgo.cc:23
double incrAngle
Definition: DDTECPhiAlgo.h:28
type of data representation of DDCompactView
Definition: DDCompactView.h:90
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:64
U second(std::pair< T, U > const &p)
void execute(DDCompactView &cpv)
Definition: DDTECPhiAlgo.cc:53
virtual ~DDTECPhiAlgo()
Definition: DDTECPhiAlgo.cc:21
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
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