CMS 3D CMS Logo

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

Public Member Functions

 HGCalHEAlgo ()
 
 HGCalHEAlgo (cms::DDParsingContext &ctxt, xml_h e)
 
void positionMix (cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, const std::string &nameM, int copyM, double thick, const dd4hep::Material &matter, double rin, double rmid, double rout, double zz)
 
void positionSensitive (cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, double rin, double rout, double zpos, int layertype, int layercenter)
 

Public Attributes

int absorbMode
 
double alpha
 
int choiceType
 
std::unordered_set< int > copies
 
std::vector< int > copyNumber
 
std::vector< int > copyNumberBot
 
std::vector< int > copyNumberTop
 
double cosAlpha
 
int firstLayer
 
double fracAreaMin
 
HGCalGeomTools geomTools
 
std::vector< int > layerCenter
 
std::vector< int > layerNumbers
 
std::vector< int > layerSense
 
std::vector< int > layerSenseBot
 
std::vector< double > layerThick
 
std::vector< double > layerThickBot
 
std::vector< double > layerThickTop
 
std::vector< int > layerType
 
std::vector< int > layerTypeBot
 
std::vector< int > layerTypeTop
 
std::vector< std::string > materials
 
std::vector< std::string > materialsBot
 
std::vector< std::string > materialsTop
 
std::vector< std::string > namesBot
 
std::vector< std::string > namesTop
 
int nCutRadPar
 
std::vector< double > rad100to200
 
std::vector< double > rad200to300
 
std::vector< double > rMaxFront
 
std::vector< double > rMinFront
 
std::vector< double > rMixLayer
 
int sectors
 
std::vector< double > slopeB
 
std::vector< double > slopeT
 
std::vector< double > thickness
 
std::vector< std::string > volumeNames
 
std::vector< std::string > waferNames
 
double waferSepar
 
double waferSize
 
std::unique_ptr< HGCalWaferTypewaferType
 
std::vector< double > zFrontB
 
std::vector< double > zFrontT
 
double zMinBlock
 
double zMinRadPar
 

Detailed Description

Definition at line 25 of file DDHGCalHEAlgo.cc.

Constructor & Destructor Documentation

◆ HGCalHEAlgo() [1/2]

HGCalHEAlgo::HGCalHEAlgo ( )
inline

Definition at line 26 of file DDHGCalHEAlgo.cc.

26 { throw cms::Exception("HGCalGeom") << "Wrong initialization to HGCalHEAlgo"; }

References Exception.

◆ HGCalHEAlgo() [2/2]

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

Definition at line 27 of file DDHGCalHEAlgo.cc.

