CMS 3D CMS Logo

Functions
DDMuonAngular.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 &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 11 of file DDMuonAngular.cc.

References writedatasetfile::args, visDQMUpload::context, cms::convert2mm(), 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::s_executed, AlCaHLTBitMon_QueryRunRegistry::string, to_string(), and cms::DDNamespace::volume().

11  {
12  cms::DDNamespace ns(context, element, true);
14 
15  int n = args.value<int>("n");
16  int startCopyNo = args.find("startCopyNo") ? args.value<int>("startCopyNo") : 1;
17  int incrCopyNo = args.find("incrCopyNo") ? args.value<int>("incrCopyNo") : 1;
18  float startAngle = args.value<float>("startAngle");
19  float stepAngle = args.value<float>("stepAngle");
20  float zoffset = args.value<float>("zoffset");
21  std::string rotns = args.value<std::string>("RotNameSpace");
22  dd4hep::Volume mother = ns.volume(args.parentName());
23  std::string childName = args.value<std::string>("ChildName");
24  childName = ns.prepend(childName);
25  dd4hep::Volume child = ns.volume(childName);
26 
27 #ifdef EDM_ML_DEBUG
28  edm::LogVerbatim("MuonGeom") << "DDMuonAngular: Parameters for positioning:: n " << n << " Start, Step "
29  << convertRadToDeg(startAngle) << ", " << convertRadToDeg(stepAngle) << ", zoffset "
30  << cms::convert2mm(zoffset) << ", RotNameSpace " << rotns;
31  edm::LogVerbatim("MuonGeom") << "DDMuonAngular: Parent " << mother.name() << "\tChild " << child.name()
32  << " NameSpace " << ns.name();
33 #endif
34  double phi = startAngle;
35  int copyNo = startCopyNo;
36 
37  for (int i = 0; i < n; ++i) {
38  double phitmp = phi;
39  if (phitmp >= 2._pi)
40  phitmp -= 2._pi;
41  dd4hep::Rotation3D rotation = cms::makeRotation3D(90._deg, phitmp, 90._deg, 90._deg + phitmp, 0., 0.);
42  std::string rotstr = ns.nsName(child.name()) + std::to_string(phitmp * 10.);
43  auto irot = context.rotations.find(ns.prepend(rotstr));
44  if (irot != context.rotations.end()) {
45  rotation = ns.rotation(ns.prepend(rotstr));
46  }
47  dd4hep::Position tran(0., 0., zoffset);
48  mother.placeVolume(child, copyNo, dd4hep::Transform3D(rotation, tran));
49 #ifdef EDM_ML_DEBUG
50  edm::LogVerbatim("MuonGeom") << "DDMuonAngular:" << child.name() << " number " << copyNo << " positioned in "
51  << mother.name() << " at (0,0," << cms::convert2mm(zoffset) << ") with " << rotstr
52  << ": " << rotation;
53 #endif
54  phi += stepAngle;
55  copyNo += incrCopyNo;
56  }
57  return cms::s_executed;
58 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
static std::string to_string(const XMLCh *ch)
static constexpr long s_executed
dd4hep::Volume Volume

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_muon_DDMuonAngular   
)

Definition at line 61 of file DDMuonAngular.cc.