CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
HcalBarrelAlgo Struct Reference

Public Member Functions

void constructInsideDetectors (dd4hep::Volume &detector, const std::string &name, int id, double dx, double dy, double dz, int type, cms::DDNamespace &ns)
 
void constructInsideLayers (dd4hep::Volume &laylog, const std::string &nm, int id, int nAbs, double rin, double d1, double alpha1, double d2, double alpha2, double t1, double t2, cms::DDNamespace &ns)
 
dd4hep::Volume constructMidLayer (dd4hep::Volume laylog, const std::string &nm, double rin, double alpha, cms::DDNamespace &ns)
 
dd4hep::Volume constructSideLayer (dd4hep::Volume &laylog, const std::string &nm, int nAbs, double rin, double alpha, cms::DDNamespace &ns)
 
dd4hep::Rotation3D getRotation (std::string &rotation, std::string &rotns, cms::DDNamespace &ns)
 
 HcalBarrelAlgo ()=delete
 
 HcalBarrelAlgo (cms::DDParsingContext &ctxt, xml_h &e)
 

Public Attributes

std::vector< double > absorbD
 
std::vector< std::string > absorbMat
 
std::vector< std::string > absorbName
 
std::vector< double > absorbT
 
std::vector< double > detdP1
 
std::vector< double > detdP2
 
std::string detMat
 
std::string detMatPl
 
std::string detMatSc
 
std::vector< int > detPosY
 
std::string detRot
 
std::vector< double > detT11
 
std::vector< double > detT12
 
std::vector< double > detT21
 
std::vector< double > detT22
 
std::vector< double > detTsc
 
std::vector< int > detType
 
std::vector< double > detWidth1
 
std::vector< double > detWidth2
 
std::string genMaterial
 
std::string idName
 
std::string idNameSpace
 
int idOffset
 
std::vector< int > layerAbsorb
 
std::vector< double > layerAlpha
 
std::vector< double > layerD1
 
std::vector< double > layerD2
 
std::vector< double > layerGap
 
std::vector< int > layerId
 
std::vector< std::string > layerLabel
 
std::vector< std::string > layerMat
 
std::vector< double > layerT1
 
std::vector< double > layerT2
 
std::vector< double > layerWidth
 
double middleD
 
std::string middleMat
 
double middleW
 
std::vector< std::string > midMat
 
std::vector< std::string > midName
 
std::vector< double > midT
 
std::vector< double > midW
 
int nAbsorber
 
int nhalf
 
int nLayers
 
int nMidAbs
 
int nsectors
 
int nsectortot
 
int nSideAbs
 
double rinner
 
std::vector< double > rmax
 
std::string rotHalf
 
std::string rotns
 
double router
 
int rzones
 
std::vector< std::string > sideAbsMat
 
std::vector< std::string > sideAbsName
 
std::vector< double > sideAbsW
 
std::vector< double > sideD
 
std::vector< std::string > sideMat
 
std::vector< double > sideT
 
std::vector< double > theta
 
std::vector< double > ttheta
 
std::vector< double > zoff
 

Detailed Description

Definition at line 23 of file DDHCalBarrelAlgo.cc.

Constructor & Destructor Documentation

◆ HcalBarrelAlgo() [1/2]

HcalBarrelAlgo::HcalBarrelAlgo ( )
delete

◆ HcalBarrelAlgo() [2/2]

HcalBarrelAlgo::HcalBarrelAlgo ( cms::DDParsingContext ctxt,
xml_h &  e 
)
inline

!!!!!!!!!!!!!!!!Should be zero. And removed as soon as

Definition at line 143 of file DDHCalBarrelAlgo.cc.

References simBeamSpotPI::alpha, writedatasetfile::args, cms::convert2mm(), angle_units::operators::convertRadToDeg(), MillePedeFileConverter_cfg::e, mps_fire::i, versionedElectronIDProducer_cfi::idName, cuy::ii, recoMuon::in, dqmiolumiharvest::j, dqmdumpme::k, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, cms::DDNamespace::name(), MuonTCMETValueMapProducer_cff::nLayers, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::ntot, MillePedeFileConverter_cfg::out, HGCalGeometryMode::Polyhedra, cms::DDNamespace::prepend(), makeMuonMisalignmentScenario::rot, idealTransformation::rotation, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), theta(), cms::DDNamespace::volume(), ApeEstimator_cff::width, and SiStripMonitorCluster_cfi::zmax.