27  {
28  cms::DDNamespace ns(ctxt, e, true);
30 
31 #ifdef EDM_ML_DEBUG
32  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Creating an instance";
33 #endif
34 
35  dd4hep::Volume mother = ns.volume(args.parentName());
36  waferNames = args.value<std::vector<std::string>>("WaferNames");
37 #ifdef EDM_ML_DEBUG
38  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << waferNames.size() << " wafers";
39  for (unsigned int i = 0; i < waferNames.size(); ++i)
40  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << waferNames[i];
41 #endif
42  materials = args.value<std::vector<std::string>>("MaterialNames");
43  volumeNames = args.value<std::vector<std::string>>("VolumeNames");
44  thickness = args.value<std::vector<double>>("Thickness");
45  for (unsigned int i = 0; i < materials.size(); ++i) {
46  copyNumber.emplace_back(1);
47  }
48 #ifdef EDM_ML_DEBUG
49  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materials.size() << " types of volumes";
50  for (unsigned int i = 0; i < volumeNames.size(); ++i)
51  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << volumeNames[i] << " of thickness " << thickness[i]
52  << " filled with " << materials[i] << " first copy number " << copyNumber[i];
53 #endif
54  layerNumbers = args.value<std::vector<int>>("Layers");
55  layerThick = args.value<std::vector<double>>("LayerThick");
56  rMixLayer = args.value<std::vector<double>>("LayerRmix");
57 #ifdef EDM_ML_DEBUG
58  edm::LogVerbatim("HGCalGeom") << "There are " << layerNumbers.size() << " blocks";
59  for (unsigned int i = 0; i < layerNumbers.size(); ++i)
60  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << layerThick[i] << " Rmid " << rMixLayer[i]
61  << " with " << layerNumbers[i] << " layers";
62 #endif
63  layerType = args.value<std::vector<int>>("LayerType");
64  layerSense = args.value<std::vector<int>>("LayerSense");
65  firstLayer = args.value<int>("FirstLayer");
66  absorbMode = args.value<int>("AbsorberMode");
67 #ifdef EDM_ML_DEBUG
68  edm::LogVerbatim("HGCalGeom") << "First Layer " << firstLayer << " and "
69  << "Absober mode " << absorbMode;
70 #endif
71  layerCenter = args.value<std::vector<int>>("LayerCenter");
72 #ifdef EDM_ML_DEBUG
73  for (unsigned int i = 0; i < layerCenter.size(); ++i)
74  edm::LogVerbatim("HGCalGeom") << "LayerCenter [" << i << "] " << layerCenter[i];
75 #endif
76  if (firstLayer > 0) {
77  for (unsigned int i = 0; i < layerType.size(); ++i) {
78  if (layerSense[i] > 0) {
79  int ii = layerType[i];
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("HGCalGeom") << "First copy number for layer type " << i << ":" << ii << " with "
83  << materials[ii] << " changed to " << copyNumber[ii];
84 #endif
85  break;
86  }
87  }
88  }
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("HGCalGeom") << "There are " << layerType.size() << " layers";
91  for (unsigned int i = 0; i < layerType.size(); ++i)
92  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType[i] << " sensitive class "
93  << layerSense[i];
94 #endif
95  materialsTop = args.value<std::vector<std::string>>("TopMaterialNames");
96  namesTop = args.value<std::vector<std::string>>("TopVolumeNames");
97  layerThickTop = args.value<std::vector<double>>("TopLayerThickness");
98  layerTypeTop = args.value<std::vector<int>>("TopLayerType");
99  for (unsigned int i = 0; i < materialsTop.size(); ++i) {
100  copyNumberTop.emplace_back(1);
101  }
102 #ifdef EDM_ML_DEBUG
103  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materialsTop.size() << " types of volumes in the top part";
104  for (unsigned int i = 0; i < materialsTop.size(); ++i)
105  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesTop[i] << " of thickness " << layerThickTop[i]
106  << " filled with " << materialsTop[i] << " first copy number " << copyNumberTop[i];
107  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeTop.size() << " layers in the top part";
108  for (unsigned int i = 0; i < layerTypeTop.size(); ++i)
109  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerTypeTop[i];
110 #endif
111  materialsBot = args.value<std::vector<std::string>>("BottomMaterialNames");
112  namesBot = args.value<std::vector<std::string>>("BottomVolumeNames");
113  layerTypeBot = args.value<std::vector<int>>("BottomLayerType");
114  layerSenseBot = args.value<std::vector<int>>("BottomLayerSense");
115  layerThickBot = args.value<std::vector<double>>("BottomLayerThickness");
116  for (unsigned int i = 0; i < materialsBot.size(); ++i) {
117  copyNumberBot.emplace_back(1);
118  }
119 #ifdef EDM_ML_DEBUG
120  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materialsBot.size() << " types of volumes in the bottom part";
121  for (unsigned int i = 0; i < materialsBot.size(); ++i)
122  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesBot[i] << " of thickness " << layerThickBot[i]
123  << " filled with " << materialsBot[i] << " first copy number " << copyNumberBot[i];
124  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeBot.size() << " layers in the bottom part";
125  for (unsigned int i = 0; i < layerTypeBot.size(); ++i)
126  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerTypeBot[i]
127  << " sensitive class " << layerSenseBot[i];
128 #endif
129  zMinBlock = args.value<double>("zMinBlock");
130  rad100to200 = args.value<std::vector<double>>("rad100to200");
131  rad200to300 = args.value<std::vector<double>>("rad200to300");
132  zMinRadPar = args.value<double>("zMinForRadPar");
133  choiceType = args.value<int>("choiceType");
134  nCutRadPar = args.value<int>("nCornerCut");
135  fracAreaMin = args.value<double>("fracAreaMin");
136  waferSize = args.value<double>("waferSize");
137  waferSepar = args.value<double>("SensorSeparation");
138  sectors = args.value<int>("Sectors");
139  alpha = (1._pi) / sectors;
140  cosAlpha = cos(alpha);
141 #ifdef EDM_ML_DEBUG
142  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: zStart " << zMinBlock << " radius for wafer type separation uses "
143  << rad100to200.size() << " parameters; zmin " << zMinRadPar << " cutoff "
144  << choiceType << ":" << nCutRadPar << ":" << fracAreaMin << " wafer width "
145  << waferSize << " separations " << waferSepar << " sectors " << sectors << ":"
146  << convertRadToDeg(alpha) << ":" << cosAlpha;
147  for (unsigned int k = 0; k < rad100to200.size(); ++k)
148  edm::LogVerbatim("HGCalGeom") << "[" << k << "] 100-200 " << rad100to200[k] << " 200-300 " << rad200to300[k];
149 #endif
150  slopeB = args.value<std::vector<double>>("SlopeBottom");
151  zFrontB = args.value<std::vector<double>>("ZFrontBottom");
152  rMinFront = args.value<std::vector<double>>("RMinFront");
153  slopeT = args.value<std::vector<double>>("SlopeTop");
154  zFrontT = args.value<std::vector<double>>("ZFrontTop");
155  rMaxFront = args.value<std::vector<double>>("RMaxFront");
156 #ifdef EDM_ML_DEBUG
157  for (unsigned int i = 0; i < slopeB.size(); ++i)
158  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFrontB[i] << " Rmin " << rMinFront[i]
159  << " Slope " << slopeB[i];
160  for (unsigned int i = 0; i < slopeT.size(); ++i)
161  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFrontT[i] << " Rmax " << rMaxFront[i]
162  << " Slope " << slopeT[i];
163  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: NameSpace " << ns.name();
164 #endif
165 
166  waferType = std::make_unique<HGCalWaferType>(
168 
169 #ifdef EDM_ML_DEBUG
170  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalHEAlgo...";
171  copies.clear();
172 #endif
173 
174  double zi(zMinBlock);
175  int laymin(0);
176  const double tol(0.01);
177  for (unsigned int i = 0; i < layerNumbers.size(); i++) {
178  double zo = zi + layerThick[i];
179  double routF = HGCalGeomTools::radius(zi, zFrontT, rMaxFront, slopeT);
180  int laymax = laymin + layerNumbers[i];
181  double zz = zi;
182  double thickTot(0);
183  for (int ly = laymin; ly < laymax; ++ly) {
184  int ii = layerType[ly];
185  int copy = copyNumber[ii];
186  double hthick = 0.5 * thickness[ii];
187  double rinB = HGCalGeomTools::radius(zo, zFrontB, rMinFront, slopeB);
188  zz += hthick;
189  thickTot += thickness[ii];
190 
191  std::string name = volumeNames[ii] + std::to_string(copy);
192 
193 #ifdef EDM_ML_DEBUG
194  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii << " Front " << zi << ", " << routF
195  << " Back " << zo << ", " << rinB << " superlayer thickness " << layerThick[i];
196 #endif
197 
198  dd4hep::Material matter = ns.material(materials[ii]);
199  dd4hep::Volume glog;
200 
201  if (layerSense[ly] < 1) {
202  std::vector<double> pgonZ, pgonRin, pgonRout;
203  if (layerSense[ly] == 0 || absorbMode == 0) {
204  double rmax =
205  (std::min(routF, HGCalGeomTools::radius(zz + hthick, zFrontT, rMaxFront, slopeT)) * cosAlpha) - tol;
206  pgonZ.emplace_back(-hthick);
207  pgonZ.emplace_back(hthick);
208  pgonRin.emplace_back(rinB);
209  pgonRin.emplace_back(rinB);
210  pgonRout.emplace_back(rmax);
211  pgonRout.emplace_back(rmax);
212  } else {
213  HGCalGeomTools::radius(zz - hthick,
214  zz + hthick,
215  zFrontB,
216  rMinFront,
217  slopeB,
218  zFrontT,
219  rMaxFront,
220  slopeT,
221  -layerSense[ly],
222  pgonZ,
223  pgonRin,
224  pgonRout);
225  for (unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
226  pgonZ[isec] -= zz;
227  pgonRout[isec] = pgonRout[isec] * cosAlpha - tol;
228  }
229  }
230 
231  dd4hep::Solid solid = dd4hep::Polyhedra(sectors, -alpha, 2. * cms_units::piRadians, pgonZ, pgonRin, pgonRout);
232  ns.addSolidNS(ns.prepend(name), solid);
233  glog = dd4hep::Volume(solid.name(), solid, matter);
234  ns.addVolumeNS(glog);
235 #ifdef EDM_ML_DEBUG
236  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " polyhedra of " << sectors
237  << " sectors covering " << convertRadToDeg(-alpha) << ":"
238  << convertRadToDeg(-alpha + 2._pi) << " with " << pgonZ.size() << " sections";
239  for (unsigned int k = 0; k < pgonZ.size(); ++k)
240  edm::LogVerbatim("HGCalGeom")
241  << "[" << k << "] z " << pgonZ[k] << " R " << pgonRin[k] << ":" << pgonRout[k];
242 #endif
243  } else {
244  dd4hep::Solid solid = dd4hep::Tube(rinB, routF, hthick, 0.0, 2. * cms_units::piRadians);
245  ns.addSolidNS(ns.prepend(name), solid);
246  glog = dd4hep::Volume(solid.name(), solid, matter);
247  ns.addVolumeNS(glog);
248 
249 #ifdef EDM_ML_DEBUG
250  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matter.name()
251  << " of dimensions " << rinB << ", " << routF << ", " << hthick
252  << ", 0.0, 360.0 and positioned in: " << glog.name() << " number " << copy;
253 #endif
254  positionMix(ctxt, e, glog, name, copy, thickness[ii], matter, rinB, rMixLayer[i], routF, zz);
255  }
256 
257  dd4hep::Position r1(0, 0, zz);
258  mother.placeVolume(glog, copy, r1);
259  ++copyNumber[ii];
260 #ifdef EDM_ML_DEBUG
261  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog.name() << " number " << copy << " positioned in "
262  << mother.name() << " at " << r1 << " with no rotation";
263 #endif
264  zz += hthick;
265  } // End of loop over layers in a block
266  zi = zo;
267  laymin = laymax;
268  if (std::abs(thickTot - layerThick[i]) < 0.00001) {
269  } else if (thickTot > layerThick[i]) {
270  edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick[i] << " is smaller than " << thickTot
271  << ": thickness of all its "
272  << "components **** ERROR ****";
273  } else if (thickTot < layerThick[i]) {
274  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << layerThick[i] << " does not match with "
275  << thickTot << " of the components";
276  }
277  } // End of loop over blocks
278 
279 #ifdef EDM_ML_DEBUG
280  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << copies.size() << " different wafer copy numbers";
281  int k(0);
282  for (std::unordered_set<int>::const_iterator itr = copies.begin(); itr != copies.end(); ++itr, ++k) {
283  edm::LogVerbatim("HGCalGeom") << "Copy [" << k << "] : " << (*itr);
284  }
285  copies.clear();
286  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalHEAlgo construction...";
287 #endif
288  }

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), zMuMuMuonUserData::alpha, writedatasetfile::args, angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), MillePedeFileConverter_cfg::e, mps_fire::i, cuy::ii, dqmdumpme::k, cms::DDNamespace::material(), g4SimHits_cfi::Material, min(), Skims_PA_cff::name, cms::DDNamespace::name(), angle_units::piRadians(), HGCalGeometryMode::Polyhedra, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, HGCalGeomTools::radius(), volumeBasedMagneticField_160812_cfi::sectors, AlCaHLTBitMon_QueryRunRegistry::string, Calorimetry_cff::thickness, cms::DDNamespace::volume(), and geometryCSVtoXML::zz.

