9 #include "DD4hep/DetFactoryHelper.h" 24 #include <unordered_set> 32 throw cms::Exception(
"HGCalGeom") <<
"Wrong initialization to HGCalMixRotatedFineCassette";
40 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Creating an instance";
42 static constexpr double tol1 = 0.01 * dd4hep::mm;
46 waferTypes_ =
args.value<
int>(
"WaferTypes");
47 passiveTypes_ =
args.value<
int>(
"PassiveTypes");
48 facingTypes_ =
args.value<
int>(
"FacingTypes");
49 orientationTypes_ =
args.value<
int>(
"OrientationTypes");
50 partialTypes_ =
args.value<
int>(
"PartialTypes");
51 placeOffset_ =
args.value<
int>(
"PlaceOffset");
52 phiBinsScint_ =
args.value<
int>(
"NPhiBinScint");
53 phiBinsFineScint_ =
args.value<
int>(
"NPhiBinFineScint");
55 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::Number of types of wafers: " << waferTypes_
56 <<
" passives: " << passiveTypes_ <<
" facings: " << facingTypes_
57 <<
" Orientations: " << orientationTypes_ <<
" PartialTypes: " << partialTypes_
58 <<
" PlaceOffset: " << placeOffset_ <<
"; number of cells along phi " 59 << phiBinsFineScint_ <<
":" << phiBinsScint_;
61 firstFineLayer_ =
args.value<
int>(
"FirstFineLayer");
62 firstCoarseLayer_ =
args.value<
int>(
"FirstCoarseLayer");
63 absorbMode_ =
args.value<
int>(
"AbsorberMode");
64 sensitiveMode_ =
args.value<
int>(
"SensitiveMode");
65 passiveMode_ =
args.value<
int>(
"PassiveMode");
67 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::First Layers " << firstFineLayer_ <<
":" 68 << firstCoarseLayer_ <<
" and Absober:Sensitive mode " << absorbMode_ <<
":" 69 << sensitiveMode_ <<
":" << passiveMode_;
71 zMinBlock_ =
args.value<
double>(
"zMinBlock");
72 waferSize_ =
args.value<
double>(
"waferSize");
73 waferSepar_ =
args.value<
double>(
"SensorSeparation");
74 sectors_ =
args.value<
int>(
"Sectors");
75 cassettes_ =
args.value<
int>(
"Cassettes");
76 alpha_ = (1._pi) / sectors_;
77 cosAlpha_ =
cos(alpha_);
79 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: zStart " << zMinBlock_ <<
" wafer width " 80 << waferSize_ <<
" separations " << waferSepar_ <<
" sectors " << sectors_ <<
":" 81 <<
convertRadToDeg(alpha_) <<
":" << cosAlpha_ <<
" with " << cassettes_
84 slopeB_ =
args.value<std::vector<double>>(
"SlopeBottom");
85 zFrontB_ =
args.value<std::vector<double>>(
"ZFrontBottom");
86 rMinFront_ =
args.value<std::vector<double>>(
"RMinFront");
87 slopeT_ =
args.value<std::vector<double>>(
"SlopeTop");
88 zFrontT_ =
args.value<std::vector<double>>(
"ZFrontTop");
89 rMaxFront_ =
args.value<std::vector<double>>(
"RMaxFront");
91 for (
unsigned int i = 0;
i < slopeB_.size(); ++
i)
92 edm::LogVerbatim(
"HGCalGeom") <<
"Bottom Block [" <<
i <<
"] Zmin " << zFrontB_[
i] <<
" Rmin " << rMinFront_[
i]
93 <<
" Slope " << slopeB_[
i];
94 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
95 edm::LogVerbatim(
"HGCalGeom") <<
"Top Block [" <<
i <<
"] Zmin " << zFrontT_[
i] <<
" Rmax " << rMaxFront_[
i]
96 <<
" Slope " << slopeT_[
i];
98 waferFull_ =
args.value<std::vector<std::string>>(
"WaferNamesFull");
99 waferPart_ =
args.value<std::vector<std::string>>(
"WaferNamesPartial");
101 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << waferFull_.size() <<
" full and " 103 <<
" partial modules\nDDHGCalMixRotatedFineCassette:Full Modules:";
104 unsigned int i1max =
static_cast<unsigned int>(waferFull_.size());
105 for (
unsigned int i1 = 0;
i1 < i1max;
i1 += 2) {
106 std::ostringstream st1;
108 for (
unsigned int i =
i1;
i <
i2; ++
i)
109 st1 <<
" [" <<
i <<
"] " << waferFull_[
i];
112 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Partial Modules:";
113 i1max =
static_cast<unsigned int>(waferPart_.size());
114 for (
unsigned int i1 = 0;
i1 < i1max;
i1 += 2) {
115 std::ostringstream st1;
117 for (
unsigned int i =
i1;
i <
i2; ++
i)
118 st1 <<
" [" <<
i <<
"] " << waferPart_[
i];
122 passiveFull_ =
args.value<std::vector<std::string>>(
"PassiveNamesFull");
123 passivePart_ =
args.value<std::vector<std::string>>(
"PassiveNamesPartial");
125 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconRotatedCassette: " << passiveFull_.size() <<
" full and " 126 << passivePart_.size() <<
" partial passive modules";
127 i1max =
static_cast<unsigned int>(passiveFull_.size());
128 for (
unsigned int i1 = 0;
i1 < i1max;
i1 += 2) {
129 std::ostringstream st1;
131 for (
unsigned int i =
i1;
i <
i2; ++
i)
132 st1 <<
" [" <<
i <<
"] " << passiveFull_[
i];
135 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconRotatedCassette: Partial Modules:";
136 i1max =
static_cast<unsigned int>(passivePart_.size());
137 for (
unsigned int i1 = 0;
i1 < i1max;
i1 += 2) {
138 std::ostringstream st1;
140 for (
unsigned int i =
i1;
i <
i2; ++
i)
141 st1 <<
" [" <<
i <<
"] " << passivePart_[
i];
145 materials_ =
args.value<std::vector<std::string>>(
"MaterialNames");
146 names_ =
args.value<std::vector<std::string>>(
"VolumeNames");
147 thick_ =
args.value<std::vector<double>>(
"Thickness");
148 copyNumber_.resize(materials_.size(), 1);
150 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << materials_.size() <<
" types of volumes";
151 for (
unsigned int i = 0;
i < names_.size(); ++
i)
152 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
153 <<
" filled with " << materials_[
i] <<
" first copy number " << copyNumber_[
i];
155 layers_ =
args.value<std::vector<int>>(
"Layers");
156 layerThick_ =
args.value<std::vector<double>>(
"LayerThick");
158 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layers_.size() <<
" blocks";
159 for (
unsigned int i = 0;
i < layers_.size(); ++
i)
160 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] of thickness " << layerThick_[
i] <<
" with " << layers_[
i]
163 layerType_ =
args.value<std::vector<int>>(
"LayerType");
164 layerSense_ =
args.value<std::vector<int>>(
"LayerSense");
165 layerOrient_ =
args.value<std::vector<int>>(
"LayerTypes");
166 for (
unsigned int k = 0;
k < layerOrient_.size(); ++
k)
169 for (
unsigned int i = 0;
i < layerOrient_.size(); ++
i)
172 if (firstFineLayer_ > 0) {
173 for (
unsigned int i = 0;
i < layerType_.size(); ++
i) {
174 if (layerSense_[
i] != 0) {
175 int ii = layerType_[
i];
176 copyNumber_[
ii] = firstFineLayer_;
178 edm::LogVerbatim(
"HGCalGeom") <<
"First copy number for layer type " <<
i <<
":" <<
ii <<
" with " 179 << materials_[
ii] <<
" changed to " << copyNumber_[
ii];
187 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType_.size() <<
" layers";
188 for (
unsigned int i = 0;
i < layerType_.size(); ++
i)
189 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType_[
i] <<
" sensitive class " 192 materialTop_ =
args.value<std::vector<std::string>>(
"TopMaterialNames");
193 namesTop_ =
args.value<std::vector<std::string>>(
"TopVolumeNames");
194 layerThickTop_ =
args.value<std::vector<double>>(
"TopLayerThickness");
195 layerTypeTop_ =
args.value<std::vector<int>>(
"TopLayerType");
196 copyNumberTop_.resize(materialTop_.size(), firstFineLayer_);
197 coverTypeTop_ =
args.value<
int>(
"TopCoverLayerType");
198 coverTopLayers_ =
args.value<
int>(
"TopCoverLayers");
199 copyNumberCoverTop_.resize(coverTopLayers_, firstFineLayer_);
201 std::ostringstream st0;
202 for (
int k = 0;
k < coverTopLayers_; ++
k)
203 st0 <<
" " << copyNumberCoverTop_[
k];
204 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << materialTop_.size()
205 <<
" types of volumes in the top part; " << coverTopLayers_ <<
" covers of Type " 206 << coverTypeTop_ <<
" with initial copy numbers: " << st0.str();
207 for (
unsigned int i = 0;
i < materialTop_.size(); ++
i)
208 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << namesTop_[
i] <<
" of thickness " << layerThickTop_[
i]
209 <<
" filled with " << materialTop_[
i] <<
" first copy number " << copyNumberTop_[
i];
210 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerTypeTop_.size() <<
" layers in the top part";
211 for (
unsigned int i = 0;
i < layerTypeTop_.size(); ++
i)
212 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerTypeTop_[
i];
214 waferIndex_ =
args.value<std::vector<int>>(
"WaferIndex");
215 waferProperty_ =
args.value<std::vector<int>>(
"WaferProperties");
216 waferLayerStart_ =
args.value<std::vector<int>>(
"WaferLayerStart");
217 cassetteShift_ =
args.value<std::vector<double>>(
"CassetteShift");
219 edm::LogVerbatim(
"HGCalGeom") <<
"waferProperties with " << waferIndex_.size() <<
" entries in " 220 << waferLayerStart_.size() <<
" layers";
221 for (
unsigned int k = 0;
k < waferLayerStart_.size(); ++
k)
223 for (
unsigned int k = 0;
k < waferIndex_.size(); ++
k)
231 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << cassetteShift_.size()
232 <<
" elements for cassette shifts";
233 unsigned int j1max = cassetteShift_.size();
234 for (
unsigned int j1 = 0; j1 < j1max; j1 += 6) {
235 std::ostringstream st1;
236 unsigned int j2 =
std::min((j1 + 6), j1max);
237 for (
unsigned int j = j1;
j < j2; ++
j)
238 st1 <<
" [" <<
j <<
"] " << std::setw(9) << cassetteShift_[
j];
242 tileFineRMin_ =
args.value<std::vector<double>>(
"Tile6RMin");
243 tileFineRMax_ =
args.value<std::vector<double>>(
"Tile6RMax");
244 tileFineIndex_ =
args.value<std::vector<int>>(
"Tile6LayerRings");
245 tileFinePhis_ =
args.value<std::vector<int>>(
"Tile6PhiRange");
246 tileFineLayerStart_ =
args.value<std::vector<int>>(
"Tile6LayerStart");
247 tileCoarseRMin_ =
args.value<std::vector<double>>(
"TileRMin");
248 tileCoarseRMax_ =
args.value<std::vector<double>>(
"TileRMax");
249 tileCoarseIndex_ =
args.value<std::vector<int>>(
"TileLayerRings");
250 tileCoarsePhis_ =
args.value<std::vector<int>>(
"TilePhiRange");
251 tileCoarseLayerStart_ =
args.value<std::vector<int>>(
"TileLayerStart");
253 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette:: with " << tileFineRMin_.size() <<
":" 254 << tileCoarseRMin_.size() <<
" rings";
255 for (
unsigned int k = 0;
k < tileFineRMin_.size(); ++
k)
256 edm::LogVerbatim(
"HGCalGeom") <<
"Fine Ring[" <<
k <<
"] " << tileFineRMin_[
k] <<
" : " << tileFineRMax_[
k];
257 for (
unsigned int k = 0;
k < tileCoarseRMin_.size(); ++
k)
258 edm::LogVerbatim(
"HGCalGeom") <<
"Coarse Ring[" <<
k <<
"] " << tileCoarseRMin_[
k] <<
" : " << tileCoarseRMax_[
k];
259 edm::LogVerbatim(
"HGCalGeom") <<
"TileProperties with " << tileFineIndex_.size() <<
":" << tileCoarseIndex_.size()
260 <<
" entries in " << tileFineLayerStart_.size() <<
":" << tileCoarseLayerStart_.size()
262 for (
unsigned int k = 0;
k < tileFineLayerStart_.size(); ++
k)
263 edm::LogVerbatim(
"HGCalGeom") <<
"FineLayerStart[" <<
k <<
"] " << tileFineLayerStart_[
k];
264 for (
unsigned int k = 0;
k < tileCoarseLayerStart_.size(); ++
k)
265 edm::LogVerbatim(
"HGCalGeom") <<
"CoarseLayerStart[" <<
k <<
"] " << tileCoarseLayerStart_[
k];
266 for (
unsigned int k = 0;
k < tileFineIndex_.size(); ++
k)
273 for (
unsigned int k = 0;
k < tileCoarseIndex_.size(); ++
k)
281 std::vector<double> retract =
args.value<std::vector<double>>(
"ScintRetract");
282 double dphi =
M_PI / cassettes_;
283 for (
int k = 0;
k < cassettes_; ++
k) {
284 double phi = (2 *
k + 1) * dphi;
285 cassetteShiftScnt_.emplace_back(retract[
k] *
cos(phi));
286 cassetteShiftScnt_.emplace_back(retract[
k] *
sin(phi));
289 unsigned int j2max = cassetteShiftScnt_.size();
290 for (
unsigned int j1 = 0; j1 < j2max; j1 += 6) {
291 std::ostringstream st1;
292 unsigned int j2 =
std::min((j1 + 6), j2max);
293 for (
unsigned int j = j1;
j < j2; ++
j)
294 st1 <<
" [" <<
j <<
"] " << std::setw(9) << cassetteShiftScnt_[
j];
298 cassette_.setParameter(cassettes_, cassetteShift_,
false);
299 cassette_.setParameterScint(cassetteShiftScnt_);
306 edm::LogVerbatim(
"HGCalGeom") <<
"==>> Constructing DDHGCalMixRotatedFineCassette...";
310 double zi(zMinBlock_);
312 unsigned int fineLayers =
static_cast<unsigned int>(firstCoarseLayer_ - firstFineLayer_);
313 for (
unsigned int i = 0;
i < layers_.size();
i++) {
314 double zo = zi + layerThick_[
i];
316 int laymax = laymin + layers_[
i];
319 bool fine = (
i < fineLayers) ?
true :
false;
320 for (
int ly = laymin; ly < laymax; ++ly) {
321 int ii = layerType_[ly];
322 int copy = copyNumber_[
ii];
323 double hthick = 0.5 * thick_[
ii];
326 thickTot += thick_[
ii];
330 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Layer " << ly <<
":" <<
ii <<
" Front " 333 <<
" superlayer thickness " << layerThick_[
i];
337 if (layerSense_[ly] == 0) {
338 std::vector<double> pgonZ, pgonRin, pgonRout;
353 for (
unsigned int isec = 0;
isec < pgonZ.size(); ++
isec) {
355 if (layerSense_[ly] == 0 || absorbMode_ == 0)
356 pgonRout[
isec] = rmax;
358 pgonRout[
isec] = pgonRout[
isec] * cosAlpha_ - tol1;
360 dd4hep::Solid solid =
dd4hep::Polyhedra(sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
365 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << solid.name() <<
" polyhedra of " 367 <<
convertRadToDeg(-alpha_ + 2._pi) <<
" with " << pgonZ.size() <<
" sections";
368 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
373 int mode = (layerSense_[ly] > 0) ? sensitiveMode_ : absorbMode_;
376 dd4hep::Solid solid = dd4hep::Tube(rins, routs, hthick, 0.0, 2._pi);
381 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << solid.name() <<
" Tubs made of " 385 <<
", 0.0, 360.0 and positioned in: " << glog.name() <<
" number " <<
copy;
387 positionMix(ctxt,
e, glog,
name,
copy, thick_[
ii], matter, -layerSense_[ly], fine);
390 mother.placeVolume(glog,
copy, r1);
393 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << glog.name() <<
" number " <<
copy 395 <<
") with no rotation";
402 if (
std::abs(thickTot - layerThick_[
i]) >= tol2_) {
403 if (thickTot > layerThick_[
i]) {
406 <<
": thickness of all its components **** ERROR ****";
409 <<
" does not match with " <<
cms::convert2mm(thickTot) <<
" of the components";
414 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << copies_.size()
415 <<
" different wafer copy numbers";
417 for (std::unordered_set<int>::const_iterator itr = copies_.begin(); itr != copies_.end(); ++itr, ++
k) {
421 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalMixRotatedFineCassette construction...";
437 for (
unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
438 int ii = layerTypeTop_[ly];
439 copyNumberTop_[
ii] = copyM;
441 double hthick = 0.5 * thick;
442 double dphi = (fine) ? ((2._pi) / phiBinsFineScint_) : ((2._pi) / phiBinsScint_);
443 double thickTot(0), zpos(-hthick);
445 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Entry to positionMix with Name " << nameM
446 <<
" copy " << copyM <<
" Thick " << thick <<
" AbsType " << absType <<
" Fine " 450 for (
unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
451 int ii = layerTypeTop_[ly];
452 int copy = copyNumberTop_[
ii];
453 int layer = (fine) ? (
copy - firstFineLayer_) : (
copy - firstCoarseLayer_);
454 double hthickl = 0.5 * layerThickTop_[
ii];
455 thickTot += layerThickTop_[
ii];
459 int firstTile = (fine) ? tileFineLayerStart_[layer] : tileCoarseLayerStart_[layer];
460 int lastTile = (fine) ? ((layer + 1 < static_cast<int>(tileFineLayerStart_.size()))
461 ? tileFineLayerStart_[layer + 1]
462 :
static_cast<int>(tileFineIndex_.size()))
463 : ((layer + 1 <
static_cast<int>(tileCoarseLayerStart_.size()))
464 ? tileCoarseLayerStart_[layer + 1]
465 :
static_cast<int>(tileCoarseIndex_.size()));
467 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Layer " << ly <<
":" <<
ii <<
":" << layer
468 <<
" Copy " <<
copy <<
" Tiles " << firstTile <<
":" << lastTile <<
" Size " 469 << tileFineIndex_.size() <<
":" << tileCoarseIndex_.size() <<
" Fine " << fine
470 <<
" absType " << absType;
472 for (
int ti = firstTile; ti < lastTile; ++ti) {
474 int cassette, fimin, fimax;
476 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: ti " << ti <<
":" << fine <<
" index " 477 << tileFineIndex_.size() <<
":" << tileCoarseIndex_.size() <<
" Phis " 478 << tileFinePhis_.size() <<
":" << tileCoarsePhis_.size();
494 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Casstee|Fimin|Fimax " << cassette <<
":" 495 << fimin <<
":" << fimax;
497 double phi1 = dphi * (fimin - 1);
498 double phi2 = dphi * (fimax - fimin + 1);
499 auto cshift = cassette_.getShift(layer + 1, 1, cassette,
true);
506 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Layer " <<
copy <<
":" << (layer + 1)
510 <<
convertRadToDeg(phi2) <<
" cassette " << cassette <<
":" << cassette0
516 dd4hep::Solid solid = dd4hep::Tube(r1,
r2, hthickl, phi1, phi2);
521 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << glog1.name() <<
" Tubs made of " 527 glog.placeVolume(glog1,
copy, tran);
529 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Position " << glog1.name() <<
" number " 532 <<
") with no rotation";
535 ++copyNumberTop_[
ii];
538 if (
std::abs(thickTot - thick) >= tol2_) {
539 if (thickTot > thick) {
540 edm::LogError(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Thickness of the partition " 542 <<
": thickness of all its components in the top part **** ERROR ****";
544 edm::LogWarning(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Thickness of the partition " 546 <<
" of the components in top part";
550 int ii = coverTypeTop_;
551 int copy = copyNumberCoverTop_[absType - 1];
552 int layer = (fine) ? (
copy - firstFineLayer_) : (
copy - firstCoarseLayer_);
553 double hthickl = 0.5 * layerThickTop_[
ii];
557 int firstTile = (fine) ? tileFineLayerStart_[layer] : tileCoarseLayerStart_[layer];
558 int lastTile = (fine) ? (((layer + 1) <
static_cast<int>(tileFineLayerStart_.size()))
559 ? tileFineLayerStart_[layer + 1]
560 :
static_cast<int>(tileFineIndex_.size()))
561 : (((layer + 1) < static_cast<int>(tileCoarseLayerStart_.size()))
562 ? tileCoarseLayerStart_[layer + 1]
563 :
static_cast<int>(tileCoarseIndex_.size()));
565 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: TOP Layer " <<
ii <<
":" << layer <<
" Copy " 566 <<
copy <<
" Tiles " << firstTile <<
":" << lastTile <<
" Size " 567 << tileFineIndex_.size() <<
":" << tileCoarseIndex_.size() <<
" Fine " << fine
568 <<
" absType " << absType;
570 for (
int ti = firstTile; ti < lastTile; ++ti) {
572 int cassette, fimin, fimax;
574 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: ti " << ti <<
":" << fine <<
" index " 575 << tileFineIndex_.size() <<
":" << tileCoarseIndex_.size() <<
" Phis " 576 << tileFinePhis_.size() <<
":" << tileCoarsePhis_.size();
592 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Casstee|Fimin|Fimax " << cassette <<
":" 593 << fimin <<
":" << fimax;
595 double phi1 = dphi * (fimin - 1);
596 double phi2 = dphi * (fimax - fimin + 1);
597 auto cshift = cassette_.getShift(layer + 1, 1, cassette,
true);
604 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Layer " <<
copy <<
":" << (layer + 1) <<
" iR " 606 <<
" Thick " <<
cms::convert2mm(2.0 * hthickl) <<
" phi " << fimin <<
":" << fimax
608 << cassette <<
":" << cassette0 <<
" Shift " <<
cms::convert2mm(cshift.first)
613 dd4hep::Solid solid = dd4hep::Tube(r1,
r2, hthickl, phi1, phi2);
618 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << glog1.name() <<
" Tubs made of " 624 glog.placeVolume(glog1,
copy, tran);
626 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Position " << glog1.name() <<
" number " 629 <<
") with no rotation";
632 ++copyNumberCoverTop_[absType - 1];
636 int layer = (copyM - firstFineLayer_);
638 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Start bottom section for layer " << layer
639 <<
" absType " << absType;
645 for (
int k = 0;
k < cassettes_; ++
k) {
646 int cassette =
k + 1;
647 auto cshift = cassette_.getShift(layer + 1, -1, cassette);
648 double xpos = -cshift.first;
649 double ypos = cshift.second;
650 int i = layer * cassettes_ +
k;
652 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::Passive: layer " << layer + 1 <<
" cassette " 655 << passiveFull_.size() <<
":" << passivePart_.size();
657 std::string passive = (absType <= waferTypes_) ? passiveFull_[
i] : passivePart_[
i];
659 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Passive " << passive <<
" number " << cassette
664 glog.placeVolume(ns.
volume(passive), cassette, tran);
666 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << passive <<
" number " << cassette
667 <<
" positioned in " << glog.name() <<
" at (" <<
cms::convert2mm(xpos) <<
"," 672 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << kount <<
" passives of type " << absType
673 <<
" for " << glog.name();
676 static const double sqrt3 =
std::sqrt(3.0);
677 int layercenter = layerOrient_[layer];
679 int firstWafer = waferLayerStart_[layer];
681 (((layer + 1) < static_cast<int>(waferLayerStart_.size())) ? waferLayerStart_[layer + 1]
682 :
static_cast<int>(waferIndex_.size()));
683 double delx = 0.5 * (waferSize_ + waferSepar_);
684 double dely = 2.0 * delx / sqrt3;
685 double dy = 0.75 * dely;
686 const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
688 int ium(0), ivm(0), kount(0);
689 std::vector<int> ntype(3, 0);
690 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::Bottom: " << glog.name() <<
" r " 694 <<
cms::convert2mm(waferSize_ + waferSepar_) <<
" index " << firstWafer <<
":" 695 << (lastWafer - 1) <<
" Copy " << copyM <<
":" << layer;
697 for (
int k = firstWafer;
k < lastWafer; ++
k) {
713 <<
"DDHGCalMixRotatedFineCassette::index:Property:layertype:type:part:orien:cassette:place:offsets:ind " 714 <<
k << waferProperty_[
k] <<
":" << layertype <<
":" <<
type <<
":" <<
part <<
":" << orien <<
":" 715 << cassette <<
":" << place;
717 auto cshift = cassette_.getShift(layer + 1, -1, cassette,
false);
718 double xpos = xyoff.first - cshift.first + nc * delx;
719 double ypos = xyoff.second + cshift.second +
nr *
dy;
721 double xorig = xyoff.first + nc * delx;
722 double yorig = xyoff.second +
nr *
dy;
723 double angle = std::atan2(yorig, xorig);
724 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::Wafer: layer " << layer + 1 <<
" cassette " 733 i =
type * facingTypes_ * orientationTypes_ + place - placeOffset_;
735 edm::LogVerbatim(
"HGCalGeom") <<
" FullWafer type:place:ind " <<
type <<
":" << place <<
":" <<
i <<
":" 736 << waferFull_.size();
738 wafer = waferFull_[
i];
742 i = (
part - partoffset) * facingTypes_ * orientationTypes_ +
745 edm::LogVerbatim(
"HGCalGeom") <<
" layertype:type:part:orien:cassette:place:offsets:ind " << layertype <<
":" 746 <<
type <<
":" <<
part <<
":" << orien <<
":" << cassette <<
":" << place <<
":" 748 << waferPart_.size();
750 wafer = waferPart_[
i];
756 <<
copy <<
" type :part:orien:ind " <<
type <<
":" <<
part <<
":" << orien <<
":" 757 <<
i <<
" layer:u:v " << (layer + firstFineLayer_) <<
":" << u <<
":" <<
v;
763 if (copies_.count(
copy) == 0)
764 copies_.insert(
copy);
767 glog.placeVolume(ns.
volume(wafer),
copy, tran);
770 edm::LogVerbatim(
"HGCalGeom") <<
" DDHGCalMixRotatedFineCassette: " << wafer <<
" number " <<
copy <<
" type " 771 << layertype <<
":" <<
type <<
" positioned in " << glog.name() <<
" at (" 773 <<
",0) with no rotation";
777 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Maximum # of u " << ium <<
" # of v " << ivm
778 <<
" and " << kount <<
" wafers (" << ntype[0] <<
":" << ntype[1] <<
":" << ntype[2]
779 <<
") for " << glog.name();
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
static constexpr int32_t WaferPartLDOffset
HGCalGeomTools geomTools_
std::vector< double > tileCoarseRMax_
std::vector< double > tileCoarseRMin_
std::vector< std::string > namesTop_
static constexpr int32_t WaferTypeOffset[3]
std::vector< std::string > waferFull_
std::vector< int > layerTypeTop_
std::vector< double > rMaxFront_
HGCalMixRotatedFineCassette(cms::DDParsingContext &ctxt, xml_h e)
std::vector< double > zFrontB_
int32_t waferU(const int32_t index)
std::vector< int > tileFineLayerStart_
int32_t waferLayer(const int32_t index)
std::vector< int > tileFineIndex_
constexpr NumType convertRadToDeg(NumType radians)
constexpr NumType convert2mm(NumType length)
Sin< T >::type sin(const T &t)
std::vector< int > waferIndex_
HGCalMixRotatedFineCassette()
std::vector< double > slopeB_
std::vector< double > cassetteShiftScnt_
std::unordered_set< int > copies_
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
std::vector< int > waferLayerStart_
std::vector< int > tileFinePhis_
Log< level::Error, false > LogError
std::vector< int > tileCoarsePhis_
std::vector< std::string > waferPart_
dd4hep::Material material(const std::string &name) const
int32_t waferOrient(const int32_t property)
std::vector< double > layerThick_
std::vector< std::string > names_
static std::string to_string(const XMLCh *ch)
std::vector< int > copyNumberTop_
std::vector< int > tileCoarseIndex_
int32_t waferCassette(const int32_t property)
#define DECLARE_DDCMS_DETELEMENT(name, func)
static constexpr int32_t WaferFull
std::vector< int > layerType_
static constexpr long s_executed
Cos< T >::type cos(const T &t)
void positionMix(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, const std::string &nameM, int copyM, double thick, const dd4hep::Material &matter, int absType, bool fine)
Abs< T >::type abs(const T &t)
std::vector< double > cassetteShift_
int32_t waferThick(const int32_t property)
std::vector< int > tileCoarseLayerStart_
std::vector< std::string > passivePart_
std::tuple< int32_t, int32_t, int32_t > tileUnpack(int32_t index)
static constexpr int32_t WaferPartHDOffset
std::vector< int > waferProperty_
std::vector< int > copyNumber_
std::vector< int > layerSense_
std::vector< std::string > passiveFull_
std::vector< double > tileFineRMin_
int32_t waferPartial(const int32_t property)
std::vector< double > layerThickTop_
std::vector< double > slopeT_
std::vector< double > thick_
int32_t waferV(const int32_t index)
std::vector< std::string > materialTop_
std::vector< int > layers_
static int32_t packTypeUV(int type, int u, int v)
static constexpr int32_t WaferHDTop
std::vector< int > layerOrient_
std::vector< double > tileFineRMax_
Log< level::Warning, false > LogWarning
static int32_t layerType(int type)
std::vector< int > copyNumberCoverTop_
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
std::vector< std::string > materials_
dd4hep::Volume volume(const std::string &name, bool exc=true) const
static int cassetteType(int det, int zside, int cassette)
std::vector< double > rMinFront_
std::vector< double > zFrontT_
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
std::string prepend(const std::string &) const
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
static constexpr int32_t layerFrontBack(int32_t layerOrient)