CMS 3D CMS Logo

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

Public Member Functions

void constructGeneralVolume (cms::DDNamespace &ns, dd4hep::Volume &parent)
 
void constructInsideModule (cms::DDNamespace &ns, dd4hep::Volume &module, int mod)
 
void constructInsideModule0 (cms::DDNamespace &ns, dd4hep::Volume &module, int mod)
 
void constructInsideSector (cms::DDNamespace &ns, dd4hep::Volume &sector)
 
void constructScintLayer (cms::DDNamespace &ns, dd4hep::Volume &detector, double dz, double yh, double bl, double tl, double alp, const std::string &nm, int id)
 
int getLayer (unsigned int i, unsigned int j) const
 
dd4hep::Rotation3D getRotation (const std::string &rotation, cms::DDNamespace &ns)
 
double getTrim (unsigned int i, unsigned int j) const
 
 HCalEndcapAlgo ()=delete
 
 HCalEndcapAlgo (cms::DDParsingContext &ctxt, xml_h e)
 
void parameterLayer (int iphi, double rinF, double routF, double rinB, double routB, double zi, double zo, double &yh1, double &bl1, double &tl1, double &yh2, double &bl2, double &tl2, double &alp, double &theta, double &phi, double &xpos, double &ypos, double &zpos)
 
void parameterLayer0 (int mod, int layer, int iphi, double &yh, double &bl, double &tl, double &alp, double &xpos, double &ypos, double &zpos)
 

Public Attributes

std::string absMat
 
double angBot
 
double angGap
 
double angTop
 
double drEnd
 
double dzShift
 
double dzStep
 
std::vector< int > eModule
 
std::string genMaterial
 
double heboxDepth
 
std::string idName
 
std::string idNameSpace
 
int idOffset
 
std::vector< int > layerN
 
std::vector< int > layerN0
 
std::vector< int > layerN1
 
std::vector< int > layerN2
 
std::vector< int > layerN3
 
std::vector< int > layerN4
 
std::vector< int > layerN5
 
std::vector< std::string > layerName
 
int layers
 
std::vector< double > layerT
 
std::vector< int > layerType
 
std::vector< std::string > modMat
 
std::vector< std::string > modName
 
std::vector< int > modType
 
int modules
 
int nEndcap
 
int nsectors
 
int nsectortot
 
std::vector< std::string > phiName
 
int phiSections
 
std::string plastMat
 
double riDip
 
double riKink
 
std::vector< double > rinBlock1
 
std::vector< double > rinBlock2
 
double roDip
 
std::string rotation
 
std::string rotHalf
 
std::string rotmat
 
double rout
 
std::vector< double > routBlock1
 
std::vector< double > routBlock2
 
std::string scintMat
 
std::vector< double > scintT
 
std::vector< int > sectionModule
 
double slope
 
std::vector< double > thick
 
double tolAbs
 
double tolPos
 
std::vector< double > trimLeft
 
std::vector< double > trimRight
 
double z0Beam
 
double z1Beam
 
double zEnd
 
double zFront
 
double ziBody
 
double ziDip
 
double ziKink
 
double ziL0Body
 
double ziL0Nose
 
double ziNose
 
std::vector< double > zmaxBlock
 
std::vector< double > zminBlock
 
double zShift
 
double zShiftHac2
 

Detailed Description

Definition at line 22 of file DDHCalEndcapAlgo.cc.

Constructor & Destructor Documentation

HCalEndcapAlgo::HCalEndcapAlgo ( )
delete
HCalEndcapAlgo::HCalEndcapAlgo ( cms::DDParsingContext ctxt,
xml_h  e 
)
inline

Definition at line 93 of file DDHCalEndcapAlgo.cc.

References writedatasetfile::args, geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), muonTiming_cfi::etamin, JetChargeProducer_cfi::exp, HLT_2018_cff::gap, mps_fire::i, dqmiolumiharvest::j, hgcalTopologyTester_cfi::layers, LogMessageMonitor_cff::modules, cms::DDNamespace::name(), class-composition::parent, cms::DDAlgoArguments::parentName(), diffTwoXMLs::r1, idealTransformation::rotation, funct::sin(), slope, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), cms::DDAlgoArguments::value(), and cms::DDNamespace::volume().

