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 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, gpuPixelDoublets::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  int nsec = 2;
469  std::vector<double> pgonZ, pgonRmin, pgonRmax;
470  // index 0
471  pgonZ.emplace_back(0);
472  pgonRmin.emplace_back(rin);
473  pgonRmax.emplace_back(rout);
474  // index 1
475  pgonZ.emplace_back(zout);
476  pgonRmin.emplace_back(rin);
477  pgonRmax.emplace_back(rout);
478  if (in == out) {
479  if (in <= 3) {
480  //index 2
481  pgonZ.emplace_back(zoff[in] + rout * ttheta[in]);
482  pgonRmin.emplace_back(pgonRmax[1]);
483  pgonRmax.emplace_back(pgonRmax[1]);
484  nsec++;
485  }
486  } else {
487  if (in == 3) {
488  //redo index 1, add index 2
489  pgonZ[1] = (zoff[out] + rmax[out] * ttheta[out]);
490  pgonZ.emplace_back(pgonZ[1]);
491  pgonRmin.emplace_back(pgonRmin[1]);
492  pgonRmax.emplace_back(rmax[in]);
493  //index 3
494  pgonZ.emplace_back(zoff[in] + rmax[in] * ttheta[in]);
495  pgonRmin.emplace_back(pgonRmin[2]);
496  pgonRmax.emplace_back(pgonRmax[2]);
497  nsec += 2;
498  } else {
499  //index 2
500  pgonZ.emplace_back(zoff[in] + rmax[in] * ttheta[in]);
501  pgonRmin.emplace_back(rmax[in]);
502  pgonRmax.emplace_back(pgonRmax[1]);
503  nsec++;
504  if (in == 0) {
505  pgonZ.emplace_back(zoff[out] + rmax[in] * ttheta[out]);
506  pgonRmin.emplace_back(pgonRmin[2]);
507  pgonRmax.emplace_back(pgonRmax[2]);
508  nsec++;
509  }
510  if (in <= 1) {
511  pgonZ.emplace_back(zoff[out] + rout * ttheta[out]);
512  pgonRmin.emplace_back(rout);
513  pgonRmax.emplace_back(rout);
514  nsec++;
515  }
516  }
517  }
518  //Solid & volume
519  dd4hep::Solid solid;
520  double alpha1 = alpha;
521  if (layerGap[i] > 1.e-6) {
522  double rmid = 0.5 * (rin + rout);
523  double width = rmid * tan(alpha) - layerGap[i];
524  alpha1 = atan(width / rmid);
525 #ifdef EDM_ML_DEBUG
526  edm::LogVerbatim("HCalGeom") << "\tAlpha_1 modified from " << convertRadToDeg(alpha) << " to "
527  << convertRadToDeg(alpha1) << " Rmid " << cms::convert2mm(rmid)
528  << " Reduced width " << cms::convert2mm(width);
529 #endif
530  }
531  solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha1, 2 * alpha1, pgonZ, pgonRmin, pgonRmax);
532  dd4hep::Volume glog(solid.name(), solid, matter);
533 #ifdef EDM_ML_DEBUG
534  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " (Layer " << i << ") Polyhedra made of "
535  << matter.name() << " with 1 sector from " << convertRadToDeg(-alpha1) << " to "
536  << convertRadToDeg(alpha1) << " and with " << nsec << " sections";
537  for (unsigned int k = 0; k < pgonZ.size(); k++)
538  edm::LogVerbatim("HCalGeom") << "\t\t" << cms::convert2mm(pgonZ[k]) << "\t" << cms::convert2mm(pgonRmin[k])
539  << "\t" << cms::convert2mm(pgonRmax[k]);
540 #endif
541 
542  seclogic.placeVolume(glog, layerId[i]);
543 #ifdef EDM_ML_DEBUG
544  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " number " << layerId[i]
545  << " positioned in " << seclogic.name() << " at (0,0,0) with no rotation";
546 #endif
548  layerLabel[i],
549  layerId[i],
550  layerAbsorb[i],
551  rin,
552  layerD1[i],
553  alpha1,
554  layerD2[i],
555  layerAlpha[i],
556  layerT1[i],
557  layerT2[i],
558  ns);
559  rin = rout;
560  }
561  }
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)
float alpha
Definition: AMPTWrapper.h:105
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
__shared__ uint32_t ntot
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 889 of file DDHCalBarrelAlgo.cc.

