CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
HGCalSiliconRotatedCassette Struct Reference

Public Member Functions

 HGCalSiliconRotatedCassette ()
 
 HGCalSiliconRotatedCassette (cms::DDParsingContext &ctxt, xml_h e)
 
void positionPassive (cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, int layer, int absType)
 
void positionSensitive (cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, int layer)
 

Public Attributes

int absorbMode_
 
double alpha_
 
HGCalCassette cassette_
 
int cassettes_
 
std::vector< double > cassetteShift_
 
std::unordered_set< int > copies_
 
std::vector< int > copyNumber_
 
double cosAlpha_
 
int facingTypes_
 
int firstLayer_
 
HGCalGeomTools geomTools_
 
std::vector< int > layerOrient_
 
std::vector< int > layers_
 
std::vector< int > layerSense_
 
std::vector< double > layerThick_
 
std::vector< int > layerType_
 
std::vector< std::string > materials_
 
std::vector< std::string > names_
 
int orientationTypes_
 
int partialTypes_
 
std::vector< std::string > passiveFull_
 
std::vector< std::string > passivePart_
 
int passiveTypes_
 
int placeOffset_
 
std::vector< double > rMaxFront_
 
std::vector< double > rMinFront_
 
std::string rotstr_
 
int sectors_
 
int sensitiveMode_
 
std::vector< double > slopeB_
 
std::vector< double > slopeT_
 
std::vector< double > thick_
 
std::vector< std::string > waferFull_
 
std::vector< int > waferIndex_
 
std::vector< int > waferLayerStart_
 
std::vector< std::string > waferPart_
 
std::vector< int > waferProperty_
 
double waferSepar_
 
double waferSize_
 
int waferTypes_
 
std::vector< double > zFrontB_
 
std::vector< double > zFrontT_
 
double zMinBlock_
 

Detailed Description

Definition at line 30 of file DDHGCalSiliconRotatedCassette.cc.

Constructor & Destructor Documentation

◆ HGCalSiliconRotatedCassette() [1/2]

HGCalSiliconRotatedCassette::HGCalSiliconRotatedCassette ( )
inline

Definition at line 31 of file DDHGCalSiliconRotatedCassette.cc.

References Exception.

31  {
32  throw cms::Exception("HGCalGeom") << "Wrong initialization to HGCalSiliconRotatedCassette";
33  }

◆ HGCalSiliconRotatedCassette() [2/2]

HGCalSiliconRotatedCassette::HGCalSiliconRotatedCassette ( cms::DDParsingContext ctxt,
xml_h  e 
)
inline

