31 #include <unordered_set> 133 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Creating an instance";
142 waferTypes_ =
static_cast<int>(nArgs[
"WaferTypes"]);
143 passiveTypes_ =
static_cast<int>(nArgs[
"PassiveTypes"]);
144 facingTypes_ =
static_cast<int>(nArgs[
"FacingTypes"]);
145 orientationTypes_ =
static_cast<int>(nArgs[
"OrientationTypes"]);
146 partialTypes_ =
static_cast<int>(nArgs[
"PartialTypes"]);
147 placeOffset_ =
static_cast<int>(nArgs[
"PlaceOffset"]);
148 phiBinsScint_ =
static_cast<int>(nArgs[
"NPhiBinScint"]);
149 phiBinsFineScint_ =
static_cast<int>(nArgs[
"NPhiBinFineScint"]);
151 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::Number of types of wafers: " << waferTypes_
152 <<
" passives: " << passiveTypes_ <<
" facings: " << facingTypes_
153 <<
" Orientations: " << orientationTypes_ <<
" PartialTypes: " << partialTypes_
154 <<
" PlaceOffset: " << placeOffset_ <<
"; number of cells along phi " 155 << phiBinsFineScint_ <<
":" << phiBinsScint_;
157 firstFineLayer_ =
static_cast<int>(nArgs[
"FirstFineLayer"]);
158 firstCoarseLayer_ =
static_cast<int>(nArgs[
"FirstCoarseLayer"]);
159 absorbMode_ =
static_cast<int>(nArgs[
"AbsorberMode"]);
160 sensitiveMode_ =
static_cast<int>(nArgs[
"SensitiveMode"]);
161 passiveMode_ =
static_cast<int>(nArgs[
"PassiveMode"]);
163 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::First Layers " << firstFineLayer_ <<
":" 164 << firstCoarseLayer_ <<
" and Absober:Sensitive mode " << absorbMode_ <<
":" 165 << sensitiveMode_ <<
":" << passiveMode_;
167 zMinBlock_ = nArgs[
"zMinBlock"];
168 waferSize_ = nArgs[
"waferSize"];
169 waferSepar_ = nArgs[
"SensorSeparation"];
170 sectors_ =
static_cast<int>(nArgs[
"Sectors"]);
171 cassettes_ =
static_cast<int>(nArgs[
"Cassettes"]);
172 alpha_ = (1._pi) / sectors_;
173 cosAlpha_ =
cos(alpha_);
175 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: zStart " << zMinBlock_ <<
" wafer width " 176 << waferSize_ <<
" separations " << waferSepar_ <<
" sectors " << sectors_ <<
":" 177 <<
convertRadToDeg(alpha_) <<
":" << cosAlpha_ <<
" with " << cassettes_
180 slopeB_ = vArgs[
"SlopeBottom"];
181 zFrontB_ = vArgs[
"ZFrontBottom"];
182 rMinFront_ = vArgs[
"RMinFront"];
183 slopeT_ = vArgs[
"SlopeTop"];
184 zFrontT_ = vArgs[
"ZFrontTop"];
185 rMaxFront_ = vArgs[
"RMaxFront"];
187 for (
unsigned int i = 0;
i < slopeB_.size(); ++
i)
188 edm::LogVerbatim(
"HGCalGeom") <<
"Bottom Block [" <<
i <<
"] Zmin " << zFrontB_[
i] <<
" Rmin " << rMinFront_[
i]
189 <<
" Slope " << slopeB_[
i];
190 for (
unsigned int i = 0;
i < slopeT_.size(); ++
i)
191 edm::LogVerbatim(
"HGCalGeom") <<
"Top Block [" <<
i <<
"] Zmin " << zFrontT_[
i] <<
" Rmax " << rMaxFront_[
i]
192 <<
" Slope " << slopeT_[
i];
194 waferFull_ = vsArgs[
"WaferNamesFull"];
195 waferPart_ = vsArgs[
"WaferNamesPartial"];
197 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << waferFull_.size() <<
" full and " 198 << waferPart_.size() <<
" partial modules\nDDHGCalMixRotatedFineCassette:Full Modules:";
199 unsigned int i1max =
static_cast<unsigned int>(waferFull_.size());
200 for (
unsigned int i1 = 0;
i1 < i1max;
i1 += 2) {
201 std::ostringstream st1;
203 for (
unsigned int i =
i1;
i <
i2; ++
i)
204 st1 <<
" [" <<
i <<
"] " << waferFull_[
i];
207 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Partial Modules:";
208 i1max =
static_cast<unsigned int>(waferPart_.size());
209 for (
unsigned int i1 = 0;
i1 < i1max;
i1 += 2) {
210 std::ostringstream st1;
212 for (
unsigned int i =
i1;
i <
i2; ++
i)
213 st1 <<
" [" <<
i <<
"] " << waferPart_[
i];
217 passiveFull_ = vsArgs[
"PassiveNamesFull"];
218 passivePart_ = vsArgs[
"PassiveNamesPartial"];
220 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconRotatedCassette: " << passiveFull_.size() <<
" full and " 221 << passivePart_.size() <<
" partial passive modules";
222 i1max =
static_cast<unsigned int>(passiveFull_.size());
223 for (
unsigned int i1 = 0;
i1 < i1max;
i1 += 2) {
224 std::ostringstream st1;
226 for (
unsigned int i =
i1;
i <
i2; ++
i)
227 st1 <<
" [" <<
i <<
"] " << passiveFull_[
i];
230 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalSiliconRotatedCassette: Partial Modules:";
231 i1max =
static_cast<unsigned int>(passivePart_.size());
232 for (
unsigned int i1 = 0;
i1 < i1max;
i1 += 2) {
233 std::ostringstream st1;
235 for (
unsigned int i =
i1;
i <
i2; ++
i)
236 st1 <<
" [" <<
i <<
"] " << passivePart_[
i];
240 materials_ = vsArgs[
"MaterialNames"];
241 names_ = vsArgs[
"VolumeNames"];
242 thick_ = vArgs[
"Thickness"];
243 copyNumber_.resize(materials_.size(), 1);
245 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << materials_.size() <<
" types of volumes";
246 for (
unsigned int i = 0;
i < names_.size(); ++
i)
247 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << names_[
i] <<
" of thickness " << thick_[
i]
248 <<
" filled with " << materials_[
i] <<
" first copy number " << copyNumber_[
i];
251 layerThick_ = vArgs[
"LayerThick"];
253 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layers_.size() <<
" blocks";
254 for (
unsigned int i = 0;
i < layers_.size(); ++
i)
255 edm::LogVerbatim(
"HGCalGeom") <<
"Block [" <<
i <<
"] of thickness " << layerThick_[
i] <<
" with " << layers_[
i]
259 layerSense_ =
dbl_to_int(vArgs[
"LayerSense"]);
260 layerOrient_ =
dbl_to_int(vArgs[
"LayerTypes"]);
261 for (
unsigned int k = 0;
k < layerOrient_.size(); ++
k)
264 for (
unsigned int i = 0;
i < layerOrient_.size(); ++
i)
267 if (firstFineLayer_ > 0) {
268 for (
unsigned int i = 0;
i < layerType_.size(); ++
i) {
269 if (layerSense_[
i] != 0) {
270 int ii = layerType_[
i];
271 copyNumber_[
ii] = firstFineLayer_;
273 edm::LogVerbatim(
"HGCalGeom") <<
"First copy number for layer type " <<
i <<
":" <<
ii <<
" with " 274 << materials_[
ii] <<
" changed to " << copyNumber_[
ii];
282 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerType_.size() <<
" layers";
283 for (
unsigned int i = 0;
i < layerType_.size(); ++
i)
284 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerType_[
i] <<
" sensitive class " 287 materialTop_ = vsArgs[
"TopMaterialNames"];
288 namesTop_ = vsArgs[
"TopVolumeNames"];
289 layerThickTop_ = vArgs[
"TopLayerThickness"];
290 layerTypeTop_ =
dbl_to_int(vArgs[
"TopLayerType"]);
291 copyNumberTop_.resize(materialTop_.size(), firstFineLayer_);
292 coverTypeTop_ =
static_cast<int>(nArgs[
"TopCoverLayerType"]);
293 coverTopLayers_ =
static_cast<int>(nArgs[
"TopCoverLayers"]);
294 copyNumberCoverTop_.resize(coverTopLayers_, firstFineLayer_);
296 std::ostringstream st0;
297 for (
int k = 0;
k < coverTopLayers_; ++
k)
298 st0 <<
" " << copyNumberCoverTop_[
k];
299 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << materialTop_.size()
300 <<
" types of volumes in the top part; " << coverTopLayers_ <<
" covers of Type " 301 << coverTypeTop_ <<
" with initial copy numbers: " << st0.str();
302 for (
unsigned int i = 0;
i < materialTop_.size(); ++
i)
303 edm::LogVerbatim(
"HGCalGeom") <<
"Volume [" <<
i <<
"] " << namesTop_[
i] <<
" of thickness " << layerThickTop_[
i]
304 <<
" filled with " << materialTop_[
i] <<
" first copy number " << copyNumberTop_[
i];
305 edm::LogVerbatim(
"HGCalGeom") <<
"There are " << layerTypeTop_.size() <<
" layers in the top part";
306 for (
unsigned int i = 0;
i < layerTypeTop_.size(); ++
i)
307 edm::LogVerbatim(
"HGCalGeom") <<
"Layer [" <<
i <<
"] with material type " << layerTypeTop_[
i];
309 waferIndex_ =
dbl_to_int(vArgs[
"WaferIndex"]);
310 waferProperty_ =
dbl_to_int(vArgs[
"WaferProperties"]);
311 waferLayerStart_ =
dbl_to_int(vArgs[
"WaferLayerStart"]);
312 cassetteShift_ = vArgs[
"CassetteShift"];
314 edm::LogVerbatim(
"HGCalGeom") <<
"waferProperties with " << waferIndex_.size() <<
" entries in " 315 << waferLayerStart_.size() <<
" layers";
316 for (
unsigned int k = 0;
k < waferLayerStart_.size(); ++
k)
318 for (
unsigned int k = 0;
k < waferIndex_.size(); ++
k)
326 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << cassetteShift_.size()
327 <<
" elements for cassette shifts";
328 unsigned int j1max = cassetteShift_.size();
329 for (
unsigned int j1 = 0; j1 < j1max; j1 += 6) {
330 std::ostringstream st1;
331 unsigned int j2 =
std::min((j1 + 6), j1max);
332 for (
unsigned int j = j1;
j < j2; ++
j)
333 st1 <<
" [" <<
j <<
"] " << std::setw(9) << cassetteShift_[
j];
337 tileFineRMin_ = vArgs[
"Tile6RMin"];
338 tileFineRMax_ = vArgs[
"Tile6RMax"];
339 tileFineIndex_ =
dbl_to_int(vArgs[
"Tile6LayerRings"]);
340 tileFinePhis_ =
dbl_to_int(vArgs[
"Tile6PhiRange"]);
341 tileFineLayerStart_ =
dbl_to_int(vArgs[
"Tile6LayerStart"]);
342 tileCoarseRMin_ = vArgs[
"TileRMin"];
343 tileCoarseRMax_ = vArgs[
"TileRMax"];
344 tileCoarseIndex_ =
dbl_to_int(vArgs[
"TileLayerRings"]);
345 tileCoarsePhis_ =
dbl_to_int(vArgs[
"TilePhiRange"]);
346 tileCoarseLayerStart_ =
dbl_to_int(vArgs[
"TileLayerStart"]);
348 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette:: with " << tileFineRMin_.size() <<
":" 349 << tileCoarseRMin_.size() <<
" rings";
350 for (
unsigned int k = 0;
k < tileFineRMin_.size(); ++
k)
351 edm::LogVerbatim(
"HGCalGeom") <<
"Fine Ring[" <<
k <<
"] " << tileFineRMin_[
k] <<
" : " << tileFineRMax_[
k];
352 for (
unsigned int k = 0;
k < tileCoarseRMin_.size(); ++
k)
353 edm::LogVerbatim(
"HGCalGeom") <<
"Coarse Ring[" <<
k <<
"] " << tileCoarseRMin_[
k] <<
" : " << tileCoarseRMax_[
k];
354 edm::LogVerbatim(
"HGCalGeom") <<
"TileProperties with " << tileFineIndex_.size() <<
":" << tileCoarseIndex_.size()
355 <<
" entries in " << tileFineLayerStart_.size() <<
":" << tileCoarseLayerStart_.size()
357 for (
unsigned int k = 0;
k < tileFineLayerStart_.size(); ++
k)
358 edm::LogVerbatim(
"HGCalGeom") <<
"FineLayerStart[" <<
k <<
"] " << tileFineLayerStart_[
k];
359 for (
unsigned int k = 0;
k < tileCoarseLayerStart_.size(); ++
k)
360 edm::LogVerbatim(
"HGCalGeom") <<
"CoarseLayerStart[" <<
k <<
"] " << tileCoarseLayerStart_[
k];
361 for (
unsigned int k = 0;
k < tileFineIndex_.size(); ++
k)
368 for (
unsigned int k = 0;
k < tileCoarseIndex_.size(); ++
k)
376 std::vector<double> retract = vArgs[
"ScintRetract"];
377 double dphi =
M_PI / cassettes_;
378 for (
int k = 0;
k < cassettes_; ++
k) {
379 double phi = (2 *
k + 1) * dphi;
380 cassetteShiftScnt_.emplace_back(retract[
k] *
cos(phi));
381 cassetteShiftScnt_.emplace_back(retract[
k] *
sin(phi));
384 unsigned int j2max = cassetteShiftScnt_.size();
385 for (
unsigned int j1 = 0; j1 < j2max; j1 += 6) {
386 std::ostringstream st1;
387 unsigned int j2 =
std::min((j1 + 6), j2max);
388 for (
unsigned int j = j1;
j < j2; ++
j)
389 st1 <<
" [" <<
j <<
"] " << std::setw(9) << cassetteShiftScnt_[
j];
395 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: NameSpace " << nameSpace_ <<
":";
397 cassette_.setParameter(cassettes_, cassetteShift_,
false);
398 cassette_.setParameterScint(cassetteShiftScnt_);
407 edm::LogVerbatim(
"HGCalGeom") <<
"==>> Constructing DDHGCalMixRotatedFineCassette...";
412 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << copies_.size()
413 <<
" different wafer copy numbers";
415 for (std::unordered_set<int>::const_iterator itr = copies_.begin(); itr != copies_.end(); ++itr, ++
k) {
419 edm::LogVerbatim(
"HGCalGeom") <<
"<<== End of DDHGCalMixRotatedFineCassette construction...";
424 double zi(zMinBlock_);
426 unsigned int fineLayers =
static_cast<unsigned int>(firstCoarseLayer_ - firstFineLayer_);
427 for (
unsigned int i = 0;
i < layers_.size();
i++) {
428 double zo = zi + layerThick_[
i];
430 int laymax = laymin + layers_[
i];
433 bool fine = (
i < fineLayers) ?
true :
false;
434 for (
int ly = laymin; ly < laymax; ++ly) {
435 int ii = layerType_[ly];
436 int copy = copyNumber_[
ii];
437 double hthick = 0.5 * thick_[
ii];
440 thickTot += thick_[
ii];
444 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Layer " << ly <<
":" <<
ii <<
" Front " << zi
445 <<
", " << routF <<
" Back " << zo <<
", " << rinB <<
" superlayer thickness " 451 if (layerSense_[ly] == 0) {
452 std::vector<double> pgonZ, pgonRin, pgonRout;
467 for (
unsigned int isec = 0;
isec < pgonZ.size(); ++
isec) {
469 if (layerSense_[ly] == 0 || absorbMode_ == 0)
470 pgonRout[
isec] = rmax;
472 pgonRout[
isec] = pgonRout[
isec] * cosAlpha_ - tol1_;
478 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << solid.
name() <<
" polyhedra of " 480 <<
convertRadToDeg(-alpha_ + 2._pi) <<
" with " << pgonZ.size() <<
" sections";
481 for (
unsigned int k = 0;
k < pgonZ.size(); ++
k)
482 edm::LogVerbatim(
"HGCalGeom") <<
"[" <<
k <<
"] z " << pgonZ[
k] <<
" R " << pgonRin[
k] <<
":" << pgonRout[
k];
485 int mode = (layerSense_[ly] > 0) ? sensitiveMode_ : absorbMode_;
491 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << solid.
name() <<
" Tubs made of " 492 << matName <<
" of dimensions " << rinB <<
":" << rins <<
", " << routF <<
":" 493 << routs <<
", " << hthick <<
", 0.0, 360.0 and positioned in: " << glog.
name()
494 <<
" number " <<
copy;
496 positionMix(glog,
name,
copy, thick_[
ii], matter, -layerSense_[ly], fine, cpv);
504 <<
" positioned in " <<
module.name() <<
" at " << r1 <<
" with no rotation";
511 if (
std::abs(thickTot - layerThick_[
i]) >= tol2_) {
512 if (thickTot > layerThick_[
i]) {
513 edm::LogError(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" is smaller than " << thickTot
514 <<
": thickness of all its components **** ERROR ****";
516 edm::LogWarning(
"HGCalGeom") <<
"Thickness of the partition " << layerThick_[
i] <<
" does not match with " 517 << thickTot <<
" of the components";
534 for (
unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
535 int ii = layerTypeTop_[ly];
536 copyNumberTop_[
ii] = copyM;
538 double hthick = 0.5 * thick;
539 double dphi = (fine) ? ((2._pi) / phiBinsFineScint_) : ((2._pi) / phiBinsScint_);
540 double thickTot(0), zpos(-hthick);
542 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Entry to positionMix with Name " << nameM <<
" copy " 543 << copyM <<
" Thick " << thick <<
" AbsType " << absType <<
" Fine " << fine <<
" dphi " 547 for (
unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
548 int ii = layerTypeTop_[ly];
549 int copy = copyNumberTop_[
ii];
550 int layer = (fine) ? (
copy - firstFineLayer_) : (
copy - firstCoarseLayer_);
551 double hthickl = 0.5 * layerThickTop_[
ii];
552 thickTot += 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: Layer " << ly <<
":" <<
ii <<
":" << layer
566 <<
" Copy " <<
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 " 605 << ir1 <<
":" << ir2 <<
" R " << r1 <<
":" <<
r2 <<
" Thick " << (2.0 * hthickl)
606 <<
" phi " << fimin <<
":" << fimax <<
":" <<
convertRadToDeg(phi1) <<
":" 607 <<
convertRadToDeg(phi2) <<
" cassette " << cassette <<
":" << cassette0
608 <<
" Shift " << cshift.first <<
":" << cshift.second;
615 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << glog1.
name() <<
" Tubs made of " 616 << matName <<
" of dimensions " << r1 <<
", " <<
r2 <<
", " << hthickl <<
", " 622 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Position " << glog1.
name() <<
" number " 623 <<
copy <<
" in " << glog.
name() <<
" at " << tran <<
" with no rotation";
626 ++copyNumberTop_[
ii];
629 if (
std::abs(thickTot - thick) >= tol2_) {
630 if (thickTot > thick) {
631 edm::LogError(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Thickness of the partition " << thick
632 <<
" is smaller than " << thickTot
633 <<
": thickness of all its components in the top part **** ERROR ****";
635 edm::LogWarning(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Thickness of the partition " << thick
636 <<
" does not match with " << thickTot <<
" of the components in top part";
640 int ii = coverTypeTop_;
641 int copy = copyNumberCoverTop_[absType - 1];
642 int layer = (fine) ? (
copy - firstFineLayer_) : (
copy - firstCoarseLayer_);
643 double hthickl = 0.5 * layerThickTop_[
ii];
648 int firstTile = (fine) ? tileFineLayerStart_[layer] : tileCoarseLayerStart_[layer];
650 (fine) ? ((layer + 1 < static_cast<int>(tileFineLayerStart_.size())) ? tileFineLayerStart_[layer + 1]
651 :
static_cast<int>(tileFineIndex_.size()))
652 : ((layer + 1 <
static_cast<int>(tileCoarseLayerStart_.size()))
653 ? tileCoarseLayerStart_[layer + 1]
654 :
static_cast<int>(tileCoarseIndex_.size()));
656 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: TOP Layer " <<
ii <<
":" << layer <<
" Copy " 657 <<
copy <<
" Tiles " << firstTile <<
":" << lastTile <<
" Size " 658 << tileFineIndex_.size() <<
":" << tileCoarseIndex_.size() <<
" Fine " << fine
659 <<
" absType " << absType;
661 for (
int ti = firstTile; ti < lastTile; ++ti) {
663 int cassette, fimin, fimax;
665 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: ti " << ti <<
":" << fine <<
" index " 666 << tileFineIndex_.size() <<
":" << tileCoarseIndex_.size() <<
" Phis " 667 << tileFinePhis_.size() <<
":" << tileCoarsePhis_.size();
683 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Casstee|Fimin|Fimax " << cassette <<
":" << fimin
686 double phi1 = dphi * (fimin - 1);
687 double phi2 = dphi * (fimax - fimin + 1);
688 auto cshift = cassette_.getShift(layer + 1, 1, cassette,
true);
695 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Layer " <<
copy <<
":" << (layer + 1) <<
" iR " 696 << ir1 <<
":" << ir2 <<
" R " << r1 <<
":" <<
r2 <<
" Thick " << (2.0 * hthickl)
697 <<
" phi " << fimin <<
":" << fimax <<
":" <<
convertRadToDeg(phi1) <<
":" 698 <<
convertRadToDeg(phi2) <<
" cassette " << cassette <<
":" << cassette0
699 <<
" Shift " << cshift.first <<
":" << cshift.second;
706 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << glog1.
name() <<
" Tubs made of " << matName
707 <<
" of dimensions " << r1 <<
", " <<
r2 <<
", " << hthickl <<
", " 714 <<
" in " << glog.
name() <<
" at " << tran <<
" with no rotation";
717 ++copyNumberCoverTop_[absType - 1];
721 int layer = (copyM - firstFineLayer_);
723 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Start bottom section for layer " << layer
724 <<
" absType " << absType;
730 for (
int k = 0;
k < cassettes_; ++
k) {
731 int cassette =
k + 1;
732 auto cshift = cassette_.getShift(layer + 1, -1, cassette);
733 double xpos = -cshift.first;
734 double ypos = cshift.second;
735 int i = layer * cassettes_ +
k;
737 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::Passive: layer " << layer + 1 <<
" cassette " 738 << cassette <<
" Shift " << cshift.first <<
":" << cshift.second <<
" PassiveIndex " 739 <<
i <<
":" << passiveFull_.size() <<
":" << passivePart_.size();
741 std::string passive = (absType <= waferTypes_) ? passiveFull_[
i] : passivePart_[
i];
743 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Passive " << passive <<
" number " << cassette
744 <<
" pos " << xpos <<
":" << ypos;
752 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " <<
name <<
" number " << cassette
753 <<
" positioned in " << glog.
ddname() <<
" at " << tran <<
" with no rotation";
757 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: " << kount <<
" passives of type " << absType
758 <<
" for " << glog.
ddname();
761 static const double sqrt3 =
std::sqrt(3.0);
762 int layercenter = layerOrient_[layer];
764 int firstWafer = waferLayerStart_[layer];
765 int lastWafer = ((layer + 1 <
static_cast<int>(waferLayerStart_.size())) ? waferLayerStart_[layer + 1]
766 :
static_cast<int>(waferIndex_.size()));
767 double delx = 0.5 * (waferSize_ + waferSepar_);
768 double dely = 2.0 * delx / sqrt3;
769 double dy = 0.75 * dely;
770 const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
772 int ium(0), ivm(0), kount(0);
773 std::vector<int> ntype(3, 0);
774 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::Bottom: " << glog.
ddname() <<
" r " << delx
775 <<
" R " << dely <<
" dy " <<
dy <<
" Shift " << xyoff.first <<
":" << xyoff.second
776 <<
" WaferSize " << (waferSize_ + waferSepar_) <<
" index " << firstWafer <<
":" 778 << (lastWafer - 1) <<
" Copy " << copyM <<
":" << layer;
780 for (
int k = firstWafer;
k < lastWafer; ++
k) {
796 <<
"DDHGCalMixRotatedFineCassette::index:Property:layertype:type:part:orien:cassette:place:offsets:ind " <<
k 797 <<
":" << waferProperty_[
k] <<
":" << layertype <<
":" <<
type <<
":" <<
part <<
":" << orien <<
":" 798 << cassette <<
":" << place;
800 auto cshift = cassette_.getShift(layer + 1, -1, cassette,
false);
801 double xpos = xyoff.first - cshift.first + nc * delx;
802 double ypos = xyoff.second + cshift.second +
nr *
dy;
804 double xorig = xyoff.first + nc * delx;
805 double yorig = xyoff.second +
nr *
dy;
806 double angle = std::atan2(yorig, xorig);
807 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette::Wafer: layer " << layer + 1 <<
" cassette " 808 << cassette <<
" Shift " << cshift.first <<
":" << cshift.second <<
" Original " 815 i =
type * facingTypes_ * orientationTypes_ + place - placeOffset_;
817 edm::LogVerbatim(
"HGCalGeom") <<
" FullWafer type:place:ind " <<
type <<
":" << place <<
":" <<
i <<
":" 818 << waferFull_.size();
820 wafer = waferFull_[
i];
824 i = (
part - partoffset) * facingTypes_ * orientationTypes_ +
827 edm::LogVerbatim(
"HGCalGeom") <<
" layertype:type:part:orien:cassette:place:offsets:ind " << layertype <<
":" 828 <<
type <<
":" <<
part <<
":" << orien <<
":" << cassette <<
":" << place <<
":" 830 << waferPart_.size();
832 wafer = waferPart_[
i];
838 <<
copy <<
" type :part:orien:ind " <<
type <<
":" <<
part <<
":" << orien <<
":" 839 <<
i <<
" layer:u:v " << (layer + firstFineLayer_) <<
":" << u <<
":" <<
v;
845 if (copies_.count(
copy) == 0)
846 copies_.insert(
copy);
854 << layertype <<
":" <<
type <<
" positioned in " << glog.
ddname() <<
" at " << tran
855 <<
" with no rotation";
859 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalMixRotatedFineCassette: Maximum # of u " << ium <<
" # of v " << ivm
860 <<
" and " << kount <<
" wafers (" << ntype[0] <<
":" << ntype[1] <<
":" << ntype[2]
861 <<
") for " << glog.
ddname();
Log< level::Info, true > LogVerbatim
static AlgebraicMatrix initialize()
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
static constexpr int32_t WaferPartLDOffset
std::vector< std::string > waferFull_
std::vector< double > zFrontB_
std::vector< int > tileFinePhis_
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
static constexpr int32_t WaferTypeOffset[3]
std::vector< double > slopeT_
DDMaterial is used to define and access material information.
std::vector< std::string > names_
int32_t waferU(const int32_t index)
std::vector< int > layers_
int32_t waferLayer(const int32_t index)
std::vector< double > cassetteShift_
constexpr NumType convertRadToDeg(NumType radians)
std::vector< double > layerThick_
Sin< T >::type sin(const T &t)
std::unordered_set< int > copies_
DDName is used to identify DDD entities uniquely.
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
std::vector< double > rMaxFront_
std::vector< int > layerTypeTop_
static std::string & ns()
std::vector< int > tileCoarsePhis_
Log< level::Error, false > LogError
Compact representation of the geometrical detector hierarchy.
std::vector< int > copyNumberTop_
int32_t waferOrient(const int32_t property)
A DDSolid represents the shape of a part.
static std::string to_string(const XMLCh *ch)
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
int32_t waferCassette(const int32_t property)
static constexpr int32_t WaferFull
std::vector< std::string > passivePart_
std::vector< double > tileFineRMin_
void execute(DDCompactView &cpv) override
std::vector< int > tileFineLayerStart_
Cos< T >::type cos(const T &t)
std::vector< double > tileFineRMax_
Abs< T >::type abs(const T &t)
void constructLayers(const cms::DDNamespace &ns, const std::vector< std::string > &wafers, const std::vector< std::string > &covers, const std::vector< int > &layerType, const std::vector< int > &layerSense, const std::vector< int > &maxModule, const std::vector< std::string > &names, const std::vector< std::string > &materials, std::vector< int > ©Number, const std::vector< double > &layerThick, const double &absorbW, const double &absorbH, const double &waferTot, const double &rMax, const double &rMaxFine, std::unordered_set< int > &copies, int firstLayer, int lastLayer, double zFront, double totalWidth, bool ignoreCenter, dd4hep::Volume &module)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
std::vector< int > copyNumber_
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
int32_t waferThick(const int32_t property)
HGCalGeomTools geomTools_
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
std::vector< int > layerOrient_
std::vector< int > tileFineIndex_
std::vector< int > waferIndex_
std::vector< double > tileCoarseRMin_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
std::tuple< int32_t, int32_t, int32_t > tileUnpack(int32_t index)
static constexpr int32_t WaferPartHDOffset
std::vector< double > tileCoarseRMax_
std::vector< int > layerType_
std::vector< int > copyNumberCoverTop_
std::vector< double > zFrontT_
std::vector< double > layerThickTop_
std::vector< int > waferLayerStart_
int32_t waferPartial(const int32_t property)
std::vector< int > tileCoarseLayerStart_
std::vector< double > thick_
std::vector< std::string > materialTop_
std::vector< int > layerSense_
std::vector< std::string > waferPart_
int32_t waferV(const int32_t index)
void positionMix(const DDLogicalPart &glog, const std::string &nameM, int copyM, double thick, const DDMaterial &matter, int absType, bool fine, DDCompactView &cpv)
static int32_t packTypeUV(int type, int u, int v)
static constexpr int32_t WaferHDTop
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< int > waferProperty_
Log< level::Warning, false > LogWarning
static int32_t layerType(int type)
std::vector< std::string > materials_
std::vector< std::string > namesTop_
std::vector< double > rMinFront_
std::vector< std::string > passiveFull_
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
std::vector< double > slopeB_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
std::vector< int > tileCoarseIndex_
static int cassetteType(int det, int zside, int cassette)
DDHGCalMixRotatedFineCassette()
std::vector< double > cassetteShiftScnt_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
static constexpr int32_t layerFrontBack(int32_t layerOrient)