143  {
144  cms::DDNamespace ns(ctxt, e, true);
145  cms::DDAlgoArguments args(ctxt, e);
146 #ifdef EDM_ML_DEBUG
147  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: Creating an instance";
148 #endif
149 
150  genMaterial = args.value<std::string>("MaterialName");
151  nsectors = args.value<int>("NSector");
152  nsectortot = args.value<int>("NSectorTot");
153  nhalf = args.value<int>("NHalf");
154  rinner = args.value<double>("RIn");
155  router = args.value<double>("ROut");
156  rzones = args.value<int>("RZones");
157  rotHalf = args.value<std::string>("RotHalf");
158  rotns = args.value<std::string>("RotNameSpace");
159 
160  theta = args.value<std::vector<double> >("Theta");
161  rmax = args.value<std::vector<double> >("RMax");
162  zoff = args.value<std::vector<double> >("ZOff");
163  for (int i = 0; i < rzones; i++) {
164  ttheta.emplace_back(tan(theta[i])); //*deg already done in XML
165  }
166  if (rzones > 3)
167  rmax[2] = (zoff[3] - zoff[2]) / ttheta[2];
168 
169 #ifdef EDM_ML_DEBUG
170  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: General material " << genMaterial << "\tSectors " << nsectors
171  << ", " << nsectortot << "\tHalves " << nhalf << "\tRotation matrix " << rotns << ":"
172  << rotHalf << "\n\t\t" << cms::convert2mm(rinner) << "\t" << cms::convert2mm(router)
173  << "\t" << rzones;
174  for (int i = 0; i < rzones; i++)
175  edm::LogVerbatim("HCalGeom") << "\tTheta[" << i << "] = " << theta[i] << "\trmax[" << i
176  << "] = " << cms::convert2mm(rmax[i]) << "\tzoff[" << i
177  << "] = " << cms::convert2mm(zoff[i]);
178 #endif
179  //Layers
181  nLayers = args.value<int>("NLayers");
182 #ifdef EDM_ML_DEBUG
183  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: Layer\t" << nLayers;
184 #endif
185  layerId = args.value<std::vector<int> >("Id");
186  layerLabel = args.value<std::vector<std::string> >("LayerLabel");
187  layerMat = args.value<std::vector<std::string> >("LayerMat");
188  layerWidth = args.value<std::vector<double> >("LayerWidth");
189  layerD1 = args.value<std::vector<double> >("D1");
190  layerD2 = args.value<std::vector<double> >("D2");
191  layerAlpha = args.value<std::vector<double> >("Alpha2");
192  layerT1 = args.value<std::vector<double> >("T1");
193  layerT2 = args.value<std::vector<double> >("T2");
194  layerAbsorb = args.value<std::vector<int> >("AbsL");
195  layerGap = args.value<std::vector<double> >("Gap");
196 #ifdef EDM_ML_DEBUG
197  for (int i = 0; i < nLayers; i++)
198  edm::LogVerbatim("HCalGeom") << layerLabel[i] << "\t" << layerId[i] << "\t" << layerMat[i] << "\t"
199  << cms::convert2mm(layerWidth[i]) << "\t" << cms::convert2mm(layerD1[i]) << "\t"
200  << cms::convert2mm(layerD2[i]) << "\t" << layerAlpha[i] << "\t"
201  << cms::convert2mm(layerT1[i]) << "\t" << cms::convert2mm(layerT2[i]) << "\t"
202  << layerAbsorb[i] << "\t" << cms::convert2mm(layerGap[i]);
203 #endif
204 
206  //Absorber Layers and middle part
207  absorbName = args.value<std::vector<std::string> >("AbsorbName");
208  absorbMat = args.value<std::vector<std::string> >("AbsorbMat");
209  absorbD = args.value<std::vector<double> >("AbsorbD");
210  absorbT = args.value<std::vector<double> >("AbsorbT");
211  nAbsorber = absorbName.size();
212 #ifdef EDM_ML_DEBUG
213  for (int i = 0; i < nAbsorber; i++)
214  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << absorbName[i] << " Material " << absorbMat[i] << " d "
215  << cms::convert2mm(absorbD[i]) << " t " << cms::convert2mm(absorbT[i]);
216 #endif
217  middleMat = args.value<std::string>("MiddleMat");
218  middleD = args.value<double>("MiddleD");
219  middleW = args.value<double>("MiddleW");
220 #ifdef EDM_ML_DEBUG
221  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: Middle material " << middleMat << " d "
223 #endif
224  midName = args.value<std::vector<std::string> >("MidAbsName");
225  midMat = args.value<std::vector<std::string> >("MidAbsMat");
226  midW = args.value<std::vector<double> >("MidAbsW");
227  midT = args.value<std::vector<double> >("MidAbsT");
228  nMidAbs = midName.size();
229 #ifdef EDM_ML_DEBUG
230  for (int i = 0; i < nMidAbs; i++)
231  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << midName[i] << " Material " << midMat[i] << " W "
232  << cms::convert2mm(midW[i]) << " T " << cms::convert2mm(midT[i]);
233 #endif
234 
235  //Absorber layers in the side part
236  sideMat = args.value<std::vector<std::string> >("SideMat");
237  sideD = args.value<std::vector<double> >("SideD");
238  sideT = args.value<std::vector<double> >("SideT");
239 #ifdef EDM_ML_DEBUG
240  for (unsigned int i = 0; i < sideMat.size(); i++)
241  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: Side material " << sideMat[i] << " d "
242  << cms::convert2mm(sideD[i]) << " t " << cms::convert2mm(sideT[i]);
243 #endif
244  sideAbsName = args.value<std::vector<std::string> >("SideAbsName");
245  sideAbsMat = args.value<std::vector<std::string> >("SideAbsMat");
246  sideAbsW = args.value<std::vector<double> >("SideAbsW");
247  nSideAbs = sideAbsName.size();
248 #ifdef EDM_ML_DEBUG
249  for (int i = 0; i < nSideAbs; i++)
250  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << sideAbsName[i] << " Material " << sideAbsMat[i] << " W "
252 #endif
253 
255  // Detectors
256 
257  detMat = args.value<std::string>("DetMat");
258  detRot = args.value<std::string>("DetRot");
259  detMatPl = args.value<std::string>("DetMatPl");
260  detMatSc = args.value<std::string>("DetMatSc");
261 #ifdef EDM_ML_DEBUG
262  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: Detector (" << nLayers << ") Rotation matrix " << rotns << ":"
263  << detRot << "\n\t\t" << detMat << "\t" << detMatPl << "\t" << detMatSc;
264 #endif
265  detType = args.value<std::vector<int> >("DetType");
266  detdP1 = args.value<std::vector<double> >("DetdP1");
267  detdP2 = args.value<std::vector<double> >("DetdP2");
268  detT11 = args.value<std::vector<double> >("DetT11");
269  detT12 = args.value<std::vector<double> >("DetT12");
270  detTsc = args.value<std::vector<double> >("DetTsc");
271  detT21 = args.value<std::vector<double> >("DetT21");
272  detT22 = args.value<std::vector<double> >("DetT22");
273  detWidth1 = args.value<std::vector<double> >("DetWidth1");
274  detWidth2 = args.value<std::vector<double> >("DetWidth2");
275  detPosY = args.value<std::vector<int> >("DetPosY");
276 #ifdef EDM_ML_DEBUG
277  for (int i = 0; i < nLayers; i++)
278  edm::LogVerbatim("HCalGeom") << i + 1 << "\t" << detType[i] << "\t" << cms::convert2mm(detdP1[i]) << ", "
279  << cms::convert2mm(detdP2[i]) << "\t" << cms::convert2mm(detT11[i]) << ", "
280  << cms::convert2mm(detT12[i]) << "\t" << cms::convert2mm(detTsc[i]) << "\t"
281  << cms::convert2mm(detT21[i]) << ", " << cms::convert2mm(detT22[i]) << "\t"
282  << cms::convert2mm(detWidth1[i]) << "\t" << cms::convert2mm(detWidth2[i]) << "\t"
283  << detPosY[i];
284 #endif
285 
286  // idName = parentName.name();
287  idName = args.value<std::string>("MotherName");
288  idNameSpace = ns.name();
289  idOffset = args.value<int>("IdOffset");
290 #ifdef EDM_ML_DEBUG
291  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: Parent " << args.parentName() << " idName " << idName
292  << " NameSpace " << idNameSpace << " Offset " << idOffset;
293  edm::LogVerbatim("HCalGeom") << "==>> Constructing DDHCalBarrelAlgo...\n"
294  << "DDHCalBarrelAlgo: General volume...";
295 #endif
296 
297  double alpha = (1._pi) / nsectors;
298  double dphi = nsectortot * (2._pi) / nsectors;
299  int nsec, ntot(15);
300  if (nhalf == 1)
301  nsec = 8;
302  else
303  nsec = 15;
304  int nf = ntot - nsec;
305 
306  //Calculate zmin... see HCalBarrel.hh picture. For polyhedra
307  //Rmin and Rmax are distances to vertex
308  double zmax = zoff[3];
309  double zstep5 = zoff[4];
310  double zstep4 = (zoff[1] + rmax[1] * ttheta[1]);
311  if ((zoff[2] + rmax[1] * ttheta[2]) > zstep4)
312  zstep4 = (zoff[2] + rmax[1] * ttheta[2]);
313  double zstep3 = (zoff[1] + rmax[0] * ttheta[1]);
314  double zstep2 = (zoff[0] + rmax[0] * ttheta[0]);
315  double zstep1 = (zoff[0] + rinner * ttheta[0]);
316  double rout = router;
317  double rout1 = rmax[3];
318  double rin = rinner;
319  double rmid1 = rmax[0];
320  double rmid2 = rmax[1];
321  double rmid3 = (zoff[4] - zoff[2]) / ttheta[2];
322  double rmid4 = rmax[2];
323 
324  std::vector<double> pgonZ = {-zmax,
325  -zstep5,
326  -zstep5,
327  -zstep4,
328  -zstep3,
329  -zstep2,
330  -zstep1,
331  0,
332  zstep1,
333  zstep2,
334  zstep3,
335  zstep4,
336  zstep5,
337  zstep5,
338  zmax};
339 
340  std::vector<double> pgonRmin = {
341  rmid4, rmid3, rmid3, rmid2, rmid1, rmid1, rin, rin, rin, rmid1, rmid1, rmid2, rmid3, rmid3, rmid4};
342 
343  std::vector<double> pgonRmax = {
344  rout1, rout1, rout, rout, rout, rout, rout, rout, rout, rout, rout, rout, rout, rout1, rout1};
345 
346  std::vector<double> pgonZHalf = {0, zstep1, zstep2, zstep3, zstep4, zstep5, zstep5, zmax};
347 
348  std::vector<double> pgonRminHalf = {rin, rin, rmid1, rmid1, rmid2, rmid3, rmid3, rmid4};
349 
350  std::vector<double> pgonRmaxHalf = {rout, rout, rout, rout, rout, rout, rout1, rout1};
351 
352  std::string name("Null");
353  dd4hep::Solid solid;
354  if (nf == 0) {
355  solid = dd4hep::Polyhedra(ns.prepend(idName), nsectortot, -alpha, dphi, pgonZ, pgonRmin, pgonRmax);
356 #ifdef EDM_ML_DEBUG
357  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
358  << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
359  << convertRadToDeg(-alpha + dphi) << " and with " << nsec << " sections ";
360  for (unsigned int i = 0; i < pgonZ.size(); i++)
361  edm::LogVerbatim("HCalGeom") << "\t"
362  << "\tZ = " << cms::convert2mm(pgonZ[i])
363  << "\tRmin = " << cms::convert2mm(pgonRmin[i])
364  << "\tRmax = " << cms::convert2mm(pgonRmax[i]);
365 #endif
366  } else {
367  solid = dd4hep::Polyhedra(ns.prepend(idName), nsectortot, -alpha, dphi, pgonZHalf, pgonRminHalf, pgonRmaxHalf);
368 #ifdef EDM_ML_DEBUG
369  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
370  << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
371  << convertRadToDeg(-alpha + dphi) << " and with " << nsec << " sections ";
372  for (unsigned int i = 0; i < pgonZHalf.size(); i++)
373  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZHalf[i])
374  << "\tRmin = " << cms::convert2mm(pgonRminHalf[i])
375  << "\tRmax = " << cms::convert2mm(pgonRmaxHalf[i]);
376 #endif
377  }
378 
379  dd4hep::Material matter = ns.material(genMaterial);
380  dd4hep::Volume genlogic(solid.name(), solid, matter);
381  dd4hep::Volume parentName = ns.volume(args.parentName());
382  parentName.placeVolume(genlogic, 1);
383 #ifdef EDM_ML_DEBUG
384  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << genlogic.name() << " number 1 positioned in "
385  << parentName.name() << " at (0, 0, 0) with no rotation";
386 #endif
387  //Forward and backwards halfs
388  name = idName + "Half";
389  nf = (ntot + 1) / 2;
390  solid = dd4hep::Polyhedra(ns.prepend(name), nsectortot, -alpha, dphi, pgonZHalf, pgonRminHalf, pgonRmaxHalf);
391 #ifdef EDM_ML_DEBUG
392  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
393  << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
394  << convertRadToDeg(-alpha + dphi) << " and with " << nf << " sections ";
395  for (unsigned int i = 0; i < pgonZHalf.size(); i++)
396  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZHalf[i])
397  << "\tRmin = " << cms::convert2mm(pgonRminHalf[i])
398  << "\tRmax = " << cms::convert2mm(pgonRmaxHalf[i]);
399 #endif
400  dd4hep::Volume genlogich(solid.name(), solid, matter);
401  genlogic.placeVolume(genlogich, 1);
402 #ifdef EDM_ML_DEBUG
403  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << genlogich.name() << " number 1 positioned in "
404  << genlogic.name() << " at (0, 0, 0) with no rotation";
405 #endif
406  if (nhalf != 1) {
407  dd4hep::Rotation3D rot = getRotation(rotHalf, rotns, ns);
408  genlogic.placeVolume(genlogich, 2, rot);
409 #ifdef EDM_ML_DEBUG
410  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << genlogich.name() << " number 2 positioned in "
411  << genlogic.name() << " at (0, 0, 0) with " << rot;
412 #endif
413  } //end if (getNhalf...
414 
415  //Construct sector (from -alpha to +alpha)
416  name = idName + "Module";
417  solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha, 2 * alpha, pgonZHalf, pgonRminHalf, pgonRmaxHalf);
418  dd4hep::Volume seclogic(solid.name(), solid, matter);
419 #ifdef EDM_ML_DEBUG
420  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << matter.name()
421  << " with 1 sector from " << convertRadToDeg(-alpha) << " to "
422  << convertRadToDeg(alpha) << " and with " << nf << " sections";
423  for (unsigned int i = 0; i < pgonZHalf.size(); i++)
424  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZHalf[i])
425  << "\tRmin = " << cms::convert2mm(pgonRminHalf[i])
426  << "\tRmax = " << cms::convert2mm(pgonRmaxHalf[i]);
427 #endif
428 
429  for (int ii = 0; ii < nsectortot; ii++) {
430  double phi = ii * 2 * alpha;
431  dd4hep::Rotation3D rotation;
432  if (phi != 0) {
433  rotation = dd4hep::RotationZ(phi);
434 #ifdef EDM_ML_DEBUG
435  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: Creating a new "
436  << "rotation around Z " << convertRadToDeg(phi);
437 #endif
438  } //if phideg!=0
439  genlogich.placeVolume(seclogic, ii + 1, rotation);
440 #ifdef EDM_ML_DEBUG
441  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << seclogic.name() << " number " << ii + 1
442  << " positioned in " << genlogich.name() << " at (0, 0, 0) with " << rotation;
443 #endif
444  }
445 
446  //Construct the things inside the sector
447 #ifdef EDM_ML_DEBUG
448  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: Layers (" << nLayers << ") ...";
449 #endif
450  rin = rinner;
451  for (int i = 0; i < nLayers; i++) {
453  dd4hep::Material matter = ns.material(layerMat[i]);
454  double width = layerWidth[i];
455  double rout = rin + width;
456 
457  int in = 0, out = 0;
458  for (int j = 0; j < rzones - 1; j++) {
459  if (rin >= rmax[j])
460  in = j + 1;
461  if (rout > rmax[j])
462  out = j + 1;
463  }
464  double zout = zoff[in] + rin * ttheta[in];
465 
467  //vertical walls are allowed in SolidPolyhedra
468 #ifdef EDM_ML_DEBUG
469  int nsec = 2;
470 #endif
471  std::vector<double> pgonZ, pgonRmin, pgonRmax;
472  // index 0
473  pgonZ.emplace_back(0);
474  pgonRmin.emplace_back(rin);
475  pgonRmax.emplace_back(rout);
476  // index 1
477  pgonZ.emplace_back(zout);
478  pgonRmin.emplace_back(rin);
479  pgonRmax.emplace_back(rout);
480  if (in == out) {
481  if (in <= 3) {
482  //index 2
483  pgonZ.emplace_back(zoff[in] + rout * ttheta[in]);
484  pgonRmin.emplace_back(pgonRmax[1]);
485  pgonRmax.emplace_back(pgonRmax[1]);
486 #ifdef EDM_ML_DEBUG
487  nsec++;
488 #endif
489  }
490  } else {
491  if (in == 3) {
492  //redo index 1, add index 2
493  pgonZ[1] = (zoff[out] + rmax[out] * ttheta[out]);
494  pgonZ.emplace_back(pgonZ[1]);
495  pgonRmin.emplace_back(pgonRmin[1]);
496  pgonRmax.emplace_back(rmax[in]);
497  //index 3
498  pgonZ.emplace_back(zoff[in] + rmax[in] * ttheta[in]);
499  pgonRmin.emplace_back(pgonRmin[2]);
500  pgonRmax.emplace_back(pgonRmax[2]);
501 #ifdef EDM_ML_DEBUG
502  nsec += 2;
503 #endif
504  } else {
505  //index 2
506  pgonZ.emplace_back(zoff[in] + rmax[in] * ttheta[in]);
507  pgonRmin.emplace_back(rmax[in]);
508  pgonRmax.emplace_back(pgonRmax[1]);
509 #ifdef EDM_ML_DEBUG
510  nsec++;
511 #endif
512  if (in == 0) {
513  pgonZ.emplace_back(zoff[out] + rmax[in] * ttheta[out]);
514  pgonRmin.emplace_back(pgonRmin[2]);
515  pgonRmax.emplace_back(pgonRmax[2]);
516 #ifdef EDM_ML_DEBUG
517  nsec++;
518 #endif
519  }
520  if (in <= 1) {
521  pgonZ.emplace_back(zoff[out] + rout * ttheta[out]);
522  pgonRmin.emplace_back(rout);
523  pgonRmax.emplace_back(rout);
524 #ifdef EDM_ML_DEBUG
525  nsec++;
526 #endif
527  }
528  }
529  }
530  //Solid & volume
531  dd4hep::Solid solid;
532  double alpha1 = alpha;
533  if (layerGap[i] > 1.e-6) {
534  double rmid = 0.5 * (rin + rout);
535  double width = rmid * tan(alpha) - layerGap[i];
536  alpha1 = atan(width / rmid);
537 #ifdef EDM_ML_DEBUG
538  edm::LogVerbatim("HCalGeom") << "\tAlpha_1 modified from " << convertRadToDeg(alpha) << " to "
539  << convertRadToDeg(alpha1) << " Rmid " << cms::convert2mm(rmid)
540  << " Reduced width " << cms::convert2mm(width);
541 #endif
542  }
543  solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha1, 2 * alpha1, pgonZ, pgonRmin, pgonRmax);
544  dd4hep::Volume glog(solid.name(), solid, matter);
545 #ifdef EDM_ML_DEBUG
546  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " (Layer " << i << ") Polyhedra made of "
547  << matter.name() << " with 1 sector from " << convertRadToDeg(-alpha1) << " to "
548  << convertRadToDeg(alpha1) << " and with " << nsec << " sections";
549  for (unsigned int k = 0; k < pgonZ.size(); k++)
550  edm::LogVerbatim("HCalGeom") << "\t\t" << cms::convert2mm(pgonZ[k]) << "\t" << cms::convert2mm(pgonRmin[k])
551  << "\t" << cms::convert2mm(pgonRmax[k]);
552 #endif
553 
554  seclogic.placeVolume(glog, layerId[i]);
555 #ifdef EDM_ML_DEBUG
556  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " number " << layerId[i]
557  << " positioned in " << seclogic.name() << " at (0,0,0) with no rotation";
558 #endif
560  layerLabel[i],
561  layerId[i],
562  layerAbsorb[i],
563  rin,
564  layerD1[i],
565  alpha1,
566  layerD2[i],
567  layerAlpha[i],
568  layerT1[i],
569  layerT2[i],
570  ns);
571  rin = rout;
572  }
573  }
std::vector< double > rmax
Log< level::Info, true > LogVerbatim
std::string rotHalf
std::vector< double > sideAbsW
dd4hep::Rotation3D getRotation(std::string &rotation, std::string &rotns, cms::DDNamespace &ns)
std::vector< int > detPosY
std::vector< double > detWidth1
std::string detRot
std::string detMatPl
std::string rotns
std::vector< double > detdP2
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
std::string detMat
std::string genMaterial
std::string middleMat
std::vector< double > absorbD
std::vector< std::string > sideAbsMat
std::vector< double > detT11
void constructInsideLayers(dd4hep::Volume &laylog, const std::string &nm, int id, int nAbs, double rin, double d1, double alpha1, double d2, double alpha2, double t1, double t2, cms::DDNamespace &ns)
std::vector< double > layerT1
std::vector< std::string > absorbMat
std::vector< std::string > midMat
std::vector< double > detT12
std::vector< std::string > midName
std::vector< double > layerAlpha
std::vector< std::string > sideAbsName
std::vector< double > sideD
std::string detMatSc
std::vector< double > absorbT
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > detWidth2
std::vector< double > zoff
std::vector< int > detType
std::vector< double > detT22
std::string idNameSpace
std::string idName
dd4hep::Volume Volume
ii
Definition: cuy.py:589
std::vector< double > theta
std::vector< double > detT21
std::vector< int > layerAbsorb
std::vector< double > layerD1
std::vector< std::string > absorbName
std::vector< double > layerT2
std::vector< double > sideT
std::vector< double > detdP1
std::vector< std::string > layerMat
std::vector< double > layerGap
std::vector< double > midT
std::vector< double > layerWidth
std::vector< double > midW
std::vector< std::string > layerLabel
std::vector< double > detTsc
std::vector< double > layerD2
std::vector< std::string > sideMat
std::vector< double > ttheta
std::vector< int > layerId

