21 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: Creating an instance";
27 const auto& thick =
args.value<
double>(
"ModuleThickness");
28 const auto& waferSize =
args.value<
double>(
"WaferSize");
30 const auto& waferSepar =
args.value<
double>(
"SensorSeparation");
35 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: Module " <<
args.parentName() <<
" made of " << material
36 <<
" T " << thick <<
" Wafer 2r " << waferSize <<
" Half Separation " << waferSepar
39 const auto& orient =
args.value<std::vector<int> >(
"WaferOrinet");
40 const auto& face =
args.value<std::vector<int> >(
"WaferFace");
41 const auto&
tag =
args.value<std::vector<std::string> >(
"WaferPlacementIndex");
42 const auto& layerNames =
args.value<std::vector<std::string> >(
"LayerNames");
43 const auto& materials =
args.value<std::vector<std::string> >(
"LayerMaterials");
44 const auto& layerThick =
args.value<std::vector<double> >(
"LayerThickness");
45 const auto& layerType =
args.value<std::vector<int> >(
"LayerTypes");
46 std::vector<int> copyNumber;
47 copyNumber.resize(materials.size(), 1);
49 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << layerNames.size() <<
" types of volumes";
50 for (
unsigned int i = 0;
i < layerNames.size(); ++
i)
51 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << layerNames[
i] <<
" of thickness " << layerThick[
i]
52 <<
" filled with " << materials[
i] <<
" type " << layerType[
i];
54 const auto&
layers =
args.value<std::vector<int> >(
"Layers");
56 std::ostringstream st1;
57 for (
unsigned int i = 0;
i <
layers.size(); ++
i)
58 st1 <<
" [" <<
i <<
"] " <<
layers[
i];
61 const auto&
nCells =
args.value<
int>(
"NCells");
62 const auto& cellType =
args.value<
int>(
"CellType");
63 const auto& cellNames =
args.value<std::vector<std::string> >(
"CellNames");
64 const auto& cellOffset =
args.value<std::vector<int> >(
"CellOffset");
66 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: Cells/Wafer " <<
nCells <<
" Cell Type " << cellType
67 <<
" # of cells " << cellNames.size();
68 std::ostringstream st2;
69 for (
unsigned int i = 0;
i < cellOffset.size(); ++
i)
70 st2 <<
" [" <<
i <<
"] " << cellOffset[
i];
71 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << cellOffset.size() <<
" types of cells with offsets "
73 for (
unsigned int k = 0;
k < cellNames.size(); ++
k)
74 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: Cell[" <<
k <<
"] " << cellNames[
k];
76 edm::LogVerbatim(
"HGCalGeom") <<
"==>> Executing DDHGCalWaferFullRotated...";
79 static constexpr
double tol = 0.00001;
80 static const double sqrt3 =
std::sqrt(3.0);
81 double rM = 0.5 * waferSize;
82 double RM2 = rM / sqrt3;
83 double r2 = 0.5 * waferSize;
84 double R2 = r2 / sqrt3;
86 HGCalCell wafer(waferSize, nFine, nCoarse);
87 for (
unsigned int k = 0;
k < tag.size(); ++
k) {
89 std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
90 std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
91 std::vector<double>
zw = {-0.5 * thick, 0.5 * thick};
92 std::vector<double> zx(2, 0), zy(2, 0),
scale(2, 1.0);
94 dd4hep::Material matter = ns.material(material);
96 ns.addSolidNS(ns.prepend(parentName), solid);
98 ns.addVolumeNS(glogM);
100 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << solid.name() <<
" extruded polygon made of "
101 << material <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":"
102 <<
scale[0] <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":"
103 <<
scale[1] <<
" and " << xM.size() <<
" edges";
104 for (
unsigned int kk = 0;
kk < xM.size(); ++
kk)
109 std::vector<double> xL = {
r2, 0, -
r2, -
r2, 0, r2};
110 std::vector<double> yL = {R2, 2 * R2, R2, -R2, -2 * R2, -R2};
111 std::vector<dd4hep::Volume> glogs(materials.size());
112 for (
unsigned int ii = 0;
ii < copyNumber.size();
ii++) {
115 double zi(-0.5 * thick), thickTot(0.0);
116 for (
unsigned int l = 0;
l <
layers.size();
l++) {
118 if (copyNumber[i] == 1) {
119 if (layerType[i] > 0) {
123 zw[0] = -0.5 * layerThick[
i];
124 zw[1] = 0.5 * layerThick[
i];
128 ns.addSolidNS(ns.prepend(layerName), solid);
129 matter = ns.material(materials[i]);
131 ns.addVolumeNS(glogs[i]);
133 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << solid.name() <<
" extruded polygon made of "
134 << materials[
i] <<
" z|x|y|s (0) " << zw[0] <<
":" << zx[0] <<
":" << zy[0] <<
":"
135 <<
scale[0] <<
" z|x|y|s (1) " << zw[1] <<
":" << zx[1] <<
":" << zy[1] <<
":"
136 <<
scale[1] <<
" and " << xL.size() <<
" edges";
137 for (
unsigned int kk = 0;
kk < xL.size(); ++
kk)
142 glogM.placeVolume(glogs[i], copyNumber[i], tran0);
144 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalWaferFullRotated: " << glogs[
i].name() <<
" number " << copyNumber[
i]
145 <<
" positioned in " << glogM.name() <<
" at " << tran0 <<
" with no rotation";
149 thickTot += layerThick[
i];
150 if (layerType[i] > 0) {
152 for (
int u = 0; u < 2 *
nCells; ++u) {
154 if (((
v - u) < nCells) && ((u -
v) <= nCells)) {
155 int placeIndex_ = wafer.HGCalCellPlacementIndex(1, face[
k], orient[k]);
156 std::pair<double, double> xy1 = wafer.HGCalCellUV2XY1(u,
v, placeIndex_, cellType);
157 double yp = xy1.second;
158 double xp = xy1.first;
160 std::pair<int, int> cell1 = wafer.HGCalCellUV2Cell(u,
v, placeIndex_, cellType);
161 cell = cell1.first + cellOffset[cell1.second];
164 glogs[
i].placeVolume(ns.volume(cellNames[cell]),
copy, tran);
167 <<
"DDHGCalWaferFullRotated: " << cellNames[cell] <<
" number " << copy <<
" positioned in "
168 << glogs[
i].name() <<
" at " << tran <<
" with no rotation";
175 if (
std::abs(thickTot - thick) >= tol) {
176 if (thickTot > thick) {
177 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" is smaller than " << thickTot
178 <<
": thickness of all its components **** ERROR ****";
180 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << thick <<
" does not match with " << thickTot
181 <<
" of the components";
Log< level::Info, true > LogVerbatim
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
static int32_t packCellTypeUV(int type, int u, int v)
constexpr char const * layerName[numberOfLayers]
Log< level::Error, false > LogError
static constexpr long s_executed
Abs< T >::type abs(const T &t)
int32_t waferThick(const int32_t property)
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ nCells
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Log< level::Warning, false > LogWarning