CMS 3D CMS Logo

Functions
DDTrackerAngular.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 (Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDTrackerAngular)
 

Function Documentation

◆ algorithm()

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

Definition at line 11 of file DDTrackerAngular.cc.

11  {
12  cms::DDNamespace ns(ctxt, e, true);
13  DDAlgoArguments args(ctxt, e);
14  // Header section of original DDTrackerAngular.h
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  double rangeAngle = args.value<double>("RangeAngle"); //Range in angle
19  double startAngle = args.value<double>("StartAngle"); //Start anle
20  double radius = args.value<double>("Radius"); //Radius
21  vector<double> center = args.value<vector<double> >("Center"); //Phi values
22  Volume mother = ns.volume(args.parentName());
23  Volume child = ns.volume(args.value<string>("ChildName"));
24 
25  double delta = 0e0; //Increment in phi
26  // Code section of original DDTrackerAngular.cc
27  if (fabs(rangeAngle - 360.0_deg) < 0.001_deg) {
28  delta = rangeAngle / double(n);
29  } else if (n > 1) {
30  delta = rangeAngle / double(n - 1);
31  }
32 
33  edm::LogVerbatim("TrackerGeom") << "DDTrackerAngular debug: Parameters for positioning:: n " << n
34  << " Start, Range, Delta " << convertRadToDeg(startAngle) << " "
35  << convertRadToDeg(rangeAngle) << " " << convertRadToDeg(delta) << " Radius "
36  << radius << " Centre " << center[0] << ", " << center[1] << ", " << center[2];
37  edm::LogVerbatim("TrackerGeom") << "DDTrackerAngular debug: Parent " << mother.name() << "\tChild " << child.name()
38  << " NameSpace " << ns.name();
39 
40  double theta = 90._deg;
41  int copy = startCopyNo;
42  double phi = startAngle;
43  for (int i = 0; i < n; i++) {
44  double phix = phi;
45  double phiy = phix + 90._deg;
46  double phideg = convertRadToDeg(phix);
47 
48  Rotation3D rotation;
49  if (phideg != 0) {
50  string rotstr = ns.nsName(child.name()) + std::to_string(phideg * 10.);
51  auto irot = ctxt.rotations.find(ns.prepend(rotstr));
52  if (irot != ctxt.rotations.end()) {
53  rotation = ns.rotation(ns.prepend(rotstr));
54  } else {
55  edm::LogVerbatim("TrackerGeom") << "DDTrackerAngular Creating a new "
56  << "rotation: " << rotstr << "\t90., " << convertRadToDeg(phix) << ", 90.,"
57  << convertRadToDeg(phiy) << ", 0, 0";
58  RotationZYX rot;
59  rotation = makeRotation3D(theta, phix, theta, phiy, 0., 0.);
60  }
61  }
62 
63  double xpos = radius * cos(phi) + center[0];
64  double ypos = radius * sin(phi) + center[1];
65  double zpos = center[2];
66  Position tran(xpos, ypos, zpos);
67  mother.placeVolume(child, copy, Transform3D(rotation, tran));
68  edm::LogVerbatim("TrackerGeom") << "DDTrackerAngular test " << child.name() << " number " << copy
69  << " positioned in " << mother.name() << " at " << tran << " with " << rotation;
70  copy += incrCopyNo;
71  phi += delta;
72  }
73  return 1;
74 }

References writedatasetfile::args, angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), dumpMFGeometry_cfg::delta, MillePedeFileConverter_cfg::e, mps_fire::i, cms::makeRotation3D(), dqmiodumpmetadata::n, cms::DDNamespace::name(), cms::DDNamespace::nsName(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), CosmicsPD_Skims::radius, makeMuonMisalignmentScenario::rot, idealTransformation::rotation, cms::DDNamespace::rotation(), cms::DDParsingContext::rotations, funct::sin(), theta(), and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTrackerAngular   
)

Definition at line 77 of file DDTrackerAngular.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
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
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
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
PVValHelper::phi
Definition: PVValidationHelpers.h:69
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
child
Definition: simpleInheritance.h:11
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37