93  {
94  cms::DDNamespace ns(ctxt, e, true);
96 
97  genMaterial = args.value<std::string>("MaterialName");
98  rotation = args.value<std::string>("Rotation");
99  nsectors = args.value<int>("Sector");
100  nsectortot = args.value<int>("SectorTot");
101  nEndcap = args.value<int>("Endcap");
102  rotHalf = args.value<std::string>("RotHalf");
103  zShift = args.value<double>("ZShift");
104  zFront = args.value<double>("ZFront");
105  zEnd = args.value<double>("ZEnd");
106  ziNose = args.value<double>("ZiNose");
107  ziL0Nose = args.value<double>("ZiL0Nose");
108  ziBody = args.value<double>("ZiBody");
109  ziL0Body = args.value<double>("ZiL0Body");
110  z0Beam = args.value<double>("Z0Beam");
111  ziDip = args.value<double>("ZiDip");
112  dzStep = args.value<double>("DzStep");
113  zShiftHac2 = args.value<double>("ZShiftHac2");
114  double gap = args.value<double>("Gap");
115  double z1 = args.value<double>("Z1");
116  double r1 = args.value<double>("R1");
117  rout = args.value<double>("Rout");
118  heboxDepth = args.value<double>("HEboxDepth");
119  drEnd = args.value<double>("DrEnd");
120  double etamin = args.value<double>("Etamin");
121  angBot = args.value<double>("AngBot");
122  angGap = args.value<double>("AngGap");
123 #ifdef EDM_ML_DEBUG
124  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: General material " << genMaterial << "\tSectors " << nsectors
125  << ", " << nsectortot << "\tEndcaps " << nEndcap << "\tRotation matrix for half "
126  << rotHalf << "\n\tzFront " << convertCmToMm(zFront) << " zEnd " << convertCmToMm(zEnd)
127  << " ziNose " << convertCmToMm(ziNose) << " ziL0Nose " << convertCmToMm(ziL0Nose)
128  << " ziBody " << convertCmToMm(ziBody) << " ziL0Body " << convertCmToMm(ziL0Body)
129  << " z0Beam " << convertCmToMm(z0Beam) << " ziDip " << convertCmToMm(ziDip)
130  << " dzStep " << convertCmToMm(dzStep) << " Gap " << convertCmToMm(gap) << " z1 "
131  << convertCmToMm(z1) << "\n\tr1 " << convertCmToMm(r1) << " rout "
132  << convertCmToMm(rout) << " HeboxDepth " << convertCmToMm(heboxDepth) << " drEnd "
133  << convertCmToMm(drEnd) << "\tetamin " << etamin << " Bottom angle " << angBot
134  << " Gap angle " << angGap << " Z-Shift " << convertCmToMm(zShift) << " "
135  << convertCmToMm(zShiftHac2);
136 #endif
137 
138  //Derived quantities
139  angTop = 2.0 * atan(exp(-etamin));
140  slope = tan(angGap);
141  z1Beam = z1 - r1 / slope;
142  ziKink = z1Beam + rout / slope;
143  riKink = ziKink * tan(angBot);
144  riDip = ziDip * tan(angBot);
145  roDip = rout - heboxDepth;
146  dzShift = (z1Beam - z0Beam) - gap / sin(angGap);
147 #ifdef EDM_ML_DEBUG
148  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: angTop " << convertRadToDeg(angTop) << "\tSlope " << slope
149  << "\tDzShift " << convertCmToMm(dzShift) << "\n\tz1Beam " << convertCmToMm(z1Beam)
150  << "\tziKink" << convertCmToMm(ziKink) << "\triKink " << convertCmToMm(riKink)
151  << "\triDip " << convertCmToMm(riDip) << "\n\troDip " << convertCmToMm(roDip)
152  << "\tRotation " << rotation;
153 #endif
154 
156  //Modules
157  absMat = args.value<std::string>("AbsMat");
158  modules = args.value<int>("Modules");
159 #ifdef EDM_ML_DEBUG
160  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Number of modules " << modules << " and absorber material "
161  << absMat;
162 #endif
163 
164  modName = args.value<std::vector<std::string> >("ModuleName");
165  modMat = args.value<std::vector<std::string> >("ModuleMat");
166  modType = args.value<std::vector<int> >("ModuleType");
167  sectionModule = args.value<std::vector<int> >("SectionModule");
168  thick = args.value<std::vector<double> >("ModuleThick");
169  trimLeft = args.value<std::vector<double> >("TrimLeft");
170  trimRight = args.value<std::vector<double> >("TrimRight");
171  eModule = args.value<std::vector<int> >("EquipModule");
172  layerN = args.value<std::vector<int> >("LayerN");
173  layerN0 = args.value<std::vector<int> >("LayerN0");
174  layerN1 = args.value<std::vector<int> >("LayerN1");
175  layerN2 = args.value<std::vector<int> >("LayerN2");
176  layerN3 = args.value<std::vector<int> >("LayerN3");
177  layerN4 = args.value<std::vector<int> >("LayerN4");
178  layerN5 = args.value<std::vector<int> >("LayerN5");
179 #ifdef EDM_ML_DEBUG
180  for (int i = 0; i < modules; i++) {
181  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << modName[i] << " type " << modType[i] << " Sections "
182  << sectionModule[i] << " thickness of absorber/air " << convertCmToMm(thick[i])
183  << " trim " << convertCmToMm(trimLeft[i]) << ", " << convertCmToMm(trimRight[i])
184  << " equip module " << eModule[i] << " with " << layerN[i] << " layers";
185  if (i == 0) {
186  for (int j = 0; j < layerN[i]; j++) {
187  edm::LogVerbatim("HCalGeom") << "\t " << layerN0[j] << "/" << layerN0[j + 1];
188  }
189  } else if (i == 1) {
190  for (int j = 0; j < layerN[i]; j++) {
191  edm::LogVerbatim("HCalGeom") << "\t " << layerN1[j] << "/" << layerN1[j + 1];
192  }
193  } else if (i == 2) {
194  for (int j = 0; j < layerN[i]; j++) {
195  edm::LogVerbatim("HCalGeom") << "\t " << layerN2[j];
196  }
197  } else if (i == 3) {
198  for (int j = 0; j < layerN[i]; j++) {
199  edm::LogVerbatim("HCalGeom") << "\t " << layerN3[j];
200  }
201  } else if (i == 4) {
202  for (int j = 0; j < layerN[i]; j++) {
203  edm::LogVerbatim("HCalGeom") << "\t " << layerN4[j];
204  }
205  } else if (i == 5) {
206  for (int j = 0; j < layerN[i]; j++) {
207  edm::LogVerbatim("HCalGeom") << "\t " << layerN5[j];
208  }
209  }
210  }
211 #endif
212 
214  //Layers
215  phiSections = args.value<int>("PhiSections");
216  phiName = args.value<std::vector<std::string> >("PhiName");
217  layers = args.value<int>("Layers");
218  layerName = args.value<std::vector<std::string> >("LayerName");
219  layerType = args.value<std::vector<int> >("LayerType");
220  layerT = args.value<std::vector<double> >("LayerT");
221  scintT = args.value<std::vector<double> >("ScintT");
222  scintMat = args.value<std::string>("ScintMat");
223  plastMat = args.value<std::string>("PlastMat");
224  rotmat = args.value<std::string>("RotMat");
225 #ifdef EDM_ML_DEBUG
226  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Phi Sections " << phiSections;
227  for (int i = 0; i < phiSections; i++)
228  edm::LogVerbatim("HCalGeom") << "\tName[" << i << "] : " << phiName[i];
229  edm::LogVerbatim("HCalGeom") << "\tPlastic: " << plastMat << "\tScintillator: " << scintMat << "\tRotation matrix "
230  << rotmat << "\n\tNumber of layers " << layers;
231  for (int i = 0; i < layers; i++) {
232  edm::LogVerbatim("HCalGeom") << "\t" << layerName[i] << "\tType " << layerType[i] << "\tThickness "
233  << convertCmToMm(layerT[i]) << "\tScint.Thick " << convertCmToMm(scintT[i]);
234  }
235 #endif
236 
238  // Derive bounding of the modules
239  int module = 0;
240  // Layer 0 (Nose)
241  if (modules > 0) {
242  zminBlock.emplace_back(ziL0Nose);
243  zmaxBlock.emplace_back(zminBlock[module] + layerT[0] + 0.5 * dzStep);
244  rinBlock1.emplace_back(zminBlock[module] * tan(angTop));
245  rinBlock2.emplace_back(zmaxBlock[module] * tan(angTop));
246  routBlock1.emplace_back((zminBlock[module] - z1Beam) * slope);
247  routBlock2.emplace_back((zmaxBlock[module] - z1Beam) * slope);
248  module++;
249  }
250  // Layer 0 (Body)
251  if (modules > 1) {
252  zminBlock.emplace_back(ziL0Body);
253  zmaxBlock.emplace_back(zminBlock[module] + layerT[0] + 0.5 * dzStep);
254  rinBlock1.emplace_back(zminBlock[module] * tan(angBot));
255  rinBlock2.emplace_back(zmaxBlock[module] * tan(angBot));
256  routBlock1.emplace_back(zminBlock[module] * tan(angTop));
257  routBlock2.emplace_back(zmaxBlock[module] * tan(angTop));
258  module++;
259  }
260  // Hac1
261  if (modules > 2) {
262  zminBlock.emplace_back(ziNose);
263  zmaxBlock.emplace_back(ziBody);
264  rinBlock1.emplace_back(zminBlock[module] * tan(angTop));
265  rinBlock2.emplace_back(zmaxBlock[module] * tan(angTop));
266  routBlock1.emplace_back((zminBlock[module] - z1Beam) * slope);
267  routBlock2.emplace_back((zmaxBlock[module] - z1Beam) * slope);
268  module++;
269  }
270  // Hac2
271  if (modules > 3) {
272  zminBlock.emplace_back(ziBody);
273  zmaxBlock.emplace_back(zminBlock[module] + layerN[3] * dzStep);
274  rinBlock1.emplace_back(zminBlock[module] * tan(angBot));
275  rinBlock2.emplace_back(zmaxBlock[module] * tan(angBot));
276  routBlock1.emplace_back((zmaxBlock[module - 1] - z1Beam) * slope);
277  routBlock2.emplace_back(rout);
278  module++;
279  }
280  // Hac3
281  if (modules > 4) {
282  zminBlock.emplace_back(zmaxBlock[module - 1]);
283  zmaxBlock.emplace_back(zminBlock[module] + layerN[4] * dzStep);
284  rinBlock1.emplace_back(zminBlock[module] * tan(angBot));
285  rinBlock2.emplace_back(zmaxBlock[module] * tan(angBot));
286  routBlock1.emplace_back(rout);
287  routBlock2.emplace_back(rout);
288  module++;
289  }
290  // Hac4
291  if (modules > 5) {
292  zminBlock.emplace_back(zmaxBlock[module - 1]);
293  zmaxBlock.emplace_back(zminBlock[module] + layerN[5] * dzStep);
294  rinBlock1.emplace_back(zminBlock[module] * tan(angBot));
295  rinBlock2.emplace_back(zmaxBlock[module] * tan(angBot));
296  routBlock1.emplace_back(rout);
297  routBlock2.emplace_back(roDip);
298  module++;
299  }
300 #ifdef EDM_ML_DEBUG
301  for (int i = 0; i < module; i++)
302  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Module " << i << "\tZ/Rin/Rout " << convertCmToMm(zminBlock[i])
303  << ", " << convertCmToMm(zmaxBlock[i]) << "/ " << convertCmToMm(rinBlock1[i]) << ", "
304  << convertCmToMm(rinBlock2[i]) << "/ " << convertCmToMm(routBlock1[i]) << ", "
306 #endif
307 
308  idName = args.value<std::string>("MotherName");
309  idNameSpace = static_cast<std::string>(ns.name());
310  idOffset = args.value<int>("IdOffset");
311 #ifdef EDM_ML_DEBUG
312  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Parent " << args.parentName() << " idName " << idName
313  << " NameSpace " << idNameSpace << " Offset " << idOffset;
314 #endif
315 
316  tolPos = args.value<double>("TolPos");
317  tolAbs = args.value<double>("TolAbs");
318 #ifdef EDM_ML_DEBUG
319  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Tolerances - Positioning " << convertCmToMm(tolPos)
320  << " Absorber " << convertCmToMm(tolAbs);
321  edm::LogVerbatim("HCalGeom") << "==>> Constructing DDHCalEndcapAlgo...";
322 #endif
323 
324  dd4hep::Volume parent = ns.volume(args.parentName());
325  constructGeneralVolume(ns, parent);
326 #ifdef EDM_ML_DEBUG
327  edm::LogVerbatim("HCalGeom") << "<<== End of DDHCalEndcapAlgo construction ...";
328 #endif
329  }
std::vector< double > scintT
std::vector< double > rinBlock2
std::string idName
std::vector< int > layerN5
std::vector< double > layerT
std::string rotmat
std::string absMat
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< int > eModule
std::vector< double > zminBlock
std::vector< double > zmaxBlock
std::vector< int > layerN0
std::vector< double > trimRight
std::vector< double > trimLeft
std::vector< int > layerN3
std::vector< std::string > modMat
std::string scintMat
std::vector< int > layerN1
std::string plastMat
void constructGeneralVolume(cms::DDNamespace &ns, dd4hep::Volume &parent)
std::vector< double > routBlock1
std::vector< int > layerN4
std::string rotHalf
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< int > layerType
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
dd4hep::Volume Volume
std::vector< int > layerN
std::string genMaterial
std::vector< std::string > phiName
std::string rotation
std::vector< double > routBlock2
std::vector< std::string > modName
std::vector< int > modType
std::vector< int > layerN2
std::vector< int > sectionModule
std::vector< std::string > layerName
std::vector< double > rinBlock1
std::vector< double > thick
Definition: vlib.h:198
std::string idNameSpace

