CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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 23 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, cms::convert2mm(), angle_units::operators::convertRadToDeg(), funct::exp(), mps_fire::i, cutBasedElectronHLTPreselecition_Summer16_V1_cff::idName, dqmiolumiharvest::j, phase1PixelTopology::layerName, LayerTriplets::layers(), callgraph::module, TrackingSourceConfig_Tier0_Cosmic_cff::modules, cms::DDNamespace::name(), SpecificationBuilder_cfi::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 " << cms::convert2mm(zFront) << " zEnd "
127  << cms::convert2mm(zEnd) << " ziNose " << cms::convert2mm(ziNose) << " ziL0Nose "
128  << cms::convert2mm(ziL0Nose) << " ziBody " << cms::convert2mm(ziBody) << " ziL0Body "
129  << cms::convert2mm(ziL0Body) << " z0Beam " << cms::convert2mm(z0Beam) << " ziDip "
130  << cms::convert2mm(ziDip) << " dzStep " << cms::convert2mm(dzStep) << " Gap "
131  << cms::convert2mm(gap) << " z1 " << cms::convert2mm(z1) << "\n\tr1 "
132  << cms::convert2mm(r1) << " rout " << cms::convert2mm(rout) << " HeboxDepth "
133  << cms::convert2mm(heboxDepth) << " drEnd " << cms::convert2mm(drEnd) << "\tetamin "
134  << etamin << " Bottom angle " << angBot << " Gap angle " << angGap << " Z-Shift "
135  << cms::convert2mm(zShift) << " " << cms::convert2mm(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 " << cms::convert2mm(dzShift) << "\n\tz1Beam " << cms::convert2mm(z1Beam)
150  << "\tziKink" << cms::convert2mm(ziKink) << "\triKink " << cms::convert2mm(riKink)
151  << "\triDip " << cms::convert2mm(riDip) << "\n\troDip " << cms::convert2mm(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 " << cms::convert2mm(thick[i])
183  << " trim " << cms::convert2mm(trimLeft[i]) << ", " << cms::convert2mm(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  << cms::convert2mm(layerT[i]) << "\tScint.Thick " << cms::convert2mm(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 "
303  << cms::convert2mm(zminBlock[i]) << ", " << cms::convert2mm(zmaxBlock[i]) << "/ "
304  << cms::convert2mm(rinBlock1[i]) << ", " << cms::convert2mm(rinBlock2[i]) << "/ "
306 #endif
307 
308  idName = args.value<std::string>("MotherName");
309  idOffset = args.value<int>("IdOffset");
310 #ifdef EDM_ML_DEBUG
311  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Parent " << args.parentName() << " idName " << idName
312  << " NameSpace " << ns.name() << " Offset " << idOffset;
313 #endif
314 
315  tolPos = args.value<double>("TolPos");
316  tolAbs = args.value<double>("TolAbs");
317 #ifdef EDM_ML_DEBUG
318  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Tolerances - Positioning " << cms::convert2mm(tolPos)
319  << " Absorber " << cms::convert2mm(tolAbs);
320  edm::LogVerbatim("HCalGeom") << "==>> Constructing DDHCalEndcapAlgo...";
321 #endif
322 
323  dd4hep::Volume parent = ns.volume(args.parentName());
324  constructGeneralVolume(ns, parent);
325 #ifdef EDM_ML_DEBUG
326  edm::LogVerbatim("HCalGeom") << "<<== End of DDHCalEndcapAlgo construction ...";
327 #endif
328  }
Log< level::Info, true > LogVerbatim
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
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< int > eModule
std::vector< double > zminBlock
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
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
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
tuple module
Definition: callgraph.py:69

Member Function Documentation

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

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

Definition at line 330 of file DDHCalEndcapAlgo.cc.

References cms::DDNamespace::addVolumeNS(), alpha, cms::convert2mm(), angle_units::operators::convertRadToDeg(), mps_fire::i, cutBasedElectronHLTPreselecition_Summer16_V1_cff::idName, cuy::ii, cms::DDNamespace::material(), mergeVDriftHistosByStation::name, HGCalGeometryMode::Polyhedra, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), makeMuonMisalignmentScenario::rot, idealTransformation::rotation, slope, AlCaHLTBitMon_QueryRunRegistry::string, and funct::tan().

330  {
331 #ifdef EDM_ML_DEBUG
332  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: General volume...";
333 #endif
334 
335  bool proto = true;
336  for (int i = 0; i < 3; i++)
337  if (eModule[i] > 0)
338  proto = false;
339 
340  dd4hep::Rotation3D rot = getRotation(rotation, ns);
341 #ifdef EDM_ML_DEBUG
342  edm::LogVerbatim("HCalGeom") << " Rotation matrix " << rotation << " Rotation " << rot;
343 #endif
344 
345  dd4hep::Position r0(0, 0, zShift);
346  double alpha = (1._pi) / nsectors;
347  double dphi = nsectortot * (2._pi) / nsectors;
348 
350  //vertical walls are allowed in SolidPolyhedra
351  double delz = 0;
352 
353  std::vector<double> pgonZ, pgonRmin, pgonRmax;
354  if (proto) {
355  double zf = ziBody + zShiftHac2;
356  pgonZ.emplace_back(zf - dzShift);
357  pgonRmin.emplace_back(zf * tan(angBot));
358  pgonRmax.emplace_back((zf - z1Beam) * slope);
359  } else {
360  pgonZ.emplace_back(zFront - dzShift);
361  pgonRmin.emplace_back(zFront * tan(angTop));
362  pgonRmax.emplace_back((zFront - z1Beam) * slope);
363  pgonZ.emplace_back(ziL0Body - dzShift);
364  pgonRmin.emplace_back(ziL0Body * tan(angTop));
365  pgonRmax.emplace_back((ziL0Body - z1Beam) * slope);
366  pgonZ.emplace_back(ziL0Body - dzShift);
367  pgonRmin.emplace_back(ziL0Body * tan(angBot));
368  pgonRmax.emplace_back((ziL0Body - z1Beam) * slope);
369  }
370  pgonZ.emplace_back(ziKink - dzShift);
371  pgonRmin.emplace_back(riKink);
372  pgonRmax.emplace_back(rout);
373  pgonZ.emplace_back(ziDip - dzShift);
374  pgonRmin.emplace_back(riDip);
375  pgonRmax.emplace_back(rout);
376  pgonZ.emplace_back(ziDip - dzShift + delz);
377  pgonRmin.emplace_back(riDip);
378  pgonRmax.emplace_back(roDip);
379  pgonZ.emplace_back(zEnd - dzShift);
380  pgonRmin.emplace_back(zEnd * tan(angBot));
381  pgonRmax.emplace_back(roDip);
382  pgonZ.emplace_back(zEnd);
383  pgonRmin.emplace_back(zEnd * tan(angBot));
384  pgonRmax.emplace_back(roDip);
385 
386  std::string name("Null");
387  dd4hep::Solid solid = dd4hep::Polyhedra(ns.prepend(idName), nsectortot, -alpha, dphi, pgonZ, pgonRmin, pgonRmax);
388 #ifdef EDM_ML_DEBUG
389  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Polyhedra made of " << genMaterial
390  << " with " << nsectortot << " sectors from " << convertRadToDeg(-alpha) << " to "
391  << convertRadToDeg(-alpha + dphi) << " and with " << pgonZ.size() << " sections";
392  for (unsigned int i = 0; i < pgonZ.size(); i++)
393  edm::LogVerbatim("HCalGeom") << "\t\tZ = " << cms::convert2mm(pgonZ[i])
394  << "\tRmin = " << cms::convert2mm(pgonRmin[i])
395  << "\tRmax = " << cms::convert2mm(pgonRmax[i]);
396 #endif
397  dd4hep::Material matter = ns.material(genMaterial);
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, " << cms::convert2mm(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, " << cms::convert2mm(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 = " << cms::convert2mm(pgonZMod[i])
432  << "\tRmin = " << cms::convert2mm(pgonRminMod[i])
433  << "\tRmax = " << cms::convert2mm(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," << -cms::convert2mm(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 = " << cms::convert2mm(pgonZMod[i])
453  << "\tRmin = " << cms::convert2mm(pgonRminMod[i])
454  << "\tRmax = " << cms::convert2mm(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 = " << cms::convert2mm(pgonZBack[i])
494  << "\tRmin = " << cms::convert2mm(pgonRminBack[i])
495  << "\tRmax = " << cms::convert2mm(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  }
Log< level::Info, true > LogVerbatim
std::string idName
float alpha
Definition: AMPTWrapper.h:105
std::string absMat
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
Definition: DDNamespace.cc:202
std::vector< int > eModule
int ii
Definition: cuy.py:589
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:166
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99
dd4hep::Volume Volume
std::string genMaterial
std::string rotation
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 691 of file DDHCalEndcapAlgo.cc.

References alpha, cms::convert2mm(), angle_units::operators::convertRadToDeg(), DDSplit(), first, phase1PixelTopology::getLayer(), mps_fire::i, phase1PixelTopology::layer, phase1PixelTopology::layerName, cms::DDNamespace::material(), mod(), mergeVDriftHistosByStation::name, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, makeMuonMisalignmentScenario::rot, slope, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), and theta().

691  {
692 #ifdef EDM_ML_DEBUG
693  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: \t\tInside module ..." << mod;
694 #endif
695 
697  //Pointers to the Rotation Matrices and to the Materials
698  dd4hep::Rotation3D rot = getRotation(rotmat, ns);
699  dd4hep::Material matter = ns.material(genMaterial);
700  dd4hep::Material matplastic = ns.material(plastMat);
701 
702  double alpha = (1._pi) / nsectors;
703  double zi = zminBlock[mod];
704 
705  for (int i = 0; i < layerN[mod]; i++) {
707  dd4hep::Solid solid;
708  dd4hep::Volume glog, plog;
709  int layer = getLayer(mod, i);
710  double zo = zi + 0.5 * dzStep;
711 
712  for (int iphi = 0; iphi < phiSections; iphi++) {
713  double ziAir = zo - thick[mod];
714  double rinF, rinB;
715  if (layer == 1) {
716  rinF = ziAir * tan(angTop);
717  rinB = zo * tan(angTop);
718  } else {
719  rinF = ziAir * tan(angBot);
720  rinB = zo * tan(angBot);
721  }
722  double routF = (ziAir - z1Beam) * slope;
723  double routB = (zo - z1Beam) * slope;
724  if (routF > routBlock2[mod])
725  routF = routBlock2[mod];
726  if (routB > routBlock2[mod])
727  routB = routBlock2[mod];
728 
729 #ifdef EDM_ML_DEBUG
730  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Layer " << i << " Phi " << iphi << " Front "
731  << cms::convert2mm(ziAir) << ", " << cms::convert2mm(rinF) << ", "
732  << cms::convert2mm(routF) << " Back " << cms::convert2mm(zo) << ", "
733  << cms::convert2mm(rinB) << ", " << cms::convert2mm(routB);
734 #endif
735 
736  double yh1, bl1, tl1, yh2, bl2, tl2, theta, phi, alp;
737  double xpos, ypos, zpos;
739  iphi, rinF, routF, rinB, routB, ziAir, zo, yh1, bl1, tl1, yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
740 
741  name = DDSplit(module.name()).first + layerName[layer] + phiName[iphi] + "Air";
742  solid = dd4hep::Trap(ns.prepend(name), 0.5 * thick[mod], theta, phi, yh1, bl1, tl1, alp, yh2, bl2, tl2, alp);
743 #ifdef EDM_ML_DEBUG
744  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << matter.name()
745  << " of dimensions " << cms::convert2mm(0.5 * thick[mod]) << ", "
746  << convertRadToDeg(theta) << ", " << convertRadToDeg(phi) << ", "
747  << cms::convert2mm(yh1) << ", " << cms::convert2mm(bl1) << ", "
748  << cms::convert2mm(tl1) << ", " << convertRadToDeg(alp) << ", "
749  << cms::convert2mm(yh2) << ", " << cms::convert2mm(bl2) << ", "
750  << cms::convert2mm(tl2) << ", " << convertRadToDeg(alp);
751 #endif
752 
753  glog = dd4hep::Volume(solid.name(), solid, matter);
754  dd4hep::Position r1(xpos, ypos, zpos);
755  module.placeVolume(glog, layer + 1, dd4hep::Transform3D(rot, r1));
756 
757 #ifdef EDM_ML_DEBUG
758  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << (layer + 1)
759  << " positioned in " << module.name() << " at (" << cms::convert2mm(xpos) << ", "
760  << cms::convert2mm(ypos) << ", " << cms::convert2mm(zpos)
761  << ") with rotation: " << rot;
762 #endif
763 
764  //Now the plastic with scintillators
765  double yh = 0.5 * (routF - rinB) - getTrim(mod, iphi);
766  double bl = 0.5 * rinB * tan(alpha) - getTrim(mod, iphi);
767  double tl = 0.5 * routF * tan(alpha) - getTrim(mod, iphi);
768  name = DDSplit(module.name()).first + layerName[layer] + phiName[iphi];
769  solid = dd4hep::Trap(ns.prepend(name), 0.5 * layerT[layer], 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
770 #ifdef EDM_ML_DEBUG
771  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << plastMat
772  << " of dimensions " << cms::convert2mm(0.5 * layerT[layer]) << ", 0, 0, "
773  << cms::convert2mm(yh) << ", " << cms::convert2mm(bl) << ", "
774  << cms::convert2mm(tl) << ", " << convertRadToDeg(alp) << ", "
775  << cms::convert2mm(yh) << ", " << cms::convert2mm(bl) << ", "
776  << cms::convert2mm(tl) << ", " << convertRadToDeg(alp);
777 #endif
778 
779  plog = dd4hep::Volume(solid.name(), solid, matplastic);
780  ypos = 0.5 * (routF + rinB) - xpos;
781  glog.placeVolume(plog, idOffset + layer + 1, dd4hep::Position(0., ypos, 0.));
782 
783 #ifdef EDM_ML_DEBUG
784  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << plog.name() << " number " << (idOffset + layer + 1)
785  << " positioned in " << glog.name() << " at (0, " << cms::convert2mm(ypos)
786  << ", 0) with no rotation";
787 #endif
788 
789  //Constructing the scintillators inside
790  int copyNo = layer * 10 + layerType[layer];
791  name = modName[mod] + layerName[layer] + phiName[iphi];
792  constructScintLayer(ns, plog, scintT[layer], yh, bl, tl, alp, name, copyNo);
793  zo += 0.5 * dzStep;
794  } // End of loop over phi indices
795  zi = zo - 0.5 * dzStep;
796  } // End of loop on layers
797  }
Log< level::Info, true > LogVerbatim
std::vector< double > scintT
float alpha
Definition: AMPTWrapper.h:105
std::vector< double > layerT
std::string rotmat
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
Geom::Theta< T > theta() const
std::vector< double > zminBlock
double getTrim(unsigned int i, unsigned int j) const
constexpr std::array< uint8_t, layerIndexSize > layer
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:166
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99
std::vector< int > layerType
dd4hep::Volume Volume
std::vector< int > layerN
std::string genMaterial
std::vector< std::string > phiName
std::vector< double > routBlock2
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
void constructScintLayer(cms::DDNamespace &ns, dd4hep::Volume &detector, double dz, double yh, double bl, double tl, double alp, const std::string &nm, int id)
tuple module
Definition: callgraph.py:69
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 cms::convert2mm(), angle_units::operators::convertRadToDeg(), DDSplit(), fact, first, phase1PixelTopology::getLayer(), phase1PixelTopology::layer, phase1PixelTopology::layerName, cms::DDNamespace::material(), mod(), mergeVDriftHistosByStation::name, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, diffTwoXMLs::r2, makeMuonMisalignmentScenario::rot, slope, 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 " << cms::convert2mm(0.5 * layerT[layer]) << ", 0, 0, "
603  << cms::convert2mm(yh) << ", " << cms::convert2mm(bl) << ", " << cms::convert2mm(tl)
604  << ", " << convertRadToDeg(alp) << ", " << cms::convert2mm(yh) << ", "
605  << cms::convert2mm(bl) << ", " << cms::convert2mm(tl) << ", "
606  << convertRadToDeg(alp);
607 #endif
608 
609  glog = dd4hep::Volume(solid.name(), solid, matplastic);
610 
611  dd4hep::Position r1(xpos, ypos, zpos);
612  module.placeVolume(glog, idOffset + layer + 1, dd4hep::Transform3D(rot, r1));
613 
614 #ifdef EDM_ML_DEBUG
615  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << (idOffset + layer + 1)
616  << " positioned in " << module.name() << " at (" << cms::convert2mm(xpos) << ", "
617  << cms::convert2mm(ypos) << ", " << cms::convert2mm(zpos)
618  << " with rotation: " << rot;
619 #endif
620 
621  //Now construct the layer of scintillator inside this
622  int copyNo = layer0 * 10 + layerType[layer];
623  name = modName[mod] + layerName[layer] + phiName[iphi];
624  constructScintLayer(ns, glog, scintT[layer], yh, bl, tl, alp, name, copyNo);
625  }
626 
627  //Now the absorber layer
628  double zi = zminBlock[mod] + layerT[layer];
629  double zo = zi + 0.5 * dzStep;
630  double rinF, routF, rinB, routB;
631  if (mod == 0) {
632  rinF = zi * tan(angTop);
633  routF = (zi - z1Beam) * slope;
634  rinB = zo * tan(angTop);
635  routB = (zo - z1Beam) * slope;
636  } else {
637  rinF = zi * tan(angBot);
638  routF = zi * tan(angTop);
639  rinB = zo * tan(angBot);
640  routB = zo * tan(angTop);
641  }
642 
643 #ifdef EDM_ML_DEBUG
644  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Module " << mod << " Front " << cms::convert2mm(zi) << ", "
645  << cms::convert2mm(rinF) << ", " << cms::convert2mm(routF) << " Back "
646  << cms::convert2mm(zo) << ", " << cms::convert2mm(rinB) << ", "
647  << cms::convert2mm(routB);
648 #endif
649 
650  double yh1, bl1, tl1, yh2, bl2, tl2, theta, phi, alp;
652  0, rinF, routF, rinB, routB, zi, zo, yh1, bl1, tl1, yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
653  double fact = tolAbs;
654 
655 #ifdef EDM_ML_DEBUG
656  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: Trim " << cms::convert2mm(fact) << " Param "
657  << cms::convert2mm(yh1) << ", " << cms::convert2mm(bl1) << ", " << cms::convert2mm(tl1)
658  << ", " << cms::convert2mm(yh2) << ", " << cms::convert2mm(bl2) << ", "
659  << cms::convert2mm(tl2);
660 #endif
661 
662  bl1 -= fact;
663  tl1 -= fact;
664  bl2 -= fact;
665  tl2 -= fact;
666 
667  name = DDSplit(module.name()).first + "Absorber";
668  solid = dd4hep::Trap(ns.prepend(name), 0.5 * thick[mod], theta, phi, yh1, bl1, tl1, alp, yh2, bl2, tl2, alp);
669 #ifdef EDM_ML_DEBUG
670  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << absMat
671  << " of dimensions " << cms::convert2mm(0.5 * thick[mod]) << ", "
672  << convertRadToDeg(theta) << ", " << convertRadToDeg(phi) << ", "
673  << cms::convert2mm(yh1) << ", " << cms::convert2mm(bl1) << ", " << cms::convert2mm(tl1)
674  << ", " << convertRadToDeg(alp) << ", " << cms::convert2mm(yh2) << ", "
675  << cms::convert2mm(bl2) << ", " << cms::convert2mm(tl2) << ", "
676  << convertRadToDeg(alp);
677 #endif
678 
679  glog = dd4hep::Volume(solid.name(), solid, matabsorbr);
680 
681  dd4hep::Position r2(xpos, ypos, zpos);
682  module.placeVolume(glog, 1, dd4hep::Transform3D(rot, r2));
683 
684 #ifdef EDM_ML_DEBUG
685  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number 1 positioned in " << module.name()
686  << " at (" << cms::convert2mm(xpos) << ", " << cms::convert2mm(ypos) << ", "
687  << cms::convert2mm(zpos) << ") with rotation: " << rot;
688 #endif
689  }
Log< level::Info, true > LogVerbatim
std::vector< double > scintT
std::vector< double > layerT
std::string rotmat
std::string absMat
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
Geom::Theta< T > theta() const
std::vector< double > zminBlock
constexpr std::array< uint8_t, layerIndexSize > layer
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:166
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99
std::vector< int > layerType
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
void constructScintLayer(cms::DDNamespace &ns, dd4hep::Volume &detector, double dz, double yh, double bl, double tl, double alp, const std::string &nm, int id)
tuple module
Definition: callgraph.py:69
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 alpha, cms::convert2mm(), angle_units::operators::convertRadToDeg(), mps_fire::i, cutBasedElectronHLTPreselecition_Summer16_V1_cff::idName, isotrackApplyRegressor::k, cms::DDNamespace::material(), TrackingSourceConfig_Tier0_Cosmic_cff::modules, mergeVDriftHistosByStation::name, HGCalGeometryMode::Polyhedra, cms::DDNamespace::prepend(), slope, 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 = " << cms::convert2mm(pgonZ[k])
558  << "\tRmin = " << cms::convert2mm(pgonRmin[k])
559  << "\tRmax = " << cms::convert2mm(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)
567  << " positioned in " << 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  }
Log< level::Info, true > LogVerbatim
std::vector< double > rinBlock2
std::string idName
float alpha
Definition: AMPTWrapper.h:105
void constructInsideModule0(cms::DDNamespace &ns, dd4hep::Volume &module, int mod)
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
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:166
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99
dd4hep::Volume Volume
std::vector< double > routBlock2
std::vector< std::string > modName
std::vector< int > modType
std::vector< int > sectionModule
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 799 of file DDHCalEndcapAlgo.cc.

References cms::convert2mm(), angle_units::operators::convertRadToDeg(), PVValHelper::dz, cutBasedElectronHLTPreselecition_Summer16_V1_cff::idName, cms::DDNamespace::material(), mergeVDriftHistosByStation::name, cms::DDNamespace::prepend(), and AlCaHLTBitMon_QueryRunRegistry::string.

807  {
808  dd4hep::Material matter = ns.material(scintMat);
809  std::string name = idName + "Scintillator" + nm;
810 
811  dd4hep::Solid solid = dd4hep::Trap(ns.prepend(name), 0.5 * dz, 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
812 #ifdef EDM_ML_DEBUG
813  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << solid.name() << " Trap made of " << scintMat
814  << " of dimensions " << cms::convert2mm(0.5 * dz) << ", 0, 0, " << cms::convert2mm(yh)
815  << ", " << cms::convert2mm(bl) << ", " << cms::convert2mm(tl) << ", "
816  << convertRadToDeg(alp) << ", " << cms::convert2mm(yh) << ", " << cms::convert2mm(bl)
817  << ", " << cms::convert2mm(tl) << ", " << convertRadToDeg(alp);
818 #endif
819 
820  dd4hep::Volume glog(solid.name(), solid, matter);
821  detector.placeVolume(glog, id);
822 #ifdef EDM_ML_DEBUG
823  edm::LogVerbatim("HCalGeom") << "DDHCalEndcapAlgo: " << glog.name() << " number " << id << " positioned in "
824  << detector.name() << " at (0,0,0) with no rotation";
825 #endif
826  }
Log< level::Info, true > LogVerbatim
std::string idName
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
std::string scintMat
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:166
std::string prepend(const std::string &) const
Definition: DDNamespace.cc:99
dd4hep::Volume Volume
int HCalEndcapAlgo::getLayer ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 828 of file DDHCalEndcapAlgo.cc.

References dqmiolumiharvest::j.

828  {
829  switch (i) {
830  case 0:
831  return layerN0[j];
832  break;
833  case 1:
834  return layerN1[j];
835  break;
836  case 2:
837  return layerN2[j];
838  break;
839  case 3:
840  return layerN3[j];
841  break;
842  case 4:
843  return layerN4[j];
844  break;
845  case 5:
846  return layerN5[j];
847  break;
848  default:
849  return 0;
850  }
851  }
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 981 of file DDHCalEndcapAlgo.cc.

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

981  {
982  std::string rot = (strchr(rotation.c_str(), NAMESPACE_SEP) == nullptr) ? ("rotations:" + rotation) : rotation;
983 #ifdef EDM_ML_DEBUG
984  edm::LogVerbatim("HCalGeom") << "getRotation: " << rotation << ":" << rot << ":" << ns.rotation(rot);
985 #endif
986  return ns.rotation(rot);
987  }
Log< level::Info, true > LogVerbatim
std::string rotation
const dd4hep::Rotation3D & rotation(const std::string &name) const
Definition: DDNamespace.cc:182
#define NAMESPACE_SEP
Definition: DDNamespace.h:92
double HCalEndcapAlgo::getTrim ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 853 of file DDHCalEndcapAlgo.cc.

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

853  {
854  if (j == 0)
855  return trimLeft[i];
856  else
857  return trimRight[j];
858  }
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 918 of file DDHCalEndcapAlgo.cc.

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

936  {
937  //Given rin, rout compute parameters of the trapezoid and
938  //position of the trapezoid for a standrd layer
939  double alpha = (1._pi) / nsectors;
940 
941 #ifdef EDM_ML_DEBUG
942  edm::LogVerbatim("HCalGeom") << "Input " << iphi << " Front " << cms::convert2mm(rinF) << " "
943  << cms::convert2mm(routF) << " " << cms::convert2mm(zi) << " Back "
944  << cms::convert2mm(rinB) << " " << cms::convert2mm(routB) << " " << cms::convert2mm(zo)
945  << " Alpha " << convertRadToDeg(alpha);
946 #endif
947 
948  yh1 = 0.5 * (routF - rinB);
949  bl1 = 0.5 * rinB * tan(alpha);
950  tl1 = 0.5 * routF * tan(alpha);
951  yh2 = 0.5 * (routF - rinB);
952  bl2 = 0.5 * rinB * tan(alpha);
953  tl2 = 0.5 * routF * tan(alpha);
954  double dx = 0.25 * (bl2 + tl2 - bl1 - tl1);
955  double dy = 0.5 * (rinB + routF - rinB - routF);
956  xpos = 0.25 * (rinB + routF + rinB + routF);
957  ypos = 0.25 * (bl2 + tl2 + bl1 + tl1);
958  zpos = 0.5 * (zi + zo);
959  alp = atan(0.5 * tan(alpha));
960  // ypos-= tolPos;
961  if (iphi == 0) {
962  ypos = -ypos;
963  } else {
964  alp = -alp;
965  dx = -dx;
966  }
967  double r = sqrt(dx * dx + dy * dy);
968  theta = atan(r / (zo - zi));
969  phi = atan2(dy, dx);
970 
971 #ifdef EDM_ML_DEBUG
972  edm::LogVerbatim("HCalGeom") << "Output Dimensions " << cms::convert2mm(yh1) << " " << cms::convert2mm(bl1) << " "
973  << cms::convert2mm(tl1) << " " << cms::convert2mm(yh2) << " " << cms::convert2mm(bl2)
974  << " " << cms::convert2mm(tl2) << " " << convertRadToDeg(alp) << " "
975  << convertRadToDeg(theta) << " " << convertRadToDeg(phi) << " Position "
976  << cms::convert2mm(xpos) << " " << cms::convert2mm(ypos) << " "
977  << cms::convert2mm(zpos);
978 #endif
979  }
Log< level::Info, true > LogVerbatim
float alpha
Definition: AMPTWrapper.h:105
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
Geom::Theta< T > theta() const
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
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 860 of file DDHCalEndcapAlgo.cc.

References alpha, cms::convert2mm(), angle_units::operators::convertRadToDeg(), phase1PixelTopology::layer, mod(), slope, and funct::tan().

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

Member Data Documentation

std::string HCalEndcapAlgo::absMat

Definition at line 55 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::angBot

Definition at line 52 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::angGap

Definition at line 53 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::angTop

Definition at line 51 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::drEnd

Definition at line 50 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::dzShift

Definition at line 43 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::dzStep

Definition at line 42 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::eModule

Definition at line 28 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::genMaterial

Definition at line 24 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::heboxDepth

Definition at line 49 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::idName

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 61 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN0

Definition at line 62 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN1

Definition at line 63 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN2

Definition at line 64 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN3

Definition at line 65 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN4

Definition at line 66 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerN5

Definition at line 67 of file DDHCalEndcapAlgo.cc.

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

Definition at line 80 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::layers

Definition at line 79 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::layerT

Definition at line 82 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::layerType

Definition at line 81 of file DDHCalEndcapAlgo.cc.

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

Definition at line 58 of file DDHCalEndcapAlgo.cc.

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

Definition at line 57 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::modType

Definition at line 59 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::modules

Definition at line 56 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::nEndcap

Definition at line 27 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::nsectors

Definition at line 25 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::nsectortot

Definition at line 26 of file DDHCalEndcapAlgo.cc.

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

Definition at line 78 of file DDHCalEndcapAlgo.cc.

int HCalEndcapAlgo::phiSections

Definition at line 77 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::plastMat

Definition at line 84 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::riDip

Definition at line 47 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::riKink

Definition at line 46 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::rinBlock1

Definition at line 73 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::rinBlock2

Definition at line 75 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::roDip

Definition at line 48 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::rotation

Definition at line 30 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::rotHalf

Definition at line 29 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::rotmat

Definition at line 86 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::rout

Definition at line 45 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::routBlock1

Definition at line 74 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::routBlock2

Definition at line 76 of file DDHCalEndcapAlgo.cc.

std::string HCalEndcapAlgo::scintMat

Definition at line 85 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::scintT

Definition at line 83 of file DDHCalEndcapAlgo.cc.

std::vector<int> HCalEndcapAlgo::sectionModule

Definition at line 60 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::slope

Definition at line 54 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::thick

Definition at line 68 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 69 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::trimRight

Definition at line 70 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::z0Beam

Definition at line 39 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::z1Beam

Definition at line 40 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::zEnd

Definition at line 33 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::zFront

Definition at line 32 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziBody

Definition at line 36 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziDip

Definition at line 41 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziKink

Definition at line 38 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziL0Body

Definition at line 37 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziL0Nose

Definition at line 35 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::ziNose

Definition at line 34 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::zmaxBlock

Definition at line 72 of file DDHCalEndcapAlgo.cc.

std::vector<double> HCalEndcapAlgo::zminBlock

Definition at line 71 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::zShift

Definition at line 31 of file DDHCalEndcapAlgo.cc.

double HCalEndcapAlgo::zShiftHac2

Definition at line 44 of file DDHCalEndcapAlgo.cc.