CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDHCalLinearXY.cc
Go to the documentation of this file.
1 // File: DDHCalLinearXY.cc
3 // Description: Position nxXny copies at given intervals along x and y axis
5 
6 #include <cmath>
7 #include <algorithm>
8 
13 
14 
16  LogDebug("HCalGeom") <<"DDHCalLinearXY info: Creating an instance";
17 }
18 
20 
22  const DDVectorArguments & vArgs,
23  const DDMapArguments & ,
24  const DDStringArguments & sArgs,
25  const DDStringVectorArguments & vsArgs) {
26 
27  numberX = int(nArgs["NumberX"]);
28  deltaX = nArgs["DeltaX"];
29  numberY = int(nArgs["NumberY"]);
30  deltaY = nArgs["DeltaY"];
31  centre = vArgs["Center"];
32 
34  childName = vsArgs["Child"];
35  DDName parentName = parent().name();
36  LogDebug("HCalGeom") << "DDHCalLinearXY debug: Parent " << parentName
37  << "\twith " << childName.size() << " children";
38  for (unsigned int i=0; i<childName.size(); ++i)
39  LogDebug("HCalGeom") << "DDHCalLinearXY debug: Child[" << i << "] = "
40  << childName[i];
41  LogDebug("HCalGeom") << "DDHCalLinearXY debug: NameSpace "
42  << idNameSpace << "\tNumber along X/Y " << numberX
43  << "/" << numberY << "\tDelta along X/Y " << deltaX
44  << "/" << deltaY << "\tCentre " << centre[0] << ", "
45  << centre[1] << ", " << centre[2];
46 }
47 
49 
50  DDName mother = parent().name();
51  DDName child;
53  double xoff = centre[0] - (numberX-1)*deltaX/2.;
54  double yoff = centre[1] - (numberY-1)*deltaY/2.;
55  int copy = 0;
56 
57  for (int i=0; i<numberX; i++) {
58  for (int j=0; j<numberY; j++) {
59 
60  DDTranslation tran(xoff+i*deltaX,yoff+j*deltaY,centre[2]);
61  bool place = true;
62  unsigned int k = copy;
63  if (childName.size() == 1) k = 0;
64  if (k < childName.size() && (childName[k] != " " && childName[k] != "Null")) {
66  } else {
67  place = false;
68  }
69  copy++;
70  if (place) {
71  cpv.position(child, mother, copy, tran, rot);
72  LogDebug("HCalGeom") << "DDHCalLinearXY test: " << child
73  << " number " << copy << " positioned in "
74  << mother << " at " << tran << " with " << rot;
75  } else {
76  LogDebug("HCalGeom") << "DDHCalLinearXY test: No child placed for ["
77  << copy << "]";
78  }
79  }
80  }
81 }
#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()
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< std::string > childName
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
int j
Definition: DBlmapReader.cc:9
virtual ~DDHCalLinearXY()
bool first
Definition: L1TdeRCT.cc:94
std::string idNameSpace
int k[5][pyjets_maxn]
void execute(DDCompactView &cpv)
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 > centre