25 const auto& thick =
args.value<
double>(
"ModuleThickness");
26 const auto& waferSize =
args.value<
double>(
"WaferSize");
29 const auto& waferSepar =
args.value<
double>(
"SensorSeparation");
30 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferF: Module " << motherName <<
" made of " << material <<
" T " 35 const auto& layerNames =
args.value<std::vector<std::string>>(
"LayerNames");
36 const auto& materials =
args.value<std::vector<std::string>>(
"LayerMaterials");
37 const auto& layerThick =
args.value<std::vector<double>>(
"LayerThickness");
38 const auto& layerType =
args.value<std::vector<int>>(
"LayerTypes");
39 std::vector<int> copyNumber(materials.size(), 1);
41 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferF: " << layerNames.size() <<
" types of volumes";
42 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
43 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " 47 const auto&
layers =
args.value<std::vector<int>>(
"Layers");
49 std::ostringstream st1;
50 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
51 st1 <<
" [" <<
i <<
"] " <<
layers[
i];
54 const auto&
nCells =
args.value<
int>(
"NCells");
55 const auto& cellTypeX =
args.value<
int>(
"CellType");
56 const auto& cellNames =
args.value<std::vector<std::string>>(
"CellNames");
59 <<
" NameSpace " << ns.name() <<
" # of cells " << cellNames.size();
60 for (
unsigned int k = 0;
k < cellNames.size(); ++
k)
65 static constexpr double tol = 0.00001 * dd4hep::mm;
66 static const double sqrt3 =
std::sqrt(3.0);
67 double rM = 0.5 * waferSize;
68 double RM2 = rM / sqrt3;
69 double R = waferSize / (3.0 *
nCells);
70 double r = 0.5 *
R * sqrt3;
71 double r2 = 0.5 * waferSize;
72 double R2 =
r2 / sqrt3;
75 std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
76 std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
77 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
78 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
82 ns.addSolidNS(ns.prepend(motherName), solid);
84 ns.addVolumeNS(glogM);
86 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferF: " << solid.name() <<
" extruded polygon made of " << material
91 for (
unsigned int k = 0;
k < xM.size(); ++
k)
97 std::vector<double> xL = {
r2, 0, -
r2, -
r2, 0,
r2};
98 std::vector<double> yL = {R2, 2 * R2, R2, -R2, -2 * R2, -R2};
99 std::vector<dd4hep::Volume> glogs(materials.size());
100 double zi(-0.5 * thick), thickTot(0.0);
101 for (
unsigned int l = 0;
l <
layers.size();
l++) {
103 if (copyNumber[
i] == 1) {
104 if (layerType[
i] > 0) {
108 zw[0] = -0.5 * layerThick[
i];
109 zw[1] = 0.5 * layerThick[
i];
112 ns.addSolidNS(ns.prepend(layerNames[
i]), solid);
113 matter = ns.material(materials[
i]);
115 ns.addVolumeNS(glogs[
i]);
117 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferF: " << solid.name() <<
" extruded polygon made of " << materials[
i]
122 for (
unsigned int k = 0;
k < xL.size(); ++
k)
127 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
129 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferF: " << glogs[
i].name() <<
" number " << copyNumber[
i]
130 <<
" positioned in " << glogM.name() <<
" at (0,0," 135 thickTot += layerThick[
i];
137 if (layerType[
i] > 0) {
139 double y0 = (cellTypeX >= 3) ? 0.5 : 0.0;
140 double x0 = (cellTypeX >= 3) ? 0.5 : 1.0;
141 int voff = (cellTypeX >= 3) ? 0 : 1;
143 int cellType = (cellTypeX >= 3) ? (cellTypeX - 3) : cellTypeX;
144 for (
int u = 0; u < 2 *
nCells; ++u) {
150 double yp = (u - 0.5 *
v - n2 + y0) * 2 *
r;
151 double xp = (1.5 * (
v -
nCells) + x0) *
R;
153 if ((u == 0) && (
v == 0))
155 else if ((u == 0) && (
v ==
nCells - 1))
163 else if ((u ==
nCells) && (
v == 0))
167 else if ((
v - u) == (
nCells - 1))
169 else if (
v == (2 *
nCells - 1))
171 else if (u == (2 *
nCells - 1))
179 glogs[
i].placeVolume(ns.volume(cellNames[cell]),
copy, dd4hep::Transform3D(
rotation, tran));
182 <<
"DDHGCalWaferF: " << cellNames[cell] <<
" number " <<
copy <<
" positioned in " << glogs[
i].name()
191 edm::LogVerbatim(
"HGCalGeom") <<
"\nDDHGCalWaferF::Counter : " <<
counter <<
"\n===============================\n";
193 if (
std::abs(thickTot - thick) >= tol) {
194 if (thickTot > thick) {
195 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" is smaller than " << thickTot
196 <<
": thickness of all its components **** ERROR ****";
198 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" does not match with " << thickTot
199 <<
" of the components";
Log< level::Info, true > LogVerbatim
static int32_t packCellTypeUV(int type, int u, int v)
constexpr NumType convert2mm(NumType length)
Log< level::Error, false > LogError
static constexpr long s_executed
Abs< T >::type abs(const T &t)
int32_t waferThick(const int32_t property)
ALPAKA_FN_ACC ALPAKA_FN_INLINE void uint32_t const uint32_t CACellT< TrackerTraits > uint32_t * nCells
static std::atomic< unsigned int > counter
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Log< level::Warning, false > LogWarning