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::SensitiveDetector &)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDPixPhase1FwdDiskAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 16 of file DDPixPhase1FwdDiskAlgo.cc.

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

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

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDPixPhase1FwdDiskAlgo   
)

Definition at line 94 of file DDPixPhase1FwdDiskAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:16
cms::makeRotation3D
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
Definition: DDAlgoArguments.cc:20
cms::PlacedVolume
dd4hep::PlacedVolume PlacedVolume
Definition: DDFilteredView.h:46
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
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:62
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:45
PVValHelper::phi
Definition: PVValidationHelpers.h:68
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
edm::LogVerbatim
Definition: MessageLogger.h:297
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
child
Definition: simpleInheritance.h:11
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37