Member Function Documentation

void HCalEndcapAlgo::constructGeneralVolume ( cms::DDNamespace ns,
dd4hep::Volume &  parent 
)
inline

!!!!!!!!!!!!!!!!Should be zero. And removed as soon as

Definition at line 331 of file DDHCalEndcapAlgo.cc.

References cms::DDNamespace::addVolumeNS(), zMuMuMuonUserData::alpha, geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), mps_fire::i, cuy::ii, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, HGCalGeometryMode::Polyhedra, cms::DDNamespace::prepend(), makeMuonMisalignmentScenario::rot, AlCaHLTBitMon_QueryRunRegistry::string, and funct::tan().

331  {
332 #ifdef EDM_ML_DEBUG
333  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: General volume...";
334 #endif
335 
336  bool proto = true;
337  for (int i = 0; i < 3; i++)
338  if (eModule[i] > 0)
339  proto = false;
340 
341  dd4hep::Rotation3D rot = getRotation(rotation, ns);
342 #ifdef EDM_ML_DEBUG
343  edm::LogVerbatim("HCalGeom") << " Rotation matrix " << rotation << " Rotation " << rot;
344 #endif
345 
346  dd4hep::Position r0(0, 0, zShift);
347  double alpha = (1._pi) / nsectors;
348  double dphi = nsectortot * (2._pi) / nsectors;
349 
351  //vertical walls are allowed in SolidPolyhedra
352  double delz = 0;
353 
354  std::vector<double> pgonZ, pgonRmin, pgonRmax;
355  if (proto) {
356  double zf = ziBody + zShiftHac2;
357  pgonZ.emplace_back(zf - dzShift);
358  pgonRmin.emplace_back(zf * tan(angBot));
359  pgonRmax.emplace_back((zf - z1Beam) * slope);
360  } else {
361  pgonZ.emplace_back(zFront - dzShift);
362  pgonRmin.emplace_back(zFront * tan(angTop));
363  pgonRmax.emplace_back((zFront - z1Beam) * slope);
364  pgonZ.emplace_back(ziL0Body - dzShift);
365  pgonRmin.emplace_back(ziL0Body * tan(angTop));
366  pgonRmax.emplace_back((ziL0Body - z1Beam) * slope);
367  pgonZ.emplace_back(ziL0Body - dzShift);
368  pgonRmin.emplace_back(ziL0Body * tan(angBot));
369  pgonRmax.emplace_back((ziL0Body - z1Beam) * slope);
370  }
371  pgonZ.emplace_back(ziKink - dzShift);
372  pgonRmin.emplace_back(riKink);
373  pgonRmax.emplace_back(rout);
374  pgonZ.emplace_back(ziDip - dzShift);
375  pgonRmin.emplace_back(riDip);
376  pgonRmax.emplace_back(rout);
377  pgonZ.emplace_back(ziDip - dzShift + delz);
378  pgonRmin.emplace_back(riDip);
379  pgonRmax.emplace_back(roDip);
380  pgonZ.emplace_back(zEnd - dzShift);
381  pgonRmin.emplace_back(zEnd * tan(angBot));
382  pgonRmax.emplace_back(roDip);
383  pgonZ.emplace_back(zEnd);
384  pgonRmin.emplace_back(zEnd * tan(angBot));
385  pgonRmax.emplace_back(roDip);
386 
387  std::string name("Null");
388  dd4hep::Solid solid = dd4hep::Polyhedra(ns.prepend(idName), nsectortot, -alpha, dphi, pgonZ, pgonRmin, pgonRmax);
389 #ifdef EDM_ML_DEBUG
390  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
391  << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
392  << convertRadToDeg(-alpha + dphi) << " and with " << pgonZ.size() << " sections";
393  for (unsigned int i = 0; i < pgonZ.size(); i++)
394  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZ[i]) << "\tRmin = " << convertCmToMm(pgonRmin[i])
395  << "\tRmax = " << convertCmToMm(pgonRmax[i]);
396 #endif
398  dd4hep::Volume genlogic(solid.name(), solid, matter);
399 
400  parent.placeVolume(genlogic, 1, dd4hep::Transform3D(rot, r0));
401 #ifdef EDM_ML_DEBUG
402  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << genlogic.name() << " number 1 positioned in "
403  << parent.name() << " at (0, 0, " << convertCmToMm(zShift)
404  << ") with rotation: " << rot;
405 #endif
406 
407  if (nEndcap != 1) {
408  rot = getRotation(rotHalf, ns);
409  parent.placeVolume(genlogic, 2, dd4hep::Transform3D(rot, r0));
410 #ifdef EDM_ML_DEBUG
411  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << genlogic.name() << " number 2 "
412  << "positioned in " << parent.name() << " at (0, 0, " << convertCmToMm(zShift)
413  << ") with rotation: " << rot;
414 #endif
415  }
416 
417  //Forward half
418  name = idName + "Front";
419  std::vector<double> pgonZMod, pgonRminMod, pgonRmaxMod;
420  for (unsigned int i = 0; i < (pgonZ.size() - 1); i++) {
421  pgonZMod.emplace_back(pgonZ[i] + dzShift);
422  pgonRminMod.emplace_back(pgonRmin[i]);
423  pgonRmaxMod.emplace_back(pgonRmax[i]);
424  }
425  solid = dd4hep::Polyhedra(ns.prepend(name), nsectortot, -alpha, dphi, pgonZMod, pgonRminMod, pgonRmaxMod);
426 #ifdef EDM_ML_DEBUG
427  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
428  << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
429  << convertRadToDeg(-alpha + dphi) << " and with " << pgonZMod.size() << " sections ";
430  for (unsigned int i = 0; i < pgonZMod.size(); i++)
431  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZMod[i])
432  << "\tRmin = " << convertCmToMm(pgonRminMod[i])
433  << "\tRmax = " << convertCmToMm(pgonRmaxMod[i]);
434 #endif
435 
436  dd4hep::Volume genlogich(solid.name(), solid, matter);
437  ns.addVolumeNS(genlogich);
438  genlogic.placeVolume(genlogich, 1, dd4hep::Position(0, 0, -dzShift));
439 #ifdef EDM_ML_DEBUG
440  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << genlogich.name() << " number 1 positioned in "
441  << genlogic.name() << " at (0,0," << -convertCmToMm(dzShift) << ") with no rotation";
442 #endif
443 
444  //Construct sector (from -alpha to +alpha)
445  name = idName + "Module";
446  solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha, 2 * alpha, pgonZMod, pgonRminMod, pgonRmaxMod);
447 #ifdef EDM_ML_DEBUG
448  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
449  << " with 1 sector from " << convertRadToDeg(-alpha) << " to "
450  << convertRadToDeg(alpha) << " and with " << pgonZMod.size() << " sections";
451  for (unsigned int i = 0; i < pgonZMod.size(); i++)
452  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZMod[i])
453  << "\tRmin = " << convertCmToMm(pgonRminMod[i])
454  << "\tRmax = " << convertCmToMm(pgonRmaxMod[i]);
455 #endif
456 
457  dd4hep::Volume seclogic(solid.name(), solid, matter);
458  for (int ii = 0; ii < nsectortot; ii++) {
459  double phi = ii * 2 * alpha;
460  dd4hep::Rotation3D rot0;
461  if (phi != 0) {
462  rot0 = dd4hep::RotationZ(phi);
463 #ifdef EDM_ML_DEBUG
464  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Creating a new rotation \t 90," << convertRadToDeg(phi)
465  << ", 90," << convertRadToDeg(phi + 90._deg) << ", 0, 0";
466 #endif
467  }
468  genlogich.placeVolume(seclogic, ii + 1, rot0);
469 #ifdef EDM_ML_DEBUG
470  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << seclogic.name() << " number " << ii + 1
471  << " positioned in " << genlogich.name() << " at (0, 0, 0) with rotation: " << rot0;
472 #endif
473  }
474 
475  //Construct the things inside the sector
476  constructInsideSector(ns, seclogic);
477 
478  //Backward half
479  name = idName + "Back";
480  std::vector<double> pgonZBack, pgonRminBack, pgonRmaxBack;
481  pgonZBack.emplace_back(zEnd - dzShift);
482  pgonRminBack.emplace_back(pgonZBack[0] * tan(angBot) + drEnd);
483  pgonRmaxBack.emplace_back(roDip);
484  pgonZBack.emplace_back(zEnd);
485  pgonRminBack.emplace_back(pgonZBack[1] * tan(angBot) + drEnd);
486  pgonRmaxBack.emplace_back(roDip);
487  solid = dd4hep::Polyhedra(ns.prepend(name), nsectortot, -alpha, dphi, pgonZBack, pgonRminBack, pgonRmaxBack);
488 #ifdef EDM_ML_DEBUG
489  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << absMat << " with "
490  << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
491  << convertRadToDeg(-alpha + dphi) << " and with " << pgonZBack.size() << " sections";
492  for (unsigned int i = 0; i < pgonZBack.size(); i++)
493  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZBack[i])
494  << "\tRmin = " << convertCmToMm(pgonRminBack[i])
495  << "\tRmax = " << convertCmToMm(pgonRmaxBack[i]);
496 #endif
497 
498  dd4hep::Material absMatter = ns.material(absMat);
499  dd4hep::Volume glog(solid.name(), solid, absMatter);
500  genlogic.placeVolume(glog, 1);
501 #ifdef EDM_ML_DEBUG
502  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number 1 positioned in " << genlogic.name()
503  << " at (0,0,0) with no rotation";
504 #endif
505  }
std::string idName
std::string absMat
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
Definition: DDNamespace.cc:150
std::vector< int > eModule
void constructInsideSector(cms::DDNamespace &ns, dd4hep::Volume &sector)
std::string rotHalf
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:121
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:66
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
dd4hep::Volume Volume
ii
Definition: cuy.py:590
std::string genMaterial
std::string rotation
alpha
zGenParticlesMatch = cms.InputTag(""),
dd4hep::Rotation3D getRotation(const std::string &rotation, cms::DDNamespace &ns)
void HCalEndcapAlgo::constructInsideModule ( cms::DDNamespace ns,
dd4hep::Volume &  module,
int  mod 
)
inline