Member Function Documentation

◆ constructInsideDetectors()

void HcalBarrelAlgo::constructInsideDetectors ( dd4hep::Volume &  detector,
const std::string &  name,
int  id,
double  dx,
double  dy,
double  dz,
int  type,
cms::DDNamespace ns 
)
inline

Definition at line 901 of file DDHCalBarrelAlgo.cc.

References cms::convert2mm(), DDSplit(), hgcalTestNeighbor_cfi::detector, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, dqmdumpme::first, l1ctLayer2EG_cff::id, versionedElectronIDProducer_cfi::idName, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), AlCaHLTBitMon_QueryRunRegistry::string, and x.

908  {
909 #ifdef EDM_ML_DEBUG
910  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: \t\tInside detector " << id << "...";
911 #endif
912 
913  dd4hep::Material plmatter = ns.material(detMatPl);
914  dd4hep::Material scmatter = ns.material(detMatSc);
915  std::string plname = DDSplit(detector.name()).first + "Plastic_";
916  std::string scname = idName + "Scintillator" + name;
917 
918  id--;
919  dd4hep::Solid solid;
920  dd4hep::Volume glog;
921  double wid, y = 0;
922  double dx1, dx2, shiftX;
923 
924  if (type == 1) {
925  wid = 0.5 * detWidth1[id];
926  dx1 = 0.5 * detT11[id];
927  dx2 = 0.5 * detT21[id];
928  shiftX = detdP1[id];
929  if (detPosY[id] > 0)
930  y = -dy + wid;
931  } else {
932  wid = 0.5 * detWidth2[id];
933  dx1 = 0.5 * detT12[id];
934  dx2 = 0.5 * detT22[id];
935  shiftX = detdP2[id];
936  }
937 
938  solid = dd4hep::Box(ns.prepend(plname + "1"), dx1, wid, dz);
939  glog = dd4hep::Volume(solid.name(), solid, plmatter);
940 #ifdef EDM_ML_DEBUG
941  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Box made of " << plmatter.name()
942  << " of dimensions " << cms::convert2mm(dx1) << ", " << cms::convert2mm(wid) << ", "
943  << cms::convert2mm(dz);
944 #endif
945 
946  double x = shiftX + dx1 - dx;
947  detector.placeVolume(glog, 1, dd4hep::Position(x, y, 0));
948 #ifdef EDM_ML_DEBUG
949  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number 1 positioned in " << detector.name()
950  << " at (" << cms::convert2mm(x) << "," << cms::convert2mm(y)
951  << ",0) with no rotation";
952 #endif
953  solid = dd4hep::Box(ns.prepend(scname), 0.5 * detTsc[id], wid, dz);
954  glog = dd4hep::Volume(solid.name(), solid, scmatter);
955 #ifdef EDM_ML_DEBUG
956  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Box made of " << scmatter.name()
957  << " of dimensions " << cms::convert2mm(0.5 * detTsc[id]) << ", "
958  << cms::convert2mm(wid) << ", " << cms::convert2mm(dz);
959 #endif
960 
961  x += dx1 + 0.5 * detTsc[id];
962  int copyNo = id * 10 + detType[id];
963  detector.placeVolume(glog, copyNo, dd4hep::Position(x, y, 0));
964 #ifdef EDM_ML_DEBUG
965  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number " << copyNo << " positioned in "
966  << detector.name() << " at (" << cms::convert2mm(x) << "," << cms::convert2mm(y)
967  << ",0) with no rotation";
968 #endif
969  solid = dd4hep::Box(ns.prepend(plname + "2"), dx2, wid, dz);
970  glog = dd4hep::Volume(solid.name(), solid, plmatter);
971 #ifdef EDM_ML_DEBUG
972  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Box made of " << plmatter.name()
973  << " of dimensions " << cms::convert2mm(dx2) << ", " << cms::convert2mm(wid) << ", "
974  << cms::convert2mm(dz);
975 #endif
976 
977  x += 0.5 * detTsc[id] + dx2;
978  detector.placeVolume(glog, 1, dd4hep::Position(x, y, 0));
979 #ifdef EDM_ML_DEBUG
980  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number 1 positioned in " << detector.name()
981  << " at (" << cms::convert2mm(x) << "," << cms::convert2mm(y)
982  << ",0) with no rotation";
983 #endif
984  }
Log< level::Info, true > LogVerbatim
std::vector< int > detPosY
std::vector< double > detWidth1
std::string detMatPl
std::vector< double > detdP2
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:166
std::vector< double > detT11
std::vector< double > detT12
std::string detMatSc
std::vector< double > detWidth2
std::vector< int > detType
std::vector< double > detT22
std::string idName
dd4hep::Volume Volume
std::vector< double > detT21
std::vector< double > detdP1
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::vector< double > detTsc
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99

