CMS 3D CMS Logo

Typedefs | Functions
DDMTDLinear.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"
#include <Math/Cartesian3D.h>
#include <Math/DisplacementVector3D.h>
#include "DataFormats/Math/interface/GeantUnits.h"

Go to the source code of this file.

Typedefs

using DD3Vector = ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > >
 

Functions

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

Typedef Documentation

◆ DD3Vector

using DD3Vector = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> >

Definition at line 14 of file DDMTDLinear.cc.

Function Documentation

◆ algorithm()

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

Definition at line 16 of file DDMTDLinear.cc.

References writedatasetfile::args, newFWLiteAna::base, angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), dumpMFGeometry_cfg::delta, MillePedeFileConverter_cfg::e, mps_fire::i, LogDebug, cms::makeRotation3D(), dqmiodumpmetadata::n, cms::DDNamespace::name(), PixelTestBeamValidation_cfi::Position, idealTransformation::rotation, funct::sin(), theta(), DOFs::thetaX, DOFs::thetaY, DOFs::thetaZ, and cms::DDNamespace::volume().

16  {
17  cms::DDNamespace ns(ctxt, e, true);
18  DDAlgoArguments args(ctxt, e);
19 
20  int n = args.value<int>("N");
21  int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
22  int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;
23  double theta = args.find("Theta") ? args.value<double>("Theta") : 0.;
24  double phi = args.find("Phi") ? args.value<double>("Phi") : 0.;
25  double theta_obj = args.find("Theta_obj") ? args.value<double>("Theta_obj") : 0.;
26  double phi_obj = args.find("Phi_obj") ? args.value<double>("Phi_obj") : 0.;
27  double delta = args.find("Delta") ? args.value<double>("Delta") : 0.;
28  vector<double> base = args.value<vector<double> >("Base");
29  Volume mother = ns.volume(args.parentName());
30  Volume child = ns.volume(args.value<string>("ChildName"));
31  int copy = startCopyNo;
32 
33  LogDebug("DDAlgorithm") << "DDMTDLinear: Parameters for positioning:: n " << n << " Direction Theta, Phi, Delta "
35  << " Base " << base[0] << ", " << base[1] << ", " << base[2] << convertRadToDeg(theta_obj)
36  << " " << convertRadToDeg(phi_obj);
37 
38  LogDebug("DDAlgorithm") << "DDMTDLinear: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace "
39  << ns.name();
40 
41  Position direction(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
42 
43  Position basetr(base[0], base[1], base[2]);
44 
45  //rotation is in xy plane
46  double thetaZ = theta_obj - 0.5_pi;
47  double phiZ = phi_obj;
48  double thetaX = theta_obj;
49  double thetaY = theta_obj;
50  double phiX = phi_obj;
51  double phiY = phi_obj + 0.5_pi;
52 
53  Rotation3D rotation = makeRotation3D(thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
54 
55  for (int i = 0; i < n; ++i) {
56  Position tran = basetr + (double(i) * delta) * direction;
57  mother.placeVolume(child, copy, Transform3D(rotation, tran));
58  LogDebug("DDAlgorithm") << "DDMTDLinear: " << child.name() << " number " << copy << " positioned in "
59  << mother.name() << " at " << tran << " with " << rotation;
60 
61  copy += incrCopyNo;
62  }
63 
64  return 1;
65 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
base
Main Program
Definition: newFWLiteAna.py:92
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)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
dd4hep::Volume Volume
Geom::Theta< T > theta() const
#define LogDebug(id)

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_mtd_DDMTDLinear   
)

Definition at line 68 of file DDMTDLinear.cc.