CMS 3D CMS Logo

Functions
DDGEMAngular.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.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 10 of file DDGEMAngular.cc.

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

References writedatasetfile::args, 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, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_muon_DDGEMAngular   
)

Definition at line 70 of file DDGEMAngular.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
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
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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
PVValHelper::phi
Definition: PVValidationHelpers.h:68
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
l1tstage2_dqm_sourceclient-live_cfg.invert
invert
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:85
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
child
Definition: simpleInheritance.h:11
class-composition.parent
parent
Definition: class-composition.py:88
cuy.ii
ii
Definition: cuy.py:590
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37