Member Function Documentation

◆ positionMix()

void HGCalHEAlgo::positionMix ( cms::DDParsingContext ctxt,
xml_h  e,
const dd4hep::Volume &  glog,
const std::string &  nameM,
int  copyM,
double  thick,
const dd4hep::Material &  matter,
double  rin,
double  rmid,
double  rout,
double  zz 
)
inline

Definition at line 290 of file DDHGCalHEAlgo.cc.

300  {
301  cms::DDNamespace ns(ctxt, e, true);
302 
303  dd4hep::Volume glog1;
304  for (unsigned int ly = 0; ly < layerTypeTop.size(); ++ly) {
305  int ii = layerTypeTop[ly];
306  copyNumberTop[ii] = copyM;
307  }
308  for (unsigned int ly = 0; ly < layerTypeBot.size(); ++ly) {
309  int ii = layerTypeBot[ly];
310  copyNumberBot[ii] = copyM;
311  }
312  double hthick = 0.5 * thick;
313  // Make the top part first
314  std::string name = nameM + "Top";
315 
316  dd4hep::Solid solid = dd4hep::Tube(rmid, rout, hthick, 0.0, 2. * cms_units::piRadians);
317  ns.addSolidNS(ns.prepend(name), solid);
318  glog1 = dd4hep::Volume(solid.name(), solid, matter);
319  ns.addVolumeNS(glog1);
320 #ifdef EDM_ML_DEBUG
321  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matter.name()
322  << " of dimensions " << rmid << ", " << rout << ", " << hthick << ", 0.0, 360.0";
323 #endif
324  glog.placeVolume(glog1, 1);
325 
326 #ifdef EDM_ML_DEBUG
327  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog1.name() << " number 1 positioned in " << glog.name()
328  << " at (0, 0, 0) with no rotation";
329 #endif
330  double thickTot(0), zpos(-hthick);
331  for (unsigned int ly = 0; ly < layerTypeTop.size(); ++ly) {
332  int ii = layerTypeTop[ly];
333  int copy = copyNumberTop[ii];
334  double hthickl = 0.5 * layerThickTop[ii];
335  thickTot += layerThickTop[ii];
336  name = namesTop[ii] + std::to_string(copy);
337 #ifdef EDM_ML_DEBUG
338  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii << " R " << rmid << ":" << rout
339  << " Thick " << layerThickTop[ii];
340 #endif
341 
342  dd4hep::Material matter1 = ns.material(materialsTop[ii]);
343  solid = dd4hep::Tube(rmid, rout, hthickl, 0.0, 2. * cms_units::piRadians);
344  ns.addSolidNS(ns.prepend(name), solid);
345  dd4hep::Volume glog2 = dd4hep::Volume(solid.name(), solid, matter1);
346  ns.addVolumeNS(glog2);
347 
348 #ifdef EDM_ML_DEBUG
349  double eta1 = -log(tan(0.5 * atan(rmid / zz)));
350  double eta2 = -log(tan(0.5 * atan(rout / zz)));
351  edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":" << rmid << ":" << rout << " eta " << eta1
352  << ":" << eta2;
353  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matter1.name()
354  << " of dimensions " << rmid << ", " << rout << ", " << hthickl << ", 0.0, 360.0";
355 #endif
356  zpos += hthickl;
357 
358  dd4hep::Position r1(0, 0, zpos);
359  glog1.placeVolume(glog2, copy, r1);
360 
361 #ifdef EDM_ML_DEBUG
362  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Position " << glog2.name() << " number " << copy << " in "
363  << glog1.name() << " at " << r1 << " with no rotation";
364 #endif
365  ++copyNumberTop[ii];
366  zpos += hthickl;
367  }
368  if (std::abs(thickTot - thick) < 0.00001) {
369  } else if (thickTot > thick) {
370  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot
371  << ": thickness of all its components in "
372  << "the top part **** ERROR ****";
373  } else if (thickTot < thick) {
374  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick << " does not match with " << thickTot
375  << " of the components in top part";
376  }
377 
378  // Make the bottom part next
379  name = nameM + "Bottom";
380 
381  solid = dd4hep::Tube(rin, rmid, hthick, 0.0, 2. * cms_units::piRadians);
382  ns.addSolidNS(ns.prepend(name), solid);
383  glog1 = dd4hep::Volume(solid.name(), solid, matter);
384  ns.addVolumeNS(glog1);
385 
386 #ifdef EDM_ML_DEBUG
387  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matter.name()
388  << " of dimensions " << rin << ", " << rmid << ", " << hthick << ", 0.0, 360.0";
389 #endif
390 
391  glog.placeVolume(glog1, 1);
392 #ifdef EDM_ML_DEBUG
393  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog1.name() << " number 1 positioned in " << glog.name()
394  << " at (0, 0, 0) with no rotation";
395 #endif
396  thickTot = 0;
397  zpos = -hthick;
398  for (unsigned int ly = 0; ly < layerTypeBot.size(); ++ly) {
399  int ii = layerTypeBot[ly];
400  int copy = copyNumberBot[ii];
401  double hthickl = 0.5 * layerThickBot[ii];
402  thickTot += layerThickBot[ii];
403  name = namesBot[ii] + std::to_string(copy);
404 #ifdef EDM_ML_DEBUG
405  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii << " R " << rin << ":" << rmid
406  << " Thick " << layerThickBot[ii];
407 #endif
408 
409  dd4hep::Material matter1 = ns.material(materialsBot[ii]);
410  solid = dd4hep::Tube(rin, rmid, hthickl, 0.0, 2. * cms_units::piRadians);
411  ns.addSolidNS(ns.prepend(name), solid);
412  dd4hep::Volume glog2 = dd4hep::Volume(solid.name(), solid, matter1);
413  ns.addVolumeNS(glog2);
414 
415 #ifdef EDM_ML_DEBUG
416  double eta1 = -log(tan(0.5 * atan(rin / zz)));
417  double eta2 = -log(tan(0.5 * atan(rmid / zz)));
418  edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":" << rin << ":" << rmid << " eta " << eta1
419  << ":" << eta2;
420  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matter1.name()
421  << " of dimensions " << rin << ", " << rmid << ", " << hthickl << ", 0.0, 360.0";
422 #endif
423  zpos += hthickl;
424 
425  dd4hep::Position r1(0, 0, zpos);
426  glog1.placeVolume(glog2, copy, r1);
427 #ifdef EDM_ML_DEBUG
428  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Position " << glog2.name() << " number " << copy << " in "
429  << glog1.name() << " at " << r1 << " with no rotation";
430 #endif
431  if (layerSenseBot[ly] != 0) {
432 #ifdef EDM_ML_DEBUG
433  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: z " << (zz + zpos) << " Center " << copy << ":"
434  << (copy - firstLayer) << ":" << layerCenter[copy - firstLayer];
435 #endif
436  positionSensitive(ctxt, e, glog2, rin, rmid, zz + zpos, layerSenseBot[ly], layerCenter[copy - firstLayer]);
437  }
438  zpos += hthickl;
439  ++copyNumberBot[ii];
440  }
441  if (std::abs(thickTot - thick) < 0.00001) {
442  } else if (thickTot > thick) {
443  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot
444  << ": thickness of all its components in "
445  << "the top part **** ERROR ****";
446  } else if (thickTot < thick) {
447  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick << " does not match with " << thickTot
448  << " of the components in top part";
449  }
450  }

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), filterCSVwithJSON::copy, MillePedeFileConverter_cfg::e, HLT_2018_cff::eta1, HLT_2018_cff::eta2, cuy::ii, dqm-mbProfile::log, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, angle_units::piRadians(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), and geometryCSVtoXML::zz.