References cms::convert2mm(), DDSplit(), hgcalTestNeighbor_cfi::detector, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, 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.

896  {
897 #ifdef EDM_ML_DEBUG
898  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: \t\tInside detector " << id << "...";
899 #endif
900 
901  dd4hep::Material plmatter = ns.material(detMatPl);
902  dd4hep::Material scmatter = ns.material(detMatSc);
903  std::string plname = DDSplit(detector.name()).first + "Plastic_";
904  std::string scname = idName + "Scintillator" + name;
905 
906  id--;
907  dd4hep::Solid solid;
908  dd4hep::Volume glog;
909  double wid, y = 0;
910  double dx1, dx2, shiftX;
911 
912  if (type == 1) {
913  wid = 0.5 * detWidth1[id];
914  dx1 = 0.5 * detT11[id];
915  dx2 = 0.5 * detT21[id];
916  shiftX = detdP1[id];
917  if (detPosY[id] > 0)
918  y = -dy + wid;
919  } else {
920  wid = 0.5 * detWidth2[id];
921  dx1 = 0.5 * detT12[id];
922  dx2 = 0.5 * detT22[id];
923  shiftX = detdP2[id];
924  }
925 
926  solid = dd4hep::Box(ns.prepend(plname + "1"), dx1, wid, dz);
927  glog = dd4hep::Volume(solid.name(), solid, plmatter);
928 #ifdef EDM_ML_DEBUG
929  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Box made of " << plmatter.name()
930  << " of dimensions " << cms::convert2mm(dx1) << ", " << cms::convert2mm(wid) << ", "
931  << cms::convert2mm(dz);
932 #endif
933 
934  double x = shiftX + dx1 - dx;
935  detector.placeVolume(glog, 1, dd4hep::Position(x, y, 0));
936 #ifdef EDM_ML_DEBUG
937  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number 1 positioned in " << detector.name()
938  << " at (" << cms::convert2mm(x) << "," << cms::convert2mm(y)
939  << ",0) with no rotation";
940 #endif
941  solid = dd4hep::Box(ns.prepend(scname), 0.5 * detTsc[id], wid, dz);
942  glog = dd4hep::Volume(solid.name(), solid, scmatter);
943 #ifdef EDM_ML_DEBUG
944  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Box made of " << scmatter.name()
945  << " of dimensions " << cms::convert2mm(0.5 * detTsc[id]) << ", "
946  << cms::convert2mm(wid) << ", " << cms::convert2mm(dz);
947 #endif
948 
949  x += dx1 + 0.5 * detTsc[id];
950  int copyNo = id * 10 + detType[id];
951  detector.placeVolume(glog, copyNo, dd4hep::Position(x, y, 0));
952 #ifdef EDM_ML_DEBUG
953  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number " << copyNo << " positioned in "
954  << detector.name() << " at (" << cms::convert2mm(x) << "," << cms::convert2mm(y)
955  << ",0) with no rotation";
956 #endif
957  solid = dd4hep::Box(ns.prepend(plname + "2"), dx2, wid, dz);
958  glog = dd4hep::Volume(solid.name(), solid, plmatter);
959 #ifdef EDM_ML_DEBUG
960  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Box made of " << plmatter.name()
961  << " of dimensions " << cms::convert2mm(dx2) << ", " << cms::convert2mm(wid) << ", "
962  << cms::convert2mm(dz);
963 #endif
964 
965  x += 0.5 * detTsc[id] + dx2;
966  detector.placeVolume(glog, 1, dd4hep::Position(x, y, 0));
967 #ifdef EDM_ML_DEBUG
968  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number 1 positioned in " << detector.name()
969  << " at (" << cms::convert2mm(x) << "," << cms::convert2mm(y)
970  << ",0) with no rotation";
971 #endif
972  }
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 563 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.

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

References 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.

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

References funct::abs(), 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.

