CMS 3D CMS Logo

DDHGCalMixRotatedFineCassette.cc
Go to the documentation of this file.
1 // File: DDHGCalMixRotatedFineFineCassette.cc
3 // Description: Geometry factory class for HGCal (Mix)
5 
9 #include "DD4hep/DetFactoryHelper.h"
20 
21 #include <cmath>
22 #include <memory>
23 #include <string>
24 #include <unordered_set>
25 #include <vector>
26 
27 //#define EDM_ML_DEBUG
28 using namespace angle_units::operators;
29 
32  throw cms::Exception("HGCalGeom") << "Wrong initialization to HGCalMixRotatedFineCassette";
33  }
34 
36  cms::DDNamespace ns(ctxt, e, true);
38 
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Creating an instance";
41 #endif
42  static constexpr double tol1 = 0.01 * dd4hep::mm;
43 
44  dd4hep::Volume mother = ns.volume(args.parentName());
45 
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");
54 #ifdef EDM_ML_DEBUG
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_;
60 #endif
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");
66 #ifdef EDM_ML_DEBUG
67  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette::First Layers " << firstFineLayer_ << ":"
68  << firstCoarseLayer_ << " and Absober:Sensitive mode " << absorbMode_ << ":"
69  << sensitiveMode_ << ":" << passiveMode_;
70 #endif
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_);
78 #ifdef EDM_ML_DEBUG
79  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: zStart " << zMinBlock_ << " wafer width "
80  << waferSize_ << " separations " << waferSepar_ << " sectors " << sectors_ << ":"
81  << convertRadToDeg(alpha_) << ":" << cosAlpha_ << " with " << cassettes_
82  << " cassettes";
83 #endif
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");
90 #ifdef EDM_ML_DEBUG
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];
97 #endif
98  waferFull_ = args.value<std::vector<std::string>>("WaferNamesFull");
99  waferPart_ = args.value<std::vector<std::string>>("WaferNamesPartial");
100 #ifdef EDM_ML_DEBUG
101  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << waferFull_.size() << " full and "
102  << waferPart_.size()
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;
107  unsigned int i2 = std::min((i1 + 2), i1max);
108  for (unsigned int i = i1; i < i2; ++i)
109  st1 << " [" << i << "] " << waferFull_[i];
110  edm::LogVerbatim("HGCalGeom") << st1.str();
111  }
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;
116  unsigned int i2 = std::min((i1 + 2), i1max);
117  for (unsigned int i = i1; i < i2; ++i)
118  st1 << " [" << i << "] " << waferPart_[i];
119  edm::LogVerbatim("HGCalGeom") << st1.str();
120  }
121 #endif
122  passiveFull_ = args.value<std::vector<std::string>>("PassiveNamesFull");
123  passivePart_ = args.value<std::vector<std::string>>("PassiveNamesPartial");
124 #ifdef EDM_ML_DEBUG
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;
130  unsigned int i2 = std::min((i1 + 2), i1max);
131  for (unsigned int i = i1; i < i2; ++i)
132  st1 << " [" << i << "] " << passiveFull_[i];
133  edm::LogVerbatim("HGCalGeom") << st1.str();
134  }
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;
139  unsigned int i2 = std::min((i1 + 2), i1max);
140  for (unsigned int i = i1; i < i2; ++i)
141  st1 << " [" << i << "] " << passivePart_[i];
142  edm::LogVerbatim("HGCalGeom") << st1.str();
143  }
144 #endif
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);
149 #ifdef EDM_ML_DEBUG
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];
154 #endif
155  layers_ = args.value<std::vector<int>>("Layers");
156  layerThick_ = args.value<std::vector<double>>("LayerThick");
157 #ifdef EDM_ML_DEBUG
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]
161  << " layers";
162 #endif
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)
167  layerOrient_[k] = HGCalTypes::layerType(layerOrient_[k]);
168 #ifdef EDM_ML_DEBUG
169  for (unsigned int i = 0; i < layerOrient_.size(); ++i)
170  edm::LogVerbatim("HGCalGeom") << "LayerOrient [" << i << "] " << layerOrient_[i];
171 #endif
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_;
177 #ifdef EDM_ML_DEBUG
178  edm::LogVerbatim("HGCalGeom") << "First copy number for layer type " << i << ":" << ii << " with "
179  << materials_[ii] << " changed to " << copyNumber_[ii];
180 #endif
181  }
182  }
183  } else {
184  firstFineLayer_ = 1;
185  }
186 #ifdef EDM_ML_DEBUG
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 "
190  << layerSense_[i];
191 #endif
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_);
200 #ifdef EDM_ML_DEBUG
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];
213 #endif
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");
218 #ifdef EDM_ML_DEBUG
219  edm::LogVerbatim("HGCalGeom") << "waferProperties with " << waferIndex_.size() << " entries in "
220  << waferLayerStart_.size() << " layers";
221  for (unsigned int k = 0; k < waferLayerStart_.size(); ++k)
222  edm::LogVerbatim("HGCalGeom") << "LayerStart[" << k << "] " << waferLayerStart_[k];
223  for (unsigned int k = 0; k < waferIndex_.size(); ++k)
224  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << waferIndex_[k] << " ("
225  << HGCalWaferIndex::waferLayer(waferIndex_[k]) << ", "
226  << HGCalWaferIndex::waferU(waferIndex_[k]) << ", "
227  << HGCalWaferIndex::waferV(waferIndex_[k]) << ") : ("
228  << HGCalProperty::waferThick(waferProperty_[k]) << ":"
229  << HGCalProperty::waferPartial(waferProperty_[k]) << ":"
230  << HGCalProperty::waferOrient(waferProperty_[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];
239  edm::LogVerbatim("HGCalGeom") << st1.str();
240  }
241 #endif
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");
252 #ifdef EDM_ML_DEBUG
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()
261  << " layers";
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)
267  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << tileFineIndex_[k] << " ("
268  << "Layer " << std::get<0>(HGCalTileIndex::tileUnpack(tileFineIndex_[k]))
269  << " Ring " << std::get<1>(HGCalTileIndex::tileUnpack(tileFineIndex_[k])) << ":"
270  << std::get<2>(HGCalTileIndex::tileUnpack(tileFineIndex_[k])) << ") Phi "
271  << std::get<1>(HGCalTileIndex::tileUnpack(tileFinePhis_[k])) << ":"
272  << std::get<2>(HGCalTileIndex::tileUnpack(tileFinePhis_[k]));
273  for (unsigned int k = 0; k < tileCoarseIndex_.size(); ++k)
274  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << tileCoarseIndex_[k] << " ("
275  << "Layer " << std::get<0>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[k]))
276  << " Ring " << std::get<1>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[k])) << ":"
277  << std::get<2>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[k])) << ") Phi "
278  << std::get<1>(HGCalTileIndex::tileUnpack(tileCoarsePhis_[k])) << ":"
279  << std::get<2>(HGCalTileIndex::tileUnpack(tileCoarsePhis_[k]));
280 #endif
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));
287  }
288 #ifdef EDM_ML_DEBUG
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];
295  edm::LogVerbatim("HGCalGeom") << st1.str();
296  }
297 #endif
298  cassette_.setParameter(cassettes_, cassetteShift_, false);
299  cassette_.setParameterScint(cassetteShiftScnt_);
300 
302  // DDHGCalMixRotatedFineCassette methods...
304 
305 #ifdef EDM_ML_DEBUG
306  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalMixRotatedFineCassette...";
307  copies_.clear();
308 #endif
309 
310  double zi(zMinBlock_);
311  int laymin(0);
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];
315  double routF = HGCalGeomTools::radius(zi, zFrontT_, rMaxFront_, slopeT_);
316  int laymax = laymin + layers_[i];
317  double zz = zi;
318  double thickTot(0);
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];
324  double rinB = HGCalGeomTools::radius(zo, zFrontB_, rMinFront_, slopeB_);
325  zz += hthick;
326  thickTot += thick_[ii];
327 
328  std::string name = names_[ii] + std::to_string(copy);
329 #ifdef EDM_ML_DEBUG
330  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Layer " << ly << ":" << ii << " Front "
331  << cms::convert2mm(zi) << ", " << cms::convert2mm(routF) << " Back "
332  << cms::convert2mm(zo) << ", " << cms::convert2mm(rinB)
333  << " superlayer thickness " << layerThick_[i];
334 #endif
335  dd4hep::Material matter = ns.material(materials_[ii]);
336  dd4hep::Volume glog;
337  if (layerSense_[ly] == 0) {
338  std::vector<double> pgonZ, pgonRin, pgonRout;
339  double rmax =
340  (std::min(routF, HGCalGeomTools::radius(zz + hthick, zFrontT_, rMaxFront_, slopeT_)) * cosAlpha_) - tol1;
341  HGCalGeomTools::radius(zz - hthick,
342  zz + hthick,
343  zFrontB_,
344  rMinFront_,
345  slopeB_,
346  zFrontT_,
347  rMaxFront_,
348  slopeT_,
349  -layerSense_[ly],
350  pgonZ,
351  pgonRin,
352  pgonRout);
353  for (unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
354  pgonZ[isec] -= zz;
355  if (layerSense_[ly] == 0 || absorbMode_ == 0)
356  pgonRout[isec] = rmax;
357  else
358  pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1;
359  }
360  dd4hep::Solid solid = dd4hep::Polyhedra(sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
361  ns.addSolidNS(ns.prepend(name), solid);
362  glog = dd4hep::Volume(solid.name(), solid, matter);
363  ns.addVolumeNS(glog);
364 #ifdef EDM_ML_DEBUG
365  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << solid.name() << " polyhedra of "
366  << sectors_ << " sectors covering " << convertRadToDeg(-alpha_) << ":"
367  << convertRadToDeg(-alpha_ + 2._pi) << " with " << pgonZ.size() << " sections";
368  for (unsigned int k = 0; k < pgonZ.size(); ++k)
369  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << cms::convert2mm(pgonZ[k]) << " R "
370  << cms::convert2mm(pgonRin[k]) << ":" << cms::convert2mm(pgonRout[k]);
371 #endif
372  } else {
373  int mode = (layerSense_[ly] > 0) ? sensitiveMode_ : absorbMode_;
374  double rins = (mode < 1) ? rinB : HGCalGeomTools::radius(zz + hthick, zFrontB_, rMinFront_, slopeB_);
375  double routs = (mode < 1) ? routF : HGCalGeomTools::radius(zz - hthick, zFrontT_, rMaxFront_, slopeT_);
376  dd4hep::Solid solid = dd4hep::Tube(rins, routs, hthick, 0.0, 2._pi);
377  ns.addSolidNS(ns.prepend(name), solid);
378  glog = dd4hep::Volume(solid.name(), solid, matter);
379  ns.addVolumeNS(glog);
380 #ifdef EDM_ML_DEBUG
381  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << solid.name() << " Tubs made of "
382  << matter.name() << " of dimensions " << cms::convert2mm(rinB) << ":"
383  << cms::convert2mm(rins) << ", " << cms::convert2mm(routF) << ":"
384  << cms::convert2mm(routs) << ", " << cms::convert2mm(hthick)
385  << ", 0.0, 360.0 and positioned in: " << glog.name() << " number " << copy;
386 #endif
387  positionMix(ctxt, e, glog, name, copy, thick_[ii], matter, -layerSense_[ly], fine);
388  }
389  dd4hep::Position r1(0, 0, zz);
390  mother.placeVolume(glog, copy, r1);
391  ++copyNumber_[ii];
392 #ifdef EDM_ML_DEBUG
393  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << glog.name() << " number " << copy
394  << " positioned in " << mother.name() << " at (0,0," << cms::convert2mm(zz)
395  << ") with no rotation";
396 #endif
397  zz += hthick;
398  } // End of loop over layers in a block
399  zi = zo;
400  laymin = laymax;
401  // Make consistency check of all the partitions of the block
402  if (std::abs(thickTot - layerThick_[i]) >= tol2_) {
403  if (thickTot > layerThick_[i]) {
404  edm::LogError("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(layerThick_[i])
405  << " is smaller than " << cms::convert2mm(thickTot)
406  << ": thickness of all its components **** ERROR ****";
407  } else {
408  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(layerThick_[i])
409  << " does not match with " << cms::convert2mm(thickTot) << " of the components";
410  }
411  }
412  } // End of loop over blocks
413 #ifdef EDM_ML_DEBUG
414  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << copies_.size()
415  << " different wafer copy numbers";
416  int k(0);
417  for (std::unordered_set<int>::const_iterator itr = copies_.begin(); itr != copies_.end(); ++itr, ++k) {
418  edm::LogVerbatim("HGCalGeom") << "Copy [" << k << "] : " << (*itr);
419  }
420  copies_.clear();
421  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalMixRotatedFineCassette construction...";
422 #endif
423  }
424 
426  xml_h e,
427  const dd4hep::Volume& glog,
428  const std::string& nameM,
429  int copyM,
430  double thick,
431  const dd4hep::Material& matter,
432  int absType,
433  bool fine) {
434  cms::DDNamespace ns(ctxt, e, true);
435 
436  // Make the top part first
437  for (unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
438  int ii = layerTypeTop_[ly];
439  copyNumberTop_[ii] = copyM;
440  }
441  double hthick = 0.5 * thick;
442  double dphi = (fine) ? ((2._pi) / phiBinsFineScint_) : ((2._pi) / phiBinsScint_);
443  double thickTot(0), zpos(-hthick);
444 #ifdef EDM_ML_DEBUG
445  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Entry to positionMix with Name " << nameM
446  << " copy " << copyM << " Thick " << thick << " AbsType " << absType << " Fine "
447  << fine << " dphi " << convertRadToDeg(dphi);
448 #endif
449  if (absType < 0) {
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];
456  zpos += hthickl;
457  dd4hep::Material matter1 = ns.material(materialTop_[ii]);
458  unsigned int k = 0;
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()));
466 #ifdef EDM_ML_DEBUG
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;
471 #endif
472  for (int ti = firstTile; ti < lastTile; ++ti) {
473  double r1, r2;
474  int cassette, fimin, fimax;
475 #ifdef EDM_ML_DEBUG
476  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: ti " << ti << ":" << fine << " index "
477  << tileFineIndex_.size() << ":" << tileCoarseIndex_.size() << " Phis "
478  << tileFinePhis_.size() << ":" << tileCoarsePhis_.size();
479 #endif
480  if (fine) {
481  r1 = tileFineRMin_[std::get<1>(HGCalTileIndex::tileUnpack(tileFineIndex_[ti])) - 1];
482  r2 = tileFineRMax_[std::get<2>(HGCalTileIndex::tileUnpack(tileFineIndex_[ti])) - 1];
483  cassette = std::get<0>(HGCalTileIndex::tileUnpack(tileFinePhis_[ti]));
484  fimin = std::get<1>(HGCalTileIndex::tileUnpack(tileFinePhis_[ti]));
485  fimax = std::get<2>(HGCalTileIndex::tileUnpack(tileFinePhis_[ti]));
486  } else {
487  r1 = tileCoarseRMin_[std::get<1>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[ti])) - 1];
488  r2 = tileCoarseRMax_[std::get<2>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[ti])) - 1];
489  cassette = std::get<0>(HGCalTileIndex::tileUnpack(tileCoarsePhis_[ti]));
490  fimin = std::get<1>(HGCalTileIndex::tileUnpack(tileCoarsePhis_[ti]));
491  fimax = std::get<2>(HGCalTileIndex::tileUnpack(tileCoarsePhis_[ti]));
492  }
493 #ifdef EDM_ML_DEBUG
494  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Casstee|Fimin|Fimax " << cassette << ":"
495  << fimin << ":" << fimax;
496 #endif
497  double phi1 = dphi * (fimin - 1);
498  double phi2 = dphi * (fimax - fimin + 1);
499  auto cshift = cassette_.getShift(layer + 1, 1, cassette, true);
500 #ifdef EDM_ML_DEBUG
501  int cassette0 = HGCalCassette::cassetteType(2, 1, cassette); //
502  int ir1 = (fine) ? std::get<1>(HGCalTileIndex::tileUnpack(tileFineIndex_[ti]))
503  : std::get<1>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[ti]));
504  int ir2 = (fine) ? std::get<2>(HGCalTileIndex::tileUnpack(tileFineIndex_[ti]))
505  : std::get<2>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[ti]));
506  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Layer " << copy << ":" << (layer + 1)
507  << " iR " << ir1 << ":" << ir2 << " R " << cms::convert2mm(r1) << ":"
508  << cms::convert2mm(r2) << " Thick " << cms::convert2mm(2.0 * hthickl) << " phi "
509  << fimin << ":" << fimax << ":" << convertRadToDeg(phi1) << ":"
510  << convertRadToDeg(phi2) << " cassette " << cassette << ":" << cassette0
511  << " Shift " << cms::convert2mm(cshift.first) << ":"
512  << cms::convert2mm(cshift.second);
513 #endif
514  std::string name = namesTop_[ii] + "L" + std::to_string(copy) + "F" + std::to_string(k);
515  ++k;
516  dd4hep::Solid solid = dd4hep::Tube(r1, r2, hthickl, phi1, phi2);
517  ns.addSolidNS(ns.prepend(name), solid);
518  dd4hep::Volume glog1 = dd4hep::Volume(solid.name(), solid, matter1);
519  ns.addVolumeNS(glog1);
520 #ifdef EDM_ML_DEBUG
521  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << glog1.name() << " Tubs made of "
522  << matter1.name() << " of dimensions " << cms::convert2mm(r1) << ", "
523  << cms::convert2mm(r2) << ", " << cms::convert2mm(hthickl) << ", "
524  << convertRadToDeg(phi1) << ", " << convertRadToDeg(phi2);
525 #endif
526  dd4hep::Position tran(-cshift.first, cshift.second, zpos);
527  glog.placeVolume(glog1, copy, tran);
528 #ifdef EDM_ML_DEBUG
529  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Position " << glog1.name() << " number "
530  << copy << " in " << glog.name() << " at (" << cms::convert2mm(cshift.first)
531  << ", " << cms::convert2mm(cshift.second) << ", " << cms::convert2mm(zpos)
532  << ") with no rotation";
533 #endif
534  }
535  ++copyNumberTop_[ii];
536  zpos += hthickl;
537  }
538  if (std::abs(thickTot - thick) >= tol2_) {
539  if (thickTot > thick) {
540  edm::LogError("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Thickness of the partition "
541  << cms::convert2mm(thick) << " is smaller than " << cms::convert2mm(thickTot)
542  << ": thickness of all its components in the top part **** ERROR ****";
543  } else {
544  edm::LogWarning("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Thickness of the partition "
545  << cms::convert2mm(thick) << " does not match with " << cms::convert2mm(thickTot)
546  << " of the components in top part";
547  }
548  }
549  } else {
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];
554  zpos += hthickl;
555  dd4hep::Material matter1 = ns.material(materialTop_[ii]);
556  unsigned int k = 0;
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()));
564 #ifdef EDM_ML_DEBUG
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;
569 #endif
570  for (int ti = firstTile; ti < lastTile; ++ti) {
571  double r1, r2;
572  int cassette, fimin, fimax;
573 #ifdef EDM_ML_DEBUG
574  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: ti " << ti << ":" << fine << " index "
575  << tileFineIndex_.size() << ":" << tileCoarseIndex_.size() << " Phis "
576  << tileFinePhis_.size() << ":" << tileCoarsePhis_.size();
577 #endif
578  if (fine) {
579  r1 = tileFineRMin_[std::get<1>(HGCalTileIndex::tileUnpack(tileFineIndex_[ti])) - 1];
580  r2 = tileFineRMax_[std::get<2>(HGCalTileIndex::tileUnpack(tileFineIndex_[ti])) - 1];
581  cassette = std::get<0>(HGCalTileIndex::tileUnpack(tileFinePhis_[ti]));
582  fimin = std::get<1>(HGCalTileIndex::tileUnpack(tileFinePhis_[ti]));
583  fimax = std::get<2>(HGCalTileIndex::tileUnpack(tileFinePhis_[ti]));
584  } else {
585  r1 = tileCoarseRMin_[std::get<1>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[ti])) - 1];
586  r2 = tileCoarseRMax_[std::get<2>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[ti])) - 1];
587  cassette = std::get<0>(HGCalTileIndex::tileUnpack(tileCoarsePhis_[ti]));
588  fimin = std::get<1>(HGCalTileIndex::tileUnpack(tileCoarsePhis_[ti]));
589  fimax = std::get<2>(HGCalTileIndex::tileUnpack(tileCoarsePhis_[ti]));
590  }
591 #ifdef EDM_ML_DEBUG
592  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Casstee|Fimin|Fimax " << cassette << ":"
593  << fimin << ":" << fimax;
594 #endif
595  double phi1 = dphi * (fimin - 1);
596  double phi2 = dphi * (fimax - fimin + 1);
597  auto cshift = cassette_.getShift(layer + 1, 1, cassette, true);
598 #ifdef EDM_ML_DEBUG
599  int cassette0 = HGCalCassette::cassetteType(2, 1, cassette); //
600  int ir1 = (fine) ? std::get<1>(HGCalTileIndex::tileUnpack(tileFineIndex_[ti]))
601  : std::get<1>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[ti]));
602  int ir2 = (fine) ? std::get<2>(HGCalTileIndex::tileUnpack(tileFineIndex_[ti]))
603  : std::get<2>(HGCalTileIndex::tileUnpack(tileCoarseIndex_[ti]));
604  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Layer " << copy << ":" << (layer + 1) << " iR "
605  << ir1 << ":" << ir2 << " R " << cms::convert2mm(r1) << ":" << cms::convert2mm(r2)
606  << " Thick " << cms::convert2mm(2.0 * hthickl) << " phi " << fimin << ":" << fimax
607  << ":" << convertRadToDeg(phi1) << ":" << convertRadToDeg(phi2) << " cassette "
608  << cassette << ":" << cassette0 << " Shift " << cms::convert2mm(cshift.first)
609  << ":" << cms::convert2mm(cshift.second);
610 #endif
611  std::string name = namesTop_[ii] + "L" + std::to_string(copy) + "F" + std::to_string(k);
612  ++k;
613  dd4hep::Solid solid = dd4hep::Tube(r1, r2, hthickl, phi1, phi2);
614  ns.addSolidNS(ns.prepend(name), solid);
615  dd4hep::Volume glog1 = dd4hep::Volume(solid.name(), solid, matter1);
616  ns.addVolumeNS(glog1);
617 #ifdef EDM_ML_DEBUG
618  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << glog1.name() << " Tubs made of "
619  << matter1.name() << " of dimensions " << cms::convert2mm(r1) << ", "
620  << cms::convert2mm(r2) << ", " << cms::convert2mm(hthickl) << ", "
621  << convertRadToDeg(phi1) << ", " << convertRadToDeg(phi2);
622 #endif
623  dd4hep::Position tran(-cshift.first, cshift.second, zpos);
624  glog.placeVolume(glog1, copy, tran);
625 #ifdef EDM_ML_DEBUG
626  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Position " << glog1.name() << " number "
627  << copy << " in " << glog.name() << " at (" << cms::convert2mm(-cshift.first)
628  << ", " << cms::convert2mm(cshift.second) << ", " << cms::convert2mm(zpos)
629  << ") with no rotation";
630 #endif
631  }
632  ++copyNumberCoverTop_[absType - 1];
633  }
634 
635  // Make the bottom part next
636  int layer = (copyM - firstFineLayer_);
637 #ifdef EDM_ML_DEBUG
638  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Start bottom section for layer " << layer
639  << " absType " << absType;
640 #endif
641  if (absType > 0) {
642 #ifdef EDM_ML_DEBUG
643  int kount(0);
644 #endif
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;
651 #ifdef EDM_ML_DEBUG
652  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette::Passive: layer " << layer + 1 << " cassette "
653  << cassette << " Shift " << cms::convert2mm(-cshift.first) << ":"
654  << cms::convert2mm(cshift.second) << " PassiveIndex " << i << ":"
655  << passiveFull_.size() << ":" << passivePart_.size();
656 #endif
657  std::string passive = (absType <= waferTypes_) ? passiveFull_[i] : passivePart_[i];
658 #ifdef EDM_ML_DEBUG
659  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: Passive " << passive << " number " << cassette
660  << " pos " << cms::convert2mm(xpos) << ":" << cms::convert2mm(ypos);
661  kount++;
662 #endif
663  dd4hep::Position tran(xpos, ypos, 0.0);
664  glog.placeVolume(ns.volume(passive), cassette, tran);
665 #ifdef EDM_ML_DEBUG
666  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << passive << " number " << cassette
667  << " positioned in " << glog.name() << " at (" << cms::convert2mm(xpos) << ","
668  << cms::convert2mm(ypos) << ",0) with no rotation";
669 #endif
670  }
671 #ifdef EDM_ML_DEBUG
672  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette: " << kount << " passives of type " << absType
673  << " for " << glog.name();
674 #endif
675  } else {
676  static const double sqrt3 = std::sqrt(3.0);
677  int layercenter = layerOrient_[layer];
678  int layertype = HGCalTypes::layerFrontBack(layerOrient_[layer]);
679  int firstWafer = waferLayerStart_[layer];
680  int lastWafer =
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_));
687 #ifdef EDM_ML_DEBUG
688  int ium(0), ivm(0), kount(0);
689  std::vector<int> ntype(3, 0);
690  edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedFineCassette::Bottom: " << glog.name() << " r "
691  << cms::convert2mm(delx) << " R " << cms::convert2mm(dely) << " dy "
692  << cms::convert2mm(dy) << " Shift " << cms::convert2mm(xyoff.first) << ":"
693  << cms::convert2mm(xyoff.second) << " WaferSize "
694  << cms::convert2mm(waferSize_ + waferSepar_) << " index " << firstWafer << ":"
695  << (lastWafer - 1) << " Copy " << copyM << ":" << layer;
696 #endif
697  for (int k = firstWafer; k < lastWafer; ++k) {
698  int u = HGCalWaferIndex::waferU(waferIndex_[k]);
699  int v = HGCalWaferIndex::waferV(waferIndex_[k]);
700 #ifdef EDM_ML_DEBUG
701  int iu = std::abs(u);
702  int iv = std::abs(v);
703 #endif
704  int nr = 2 * v;
705  int nc = -2 * u + v;
706  int type = HGCalProperty::waferThick(waferProperty_[k]);
707  int part = HGCalProperty::waferPartial(waferProperty_[k]);
708  int orien = HGCalProperty::waferOrient(waferProperty_[k]);
709  int cassette = HGCalProperty::waferCassette(waferProperty_[k]);
710  int place = HGCalCell::cellPlacementIndex(1, layertype, orien);
711 #ifdef EDM_ML_DEBUG
712  edm::LogVerbatim("HGCalGeom")
713  << "DDHGCalMixRotatedFineCassette::index:Property:layertype:type:part:orien:cassette:place:offsets:ind "
714  << k << waferProperty_[k] << ":" << layertype << ":" << type << ":" << part << ":" << orien << ":"
715  << cassette << ":" << place;
716 #endif
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;
720 #ifdef EDM_ML_DEBUG
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 "
725  << cassette << " Shift " << cms::convert2mm(cshift.first) << ":"
726  << cms::convert2mm(cshift.second) << " Original " << cms::convert2mm(xorig) << ":"
727  << cms::convert2mm(yorig) << ":" << convertRadToDeg(angle) << " Final "
728  << cms::convert2mm(xpos) << ":" << cms::convert2mm(ypos);
729 #endif
730  std::string wafer;
731  int i(999);
732  if (part == HGCalTypes::WaferFull) {
733  i = type * facingTypes_ * orientationTypes_ + place - placeOffset_;
734 #ifdef EDM_ML_DEBUG
735  edm::LogVerbatim("HGCalGeom") << " FullWafer type:place:ind " << type << ":" << place << ":" << i << ":"
736  << waferFull_.size();
737 #endif
738  wafer = waferFull_[i];
739  } else {
740  int partoffset =
742  i = (part - partoffset) * facingTypes_ * orientationTypes_ +
743  HGCalTypes::WaferTypeOffset[type] * facingTypes_ * orientationTypes_ + place - placeOffset_;
744 #ifdef EDM_ML_DEBUG
745  edm::LogVerbatim("HGCalGeom") << " layertype:type:part:orien:cassette:place:offsets:ind " << layertype << ":"
746  << type << ":" << part << ":" << orien << ":" << cassette << ":" << place << ":"
747  << partoffset << ":" << HGCalTypes::WaferTypeOffset[type] << ":" << i << ":"
748  << waferPart_.size();
749 #endif
750  wafer = waferPart_[i];
751  }
752  int copy = HGCalTypes::packTypeUV(type, u, v);
753 #ifdef EDM_ML_DEBUG
754  edm::LogVerbatim("HGCalGeom") << " DDHGCalMixRotatedFineCassette: Layer "
755  << HGCalWaferIndex::waferLayer(waferIndex_[k]) << " Wafer " << wafer << " number "
756  << copy << " type :part:orien:ind " << type << ":" << part << ":" << orien << ":"
757  << i << " layer:u:v " << (layer + firstFineLayer_) << ":" << u << ":" << v;
758  if (iu > ium)
759  ium = iu;
760  if (iv > ivm)
761  ivm = iv;
762  kount++;
763  if (copies_.count(copy) == 0)
764  copies_.insert(copy);
765 #endif
766  dd4hep::Position tran(xpos, ypos, 0.0);
767  glog.placeVolume(ns.volume(wafer), copy, tran);
768 #ifdef EDM_ML_DEBUG
769  ++ntype[type];
770  edm::LogVerbatim("HGCalGeom") << " DDHGCalMixRotatedFineCassette: " << wafer << " number " << copy << " type "
771  << layertype << ":" << type << " positioned in " << glog.name() << " at ("
772  << cms::convert2mm(xpos) << "," << cms::convert2mm(ypos)
773  << ",0) with no rotation";
774 #endif
775  }
776 #ifdef EDM_ML_DEBUG
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();
780 #endif
781  }
782  }
783 
786 
787  int waferTypes_; // Number of wafer types
788  int passiveTypes_; // Number of passive types
789  int facingTypes_; // Types of facings of modules toward IP
790  int orientationTypes_; // Number of partial wafer orienations
791  int partialTypes_; // Number of partial types
792  int placeOffset_; // Offset for placement
793  int phiBinsScint_; // Maximum number of cells along phi (coarse)
794  int phiBinsFineScint_; // Maximum number of cells along phi (fine)
795  int firstFineLayer_; // Copy # of the first Fine sensitive layer
796  int firstCoarseLayer_; // Copy # of the first Coarse sensitive layer
797  int absorbMode_; // Absorber mode
798  int sensitiveMode_; // Sensitive mode
799  int passiveMode_; // Mode for passive components
800  double zMinBlock_; // Starting z-value of the block
801  double waferSize_; // Width of the wafer
802  double waferSepar_; // Sensor separation
803  int sectors_; // Sectors
804  int cassettes_; // Cassettes
805  std::vector<double> slopeB_; // Slope at the lower R
806  std::vector<double> zFrontB_; // Starting Z values for the slopes
807  std::vector<double> rMinFront_; // Corresponding rMin's
808  std::vector<double> slopeT_; // Slopes at the larger R
809  std::vector<double> zFrontT_; // Starting Z values for the slopes
810  std::vector<double> rMaxFront_; // Corresponding rMax's
811  std::vector<std::string> waferFull_; // Names of full wafer modules
812  std::vector<std::string> waferPart_; // Names of partial wafer modules
813  std::vector<std::string> passiveFull_; // Names of full passive modules
814  std::vector<std::string> passivePart_; // Names of partial passive modules
815  std::vector<std::string> materials_; // Materials
816  std::vector<std::string> names_; // Names
817  std::vector<double> thick_; // Thickness of the material
818  std::vector<int> copyNumber_; // Initial copy numbers
819  std::vector<int> layers_; // Number of layers in a section
820  std::vector<double> layerThick_; // Thickness of each section
821  std::vector<int> layerType_; // Type of the layer
822  std::vector<int> layerSense_; // Content of a layer (sensitive?)
823  std::vector<std::string> materialTop_; // Materials of top layers
824  std::vector<std::string> namesTop_; // Names of top layers
825  std::vector<double> layerThickTop_; // Thickness of the top sections
826  std::vector<int> layerTypeTop_; // Type of the Top layer
827  std::vector<int> copyNumberTop_; // Initial copy numbers (top section)
828  int coverTypeTop_; // Type of the Top layer cover
829  int coverTopLayers_; // Number of cover layers in top section
830  std::vector<int> copyNumberCoverTop_; // Initial copy number of top cover
831  std::vector<int> layerOrient_; // Layer orientation for the silicon component
832  std::vector<int> waferIndex_; // Wafer index for the types
833  std::vector<int> waferProperty_; // Wafer property
834  std::vector<int> waferLayerStart_; // Start index of wafers in each layer
835  std::vector<double> cassetteShift_; // Shifts of the cassetes
836  std::vector<double> tileFineRMin_; // Minimum radius of each fine ring
837  std::vector<double> tileFineRMax_; // Maximum radius of each fine ring
838  std::vector<int> tileFineIndex_; // Index of tile (layer/start|end fine ring)
839  std::vector<int> tileFinePhis_; // Tile phi range for each index in fine ring
840  std::vector<int> tileFineLayerStart_; // Start index of tiles in each fine layer
841  std::vector<double> tileCoarseRMin_; // Minimum radius of each coarse ring
842  std::vector<double> tileCoarseRMax_; // Maximum radius of each coarse ring
843  std::vector<int> tileCoarseIndex_; // Index of tile (layer/start|end coarse ring)
844  std::vector<int> tileCoarsePhis_; // Tile phi range for each index in coarse ring
845  std::vector<int> tileCoarseLayerStart_; // Start index of tiles in each coarse layer
846  std::vector<double> cassetteShiftScnt_; // Shifts of the cassetes for scintillators
847  std::string nameSpace_; // Namespace of this and ALL sub-parts
848  std::unordered_set<int> copies_; // List of copy #'s
849  double alpha_, cosAlpha_;
850  static constexpr double tol2_ = 0.00001 * dd4hep::mm;
851 };
852 
853 static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) {
854  HGCalMixRotatedFineCassette siliconRotatedCassetteAlgo(ctxt, e);
855  return cms::s_executed;
856 }
857 
858 DECLARE_DDCMS_DETELEMENT(DDCMS_hgcal_DDHGCalMixRotatedFineCassette, algorithm)
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:239
static constexpr int32_t WaferPartLDOffset
Definition: HGCalTypes.h:57
static void radius(double zf, double zb, std::vector< double > const &zFront1, std::vector< double > const &rFront1, std::vector< double > const &slope1, std::vector< double > const &zFront2, std::vector< double > const &rFront2, std::vector< double > const &slope2, int flag, std::vector< double > &zz, std::vector< double > &rin, std::vector< double > &rout)
static constexpr int32_t WaferTypeOffset[3]
Definition: HGCalTypes.h:61
HGCalMixRotatedFineCassette(cms::DDParsingContext &ctxt, xml_h e)
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
Log< level::Error, false > LogError
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:166
int32_t waferOrient(const int32_t property)
static std::string to_string(const XMLCh *ch)
int32_t waferCassette(const int32_t property)
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition: DDPlugins.h:25
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
static constexpr long s_executed
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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)
Definition: Abs.h:22
int32_t waferThick(const int32_t property)
dd4hep::Volume Volume
ii
Definition: cuy.py:589
#define M_PI
std::tuple< int32_t, int32_t, int32_t > tileUnpack(int32_t index)
static constexpr int32_t WaferPartHDOffset
Definition: HGCalTypes.h:58
part
Definition: HCALResponse.h:20
int32_t waferPartial(const int32_t property)
int32_t waferV(const int32_t index)
static int32_t packTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:3
static constexpr int32_t WaferHDTop
Definition: HGCalTypes.h:51
Log< level::Warning, false > LogWarning
static int32_t layerType(int type)
Definition: HGCalTypes.cc:42
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
Definition: DDNamespace.cc:202
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition: DDNamespace.cc:276
static int cassetteType(int det, int zside, int cassette)
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
Definition: DDNamespace.cc:292
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
static constexpr int32_t layerFrontBack(int32_t layerOrient)
Definition: HGCalTypes.h:137