CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTrackerZPosAlgo.cc
Go to the documentation of this file.
1 // File: DDTrackerZPosAlgo.cc
3 // Description: Position n copies at given 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") <<"DDTrackerZPosAlgo 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  zvec = vArgs["ZPositions"];
32  rotMat = vsArgs["Rotations"];
33 
35  childName = sArgs["ChildName"];
36  DDName parentName = parent().name();
37  LogDebug("TrackerGeom") << "DDTrackerZPosAlgo debug: Parent " << parentName
38  << "\tChild " << childName << " NameSpace "
39  << idNameSpace << "\tCopyNo (Start/Increment) "
40  << startCopyNo << ", " << incrCopyNo << "\tNumber "
41  << zvec.size();
42  for (int i = 0; i < (int)(zvec.size()); i++) {
43  LogDebug("TrackerGeom") << "\t[" << i << "]\tZ = " << zvec[i]
44  << ", Rot.Matrix = " << rotMat[i];
45  }
46 }
47 
49 
50  int copy = startCopyNo;
51  DDName mother = parent().name();
53 
54  for (int i=0; i<(int)(zvec.size()); i++) {
55 
56  DDTranslation tran(0, 0, zvec[i]);
57  std::string rotstr = DDSplit(rotMat[i]).first;
59  if (rotstr != "NULL") {
60  std::string rotns = DDSplit(rotMat[i]).second;
61  rot = DDRotation(DDName(rotstr, rotns));
62  }
63  cpv.position(child, mother, copy, tran, rot);
64  LogDebug("TrackerGeom") << "DDTrackerZPosAlgo test: " << child <<" number "
65  << copy << " positioned in " << mother << " at "
66  << tran << " with " << rot;
67  copy += incrCopyNo;
68  }
69 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::string idNameSpace
list parent
Definition: dbtoconf.py:74
void execute(DDCompactView &cpv)
std::vector< double > zvec
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)
virtual ~DDTrackerZPosAlgo()
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
std::vector< std::string > rotMat