Definition at line 686 of file DDHCalEndcapAlgo.cc.

References zMuMuMuonUserData::alpha, geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), DDSplit(), dqmdumpme::first, mps_fire::i, LEDCalibrationChannels::iphi, cms::DDNamespace::material(), g4SimHits_cfi::Material, mod(), Skims_PA_cff::name, cms::DDNamespace::prepend(), diffTwoXMLs::r1, makeMuonMisalignmentScenario::rot, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), and theta().

686  {
687 #ifdef EDM_ML_DEBUG
688  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: \t\tInside module ..." << mod;
689 #endif
690 
692  //Pointers to the Rotation Matrices and to the Materials
693  dd4hep::Rotation3D rot = getRotation(rotmat, ns);
695  dd4hep::Material matplastic = ns.material(plastMat);
696 
697  double alpha = (1._pi) / nsectors;
698  double zi = zminBlock[mod];
699 
700  for (int i = 0; i < layerN[mod]; i++) {
702  dd4hep::Solid solid;
703  dd4hep::Volume glog, plog;
704  int layer = getLayer(mod, i);
705  double zo = zi + 0.5 * dzStep;
706 
707  for (int iphi = 0; iphi < phiSections; iphi++) {
708  double ziAir = zo - thick[mod];
709  double rinF, rinB;
710  if (layer == 1) {
711  rinF = ziAir * tan(angTop);
712  rinB = zo * tan(angTop);
713  } else {
714  rinF = ziAir * tan(angBot);
715  rinB = zo * tan(angBot);
716  }
717  double routF = (ziAir - z1Beam) * slope;
718  double routB = (zo - z1Beam) * slope;
719  if (routF > routBlock2[mod])
720  routF = routBlock2[mod];
721  if (routB > routBlock2[mod])
722  routB = routBlock2[mod];
723 
724 #ifdef EDM_ML_DEBUG
725  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Layer " << i << " Phi " << iphi << " Front "
726  << convertCmToMm(ziAir) << ", " << convertCmToMm(rinF) << ", "
727  << convertCmToMm(routF) << " Back " << convertCmToMm(zo) << ", "
728  << convertCmToMm(rinB) << ", " << convertCmToMm(routB);
729 #endif
730 
731  double yh1, bl1, tl1, yh2, bl2, tl2, theta, phi, alp;
732  double xpos, ypos, zpos;
734  iphi, rinF, routF, rinB, routB, ziAir, zo, yh1, bl1, tl1, yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
735 
736  name = DDSplit(module.name()).first + layerName[layer] + phiName[iphi] + "Air";
737  solid = dd4hep::Trap(ns.prepend(name), 0.5 * thick[mod], theta, phi, yh1, bl1, tl1, alp, yh2, bl2, tl2, alp);
738 #ifdef EDM_ML_DEBUG
739  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << matter.name()
740  << " of dimensions " << convertCmToMm(0.5 * thick[mod]) << ", "
741  << convertRadToDeg(theta) << ", " << convertRadToDeg(phi) << ", "
742  << convertCmToMm(yh1) << ", " << convertCmToMm(bl1) << ", " << convertCmToMm(tl1)
743  << ", " << convertRadToDeg(alp) << ", " << convertCmToMm(yh2) << ", "
744  << convertCmToMm(bl2) << ", " << convertCmToMm(tl2) << ", "
745  << convertRadToDeg(alp);
746 #endif
747 
748  glog = dd4hep::Volume(solid.name(), solid, matter);
749  dd4hep::Position r1(xpos, ypos, zpos);
750  module.placeVolume(glog, layer + 1, dd4hep::Transform3D(rot, r1));
751 
752 #ifdef EDM_ML_DEBUG
753  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << (layer + 1)
754  << " positioned in " << module.name() << " at (" << convertCmToMm(xpos) << ", "
755  << convertCmToMm(ypos) << ", " << convertCmToMm(zpos)
756  << ") with rotation: " << rot;
757 #endif
758 
759  //Now the plastic with scintillators
760  double yh = 0.5 * (routF - rinB) - getTrim(mod, iphi);
761  double bl = 0.5 * rinB * tan(alpha) - getTrim(mod, iphi);
762  double tl = 0.5 * routF * tan(alpha) - getTrim(mod, iphi);
763  name = DDSplit(module.name()).first + layerName[layer] + phiName[iphi];
764  solid = dd4hep::Trap(ns.prepend(name), 0.5 * layerT[layer], 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
765 #ifdef EDM_ML_DEBUG
766  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << plastMat
767  << " of dimensions " << convertCmToMm(0.5 * layerT[layer]) << ", 0, 0, "
768  << convertCmToMm(yh) << ", " << convertCmToMm(bl) << ", " << convertCmToMm(tl)
769  << ", " << convertRadToDeg(alp) << ", " << convertCmToMm(yh) << ", "
770  << convertCmToMm(bl) << ", " << convertCmToMm(tl) << ", " << convertRadToDeg(alp);
771 #endif
772 
773  plog = dd4hep::Volume(solid.name(), solid, matplastic);
774  ypos = 0.5 * (routF + rinB) - xpos;
775  glog.placeVolume(plog, idOffset + layer + 1, dd4hep::Position(0., ypos, 0.));
776 
777 #ifdef EDM_ML_DEBUG
778  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << plog.name() << " number " << (idOffset + layer + 1)
779  << " positioned in " << glog.name() << " at (0, " << convertCmToMm(ypos)
780  << ", 0) with no rotation";
781 #endif
782 
783  //Constructing the scintillators inside
784  int copyNo = layer * 10 + layerType[layer];
785  name = modName[mod] + layerName[layer] + phiName[iphi];
786  constructScintLayer(ns, plog, scintT[layer], yh, bl, tl, alp, name, copyNo);
787  zo += 0.5 * dzStep;
788  } // End of loop over phi indices
789  zi = zo - 0.5 * dzStep;
790  } // End of loop on layers
791  }
std::vector< double > scintT
std::vector< double > layerT
std::string rotmat
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Geom::Theta< T > theta() const
std::vector< double > zminBlock
double getTrim(unsigned int i, unsigned int j) const
int getLayer(unsigned int i, unsigned int j) const
std::string plastMat
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:121
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:66
std::vector< int > layerType
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
dd4hep::Volume Volume
std::vector< int > layerN
std::string genMaterial
std::vector< std::string > phiName
std::vector< double > routBlock2
std::vector< std::string > modName
alpha
zGenParticlesMatch = cms.InputTag(""),
std::vector< std::string > layerName
void parameterLayer(int iphi, double rinF, double routF, double rinB, double routB, double zi, double zo, double &yh1, double &bl1, double &tl1, double &yh2, double &bl2, double &tl2, double &alp, double &theta, double &phi, double &xpos, double &ypos, double &zpos)
std::vector< double > thick
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
Definition: vlib.h:198
void constructScintLayer(cms::DDNamespace &ns, dd4hep::Volume &detector, double dz, double yh, double bl, double tl, double alp, const std::string &nm, int id)
dd4hep::Rotation3D getRotation(const std::string &rotation, cms::DDNamespace &ns)
void HCalEndcapAlgo::constructInsideModule0 ( cms::DDNamespace ns,
dd4hep::Volume &  module,
int  mod 
)
inline

Definition at line 578 of file DDHCalEndcapAlgo.cc.

References geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), DDSplit(), fact, dqmdumpme::first, LEDCalibrationChannels::iphi, cms::DDNamespace::material(), g4SimHits_cfi::Material, mod(), Skims_PA_cff::name, cms::DDNamespace::prepend(), diffTwoXMLs::r1, diffTwoXMLs::r2, makeMuonMisalignmentScenario::rot, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), and theta().

