CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDHCalForwardAlgo.cc
Go to the documentation of this file.
1 // File: DDHCalForwardAlgo.cc
3 // Description: Cable mockup between barrel and endcap gap
5 
6 #include <cmath>
7 #include <algorithm>
8 
9 namespace std{} using namespace std;
18 
20  LogDebug("HCalGeom") << "DDHCalForwardAlgo info: Creating an instance";
21 }
22 
24 
25 
27  const DDVectorArguments & vArgs,
28  const DDMapArguments & ,
29  const DDStringArguments & sArgs,
30  const DDStringVectorArguments & vsArgs) {
31 
32  cellMat = sArgs["CellMaterial"];
33  cellDx = nArgs["CellDx"];
34  cellDy = nArgs["CellDy"];
35  cellDz = nArgs["CellDz"];
36  startY = nArgs["StartY"];
37 
38  childName = vsArgs["Child"];
39  number = dbl_to_int(vArgs["Number"]);
40  size = dbl_to_int(vArgs["Size"]);
41  type = dbl_to_int(vArgs["Type"]);
42 
43  LogDebug("HCalGeom") << "DDHCalForwardAlgo debug: Cell material " << cellMat
44  << "\tCell Size " << cellDx << ", " << cellDy << ", "
45  << cellDz << "\tStarting Y " << startY << "\tChildren "
46  << childName[0] << ", " << childName[1] << "\n"
47  << " Cell positioning done for "
48  << number.size() << " times";
49  for (unsigned int i = 0; i < number.size(); i++)
50  LogDebug("HCalGeom") << "\t" << i << " Number of children " << size[i]
51  << " occurence " << number[i] << " first child index "
52  << type[i];
53 
55  DDName parentName = parent().name();
56  LogDebug("HCalGeom") << "DDHCalForwardAlgo debug: Parent " << parentName
57  << " NameSpace " << idNameSpace;
58 }
59 
61 
62  LogDebug("HCalGeom") << "==>> Constructing DDHCalForwardAlgo...";
63 
64  DDName parentName = parent().name();
65  double ypos = startY;
66  int box = 0;
67 
68  for (unsigned int i=0; i<number.size(); i++) {
69  double dx = cellDx*size[i];
70  int indx = type[i];
71  for (int j=0; j<number[i]; j++) {
72  box++;
73  string name = parentName.name() + dbl_to_string(box);
75  dx, cellDy, cellDz);
76  LogDebug("HCalGeom") << "DDHCalForwardAlgo test: "
77  << DDName(name, idNameSpace) << " Box made of "
78  << cellMat << " of Size " << dx << ", " << cellDy
79  << ", " << cellDz;
80 
82  DDMaterial matter(matname);
83  DDLogicalPart genlogic(solid.ddname(), matter, solid);
84 
85  DDTranslation r0(0.0, ypos, 0.0);
87  cpv.position(solid.ddname(), parentName, box, r0, rot);
88  LogDebug("HCalGeom") << "DDHCalForwardAlgo test: " << solid.ddname()
89  << " number " << box << " positioned in "
90  << parentName << " at " << r0 << " with " << rot;
91 
92  DDName child(DDSplit(childName[indx]).first,
93  DDSplit(childName[indx]).second);
94  double xpos = -dx + cellDx;
95  ypos += 2*cellDy;
96  indx = 1 - indx;
97 
98  for (int k=0; k<size[i]; k++) {
99  DDTranslation r1(xpos, 0.0, 0.0);
100  cpv.position(child, solid.ddname(), k+1, r1, rot);
101  LogDebug("HCalGeom") << "DDHCalForwardAlgo test: " << child
102  << " number " << k+1 << " positioned in "
103  << solid.ddname() << " at " << r1 << " with "
104  << rot;
105  xpos += 2*cellDx;
106  }
107  }
108  }
109  LogDebug("HCalGeom") << "<<== End of DDHCalForwardAlgo construction ...";
110 }
#define LogDebug(id)
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
std::string idNameSpace
list parent
Definition: dbtoconf.py:74
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
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()
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Definition: DDutils.cc:12
type of data representation of DDCompactView
Definition: DDCompactView.h:76
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
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< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.cc:4
void execute(DDCompactView &cpv)
virtual ~DDHCalForwardAlgo()
int j
Definition: DBlmapReader.cc:9
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:519
std::vector< int > size
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 > childName
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
std::vector< int > number
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
tuple size
Write out results.
const N & ddname() const
Definition: DDBase.h:80