CMS 3D CMS Logo

Functions
DDPixPhase1FwdDiskAlgo.cc File Reference
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Printout.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include <sstream>

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_track_DDPixPhase1FwdDiskAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 16 of file DDPixPhase1FwdDiskAlgo.cc.

References writedatasetfile::args, angle_units::operators::convertRadToDeg(), funct::cos(), SiPixelRawToDigiRegional_cfi::deltaPhi, MillePedeFileConverter_cfg::e, cms::makeRotation3D(), cms::DDNamespace::name(), PixelTestBeamValidation_cfi::Position, MetAnalyzer::pv(), makeMuonMisalignmentScenario::rot, cms::rotation_utils::rotName(), cms::s_executed, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::DDNamespace::volume().

16  {
17  cms::DDNamespace ns(ctxt, e, true);
19 
20  int nBlades; //Number of blades
21  int startCopyNo; //Start Copy number
22  double bladeAngle; //Angle of blade rotation aroung y-axis
23  double bladeTilt; //Tilt of the blade around x-axis
24  double zPlane; //Common shift in z for all blades
25  std::vector<double> bladeZShift; //Shift in Z of individual blades
26  double anchorR; //Distance of beam line to anchor point
27 
28  std::string childName; //Child name
29  std::string rotName; //Name of the base rotation matrix
30  std::string flagString; //Flag if a blade is present
31 
32  dd4hep::Volume mother = ns.volume(args.parentName());
34 
35  startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 0;
36  nBlades = args.value<int>("NumberOfBlades");
37  bladeAngle = args.value<double>("BladeAngle");
38 
39  bladeTilt = -1. * args.value<double>("BladeTilt");
40  zPlane = args.value<double>("BladeCommonZ");
41  anchorR = args.value<double>("AnchorRadius");
42 
43  bladeZShift = args.value<std::vector<double> >("BladeZShift");
44 
45  childName = args.value<std::string>("ChildName");
46  rotName = args.value<std::string>("RotationName");
47  flagString = args.value<std::string>("FlagString");
48 
49  dd4hep::Volume child = ns.volume(childName);
50 
51  edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo debug: Parent " << mother.name() << "\tChild " << child.name()
52  << " NameSpace " << ns.name() << "\tRot Name " << rotName << "\tCopyNo (Start/Total) "
53  << startCopyNo << ", " << nBlades << "\tAngles " << convertRadToDeg(bladeAngle) << ", "
54  << convertRadToDeg(bladeTilt) << "\tZshifts " << zPlane << "\tAnchor Radius "
55  << anchorR;
56 
57  for (int iBlade = 0; iBlade < nBlades; ++iBlade) {
58  edm::LogVerbatim("PixelGeom") << "DDPixFwdDiskAlgo: Blade " << iBlade << " flag " << flagString[iBlade]
59  << " zshift " << bladeZShift[iBlade];
60  }
61 
62  double deltaPhi = 360.0_deg / (double)nBlades;
63  int copyNo = startCopyNo;
64  std::string flagSelector = "Y";
65 
66  for (int iBlade = 0; iBlade < nBlades; ++iBlade) {
67  if (flagString[iBlade] == flagSelector[0]) {
68  double phi = (iBlade + 0.5) * deltaPhi;
69  double phiy = atan2(cos(phi), -sin(phi));
70  double thety = acos(sin(bladeTilt));
71  double phix = atan2(cos(bladeAngle) * sin(phi) + cos(phi) * sin(bladeTilt) * sin(bladeAngle),
72  cos(phi) * cos(bladeAngle) - sin(phi) * sin(bladeTilt) * sin(bladeAngle));
73  double thetx = acos(-cos(bladeTilt) * sin(bladeAngle));
74  double phiz = atan2(sin(phi) * sin(bladeAngle) - cos(phi) * cos(bladeAngle) * sin(bladeTilt),
75  cos(phi) * sin(bladeAngle) + cos(bladeAngle) * sin(phi) * sin(bladeTilt));
76  double thetz = acos(cos(bladeTilt) * cos(bladeAngle));
77 
78  dd4hep::Rotation3D rot = cms::makeRotation3D(thetx, phix, thety, phiy, thetz, phiz);
79 
80  double xpos = -anchorR * sin(phi);
81  double ypos = anchorR * cos(phi);
82  double zpos = zPlane + bladeZShift[iBlade % nBlades];
83 
84  dd4hep::Position tran(xpos, ypos, zpos);
85  pv = mother.placeVolume(child, copyNo, dd4hep::Transform3D(rot, tran));
86  }
87  copyNo++;
88  }
89  return cms::s_executed;
90 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
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 const std::string & rotName(const T &rot, const cms::DDParsingContext &context)
static constexpr long s_executed
dd4hep::PlacedVolume PlacedVolume
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def pv(vc)
Definition: MetAnalyzer.py:7
dd4hep::Volume Volume

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDPixPhase1FwdDiskAlgo   
)

Definition at line 92 of file DDPixPhase1FwdDiskAlgo.cc.