CMS 3D CMS Logo

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 
17 
18 //#define EDM_ML_DEBUG
19 
21 #ifdef EDM_ML_DEBUG
22  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: Creating an instance";
23 #endif
24 }
25 
27 
29  const DDVectorArguments & vArgs,
30  const DDMapArguments & ,
31  const DDStringArguments & sArgs,
32  const DDStringVectorArguments & vsArgs) {
33 
34  cellMat = sArgs["CellMaterial"];
35  cellDx = nArgs["CellDx"];
36  cellDy = nArgs["CellDy"];
37  cellDz = nArgs["CellDz"];
38  startY = nArgs["StartY"];
39 
40  childName = vsArgs["Child"];
41  number = dbl_to_int(vArgs["Number"]);
42  size = dbl_to_int(vArgs["Size"]);
43  type = dbl_to_int(vArgs["Type"]);
44 
45 #ifdef EDM_ML_DEBUG
46  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: Cell material "
47  << cellMat << "\tCell Size " << cellDx << ", "
48  << cellDy << ", " << cellDz << "\tStarting Y "
49  << startY << "\tChildren " << childName[0]
50  << ", " << childName[1] << "\n "
51  << " Cell positioning done for "
52  << number.size() << " times";
53  for (unsigned int i = 0; i < number.size(); i++)
54  edm::LogVerbatim("HCalGeom") << "\t" << i << " Number of children "
55  << size[i] << " occurence " << number[i]
56  << " first child index " << type[i];
57 #endif
59 #ifdef EDM_ML_DEBUG
60  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo debug: Parent "
61  << parent().name() << " NameSpace "
62  << idNameSpace;
63 #endif
64 }
65 
67 
68 #ifdef EDM_ML_DEBUG
69  edm::LogVerbatim("HCalGeom") << "==>> Constructing DDHCalForwardAlgo...";
70 #endif
71  DDName parentName = parent().name();
72  double ypos = startY;
73  int box = 0;
74 
75  for (unsigned int i=0; i<number.size(); i++) {
76  double dx = cellDx*size[i];
77  int indx = type[i];
78  for (int j=0; j<number[i]; j++) {
79  box++;
80  std::string name = parentName.name() + std::to_string(box);
82  dx, cellDy, cellDz);
83 #ifdef EDM_ML_DEBUG
84  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: "
85  << DDName(name, idNameSpace)
86  << " Box made of " << cellMat << " of Size "
87  << dx << ", " << cellDy << ", " << cellDz;
88 #endif
90  DDMaterial matter(matname);
91  DDLogicalPart genlogic(solid.ddname(), matter, solid);
92 
93  DDTranslation r0(0.0, ypos, 0.0);
95  cpv.position(solid.ddname(), parentName, box, r0, rot);
96 #ifdef EDM_ML_DEBUG
97  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: " << solid.ddname()
98  << " number " << box << " positioned in "
99  << parentName << " at " << r0 << " with "
100  << rot;
101 #endif
102  DDName child(DDSplit(childName[indx]).first,
103  DDSplit(childName[indx]).second);
104  double xpos = -dx + cellDx;
105  ypos += 2*cellDy;
106  indx = 1 - indx;
107 
108  for (int k=0; k<size[i]; k++) {
109  DDTranslation r1(xpos, 0.0, 0.0);
110  cpv.position(child, solid.ddname(), k+1, r1, rot);
111 #ifdef EDM_ML_DEBUG
112  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: " << child
113  << " number " << k+1 << " positioned in "
114  << solid.ddname() << " at " << r1
115  << " with " << rot;
116 #endif
117  xpos += 2*cellDx;
118  }
119  }
120  }
121 #ifdef EDM_ML_DEBUG
122  edm::LogVerbatim("HCalGeom") << "<<== End of DDHCalForwardAlgo construction";
123 #endif
124 }
size
Write out results.
type
Definition: HCALResponse.h:21
std::string idNameSpace
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
~DDHCalForwardAlgo() override
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
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.h:7
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
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:704
int k[5][pyjets_maxn]
std::vector< int > size
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::vector< std::string > childName
void execute(DDCompactView &cpv) override
std::vector< int > number
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
const N & ddname() const
Definition: DDBase.h:76