◆ constructInsideLayers()

void HcalBarrelAlgo::constructInsideLayers ( dd4hep::Volume &  laylog,
const std::string &  nm,
int  id,
int  nAbs,
double  rin,
double  d1,
double  alpha1,
double  d2,
double  alpha2,
double  t1,
double  t2,
cms::DDNamespace ns 
)
inline

Definition at line 575 of file DDHCalBarrelAlgo.cc.

References cms::convert2mm(), d1, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, mps_fire::i, versionedElectronIDProducer_cfi::idName, recoMuon::in, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), makeMuonMisalignmentScenario::rot, AlCaHLTBitMon_QueryRunRegistry::string, RandomServiceHelper::t1, RandomServiceHelper::t2, funct::tan(), and x.

586  {
587 #ifdef EDM_ML_DEBUG
588  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: \t\tInside layer " << id << "...";
589 #endif
590 
592  //Pointers to the Rotation Matrices and to the Materials
593  dd4hep::Rotation3D rot = getRotation(detRot, rotns, ns);
594 
595  std::string nam0 = nm + "In";
596  std::string name = idName + nam0;
597  dd4hep::Material matter = ns.material(detMat);
598 
599  dd4hep::Solid solid;
600  dd4hep::Volume glog, mother;
601  double rsi, dx, dy, dz, x, y;
602  int i, in;
603  //Two lower volumes
604  if (alpha1 > 0) {
605  rsi = rin + d1;
606  in = 0;
607  for (i = 0; i < rzones - 1; i++) {
608  if (rsi >= rmax[i])
609  in = i + 1;
610  }
611  dx = 0.5 * t1;
612  dy = 0.5 * rsi * (tan(alpha1) - tan(alpha2));
613  dz = 0.5 * (zoff[in] + rsi * ttheta[in]);
614  x = rsi + dx;
615  y = 0.5 * rsi * (tan(alpha1) + tan(alpha2));
616  dd4hep::Position r11(x, y, dz);
617  dd4hep::Position r12(x, -y, dz);
618 
619  solid = dd4hep::Box(ns.prepend(name + "1"), dx, dy, dz);
620 #ifdef EDM_ML_DEBUG
621  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Box made of " << matter.name()
622  << " of dimensions " << cms::convert2mm(dx) << ", " << cms::convert2mm(dy) << ", "
623  << cms::convert2mm(dz);
624 #endif
625  glog = dd4hep::Volume(solid.name(), solid, matter);
626 
627  if (nAbs != 0) {
628  mother = constructSideLayer(laylog, name, nAbs, rin, alpha1, ns);
629  } else {
630  mother = laylog;
631  }
632  mother.placeVolume(glog, idOffset + 1, r11);
633  mother.placeVolume(glog, idOffset + 2, dd4hep::Transform3D(rot, r12));
634 #ifdef EDM_ML_DEBUG
635  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number " << (idOffset + 1)
636  << " positioned in " << mother.name() << " at (" << cms::convert2mm(x) << ","
637  << cms::convert2mm(y) << "," << cms::convert2mm(dz) << ") with no rotation\n"
638  << "DDHCalBarrelAlgo: " << glog.name() << " Number " << (idOffset + 2)
639  << " positioned in " << mother.name() << " at (" << cms::convert2mm(x) << ","
640  << -cms::convert2mm(y) << "," << cms::convert2mm(dz) << ") with " << rot;
641 #endif
642  //Constructin the plastics and scintillators inside
643  constructInsideDetectors(glog, nam0 + "1", id, dx, dy, dz, 1, ns);
644  }
645 
646  //Upper volume
647  rsi = rin + d2;
648  in = 0;
649  for (i = 0; i < rzones - 1; i++) {
650  if (rsi >= rmax[i])
651  in = i + 1;
652  }
653  dx = 0.5 * t2;
654  dy = 0.5 * rsi * tan(alpha2);
655  dz = 0.5 * (zoff[in] + rsi * ttheta[in]);
656  x = rsi + dx;
657  dd4hep::Position r21(x, dy, dz);
658  dd4hep::Position r22(x, -dy, dz);
659 
660  solid = dd4hep::Box(ns.prepend(name + "2"), dx, dy, dz);
661 #ifdef EDM_ML_DEBUG
662  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Box made of " << matter.name()
663  << " of dimensions " << cms::convert2mm(dx) << ", " << cms::convert2mm(dy) << ", "
664  << cms::convert2mm(dz);
665 #endif
666  glog = dd4hep::Volume(solid.name(), solid, matter);
667 
668  if (nAbs < 0) {
669  mother = constructMidLayer(laylog, name, rin, alpha1, ns);
670  } else {
671  mother = laylog;
672  }
673  mother.placeVolume(glog, idOffset + 3, r21);
674  mother.placeVolume(glog, idOffset + 4, dd4hep::Transform3D(rot, r22));
675 #ifdef EDM_ML_DEBUG
676  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number " << (idOffset + 3)
677  << " positioned in " << mother.name() << " at (" << cms::convert2mm(x) << ","
678  << cms::convert2mm(dy) << "," << cms::convert2mm(dz)
679  << ") with no rotation\nDDHCalBarrelAlgo: " << glog.name() << " Number "
680  << (idOffset + 4) << " positioned in " << mother.name() << " at ("
681  << cms::convert2mm(x) << "," << -cms::convert2mm(dy) << "," << cms::convert2mm(dz)
682  << ") with " << rot;
683 #endif
684  //Constructin the plastics and scintillators inside
685  constructInsideDetectors(glog, nam0 + "2", id, dx, dy, dz, 2, ns);
686  }
std::vector< double > rmax
dd4hep::Volume constructMidLayer(dd4hep::Volume laylog, const std::string &nm, double rin, double alpha, cms::DDNamespace &ns)
Log< level::Info, true > LogVerbatim
dd4hep::Rotation3D getRotation(std::string &rotation, std::string &rotns, cms::DDNamespace &ns)
void constructInsideDetectors(dd4hep::Volume &detector, const std::string &name, int id, double dx, double dy, double dz, int type, cms::DDNamespace &ns)
std::string detRot
std::string rotns
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
std::string detMat
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:166
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > zoff
dd4hep::Volume constructSideLayer(dd4hep::Volume &laylog, const std::string &nm, int nAbs, double rin, double alpha, cms::DDNamespace &ns)
std::string idName
dd4hep::Volume Volume
static constexpr float d1
std::vector< double > ttheta
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99

