CMS 3D CMS Logo

Functions
DDHGCalNoTaperEndcap.cc File Reference
#include "DataFormats/Math/interface/GeantUnits.h"
#include "DD4hep/DetFactoryHelper.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.h"

Go to the source code of this file.

Functions

static long algorithm (dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_hgcal_DDHGCalNoTaperEndcap)
 

Function Documentation

◆ algorithm()

static long algorithm ( dd4hep::Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e 
)
static

Definition at line 10 of file DDHGCalNoTaperEndcap.cc.

10  {
11  cms::DDNamespace ns(ctxt, e, true);
13  std::string motherName = args.parentName();
14 
15  auto const& m_tiltAngle = args.value<double>("tiltAngle"); // Tilt angle
16  auto const& m_rMin = args.value<double>("rMin"); // Inner radius
17  auto const& m_rMax = args.value<double>("rMax"); // Outer radius
18  auto const& m_zoffset = args.value<double>("zoffset"); // Offset in z
19  auto const& m_xyoffset = args.value<double>("xyoffset"); // Offset in x or y
20  auto const& m_startCopyNo = args.value<int>("startCopyNo"); // Start copy Number
21  auto const& m_incrCopyNo = args.value<int>("incrCopyNo"); // Increment copy Number
22  auto const& m_childName = args.value<std::string>("ChildName"); // Children name
23 #ifdef EDM_ML_DEBUG
24  edm::LogVerbatim("HGCalGeom") << "Tilt Angle " << m_tiltAngle << " R " << m_rMin << ":" << m_rMax << " Offset "
25  << m_zoffset << ":" << m_xyoffset << " Copy " << m_startCopyNo << ":" << m_incrCopyNo
26  << " Child " << m_childName;
27 
28  edm::LogVerbatim("HGCalGeom") << "DDHGCalNoTaperEndcap: NameSpace " << ns.name() << "\tParent " << args.parentName();
29 #endif
30 
31  dd4hep::Volume parent = ns.volume(args.parentName());
32  std::string name = ns.prepend(m_childName);
33 
34  const int ix[4] = {1, -1, -1, 1};
35  const int iy[4] = {1, 1, -1, -1};
36  int copyNo = m_startCopyNo;
37  for (int i = 0; i < 4; ++i) {
38  int xQuadrant = ix[i];
39  int yQuadrant = iy[i];
40 #ifdef EDM_ML_DEBUG
41  edm::LogVerbatim("HGCalGeom") << "Create quarter " << xQuadrant << ":" << yQuadrant;
42 #endif
43  double tiltAngle = m_tiltAngle;
44  double xphi = xQuadrant * tiltAngle;
45  double yphi = yQuadrant * tiltAngle;
46  double theta = 90._deg;
47  double phiX = 0.0;
48  double phiY = theta;
49  double phiZ = 3 * theta;
50  double offsetZ = m_zoffset;
51  double offsetXY = m_xyoffset;
52  double offsetX = xQuadrant * 0.5 * offsetXY;
53  double offsetY = yQuadrant * 0.5 * offsetXY;
54 
55 #ifdef EDM_ML_DEBUG
56  int rowmax(0), column(0);
57 #endif
58  while (std::abs(offsetX) < m_rMax) {
59 #ifdef EDM_ML_DEBUG
60  column++;
61  int row(0);
62 #endif
63  while (std::abs(offsetY) < m_rMax) {
64 #ifdef EDM_ML_DEBUG
65  row++;
66 #endif
67  double limit1 = sqrt((offsetX + 0.5 * xQuadrant * offsetXY) * (offsetX + 0.5 * xQuadrant * offsetXY) +
68  (offsetY + 0.5 * yQuadrant * offsetXY) * (offsetY + 0.5 * yQuadrant * offsetXY));
69  double limit2 = sqrt((offsetX - 0.5 * xQuadrant * offsetXY) * (offsetX - 0.5 * xQuadrant * offsetXY) +
70  (offsetY - 0.5 * yQuadrant * offsetXY) * (offsetY - 0.5 * yQuadrant * offsetXY));
71  // Make sure we do not add supermodules in rMin area
72  if (limit2 > m_rMin && limit1 < m_rMax) {
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << m_childName << " copyNo = " << copyNo << " (" << column << "," << row
75  << "): offsetX,Y = " << offsetX << "," << offsetY << " limit=" << limit1 << ":"
76  << limit2 << " rMin, rMax = " << m_rMin << "," << m_rMax;
77 #endif
78 
79  dd4hep::Rotation3D rotation = (cms::makeRotation3D(theta, phiX, theta + yphi, phiY, -yphi, phiZ) *
80  cms::makeRotation3D(theta + xphi, phiX, 90._deg, 90._deg, xphi, 0.0));
81 
82  dd4hep::Position tran(offsetX, offsetY, offsetZ);
83 #ifdef EDM_ML_DEBUG
84  edm::LogVerbatim("HGCalGeom") << "Module " << copyNo << ": location = " << tran << " Rotation " << rotation;
85 #endif
86  parent.placeVolume(ns.volume(name), copyNo, dd4hep::Transform3D(rotation, tran));
87 
88  copyNo += m_incrCopyNo;
89  } else {
90 #ifdef EDM_ML_DEBUG
91  edm::LogVerbatim("HGCalGeom") << " (" << column << "," << row << "): offsetX,Y = " << offsetX << ","
92  << offsetY << " is out of limit=" << limit1 << ":" << limit2
93  << " rMin, rMax = " << m_rMin << "," << m_rMax;
94 #endif
95  }
96  yphi += yQuadrant * 2. * tiltAngle;
97  offsetY += yQuadrant * offsetXY;
98  }
99 #ifdef EDM_ML_DEBUG
100  if (row > rowmax)
101  rowmax = row;
102 #endif
103  xphi += xQuadrant * 2. * tiltAngle;
104  yphi = yQuadrant * tiltAngle;
105  offsetY = yQuadrant * 0.5 * offsetXY;
106  offsetX += xQuadrant * offsetXY;
107  }
108 #ifdef EDM_ML_DEBUG
109  edm::LogVerbatim("HGCalGeom") << rowmax << " rows and " << column << " columns in quadrant " << xQuadrant << ":"
110  << yQuadrant;
111 #endif
112  }
113 
114  return cms::s_executed;
115 }

References funct::abs(), writedatasetfile::args, MillePedeFileConverter_cfg::e, mps_fire::i, cms::makeRotation3D(), Skims_PA_cff::name, cms::DDNamespace::name(), class-composition::parent, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), idealTransformation::rotation, cms::s_executed, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, theta(), and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hgcal_DDHGCalNoTaperEndcap   
)

Definition at line 118 of file DDHGCalNoTaperEndcap.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
cms::DDNamespace
Definition: DDNamespace.h:16
cms::makeRotation3D
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
Definition: DDAlgoArguments.cc:20
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
class-composition.parent
parent
Definition: class-composition.py:88
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37