CMS 3D CMS Logo

Functions
DDHGCalWafer8.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Geometry/HGCalCommonData/interface/HGCalTypes.h"

Go to the source code of this file.

Functions

static long algorithm (dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_hgcal_DDHGCalWafer8)
 

Function Documentation

◆ algorithm()

static long algorithm ( dd4hep::Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e 
)
static

Definition at line 16 of file DDHGCalWafer8.cc.

16  {
17  cms::DDNamespace ns(ctxt, e, true);
19  std::string motherName = args.parentName();
20  auto waferSize = args.value<double>("WaferSize");
21  auto waferT = args.value<double>("WaferThick");
22  auto waferSepar = args.value<double>("SensorSeparation");
23  auto nCells = args.value<int>("NCells");
24  auto cellType = args.value<int>("CellType");
25  auto material = args.value<std::string>("Material");
26  auto cellNames = args.value<std::vector<std::string>>("CellNames");
27 
28 #ifdef EDM_ML_DEBUG
29  edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Wafer 2r " << waferSize << " T " << waferT << " Half Separation "
30  << waferSepar << " Cells/Wafer " << nCells << " Cell Type " << cellType << " Material "
31  << material << " Names " << motherName << " NameSpace " << ns.name() << " # of cells "
32  << cellNames.size();
33  for (unsigned int k = 0; k < cellNames.size(); ++k)
34  edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Cell[" << k << "] " << cellNames[k];
35 #endif
36 
37  static const double sqrt3 = std::sqrt(3.0);
38  double rM = 0.5 * (waferSize + waferSepar);
39  double RM2 = rM / sqrt3;
40  double R = waferSize / (3.0 * nCells);
41  double r = 0.5 * R * sqrt3;
42 
43  // Mother Wafer
44  std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
45  std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
46  std::vector<double> zw = {-0.5 * waferT, 0.5 * waferT};
47  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
48 
49  dd4hep::Material matter = ns.material(material);
50 
51  dd4hep::Solid solid = dd4hep::ExtrudedPolygon(xM, yM, zw, zx, zy, scale);
52  ns.addSolidNS(ns.prepend(motherName), solid);
53  dd4hep::Volume glog = dd4hep::Volume(solid.name(), solid, matter);
54  ns.addVolumeNS(glog);
55 #ifdef EDM_ML_DEBUG
56  edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: " << solid.name() << " extruded polygon made of " << material
57  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
58  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
59  << " and " << xM.size() << " edges";
60  for (unsigned int k = 0; k < xM.size(); ++k)
61  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xM[k] << ":" << yM[k];
62 #endif
63 
64  dd4hep::Rotation3D rotation;
65 #ifdef EDM_ML_DEBUG
66  int counter(0);
67 #endif
68  for (int u = 0; u < 2 * nCells; ++u) {
69  for (int v = 0; v < 2 * nCells; ++v) {
70  if (((v - u) < nCells) && (u - v) <= nCells) {
71 #ifdef EDM_ML_DEBUG
72  counter++;
73 #endif
74  int n2 = nCells / 2;
75  double yp = (u - 0.5 * v - n2) * 2 * r;
76  double xp = (1.5 * (v - nCells) + 1.0) * R;
77  int cell(0);
78  if ((u == 0) && (v == 0))
79  cell = 7;
80  else if ((u == 0) && (v == nCells - 1))
81  cell = 8;
82  else if ((u == nCells) && (v == 2 * nCells - 1))
83  cell = 9;
84  else if ((u == 2 * nCells - 1) && (v == 2 * nCells - 1))
85  cell = 10;
86  else if ((u == 2 * nCells - 1) && (v == nCells - 1))
87  cell = 11;
88  else if ((u == nCells) && (v == 0))
89  cell = 12;
90  else if (u == 0)
91  cell = 1;
92  else if ((v - u) == (nCells - 1))
93  cell = 4;
94  else if (v == (2 * nCells - 1))
95  cell = 2;
96  else if (u == (2 * nCells - 1))
97  cell = 5;
98  else if ((u - v) == nCells)
99  cell = 3;
100  else if (v == 0)
101  cell = 6;
102  dd4hep::Position tran(xp, yp, 0);
103  int copy = HGCalTypes::packCellTypeUV(cellType, u, v);
104  glog.placeVolume(ns.volume(cellNames[cell]), copy, dd4hep::Transform3D(rotation, tran));
105 #ifdef EDM_ML_DEBUG
106  edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: " << cellNames[cell] << " number " << copy << " position in "
107  << glog.name() << " at " << tran << " with " << rotation;
108 #endif
109  }
110  }
111  }
112 #ifdef EDM_ML_DEBUG
113  edm::LogVerbatim("HGCalGeom") << "\nDDHGCalWafer8::Counter : " << counter << "\n===============================\n";
114 #endif
115 
116  return cms::s_executed;
117 }

References cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), writedatasetfile::args, filterCSVwithJSON::copy, counter, MillePedeFileConverter_cfg::e, HGCalGeometryMode::ExtrudedPolygon, dqmdumpme::k, cms::DDNamespace::material(), g4SimHits_cfi::Material, cms::DDNamespace::name(), HGCalTypes::packCellTypeUV(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), dttmaxenums::R, alignCSCRings::r, idealTransformation::rotation, cms::s_executed, L1EGammaCrystalsEmulatorProducer_cfi::scale, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, findQualityFiles::v, cms::DDNamespace::volume(), and zw().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hgcal_DDHGCalWafer8   
)

Definition at line 120 of file DDHGCalWafer8.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
counter
Definition: counter.py:1
g4SimHits_cfi.Material
Material
Definition: g4SimHits_cfi.py:560
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
cms::DDNamespace
Definition: DDNamespace.h:16
findQualityFiles.v
v
Definition: findQualityFiles.py:179
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HGCalTypes::packCellTypeUV
static int32_t packCellTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:28
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:17
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
HGCalGeometryMode::ExtrudedPolygon
Definition: HGCalGeometryMode.h:35
zw
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:75
edm::Log
Definition: MessageLogger.h:70
dttmaxenums::R
Definition: DTTMax.h:29
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37