578  {
579 #ifdef EDM_ML_DEBUG
580  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: \t\tInside module0 ..." << mod;
581 #endif
582 
584  //Pointers to the Rotation Matrices and to the Materials
585  dd4hep::Rotation3D rot = getRotation(rotmat, ns);
586  dd4hep::Material matabsorbr = ns.material(absMat);
587  dd4hep::Material matplastic = ns.material(plastMat);
588 
589  int layer = getLayer(mod, 0);
590  int layer0 = getLayer(mod, 1);
592  double xpos, ypos, zpos;
593  dd4hep::Solid solid;
594  dd4hep::Volume glog;
595  for (int iphi = 0; iphi < phiSections; iphi++) {
596  double yh, bl, tl, alp;
597  parameterLayer0(mod, layer, iphi, yh, bl, tl, alp, xpos, ypos, zpos);
598  name = DDSplit(module.name()).first + layerName[layer] + phiName[iphi];
599  solid = dd4hep::Trap(ns.prepend(name), 0.5 * layerT[layer], 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
600 #ifdef EDM_ML_DEBUG
601  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << plastMat
602  << " of dimensions " << convertCmToMm(0.5 * layerT[layer]) << ", 0, 0, "
603  << convertCmToMm(yh) << ", " << convertCmToMm(bl) << ", " << convertCmToMm(tl)
604  << ", " << convertRadToDeg(alp) << ", " << convertCmToMm(yh) << ", "
605  << convertCmToMm(bl) << ", " << convertCmToMm(tl) << ", " << convertRadToDeg(alp);
606 #endif
607 
608  glog = dd4hep::Volume(solid.name(), solid, matplastic);
609 
610  dd4hep::Position r1(xpos, ypos, zpos);
611  module.placeVolume(glog, idOffset + layer + 1, dd4hep::Transform3D(rot, r1));
612 
613 #ifdef EDM_ML_DEBUG
614  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << (idOffset + layer + 1)
615  << " positioned in " << module.name() << " at (" << convertCmToMm(xpos) << ", "
616  << convertCmToMm(ypos) << ", " << convertCmToMm(zpos) << " with rotation: " << rot;
617 #endif
618 
619  //Now construct the layer of scintillator inside this
620  int copyNo = layer0 * 10 + layerType[layer];
621  name = modName[mod] + layerName[layer] + phiName[iphi];
622  constructScintLayer(ns, glog, scintT[layer], yh, bl, tl, alp, name, copyNo);
623  }
624 
625  //Now the absorber layer
626  double zi = zminBlock[mod] + layerT[layer];
627  double zo = zi + 0.5 * dzStep;
628  double rinF, routF, rinB, routB;
629  if (mod == 0) {
630  rinF = zi * tan(angTop);
631  routF = (zi - z1Beam) * slope;
632  rinB = zo * tan(angTop);
633  routB = (zo - z1Beam) * slope;
634  } else {
635  rinF = zi * tan(angBot);
636  routF = zi * tan(angTop);
637  rinB = zo * tan(angBot);
638  routB = zo * tan(angTop);
639  }
640 
641 #ifdef EDM_ML_DEBUG
642  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Module " << mod << " Front " << convertCmToMm(zi) << ", "
643  << convertCmToMm(rinF) << ", " << convertCmToMm(routF) << " Back " << convertCmToMm(zo)
644  << ", " << convertCmToMm(rinB) << ", " << convertCmToMm(routB);
645 #endif
646 
647  double yh1, bl1, tl1, yh2, bl2, tl2, theta, phi, alp;
649  0, rinF, routF, rinB, routB, zi, zo, yh1, bl1, tl1, yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
650  double fact = tolAbs;
651 
652 #ifdef EDM_ML_DEBUG
653  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Trim " << convertCmToMm(fact) << " Param " << convertCmToMm(yh1)
654  << ", " << convertCmToMm(bl1) << ", " << convertCmToMm(tl1) << ", "
655  << convertCmToMm(yh2) << ", " << convertCmToMm(bl2) << ", " << convertCmToMm(tl2);
656 #endif
657 
658  bl1 -= fact;
659  tl1 -= fact;
660  bl2 -= fact;
661  tl2 -= fact;
662 
663  name = DDSplit(module.name()).first + "Absorber";
664  solid = dd4hep::Trap(ns.prepend(name), 0.5 * thick[mod], theta, phi, yh1, bl1, tl1, alp, yh2, bl2, tl2, alp);
665 #ifdef EDM_ML_DEBUG
666  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << absMat
667  << " of dimensions " << convertCmToMm(0.5 * thick[mod]) << ", "
668  << convertRadToDeg(theta) << ", " << convertRadToDeg(phi) << ", " << convertCmToMm(yh1)
669  << ", " << convertCmToMm(bl1) << ", " << convertCmToMm(tl1) << ", "
670  << convertRadToDeg(alp) << ", " << convertCmToMm(yh2) << ", " << convertCmToMm(bl2)
671  << ", " << convertCmToMm(tl2) << ", " << convertRadToDeg(alp);
672 #endif
673 
674  glog = dd4hep::Volume(solid.name(), solid, matabsorbr);
675 
676  dd4hep::Position r2(xpos, ypos, zpos);
677  module.placeVolume(glog, 1, dd4hep::Transform3D(rot, r2));
678 
679 #ifdef EDM_ML_DEBUG
680  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number 1 positioned in " << module.name()
681  << " at (" << convertCmToMm(xpos) << ", " << convertCmToMm(ypos) << ", "
682  << convertCmToMm(zpos) << ") with rotation: " << rot;
683 #endif
684  }
std::vector< double > scintT
std::vector< double > layerT
std::string rotmat
std::string absMat
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Geom::Theta< T > theta() const
std::vector< double > zminBlock
int getLayer(unsigned int i, unsigned int j) const
std::string plastMat
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:121
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:66
std::vector< int > layerType
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
dd4hep::Volume Volume
std::vector< std::string > phiName
void parameterLayer0(int mod, int layer, int iphi, double &yh, double &bl, double &tl, double &alp, double &xpos, double &ypos, double &zpos)
const double fact
std::vector< std::string > modName
std::vector< std::string > layerName
void parameterLayer(int iphi, double rinF, double routF, double rinB, double routB, double zi, double zo, double &yh1, double &bl1, double &tl1, double &yh2, double &bl2, double &tl2, double &alp, double &theta, double &phi, double &xpos, double &ypos, double &zpos)
std::vector< double > thick
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
Definition: vlib.h:198
void constructScintLayer(cms::DDNamespace &ns, dd4hep::Volume &detector, double dz, double yh, double bl, double tl, double alp, const std::string &nm, int id)
dd4hep::Rotation3D getRotation(const std::string &rotation, cms::DDNamespace &ns)
void HCalEndcapAlgo::constructInsideSector ( cms::DDNamespace ns,
dd4hep::Volume &  sector 
)
inline

!!!!!!!!!!!!!!!!Should be zero. And removed as soon as

Definition at line 507 of file DDHCalEndcapAlgo.cc.

References zMuMuMuonUserData::alpha, geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), mps_fire::i, dqmdumpme::k, cms::DDNamespace::material(), g4SimHits_cfi::Material, LogMessageMonitor_cff::modules, Skims_PA_cff::name, HGCalGeometryMode::Polyhedra, cms::DDNamespace::prepend(), AlCaHLTBitMon_QueryRunRegistry::string, and funct::tan().

