CMS 3D CMS Logo

Functions
DDGEMAngular.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DataFormats/Math/interface/angle_units.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "DetectorDescription/DDCMS/interface/DDutils.h"
#include "FWCore/MessageLogger/interface/MessageLogger.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_muon_DDGEMAngular)
 

Function Documentation

◆ algorithm()

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

Definition at line 11 of file DDGEMAngular.cc.

References writedatasetfile::args, cms::convert2mm(), angle_units::operators::convertRadToDeg(), funct::cos(), MillePedeFileConverter_cfg::e, cuy::ii, l1tstage2_dqm_sourceclient-live_cfg::invert, cms::makeRotation3D(), dqmiodumpmetadata::n, cms::DDNamespace::name(), class-composition::parent, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), idealTransformation::rotation, cms::s_executed, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::DDNamespace::volume().

11  {
12  cms::DDNamespace ns(ctxt, e, true);
14 
15  // Header section of original DDGEMAngular.h
16  float startAngle = args.value<float>("startAngle");
17  float stepAngle = args.value<float>("stepAngle");
18  int invert = args.value<int>("invert");
19  double rPos = args.value<double>("rPosition");
20  double zoffset = args.value<double>("zoffset");
21  int n = args.value<int>("n");
22  int startCopyNo = args.value<int>("startCopyNo");
23  int incrCopyNo = args.value<int>("incrCopyNo");
24 #ifdef EDM_ML_DEBUG
25  edm::LogVerbatim("MuonGeom") << "DDGEMAngular: Parameters for positioning-- " << n << " copies in steps of "
26  << convertRadToDeg(stepAngle) << " from " << convertRadToDeg(startAngle)
27  << " (inversion flag " << invert << ") \trPos " << cms::convert2mm(rPos) << " Zoffest "
28  << cms::convert2mm(zoffset) << "\tStart and inremental "
29  << "copy nos " << startCopyNo << ", " << incrCopyNo;
30 #endif
31  std::string childName = args.value<std::string>("ChildName");
32  childName = ns.prepend(childName);
33  std::string parentName = args.parentName();
34  parentName = ns.prepend(parentName);
35  dd4hep::Volume parent = ns.volume(parentName);
36  dd4hep::Volume child = ns.volume(childName);
37 #ifdef EDM_ML_DEBUG
38  edm::LogVerbatim("MuonGeom") << "DDGEMAngular: Parent " << parentName << "\tChild " << child.name() << "\tNameSpace "
39  << ns.name();
40 #endif
41 
42  // Now position child in mother *n* times
43  double phi = startAngle;
44  int copyNo = startCopyNo;
45  double thetax = 90.0_deg;
46  double thetay = invert == 0 ? 0.0 : 180.0_deg;
47  for (int ii = 0; ii < n; ii++) {
48  double phiz = phi;
49  if (phiz >= 2._pi)
50  phiz -= 2._pi;
51  double phix = invert == 0 ? (90.0_deg + phiz) : (-90.0_deg + phiz);
52 #ifdef EDM_ML_DEBUG
53  edm::LogVerbatim("MuonGeom") << "DDGEMAngular: Creating a rotation " << convertRadToDeg(thetax) << ", "
54  << convertRadToDeg(phix) << ", " << convertRadToDeg(thetay) << ", 0, "
55  << convertRadToDeg(thetax) << ", " << convertRadToDeg(phiz);
56 #endif
57  dd4hep::Rotation3D rotation = cms::makeRotation3D(thetax, phix, thetay, 0., thetax, phiz);
58  dd4hep::Position tran(rPos * cos(phiz), rPos * sin(phiz), zoffset);
59  parent.placeVolume(child, copyNo, dd4hep::Transform3D(rotation, tran));
60 #ifdef EDM_ML_DEBUG
61  edm::LogVerbatim("MuonGeom") << "DDGEMAngular: " << child.name() << " number " << copyNo << " positioned in "
62  << parentName << " at (" << cms::convert2mm(rPos * cos(phiz)) << ","
63  << cms::convert2mm(rPos * sin(phiz)) << "," << cms::convert2mm(zoffset) << ") with "
64  << rotation;
65 #endif
66  phi += stepAngle;
67  copyNo += incrCopyNo;
68  }
69  return cms::s_executed;
70 }
Log< level::Info, true > LogVerbatim
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
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
static constexpr long s_executed
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
dd4hep::Volume Volume
ii
Definition: cuy.py:589

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_muon_DDGEMAngular   
)

Definition at line 73 of file DDGEMAngular.cc.