CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTrackerLinearXY.cc
Go to the documentation of this file.
1 // File: DDTrackerLinearXY.cc
3 // Description: Position nxXny copies at given intervals along x and y axis
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") <<"DDTrackerLinearXY info: Creating an instance";
19 }
20 
22 
24  const DDVectorArguments & vArgs,
25  const DDMapArguments & ,
26  const DDStringArguments & sArgs,
27  const DDStringVectorArguments &) {
28 
29  numberX = int(nArgs["NumberX"]);
30  deltaX = nArgs["DeltaX"];
31  numberY = int(nArgs["NumberY"]);
32  deltaY = nArgs["DeltaY"];
33  centre = vArgs["Center"];
34 
36  childName = sArgs["ChildName"];
37  DDName parentName = parent().name();
38  LogDebug("TrackerGeom") << "DDTrackerLinearXY debug: Parent " << parentName
39  << "\tChild " << childName << " NameSpace "
40  << idNameSpace << "\tNumber along X/Y " << numberX
41  << "/" << numberY << "\tDelta along X/Y " << deltaX
42  << "/" << deltaY << "\tCentre " << centre[0] << ", "
43  << centre[1] << ", " << centre[2];
44 }
45 
47 
48  DDName mother = parent().name();
51  double xoff = centre[0] - (numberX-1)*deltaX/2.;
52  double yoff = centre[1] - (numberY-1)*deltaY/2.;
53  int copy = 0;
54 
55  for (int i=0; i<numberX; i++) {
56  for (int j=0; j<numberY; j++) {
57 
58  DDTranslation tran(xoff+i*deltaX,yoff+j*deltaY,centre[2]);
59  copy++;
60  cpv.position(child, mother, copy, tran, rot);
61  LogDebug("TrackerGeom") << "DDTrackerLinearXY test: " << child
62  << " number " << copy << " positioned in "
63  << mother << " at " << tran << " with " << rot;
64  }
65  }
66 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
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()
virtual ~DDTrackerLinearXY()
void execute(DDCompactView &cpv)
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)
int j
Definition: DBlmapReader.cc:9
std::vector< double > centre
std::string idNameSpace
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4