CMS 3D CMS Logo

Functions
DDMuonAngular.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 &context, xml_h element)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_muon_DDMuonAngular)
 

Function Documentation

◆ algorithm()

static long algorithm ( dd4hep::Detector &  ,
cms::DDParsingContext context,
xml_h  element 
)
static

Definition at line 8 of file DDMuonAngular.cc.

8  {
9  cms::DDNamespace ns(context, element, true);
10  cms::DDAlgoArguments args(context, element);
11 
12  int n = args.value<int>("n");
13  int startCopyNo = args.find("startCopyNo") ? args.value<int>("startCopyNo") : 1;
14  int incrCopyNo = args.find("incrCopyNo") ? args.value<int>("incrCopyNo") : 1;
15  float startAngle = args.value<float>("startAngle");
16  float stepAngle = args.value<float>("stepAngle");
17  float zoffset = args.value<float>("zoffset");
18  std::string rotns = args.value<std::string>("RotNameSpace");
19  dd4hep::Volume mother = ns.volume(args.parentName());
20  std::string childName = args.value<std::string>("ChildName");
21  childName = ns.prepend(childName);
22  dd4hep::Volume child = ns.volume(childName);
23 
24  edm::LogVerbatim("MuonGeom") << "debug: Parameters for positioning:: n " << n << " Start, Step "
25  << convertRadToDeg(startAngle) << ", " << convertRadToDeg(stepAngle) << ", zoffset "
26  << zoffset << ", RotNameSpace " << rotns;
27  edm::LogVerbatim("MuonGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace "
28  << ns.name();
29 
30  double phi = startAngle;
31  int copyNo = startCopyNo;
32 
33  for (int i = 0; i < n; ++i) {
34  double phitmp = phi;
35  if (phitmp >= 2._pi)
36  phitmp -= 2._pi;
37  dd4hep::Rotation3D rotation = cms::makeRotation3D(90._deg, phitmp, 90._deg, 90._deg + phitmp, 0., 0.);
38  std::string rotstr = ns.nsName(child.name()) + std::to_string(phitmp * 10.);
39  auto irot = context.rotations.find(ns.prepend(rotstr));
40  if (irot != context.rotations.end()) {
41  rotation = ns.rotation(ns.prepend(rotstr));
42  }
43  dd4hep::Position tran(0., 0., zoffset);
44  mother.placeVolume(child, copyNo, dd4hep::Transform3D(rotation, tran));
45  edm::LogVerbatim("MuonGeom") << "test " << child.name() << " number " << copyNo << " positioned in "
46  << mother.name() << " at " << tran << " with " << rotstr << ": " << rotation;
47  phi += stepAngle;
48  copyNo += incrCopyNo;
49  }
50  return 1;
51 }

References writedatasetfile::args, angle_units::operators::convertRadToDeg(), mps_fire::i, cms::makeRotation3D(), dqmiodumpmetadata::n, cms::DDNamespace::name(), cms::DDNamespace::nsName(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), idealTransformation::rotation, cms::DDNamespace::rotation(), cms::DDParsingContext::rotations, AlCaHLTBitMon_QueryRunRegistry::string, and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_muon_DDMuonAngular   
)

Definition at line 54 of file DDMuonAngular.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
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
cms::DDParsingContext::rotations
std::unordered_map< std::string, dd4hep::Rotation3D > rotations
Definition: DDParsingContext.h:71
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
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
child
Definition: simpleInheritance.h:11