◆ constructMidLayer()

dd4hep::Volume HcalBarrelAlgo::constructMidLayer ( dd4hep::Volume  laylog,
const std::string &  nm,
double  rin,
double  alpha,
cms::DDNamespace ns 
)
inline

Definition at line 762 of file DDHCalBarrelAlgo.cc.

References simBeamSpotPI::alpha, cms::convert2mm(), angle_units::operators::convertRadToDeg(), mps_fire::i, cuy::ii, recoMuon::in, dqmdumpme::k, dqm-mbProfile::log, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, HGCalGeometryMode::Polyhedra, cms::DDNamespace::prepend(), and AlCaHLTBitMon_QueryRunRegistry::string.

763  {
764  dd4hep::Solid solid;
765  dd4hep::Volume log, glog;
766  std::string name = nm + "Mid";
767  for (int k = 0; k < nAbsorber; k++) {
768  std::string namek = name + absorbName[k];
769  double rsi = rin + absorbD[k];
770  int in = 0;
771  for (int i = 0; i < rzones - 1; i++) {
772  if (rsi >= rmax[i])
773  in = i + 1;
774  }
775  std::vector<double> pgonZ, pgonRmin, pgonRmax;
776  // index 0
777  pgonZ.emplace_back(0.0);
778  pgonRmin.emplace_back(rsi);
779  pgonRmax.emplace_back(rsi + absorbT[k]);
780  // index 1
781  pgonZ.emplace_back(zoff[in] + rsi * ttheta[in]);
782  pgonRmin.emplace_back(rsi);
783  pgonRmax.emplace_back(pgonRmax[0]);
784  // index 2
785  pgonZ.emplace_back(zoff[in] + pgonRmax[0] * ttheta[in]);
786  pgonRmin.emplace_back(pgonRmax[1]);
787  pgonRmax.emplace_back(pgonRmax[1]);
788  solid = dd4hep::Polyhedra(ns.prepend(namek), 1, -alpha, 2 * alpha, pgonZ, pgonRmin, pgonRmax);
789  dd4hep::Material matter = ns.material(absorbMat[k]);
790  log = dd4hep::Volume(solid.name(), solid, matter);
791 #ifdef EDM_ML_DEBUG
792  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << matter.name()
793  << " with 1 sector from " << convertRadToDeg(-alpha) << " to "
794  << convertRadToDeg(alpha) << " and with " << pgonZ.size() << " sections";
795  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
796  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[ii])
797  << "\tRmin = " << cms::convert2mm(pgonRmin[ii])
798  << "\tRmax = " << cms::convert2mm(pgonRmax[ii]);
799 #endif
800 
801  laylog.placeVolume(log, 1);
802 #ifdef EDM_ML_DEBUG
803  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << log.name() << " Number 1 positioned in " << laylog.name()
804  << " at (0,0,0) with no rotation";
805 #endif
806  if (k == 0) {
807  double rmin = pgonRmin[0];
808  double rmax = pgonRmax[0];
809  dd4hep::Volume mother = log;
810  for (int i = 0; i < 1; i++) {
811  double alpha1 = atan(midW[i] / rmin);
812  std::string namek = name + midName[i];
813  solid = dd4hep::Polyhedra(ns.prepend(namek), 1, -alpha1, 2 * alpha1, pgonZ, pgonRmin, pgonRmax);
814  dd4hep::Material matter1 = ns.material(midMat[i]);
815  log = dd4hep::Volume(solid.name(), solid, matter1);
816 #ifdef EDM_ML_DEBUG
817  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of "
818  << matter1.name() << " with 1 sector from " << convertRadToDeg(-alpha1) << " to "
819  << convertRadToDeg(alpha1) << " and with " << pgonZ.size() << " sections";
820  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
821  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[ii])
822  << "\tRmin = " << cms::convert2mm(pgonRmin[ii])
823  << "\tRmax = " << cms::convert2mm(pgonRmax[ii]);
824 #endif
825 
826  mother.placeVolume(log, 1);
827 #ifdef EDM_ML_DEBUG
828  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << log.name() << " Number 1 positioned in "
829  << mother.name() << " at (0,0,0) with no rotation";
830 #endif
831  mother = log;
832  }
833 
834  // Now the layer with detectors
835  double rmid = rmin + middleD;
836  pgonRmin[0] = rmid;
837  pgonRmax[0] = rmax;
838  pgonRmin[1] = rmid;
839  pgonRmax[1] = rmax;
840  pgonZ[1] = zoff[in] + rmid * ttheta[in];
841  pgonRmin[2] = rmax;
842  pgonRmax[2] = rmax;
843  pgonZ[2] = zoff[in] + rmax * ttheta[in];
844  double alpha1 = atan(middleW / rmin);
845  solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha1, 2 * alpha1, pgonZ, pgonRmin, pgonRmax);
846  dd4hep::Material matter1 = ns.material(middleMat);
847  glog = dd4hep::Volume(solid.name(), solid, matter1);
848 #ifdef EDM_ML_DEBUG
849  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << matter1.name()
850  << " with 1 sector from " << convertRadToDeg(-alpha1) << " to "
851  << convertRadToDeg(alpha1) << " and with " << pgonZ.size() << " sections";
852  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
853  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[ii])
854  << "\tRmin = " << cms::convert2mm(pgonRmin[ii])
855  << "\tRmax = " << cms::convert2mm(pgonRmax[ii]);
856 #endif
857 
858  mother.placeVolume(glog, 1);
859 #ifdef EDM_ML_DEBUG
860  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number 1 positioned in "
861  << mother.name() << " at (0,0,0) with no rotation";
862 #endif
863  // Now the remaining absorber layers
864  for (int i = 1; i < nMidAbs; i++) {
865  namek = name + midName[i];
866  rmid = rmin + midT[i];
867  pgonRmin[0] = rmin;
868  pgonRmax[0] = rmid;
869  pgonRmin[1] = rmin;
870  pgonRmax[1] = rmid;
871  pgonZ[1] = zoff[in] + rmin * ttheta[in];
872  pgonRmin[2] = rmid;
873  pgonRmax[2] = rmid;
874  pgonZ[2] = zoff[in] + rmid * ttheta[in];
875  alpha1 = atan(midW[i] / rmin);
876  solid = dd4hep::Polyhedra(ns.prepend(namek), 1, -alpha1, 2 * alpha1, pgonZ, pgonRmin, pgonRmax);
877  dd4hep::Material matter2 = ns.material(midMat[i]);
878  log = dd4hep::Volume(solid.name(), solid, matter2);
879 #ifdef EDM_ML_DEBUG
880  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of "
881  << matter2.name() << " with 1 sector from " << convertRadToDeg(-alpha1) << " to "
882  << convertRadToDeg(alpha1) << " and with " << pgonZ.size() << " sections";
883  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
884  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[ii])
885  << "\tRmin = " << cms::convert2mm(pgonRmin[ii])
886  << "\tRmax = " << cms::convert2mm(pgonRmax[ii]);
887 #endif
888 
889  mother.placeVolume(log, i);
890 #ifdef EDM_ML_DEBUG
891  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << log.name() << " Number " << i << " positioned in "
892  << mother.name() << " at (0,0,0) with no rotation";
893 #endif
894  mother = log;
895  }
896  }
897  }
898  return glog;
899  }
std::vector< double > rmax
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
std::string middleMat
std::vector< double > absorbD
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:166
std::vector< std::string > absorbMat
std::vector< std::string > midMat
std::vector< std::string > midName
std::vector< double > absorbT
std::vector< double > zoff
dd4hep::Volume Volume
ii
Definition: cuy.py:589
std::vector< std::string > absorbName
std::vector< double > midT
std::vector< double > midW
std::vector< double > ttheta
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99