507  {
508 #ifdef EDM_ML_DEBUG
509  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Modules (" << modules << ") ...";
510 #endif
511 
512  double alpha = (1._pi) / nsectors;
513  for (int i = 0; i < modules; i++) {
515  dd4hep::Material matter = ns.material(modMat[i]);
516 
517  if (eModule[i] > 0) {
518  int nsec = sectionModule[i];
519 
521  //vertical walls are allowed in SolidPolyhedra
522  double deltaz = 0;
523 
524  std::vector<double> pgonZ, pgonRmin, pgonRmax;
525  if (nsec == 3) {
526  double zf = zminBlock[i] + zShiftHac2;
527  pgonZ.emplace_back(zf);
528  pgonRmin.emplace_back(zf * tan(angBot));
529  pgonRmax.emplace_back((zf - z1Beam) * slope);
530  pgonZ.emplace_back(ziKink);
531  pgonRmin.emplace_back(riKink);
532  pgonRmax.emplace_back(rout);
533  } else {
534  pgonZ.emplace_back(zminBlock[i]);
535  pgonRmin.emplace_back(rinBlock1[i]);
536  pgonRmax.emplace_back(routBlock1[i]);
537  }
538  if (nsec == 4) {
539  pgonZ.emplace_back(ziDip);
540  pgonRmin.emplace_back(riDip);
541  pgonRmax.emplace_back(rout);
542  pgonZ.emplace_back(pgonZ[1] + deltaz);
543  pgonRmin.emplace_back(pgonRmin[1]);
544  pgonRmax.emplace_back(roDip);
545  }
546  pgonZ.emplace_back(zmaxBlock[i]);
547  pgonRmin.emplace_back(rinBlock2[i]);
548  pgonRmax.emplace_back(routBlock2[i]);
549 
550  //Solid & volume
551  dd4hep::Solid solid = dd4hep::Polyhedra(ns.prepend(name), 1, -alpha, 2 * alpha, pgonZ, pgonRmin, pgonRmax);
552 #ifdef EDM_ML_DEBUG
553  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << modMat[i]
554  << " with 1 sector from " << convertRadToDeg(-alpha) << " to "
555  << convertRadToDeg(alpha) << " and with " << nsec << " sections";
556  for (unsigned int k = 0; k < pgonZ.size(); k++)
557  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << convertCmToMm(pgonZ[k])
558  << "\tRmin = " << convertCmToMm(pgonRmin[k])
559  << "\tRmax = " << convertCmToMm(pgonRmax[k]);
560 #endif
561 
562  dd4hep::Volume glog(solid.name(), solid, matter);
563 
564  sector.placeVolume(glog, i + 1);
565 #ifdef EDM_ML_DEBUG
566  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << i + 1 << " positioned in "
567  << sector.name() << " at (0,0,0) with no rotation";
568 #endif
569 
570  if (modType[i] == 0)
571  constructInsideModule0(ns, glog, i);
572  else
573  constructInsideModule(ns, glog, i);
574  }
575  }
576  }
std::vector< double > rinBlock2
std::string idName
void constructInsideModule0(cms::DDNamespace &ns, dd4hep::Volume &module, int mod)
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< int > eModule
std::vector< double > zminBlock
std::vector< double > zmaxBlock
std::vector< std::string > modMat
void constructInsideModule(cms::DDNamespace &ns, dd4hep::Volume &module, int mod)
std::vector< double > routBlock1
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:121
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:66
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
dd4hep::Volume Volume
std::vector< double > routBlock2
std::vector< std::string > modName
std::vector< int > modType
std::vector< int > sectionModule
alpha
zGenParticlesMatch = cms.InputTag(""),
std::vector< double > rinBlock1
void HCalEndcapAlgo::constructScintLayer ( cms::DDNamespace ns,
dd4hep::Volume &  detector,
double  dz,
double  yh,
double  bl,
double  tl,
double  alp,
const std::string &  nm,
int  id 
)
inline

