CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDPixBarStackLinear.cc
Go to the documentation of this file.
1 // File: DDPixBarStackLinear.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") << "DDPixBarStackLinear 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  theta = nArgs["Theta"];
31  phi = nArgs["Phi"];
32  offset = nArgs["Offset"];
33  delta = nArgs["Delta"];
34  centre = vArgs["Center"];
35  rotMat = sArgs["Rotation"];
36  stackoffset = nArgs["StackOffset"];
37  stackoffsetT= int(nArgs["StackOffsetT"]);
38  zoffset = nArgs["ZOffset"];
39 
41  childName = sArgs["ChildName"];
42  DDName parentName = parent().name();
43  LogDebug("TrackerGeom") << "DDPixBarStackLinear debug: Parent " << parentName
44  << "\tChild " << childName << " NameSpace "
45  << idNameSpace << "\tNumber " << number
46  << "\tAxis (theta/phi) " << theta/CLHEP::deg << ", "
47  << phi/CLHEP::deg << "\t(Offset/Delta) " << offset << ", "
48  << delta << "\tCentre " << centre[0] << ", "
49  << centre[1] << ", " << centre[2] << "\tRotation "
50  << rotMat;
51 }
52 
54 
55  DDName mother = parent().name();
57  DDTranslation direction(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
59  DDTranslation zbase(centre[0],zoffset,centre[2]);
60  std::string rotstr = DDSplit(rotMat).first;
62  if (rotstr != "NULL") {
63  std::string rotns = DDSplit(rotMat).second;
64  rot = DDRotation(DDName(rotstr, rotns));
65  }
66 
67  for (int i=0; i<(number/2); i++) {
68 
69  if((stackoffset!=0.0)&&(i!=0)) {
71  }
72 
73  DDTranslation tran = base + (offset + double(i)*delta)*direction;
74  cpv.position (child, mother, 2*i+1, tran, rot);
75  LogDebug("TrackerGeom") << "DDPixBarStackLinear test: " << child << " number "
76  << 2*i+1 << " positioned in " << mother << " at "
77  << tran << " with " << rot;
78 
79  DDTranslation tran2 = base - (offset + double(i)*delta)*direction;
80  cpv.position (child, mother, 2*i+2, tran2, rot);
81  LogDebug("TrackerGeom") << "DDPixBarStackLinear test: " << child << " number "
82  << 2*i+2 << " positioned in " << mother << " at "
83  << tran << " with " << rot;
84 
85  if(zoffset!=0.0){
86  if((i+1)!=number){
87  i++;
88  DDTranslation tran3 = zbase + (offset + double(i)*delta)*direction;
89  cpv.position (child, mother, 2*i+1, tran3, rot);
90  LogDebug("TrackerGeom") << "DDPixBarStackLinear test: " << child << " number "
91  << 2*i+1 << " positioned in " << mother << " at "
92  << tran << " with " << rot;
93 
94  DDTranslation tran4 = zbase - (offset + double(i)*delta)*direction;
95  cpv.position (child, mother, 2*i+2, tran4, rot);
96  LogDebug("TrackerGeom") << "DDPixBarStackLinear test: " << child << " number "
97  << 2*i+2 << " positioned in " << mother << " at "
98  << tran << " with " << rot;
99 
100  }
101  }
102 
103  }
104 }
#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)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool first
Definition: L1TdeRCT.cc:94
std::vector< double > centre
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
void execute(DDCompactView &cpv)