CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTrackerLinear.cc
Go to the documentation of this file.
1 // File: DDTrackerLinear.cc
3 // Description: Position n copies at given intervals along an axis
5 
6 #include <cmath>
7 #include <algorithm>
8 
13 #include "CLHEP/Units/GlobalPhysicalConstants.h"
14 #include "CLHEP/Units/GlobalSystemOfUnits.h"
15 
16 
17 DDTrackerLinear::DDTrackerLinear() : startcn(1), incrcn(1) {
18  LogDebug("TrackerGeom") << "DDTrackerLinear 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  if ( nArgs.find("StartCopyNo") != nArgs.end() ) {
37  startcn = size_t(nArgs["StartCopyNo"]);
38  } else {
39  startcn = 1;
40  }
41  if ( nArgs.find("IncrCopyNo") != nArgs.end() ) {
42  incrcn = int(nArgs["IncrCopyNo"]);
43  } else {
44  incrcn = 1;
45  }
46 
48  childName = sArgs["ChildName"];
49  DDName parentName = parent().name();
50  LogDebug("TrackerGeom") << "DDTrackerLinear debug: Parent " << parentName
51  << "\tChild " << childName << " NameSpace "
52  << idNameSpace << "\tNumber " << number
53  << "\tAxis (theta/phi) " << theta/CLHEP::deg << ", "
54  << phi/CLHEP::deg << "\t(Offset/Delta) " << offset
55  << ", " << delta << "\tCentre " << centre[0] << ", "
56  << centre[1] << ", " << centre[2] << "\tRotation "
57  << rotMat;
58 }
59 
61 
62  DDName mother = parent().name();
64  DDTranslation direction(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
66  std::string rotstr = DDSplit(rotMat).first;
68  if (rotstr != "NULL") {
69  std::string rotns = DDSplit(rotMat).second;
70  rot = DDRotation(DDName(rotstr, rotns));
71  }
72  int ci = startcn;
73  for (int i=0; i<number; i++) {
74 
75  DDTranslation tran = base + (offset + double(i)*delta)*direction;
76  cpv.position(child, mother, ci, tran, rot);
77  LogDebug("TrackerGeom") << "DDTrackerLinear test: " << child << " number "
78  << ci << " positioned in " << mother << " at "
79  << tran << " with " << rot;
80  ++ci;
81  }
82 }
#define LogDebug(id)
tuple base
Main Program
Definition: newFWLiteAna.py:92
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
virtual ~DDTrackerLinear()
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
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
static std::string & ns()
type of data representation of DDCompactView
Definition: DDCompactView.h:77
std::vector< double > centre
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)
std::string rotMat
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool first
Definition: L1TdeRCT.cc:75
std::string childName
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
std::string idNameSpace