◆ constructSideLayer()

dd4hep::Volume HcalBarrelAlgo::constructSideLayer ( dd4hep::Volume &  laylog,
const std::string &  nm,
int  nAbs,
double  rin,
double  alpha,
cms::DDNamespace ns 
)
inline

Definition at line 688 of file DDHCalBarrelAlgo.cc.

References funct::abs(), simBeamSpotPI::alpha, cms::convert2mm(), angle_units::operators::convertRadToDeg(), mps_fire::i, cuy::ii, recoMuon::in, dqmdumpme::k, dqm-mbProfile::log, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, HGCalGeometryMode::Polyhedra, cms::DDNamespace::prepend(), and AlCaHLTBitMon_QueryRunRegistry::string.

689  {
690  //Extra absorber layer
691  int k = abs(nAbs) - 1;
692  std::string namek = nm + "Side";
693  double rsi = rin + sideD[k];
694  int in = 0;
695  for (int i = 0; i < rzones - 1; i++) {
696  if (rsi >= rmax[i])
697  in = i + 1;
698  }
699  std::vector<double> pgonZ, pgonRmin, pgonRmax;
700  // index 0
701  pgonZ.emplace_back(0.0);
702  pgonRmin.emplace_back(rsi);
703  pgonRmax.emplace_back(rsi + sideT[k]);
704  // index 1
705  pgonZ.emplace_back(zoff[in] + rsi * ttheta[in]);
706  pgonRmin.emplace_back(rsi);
707  pgonRmax.emplace_back(pgonRmax[0]);
708  // index 2
709  pgonZ.emplace_back(zoff[in] + pgonRmax[0] * ttheta[in]);
710  pgonRmin.emplace_back(pgonRmax[1]);
711  pgonRmax.emplace_back(pgonRmax[1]);
712  dd4hep::Solid solid = dd4hep::Polyhedra(ns.prepend(namek), 1, -alpha, 2 * alpha, pgonZ, pgonRmin, pgonRmax);
713  dd4hep::Material matter = ns.material(sideMat[k]);
714  dd4hep::Volume glog(solid.name(), solid, matter);
715 #ifdef EDM_ML_DEBUG
716  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << sideMat[k]
717  << " with 1 sector from " << convertRadToDeg(-alpha) << " to "
718  << convertRadToDeg(alpha) << " and with " << pgonZ.size() << " sections";
719  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
720  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[ii])
721  << "\tRmin = " << cms::convert2mm(pgonRmin[ii])
722  << "\tRmax = " << cms::convert2mm(pgonRmax[ii]);
723 #endif
724 
725  laylog.placeVolume(glog, 1);
726 #ifdef EDM_ML_DEBUG
727  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number 1 positioned in " << laylog.name()
728  << " at (0,0,0) with no rotation";
729 #endif
730  if (nAbs < 0) {
731  dd4hep::Volume mother = glog;
732  double rmid = pgonRmax[0];
733  for (int i = 0; i < nSideAbs; i++) {
734  double alpha1 = atan(sideAbsW[i] / rmid);
735  if (alpha1 > 0) {
736  std::string name = namek + sideAbsName[i];
737  solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha1, 2 * alpha1, pgonZ, pgonRmin, pgonRmax);
738  dd4hep::Material matter = ns.material(sideAbsMat[i]);
739  dd4hep::Volume log(solid.name(), solid, matter);
740 #ifdef EDM_ML_DEBUG
741  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << sideAbsMat[i]
742  << " with 1 sector from " << convertRadToDeg(-alpha1) << " to "
743  << convertRadToDeg(alpha1) << " and with " << pgonZ.size() << " sections";
744  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
745  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[ii])
746  << "\tRmin = " << cms::convert2mm(pgonRmin[ii])
747  << "\tRmax = " << cms::convert2mm(pgonRmax[ii]);
748 #endif
749 
750  mother.placeVolume(log, 1);
751 #ifdef EDM_ML_DEBUG
752  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << log.name() << " Number 1 positioned in "
753  << mother.name() << " at (0,0,0) with no rotation";
754 #endif
755  mother = log;
756  }
757  }
758  }
759  return glog;
760  }
std::vector< double > rmax
Log< level::Info, true > LogVerbatim
std::vector< double > sideAbsW
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:166
std::vector< std::string > sideAbsMat
std::vector< std::string > sideAbsName
std::vector< double > sideD
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > zoff
dd4hep::Volume Volume
ii
Definition: cuy.py:589
std::vector< double > sideT
std::vector< std::string > sideMat
std::vector< double > ttheta
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99

