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::HGCalHEAlgo ( )
inline

Definition at line 26 of file DDHGCalHEAlgo.cc.

References Exception.

26 { throw cms::Exception("HGCalGeom") << "Wrong initialization to HGCalHEAlgo"; }
HGCalHEAlgo::HGCalHEAlgo ( cms::DDParsingContext ctxt,
xml_h  e 
)
inline

Definition at line 27 of file DDHGCalHEAlgo.cc.

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

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];
80  copyNumber[ii] = firstLayer;
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>(
167  rad100to200, rad200to300, (waferSize + waferSepar), zMinRadPar, choiceType, nCutRadPar, fracAreaMin);
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  }
std::vector< double > slopeT
std::vector< int > layerCenter
std::vector< double > rad200to300
std::vector< double > rMaxFront
std::vector< int > layerNumbers
std::vector< double > slopeB
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)
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)
std::vector< double > zFrontB
std::vector< double > rMinFront
double zMinRadPar
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< int > layerSenseBot
std::vector< std::string > namesTop
std::vector< int > layerSense
std::vector< std::string > materialsTop
double zMinBlock
double waferSize
std::vector< std::string > volumeNames
double fracAreaMin
constexpr long double piRadians(M_PIl)
std::vector< int > copyNumber
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< double > rad100to200
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > layerThick
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< std::string > waferNames
std::unordered_set< int > copies
dd4hep::Volume Volume
std::vector< double > rMixLayer
ii
Definition: cuy.py:590
std::unique_ptr< HGCalWaferType > waferType
std::vector< int > copyNumberBot
std::vector< std::string > namesBot
std::vector< double > thickness
std::vector< int > layerTypeTop
std::vector< int > layerTypeBot
std::vector< int > layerType
std::vector< int > copyNumberTop
std::vector< std::string > materials
double waferSepar
std::vector< double > layerThickTop
std::vector< double > layerThickBot
std::vector< std::string > materialsBot
std::vector< double > zFrontT

Member Function Documentation

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.

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), filterCSVwithJSON::copy, 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(), cms::DDNamespace::prepend(), diffTwoXMLs::r1, AlCaHLTBitMon_QueryRunRegistry::string, and funct::tan().

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  }
std::vector< int > layerCenter
std::vector< int > layerSenseBot
void positionSensitive(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, double rin, double rout, double zpos, int layertype, int layercenter)
std::vector< std::string > namesTop
std::vector< std::string > materialsTop
constexpr long double piRadians(M_PIl)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dd4hep::Volume Volume
ii
Definition: cuy.py:590
std::vector< int > copyNumberBot
std::vector< std::string > namesBot
std::vector< int > layerTypeTop
std::vector< int > layerTypeBot
std::vector< int > copyNumberTop
std::vector< double > layerThickTop
std::vector< double > layerThickBot
std::vector< std::string > materialsBot
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.

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

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  }
type
Definition: HCALResponse.h:21
HGCalGeomTools geomTools
int nin
double waferSize
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::string > waferNames
std::unordered_set< int > copies
std::unique_ptr< HGCalWaferType > waferType
static uint32_t k_CornerSize
#define N
Definition: blowfish.cc:9
double waferSepar
std::pair< double, double > shiftXY(int waferPosition, double waferSize)

Member Data Documentation

int HGCalHEAlgo::absorbMode

Definition at line 549 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::alpha

Definition at line 580 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::choiceType

Definition at line 567 of file DDHGCalHEAlgo.cc.

std::unordered_set<int> HGCalHEAlgo::copies

Definition at line 579 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::copyNumber

Definition at line 542 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::copyNumberBot

Definition at line 559 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::copyNumberTop

Definition at line 554 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::cosAlpha

Definition at line 580 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::firstLayer

Definition at line 548 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::fracAreaMin

Definition at line 569 of file DDHGCalHEAlgo.cc.

HGCalGeomTools HGCalHEAlgo::geomTools

Definition at line 535 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerCenter

Definition at line 561 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerNumbers

Definition at line 543 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerSense

Definition at line 547 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerSenseBot

Definition at line 560 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::layerThick

Definition at line 544 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::layerThickBot

Definition at line 557 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::layerThickTop

Definition at line 552 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerType

Definition at line 546 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerTypeBot

Definition at line 558 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerTypeTop

Definition at line 553 of file DDHGCalHEAlgo.cc.

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

Definition at line 539 of file DDHGCalHEAlgo.cc.

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

Definition at line 555 of file DDHGCalHEAlgo.cc.

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

Definition at line 550 of file DDHGCalHEAlgo.cc.

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

Definition at line 556 of file DDHGCalHEAlgo.cc.

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

Definition at line 551 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::nCutRadPar

Definition at line 568 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rad100to200

Definition at line 564 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rad200to300

Definition at line 565 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rMaxFront

Definition at line 578 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rMinFront

Definition at line 575 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rMixLayer

Definition at line 545 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::sectors

Definition at line 572 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::slopeB

Definition at line 573 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::slopeT

Definition at line 576 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::thickness

Definition at line 541 of file DDHGCalHEAlgo.cc.

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

Definition at line 540 of file DDHGCalHEAlgo.cc.

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

Definition at line 538 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::waferSepar

Definition at line 571 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::waferSize

Definition at line 570 of file DDHGCalHEAlgo.cc.

std::unique_ptr<HGCalWaferType> HGCalHEAlgo::waferType

Definition at line 536 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::zFrontB

Definition at line 574 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::zFrontT

Definition at line 577 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::zMinBlock

Definition at line 563 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::zMinRadPar

Definition at line 566 of file DDHGCalHEAlgo.cc.