Definition at line 34 of file DDHGCalSiliconRotatedCassette.cc.

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), writedatasetfile::args, cms::convert2mm(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), MillePedeFileConverter_cfg::e, mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, cuy::ii, dqmiolumiharvest::j, dqmdumpme::k, HGCalTypes::layerType(), cms::DDNamespace::material(), g4SimHits_cfi::Material, SiStripPI::min, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, Skims_PA_cff::name, HGCalGeometryMode::Polyhedra, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), HGCalGeomTools::radius(), makeMuonMisalignmentScenario::rot, cms::DDNamespace::rotation(), cms::rotation_utils::rotName(), AlCaHLTBitMon_QueryRunRegistry::string, to_string(), cms::DDNamespace::volume(), HGCalTypes::WaferCenterR, HGCalWaferIndex::waferLayer(), HGCalProperty::waferOrient(), HGCalProperty::waferPartial(), HGCalProperty::waferThick(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and geometryCSVtoXML::zz.

34  {
35  cms::DDNamespace ns(ctxt, e, true);
37 
38 #ifdef EDM_ML_DEBUG
39  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: 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  passiveTypes_ = args.value<int>("PassiveTypes");
47  facingTypes_ = args.value<int>("FacingTypes");
48  orientationTypes_ = args.value<int>("OrientationTypes");
49  partialTypes_ = args.value<int>("PartialTypes");
50  placeOffset_ = args.value<int>("PlaceOffset");
51 #ifdef EDM_ML_DEBUG
52  edm::LogVerbatim("HGCalGeom") << "Number of types of wafers: " << waferTypes_ << " passives: " << passiveTypes_
53  << " facings: " << facingTypes_ << " Orientations: " << orientationTypes_
54  << " PartialTypes: " << partialTypes_ << " PlaceOffset: " << placeOffset_;
55 #endif
56  firstLayer_ = args.value<int>("FirstLayer");
57  absorbMode_ = args.value<int>("AbsorberMode");
58  sensitiveMode_ = args.value<int>("SensitiveMode");
59 #ifdef EDM_ML_DEBUG
60  edm::LogVerbatim("HGCalGeom") << "First Layer " << firstLayer_ << " and Absober:Sensitive mode " << absorbMode_
61  << ":" << sensitiveMode_;
62 #endif
63  zMinBlock_ = args.value<double>("zMinBlock");
64  waferSize_ = args.value<double>("waferSize");
65  waferSepar_ = args.value<double>("SensorSeparation");
66  sectors_ = args.value<int>("Sectors");
67  cassettes_ = args.value<int>("Cassettes");
68  alpha_ = (1._pi) / sectors_;
69  cosAlpha_ = cos(alpha_);
70  rotstr_ = args.value<std::string>("LayerRotation");
71 #ifdef EDM_ML_DEBUG
72  edm::LogVerbatim("HGCalGeom") << "zStart " << cms::convert2mm(zMinBlock_) << " wafer width "
73  << cms::convert2mm(waferSize_) << " separations " << cms::convert2mm(waferSepar_)
74  << " sectors " << sectors_ << ":" << convertRadToDeg(alpha_) << ":" << cosAlpha_
75  << " rotation matrix " << rotstr_ << " with " << cassettes_ << " cassettes";
76 #endif
77  waferFull_ = args.value<std::vector<std::string>>("WaferNamesFull");
78  waferPart_ = args.value<std::vector<std::string>>("WaferNamesPartial");
79 #ifdef EDM_ML_DEBUG
80  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << waferFull_.size() << " full and "
81  << waferPart_.size() << " partial modules";
82  unsigned int i1max = static_cast<unsigned int>(waferFull_.size());
83  for (unsigned int i1 = 0; i1 < i1max; i1 += 2) {
84  std::ostringstream st1;
85  unsigned int i2 = std::min((i1 + 2), i1max);
86  for (unsigned int i = i1; i < i2; ++i)
87  st1 << " [" << i << "] " << waferFull_[i];
88  edm::LogVerbatim("HGCalGeom") << st1.str();
89  }
90  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: Partial Modules:";
91  i1max = static_cast<unsigned int>(waferPart_.size());
92  for (unsigned int i1 = 0; i1 < i1max; i1 += 2) {
93  std::ostringstream st1;
94  unsigned int i2 = std::min((i1 + 2), i1max);
95  for (unsigned int i = i1; i < i2; ++i)
96  st1 << " [" << i << "] " << waferPart_[i];
97  edm::LogVerbatim("HGCalGeom") << st1.str();
98  }
99 #endif
100  passiveFull_ = args.value<std::vector<std::string>>("PassiveNamesFull");
101  passivePart_ = args.value<std::vector<std::string>>("PassiveNamesPartial");
102 #ifdef EDM_ML_DEBUG
103  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << passiveFull_.size() << " full and "
104  << passivePart_.size() << " partial passive modules";
105  i1max = static_cast<unsigned int>(passiveFull_.size());
106  for (unsigned int i1 = 0; i1 < i1max; i1 += 2) {
107  std::ostringstream st1;
108  unsigned int i2 = std::min((i1 + 2), i1max);
109  for (unsigned int i = i1; i < i2; ++i)
110  st1 << " [" << i << "] " << passiveFull_[i];
111  edm::LogVerbatim("HGCalGeom") << st1.str();
112  }
113  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: Partial Modules:";
114  i1max = static_cast<unsigned int>(passivePart_.size());
115  for (unsigned int i1 = 0; i1 < i1max; i1 += 2) {
116  std::ostringstream st1;
117  unsigned int i2 = std::min((i1 + 2), i1max);
118  for (unsigned int i = i1; i < i2; ++i)
119  st1 << " [" << i << "] " << passivePart_[i];
120  edm::LogVerbatim("HGCalGeom") << st1.str();
121  }
122 #endif
123  materials_ = args.value<std::vector<std::string>>("MaterialNames");
124  names_ = args.value<std::vector<std::string>>("VolumeNames");
125  thick_ = args.value<std::vector<double>>("Thickness");
126  copyNumber_.resize(materials_.size(), 1);
127 #ifdef EDM_ML_DEBUG
128  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << materials_.size() << " types of volumes";
129  for (unsigned int i = 0; i < names_.size(); ++i)
130  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names_[i] << " of thickness "
131  << cms::convert2mm(thick_[i]) << " filled with " << materials_[i]
132  << " first copy number " << copyNumber_[i];
133 #endif
134  layers_ = args.value<std::vector<int>>("Layers");
135  layerThick_ = args.value<std::vector<double>>("LayerThick");
136 #ifdef EDM_ML_DEBUG
137  edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks";
138  for (unsigned int i = 0; i < layers_.size(); ++i)
139  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << cms::convert2mm(layerThick_[i])
140  << " with " << layers_[i] << " layers";
141 #endif
142  layerType_ = args.value<std::vector<int>>("LayerType");
143  layerSense_ = args.value<std::vector<int>>("LayerSense");
144  layerOrient_ = args.value<std::vector<int>>("LayerTypes");
145  for (unsigned int k = 0; k < layerOrient_.size(); ++k)
147 #ifdef EDM_ML_DEBUG
148  for (unsigned int i = 0; i < layerOrient_.size(); ++i)
149  edm::LogVerbatim("HGCalGeom") << "LayerTypes [" << i << "] " << layerOrient_[i];
150 #endif
151  if (firstLayer_ > 0) {
152  for (unsigned int i = 0; i < layerType_.size(); ++i) {
153  if (layerSense_[i] > 0) {
154  int ii = layerType_[i];
155  copyNumber_[ii] = (layerSense_[i] == 1) ? firstLayer_ : (firstLayer_ + 1);
156 #ifdef EDM_ML_DEBUG
157  edm::LogVerbatim("HGCalGeom") << "First copy number for layer type " << i << ":" << ii << " with "
158  << materials_[ii] << " changed to " << copyNumber_[ii];
159 #endif
160  }
161  }
162  } else {
163  firstLayer_ = 1;
164  }
165 #ifdef EDM_ML_DEBUG
166  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size() << " layers";
167  for (unsigned int i = 0; i < layerType_.size(); ++i)
168  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType_[i] << " sensitive class "
169  << layerSense_[i];
170 #endif
171  slopeB_ = args.value<std::vector<double>>("SlopeBottom");
172  zFrontB_ = args.value<std::vector<double>>("ZFrontBottom");
173  rMinFront_ = args.value<std::vector<double>>("RMinFront");
174  slopeT_ = args.value<std::vector<double>>("SlopeTop");
175  zFrontT_ = args.value<std::vector<double>>("ZFrontTop");
176  rMaxFront_ = args.value<std::vector<double>>("RMaxFront");
177 #ifdef EDM_ML_DEBUG
178  for (unsigned int i = 0; i < slopeB_.size(); ++i)
179  edm::LogVerbatim("HGCalGeom") << "Bottom Block [" << i << "] Zmin " << cms::convert2mm(zFrontB_[i]) << " Rmin "
180  << cms::convert2mm(rMinFront_[i]) << " Slope " << slopeB_[i];
181  for (unsigned int i = 0; i < slopeT_.size(); ++i)
182  edm::LogVerbatim("HGCalGeom") << "Top Block [" << i << "] Zmin " << cms::convert2mm(zFrontT_[i]) << " Rmax "
183  << cms::convert2mm(rMaxFront_[i]) << " Slope " << slopeT_[i];
184 #endif
185  waferIndex_ = args.value<std::vector<int>>("WaferIndex");
186  waferProperty_ = args.value<std::vector<int>>("WaferProperties");
187  waferLayerStart_ = args.value<std::vector<int>>("WaferLayerStart");
188  cassetteShift_ = args.value<std::vector<double>>("CassetteShift");
189 #ifdef EDM_ML_DEBUG
190  edm::LogVerbatim("HGCalGeom") << "waferProperties with " << waferIndex_.size() << " entries in "
191  << waferLayerStart_.size() << " layers";
192  for (unsigned int k = 0; k < waferLayerStart_.size(); ++k)
193  edm::LogVerbatim("HGCalGeom") << "LayerStart[" << k << "] " << waferLayerStart_[k];
194  for (unsigned int k = 0; k < waferIndex_.size(); ++k)
195  edm::LogVerbatim("HGCalGeom") << "Wafer[" << k << "] " << waferIndex_[k] << " ("
198  << HGCalWaferIndex::waferV(waferIndex_[k]) << ") : ("
202  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << cassetteShift_.size()
203  << " elements for cassette shifts";
204  unsigned int j1max = cassetteShift_.size();
205  for (unsigned int j1 = 0; j1 < j1max; j1 += 6) {
206  std::ostringstream st1;
207  unsigned int j2 = std::min((j1 + 6), j1max);
208  for (unsigned int j = j1; j < j2; ++j)
209  st1 << " [" << j << "] " << std::setw(9) << cms::convert2mm(cassetteShift_[j]);
210  edm::LogVerbatim("HGCalGeom") << st1.str();
211  }
212 #endif
214 
215 #ifdef EDM_ML_DEBUG
216  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalSiliconRotatedCassette...";
217  copies_.clear();
218 #endif
219 
220  double zi(zMinBlock_);
221  int laymin(0);
222  for (unsigned int i = 0; i < layers_.size(); i++) {
223  double zo = zi + layerThick_[i];
224  double routF = HGCalGeomTools::radius(zi, zFrontT_, rMaxFront_, slopeT_);
225  int laymax = laymin + layers_[i];
226  double zz = zi;
227  double thickTot(0);
228  for (int ly = laymin; ly < laymax; ++ly) {
229  int ii = layerType_[ly];
230  int copy = copyNumber_[ii];
231  double hthick = 0.5 * thick_[ii];
232  double rinB = HGCalGeomTools::radius(zo - tol1, zFrontB_, rMinFront_, slopeB_);
233  zz += hthick;
234  thickTot += thick_[ii];
235 
237 #ifdef EDM_ML_DEBUG
238  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: Layer " << ly << ":" << ii << " Front "
239  << cms::convert2mm(zi) << ", " << cms::convert2mm(routF) << " Back "
240  << cms::convert2mm(zo) << ", " << cms::convert2mm(rinB)
241  << " superlayer thickness " << cms::convert2mm(layerThick_[i]);
242 #endif
243  dd4hep::Material matter = ns.material(materials_[ii]);
244  dd4hep::Volume glog;
245  if (layerSense_[ly] == 0) {
246  std::vector<double> pgonZ, pgonRin, pgonRout;
247  double rmax = routF * cosAlpha_ - tol1;
248  HGCalGeomTools::radius(zz - hthick,
249  zz + hthick,
250  zFrontB_,
251  rMinFront_,
252  slopeB_,
253  zFrontT_,
254  rMaxFront_,
255  slopeT_,
256  -layerSense_[ly],
257  pgonZ,
258  pgonRin,
259  pgonRout);
260  for (unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
261  pgonZ[isec] -= zz;
262  if (layerSense_[ly] == 0 || absorbMode_ == 0)
263  pgonRout[isec] = rmax;
264  else
265  pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1;
266  }
267  dd4hep::Solid solid = dd4hep::Polyhedra(sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
268  ns.addSolidNS(ns.prepend(name), solid);
269  glog = dd4hep::Volume(solid.name(), solid, matter);
270  ns.addVolumeNS(glog);
271 #ifdef EDM_ML_DEBUG
272  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << solid.name() << " polyhedra of "
273  << sectors_ << " sectors covering " << convertRadToDeg(-alpha_) << ":"
274  << convertRadToDeg(-alpha_ + 2._pi) << " with " << pgonZ.size()
275  << " sections and filled with " << matter.name();
276  for (unsigned int k = 0; k < pgonZ.size(); ++k)
277  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << cms::convert2mm(pgonZ[k]) << " R "
278  << cms::convert2mm(pgonRin[k]) << ":" << cms::convert2mm(pgonRout[k]);
279 #endif
280  } else {
281  int mode = (layerSense_[ly] > 0) ? sensitiveMode_ : absorbMode_;
282  double rins = (mode < 1) ? rinB : HGCalGeomTools::radius(zz + hthick - tol1, zFrontB_, rMinFront_, slopeB_);
283  double routs = (mode < 1) ? routF : HGCalGeomTools::radius(zz - hthick, zFrontT_, rMaxFront_, slopeT_);
284  dd4hep::Solid solid = dd4hep::Tube(rins, routs, hthick, 0.0, 2._pi);
285  ns.addSolidNS(ns.prepend(name), solid);
286  glog = dd4hep::Volume(solid.name(), solid, matter);
287  ns.addVolumeNS(glog);
288 #ifdef EDM_ML_DEBUG
289  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << solid.name() << " Tubs made of "
290  << matter.name() << " of dimensions " << cms::convert2mm(rinB) << ":"
291  << cms::convert2mm(rins) << ", " << cms::convert2mm(routF) << ":"
292  << cms::convert2mm(routs) << ", " << cms::convert2mm(hthick)
293  << ", 0.0, 360.0 and position " << glog.name() << " number " << copy << ":"
294  << layerOrient_[copy - firstLayer_] << " Z " << cms::convert2mm(zz);
295 #endif
296  if (layerSense_[ly] > 0)
297  positionSensitive(ctxt, e, glog, (copy - firstLayer_));
298  else
299  positionPassive(ctxt, e, glog, (copy - firstLayer_), -layerSense_[ly]);
300  }
301  dd4hep::Position r1(0, 0, zz);
302  dd4hep::Rotation3D rot;
303 #ifdef EDM_ML_DEBUG
304  std::string rotName("Null");
305 #endif
307  rot = ns.rotation(rotstr_);
308 #ifdef EDM_ML_DEBUG
309  rotName = rotstr_;
310 #endif
311  }
312  mother.placeVolume(glog, copy, dd4hep::Transform3D(rot, r1));
313  int inc = ((layerSense_[ly] > 0) && (facingTypes_ > 1)) ? 2 : 1;
314  copyNumber_[ii] = copy + inc;
315 #ifdef EDM_ML_DEBUG
316  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << glog.name() << " number " << copy
317  << " positioned in " << mother.name() << " at (0,0," << cms::convert2mm(zz)
318  << ") with " << rotName << " rotation";
319 #endif
320  zz += hthick;
321  } // End of loop over layers in a block
322  zi = zo;
323  laymin = laymax;
324  // Make consistency check of all the partitions of the block
325  if (std::abs(thickTot - layerThick_[i]) >= tol2) {
326  if (thickTot > layerThick_[i]) {
327  edm::LogError("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(layerThick_[i])
328  << " is smaller than " << cms::convert2mm(thickTot)
329  << ": thickness of all its components **** ERROR ****";
330  } else {
331  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(layerThick_[i])
332  << " does not match with " << cms::convert2mm(thickTot) << " of the components";
333  }
334  }
335  } // End of loop over blocks
336 
337 #ifdef EDM_ML_DEBUG
338  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << copies_.size()
339  << " different wafer copy numbers";
340  int k(0);
341  for (std::unordered_set<int>::const_iterator itr = copies_.begin(); itr != copies_.end(); ++itr, ++k) {
342  edm::LogVerbatim("HGCalGeom") << "Copy [" << k << "] : " << (*itr);
343  }
344  copies_.clear();
345  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalSiliconRotatedCassette construction...";
346 #endif
347  }
Log< level::Info, true > LogVerbatim
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)
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
void positionPassive(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, int layer, int absType)
Log< level::Error, false > LogError
int32_t waferOrient(const int32_t property)
static std::string to_string(const XMLCh *ch)
static const std::string & rotName(const T &rot, const cms::DDParsingContext &context)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:27
int32_t waferPartial(const int32_t property)
int32_t waferV(const int32_t index)
void positionSensitive(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, int layer)
Log< level::Warning, false > LogWarning
static int32_t layerType(int type)
Definition: HGCalTypes.cc:42
void setParameter(int cassette, const std::vector< double > &shifts)
Definition: HGCalCassette.cc:8

Member Function Documentation

◆ positionPassive()

void HGCalSiliconRotatedCassette::positionPassive ( cms::DDParsingContext ctxt,
xml_h  e,
const dd4hep::Volume &  glog,
int  layer,
int  absType 
)
inline

Definition at line 456 of file DDHGCalSiliconRotatedCassette.cc.

References funct::abs(), angle(), HGCalCell::cellPlacementIndex(), cms::convert2mm(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, PVValHelper::dy, MillePedeFileConverter_cfg::e, mps_fire::i, gpuVertexFinder::iv, dqmdumpme::k, EgHLTOffHistBins_cfi::nr, HGCalTypes::packTypeUV(), PixelTestBeamValidation_cfi::Position, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, findQualityFiles::v, cms::DDNamespace::volume(), HGCalProperty::waferCassette(), HGCalTypes::WaferCenterB, HGCalTypes::WaferFull, HGCalTypes::WaferHDTop, HGCalWaferIndex::waferLayer(), HGCalProperty::waferOrient(), HGCalTypes::WaferPartHDOffset, HGCalProperty::waferPartial(), HGCalTypes::WaferPartLDOffset, HGCalProperty::waferThick(), HGCalTypes::WaferTypeOffset, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

456  {
457  cms::DDNamespace ns(ctxt, e, true);
458  static const double sqrt3 = std::sqrt(3.0);
459  int layercenter = layerOrient_[layer];
460  int layertype = (layerOrient_[layer] == HGCalTypes::WaferCenterB) ? 1 : 0;
461  int firstWafer = waferLayerStart_[layer];
462  int lastWafer = ((layer + 1 < static_cast<int>(waferLayerStart_.size())) ? waferLayerStart_[layer + 1]
463  : static_cast<int>(waferIndex_.size()));
464  double delx = 0.5 * (waferSize_ + waferSepar_);
465  double dely = 2.0 * delx / sqrt3;
466  double dy = 0.75 * dely;
467  const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
468 #ifdef EDM_ML_DEBUG
469  int ium(0), ivm(0), kount(0);
470  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << glog.name() << " r " << cms::convert2mm(delx)
471  << " R " << cms::convert2mm(dely) << " dy " << cms::convert2mm(dy) << " Shift "
472  << cms::convert2mm(xyoff.first) << ":" << cms::convert2mm(xyoff.second)
473  << " WaferSize " << cms::convert2mm(waferSize_ + waferSepar_) << " index "
474  << firstWafer << ":" << (lastWafer - 1) << " Layer Center " << layercenter << ":"
475  << layertype;
476 #endif
477  for (int k = firstWafer; k < lastWafer; ++k) {
480 #ifdef EDM_ML_DEBUG
481  int iu = std::abs(u);
482  int iv = std::abs(v);
483 #endif
484  int nr = 2 * v;
485  int nc = -2 * u + v;
489  int place = HGCalCell::cellPlacementIndex(1, layertype, orien);
490  auto cshift = cassette_.getShift(layer + 1, -1, cassette);
491  double xpos = xyoff.first - cshift.first + nc * delx;
492  double ypos = xyoff.second + cshift.second + nr * dy;
493 #ifdef EDM_ML_DEBUG
494  double xorig = xyoff.first + nc * delx;
495  double yorig = xyoff.second + nr * dy;
496  double angle = std::atan2(yorig, xorig);
498  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette::Passive: layer " << layer + 1 << " cassette "
499  << cassette << " Shift " << cms::convert2mm(cshift.first) << ":"
500  << cms::convert2mm(cshift.second) << " Original " << cms::convert2mm(xorig) << ":"
501  << cms::convert2mm(yorig) << ":" << convertRadToDeg(angle) << " Final "
502  << cms::convert2mm(xpos) << ":" << cms::convert2mm(ypos) << " u|v " << u << ":" << v
503  << " type|part|orient" << type << ":" << part << ":" << orien;
504 #endif
505  std::string passive;
506  int i(999);
507  if (part == HGCalTypes::WaferFull) {
508  i = absType - 1;
509  passive = passiveFull_[i];
510 #ifdef EDM_ML_DEBUG
511  edm::LogVerbatim("HGCalGeom") << " layertype:abstype:part:orien:cassette:offsets:ind " << layertype << ":"
512  << absType << ":" << part << ":" << orien << ":" << cassette << ":"
513  << ":" << partialTypes_ << ":" << orientationTypes_ << " passive " << i << ":"
514  << passive;
515 #endif
516  } else {
517  int partoffset = (part >= HGCalTypes::WaferHDTop)
520  i = (part - partoffset) * facingTypes_ * orientationTypes_ +
521  (absType - 1) * facingTypes_ * orientationTypes_ * partialTypes_ + place - placeOffset_;
522 #ifdef EDM_ML_DEBUG
523  edm::LogVerbatim("HGCalGeom") << " layertype:abstype:part:orien:cassette:3Types:offset:ind " << layertype << ":"
524  << absType << ":" << part << ":" << orien << ":" << cassette << ":"
525  << partialTypes_ << ":" << facingTypes_ << ":" << orientationTypes_ << ":"
526  << partoffset << ":" << i << ":" << passivePart_.size();
527 #endif
528  passive = passivePart_[i];
529  }
530  int copy = HGCalTypes::packTypeUV(absType, u, v);
531 #ifdef EDM_ML_DEBUG
532  edm::LogVerbatim("HGCalGeom") << " DDHGCalSiliconRotatedCassette: Layer "
533  << HGCalWaferIndex::waferLayer(waferIndex_[k]) << " Passive " << passive
534  << " number " << copy << " type:part:orien:place:ind " << type << ":" << part << ":"
535  << orien << ":" << place << ":" << i << " layer:u:v:indx " << (layer + firstLayer_)
536  << ":" << u << ":" << v << " pos " << cms::convert2mm(xpos) << ":"
537  << cms::convert2mm(ypos);
538  if (iu > ium)
539  ium = iu;
540  if (iv > ivm)
541  ivm = iv;
542  kount++;
543 #endif
544  dd4hep::Position tran(xpos, ypos, 0.0);
545  glog.placeVolume(ns.volume(passive), copy, tran);
546 #ifdef EDM_ML_DEBUG
547  edm::LogVerbatim("HGCalGeom") << " DDHGCalSiliconRotatedCassette: " << passive << " number " << copy << " type "
548  << layertype << ":" << type << " positioned in " << glog.name() << " at ("
549  << cms::convert2mm(xpos) << "," << cms::convert2mm(ypos) << ",0) with no rotation";
550 #endif
551  }
552 #ifdef EDM_ML_DEBUG
553  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: Maximum # of u " << ium << " # of v " << ivm
554  << " and " << kount << " passives for " << glog.name();
555 #endif
556  }
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
static constexpr int32_t WaferPartLDOffset
Definition: HGCalTypes.h:57
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::pair< double, double > getShift(int layer, int zside, int cassette) const
int32_t waferOrient(const int32_t property)
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
int32_t waferCassette(const int32_t property)
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int32_t waferThick(const int32_t property)
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
static constexpr int32_t WaferCenterB
Definition: HGCalTypes.h:26
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ positionSensitive()

void HGCalSiliconRotatedCassette::positionSensitive ( cms::DDParsingContext ctxt,
xml_h  e,
const dd4hep::Volume &  glog,
int  layer 
)
inline

Definition at line 349 of file DDHGCalSiliconRotatedCassette.cc.

References funct::abs(), angle(), HGCalCell::cellPlacementIndex(), cms::convert2mm(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, PVValHelper::dy, MillePedeFileConverter_cfg::e, mps_fire::i, gpuVertexFinder::iv, dqmdumpme::k, EgHLTOffHistBins_cfi::nr, HGCalTypes::packTypeUV(), PixelTestBeamValidation_cfi::Position, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, findQualityFiles::v, cms::DDNamespace::volume(), HGCalProperty::waferCassette(), HGCalTypes::WaferCenterB, HGCalTypes::WaferFull, HGCalTypes::WaferHDTop, HGCalWaferIndex::waferLayer(), HGCalProperty::waferOrient(), HGCalTypes::WaferPartHDOffset, HGCalProperty::waferPartial(), HGCalTypes::WaferPartLDOffset, HGCalProperty::waferThick(), HGCalTypes::WaferTypeOffset, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

349  {
350  cms::DDNamespace ns(ctxt, e, true);
351  static const double sqrt3 = std::sqrt(3.0);
352  int layercenter = layerOrient_[layer];
353  int layertype = (layerOrient_[layer] == HGCalTypes::WaferCenterB) ? 1 : 0;
354  int firstWafer = waferLayerStart_[layer];
355  int lastWafer = ((layer + 1 < static_cast<int>(waferLayerStart_.size())) ? waferLayerStart_[layer + 1]
356  : static_cast<int>(waferIndex_.size()));
357  double delx = 0.5 * (waferSize_ + waferSepar_);
358  double dely = 2.0 * delx / sqrt3;
359  double dy = 0.75 * dely;
360  const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
361 #ifdef EDM_ML_DEBUG
362  int ium(0), ivm(0), kount(0);
363  std::vector<int> ntype(3, 0);
364  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: " << glog.name() << " r " << cms::convert2mm(delx)
365  << " R " << cms::convert2mm(dely) << " dy " << cms::convert2mm(dy) << " Shift "
366  << cms::convert2mm(xyoff.first) << ":" << cms::convert2mm(xyoff.second)
367  << " WaferSize " << cms::convert2mm(waferSize_ + waferSepar_) << " index "
368  << firstWafer << ":" << (lastWafer - 1) << " Layer Center " << layercenter << ":"
369  << layertype;
370 #endif
371  for (int k = firstWafer; k < lastWafer; ++k) {
374 #ifdef EDM_ML_DEBUG
375  int iu = std::abs(u);
376  int iv = std::abs(v);
377 #endif
378  int nr = 2 * v;
379  int nc = -2 * u + v;
384  int place = HGCalCell::cellPlacementIndex(1, layertype, orien);
385  auto cshift = cassette_.getShift(layer + 1, -1, cassette);
386  double xpos = xyoff.first - cshift.first + nc * delx;
387  double ypos = xyoff.second + cshift.second + nr * dy;
388 #ifdef EDM_ML_DEBUG
389  double xorig = xyoff.first + nc * delx;
390  double yorig = xyoff.second + nr * dy;
391  double angle = std::atan2(yorig, xorig);
392  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette::Wafer: layer " << layer + 1 << " cassette "
393  << cassette << " Shift " << cms::convert2mm(cshift.first) << ":"
394  << cms::convert2mm(cshift.second) << " Original " << cms::convert2mm(xorig) << ":"
395  << cms::convert2mm(yorig) << ":" << convertRadToDeg(angle) << " Final "
396  << cms::convert2mm(xpos) << ":" << cms::convert2mm(ypos) << " u|v " << u << ":" << v
397  << " type|part|orient|place " << type << ":" << part << ":" << orien << ":"
398  << place;
399 #endif
400  std::string wafer;
401  int i(999);
402  if (part == HGCalTypes::WaferFull) {
404  wafer = waferFull_[i];
405 #ifdef EDM_ML_DEBUG
406  edm::LogVerbatim("HGCalGeom") << " layertype:type:part:orien:cassette:place:offsets:ind " << layertype << ":"
407  << type << ":" << part << ":" << orien << ":" << cassette << ":" << place << ":"
408  << placeOffset_ << ":" << facingTypes_ << ":" << orientationTypes_ << " wafer "
409  << i << ":" << wafer;
410 #endif
411  } else {
412  int partoffset =
414  i = (part - partoffset) * facingTypes_ * orientationTypes_ +
416 #ifdef EDM_ML_DEBUG
417  edm::LogVerbatim("HGCalGeom") << " layertype:type:part:orien:cassette:place:offsets:ind " << layertype << ":"
418  << type << ":" << part << ":" << orien << ":" << cassette << ":" << place << ":"
419  << partoffset << ":" << HGCalTypes::WaferTypeOffset[type] << ":" << i << ":"
420  << waferPart_.size();
421 #endif
422  wafer = waferPart_[i];
423  }
424  int copy = HGCalTypes::packTypeUV(type, u, v);
425 #ifdef EDM_ML_DEBUG
426  edm::LogVerbatim("HGCalGeom") << " DDHGCalSiliconRotatedCassette: Layer "
427  << HGCalWaferIndex::waferLayer(waferIndex_[k]) << " Wafer " << wafer << " number "
428  << copy << " type:part:orien:place:ind " << type << ":" << part << ":" << orien
429  << ":" << place << ":" << i << " layer:u:v:indx " << (layer + firstLayer_) << ":"
430  << u << ":" << v << " pos " << cms::convert2mm(xpos) << ":"
431  << cms::convert2mm(ypos);
432  if (iu > ium)
433  ium = iu;
434  if (iv > ivm)
435  ivm = iv;
436  kount++;
437  if (copies_.count(copy) == 0)
438  copies_.insert(copy);
439 #endif
440  dd4hep::Position tran(xpos, ypos, 0.0);
441  glog.placeVolume(ns.volume(wafer), copy, tran);
442 #ifdef EDM_ML_DEBUG
443  ++ntype[type];
444  edm::LogVerbatim("HGCalGeom") << " DDHGCalSiliconRotatedCassette: " << wafer << " number " << copy << " type "
445  << layertype << ":" << type << " positioned in " << glog.name() << " at ("
446  << cms::convert2mm(xpos) << "," << cms::convert2mm(ypos) << ",0) with no rotation";
447 #endif
448  }
449 #ifdef EDM_ML_DEBUG
450  edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedCassette: Maximum # of u " << ium << " # of v " << ivm
451  << " and " << kount << " passives (" << ntype[0] << ":" << ntype[1] << ":" << ntype[2]
452  << ") for " << glog.name();
453 #endif
454  }
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
static constexpr int32_t WaferPartLDOffset
Definition: HGCalTypes.h:57
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::pair< double, double > getShift(int layer, int zside, int cassette) const
int32_t waferOrient(const int32_t property)
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
int32_t waferCassette(const int32_t property)
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int32_t waferThick(const int32_t property)
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
static constexpr int32_t WaferCenterB
Definition: HGCalTypes.h:26
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

Member Data Documentation

◆ absorbMode_

int HGCalSiliconRotatedCassette::absorbMode_

Definition at line 569 of file DDHGCalSiliconRotatedCassette.cc.

◆ alpha_

double HGCalSiliconRotatedCassette::alpha_

Definition at line 601 of file DDHGCalSiliconRotatedCassette.cc.

◆ cassette_

HGCalCassette HGCalSiliconRotatedCassette::cassette_

Definition at line 560 of file DDHGCalSiliconRotatedCassette.cc.

◆ cassettes_

int HGCalSiliconRotatedCassette::cassettes_

Definition at line 575 of file DDHGCalSiliconRotatedCassette.cc.

◆ cassetteShift_

std::vector<double> HGCalSiliconRotatedCassette::cassetteShift_

Definition at line 599 of file DDHGCalSiliconRotatedCassette.cc.

◆ copies_

std::unordered_set<int> HGCalSiliconRotatedCassette::copies_

Definition at line 600 of file DDHGCalSiliconRotatedCassette.cc.

◆ copyNumber_

std::vector<int> HGCalSiliconRotatedCassette::copyNumber_

Definition at line 584 of file DDHGCalSiliconRotatedCassette.cc.

◆ cosAlpha_

double HGCalSiliconRotatedCassette::cosAlpha_

Definition at line 601 of file DDHGCalSiliconRotatedCassette.cc.

◆ facingTypes_

int HGCalSiliconRotatedCassette::facingTypes_

Definition at line 564 of file DDHGCalSiliconRotatedCassette.cc.

◆ firstLayer_

int HGCalSiliconRotatedCassette::firstLayer_

Definition at line 568 of file DDHGCalSiliconRotatedCassette.cc.

◆ geomTools_

HGCalGeomTools HGCalSiliconRotatedCassette::geomTools_

Definition at line 559 of file DDHGCalSiliconRotatedCassette.cc.

◆ layerOrient_

std::vector<int> HGCalSiliconRotatedCassette::layerOrient_

Definition at line 595 of file DDHGCalSiliconRotatedCassette.cc.

◆ layers_

std::vector<int> HGCalSiliconRotatedCassette::layers_

Definition at line 585 of file DDHGCalSiliconRotatedCassette.cc.

◆ layerSense_

std::vector<int> HGCalSiliconRotatedCassette::layerSense_

Definition at line 588 of file DDHGCalSiliconRotatedCassette.cc.

◆ layerThick_

std::vector<double> HGCalSiliconRotatedCassette::layerThick_

Definition at line 586 of file DDHGCalSiliconRotatedCassette.cc.

◆ layerType_

std::vector<int> HGCalSiliconRotatedCassette::layerType_

Definition at line 587 of file DDHGCalSiliconRotatedCassette.cc.

◆ materials_

std::vector<std::string> HGCalSiliconRotatedCassette::materials_

Definition at line 581 of file DDHGCalSiliconRotatedCassette.cc.

◆ names_

std::vector<std::string> HGCalSiliconRotatedCassette::names_

Definition at line 582 of file DDHGCalSiliconRotatedCassette.cc.

◆ orientationTypes_

int HGCalSiliconRotatedCassette::orientationTypes_

Definition at line 565 of file DDHGCalSiliconRotatedCassette.cc.

◆ partialTypes_

int HGCalSiliconRotatedCassette::partialTypes_

Definition at line 566 of file DDHGCalSiliconRotatedCassette.cc.

◆ passiveFull_

std::vector<std::string> HGCalSiliconRotatedCassette::passiveFull_

Definition at line 579 of file DDHGCalSiliconRotatedCassette.cc.

◆ passivePart_

std::vector<std::string> HGCalSiliconRotatedCassette::passivePart_

Definition at line 580 of file DDHGCalSiliconRotatedCassette.cc.

◆ passiveTypes_

int HGCalSiliconRotatedCassette::passiveTypes_

Definition at line 563 of file DDHGCalSiliconRotatedCassette.cc.

◆ placeOffset_

int HGCalSiliconRotatedCassette::placeOffset_

Definition at line 567 of file DDHGCalSiliconRotatedCassette.cc.

◆ rMaxFront_

std::vector<double> HGCalSiliconRotatedCassette::rMaxFront_

Definition at line 594 of file DDHGCalSiliconRotatedCassette.cc.

◆ rMinFront_

std::vector<double> HGCalSiliconRotatedCassette::rMinFront_

Definition at line 591 of file DDHGCalSiliconRotatedCassette.cc.

◆ rotstr_

std::string HGCalSiliconRotatedCassette::rotstr_

Definition at line 576 of file DDHGCalSiliconRotatedCassette.cc.

◆ sectors_

int HGCalSiliconRotatedCassette::sectors_

Definition at line 574 of file DDHGCalSiliconRotatedCassette.cc.

◆ sensitiveMode_

int HGCalSiliconRotatedCassette::sensitiveMode_

Definition at line 570 of file DDHGCalSiliconRotatedCassette.cc.

◆ slopeB_

std::vector<double> HGCalSiliconRotatedCassette::slopeB_

Definition at line 589 of file DDHGCalSiliconRotatedCassette.cc.

◆ slopeT_

std::vector<double> HGCalSiliconRotatedCassette::slopeT_

Definition at line 592 of file DDHGCalSiliconRotatedCassette.cc.

◆ thick_

std::vector<double> HGCalSiliconRotatedCassette::thick_

Definition at line 583 of file DDHGCalSiliconRotatedCassette.cc.

◆ waferFull_

std::vector<std::string> HGCalSiliconRotatedCassette::waferFull_

Definition at line 577 of file DDHGCalSiliconRotatedCassette.cc.

◆ waferIndex_

std::vector<int> HGCalSiliconRotatedCassette::waferIndex_

Definition at line 596 of file DDHGCalSiliconRotatedCassette.cc.

◆ waferLayerStart_

std::vector<int> HGCalSiliconRotatedCassette::waferLayerStart_

Definition at line 598 of file DDHGCalSiliconRotatedCassette.cc.

◆ waferPart_

std::vector<std::string> HGCalSiliconRotatedCassette::waferPart_

Definition at line 578 of file DDHGCalSiliconRotatedCassette.cc.

◆ waferProperty_

std::vector<int> HGCalSiliconRotatedCassette::waferProperty_

Definition at line 597 of file DDHGCalSiliconRotatedCassette.cc.

◆ waferSepar_

double HGCalSiliconRotatedCassette::waferSepar_

Definition at line 573 of file DDHGCalSiliconRotatedCassette.cc.

◆ waferSize_

double HGCalSiliconRotatedCassette::waferSize_

Definition at line 572 of file DDHGCalSiliconRotatedCassette.cc.

◆ waferTypes_

int HGCalSiliconRotatedCassette::waferTypes_

Definition at line 562 of file DDHGCalSiliconRotatedCassette.cc.

◆ zFrontB_

std::vector<double> HGCalSiliconRotatedCassette::zFrontB_

Definition at line 590 of file DDHGCalSiliconRotatedCassette.cc.

◆ zFrontT_

std::vector<double> HGCalSiliconRotatedCassette::zFrontT_

Definition at line 593 of file DDHGCalSiliconRotatedCassette.cc.

◆ zMinBlock_

double HGCalSiliconRotatedCassette::zMinBlock_

Definition at line 571 of file DDHGCalSiliconRotatedCassette.cc.