CMS 3D CMS Logo

DDHCalEndcapAlgo.cc
Go to the documentation of this file.
1 // File: DDHCalEndcapAlgo.cc
3 // adapted from CCal(G4)HcalEndcap.cc
4 // Description: Geometry factory class for Hcal Endcap
6 
7 #include <cmath>
8 #include <algorithm>
9 #include <string>
10 #include <vector>
11 
14 #include "DD4hep/DetFactoryHelper.h"
18 
19 //#define EDM_ML_DEBUG
20 using namespace geant_units::operators;
21 
23  std::string genMaterial; //General material
24  int nsectors; //Number of potenital straight edges
25  int nsectortot; //Number of straight edges (actual)
26  int nEndcap; //Number of endcaps
27  std::vector<int> eModule; //Modules to be present in part i (?)
28  std::string rotHalf; //Rotation matrix for half
29  std::string rotation; //Rotation matrix to place in mother
30  double zShift; //needed for TB setup (move HE)
31  double zFront; //Z of the front section
32  double zEnd; //Outer Z of the HE
33  double ziNose; //Starting Z of the nose
34  double ziL0Nose; //Starting Z of layer 0 at nose
35  double ziBody; //Starting Z of the body
36  double ziL0Body; //Starting Z of layer 0 at body
37  double ziKink; //Position of the kink point
38  double z0Beam; //Position of gap front along z-axis
39  double z1Beam; //Position of gap end along z-axis
40  double ziDip; //Starting Z of dipped part of body
41  double dzStep; //Width in Z of a layer
42  double dzShift; //Shift in Z for HE
43  double zShiftHac2; //needed for TB (remove part Hac2)
44  double rout; //Outer R of the HE
45  double riKink; //Inner radius at kink point
46  double riDip; //Inner radius at the dip point
47  double roDip; //Outer radius at the dip point
48  double heboxDepth; //Depth of the HE box
49  double drEnd; //Shift in R for the end absorber
50  double angTop; //Angle of top end of HE
51  double angBot; //Angle of the bottom end of HE
52  double angGap; //Gap angle (in degrees)
53  double slope; //Slope of the gap on HE side
54  std::string absMat; //Absorber material
55  int modules; //Number of modules
56  std::vector<std::string> modName; //Name
57  std::vector<std::string> modMat; //Material
58  std::vector<int> modType; //Type (0/1 for front/standard)
59  std::vector<int> sectionModule; //Number of sections in a module
60  std::vector<int> layerN; //Number of layers
61  std::vector<int> layerN0; //Layer numbers in section 0
62  std::vector<int> layerN1; //Layer numbers in section 1
63  std::vector<int> layerN2; //Layer numbers in section 2
64  std::vector<int> layerN3; //Layer numbers in section 3
65  std::vector<int> layerN4; //Layer numbers in section 4
66  std::vector<int> layerN5; //Layer numbers in section 5
67  std::vector<double> thick; //Thickness of absorber/air
68  std::vector<double> trimLeft; //Trimming of left layers in module
69  std::vector<double> trimRight; //Trimming of right layers in module
70  std::vector<double> zminBlock; //Minimum Z
71  std::vector<double> zmaxBlock; //Maximum Z
72  std::vector<double> rinBlock1; //Inner Radius
73  std::vector<double> routBlock1; //Outer Radius at zmin
74  std::vector<double> rinBlock2; //Inner Radius
75  std::vector<double> routBlock2; //Outer Radius at zmax
76  int phiSections; //Number of phi sections
77  std::vector<std::string> phiName; //Name of Phi sections
78  int layers; //Number of layers
79  std::vector<std::string> layerName; //Layer Names
80  std::vector<int> layerType; //Detector type in each layer
81  std::vector<double> layerT; //Layer thickness (plastic + scint.)
82  std::vector<double> scintT; //Scintillator thickness
83  std::string plastMat; //Plastic material
84  std::string scintMat; //Scintillator material
85  std::string rotmat; //Rotation matrix for positioning
86  std::string idName; //Name of the "parent" volume.
87  int idOffset; // Geant4 ID's... = 4000;
88  double tolPos, tolAbs; //Tolerances
89 
90  HCalEndcapAlgo() = delete;
91 
93  cms::DDNamespace ns(ctxt, e, true);
95 
96  genMaterial = args.value<std::string>("MaterialName");
97  rotation = args.value<std::string>("Rotation");
98  nsectors = args.value<int>("Sector");
99  nsectortot = args.value<int>("SectorTot");
100  nEndcap = args.value<int>("Endcap");
101  rotHalf = args.value<std::string>("RotHalf");
102  zShift = args.value<double>("ZShift");
103  zFront = args.value<double>("ZFront");
104  zEnd = args.value<double>("ZEnd");
105  ziNose = args.value<double>("ZiNose");
106  ziL0Nose = args.value<double>("ZiL0Nose");
107  ziBody = args.value<double>("ZiBody");
108  ziL0Body = args.value<double>("ZiL0Body");
109  z0Beam = args.value<double>("Z0Beam");
110  ziDip = args.value<double>("ZiDip");
111  dzStep = args.value<double>("DzStep");
112  zShiftHac2 = args.value<double>("ZShiftHac2");
113  double gap = args.value<double>("Gap");
114  double z1 = args.value<double>("Z1");
115  double r1 = args.value<double>("R1");
116  rout = args.value<double>("Rout");
117  heboxDepth = args.value<double>("HEboxDepth");
118  drEnd = args.value<double>("DrEnd");
119  double etamin = args.value<double>("Etamin");
120  angBot = args.value<double>("AngBot");
121  angGap = args.value<double>("AngGap");
122 #ifdef EDM_ML_DEBUG
123  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: General material " << genMaterial << "\tSectors " << nsectors
124  << ", " << nsectortot << "\tEndcaps " << nEndcap << "\tRotation matrix for half "
125  << rotHalf << "\n\tzFront " << convertCmToMm(zFront) << " zEnd " << convertCmToMm(zEnd)
126  << " ziNose " << convertCmToMm(ziNose) << " ziL0Nose " << convertCmToMm(ziL0Nose)
127  << " ziBody " << convertCmToMm(ziBody) << " ziL0Body " << convertCmToMm(ziL0Body)
128  << " z0Beam " << convertCmToMm(z0Beam) << " ziDip " << convertCmToMm(ziDip)
129  << " dzStep " << convertCmToMm(dzStep) << " Gap " << convertCmToMm(gap) << " z1 "
130  << convertCmToMm(z1) << "\n\tr1 " << convertCmToMm(r1) << " rout "
131  << convertCmToMm(rout) << " HeboxDepth " << convertCmToMm(heboxDepth) << " drEnd "
132  << convertCmToMm(drEnd) << "\tetamin " << etamin << " Bottom angle " << angBot
133  << " Gap angle " << angGap << " Z-Shift " << convertCmToMm(zShift) << " "
134  << convertCmToMm(zShiftHac2);
135 #endif
136 
137  //Derived quantities
138  angTop = 2.0 * atan(exp(-etamin));
139  slope = tan(angGap);
140  z1Beam = z1 - r1 / slope;
141  ziKink = z1Beam + rout / slope;
142  riKink = ziKink * tan(angBot);
143  riDip = ziDip * tan(angBot);
144  roDip = rout - heboxDepth;
145  dzShift = (z1Beam - z0Beam) - gap / sin(angGap);
146 #ifdef EDM_ML_DEBUG
147  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: angTop " << convertRadToDeg(angTop) << "\tSlope " << slope
148  << "\tDzShift " << convertCmToMm(dzShift) << "\n\tz1Beam " << convertCmToMm(z1Beam)
149  << "\tziKink" << convertCmToMm(ziKink) << "\triKink " << convertCmToMm(riKink)
150  << "\triDip " << convertCmToMm(riDip) << "\n\troDip " << convertCmToMm(roDip)
151  << "\tRotation " << rotation;
152 #endif
153 
155  //Modules
156  absMat = args.value<std::string>("AbsMat");
157  modules = args.value<int>("Modules");
158 #ifdef EDM_ML_DEBUG
159  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Number of modules " << modules << " and absorber material "
160  << absMat;
161 #endif
162 
163  modName = args.value<std::vector<std::string> >("ModuleName");
164  modMat = args.value<std::vector<std::string> >("ModuleMat");
165  modType = args.value<std::vector<int> >("ModuleType");
166  sectionModule = args.value<std::vector<int> >("SectionModule");
167  thick = args.value<std::vector<double> >("ModuleThick");
168  trimLeft = args.value<std::vector<double> >("TrimLeft");
169  trimRight = args.value<std::vector<double> >("TrimRight");
170  eModule = args.value<std::vector<int> >("EquipModule");
171  layerN = args.value<std::vector<int> >("LayerN");
172  layerN0 = args.value<std::vector<int> >("LayerN0");
173  layerN1 = args.value<std::vector<int> >("LayerN1");
174  layerN2 = args.value<std::vector<int> >("LayerN2");
175  layerN3 = args.value<std::vector<int> >("LayerN3");
176  layerN4 = args.value<std::vector<int> >("LayerN4");
177  layerN5 = args.value<std::vector<int> >("LayerN5");
178 #ifdef EDM_ML_DEBUG
179  for (int i = 0; i < modules; i++) {
180  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << modName[i] << " type " << modType[i] << " Sections "
181  << sectionModule[i] << " thickness of absorber/air " << convertCmToMm(thick[i])
182  << " trim " << convertCmToMm(trimLeft[i]) << ", " << convertCmToMm(trimRight[i])
183  << " equip module " << eModule[i] << " with " << layerN[i] << " layers";
184  if (i == 0) {
185  for (int j = 0; j < layerN[i]; j++) {
186  edm::LogVerbatim("HCalGeom") << "\t " << layerN0[j] << "/" << layerN0[j + 1];
187  }
188  } else if (i == 1) {
189  for (int j = 0; j < layerN[i]; j++) {
190  edm::LogVerbatim("HCalGeom") << "\t " << layerN1[j] << "/" << layerN1[j + 1];
191  }
192  } else if (i == 2) {
193  for (int j = 0; j < layerN[i]; j++) {
194  edm::LogVerbatim("HCalGeom") << "\t " << layerN2[j];
195  }
196  } else if (i == 3) {
197  for (int j = 0; j < layerN[i]; j++) {
198  edm::LogVerbatim("HCalGeom") << "\t " << layerN3[j];
199  }
200  } else if (i == 4) {
201  for (int j = 0; j < layerN[i]; j++) {
202  edm::LogVerbatim("HCalGeom") << "\t " << layerN4[j];
203  }
204  } else if (i == 5) {
205  for (int j = 0; j < layerN[i]; j++) {
206  edm::LogVerbatim("HCalGeom") << "\t " << layerN5[j];
207  }
208  }
209  }
210 #endif
211 
213  //Layers
214  phiSections = args.value<int>("PhiSections");
215  phiName = args.value<std::vector<std::string> >("PhiName");
216  layers = args.value<int>("Layers");
217  layerName = args.value<std::vector<std::string> >("LayerName");
218  layerType = args.value<std::vector<int> >("LayerType");
219  layerT = args.value<std::vector<double> >("LayerT");
220  scintT = args.value<std::vector<double> >("ScintT");
221  scintMat = args.value<std::string>("ScintMat");
222  plastMat = args.value<std::string>("PlastMat");
223  rotmat = args.value<std::string>("RotMat");
224 #ifdef EDM_ML_DEBUG
225  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Phi Sections " << phiSections;
226  for (int i = 0; i < phiSections; i++)
227  edm::LogVerbatim("HCalGeom") << "\tName[" << i << "] : " << phiName[i];
228  edm::LogVerbatim("HCalGeom") << "\tPlastic: " << plastMat << "\tScintillator: " << scintMat << "\tRotation matrix "
229  << rotmat << "\n\tNumber of layers " << layers;
230  for (int i = 0; i < layers; i++) {
231  edm::LogVerbatim("HCalGeom") << "\t" << layerName[i] << "\tType " << layerType[i] << "\tThickness "
232  << convertCmToMm(layerT[i]) << "\tScint.Thick " << convertCmToMm(scintT[i]);
233  }
234 #endif
235 
237  // Derive bounding of the modules
238  int module = 0;
239  // Layer 0 (Nose)
240  if (modules > 0) {
241  zminBlock.emplace_back(ziL0Nose);
242  zmaxBlock.emplace_back(zminBlock[module] + layerT[0] + 0.5 * dzStep);
243  rinBlock1.emplace_back(zminBlock[module] * tan(angTop));
244  rinBlock2.emplace_back(zmaxBlock[module] * tan(angTop));
245  routBlock1.emplace_back((zminBlock[module] - z1Beam) * slope);
246  routBlock2.emplace_back((zmaxBlock[module] - z1Beam) * slope);
247  module++;
248  }
249  // Layer 0 (Body)
250  if (modules > 1) {
251  zminBlock.emplace_back(ziL0Body);
252  zmaxBlock.emplace_back(zminBlock[module] + layerT[0] + 0.5 * dzStep);
253  rinBlock1.emplace_back(zminBlock[module] * tan(angBot));
254  rinBlock2.emplace_back(zmaxBlock[module] * tan(angBot));
255  routBlock1.emplace_back(zminBlock[module] * tan(angTop));
256  routBlock2.emplace_back(zmaxBlock[module] * tan(angTop));
257  module++;
258  }
259  // Hac1
260  if (modules > 2) {
261  zminBlock.emplace_back(ziNose);
262  zmaxBlock.emplace_back(ziBody);
263  rinBlock1.emplace_back(zminBlock[module] * tan(angTop));
264  rinBlock2.emplace_back(zmaxBlock[module] * tan(angTop));
265  routBlock1.emplace_back((zminBlock[module] - z1Beam) * slope);
266  routBlock2.emplace_back((zmaxBlock[module] - z1Beam) * slope);
267  module++;
268  }
269  // Hac2
270  if (modules > 3) {
271  zminBlock.emplace_back(ziBody);
272  zmaxBlock.emplace_back(zminBlock[module] + layerN[3] * dzStep);
273  rinBlock1.emplace_back(zminBlock[module] * tan(angBot));
274  rinBlock2.emplace_back(zmaxBlock[module] * tan(angBot));
275  routBlock1.emplace_back((zmaxBlock[module - 1] - z1Beam) * slope);
276  routBlock2.emplace_back(rout);
277  module++;
278  }
279  // Hac3
280  if (modules > 4) {
281  zminBlock.emplace_back(zmaxBlock[module - 1]);
282  zmaxBlock.emplace_back(zminBlock[module] + layerN[4] * dzStep);
283  rinBlock1.emplace_back(zminBlock[module] * tan(angBot));
284  rinBlock2.emplace_back(zmaxBlock[module] * tan(angBot));
285  routBlock1.emplace_back(rout);
286  routBlock2.emplace_back(rout);
287  module++;
288  }
289  // Hac4
290  if (modules > 5) {
291  zminBlock.emplace_back(zmaxBlock[module - 1]);
292  zmaxBlock.emplace_back(zminBlock[module] + layerN[5] * dzStep);
293  rinBlock1.emplace_back(zminBlock[module] * tan(angBot));
294  rinBlock2.emplace_back(zmaxBlock[module] * tan(angBot));
295  routBlock1.emplace_back(rout);
296  routBlock2.emplace_back(roDip);
297  module++;
298  }
299 #ifdef EDM_ML_DEBUG
300  for (int i = 0; i < module; i++)
301  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Module " << i << "\tZ/Rin/Rout " << convertCmToMm(zminBlock[i])
302  << ", " << convertCmToMm(zmaxBlock[i]) << "/ " << convertCmToMm(rinBlock1[i]) << ", "
303  << convertCmToMm(rinBlock2[i]) << "/ " << convertCmToMm(routBlock1[i]) << ", "
304  << convertCmToMm(routBlock2[i]);
305 #endif
306 
307  idName = args.value<std::string>("MotherName");
308  idOffset = args.value<int>("IdOffset");
309 #ifdef EDM_ML_DEBUG
310  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Parent " << args.parentName() << " idName " << idName
311  << " NameSpace " << ns.name() << " Offset " << idOffset;
312 #endif
313 
314  tolPos = args.value<double>("TolPos");
315  tolAbs = args.value<double>("TolAbs");
316 #ifdef EDM_ML_DEBUG
317  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Tolerances - Positioning " << convertCmToMm(tolPos)
318  << " Absorber " << convertCmToMm(tolAbs);
319  edm::LogVerbatim("HCalGeom") << "==>> Constructing DDHCalEndcapAlgo...";
320 #endif
321 
322  dd4hep::Volume parent = ns.volume(args.parentName());
323  constructGeneralVolume(ns, parent);
324 #ifdef EDM_ML_DEBUG
325  edm::LogVerbatim("HCalGeom") << "<<== End of DDHCalEndcapAlgo construction ...";
326 #endif
327  }
328 
330 #ifdef EDM_ML_DEBUG
331  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: General volume...";
332 #endif
333 
334  bool proto = true;
335  for (int i = 0; i < 3; i++)
336  if (eModule[i] > 0)
337  proto = false;
338 
339  dd4hep::Rotation3D rot = getRotation(rotation, ns);
340 #ifdef EDM_ML_DEBUG
341  edm::LogVerbatim("HCalGeom") << " Rotation matrix " << rotation << " Rotation " << rot;
342 #endif
343 
344  dd4hep::Position r0(0, 0, zShift);
345  double alpha = (1._pi) / nsectors;
346  double dphi = nsectortot * (2._pi) / nsectors;
347 
349  //vertical walls are allowed in SolidPolyhedra
350  double delz = 0;
351 
352  std::vector<double> pgonZ, pgonRmin, pgonRmax;
353  if (proto) {
354  double zf = ziBody + zShiftHac2;
355  pgonZ.emplace_back(zf - dzShift);
356  pgonRmin.emplace_back(zf * tan(angBot));
357  pgonRmax.emplace_back((zf - z1Beam) * slope);
358  } else {
359  pgonZ.emplace_back(zFront - dzShift);
360  pgonRmin.emplace_back(zFront * tan(angTop));
361  pgonRmax.emplace_back((zFront - z1Beam) * slope);
362  pgonZ.emplace_back(ziL0Body - dzShift);
363  pgonRmin.emplace_back(ziL0Body * tan(angTop));
364  pgonRmax.emplace_back((ziL0Body - z1Beam) * slope);
365  pgonZ.emplace_back(ziL0Body - dzShift);
366  pgonRmin.emplace_back(ziL0Body * tan(angBot));
367  pgonRmax.emplace_back((ziL0Body - z1Beam) * slope);
368  }
369  pgonZ.emplace_back(ziKink - dzShift);
370  pgonRmin.emplace_back(riKink);
371  pgonRmax.emplace_back(rout);
372  pgonZ.emplace_back(ziDip - dzShift);
373  pgonRmin.emplace_back(riDip);
374  pgonRmax.emplace_back(rout);
375  pgonZ.emplace_back(ziDip - dzShift + delz);
376  pgonRmin.emplace_back(riDip);
377  pgonRmax.emplace_back(roDip);
378  pgonZ.emplace_back(zEnd - dzShift);
379  pgonRmin.emplace_back(zEnd * tan(angBot));
380  pgonRmax.emplace_back(roDip);
381  pgonZ.emplace_back(zEnd);
382  pgonRmin.emplace_back(zEnd * tan(angBot));
383  pgonRmax.emplace_back(roDip);
384 
385  std::string name("Null");
386  dd4hep::Solid solid = dd4hep::Polyhedra(ns.prepend(idName), nsectortot, -alpha, dphi, pgonZ, pgonRmin, pgonRmax);
387 #ifdef EDM_ML_DEBUG
388  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
389  << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
390  << convertRadToDeg(-alpha + dphi) << " and with " << pgonZ.size() << " sections";
391  for (unsigned int i = 0; i < pgonZ.size(); i++)
392  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZ[i]) << "\tRmin = " << convertCmToMm(pgonRmin[i])
393  << "\tRmax = " << convertCmToMm(pgonRmax[i]);
394 #endif
395  dd4hep::Material matter = ns.material(genMaterial);
396  dd4hep::Volume genlogic(solid.name(), solid, matter);
397 
398  parent.placeVolume(genlogic, 1, dd4hep::Transform3D(rot, r0));
399 #ifdef EDM_ML_DEBUG
400  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << genlogic.name() << " number 1 positioned in "
401  << parent.name() << " at (0, 0, " << convertCmToMm(zShift)
402  << ") with rotation: " << rot;
403 #endif
404 
405  if (nEndcap != 1) {
406  rot = getRotation(rotHalf, ns);
407  parent.placeVolume(genlogic, 2, dd4hep::Transform3D(rot, r0));
408 #ifdef EDM_ML_DEBUG
409  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << genlogic.name() << " number 2 "
410  << "positioned in " << parent.name() << " at (0, 0, " << convertCmToMm(zShift)
411  << ") with rotation: " << rot;
412 #endif
413  }
414 
415  //Forward half
416  name = idName + "Front";
417  std::vector<double> pgonZMod, pgonRminMod, pgonRmaxMod;
418  for (unsigned int i = 0; i < (pgonZ.size() - 1); i++) {
419  pgonZMod.emplace_back(pgonZ[i] + dzShift);
420  pgonRminMod.emplace_back(pgonRmin[i]);
421  pgonRmaxMod.emplace_back(pgonRmax[i]);
422  }
423  solid = dd4hep::Polyhedra(ns.prepend(name), nsectortot, -alpha, dphi, pgonZMod, pgonRminMod, pgonRmaxMod);
424 #ifdef EDM_ML_DEBUG
425  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
426  << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
427  << convertRadToDeg(-alpha + dphi) << " and with " << pgonZMod.size() << " sections ";
428  for (unsigned int i = 0; i < pgonZMod.size(); i++)
429  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZMod[i])
430  << "\tRmin = " << convertCmToMm(pgonRminMod[i])
431  << "\tRmax = " << convertCmToMm(pgonRmaxMod[i]);
432 #endif
433 
434  dd4hep::Volume genlogich(solid.name(), solid, matter);
435  ns.addVolumeNS(genlogich);
436  genlogic.placeVolume(genlogich, 1, dd4hep::Position(0, 0, -dzShift));
437 #ifdef EDM_ML_DEBUG
438  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << genlogich.name() << " number 1 positioned in "
439  << genlogic.name() << " at (0,0," << -convertCmToMm(dzShift) << ") with no rotation";
440 #endif
441 
442  //Construct sector (from -alpha to +alpha)
443  name = idName + "Module";
444  solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha, 2 * alpha, pgonZMod, pgonRminMod, pgonRmaxMod);
445 #ifdef EDM_ML_DEBUG
446  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
447  << " with 1 sector from " << convertRadToDeg(-alpha) << " to "
448  << convertRadToDeg(alpha) << " and with " << pgonZMod.size() << " sections";
449  for (unsigned int i = 0; i < pgonZMod.size(); i++)
450  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZMod[i])
451  << "\tRmin = " << convertCmToMm(pgonRminMod[i])
452  << "\tRmax = " << convertCmToMm(pgonRmaxMod[i]);
453 #endif
454 
455  dd4hep::Volume seclogic(solid.name(), solid, matter);
456  for (int ii = 0; ii < nsectortot; ii++) {
457  double phi = ii * 2 * alpha;
458  dd4hep::Rotation3D rot0;
459  if (phi != 0) {
460  rot0 = dd4hep::RotationZ(phi);
461 #ifdef EDM_ML_DEBUG
462  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Creating a new rotation \t 90," << convertRadToDeg(phi)
463  << ", 90," << convertRadToDeg(phi + 90._deg) << ", 0, 0";
464 #endif
465  }
466  genlogich.placeVolume(seclogic, ii + 1, rot0);
467 #ifdef EDM_ML_DEBUG
468  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << seclogic.name() << " number " << ii + 1
469  << " positioned in " << genlogich.name() << " at (0, 0, 0) with rotation: " << rot0;
470 #endif
471  }
472 
473  //Construct the things inside the sector
474  constructInsideSector(ns, seclogic);
475 
476  //Backward half
477  name = idName + "Back";
478  std::vector<double> pgonZBack, pgonRminBack, pgonRmaxBack;
479  pgonZBack.emplace_back(zEnd - dzShift);
480  pgonRminBack.emplace_back(pgonZBack[0] * tan(angBot) + drEnd);
481  pgonRmaxBack.emplace_back(roDip);
482  pgonZBack.emplace_back(zEnd);
483  pgonRminBack.emplace_back(pgonZBack[1] * tan(angBot) + drEnd);
484  pgonRmaxBack.emplace_back(roDip);
485  solid = dd4hep::Polyhedra(ns.prepend(name), nsectortot, -alpha, dphi, pgonZBack, pgonRminBack, pgonRmaxBack);
486 #ifdef EDM_ML_DEBUG
487  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << absMat << " with "
488  << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
489  << convertRadToDeg(-alpha + dphi) << " and with " << pgonZBack.size() << " sections";
490  for (unsigned int i = 0; i < pgonZBack.size(); i++)
491  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZBack[i])
492  << "\tRmin = " << convertCmToMm(pgonRminBack[i])
493  << "\tRmax = " << convertCmToMm(pgonRmaxBack[i]);
494 #endif
495 
496  dd4hep::Material absMatter = ns.material(absMat);
497  dd4hep::Volume glog(solid.name(), solid, absMatter);
498  genlogic.placeVolume(glog, 1);
499 #ifdef EDM_ML_DEBUG
500  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number 1 positioned in " << genlogic.name()
501  << " at (0,0,0) with no rotation";
502 #endif
503  }
504 
506 #ifdef EDM_ML_DEBUG
507  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Modules (" << modules << ") ...";
508 #endif
509 
510  double alpha = (1._pi) / nsectors;
511  for (int i = 0; i < modules; i++) {
512  std::string name = idName + modName[i];
513  dd4hep::Material matter = ns.material(modMat[i]);
514 
515  if (eModule[i] > 0) {
516  int nsec = sectionModule[i];
517 
519  //vertical walls are allowed in SolidPolyhedra
520  double deltaz = 0;
521 
522  std::vector<double> pgonZ, pgonRmin, pgonRmax;
523  if (nsec == 3) {
524  double zf = zminBlock[i] + zShiftHac2;
525  pgonZ.emplace_back(zf);
526  pgonRmin.emplace_back(zf * tan(angBot));
527  pgonRmax.emplace_back((zf - z1Beam) * slope);
528  pgonZ.emplace_back(ziKink);
529  pgonRmin.emplace_back(riKink);
530  pgonRmax.emplace_back(rout);
531  } else {
532  pgonZ.emplace_back(zminBlock[i]);
533  pgonRmin.emplace_back(rinBlock1[i]);
534  pgonRmax.emplace_back(routBlock1[i]);
535  }
536  if (nsec == 4) {
537  pgonZ.emplace_back(ziDip);
538  pgonRmin.emplace_back(riDip);
539  pgonRmax.emplace_back(rout);
540  pgonZ.emplace_back(pgonZ[1] + deltaz);
541  pgonRmin.emplace_back(pgonRmin[1]);
542  pgonRmax.emplace_back(roDip);
543  }
544  pgonZ.emplace_back(zmaxBlock[i]);
545  pgonRmin.emplace_back(rinBlock2[i]);
546  pgonRmax.emplace_back(routBlock2[i]);
547 
548  //Solid & volume
549  dd4hep::Solid solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha, 2 * alpha, pgonZ, pgonRmin, pgonRmax);
550 #ifdef EDM_ML_DEBUG
551  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << modMat[i]
552  << " with 1 sector from " << convertRadToDeg(-alpha) << " to "
553  << convertRadToDeg(alpha) << " and with " << nsec << " sections";
554  for (unsigned int k = 0; k < pgonZ.size(); k++)
555  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZ[k])
556  << "\tRmin = " << convertCmToMm(pgonRmin[k])
557  << "\tRmax = " << convertCmToMm(pgonRmax[k]);
558 #endif
559 
560  dd4hep::Volume glog(solid.name(), solid, matter);
561 
562  sector.placeVolume(glog, i + 1);
563 #ifdef EDM_ML_DEBUG
564  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << i + 1 << " positioned in "
565  << sector.name() << " at (0,0,0) with no rotation";
566 #endif
567 
568  if (modType[i] == 0)
569  constructInsideModule0(ns, glog, i);
570  else
571  constructInsideModule(ns, glog, i);
572  }
573  }
574  }
575 
577 #ifdef EDM_ML_DEBUG
578  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: \t\tInside module0 ..." << mod;
579 #endif
580 
582  //Pointers to the Rotation Matrices and to the Materials
583  dd4hep::Rotation3D rot = getRotation(rotmat, ns);
584  dd4hep::Material matabsorbr = ns.material(absMat);
585  dd4hep::Material matplastic = ns.material(plastMat);
586 
587  int layer = getLayer(mod, 0);
588  int layer0 = getLayer(mod, 1);
590  double xpos, ypos, zpos;
591  dd4hep::Solid solid;
592  dd4hep::Volume glog;
593  for (int iphi = 0; iphi < phiSections; iphi++) {
594  double yh, bl, tl, alp;
595  parameterLayer0(mod, layer, iphi, yh, bl, tl, alp, xpos, ypos, zpos);
596  name = DDSplit(module.name()).first + layerName[layer] + phiName[iphi];
597  solid = dd4hep::Trap(ns.prepend(name), 0.5 * layerT[layer], 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
598 #ifdef EDM_ML_DEBUG
599  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << plastMat
600  << " of dimensions " << convertCmToMm(0.5 * layerT[layer]) << ", 0, 0, "
601  << convertCmToMm(yh) << ", " << convertCmToMm(bl) << ", " << convertCmToMm(tl)
602  << ", " << convertRadToDeg(alp) << ", " << convertCmToMm(yh) << ", "
603  << convertCmToMm(bl) << ", " << convertCmToMm(tl) << ", " << convertRadToDeg(alp);
604 #endif
605 
606  glog = dd4hep::Volume(solid.name(), solid, matplastic);
607 
608  dd4hep::Position r1(xpos, ypos, zpos);
609  module.placeVolume(glog, idOffset + layer + 1, dd4hep::Transform3D(rot, r1));
610 
611 #ifdef EDM_ML_DEBUG
612  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << (idOffset + layer + 1)
613  << " positioned in " << module.name() << " at (" << convertCmToMm(xpos) << ", "
614  << convertCmToMm(ypos) << ", " << convertCmToMm(zpos) << " with rotation: " << rot;
615 #endif
616 
617  //Now construct the layer of scintillator inside this
618  int copyNo = layer0 * 10 + layerType[layer];
619  name = modName[mod] + layerName[layer] + phiName[iphi];
620  constructScintLayer(ns, glog, scintT[layer], yh, bl, tl, alp, name, copyNo);
621  }
622 
623  //Now the absorber layer
624  double zi = zminBlock[mod] + layerT[layer];
625  double zo = zi + 0.5 * dzStep;
626  double rinF, routF, rinB, routB;
627  if (mod == 0) {
628  rinF = zi * tan(angTop);
629  routF = (zi - z1Beam) * slope;
630  rinB = zo * tan(angTop);
631  routB = (zo - z1Beam) * slope;
632  } else {
633  rinF = zi * tan(angBot);
634  routF = zi * tan(angTop);
635  rinB = zo * tan(angBot);
636  routB = zo * tan(angTop);
637  }
638 
639 #ifdef EDM_ML_DEBUG
640  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Module " << mod << " Front " << convertCmToMm(zi) << ", "
641  << convertCmToMm(rinF) << ", " << convertCmToMm(routF) << " Back " << convertCmToMm(zo)
642  << ", " << convertCmToMm(rinB) << ", " << convertCmToMm(routB);
643 #endif
644 
645  double yh1, bl1, tl1, yh2, bl2, tl2, theta, phi, alp;
646  parameterLayer(
647  0, rinF, routF, rinB, routB, zi, zo, yh1, bl1, tl1, yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
648  double fact = tolAbs;
649 
650 #ifdef EDM_ML_DEBUG
651  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Trim " << convertCmToMm(fact) << " Param " << convertCmToMm(yh1)
652  << ", " << convertCmToMm(bl1) << ", " << convertCmToMm(tl1) << ", "
653  << convertCmToMm(yh2) << ", " << convertCmToMm(bl2) << ", " << convertCmToMm(tl2);
654 #endif
655 
656  bl1 -= fact;
657  tl1 -= fact;
658  bl2 -= fact;
659  tl2 -= fact;
660 
661  name = DDSplit(module.name()).first + "Absorber";
662  solid = dd4hep::Trap(ns.prepend(name), 0.5 * thick[mod], theta, phi, yh1, bl1, tl1, alp, yh2, bl2, tl2, alp);
663 #ifdef EDM_ML_DEBUG
664  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << absMat
665  << " of dimensions " << convertCmToMm(0.5 * thick[mod]) << ", "
666  << convertRadToDeg(theta) << ", " << convertRadToDeg(phi) << ", " << convertCmToMm(yh1)
667  << ", " << convertCmToMm(bl1) << ", " << convertCmToMm(tl1) << ", "
668  << convertRadToDeg(alp) << ", " << convertCmToMm(yh2) << ", " << convertCmToMm(bl2)
669  << ", " << convertCmToMm(tl2) << ", " << convertRadToDeg(alp);
670 #endif
671 
672  glog = dd4hep::Volume(solid.name(), solid, matabsorbr);
673 
674  dd4hep::Position r2(xpos, ypos, zpos);
675  module.placeVolume(glog, 1, dd4hep::Transform3D(rot, r2));
676 
677 #ifdef EDM_ML_DEBUG
678  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number 1 positioned in " << module.name()
679  << " at (" << convertCmToMm(xpos) << ", " << convertCmToMm(ypos) << ", "
680  << convertCmToMm(zpos) << ") with rotation: " << rot;
681 #endif
682  }
683 
685 #ifdef EDM_ML_DEBUG
686  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: \t\tInside module ..." << mod;
687 #endif
688 
690  //Pointers to the Rotation Matrices and to the Materials
691  dd4hep::Rotation3D rot = getRotation(rotmat, ns);
692  dd4hep::Material matter = ns.material(genMaterial);
693  dd4hep::Material matplastic = ns.material(plastMat);
694 
695  double alpha = (1._pi) / nsectors;
696  double zi = zminBlock[mod];
697 
698  for (int i = 0; i < layerN[mod]; i++) {
700  dd4hep::Solid solid;
701  dd4hep::Volume glog, plog;
702  int layer = getLayer(mod, i);
703  double zo = zi + 0.5 * dzStep;
704 
705  for (int iphi = 0; iphi < phiSections; iphi++) {
706  double ziAir = zo - thick[mod];
707  double rinF, rinB;
708  if (layer == 1) {
709  rinF = ziAir * tan(angTop);
710  rinB = zo * tan(angTop);
711  } else {
712  rinF = ziAir * tan(angBot);
713  rinB = zo * tan(angBot);
714  }
715  double routF = (ziAir - z1Beam) * slope;
716  double routB = (zo - z1Beam) * slope;
717  if (routF > routBlock2[mod])
718  routF = routBlock2[mod];
719  if (routB > routBlock2[mod])
720  routB = routBlock2[mod];
721 
722 #ifdef EDM_ML_DEBUG
723  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Layer " << i << " Phi " << iphi << " Front "
724  << convertCmToMm(ziAir) << ", " << convertCmToMm(rinF) << ", "
725  << convertCmToMm(routF) << " Back " << convertCmToMm(zo) << ", "
726  << convertCmToMm(rinB) << ", " << convertCmToMm(routB);
727 #endif
728 
729  double yh1, bl1, tl1, yh2, bl2, tl2, theta, phi, alp;
730  double xpos, ypos, zpos;
731  parameterLayer(
732  iphi, rinF, routF, rinB, routB, ziAir, zo, yh1, bl1, tl1, yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
733 
734  name = DDSplit(module.name()).first + layerName[layer] + phiName[iphi] + "Air";
735  solid = dd4hep::Trap(ns.prepend(name), 0.5 * thick[mod], theta, phi, yh1, bl1, tl1, alp, yh2, bl2, tl2, alp);
736 #ifdef EDM_ML_DEBUG
737  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << matter.name()
738  << " of dimensions " << convertCmToMm(0.5 * thick[mod]) << ", "
739  << convertRadToDeg(theta) << ", " << convertRadToDeg(phi) << ", "
740  << convertCmToMm(yh1) << ", " << convertCmToMm(bl1) << ", " << convertCmToMm(tl1)
741  << ", " << convertRadToDeg(alp) << ", " << convertCmToMm(yh2) << ", "
742  << convertCmToMm(bl2) << ", " << convertCmToMm(tl2) << ", "
743  << convertRadToDeg(alp);
744 #endif
745 
746  glog = dd4hep::Volume(solid.name(), solid, matter);
747  dd4hep::Position r1(xpos, ypos, zpos);
748  module.placeVolume(glog, layer + 1, dd4hep::Transform3D(rot, r1));
749 
750 #ifdef EDM_ML_DEBUG
751  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << (layer + 1)
752  << " positioned in " << module.name() << " at (" << convertCmToMm(xpos) << ", "
753  << convertCmToMm(ypos) << ", " << convertCmToMm(zpos)
754  << ") with rotation: " << rot;
755 #endif
756 
757  //Now the plastic with scintillators
758  double yh = 0.5 * (routF - rinB) - getTrim(mod, iphi);
759  double bl = 0.5 * rinB * tan(alpha) - getTrim(mod, iphi);
760  double tl = 0.5 * routF * tan(alpha) - getTrim(mod, iphi);
761  name = DDSplit(module.name()).first + layerName[layer] + phiName[iphi];
762  solid = dd4hep::Trap(ns.prepend(name), 0.5 * layerT[layer], 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
763 #ifdef EDM_ML_DEBUG
764  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << plastMat
765  << " of dimensions " << convertCmToMm(0.5 * layerT[layer]) << ", 0, 0, "
766  << convertCmToMm(yh) << ", " << convertCmToMm(bl) << ", " << convertCmToMm(tl)
767  << ", " << convertRadToDeg(alp) << ", " << convertCmToMm(yh) << ", "
768  << convertCmToMm(bl) << ", " << convertCmToMm(tl) << ", " << convertRadToDeg(alp);
769 #endif
770 
771  plog = dd4hep::Volume(solid.name(), solid, matplastic);
772  ypos = 0.5 * (routF + rinB) - xpos;
773  glog.placeVolume(plog, idOffset + layer + 1, dd4hep::Position(0., ypos, 0.));
774 
775 #ifdef EDM_ML_DEBUG
776  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << plog.name() << " number " << (idOffset + layer + 1)
777  << " positioned in " << glog.name() << " at (0, " << convertCmToMm(ypos)
778  << ", 0) with no rotation";
779 #endif
780 
781  //Constructing the scintillators inside
782  int copyNo = layer * 10 + layerType[layer];
783  name = modName[mod] + layerName[layer] + phiName[iphi];
784  constructScintLayer(ns, plog, scintT[layer], yh, bl, tl, alp, name, copyNo);
785  zo += 0.5 * dzStep;
786  } // End of loop over phi indices
787  zi = zo - 0.5 * dzStep;
788  } // End of loop on layers
789  }
790 
793  double dz,
794  double yh,
795  double bl,
796  double tl,
797  double alp,
798  const std::string& nm,
799  int id) {
800  dd4hep::Material matter = ns.material(scintMat);
801  std::string name = idName + "Scintillator" + nm;
802 
803  dd4hep::Solid solid = dd4hep::Trap(ns.prepend(name), 0.5 * dz, 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
804 #ifdef EDM_ML_DEBUG
805  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << scintMat
806  << " of dimensions " << convertCmToMm(0.5 * dz) << ", 0, 0, " << convertCmToMm(yh)
807  << ", " << convertCmToMm(bl) << ", " << convertCmToMm(tl) << ", "
808  << convertRadToDeg(alp) << ", " << convertCmToMm(yh) << ", " << convertCmToMm(bl)
809  << ", " << convertCmToMm(tl) << ", " << convertRadToDeg(alp);
810 #endif
811 
812  dd4hep::Volume glog(solid.name(), solid, matter);
813  detector.placeVolume(glog, id);
814 #ifdef EDM_ML_DEBUG
815  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << id << " positioned in "
816  << detector.name() << " at (0,0,0) with no rotation";
817 #endif
818  }
819 
820  int getLayer(unsigned int i, unsigned int j) const {
821  switch (i) {
822  case 0:
823  return layerN0[j];
824  break;
825  case 1:
826  return layerN1[j];
827  break;
828  case 2:
829  return layerN2[j];
830  break;
831  case 3:
832  return layerN3[j];
833  break;
834  case 4:
835  return layerN4[j];
836  break;
837  case 5:
838  return layerN5[j];
839  break;
840  default:
841  return 0;
842  }
843  }
844 
845  double getTrim(unsigned int i, unsigned int j) const {
846  if (j == 0)
847  return trimLeft[i];
848  else
849  return trimRight[j];
850  }
851 
853  int layer,
854  int iphi,
855  double& yh,
856  double& bl,
857  double& tl,
858  double& alp,
859  double& xpos,
860  double& ypos,
861  double& zpos) {
862  //Given module and layer number compute parameters of trapezoid
863  //and positioning parameters
864  double alpha = (1._pi) / nsectors;
865 #ifdef EDM_ML_DEBUG
866  edm::LogVerbatim("HCalGeom") << "Input " << iphi << " " << layer << " " << iphi << " Alpha "
868 #endif
869 
870  double zi, zo;
871  if (iphi == 0) {
872  zi = zminBlock[mod];
873  zo = zi + layerT[layer];
874  } else {
875  zo = zmaxBlock[mod];
876  zi = zo - layerT[layer];
877  }
878  double rin, rout;
879  if (mod == 0) {
880  rin = zo * tan(angTop);
881  rout = (zi - z1Beam) * slope;
882  } else {
883  rin = zo * tan(angBot);
884  rout = zi * tan(angTop);
885  }
886  yh = 0.5 * (rout - rin);
887  bl = 0.5 * rin * tan(alpha);
888  tl = 0.5 * rout * tan(alpha);
889  xpos = 0.5 * (rin + rout);
890  ypos = 0.5 * (bl + tl);
891  zpos = 0.5 * (zi + zo);
892  yh -= getTrim(mod, iphi);
893  bl -= getTrim(mod, iphi);
894  tl -= getTrim(mod, iphi);
895  alp = atan(0.5 * tan(alpha));
896  if (iphi == 0) {
897  ypos = -ypos;
898  } else {
899  alp = -alp;
900  }
901 
902 #ifdef EDM_ML_DEBUG
903  edm::LogVerbatim("HCalGeom") << "Output Dimensions " << convertCmToMm(yh) << " " << convertCmToMm(bl) << " "
904  << convertCmToMm(tl) << " " << convertRadToDeg(alp) << " Position "
905  << convertCmToMm(xpos) << " " << convertCmToMm(ypos) << " " << convertCmToMm(zpos);
906 #endif
907  }
908 
910  double rinF,
911  double routF,
912  double rinB,
913  double routB,
914  double zi,
915  double zo,
916  double& yh1,
917  double& bl1,
918  double& tl1,
919  double& yh2,
920  double& bl2,
921  double& tl2,
922  double& alp,
923  double& theta,
924  double& phi,
925  double& xpos,
926  double& ypos,
927  double& zpos) {
928  //Given rin, rout compute parameters of the trapezoid and
929  //position of the trapezoid for a standrd layer
930  double alpha = (1._pi) / nsectors;
931 
932 #ifdef EDM_ML_DEBUG
933  edm::LogVerbatim("HCalGeom") << "Input " << iphi << " Front " << convertCmToMm(rinF) << " " << convertCmToMm(routF)
934  << " " << convertCmToMm(zi) << " Back " << convertCmToMm(rinB) << " "
935  << convertCmToMm(routB) << " " << convertCmToMm(zo) << " Alpha "
937 #endif
938 
939  yh1 = 0.5 * (routF - rinB);
940  bl1 = 0.5 * rinB * tan(alpha);
941  tl1 = 0.5 * routF * tan(alpha);
942  yh2 = 0.5 * (routF - rinB);
943  bl2 = 0.5 * rinB * tan(alpha);
944  tl2 = 0.5 * routF * tan(alpha);
945  double dx = 0.25 * (bl2 + tl2 - bl1 - tl1);
946  double dy = 0.5 * (rinB + routF - rinB - routF);
947  xpos = 0.25 * (rinB + routF + rinB + routF);
948  ypos = 0.25 * (bl2 + tl2 + bl1 + tl1);
949  zpos = 0.5 * (zi + zo);
950  alp = atan(0.5 * tan(alpha));
951  // ypos-= tolPos;
952  if (iphi == 0) {
953  ypos = -ypos;
954  } else {
955  alp = -alp;
956  dx = -dx;
957  }
958  double r = sqrt(dx * dx + dy * dy);
959  theta = atan(r / (zo - zi));
960  phi = atan2(dy, dx);
961 
962 #ifdef EDM_ML_DEBUG
963  edm::LogVerbatim("HCalGeom") << "Output Dimensions " << convertCmToMm(yh1) << " " << convertCmToMm(bl1) << " "
964  << convertCmToMm(tl1) << " " << convertCmToMm(yh2) << " " << convertCmToMm(bl2) << " "
965  << convertCmToMm(tl2) << " " << convertRadToDeg(alp) << " " << convertRadToDeg(theta)
966  << " " << convertRadToDeg(phi) << " Position " << convertCmToMm(xpos) << " "
967  << convertCmToMm(ypos) << " " << convertCmToMm(zpos);
968 #endif
969  }
970 
971  dd4hep::Rotation3D getRotation(const std::string& rotation, cms::DDNamespace& ns) {
972  std::string rot = (strchr(rotation.c_str(), NAMESPACE_SEP) == nullptr) ? ("rotations:" + rotation) : rotation;
973 #ifdef EDM_ML_DEBUG
974  edm::LogVerbatim("HCalGeom") << "getRotation: " << rotation << ":" << rot << ":" << ns.rotation(rot);
975 #endif
976  return ns.rotation(rot);
977  }
978 };
979 
980 static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) {
981  HCalEndcapAlgo hcalendcapalgo(ctxt, e);
982  return 1;
983 }
984 
985 // first argument is the type from the xml file
986 DECLARE_DDCMS_DETELEMENT(DDCMS_hcal_DDHCalEndcapAlgo, algorithm)
writedatasetfile.args
args
Definition: writedatasetfile.py:18
HCalEndcapAlgo::heboxDepth
double heboxDepth
Definition: DDHCalEndcapAlgo.cc:48
HCalEndcapAlgo::ziL0Body
double ziL0Body
Definition: DDHCalEndcapAlgo.cc:36
HCalEndcapAlgo::layerName
std::vector< std::string > layerName
Definition: DDHCalEndcapAlgo.cc:79
mps_fire.i
i
Definition: mps_fire.py:428
LogMessageMonitor_cff.modules
modules
Definition: LogMessageMonitor_cff.py:7
g4SimHits_cfi.Material
Material
Definition: g4SimHits_cfi.py:560
MessageLogger.h
HCalEndcapAlgo::angBot
double angBot
Definition: DDHCalEndcapAlgo.cc:51
DECLARE_DDCMS_DETELEMENT
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition: DDPlugins.h:25
cms::DDNamespace::material
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:116
HCalEndcapAlgo::modType
std::vector< int > modType
Definition: DDHCalEndcapAlgo.cc:58
HCalEndcapAlgo::roDip
double roDip
Definition: DDHCalEndcapAlgo.cc:47
cms::DDParsingContext
Definition: DDParsingContext.h:13
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
modules
Definition: ZHLTMatchFilter.cc:17
HCalEndcapAlgo::trimRight
std::vector< double > trimRight
Definition: DDHCalEndcapAlgo.cc:69
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:16
HCalEndcapAlgo::layerN2
std::vector< int > layerN2
Definition: DDHCalEndcapAlgo.cc:63
DDSplit.h
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
HCalEndcapAlgo::zEnd
double zEnd
Definition: DDHCalEndcapAlgo.cc:32
HCalEndcapAlgo::ziDip
double ziDip
Definition: DDHCalEndcapAlgo.cc:40
HCalEndcapAlgo::angTop
double angTop
Definition: DDHCalEndcapAlgo.cc:50
HCalEndcapAlgo::constructInsideModule
void constructInsideModule(cms::DDNamespace &ns, dd4hep::Volume &module, int mod)
Definition: DDHCalEndcapAlgo.cc:684
HCalEndcapAlgo::rinBlock1
std::vector< double > rinBlock1
Definition: DDHCalEndcapAlgo.cc:72
HCalEndcapAlgo::ziKink
double ziKink
Definition: DDHCalEndcapAlgo.cc:37
HCalEndcapAlgo::getLayer
int getLayer(unsigned int i, unsigned int j) const
Definition: DDHCalEndcapAlgo.cc:820
HCalEndcapAlgo
Definition: DDHCalEndcapAlgo.cc:22
versionedElectronIDProducer_cfi.idName
idName
Definition: versionedElectronIDProducer_cfi.py:11
HCalEndcapAlgo::HCalEndcapAlgo
HCalEndcapAlgo(cms::DDParsingContext &ctxt, xml_h e)
Definition: DDHCalEndcapAlgo.cc:92
HCalEndcapAlgo::idOffset
int idOffset
Definition: DDHCalEndcapAlgo.cc:87
HCalEndcapAlgo::genMaterial
std::string genMaterial
Definition: DDHCalEndcapAlgo.cc:23
HCalEndcapAlgo::constructGeneralVolume
void constructGeneralVolume(cms::DDNamespace &ns, dd4hep::Volume &parent)
Definition: DDHCalEndcapAlgo.cc:329
geant_units::operators
Definition: GeantUnits.h:18
HCalEndcapAlgo::absMat
std::string absMat
Definition: DDHCalEndcapAlgo.cc:54
HCalEndcapAlgo::thick
std::vector< double > thick
Definition: DDHCalEndcapAlgo.cc:67
HCalEndcapAlgo::zFront
double zFront
Definition: DDHCalEndcapAlgo.cc:31
HCalEndcapAlgo::routBlock1
std::vector< double > routBlock1
Definition: DDHCalEndcapAlgo.cc:73
dqmdumpme.first
first
Definition: dqmdumpme.py:55
muonTiming_cfi.etamin
etamin
Definition: muonTiming_cfi.py:30
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HCalEndcapAlgo::rotmat
std::string rotmat
Definition: DDHCalEndcapAlgo.cc:85
HCalEndcapAlgo::z1Beam
double z1Beam
Definition: DDHCalEndcapAlgo.cc:39
algorithm
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
Definition: DDHCalEndcapAlgo.cc:980
HCalEndcapAlgo::parameterLayer
void parameterLayer(int iphi, double rinF, double routF, double rinB, double routB, double zi, double zo, double &yh1, double &bl1, double &tl1, double &yh2, double &bl2, double &tl2, double &alp, double &theta, double &phi, double &xpos, double &ypos, double &zpos)
Definition: DDHCalEndcapAlgo.cc:909
HCalEndcapAlgo::rotation
std::string rotation
Definition: DDHCalEndcapAlgo.cc:29
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
cms::DDNamespace::prepend
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:60
HCalEndcapAlgo::slope
double slope
Definition: DDHCalEndcapAlgo.cc:53
HCalEndcapAlgo::layerN3
std::vector< int > layerN3
Definition: DDHCalEndcapAlgo.cc:64
HCalEndcapAlgo::nsectors
int nsectors
Definition: DDHCalEndcapAlgo.cc:24
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HCalEndcapAlgo::layers
int layers
Definition: DDHCalEndcapAlgo.cc:78
cms::DDNamespace::rotation
const dd4hep::Rotation3D & rotation(const std::string &name) const
Definition: DDNamespace.cc:125
HLT_FULL_cff.gap
gap
Definition: HLT_FULL_cff.py:8498
HCalEndcapAlgo::zShift
double zShift
Definition: DDHCalEndcapAlgo.cc:30
HCalEndcapAlgo::rinBlock2
std::vector< double > rinBlock2
Definition: DDHCalEndcapAlgo.cc:74
HCalEndcapAlgo::constructInsideModule0
void constructInsideModule0(cms::DDNamespace &ns, dd4hep::Volume &module, int mod)
Definition: DDHCalEndcapAlgo.cc:576
HCalEndcapAlgo::idName
std::string idName
Definition: DDHCalEndcapAlgo.cc:86
HCalEndcapAlgo::zminBlock
std::vector< double > zminBlock
Definition: DDHCalEndcapAlgo.cc:70
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HCalEndcapAlgo::ziL0Nose
double ziL0Nose
Definition: DDHCalEndcapAlgo.cc:34
HCalEndcapAlgo::trimLeft
std::vector< double > trimLeft
Definition: DDHCalEndcapAlgo.cc:68
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
HCalEndcapAlgo::zmaxBlock
std::vector< double > zmaxBlock
Definition: DDHCalEndcapAlgo.cc:71
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
geant_units::operators::convertCmToMm
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
GeantUnits.h
HCalEndcapAlgo::modules
int modules
Definition: DDHCalEndcapAlgo.cc:55
HCalEndcapAlgo::constructScintLayer
void constructScintLayer(cms::DDNamespace &ns, dd4hep::Volume &detector, double dz, double yh, double bl, double tl, double alp, const std::string &nm, int id)
Definition: DDHCalEndcapAlgo.cc:791
DDPlugins.h
fact
const double fact
Definition: NuclearInteractionFTFSimulator.cc:74
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
HCalEndcapAlgo::modName
std::vector< std::string > modName
Definition: DDHCalEndcapAlgo.cc:56
HCalEndcapAlgo::riDip
double riDip
Definition: DDHCalEndcapAlgo.cc:46
HCalEndcapAlgo::sectionModule
std::vector< int > sectionModule
Definition: DDHCalEndcapAlgo.cc:59
HCalEndcapAlgo::parameterLayer0
void parameterLayer0(int mod, int layer, int iphi, double &yh, double &bl, double &tl, double &alp, double &xpos, double &ypos, double &zpos)
Definition: DDHCalEndcapAlgo.cc:852
HCalEndcapAlgo::rotHalf
std::string rotHalf
Definition: DDHCalEndcapAlgo.cc:28
HCalEndcapAlgo::getRotation
dd4hep::Rotation3D getRotation(const std::string &rotation, cms::DDNamespace &ns)
Definition: DDHCalEndcapAlgo.cc:971
HCalEndcapAlgo::layerN
std::vector< int > layerN
Definition: DDHCalEndcapAlgo.cc:60
HCalEndcapAlgo::drEnd
double drEnd
Definition: DDHCalEndcapAlgo.cc:49
HCalEndcapAlgo::layerN1
std::vector< int > layerN1
Definition: DDHCalEndcapAlgo.cc:62
HCalEndcapAlgo::layerType
std::vector< int > layerType
Definition: DDHCalEndcapAlgo.cc:80
HCalEndcapAlgo::riKink
double riKink
Definition: DDHCalEndcapAlgo.cc:45
HCalEndcapAlgo::ziNose
double ziNose
Definition: DDHCalEndcapAlgo.cc:33
HCalEndcapAlgo::modMat
std::vector< std::string > modMat
Definition: DDHCalEndcapAlgo.cc:57
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
PVValHelper::dy
Definition: PVValidationHelpers.h:49
HCalEndcapAlgo::dzStep
double dzStep
Definition: DDHCalEndcapAlgo.cc:41
HCalEndcapAlgo::scintT
std::vector< double > scintT
Definition: DDHCalEndcapAlgo.cc:82
HCalEndcapAlgo::phiName
std::vector< std::string > phiName
Definition: DDHCalEndcapAlgo.cc:77
cms::DDNamespace::addVolumeNS
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
Definition: DDNamespace.cc:145
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HCalEndcapAlgo::zShiftHac2
double zShiftHac2
Definition: DDHCalEndcapAlgo.cc:43
HCalEndcapAlgo::routBlock2
std::vector< double > routBlock2
Definition: DDHCalEndcapAlgo.cc:75
HCalEndcapAlgo::phiSections
int phiSections
Definition: DDHCalEndcapAlgo.cc:76
align::Detector
Definition: StructureType.h:86
HCalEndcapAlgo::nsectortot
int nsectortot
Definition: DDHCalEndcapAlgo.cc:25
HCalEndcapAlgo::layerN0
std::vector< int > layerN0
Definition: DDHCalEndcapAlgo.cc:61
HCalEndcapAlgo::nEndcap
int nEndcap
Definition: DDHCalEndcapAlgo.cc:26
PVValHelper::dz
Definition: PVValidationHelpers.h:50
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
HGCalGeometryMode::Polyhedra
Definition: HGCalGeometryMode.h:35
HCalEndcapAlgo::eModule
std::vector< int > eModule
Definition: DDHCalEndcapAlgo.cc:27
HCalEndcapAlgo::scintMat
std::string scintMat
Definition: DDHCalEndcapAlgo.cc:84
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HCalEndcapAlgo::tolPos
double tolPos
Definition: DDHCalEndcapAlgo.cc:88
NAMESPACE_SEP
#define NAMESPACE_SEP
Definition: DDNamespace.h:85
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
HCalEndcapAlgo::layerT
std::vector< double > layerT
Definition: DDHCalEndcapAlgo.cc:81
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
HCalEndcapAlgo::plastMat
std::string plastMat
Definition: DDHCalEndcapAlgo.cc:83
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
edm::Log
Definition: MessageLogger.h:70
HCalEndcapAlgo::z0Beam
double z0Beam
Definition: DDHCalEndcapAlgo.cc:38
cms::DDNamespace::name
std::string_view name() const
Definition: DDNamespace.h:72
HCalEndcapAlgo::rout
double rout
Definition: DDHCalEndcapAlgo.cc:44
HCalEndcapAlgo::dzShift
double dzShift
Definition: DDHCalEndcapAlgo.cc:42
class-composition.parent
parent
Definition: class-composition.py:88
HCalEndcapAlgo::getTrim
double getTrim(unsigned int i, unsigned int j) const
Definition: DDHCalEndcapAlgo.cc:845
HCalEndcapAlgo::constructInsideSector
void constructInsideSector(cms::DDNamespace &ns, dd4hep::Volume &sector)
Definition: DDHCalEndcapAlgo.cc:505
cuy.ii
ii
Definition: cuy.py:590
HCalEndcapAlgo::ziBody
double ziBody
Definition: DDHCalEndcapAlgo.cc:35
cms::DDNamespace::volume
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition: DDNamespace.cc:205
PVValHelper::dx
Definition: PVValidationHelpers.h:48
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
HCalEndcapAlgo::layerN5
std::vector< int > layerN5
Definition: DDHCalEndcapAlgo.cc:66
HCalEndcapAlgo::layerN4
std::vector< int > layerN4
Definition: DDHCalEndcapAlgo.cc:65
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HCalEndcapAlgo::angGap
double angGap
Definition: DDHCalEndcapAlgo.cc:52