◆ positionSensitive()

void HGCalHEAlgo::positionSensitive ( cms::DDParsingContext ctxt,
xml_h  e,
const dd4hep::Volume &  glog,
double  rin,
double  rout,
double  zpos,
int  layertype,
int  layercenter 
)
inline

Definition at line 452 of file DDHGCalHEAlgo.cc.

459  {
460  cms::DDNamespace ns(ctxt, e, true);
461  static const double sqrt3 = std::sqrt(3.0);
462  double r = 0.5 * (waferSize + waferSepar);
463  double R = 2.0 * r / sqrt3;
464  double dy = 0.75 * R;
465  int N = (int)(0.5 * rout / r) + 2;
466  std::pair<double, double> xyoff = geomTools.shiftXY(layercenter, (waferSize + waferSepar));
467 #ifdef EDM_ML_DEBUG
468  int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0), nin(0);
469  std::vector<int> ntype(6, 0);
470  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog.name() << " rout " << rout << " N " << N
471  << " for maximum u, v Offset; Shift " << xyoff.first << ":" << xyoff.second
472  << " WaferSize " << (waferSize + waferSepar);
473 #endif
474  for (int u = -N; u <= N; ++u) {
475  int iu = std::abs(u);
476  for (int v = -N; v <= N; ++v) {
477  int iv = std::abs(v);
478  int nr = 2 * v;
479  int nc = -2 * u + v;
480  double xpos = xyoff.first + nc * r;
481  double ypos = xyoff.second + nr * dy;
482  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, r, R, rin, rout, false);
483 #ifdef EDM_ML_DEBUG
484  ++ntot;
485 #endif
486  if (corner.first > 0) {
487  int type = waferType->getType(xpos, ypos, zpos);
488  int copy = type * 1000000 + iv * 100 + iu;
489  if (u < 0)
490  copy += 10000;
491  if (v < 0)
492  copy += 100000;
493 #ifdef EDM_ML_DEBUG
494  if (iu > ium)
495  ium = iu;
496  if (iv > ivm)
497  ivm = iv;
498  kount++;
499  if (copies.count(copy) == 0)
500  copies.insert(copy);
501 #endif
502  if (corner.first == (int)(HGCalParameters::k_CornerSize)) {
503 #ifdef EDM_ML_DEBUG
504  if (iu > iumAll)
505  iumAll = iu;
506  if (iv > ivmAll)
507  ivmAll = iv;
508  ++nin;
509 #endif
510 
511  dd4hep::Position tran(xpos, ypos, 0.0);
512  if (layertype > 1)
513  type += 3;
514  glog.placeVolume(ns.volume(waferNames[type]), copy, tran);
515 
516 #ifdef EDM_ML_DEBUG
517  ++ntype[type];
518  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog.name() << " number " << copy << " positioned in "
519  << glog.name() << " at " << tran << " with no rotation";
520 #endif
521  }
522  }
523  }
524  }
525 #ifdef EDM_ML_DEBUG
526  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Maximum # of u " << ium << ":" << iumAll << " # of v " << ivm
527  << ":" << ivmAll << " and " << nin << ":" << kount << ":" << ntot << " wafers ("
528  << ntype[0] << ":" << ntype[1] << ":" << ntype[2] << ":" << ntype[3] << ":"
529  << ntype[4] << ":" << ntype[5] << ") for " << glog.name() << " R " << rin << ":"
530  << rout;
531 #endif
532  }

