CMS 3D CMS Logo

List of all members | Public Member Functions
HGCalPassiveFull Struct Reference

Public Member Functions

 HGCalPassiveFull ()
 
 HGCalPassiveFull (cms::DDParsingContext &ctxt, xml_h e)
 

Detailed Description

Definition at line 21 of file DDHGCalPassiveFull.cc.

Constructor & Destructor Documentation

◆ HGCalPassiveFull() [1/2]

HGCalPassiveFull::HGCalPassiveFull ( )
inline

Definition at line 22 of file DDHGCalPassiveFull.cc.

References Exception.

22 { throw cms::Exception("HGCalGeom") << "Wrong initialization to HGCalPassiveFull"; }

◆ HGCalPassiveFull() [2/2]

HGCalPassiveFull::HGCalPassiveFull ( cms::DDParsingContext ctxt,
xml_h  e 
)
inline

Definition at line 23 of file DDHGCalPassiveFull.cc.

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), writedatasetfile::args, MillePedeFileConverter_cfg::e, HGCalGeometryMode::ExtrudedPolygon, mps_fire::i, GetRecoTauVFromDQM_MC_cff::kk, MainPageGenerator::l, cms::DDNamespace::material(), g4SimHits_cfi::Material, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), pfClustersFromCombinedCaloHF_cfi::scale, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, and zw().

23  {
24  cms::DDNamespace ns(ctxt, e, true);
26 #ifdef EDM_ML_DEBUG
27  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassiveFull: Creating an instance";
28 #endif
29  std::string parentName = args.parentName();
30  std::string material = args.value<std::string>("ModuleMaterial");
31  double thick = args.value<double>("ModuleThickness");
32  double waferSize = args.value<double>("WaferSize");
33  double waferSepar = args.value<double>("SensorSeparation");
34 #ifdef EDM_ML_DEBUG
35  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassiveFull: Module " << parentName << " made of " << material << " T "
36  << thick << " Wafer 2r " << waferSize << " Half Separation " << waferSepar;
37 #endif
38  std::vector<std::string> layerNames = args.value<std::vector<std::string>>("LayerNames");
39  std::vector<std::string> materials = args.value<std::vector<std::string>>("LayerMaterials");
40  std::vector<double> layerThick = args.value<std::vector<double>>("LayerThickness");
41  std::vector<int> copyNumber;
42  copyNumber.resize(materials.size(), 1);
43 #ifdef EDM_ML_DEBUG
44  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassiveFull: " << layerNames.size() << " types of volumes";
45  for (unsigned int i = 0; i < layerNames.size(); ++i)
46  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << layerNames[i] << " of thickness " << layerThick[i]
47  << " filled with " << materials[i];
48 #endif
49  std::vector<int> layerType = args.value<std::vector<int>>("LayerType");
50 #ifdef EDM_ML_DEBUG
51  std::ostringstream st1;
52  for (unsigned int i = 0; i < layerType.size(); ++i)
53  st1 << " [" << i << "] " << layerType[i];
54  edm::LogVerbatim("HGCalGeom") << "There are " << layerType.size() << " blocks" << st1.str();
55 
56  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalPassiveFull...";
57 #endif
58 
59  static constexpr double tol = 0.00001;
60  static const double sqrt3 = std::sqrt(3.0);
61  double rM = 0.5 * (waferSize + waferSepar);
62  double RM2 = rM / sqrt3;
63 
64  // First the mother
65  std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
66  std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
67  std::vector<double> zw = {-0.5 * thick, 0.5 * thick};
68  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
69  dd4hep::Solid solid = dd4hep::ExtrudedPolygon(xM, yM, zw, zx, zy, scale);
70  ns.addSolidNS(ns.prepend(parentName), solid);
71  dd4hep::Material matter = ns.material(material);
72  dd4hep::Volume glogM = dd4hep::Volume(solid.name(), solid, matter);
73  ns.addVolumeNS(glogM);
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassiveFull: " << solid.name() << " extruded polygon made of "
76  << matter.name() << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":"
77  << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":"
78  << scale[1] << " and " << xM.size() << " edges";
79  for (unsigned int kk = 0; kk < xM.size(); ++kk)
80  edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << xM[kk] << ":" << yM[kk];
81 #endif
82 
83  // Then the layers
84  std::vector<dd4hep::Volume> glogs(materials.size());
85  double zi(-0.5 * thick), thickTot(0.0);
86  for (unsigned int l = 0; l < layerType.size(); l++) {
87  unsigned int i = layerType[l];
88  if (copyNumber[i] == 1) {
89  zw[0] = -0.5 * layerThick[i];
90  zw[1] = 0.5 * layerThick[i];
91  std::string layerName = parentName + layerNames[i];
92  solid = dd4hep::ExtrudedPolygon(xM, yM, zw, zx, zy, scale);
93  ns.addSolidNS(ns.prepend(layerName), solid);
94  matter = ns.material(materials[i]);
95  glogs[i] = dd4hep::Volume(solid.name(), solid, matter);
96  ns.addVolumeNS(glogs[i]);
97 #ifdef EDM_ML_DEBUG
98  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassiveFull: Layer " << i << ":" << l << ":" << solid.name()
99  << " extruded polygon made of " << matter.name() << " z|x|y|s (0) " << zw[0]
100  << ":" << zx[0] << ":" << zy[0] << ":" << scale[0] << " z|x|y|s (1) " << zw[1]
101  << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] << " and " << xM.size()
102  << " edges";
103  for (unsigned int kk = 0; kk < xM.size(); ++kk)
104  edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << xM[kk] << ":" << yM[kk];
105 #endif
106  }
107  dd4hep::Position tran0(0, 0, (zi + 0.5 * layerThick[i]));
108  glogM.placeVolume(glogs[i], copyNumber[i], tran0);
109 #ifdef EDM_ML_DEBUG
110  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassiveFull: " << glogs[i].name() << " number " << copyNumber[i]
111  << " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
112 #endif
113  ++copyNumber[i];
114  zi += layerThick[i];
115  thickTot += layerThick[i];
116  }
117  if ((std::abs(thickTot - thick) >= tol) && (!layerType.empty())) {
118  if (thickTot > thick) {
119  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot
120  << ": thickness of all its components **** ERROR ****";
121  } else {
122  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick << " does not match with " << thickTot
123  << " of the components";
124  }
125  }
126  }
Log< level::Info, true > LogVerbatim
Log< level::Error, false > LogError
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dd4hep::Volume Volume
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:71
Log< level::Warning, false > LogWarning