CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDPixBarStackLinearGap.cc
Go to the documentation of this file.
1 // File: DDPixBarStackLinearGap.cc
3 // Description: Position n copies of stacked modules at given intervals along an axis
5 
6 #include <cmath>
7 #include <algorithm>
8 
13 #include "CLHEP/Units/PhysicalConstants.h"
14 #include "CLHEP/Units/SystemOfUnits.h"
15 
16 
18  LogDebug("TrackerGeom") << "DDPixBarStackLinearGap info: Creating an instance";
19 }
20 
22 
24  const DDVectorArguments & vArgs,
25  const DDMapArguments & ,
26  const DDStringArguments & sArgs,
27  const DDStringVectorArguments &) {
28 
29  number = int(nArgs["Number"]);
30  ringmodules = int(nArgs["RingModules"]);
31  theta = nArgs["Theta"];
32  phi = nArgs["Phi"];
33  offset = nArgs["Offset"];
34  delta = nArgs["Delta"];
35  centre = vArgs["Center"];
36  rotMat = sArgs["Rotation"];
37  stackoffset = nArgs["StackOffset"];
38  stackoffsetT= int(nArgs["StackOffsetT"]);
39  zoffset = nArgs["ZOffset"];
40 
42  childName = sArgs["ChildName"];
43  DDName parentName = parent().name();
44  LogDebug("TrackerGeom") << "DDPixBarStackLinearGap debug: Parent " << parentName
45  << "\tChild " << childName << " NameSpace "
46  << idNameSpace << "\tNumber " << number <<"\tEndRings "<<ringmodules
47  << "\tAxis (theta/phi) " << theta/CLHEP::deg << ", "
48  << phi/CLHEP::deg << "\t(Offset/Delta) " << offset << ", "
49  << delta << "\tCentre " << centre[0] << ", "
50  << centre[1] << ", " << centre[2] << "\tRotation "
51  << rotMat;
52 }
53 
55 
56  DDName mother = parent().name();
58  DDTranslation direction(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
60  DDTranslation zbase(centre[0],zoffset,centre[2]);
61  std::string rotstr = DDSplit(rotMat).first;
63  if (rotstr != "NULL") {
64  std::string rotns = DDSplit(rotMat).second;
65  rot = DDRotation(DDName(rotstr, rotns));
66  }
67 
68  for (int i=(number/2)-ringmodules; i<(number/2); i++) {
69 
70  if((stackoffset!=0.0)&&(i!=0)) {
72  }
73 
74  DDTranslation tran = base + (offset + double(i)*delta)*direction;
75  cpv.position (child, mother, 2*i+1, tran, rot);
76  LogDebug("TrackerGeom") << "DDPixBarStackLinearGap test: " << child << " number "
77  << 2*i+1 << " positioned in " << mother << " at "
78  << tran << " with " << rot;
79 
80  DDTranslation tran2 = base - (offset + double(i)*delta)*direction;
81  cpv.position (child, mother, 2*i+2, tran2, rot);
82  LogDebug("TrackerGeom") << "DDPixBarStackLinearGap test: " << child << " number "
83  << 2*i+2 << " positioned in " << mother << " at "
84  << tran2 << " with " << rot;
85 
86  if(zoffset!=0.0){
87  if((i+1)!=number){
88  i++;
89  DDTranslation tran3 = zbase + (offset + double(i)*delta)*direction;
90  cpv.position (child, mother, 2*i+1, tran3, rot);
91  LogDebug("TrackerGeom") << "DDPixBarStackLinearGap test: " << child << " number "
92  << 2*i+1 << " positioned in " << mother << " at "
93  << tran3 << " with " << rot;
94 
95  DDTranslation tran4 = zbase - (offset + double(i)*delta)*direction;
96  cpv.position (child, mother, 2*i+2, tran4, rot);
97  LogDebug("TrackerGeom") << "DDPixBarStackLinearGap test: " << child << " number "
98  << 2*i+2 << " positioned in " << mother << " at "
99  << tran4 << " with " << rot;
100 
101  }
102  }
103 
104  }
105 }
#define LogDebug(id)
tuple base
Main Program
Definition: newFWLiteAna.py:92
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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()
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
U second(std::pair< T, U > const &p)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool first
Definition: L1TdeRCT.cc:79
void execute(DDCompactView &cpv)
std::vector< double > centre
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4