677  {
678  //Extra absorber layer
679  int k = abs(nAbs) - 1;
680  std::string namek = nm + "Side";
681  double rsi = rin + sideD[k];
682  int in = 0;
683  for (int i = 0; i < rzones - 1; i++) {
684  if (rsi >= rmax[i])
685  in = i + 1;
686  }
687  std::vector<double> pgonZ, pgonRmin, pgonRmax;
688  // index 0
689  pgonZ.emplace_back(0.0);
690  pgonRmin.emplace_back(rsi);
691  pgonRmax.emplace_back(rsi + sideT[k]);
692  // index 1
693  pgonZ.emplace_back(zoff[in] + rsi * ttheta[in]);
694  pgonRmin.emplace_back(rsi);
695  pgonRmax.emplace_back(pgonRmax[0]);
696  // index 2
697  pgonZ.emplace_back(zoff[in] + pgonRmax[0] * ttheta[in]);
698  pgonRmin.emplace_back(pgonRmax[1]);
699  pgonRmax.emplace_back(pgonRmax[1]);
700  dd4hep::Solid solid = dd4hep::Polyhedra(ns.prepend(namek), 1, -alpha, 2 * alpha, pgonZ, pgonRmin, pgonRmax);
701  dd4hep::Material matter = ns.material(sideMat[k]);
702  dd4hep::Volume glog(solid.name(), solid, matter);
703 #ifdef EDM_ML_DEBUG
704  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << sideMat[k]
705  << " with 1 sector from " << convertRadToDeg(-alpha) << " to "
706  << convertRadToDeg(alpha) << " and with " << pgonZ.size() << " sections";
707  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
708  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[ii])
709  << "\tRmin = " << cms::convert2mm(pgonRmin[ii])
710  << "\tRmax = " << cms::convert2mm(pgonRmax[ii]);
711 #endif
712 
713  laylog.placeVolume(glog, 1);
714 #ifdef EDM_ML_DEBUG
715  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << glog.name() << " Number 1 positioned in " << laylog.name()
716  << " at (0,0,0) with no rotation";
717 #endif
718  if (nAbs < 0) {
719  dd4hep::Volume mother = glog;
720  double rmid = pgonRmax[0];
721  for (int i = 0; i < nSideAbs; i++) {
722  double alpha1 = atan(sideAbsW[i] / rmid);
723  if (alpha1 > 0) {
724  std::string name = namek + sideAbsName[i];
725  solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha1, 2 * alpha1, pgonZ, pgonRmin, pgonRmax);
726  dd4hep::Material matter = ns.material(sideAbsMat[i]);
727  dd4hep::Volume log(solid.name(), solid, matter);
728 #ifdef EDM_ML_DEBUG
729  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << solid.name() << " Polyhedra made of " << sideAbsMat[i]
730  << " with 1 sector from " << convertRadToDeg(-alpha1) << " to "
731  << convertRadToDeg(alpha1) << " and with " << pgonZ.size() << " sections";
732  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
733  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[ii])
734  << "\tRmin = " << cms::convert2mm(pgonRmin[ii])
735  << "\tRmax = " << cms::convert2mm(pgonRmax[ii]);
736 #endif
737 
738  mother.placeVolume(log, 1);
739 #ifdef EDM_ML_DEBUG
740  edm::LogVerbatim("HCalGeom") << "DDHCalBarrelAlgo: " << log.name() << " Number 1 positioned in "
741  << mother.name() << " at (0,0,0) with no rotation";
742 #endif
743  mother = log;
744  }
745  }
746  }
747  return glog;
748  }
std::vector< double > rmax
Log< level::Info, true > LogVerbatim
std::vector< double > sideAbsW
float alpha
Definition: AMPTWrapper.h:105
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 974 of file DDHCalBarrelAlgo.cc.

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

974  {
975  std::string rot = (strchr(rotation.c_str(), NAMESPACE_SEP) == nullptr) ? (rotns + ":" + rotation) : rotation;
976 #ifdef EDM_ML_DEBUG
977  edm::LogVerbatim("HCalGeom") << "getRotation: " << rotation << ":" << rot << ":" << ns.rotation(rot);
978 #endif
979  return ns.rotation(rot);
980  }
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.