References funct::abs(), filterCSVwithJSON::copy, distTCMET_cfi::corner, PVValHelper::dy, MillePedeFileConverter_cfg::e, createfilelist::int, HGCalParameters::k_CornerSize, N, nin, EgHLTOffHistBins_cfi::nr, PixelTestBeamValidation_cfi::Position, dttmaxenums::R, alignCSCRings::r, mathSSE::sqrt(), findQualityFiles::v, cms::DDNamespace::volume(), and HGCalGeomTools::waferCorner().

Member Data Documentation

◆ absorbMode

int HGCalHEAlgo::absorbMode

Definition at line 549 of file DDHGCalHEAlgo.cc.

◆ alpha

double HGCalHEAlgo::alpha

Definition at line 580 of file DDHGCalHEAlgo.cc.

◆ choiceType

int HGCalHEAlgo::choiceType

Definition at line 567 of file DDHGCalHEAlgo.cc.

◆ copies

std::unordered_set<int> HGCalHEAlgo::copies

Definition at line 579 of file DDHGCalHEAlgo.cc.

◆ copyNumber

std::vector<int> HGCalHEAlgo::copyNumber

Definition at line 542 of file DDHGCalHEAlgo.cc.

◆ copyNumberBot

std::vector<int> HGCalHEAlgo::copyNumberBot

