CMS 3D CMS Logo

Functions
DDTECPhiAltAlgo.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_DDTECPhiAltAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 11 of file DDTECPhiAltAlgo.cc.

References writedatasetfile::args, angle_units::operators::convertRadToDeg(), funct::cos(), MillePedeFileConverter_cfg::e, mps_fire::i, cms::makeRotation3D(), cms::DDNamespace::name(), contentValuesFiles::number, PixelTestBeamValidation_cfi::Position, CosmicsPD_Skims::radius, idealTransformation::rotation, funct::sin(), theta(), and cms::DDNamespace::volume().

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  double startAngle = args.value<double>("StartAngle"); //Start angle
17  double incrAngle = args.value<double>("IncrAngle"); //Increment in angle
18  double radius = args.value<double>("Radius"); //Radius
19  double zIn = args.value<double>("ZIn"); //z position for the even ones
20  double zOut = args.value<double>("ZOut"); //z position for the odd ones
21  int number = args.value<double>("Number"); //Number of copies
22  int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1; //Start copy number
23  int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1; //Increment in copy number
24 
25  edm::LogVerbatim("TECGeom") << "debug: Parameters for "
26  << "positioning--"
27  << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle "
28  << convertRadToDeg(incrAngle) << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers "
29  << number << " Start/Increment " << startCopyNo << ", " << incrCopyNo;
30  edm::LogVerbatim("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace "
31  << ns.name();
32 
33  if (number > 0) {
34  double theta = 90._deg;
35  int copyNo = startCopyNo;
36  for (int i = 0; i < number; i++) {
37  double phiz = startAngle + i * incrAngle;
38  double phix = phiz + 90._deg;
39  Rotation3D rotation = makeRotation3D(theta, phix, 0e0, 0e0, theta, phiz);
40  Position tran(radius * cos(phiz), radius * sin(phiz), (i % 2 == 0) ? zIn : zOut);
41  mother.placeVolume(child, copyNo, Transform3D(rotation, tran));
42  edm::LogVerbatim("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in "
43  << mother.name() << " at " << tran << " with " << rotation;
44  copyNo += incrCopyNo;
45  }
46  }
47  return 1;
48 }
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)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
dd4hep::Volume Volume
Geom::Theta< T > theta() const

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTECPhiAltAlgo   
)

Definition at line 51 of file DDTECPhiAltAlgo.cc.