◆ getRotation()

dd4hep::Rotation3D HcalBarrelAlgo::getRotation ( std::string &  rotation,
std::string &  rotns,
cms::DDNamespace ns 
)
inline

Definition at line 986 of file DDHCalBarrelAlgo.cc.

References NAMESPACE_SEP, makeMuonMisalignmentScenario::rot, idealTransformation::rotation, cms::DDNamespace::rotation(), and AlCaHLTBitMon_QueryRunRegistry::string.

986  {
987  std::string rot = (strchr(rotation.c_str(), NAMESPACE_SEP) == nullptr) ? (rotns + ":" + rotation) : rotation;
988 #ifdef EDM_ML_DEBUG
989  edm::LogVerbatim("HCalGeom") << "getRotation: " << rotation << ":" << rot << ":" << ns.rotation(rot);
990 #endif
991  return ns.rotation(rot);
992  }
Log< level::Info, true > LogVerbatim
const dd4hep::Rotation3D & rotation(const std::string &name) const
Definition: DDNamespace.cc:182
std::string rotns
#define NAMESPACE_SEP
Definition: DDNamespace.h:92

Member Data Documentation

◆ absorbD

std::vector<double> HcalBarrelAlgo::absorbD

Definition at line 90 of file DDHCalBarrelAlgo.cc.

◆ absorbMat

std::vector<std::string> HcalBarrelAlgo::absorbMat

Definition at line 89 of file DDHCalBarrelAlgo.cc.

◆ absorbName

std::vector<std::string> HcalBarrelAlgo::absorbName

Definition at line 88 of file DDHCalBarrelAlgo.cc.

◆ absorbT

std::vector<double> HcalBarrelAlgo::absorbT

Definition at line 91 of file DDHCalBarrelAlgo.cc.

◆ detdP1

std::vector<double> HcalBarrelAlgo::detdP1

Definition at line 126 of file DDHCalBarrelAlgo.cc.

◆ detdP2

std::vector<double> HcalBarrelAlgo::detdP2

Definition at line 127 of file DDHCalBarrelAlgo.cc.

◆ detMat

std::string HcalBarrelAlgo::detMat

Definition at line 121 of file DDHCalBarrelAlgo.cc.

◆ detMatPl

std::string HcalBarrelAlgo::detMatPl

Definition at line 123 of file DDHCalBarrelAlgo.cc.

◆ detMatSc

std::string HcalBarrelAlgo::detMatSc

Definition at line 124 of file DDHCalBarrelAlgo.cc.

◆ detPosY

std::vector<int> HcalBarrelAlgo::detPosY

Definition at line 135 of file DDHCalBarrelAlgo.cc.

◆ detRot

std::string HcalBarrelAlgo::detRot