Definition at line 793 of file DDHCalEndcapAlgo.cc.

References geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), PVValHelper::dz, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, cms::DDNamespace::prepend(), and AlCaHLTBitMon_QueryRunRegistry::string.

801  {
802  dd4hep::Material matter = ns.material(scintMat);
803  std::string name = idName + "Scintillator" + nm;
804 
805  dd4hep::Solid solid = dd4hep::Trap(ns.prepend(name), 0.5 * dz, 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
806 #ifdef EDM_ML_DEBUG
807  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << scintMat
808  << " of dimensions " << convertCmToMm(0.5 * dz) << ", 0, 0, " << convertCmToMm(yh)
809  << ", " << convertCmToMm(bl) << ", " << convertCmToMm(tl) << ", "
810  << convertRadToDeg(alp) << ", " << convertCmToMm(yh) << ", " << convertCmToMm(bl)
811  << ", " << convertCmToMm(tl) << ", " << convertRadToDeg(alp);
812 #endif
813 
814  dd4hep::Volume glog(solid.name(), solid, matter);
815  detector.placeVolume(glog, id);
816 #ifdef EDM_ML_DEBUG
817  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << id << " positioned in "
818  << detector.name() << " at (0,0,0) with no rotation";
819 #endif
820  }
std::string idName
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::string scintMat
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:121
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:66
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
dd4hep::Volume Volume
int HCalEndcapAlgo::getLayer ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 822 of file DDHCalEndcapAlgo.cc.

References dqmiolumiharvest::j.

822  {
823  switch (i) {
824  case 0:
825  return layerN0[j];
826  break;
827  case 1:
828  return layerN1[j];
829  break;
830  case 2:
831  return layerN2[j];
832  break;
833  case 3:
834  return layerN3[j];
835  break;
836  case 4:
837  return layerN4[j];
838  break;
839  case 5:
840  return layerN5[j];
841  break;
842  default:
843  return 0;
844  }
845  }
std::vector< int > layerN5
std::vector< int > layerN0
std::vector< int > layerN3
std::vector< int > layerN1
std::vector< int > layerN4
std::vector< int > layerN2
dd4hep::Rotation3D HCalEndcapAlgo::getRotation ( const std::string &  rotation,
cms::DDNamespace ns 
)
inline

Definition at line 973 of file DDHCalEndcapAlgo.cc.

References NAMESPACE_SEP, makeMuonMisalignmentScenario::rot, idealTransformation::rotation, cms::DDNamespace::rotation(), and AlCaHLTBitMon_QueryRunRegistry::string.

973  {
974  std::string rot = (strchr(rotation.c_str(), NAMESPACE_SEP) == nullptr) ? ("rotations:" + rotation) : rotation;
975 #ifdef EDM_ML_DEBUG
976  edm::LogVerbatim("HCalGeom") << "getRotation: " << rotation << ":" << rot << ":" << ns.rotation(rot);
977 #endif
978  return ns.rotation(rot);
979  }
std::string rotation
const dd4hep::Rotation3D & rotation(const std::string &name) const
Definition: DDNamespace.cc:130
#define NAMESPACE_SEP
Definition: DDNamespace.h:79
double HCalEndcapAlgo::getTrim ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 847 of file DDHCalEndcapAlgo.cc.

References mps_fire::i, and dqmiolumiharvest::j.

847  {
848  if (j == 0)
849  return trimLeft[i];
850  else
851  return trimRight[j];
852  }
std::vector< double > trimRight
std::vector< double > trimLeft
void HCalEndcapAlgo::parameterLayer ( int  iphi,
double  rinF,
double  routF,
double  rinB,
double  routB,
double  zi,
double  zo,
double &  yh1,
double &  bl1,
double &  tl1,
double &  yh2,
double &  bl2,
double &  tl2,
double &  alp,
double &  theta,
double &  phi,
double &  xpos,
double &  ypos,
double &  zpos 
)
inline

Definition at line 911 of file DDHCalEndcapAlgo.cc.

References zMuMuMuonUserData::alpha, geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), PVValHelper::dx, PVValHelper::dy, alignCSCRings::r, mathSSE::sqrt(), and funct::tan().

