CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTrackerXYZPosAlgo.cc
Go to the documentation of this file.
1 // File: DDTrackerXYZPosAlgo.cc
3 // Description: Position n copies at given x-values, y-values and z-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("TrackerGeom") <<"DDTrackerXYZPosAlgo info: Creating an instance";
19 }
20 
22 
24  const DDVectorArguments & vArgs,
25  const DDMapArguments & ,
26  const DDStringArguments & sArgs,
27  const DDStringVectorArguments & vsArgs) {
28 
29  startCopyNo = int(nArgs["StartCopyNo"]);
30  incrCopyNo = int(nArgs["IncrCopyNo"]);
31  xvec = vArgs["XPositions"];
32  yvec = vArgs["YPositions"];
33  zvec = vArgs["ZPositions"];
34  rotMat = vsArgs["Rotations"];
35 
37  childName = sArgs["ChildName"];
38  DDName parentName = parent().name();
39  LogDebug("TrackerGeom") << "DDTrackerXYZPosAlgo debug: Parent " << parentName
40  << "\tChild " << childName << " NameSpace "
41  << idNameSpace << "\tCopyNo (Start/Increment) "
42  << startCopyNo << ", " << incrCopyNo << "\tNumber "
43  << xvec.size() << ", " << yvec.size() << ", " << zvec.size();
44  for (int i = 0; i < (int)(zvec.size()); i++) {
45  LogDebug("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i]
46  << "\t[" << i << "]\tY = " << yvec[i]
47  << "\t[" << i << "]\tZ = " << zvec[i]
48  << ", Rot.Matrix = " << rotMat[i];
49  }
50 }
51 
53 
54  int copy = startCopyNo;
55  DDName mother = parent().name();
57 
58  for (int i=0; i<(int)(zvec.size()); i++) {
59 
60  DDTranslation tran(xvec[i], yvec[i], zvec[i]);
61  std::string rotstr = DDSplit(rotMat[i]).first;
63  if (rotstr != "NULL") {
64  std::string rotns = DDSplit(rotMat[i]).second;
65  rot = DDRotation(DDName(rotstr, rotns));
66  }
67  cpv.position(child, mother, copy, tran, rot);
68  LogDebug("TrackerGeom") << "DDTrackerXYZPosAlgo test: " << child
69  <<" number " << copy << " positioned in "
70  << mother << " at " << tran << " with " << rot;
71  copy += incrCopyNo;
72  }
73 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
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)
std::vector< double > zvec
void execute(DDCompactView &cpv)
std::vector< double > xvec
bool first
Definition: L1TdeRCT.cc:75
std::vector< std::string > rotMat
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
std::vector< double > yvec