Definition at line 122 of file DDHCalBarrelAlgo.cc.

◆ detT11

std::vector<double> HcalBarrelAlgo::detT11

Definition at line 128 of file DDHCalBarrelAlgo.cc.

◆ detT12

std::vector<double> HcalBarrelAlgo::detT12

Definition at line 129 of file DDHCalBarrelAlgo.cc.

◆ detT21

std::vector<double> HcalBarrelAlgo::detT21

Definition at line 131 of file DDHCalBarrelAlgo.cc.

◆ detT22

std::vector<double> HcalBarrelAlgo::detT22

Definition at line 132 of file DDHCalBarrelAlgo.cc.

◆ detTsc

std::vector<double> HcalBarrelAlgo::detTsc

Definition at line 130 of file DDHCalBarrelAlgo.cc.

◆ detType

std::vector<int> HcalBarrelAlgo::detType

Definition at line 125 of file DDHCalBarrelAlgo.cc.

◆ detWidth1

std::vector<double> HcalBarrelAlgo::detWidth1

Definition at line 133 of file DDHCalBarrelAlgo.cc.

◆ detWidth2

std::vector<double> HcalBarrelAlgo::detWidth2

Definition at line 134 of file DDHCalBarrelAlgo.cc.

◆ genMaterial

std::string HcalBarrelAlgo::genMaterial

Definition at line 35 of file DDHCalBarrelAlgo.cc.

◆ idName

std::string HcalBarrelAlgo::idName

Definition at line 137 of file DDHCalBarrelAlgo.cc.

◆ idNameSpace

std::string HcalBarrelAlgo::idNameSpace

Definition at line 138 of file DDHCalBarrelAlgo.cc.

◆ idOffset

int HcalBarrelAlgo::idOffset

Definition at line 139 of file DDHCalBarrelAlgo.cc.

◆ layerAbsorb

std::vector<int> HcalBarrelAlgo::layerAbsorb

Definition at line 84 of file DDHCalBarrelAlgo.cc.

◆ layerAlpha

std::vector<double> HcalBarrelAlgo::layerAlpha

Definition at line 81 of file DDHCalBarrelAlgo.cc.

◆ layerD1

std::vector<double> HcalBarrelAlgo::layerD1

Definition at line 79 of file DDHCalBarrelAlgo.cc.

◆ layerD2

std::vector<double> HcalBarrelAlgo::layerD2

Definition at line 80 of file DDHCalBarrelAlgo.cc.

◆ layerGap

std::vector<double> HcalBarrelAlgo::layerGap

Definition at line 85 of file DDHCalBarrelAlgo.cc.

◆ layerId

std::vector<int> HcalBarrelAlgo::layerId

Definition at line 75 of file DDHCalBarrelAlgo.cc.

◆ layerLabel

std::vector<std::string> HcalBarrelAlgo::layerLabel

Definition at line 76 of file DDHCalBarrelAlgo.cc.

◆ layerMat

std::vector<std::string> HcalBarrelAlgo::layerMat

Definition at line 77 of file DDHCalBarrelAlgo.cc.

◆ layerT1

std::vector<double> HcalBarrelAlgo::layerT1

Definition at line 82 of file DDHCalBarrelAlgo.cc.

◆ layerT2

std::vector<double> HcalBarrelAlgo::layerT2

Definition at line 83 of file DDHCalBarrelAlgo.cc.

◆ layerWidth

std::vector<double> HcalBarrelAlgo::layerWidth

Definition at line 78 of file DDHCalBarrelAlgo.cc.

◆ middleD

double HcalBarrelAlgo::middleD

Definition at line 93 of file DDHCalBarrelAlgo.cc.

◆ middleMat

std::string HcalBarrelAlgo::middleMat

Definition at line 92 of file DDHCalBarrelAlgo.cc.

◆ middleW

double HcalBarrelAlgo::middleW

Definition at line 94 of file DDHCalBarrelAlgo.cc.

◆ midMat

std::vector<std::string> HcalBarrelAlgo::midMat

Definition at line 97 of file DDHCalBarrelAlgo.cc.

◆ midName

std::vector<std::string> HcalBarrelAlgo::midName

Definition at line 96 of file DDHCalBarrelAlgo.cc.

◆ midT

std::vector<double> HcalBarrelAlgo::midT

Definition at line 99 of file DDHCalBarrelAlgo.cc.

◆ midW

std::vector<double> HcalBarrelAlgo::midW

Definition at line 98 of file DDHCalBarrelAlgo.cc.

◆ nAbsorber

int HcalBarrelAlgo::nAbsorber

Definition at line 87 of file DDHCalBarrelAlgo.cc.

◆ nhalf

int HcalBarrelAlgo::nhalf

Definition at line 38 of file DDHCalBarrelAlgo.cc.

◆ nLayers

int HcalBarrelAlgo::nLayers

Definition at line 74 of file DDHCalBarrelAlgo.cc.

◆ nMidAbs

int HcalBarrelAlgo::nMidAbs

Definition at line 95 of file DDHCalBarrelAlgo.cc.

◆ nsectors

int HcalBarrelAlgo::nsectors

Definition at line 36 of file DDHCalBarrelAlgo.cc.

◆ nsectortot

int HcalBarrelAlgo::nsectortot

Definition at line 37 of file DDHCalBarrelAlgo.cc.

◆ nSideAbs

int HcalBarrelAlgo::nSideAbs

Definition at line 104 of file DDHCalBarrelAlgo.cc.

◆ rinner

double HcalBarrelAlgo::rinner

Definition at line 39 of file DDHCalBarrelAlgo.cc.

◆ rmax

std::vector<double> HcalBarrelAlgo::rmax

Definition at line 42 of file DDHCalBarrelAlgo.cc.

◆ rotHalf

std::string HcalBarrelAlgo::rotHalf

Definition at line 45 of file DDHCalBarrelAlgo.cc.

◆ rotns

std::string HcalBarrelAlgo::rotns

Definition at line 46 of file DDHCalBarrelAlgo.cc.

◆ router

double HcalBarrelAlgo::router

Definition at line 39 of file DDHCalBarrelAlgo.cc.

◆ rzones

int HcalBarrelAlgo::rzones

Definition at line 40 of file DDHCalBarrelAlgo.cc.

◆ sideAbsMat

std::vector<std::string> HcalBarrelAlgo::sideAbsMat

Definition at line 106 of file DDHCalBarrelAlgo.cc.

◆ sideAbsName

std::vector<std::string> HcalBarrelAlgo::sideAbsName

Definition at line 105 of file DDHCalBarrelAlgo.cc.

◆ sideAbsW

std::vector<double> HcalBarrelAlgo::sideAbsW

Definition at line 107 of file DDHCalBarrelAlgo.cc.

◆ sideD

std::vector<double> HcalBarrelAlgo::sideD

Definition at line 102 of file DDHCalBarrelAlgo.cc.

◆ sideMat

std::vector<std::string> HcalBarrelAlgo::sideMat

Definition at line 101 of file DDHCalBarrelAlgo.cc.

◆ sideT

std::vector<double> HcalBarrelAlgo::sideT

Definition at line 103 of file DDHCalBarrelAlgo.cc.

◆ theta

std::vector<double> HcalBarrelAlgo::theta

Definition at line 41 of file DDHCalBarrelAlgo.cc.

Referenced by Tau.Tau::zImpact().

◆ ttheta

std::vector<double> HcalBarrelAlgo::ttheta

Definition at line 44 of file DDHCalBarrelAlgo.cc.

◆ zoff

std::vector<double> HcalBarrelAlgo::zoff

Definition at line 43 of file DDHCalBarrelAlgo.cc.