Definition at line 559 of file DDHGCalHEAlgo.cc.

◆ copyNumberTop

std::vector<int> HGCalHEAlgo::copyNumberTop

Definition at line 554 of file DDHGCalHEAlgo.cc.

◆ cosAlpha

double HGCalHEAlgo::cosAlpha

Definition at line 580 of file DDHGCalHEAlgo.cc.

◆ firstLayer

int HGCalHEAlgo::firstLayer

Definition at line 548 of file DDHGCalHEAlgo.cc.

◆ fracAreaMin

double HGCalHEAlgo::fracAreaMin

Definition at line 569 of file DDHGCalHEAlgo.cc.

◆ geomTools

HGCalGeomTools HGCalHEAlgo::geomTools

Definition at line 535 of file DDHGCalHEAlgo.cc.

◆ layerCenter

std::vector<int> HGCalHEAlgo::layerCenter

Definition at line 561 of file DDHGCalHEAlgo.cc.

◆ layerNumbers

std::vector<int> HGCalHEAlgo::layerNumbers

Definition at line 543 of file DDHGCalHEAlgo.cc.

◆ layerSense

std::vector<int> HGCalHEAlgo::layerSense

Definition at line 547 of file DDHGCalHEAlgo.cc.

◆ layerSenseBot

std::vector<int> HGCalHEAlgo::layerSenseBot

Definition at line 560 of file DDHGCalHEAlgo.cc.

◆ layerThick

std::vector<double> HGCalHEAlgo::layerThick

Definition at line 544 of file DDHGCalHEAlgo.cc.

◆ layerThickBot

std::vector<double> HGCalHEAlgo::layerThickBot

Definition at line 557 of file DDHGCalHEAlgo.cc.

◆ layerThickTop

std::vector<double> HGCalHEAlgo::layerThickTop

Definition at line 552 of file DDHGCalHEAlgo.cc.

◆ layerType

std::vector<int> HGCalHEAlgo::layerType

Definition at line 546 of file DDHGCalHEAlgo.cc.

◆ layerTypeBot

std::vector<int> HGCalHEAlgo::layerTypeBot

Definition at line 558 of file DDHGCalHEAlgo.cc.

◆ layerTypeTop

std::vector<int> HGCalHEAlgo::layerTypeTop

Definition at line 553 of file DDHGCalHEAlgo.cc.

◆ materials

std::vector<std::string> HGCalHEAlgo::materials

Definition at line 539 of file DDHGCalHEAlgo.cc.

◆ materialsBot

std::vector<std::string> HGCalHEAlgo::materialsBot

Definition at line 555 of file DDHGCalHEAlgo.cc.

◆ materialsTop

std::vector<std::string> HGCalHEAlgo::materialsTop

Definition at line 550 of file DDHGCalHEAlgo.cc.

◆ namesBot

std::vector<std::string> HGCalHEAlgo::namesBot

Definition at line 556 of file DDHGCalHEAlgo.cc.

◆ namesTop

std::vector<std::string> HGCalHEAlgo::namesTop

Definition at line 551 of file DDHGCalHEAlgo.cc.

◆ nCutRadPar

int HGCalHEAlgo::nCutRadPar

Definition at line 568 of file DDHGCalHEAlgo.cc.

◆ rad100to200

