21 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: Creating an instance";
27 const auto& thick =
args.value<
double>(
"ModuleThickness");
28 const auto& waferSize =
args.value<
double>(
"WaferSize");
29 const auto& waferSepar =
args.value<
double>(
"SensorSeparation");
33 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: Module " <<
args.parentName() <<
" made of " << material
34 <<
" T " << thick <<
" Wafer 2r " << waferSize <<
" Half Separation " << waferSepar
37 const auto&
orient =
args.value<std::vector<int> >(
"WaferOrient");
38 const auto& face =
args.value<std::vector<int> >(
"WaferFace");
39 const auto&
tag =
args.value<std::vector<std::string> >(
"WaferPlacementIndex");
40 const auto& layerNames =
args.value<std::vector<std::string> >(
"LayerNames");
41 const auto& materials =
args.value<std::vector<std::string> >(
"LayerMaterials");
42 const auto& layerThick =
args.value<std::vector<double> >(
"LayerThickness");
43 const auto& layerType =
args.value<std::vector<int> >(
"LayerTypes");
44 std::vector<int> copyNumber;
45 copyNumber.resize(materials.size(), 1);
47 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << layerNames.size() <<
" types of volumes";
48 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
49 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " << layerThick[
i]
50 <<
" filled with " << materials[
i] <<
" type " << layerType[
i];
52 const auto&
layers =
args.value<std::vector<int> >(
"Layers");
54 std::ostringstream st1;
55 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
56 st1 <<
" [" <<
i <<
"] " <<
layers[
i];
59 const auto&
nCells =
args.value<
int>(
"NCells");
61 std::vector<std::string> cellNames;
62 std::vector<int> cellOffset;
64 cellType =
args.value<
int>(
"CellType");
65 cellNames =
args.value<std::vector<std::string> >(
"CellNames");
66 cellOffset =
args.value<std::vector<int> >(
"CellOffset");
69 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: Cells/Wafer " <<
nCells <<
" Cell Type " << cellType
70 <<
" NameSpace " << ns.name() <<
" # of cells " << cellNames.size();
71 std::ostringstream st2;
72 for (
unsigned int i = 0;
i < cellOffset.size(); ++
i)
73 st2 <<
" [" <<
i <<
"] " << cellOffset[
i];
74 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << cellOffset.size() <<
" types of cells with offsets " 76 for (
unsigned int k = 0;
k < cellNames.size(); ++
k)
77 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: Cell[" <<
k <<
"] " << cellNames[
k];
79 edm::LogVerbatim(
"HGCalGeom") <<
"==>> Executing DDHGCalWaferFullRotated...";
82 static constexpr
double tol = 0.00001;
83 static const double sqrt3 =
std::sqrt(3.0);
84 double rM = 0.5 * waferSize;
85 double RM2 = rM / sqrt3;
86 double r2 = 0.5 * waferSize;
87 double R2 =
r2 / sqrt3;
89 HGCalCell wafer((waferSize + waferSepar), nFine, nCoarse);
90 for (
unsigned int k = 0;
k <
tag.size(); ++
k) {
92 std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
93 std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
94 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
95 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
99 ns.addSolidNS(ns.prepend(parentName), solid);
101 ns.addVolumeNS(glogM);
103 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << solid.name() <<
" extruded polygon made of " 104 << material <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" 105 <<
scale[0] <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" 106 <<
scale[1] <<
" and " << xM.size() <<
" edges";
107 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
112 std::vector<double> xL = {
r2, 0, -
r2, -
r2, 0,
r2};
113 std::vector<double> yL = {R2, 2 * R2, R2, -R2, -2 * R2, -R2};
114 std::vector<dd4hep::Volume> glogs(materials.size());
115 for (
unsigned int ii = 0;
ii < copyNumber.size();
ii++) {
118 double zi(-0.5 * thick), thickTot(0.0);
119 for (
unsigned int l = 0;
l <
layers.size();
l++) {
121 if (copyNumber[
i] == 1) {
122 if (layerType[
i] > 0) {
126 zw[0] = -0.5 * layerThick[
i];
127 zw[1] = 0.5 * layerThick[
i];
131 ns.addSolidNS(ns.prepend(
layerName), solid);
132 matter = ns.material(materials[
i]);
134 ns.addVolumeNS(glogs[
i]);
136 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << solid.name() <<
" extruded polygon made of " 137 << materials[
i] <<
" z|x|y|s (0) " <<
zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":" 138 <<
scale[0] <<
" z|x|y|s (1) " <<
zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":" 139 <<
scale[1] <<
" and " << xL.size() <<
" edges";
140 for (
unsigned int kk = 0;
kk < xL.size(); ++
kk)
145 glogM.placeVolume(glogs[
i], copyNumber[
i], tran0);
147 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << glogs[
i].name() <<
" number " << copyNumber[
i]
148 <<
" positioned in " << glogM.name() <<
" at " << tran0 <<
" with no rotation";
152 thickTot += layerThick[
i];
153 if ((layerType[
i] > 0) && (
nCells > 0)) {
154 for (
int u = 0; u < 2 *
nCells; ++u) {
158 std::pair<double, double> xy1 = wafer.cellUV2XY1(u,
v, placeIndex, cellType);
159 double yp = xy1.second;
160 double xp = xy1.first;
162 std::pair<int, int>
cell1 = wafer.cellUV2Cell(u,
v, placeIndex, cellType);
163 cell =
cell1.first + cellOffset[
cell1.second];
166 glogs[
i].placeVolume(ns.volume(cellNames[cell]),
copy, tran);
169 <<
"DDHGCalWaferFullRotated: " << cellNames[cell] <<
" number " <<
copy <<
" positioned in " 170 << glogs[
i].name() <<
" at " << tran <<
" with no rotation";
177 if (
std::abs(thickTot - thick) >= tol) {
178 if (thickTot > thick) {
179 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" is smaller than " << thickTot
180 <<
": thickness of all its components **** ERROR ****";
182 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" does not match with " << thickTot
183 <<
" of the components";
Log< level::Info, true > LogVerbatim
static int32_t packCellTypeUV(int type, int u, int v)
constexpr char const * layerName[numberOfLayers]
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ nCells
Log< level::Error, false > LogError
static constexpr long s_executed
Abs< T >::type abs(const T &t)
static int32_t waferFrontBack(int32_t index)
int32_t waferThick(const int32_t property)
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Log< level::Warning, false > LogWarning