929  {
930  //Given rin, rout compute parameters of the trapezoid and
931  //position of the trapezoid for a standrd layer
932  double alpha = (1._pi) / nsectors;
933 
934 #ifdef EDM_ML_DEBUG
935  edm::LogVerbatim("HCalGeom") << "Input " << iphi << " Front " << convertCmToMm(rinF) << " " << convertCmToMm(routF)
936  << " " << convertCmToMm(zi) << " Back " << convertCmToMm(rinB) << " "
937  << convertCmToMm(routB) << " " << convertCmToMm(zo) << " Alpha "
938  << convertRadToDeg(alpha);
939 #endif
940 
941  yh1 = 0.5 * (routF - rinB);
942  bl1 = 0.5 * rinB * tan(alpha);
943  tl1 = 0.5 * routF * tan(alpha);
944  yh2 = 0.5 * (routF - rinB);
945  bl2 = 0.5 * rinB * tan(alpha);
946  tl2 = 0.5 * routF * tan(alpha);
947  double dx = 0.25 * (bl2 + tl2 - bl1 - tl1);
948  double dy = 0.5 * (rinB + routF - rinB - routF);
949  xpos = 0.25 * (rinB + routF + rinB + routF);
950  ypos = 0.25 * (bl2 + tl2 + bl1 + tl1);
951  zpos = 0.5 * (zi + zo);
952  alp = atan(0.5 * tan(alpha));
953  // ypos-= tolPos;
954  if (iphi == 0) {
955  ypos = -ypos;
956  } else {
957  alp = -alp;
958  dx = -dx;
959  }
960  double r = sqrt(dx * dx + dy * dy);
961  theta = atan(r / (zo - zi));
962  phi = atan2(dy, dx);
963 
964 #ifdef EDM_ML_DEBUG
965  edm::LogVerbatim("HCalGeom") << "Output Dimensions " << convertCmToMm(yh1) << " " << convertCmToMm(bl1) << " "
966  << convertCmToMm(tl1) << " " << convertCmToMm(yh2) << " " << convertCmToMm(bl2) << " "
967  << convertCmToMm(tl2) << " " << convertRadToDeg(alp) << " " << convertRadToDeg(theta)
968  << " " << convertRadToDeg(phi) << " Position " << convertCmToMm(xpos) << " "
969  << convertCmToMm(ypos) << " " << convertCmToMm(zpos);
970 #endif
971  }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Geom::Theta< T > theta() const
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
alpha
zGenParticlesMatch = cms.InputTag(""),
void HCalEndcapAlgo::parameterLayer0 ( int  mod,
int  layer,
int  iphi,
double &  yh,
double &  bl,
double &  tl,
double &  alp,
double &  xpos,
double &  ypos,
double &  zpos 
)
inline

Definition at line 854 of file DDHCalEndcapAlgo.cc.

References zMuMuMuonUserData::alpha, geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), mod(), and funct::tan().

863  {
864  //Given module and layer number compute parameters of trapezoid
865  //and positioning parameters
866  double alpha = (1._pi) / nsectors;
867 #ifdef EDM_ML_DEBUG
868  edm::LogVerbatim("HCalGeom") << "Input " << iphi << " " << layer << " " << iphi << " Alpha "
869  << convertRadToDeg(alpha);
870 #endif
871 
872  double zi, zo;
873  if (iphi == 0) {
874  zi = zminBlock[mod];
875  zo = zi + layerT[layer];
876  } else {
877  zo = zmaxBlock[mod];
878  zi = zo - layerT[layer];
879  }
880  double rin, rout;
881  if (mod == 0) {
882  rin = zo * tan(angTop);
883  rout = (zi - z1Beam) * slope;
884  } else {
885  rin = zo * tan(angBot);
886  rout = zi * tan(angTop);
887  }
888  yh = 0.5 * (rout - rin);
889  bl = 0.5 * rin * tan(alpha);
890  tl = 0.5 * rout * tan(alpha);
891  xpos = 0.5 * (rin + rout);
892  ypos = 0.5 * (bl + tl);
893  zpos = 0.5 * (zi + zo);
894  yh -= getTrim(mod, iphi);
895  bl -= getTrim(mod, iphi);
896  tl -= getTrim(mod, iphi);
897  alp = atan(0.5 * tan(alpha));
898  if (iphi == 0) {
899  ypos = -ypos;
900  } else {
901  alp = -alp;
902  }
903 
904 #ifdef EDM_ML_DEBUG
905  edm::LogVerbatim("HCalGeom") << "Output Dimensions " << convertCmToMm(yh) << " " << convertCmToMm(bl) << " "
906  << convertCmToMm(tl) << " " << convertRadToDeg(alp) << " Position "
907  << convertCmToMm(xpos) << " " << convertCmToMm(ypos) << " " << convertCmToMm(zpos);
908 #endif
909  }
std::vector< double > layerT
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< double > zminBlock
std::vector< double > zmaxBlock
double getTrim(unsigned int i, unsigned int j) const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
alpha
zGenParticlesMatch = cms.InputTag(""),
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

Member Data Documentation

std::string HCalEndcapAlgo::absMat

Definition at line 54 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::angBot

Definition at line 51 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::angGap

Definition at line 52 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::angTop

Definition at line 50 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::drEnd

Definition at line 49 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::dzShift

Definition at line 42 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::dzStep

Definition at line 41 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::eModule

Definition at line 27 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::genMaterial

Definition at line 23 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::heboxDepth

Definition at line 48 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::idName

Definition at line 86 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::idNameSpace

Definition at line 87 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::idOffset

Definition at line 88 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN

Definition at line 60 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN0

Definition at line 61 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN1

Definition at line 62 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN2

Definition at line 63 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN3

Definition at line 64 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN4

Definition at line 65 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN5

Definition at line 66 of file DDHCalEndcapAlgo.cc.

std::vector<std::string> HCalEndcapAlgo::layerName

Definition at line 79 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::layers

Definition at line 78 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::layerT

Definition at line 81 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerType

Definition at line 80 of file DDHCalEndcapAlgo.cc.

std::vector<std::string> HCalEndcapAlgo::modMat

Definition at line 57 of file DDHCalEndcapAlgo.cc.

std::vector<std::string> HCalEndcapAlgo::modName

Definition at line 56 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::modType

Definition at line 58 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::modules

Definition at line 55 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::nEndcap

Definition at line 26 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::nsectors

Definition at line 24 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::nsectortot

Definition at line 25 of file DDHCalEndcapAlgo.cc.

std::vector<std::string> HCalEndcapAlgo::phiName

Definition at line 77 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::phiSections

Definition at line 76 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::plastMat

Definition at line 83 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::riDip

Definition at line 46 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::riKink

Definition at line 45 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::rinBlock1

Definition at line 72 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::rinBlock2

Definition at line 74 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::roDip

Definition at line 47 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::rotation

Definition at line 29 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::rotHalf

Definition at line 28 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::rotmat

Definition at line 85 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::rout

Definition at line 44 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::routBlock1

Definition at line 73 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::routBlock2

Definition at line 75 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::scintMat

Definition at line 84 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::scintT

Definition at line 82 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::sectionModule

Definition at line 59 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::slope
std::vector<double> HCalEndcapAlgo::thick

Definition at line 67 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::tolAbs

Definition at line 89 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::tolPos

Definition at line 89 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::trimLeft

Definition at line 68 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::trimRight

Definition at line 69 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::z0Beam

Definition at line 38 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::z1Beam

Definition at line 39 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::zEnd

Definition at line 32 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::zFront

Definition at line 31 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziBody

Definition at line 35 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziDip

Definition at line 40 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziKink

Definition at line 37 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziL0Body

Definition at line 36 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziL0Nose

Definition at line 34 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziNose

Definition at line 33 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::zmaxBlock

Definition at line 71 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::zminBlock

Definition at line 70 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::zShift

Definition at line 30 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::zShiftHac2

Definition at line 43 of file DDHCalEndcapAlgo.cc.