CMS 3D CMS Logo

Functions
DDTrackerPhiAlgo.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_DDTrackerPhiAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 11 of file DDTrackerPhiAlgo.cc.

11  {
12  cms::DDNamespace ns(ctxt, e, true);
13  DDAlgoArguments args(ctxt, e);
14  Volume mother = ns.volume(args.parentName());
15  Volume child = ns.volume(args.childName());
16  int startcn = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
17  int incrcn = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;
18  vector<double> phi = args.value<vector<double> >("Phi"); // Phi values
19  vector<double> zpos = args.value<vector<double> >("ZPos"); // Z positions
20  int numcopies = args.find("NumCopies") ? args.value<int>("NumCopies") : int(phi.size());
21  double radius = args.value<double>("Radius");
22  double tilt = args.value<double>("Tilt");
23 
24  if (numcopies != int(phi.size())) {
25  LogDebug("TrackerGeom") << "error: Parameter "
26  << "NumCopies does not agree with the size "
27  << "of the Phi vector. It was adjusted to "
28  << "be the size of the Phi vector and may "
29  << "lead to crashes or errors.";
30  }
31  LogDebug("TrackerGeom") << "debug: Parameters for position"
32  << "ing:: "
33  << " Radius " << radius << " Tilt " << tilt << " Copies " << phi.size() << " at";
34  for (int i = 0; i < (int)(phi.size()); i++)
35  LogDebug("TrackerGeom") << "\t[" << i << "] phi = " << phi[i] << " z = " << zpos[i];
36  LogDebug("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace "
37  << ns.name();
38 
39  double theta = 90._deg;
40  int ci = startcn;
41  for (int i = 0; i < numcopies; ++i) {
42  double phix = phi[i] + tilt;
43  double phiy = phix + 90._deg;
44  double xpos = radius * cos(phi[i]);
45  double ypos = radius * sin(phi[i]);
46  Rotation3D rot = makeRotation3D(theta, phix, theta, phiy, 0., 0.);
47  Position tran(xpos, ypos, zpos[i]);
48  /* PlacedVolume pv = */ mother.placeVolume(child, ci, Transform3D(rot, tran));
49  LogDebug("TrackerGeom") << "test: " << child.name() << " number " << ci << " positioned in " << mother.name()
50  << " at " << tran << " with " << rot;
51  ci = ci + incrcn;
52  }
53  return 1;
54 }

References writedatasetfile::args, funct::cos(), MillePedeFileConverter_cfg::e, mps_fire::i, createfilelist::int, LogDebug, cms::makeRotation3D(), cms::DDNamespace::name(), PixelTestBeamValidation_cfi::Position, CosmicsPD_Skims::radius, makeMuonMisalignmentScenario::rot, funct::sin(), theta(), and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTrackerPhiAlgo   
)

Definition at line 57 of file DDTrackerPhiAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
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
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
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
PVValHelper::phi
Definition: PVValidationHelpers.h:68
createfilelist.int
int
Definition: createfilelist.py:10
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
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