std::vector<double> HGCalHEAlgo::rad100to200

Definition at line 564 of file DDHGCalHEAlgo.cc.

◆ rad200to300

std::vector<double> HGCalHEAlgo::rad200to300

Definition at line 565 of file DDHGCalHEAlgo.cc.

◆ rMaxFront

std::vector<double> HGCalHEAlgo::rMaxFront

Definition at line 578 of file DDHGCalHEAlgo.cc.

◆ rMinFront

std::vector<double> HGCalHEAlgo::rMinFront

Definition at line 575 of file DDHGCalHEAlgo.cc.

◆ rMixLayer

std::vector<double> HGCalHEAlgo::rMixLayer

Definition at line 545 of file DDHGCalHEAlgo.cc.

◆ sectors

int HGCalHEAlgo::sectors

Definition at line 572 of file DDHGCalHEAlgo.cc.

◆ slopeB

std::vector<double> HGCalHEAlgo::slopeB

Definition at line 573 of file DDHGCalHEAlgo.cc.

◆ slopeT

std::vector<double> HGCalHEAlgo::slopeT

Definition at line 576 of file DDHGCalHEAlgo.cc.

◆ thickness

std::vector<double> HGCalHEAlgo::thickness

Definition at line 541 of file DDHGCalHEAlgo.cc.

◆ volumeNames

std::vector<std::string> HGCalHEAlgo::volumeNames

Definition at line 540 of file DDHGCalHEAlgo.cc.

◆ waferNames

std::vector<std::string> HGCalHEAlgo::waferNames

Definition at line 538 of file DDHGCalHEAlgo.cc.

◆ waferSepar

double HGCalHEAlgo::waferSepar

Definition at line 571 of file DDHGCalHEAlgo.cc.

◆ waferSize

double HGCalHEAlgo::waferSize

Definition at line 570 of file DDHGCalHEAlgo.cc.

◆ waferType

std::unique_ptr<HGCalWaferType> HGCalHEAlgo::waferType

Definition at line 536 of file DDHGCalHEAlgo.cc.

◆ zFrontB

std::vector<double> HGCalHEAlgo::zFrontB

Definition at line 574 of file DDHGCalHEAlgo.cc.

◆ zFrontT

std::vector<double> HGCalHEAlgo::zFrontT

Definition at line 577 of file DDHGCalHEAlgo.cc.

◆ zMinBlock

double HGCalHEAlgo::zMinBlock

Definition at line 563 of file DDHGCalHEAlgo.cc.

◆ zMinRadPar

double HGCalHEAlgo::zMinRadPar

Definition at line 566 of file DDHGCalHEAlgo.cc.

