CMS 3D CMS Logo

DDHGCalSiliconRotatedModule.cc
Go to the documentation of this file.
1 // File: DDHGCalSiliconRotatedModule.cc
3 // Description: Geometry factory class for HGCal (EE and HESil) using
4 // information from the file for dd4hep
6 #include <cmath>
7 #include <memory>
8 #include <sstream>
9 #include <string>
10 #include <unordered_set>
11 #include <vector>
12 
21 #include "DD4hep/DetFactoryHelper.h"
26 
27 //#define EDM_ML_DEBUG
28 using namespace angle_units::operators;
29 
32  throw cms::Exception("HGCalGeom") << "Wrong initialization to HGCalSiliconRotatedModule";
33  }
35  cms::DDNamespace ns(ctxt, e, true);
37 
38 #ifdef EDM_ML_DEBUG
39  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: Creating an instance";
40 #endif
41  static constexpr double tol1 = 0.01 * dd4hep::mm;
42  static constexpr double tol2 = 0.00001 * dd4hep::mm;
43 
44  dd4hep::Volume mother = ns.volume(args.parentName());
45  waferTypes_ = args.value<int>("WaferTypes");
46  facingTypes_ = args.value<int>("FacingTypes");
47  orientationTypes_ = args.value<int>("OrientationTypes");
48  placeOffset_ = args.value<int>("PlaceOffset");
49 #ifdef EDM_ML_DEBUG
50  edm::LogVerbatim("HGCalGeom") << "Number of types of wafers: " << waferTypes_ << " facings: " << facingTypes_
51  << " Orientations: " << orientationTypes_ << " PlaceOffset: " << placeOffset_;
52 #endif
53  firstLayer_ = args.value<int>("FirstLayer");
54  absorbMode_ = args.value<int>("AbsorberMode");
55  sensitiveMode_ = args.value<int>("SensitiveMode");
56 #ifdef EDM_ML_DEBUG
57  edm::LogVerbatim("HGCalGeom") << "First Layer " << firstLayer_ << " and "
58  << "Absober:Sensitive mode " << absorbMode_ << ":" << sensitiveMode_;
59 #endif
60  zMinBlock_ = args.value<double>("zMinBlock");
61  waferSize_ = args.value<double>("waferSize");
62  waferSepar_ = args.value<double>("SensorSeparation");
63  sectors_ = args.value<int>("Sectors");
64  cassettes_ = args.value<int>("Cassettes");
65  alpha_ = (1._pi) / sectors_;
66  cosAlpha_ = cos(alpha_);
67  rotstr_ = args.value<std::string>("LayerRotation");
68 #ifdef EDM_ML_DEBUG
69  edm::LogVerbatim("HGCalGeom") << "zStart " << cms::convert2mm(zMinBlock_) << " wafer width "
70  << cms::convert2mm(waferSize_) << " separations " << cms::convert2mm(waferSepar_)
71  << " sectors " << sectors_ << ":" << convertRadToDeg(alpha_) << ":" << cosAlpha_
72  << " rotation matrix " << rotstr_ << " with " << cassettes_ << " cassettes";
73 #endif
74  waferFull_ = args.value<std::vector<std::string>>("WaferNamesFull");
75  waferPart_ = args.value<std::vector<std::string>>("WaferNamesPartial");
76 #ifdef EDM_ML_DEBUG
77  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << waferFull_.size() << " full and "
78  << waferPart_.size() << " partial modules\nDDHGCalSiliconRotatedModule:Full Modules:";
79  unsigned int i1max = static_cast<unsigned int>(waferFull_.size());
80  for (unsigned int i1 = 0; i1 < i1max; i1 += 2) {
81  std::ostringstream st1;
82  unsigned int i2 = std::min((i1 + 2), i1max);
83  for (unsigned int i = i1; i < i2; ++i)
84  st1 << " [" << i << "] " << waferFull_[i];
85  edm::LogVerbatim("HGCalGeom") << st1.str();
86  }
87  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: Partial Modules:";
88  i1max = static_cast<unsigned int>(waferPart_.size());
89  for (unsigned int i1 = 0; i1 < i1max; i1 += 2) {
90  std::ostringstream st1;
91  unsigned int i2 = std::min((i1 + 2), i1max);
92  for (unsigned int i = i1; i < i2; ++i)
93  st1 << " [" << i << "] " << waferPart_[i];
94  edm::LogVerbatim("HGCalGeom") << st1.str();
95  }
96 #endif
97  materials_ = args.value<std::vector<std::string>>("MaterialNames");
98  names_ = args.value<std::vector<std::string>>("VolumeNames");
99  thick_ = args.value<std::vector<double>>("Thickness");
100  copyNumber_.resize(materials_.size(), 1);
101 #ifdef EDM_ML_DEBUG
102  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << materials_.size() << " types of volumes";
103  for (unsigned int i = 0; i < names_.size(); ++i)
104  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names_[i] << " of thickness "
105  << cms::convert2mm(thick_[i]) << " filled with " << materials_[i]
106  << " first copy number " << copyNumber_[i];
107 #endif
108  layers_ = args.value<std::vector<int>>("Layers");
109  layerThick_ = args.value<std::vector<double>>("LayerThick");
110 #ifdef EDM_ML_DEBUG
111  edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks";
112  for (unsigned int i = 0; i < layers_.size(); ++i)
113  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << cms::convert2mm(layerThick_[i])
114  << " with " << layers_[i] << " layers";
115 #endif
116  layerType_ = args.value<std::vector<int>>("LayerType");
117  layerSense_ = args.value<std::vector<int>>("LayerSense");
118  layerOrient_ = args.value<std::vector<int>>("LayerTypes");
119  for (unsigned int k = 0; k < layerOrient_.size(); ++k)
120  layerOrient_[k] = HGCalTypes::layerType(layerOrient_[k]);
121 #ifdef EDM_ML_DEBUG
122  for (unsigned int i = 0; i < layerOrient_.size(); ++i)
123  edm::LogVerbatim("HGCalGeom") << "LayerTypes [" << i << "] " << layerOrient_[i];
124 #endif
125  if (firstLayer_ > 0) {
126  for (unsigned int i = 0; i < layerType_.size(); ++i) {
127  if (layerSense_[i] > 0) {
128  int ii = layerType_[i];
129  copyNumber_[ii] = (layerSense_[i] == 1) ? firstLayer_ : (firstLayer_ + 1);
130 #ifdef EDM_ML_DEBUG
131  edm::LogVerbatim("HGCalGeom") << "First copy number for layer type " << i << ":" << ii << " with "
132  << materials_[ii] << " changed to " << copyNumber_[ii];
133 #endif
134  }
135  }
136  } else {
137  firstLayer_ = 1;
138  }
139 #ifdef EDM_ML_DEBUG
140  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size() << " layers";
141  for (unsigned int i = 0; i < layerType_.size(); ++i)
142  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType_[i] << " sensitive class "
143  << layerSense_[i];
144 #endif
145  slopeB_ = args.value<std::vector<double>>("SlopeBottom");
146  zFrontB_ = args.value<std::vector<double>>("ZFrontBottom");
147  rMinFront_ = args.value<std::vector<double>>("RMinFront");
148  slopeT_ = args.value<std::vector<double>>("SlopeTop");
149  zFrontT_ = args.value<std::vector<double>>("ZFrontTop");
150  rMaxFront_ = args.value<std::vector<double>>("RMaxFront");
151 #ifdef EDM_ML_DEBUG
152  for (unsigned int i = 0; i < slopeB_.size(); ++i)
153  edm::LogVerbatim("HGCalGeom") << "Bottom Block [" << i << "] Zmin " << cms::convert2mm(zFrontB_[i]) << " Rmin "
154  << cms::convert2mm(rMinFront_[i]) << " Slope " << slopeB_[i];
155  for (unsigned int i = 0; i < slopeT_.size(); ++i)
156  edm::LogVerbatim("HGCalGeom") << "Top Block [" << i << "] Zmin " << cms::convert2mm(zFrontT_[i]) << " Rmax "
157  << cms::convert2mm(rMaxFront_[i]) << " Slope " << slopeT_[i];
158 #endif
159  waferIndex_ = args.value<std::vector<int>>("WaferIndex");
160  waferProperty_ = args.value<std::vector<int>>("WaferProperties");
161  waferLayerStart_ = args.value<std::vector<int>>("WaferLayerStart");
162  cassetteShift_ = args.value<std::vector<double>>("CassetteShift");
163 #ifdef EDM_ML_DEBUG
164  edm::LogVerbatim("HGCalGeom") << "waferProperties with " << waferIndex_.size() << " entries in "
165  << waferLayerStart_.size() << " layers";
166  for (unsigned int k = 0; k < waferLayerStart_.size(); ++k)
167  edm::LogVerbatim("HGCalGeom") << "LayerStart[" << k << "] " << waferLayerStart_[k];
168  for (unsigned int k = 0; k < waferIndex_.size(); ++k)
169  edm::LogVerbatim("HGCalGeom") << "Wafer[" << k << "] " << waferIndex_[k] << " ("
170  << HGCalWaferIndex::waferLayer(waferIndex_[k]) << ", "
171  << HGCalWaferIndex::waferU(waferIndex_[k]) << ", "
172  << HGCalWaferIndex::waferV(waferIndex_[k]) << ") : ("
173  << HGCalProperty::waferThick(waferProperty_[k]) << ":"
174  << HGCalProperty::waferPartial(waferProperty_[k]) << ":"
175  << HGCalProperty::waferOrient(waferProperty_[k]) << ")";
176  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << cassetteShift_.size()
177  << " elements for cassette shifts";
178  unsigned int j1max = cassetteShift_.size();
179  for (unsigned int j1 = 0; j1 < j1max; j1 += 6) {
180  std::ostringstream st1;
181  unsigned int j2 = std::min((j1 + 6), j1max);
182  for (unsigned int j = j1; j < j2; ++j)
183  st1 << " [" << j << "] " << std::setw(9) << cassetteShift_[j];
184  edm::LogVerbatim("HGCalGeom") << st1.str();
185  }
186 
187  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: NameSpace " << ns.name();
188 #endif
189  cassette_.setParameter(cassettes_, cassetteShift_);
190 
191 #ifdef EDM_ML_DEBUG
192  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalSiliconRotatedModule...";
193  copies_.clear();
194 #endif
195 
196  double zi(zMinBlock_);
197  int laymin(0);
198  for (unsigned int i = 0; i < layers_.size(); ++i) {
199  double zo = zi + layerThick_[i];
200  double routF = HGCalGeomTools::radius(zi, zFrontT_, rMaxFront_, slopeT_);
201  int laymax = laymin + layers_[i];
202  double zz = zi;
203  double thickTot(0);
204  for (int ly = laymin; ly < laymax; ++ly) {
205  int ii = layerType_[ly];
206  int copy = copyNumber_[ii];
207  double hthick = 0.5 * thick_[ii];
208  double rinB = HGCalGeomTools::radius(zo - tol1, zFrontB_, rMinFront_, slopeB_);
209  zz += hthick;
210  thickTot += thick_[ii];
211 
212  std::string name = names_[ii] + std::to_string(copy);
213 #ifdef EDM_ML_DEBUG
214  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: Layer " << ly << ":" << ii << " Front "
215  << cms::convert2mm(zi) << ", " << cms::convert2mm(routF) << " Back "
216  << cms::convert2mm(zo) << ", " << cms::convert2mm(rinB)
217  << " superlayer thickness " << cms::convert2mm(layerThick_[i]);
218 #endif
219 
220  dd4hep::Material matter = ns.material(materials_[ii]);
221  dd4hep::Volume glog;
222 
223  if (layerSense_[ly] < 1) {
224  std::vector<double> pgonZ, pgonRin, pgonRout;
225  double rmax = routF * cosAlpha_ - tol1;
226  HGCalGeomTools::radius(zz - hthick,
227  zz + hthick,
228  zFrontB_,
229  rMinFront_,
230  slopeB_,
231  zFrontT_,
232  rMaxFront_,
233  slopeT_,
234  -layerSense_[ly],
235  pgonZ,
236  pgonRin,
237  pgonRout);
238  for (unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
239  pgonZ[isec] -= zz;
240  if (layerSense_[ly] == 0 || absorbMode_ == 0)
241  pgonRout[isec] = rmax;
242  else
243  pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1;
244  }
245  dd4hep::Solid solid = dd4hep::Polyhedra(sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
246  ns.addSolidNS(ns.prepend(name), solid);
247  glog = dd4hep::Volume(solid.name(), solid, matter);
248  ns.addVolumeNS(glog);
249 #ifdef EDM_ML_DEBUG
250  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << solid.name() << " polyhedra of "
251  << sectors_ << " sectors covering " << convertRadToDeg(-alpha_) << ":"
252  << convertRadToDeg(-alpha_ + 2._pi) << " with " << pgonZ.size()
253  << " sections and filled with " << matter.name();
254  for (unsigned int k = 0; k < pgonZ.size(); ++k)
255  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << cms::convert2mm(pgonZ[k]) << " R "
256  << cms::convert2mm(pgonRin[k]) << ":" << cms::convert2mm(pgonRout[k]);
257 #endif
258  } else {
259  double rins =
260  (sensitiveMode_ < 1) ? rinB : HGCalGeomTools::radius(zz + hthick - tol1, zFrontB_, rMinFront_, slopeB_);
261  double routs =
262  (sensitiveMode_ < 1) ? routF : HGCalGeomTools::radius(zz - hthick, zFrontT_, rMaxFront_, slopeT_);
263  dd4hep::Solid solid = dd4hep::Tube(rins, routs, hthick, 0.0, 2._pi);
264  ns.addSolidNS(ns.prepend(name), solid);
265  glog = dd4hep::Volume(solid.name(), solid, matter);
266  ns.addVolumeNS(glog);
267 
268 #ifdef EDM_ML_DEBUG
269  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << solid.name() << " Tubs made of "
270  << matter.name() << " of dimensions " << cms::convert2mm(rinB) << ":"
271  << cms::convert2mm(rins) << ", " << cms::convert2mm(routF) << ":"
272  << cms::convert2mm(routs) << ", " << cms::convert2mm(hthick)
273  << ", 0.0, 360.0 and position " << glog.name() << " number " << copy << ":"
274  << layerOrient_[copy - firstLayer_];
275 #endif
276  positionSensitive(ctxt, e, glog, (copy - firstLayer_));
277  }
278 
279  dd4hep::Position r1(0, 0, zz);
280  dd4hep::Rotation3D rot;
281 #ifdef EDM_ML_DEBUG
282  std::string rotName("Null");
283 #endif
284  if ((layerSense_[ly] > 0) && (layerOrient_[copy - firstLayer_] == HGCalTypes::WaferCenterR)) {
285  rot = ns.rotation(rotstr_);
286 #ifdef EDM_ML_DEBUG
287  rotName = rotstr_;
288 #endif
289  }
290  mother.placeVolume(glog, copy, dd4hep::Transform3D(rot, r1));
291  int inc = ((layerSense_[ly] > 0) && (facingTypes_ > 1)) ? 2 : 1;
292  copyNumber_[ii] = copy + inc;
293 #ifdef EDM_ML_DEBUG
294  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << glog.name() << " number " << copy
295  << " positioned in " << mother.name() << " at (0,0," << cms::convert2mm(zz)
296  << ") with " << rotName << " rotation";
297 #endif
298  zz += hthick;
299  } // End of loop over layers in a block
300  zi = zo;
301  laymin = laymax;
302  // Make consistency check of all the partitions of the block
303  if (std::abs(thickTot - layerThick_[i]) >= tol2) {
304  if (thickTot > layerThick_[i]) {
305  edm::LogError("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(layerThick_[i])
306  << " is smaller than " << cms::convert2mm(thickTot)
307  << ": thickness of all its components **** ERROR ****";
308  } else {
309  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(layerThick_[i])
310  << " does not match with " << cms::convert2mm(thickTot) << " of the components";
311  }
312  }
313  } // End of loop over blocks
314 
315 #ifdef EDM_ML_DEBUG
316  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << copies_.size()
317  << " different wafer copy numbers";
318  int k(0);
319  for (std::unordered_set<int>::const_iterator itr = copies_.begin(); itr != copies_.end(); ++itr, ++k) {
320  edm::LogVerbatim("HGCalGeom") << "Copy [" << k << "] : " << (*itr);
321  }
322  copies_.clear();
323  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalSiliconRotatedModule construction...";
324 #endif
325  }
326 
327  void positionSensitive(cms::DDParsingContext& ctxt, xml_h e, const dd4hep::Volume& glog, int layer) {
328  cms::DDNamespace ns(ctxt, e, true);
329  static const double sqrt3 = std::sqrt(3.0);
330  int layercenter = layerOrient_[layer];
331  int layertype = (layerOrient_[layer] == HGCalTypes::WaferCenterB) ? 1 : 0;
332  int firstWafer = waferLayerStart_[layer];
333  int lastWafer = ((layer + 1 < static_cast<int>(waferLayerStart_.size())) ? waferLayerStart_[layer + 1]
334  : static_cast<int>(waferIndex_.size()));
335  double delx = 0.5 * (waferSize_ + waferSepar_);
336  double dely = 2.0 * delx / sqrt3;
337  double dy = 0.75 * dely;
338  const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
339 #ifdef EDM_ML_DEBUG
340  int ium(0), ivm(0), kount(0);
341  std::vector<int> ntype(3, 0);
342  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << glog.name() << " r " << cms::convert2mm(delx)
343  << " R " << cms::convert2mm(dely) << " dy " << cms::convert2mm(dy) << " Shift "
344  << cms::convert2mm(xyoff.first) << ":" << cms::convert2mm(xyoff.second)
345  << " WaferSize " << cms::convert2mm((waferSize_ + waferSepar_)) << " index "
346  << firstWafer << ":" << (lastWafer - 1) << " Layer Center " << layercenter << ":"
347  << layertype;
348 #endif
349  for (int k = firstWafer; k < lastWafer; ++k) {
350  int u = HGCalWaferIndex::waferU(waferIndex_[k]);
351  int v = HGCalWaferIndex::waferV(waferIndex_[k]);
352 #ifdef EDM_ML_DEBUG
353  int iu = std::abs(u);
354  int iv = std::abs(v);
355 #endif
356  int nr = 2 * v;
357  int nc = -2 * u + v;
358  int type = HGCalProperty::waferThick(waferProperty_[k]);
359  int part = HGCalProperty::waferPartial(waferProperty_[k]);
360  int orien = HGCalProperty::waferOrient(waferProperty_[k]);
361  int cassette = HGCalProperty::waferCassette(waferProperty_[k]);
362  int place = HGCalCell::cellPlacementIndex(1, layertype, orien);
363  auto cshift = cassette_.getShift(layer + 1, -1, cassette);
364  double xpos = xyoff.first - cshift.first + nc * delx;
365  double ypos = xyoff.second + cshift.second + nr * dy;
366 #ifdef EDM_ML_DEBUG
367  double xorig = xyoff.first + nc * delx;
368  double yorig = xyoff.second + nr * dy;
369  double angle = std::atan2(yorig, xorig);
370  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule::Wafer: layer " << layer + 1 << " cassette "
371  << cassette << " Shift " << cshift.first << ":" << cshift.second << " Original "
372  << xorig << ":" << yorig << ":" << convertRadToDeg(angle) << " Final " << xpos
373  << ":" << ypos << " u|v " << u << ":" << v << " type|part|orient|place " << type
374  << ":" << part << ":" << orien << ":" << place;
375 #endif
376  std::string wafer;
377  int i(999);
378  if (part == HGCalTypes::WaferFull) {
379  i = type * facingTypes_ * orientationTypes_ + place - placeOffset_;
380  wafer = waferFull_[i];
381 #ifdef EDM_ML_DEBUG
382  edm::LogVerbatim("HGCalGeom") << " layertype:type:part:orien:cassette:place:offsets:ind " << layertype << ":"
383  << type << ":" << part << ":" << orien << ":" << cassette << ":" << place << ":"
384  << placeOffset_ << ":" << facingTypes_ << ":" << orientationTypes_ << " wafer "
385  << i << ":" << wafer;
386 #endif
387  } else {
388  int partoffset =
390  i = (part - partoffset) * facingTypes_ * orientationTypes_ +
391  HGCalTypes::WaferTypeOffset[type] * facingTypes_ * orientationTypes_ + place - placeOffset_;
392 #ifdef EDM_ML_DEBUG
393  edm::LogVerbatim("HGCalGeom") << " layertype:type:part:orien:cassette:place:offsets:ind " << layertype << ":"
394  << type << ":" << part << ":" << orien << ":" << cassette << ":" << place << ":"
395  << partoffset << ":" << HGCalTypes::WaferTypeOffset[type] << ":" << i << ":"
396  << waferPart_.size();
397 #endif
398  wafer = waferPart_[i];
399  }
400  int copy = HGCalTypes::packTypeUV(type, u, v);
401 #ifdef EDM_ML_DEBUG
402  edm::LogVerbatim("HGCalGeom") << " DDHGCalSiliconRotatedModule: Layer"
403  << HGCalWaferIndex::waferLayer(waferIndex_[k]) << " Wafer " << wafer << " number "
404  << copy << " type:part:orien:ind " << type << ":" << part << ":" << orien << ":"
405  << i << " layer:u:v:indx " << (layer + firstLayer_) << ":" << u << ":" << v;
406  if (iu > ium)
407  ium = iu;
408  if (iv > ivm)
409  ivm = iv;
410  kount++;
411  if (copies_.count(copy) == 0)
412  copies_.insert(copy);
413 #endif
414  dd4hep::Position tran(xpos, ypos, 0.0);
415  glog.placeVolume(ns.volume(wafer), copy, tran);
416 #ifdef EDM_ML_DEBUG
417  ++ntype[type];
418  edm::LogVerbatim("HGCalGeom") << " DDHGCalSiliconRotatedModule: " << wafer << " number " << copy << " type "
419  << layertype << ":" << type << " positioned in " << glog.name() << " at ("
420  << cms::convert2mm(xpos) << "," << cms::convert2mm(ypos) << ",0) with no rotation";
421 #endif
422  }
423 
424 #ifdef EDM_ML_DEBUG
425  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: Maximum # of u " << ium << " # of v " << ivm
426  << " and " << kount << " wafers (" << ntype[0] << ":" << ntype[1] << ":" << ntype[2]
427  << ") for " << glog.name();
428 #endif
429  }
430 
431  //Required data members to cache the values from XML file
434 
435  int waferTypes_; // Number of wafer types
436  int facingTypes_; // Types of facings of modules toward IP
437  int orientationTypes_; // Number of wafer orienations
438  int placeOffset_; // Offset for placement
439  int firstLayer_; // Copy # of the first sensitive layer
440  int absorbMode_; // Absorber mode
441  int sensitiveMode_; // Sensitive mode
442  double zMinBlock_; // Starting z-value of the block
443  double waferSize_; // Width of the wafer
444  double waferSepar_; // Sensor separation
445  int sectors_; // Sectors
446  int cassettes_; // Cassettes
447  std::string rotstr_; // Rotation matrix (if needed)
448  std::vector<std::string> waferFull_; // Names of full wafer modules
449  std::vector<std::string> waferPart_; // Names of partial wafer modules
450  std::vector<std::string> materials_; // names of materials
451  std::vector<std::string> names_; // Names of volumes
452  std::vector<double> thick_; // Thickness of the material
453  std::vector<int> copyNumber_; // Initial copy numbers
454  std::vector<int> layers_; // Number of layers in a section
455  std::vector<double> layerThick_; // Thickness of each section
456  std::vector<int> layerType_; // Type of the layer
457  std::vector<int> layerSense_; // Content of a layer (sensitive?)
458  std::vector<double> slopeB_; // Slope at the lower R
459  std::vector<double> zFrontB_; // Starting Z values for the slopes
460  std::vector<double> rMinFront_; // Corresponding rMin's
461  std::vector<double> slopeT_; // Slopes at the larger R
462  std::vector<double> zFrontT_; // Starting Z values for the slopes
463  std::vector<double> rMaxFront_; // Corresponding rMax's
464  std::vector<int> layerOrient_; // Layer orientation (Centering, rotations..)
465  std::vector<int> waferIndex_; // Wafer index for the types
466  std::vector<int> waferProperty_; // Wafer property
467  std::vector<int> waferLayerStart_; // Index of wafers in each layer
468  std::vector<double> cassetteShift_; // Shifts of the cassetes
469  std::unordered_set<int> copies_; // List of copy #'s
470  double alpha_, cosAlpha_;
471 };
472 
473 static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) {
474  HGCalSiliconRotatedModule eeSiliconRotatedModuleAlgo(ctxt, e);
475  return cms::s_executed;
476 }
477 
478 DECLARE_DDCMS_DETELEMENT(DDCMS_hgcal_DDHGCalSiliconRotatedModule, algorithm)
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
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)
const dd4hep::Rotation3D & rotation(const std::string &name) const
Definition: DDNamespace.cc:182
int32_t *__restrict__ iv
static constexpr int32_t WaferTypeOffset[3]
Definition: HGCalTypes.h:59
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
std::vector< std::string > materials_
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)
HGCalSiliconRotatedModule(cms::DDParsingContext &ctxt, xml_h e)
static const std::string & rotName(const T &rot, const cms::DDParsingContext &context)
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:19
std::string_view name() const
Definition: DDNamespace.h:79
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::string > waferFull_
int32_t waferThick(const int32_t property)
dd4hep::Volume Volume
ii
Definition: cuy.py:589
static constexpr int32_t WaferPartHDOffset
Definition: HGCalTypes.h:58
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:27
part
Definition: HCALResponse.h:20
int32_t waferPartial(const int32_t property)
int32_t waferV(const int32_t index)
std::vector< std::string > names_
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
static constexpr int32_t WaferCenterB
Definition: HGCalTypes.h:26
void positionSensitive(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, int layer)
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition: DDNamespace.cc:276
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
std::vector< std::string > waferPart_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11