HGCalHEAlgo::slopeB
std::vector< double > slopeB
Definition: DDHGCalHEAlgo.cc:573
writedatasetfile.args
args
Definition: writedatasetfile.py:18
HGCalHEAlgo::firstLayer
int firstLayer
Definition: DDHGCalHEAlgo.cc:548
HGCalGeomTools::waferCorner
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
Definition: HGCalGeomTools.cc:219
mps_fire.i
i
Definition: mps_fire.py:355
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
g4SimHits_cfi.Material
Material
Definition: g4SimHits_cfi.py:547
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
HGCalHEAlgo::volumeNames
std::vector< std::string > volumeNames
Definition: DDHGCalHEAlgo.cc:540
HGCalHEAlgo::rad100to200
std::vector< double > rad100to200
Definition: DDHGCalHEAlgo.cc:564
min
T min(T a, T b)
Definition: MathUtil.h:58
HGCalHEAlgo::copies
std::unordered_set< int > copies
Definition: DDHGCalHEAlgo.cc:579
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:16
HLT_2018_cff.eta1
eta1
Definition: HLT_2018_cff.py:8220
HGCalParameters::k_CornerSize
static constexpr uint32_t k_CornerSize
Definition: HGCalParameters.h:38
distTCMET_cfi.corner
corner
Definition: distTCMET_cfi.py:38
nin
int nin
Definition: CascadeWrapper.h:114
HGCalGeomTools::shiftXY
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
Definition: HGCalGeomTools.cc:166
HGCalHEAlgo::waferSize
double waferSize
Definition: DDHGCalHEAlgo.cc:570
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HGCalHEAlgo::sectors
int sectors
Definition: DDHGCalHEAlgo.cc:572
HGCalHEAlgo::copyNumberTop
std::vector< int > copyNumberTop
Definition: DDHGCalHEAlgo.cc:554
HGCalHEAlgo::materials
std::vector< std::string > materials
Definition: DDHGCalHEAlgo.cc:539
HGCalHEAlgo::layerNumbers
std::vector< int > layerNumbers
Definition: DDHGCalHEAlgo.cc:543
HGCalHEAlgo::waferSepar
double waferSepar
Definition: DDHGCalHEAlgo.cc:571
HGCalHEAlgo::materialsBot
std::vector< std::string > materialsBot
Definition: DDHGCalHEAlgo.cc:555
HGCalHEAlgo::fracAreaMin
double fracAreaMin
Definition: DDHGCalHEAlgo.cc:569
HGCalHEAlgo::layerSenseBot
std::vector< int > layerSenseBot
Definition: DDHGCalHEAlgo.cc:560
HGCalHEAlgo::layerThickBot
std::vector< double > layerThickBot
Definition: DDHGCalHEAlgo.cc:557
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HGCalHEAlgo::zMinRadPar
double zMinRadPar
Definition: DDHGCalHEAlgo.cc:566
HGCalHEAlgo::materialsTop
std::vector< std::string > materialsTop
Definition: DDHGCalHEAlgo.cc:550
HGCalHEAlgo::zFrontT
std::vector< double > zFrontT
Definition: DDHGCalHEAlgo.cc:577
HGCalHEAlgo::layerTypeBot
std::vector< int > layerTypeBot
Definition: DDHGCalHEAlgo.cc:558
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
N
#define N
Definition: blowfish.cc:9
HGCalHEAlgo::zFrontB
std::vector< double > zFrontB
Definition: DDHGCalHEAlgo.cc:574
HGCalHEAlgo::choiceType
int choiceType
Definition: DDHGCalHEAlgo.cc:567
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:62
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HGCalHEAlgo::namesBot
std::vector< std::string > namesBot
Definition: DDHGCalHEAlgo.cc:556
HLT_2018_cff.eta2
eta2
Definition: HLT_2018_cff.py:8221
HGCalHEAlgo::positionMix
void positionMix(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, const std::string &nameM, int copyM, double thick, const dd4hep::Material &matter, double rin, double rmid, double rout, double zz)
Definition: DDHGCalHEAlgo.cc:290
HGCalHEAlgo::waferType
std::unique_ptr< HGCalWaferType > waferType
Definition: DDHGCalHEAlgo.cc:536
HGCalHEAlgo::layerCenter
std::vector< int > layerCenter
Definition: DDHGCalHEAlgo.cc:561
HGCalHEAlgo::slopeT
std::vector< double > slopeT
Definition: DDHGCalHEAlgo.cc:576
HGCalHEAlgo::layerTypeTop
std::vector< int > layerTypeTop
Definition: DDHGCalHEAlgo.cc:553
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalHEAlgo::positionSensitive
void positionSensitive(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, double rin, double rout, double zpos, int layertype, int layercenter)
Definition: DDHGCalHEAlgo.cc:452
edm::LogWarning
Definition: MessageLogger.h:141
angle_units::piRadians
constexpr long double piRadians(M_PIl)
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:45
edm::LogError
Definition: MessageLogger.h:183
EgHLTOffHistBins_cfi.nr
nr
Definition: EgHLTOffHistBins_cfi.py:4
HGCalHEAlgo::layerSense
std::vector< int > layerSense
Definition: DDHGCalHEAlgo.cc:547
HGCalHEAlgo::layerType
std::vector< int > layerType
Definition: DDHGCalHEAlgo.cc:546
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
createfilelist.int
int
Definition: createfilelist.py:10
HGCalHEAlgo::rad200to300
std::vector< double > rad200to300
Definition: DDHGCalHEAlgo.cc:565
HGCalHEAlgo::alpha
double alpha
Definition: DDHGCalHEAlgo.cc:580
edm::LogVerbatim
Definition: MessageLogger.h:297
HGCalHEAlgo::cosAlpha
double cosAlpha
Definition: DDHGCalHEAlgo.cc:580
HGCalHEAlgo::absorbMode
int absorbMode
Definition: DDHGCalHEAlgo.cc:549
HGCalHEAlgo::rMinFront
std::vector< double > rMinFront
Definition: DDHGCalHEAlgo.cc:575
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
PVValHelper::dy
Definition: PVValidationHelpers.h:49
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
HGCalHEAlgo::copyNumber
std::vector< int > copyNumber
Definition: DDHGCalHEAlgo.cc:542
HGCalHEAlgo::zMinBlock
double zMinBlock
Definition: DDHGCalHEAlgo.cc:563
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HGCalHEAlgo::geomTools
HGCalGeomTools geomTools
Definition: DDHGCalHEAlgo.cc:535
HGCalGeomTools::radius
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)
Definition: HGCalGeomTools.cc:11
type
type
Definition: HCALResponse.h:21
HGCalHEAlgo::layerThick
std::vector< double > layerThick
Definition: DDHGCalHEAlgo.cc:544
HGCalHEAlgo::rMixLayer
std::vector< double > rMixLayer
Definition: DDHGCalHEAlgo.cc:545
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
HGCalHEAlgo::waferNames
std::vector< std::string > waferNames
Definition: DDHGCalHEAlgo.cc:538
HGCalHEAlgo::copyNumberBot
std::vector< int > copyNumberBot
Definition: DDHGCalHEAlgo.cc:559
HGCalGeometryMode::Polyhedra
Definition: HGCalGeometryMode.h:26
Exception
Definition: hltDiff.cc:246
HGCalHEAlgo::nCutRadPar
int nCutRadPar
Definition: DDHGCalHEAlgo.cc:568
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
HGCalHEAlgo::layerThickTop
std::vector< double > layerThickTop
Definition: DDHGCalHEAlgo.cc:552
HGCalHEAlgo::namesTop
std::vector< std::string > namesTop
Definition: DDHGCalHEAlgo.cc:551
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCalHEAlgo::rMaxFront
std::vector< double > rMaxFront
Definition: DDHGCalHEAlgo.cc:578
dttmaxenums::R
Definition: DTTMax.h:29
cuy.ii
ii
Definition: cuy.py:590
HGCalHEAlgo::thickness
std::vector< double > thickness
Definition: DDHGCalHEAlgo.cc:541
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37