CMS 3D CMS Logo

Functions
DDTECPhiAlgo.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, SensitiveDetector &)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDTECPhiAlgo)
 

Function Documentation

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

Definition at line 11 of file DDTECPhiAlgo.cc.

References writedatasetfile::args, cms::DDAlgoArguments::childName(), angle_units::operators::convertRadToDeg(), cms::DDAlgoArguments::find(), mps_fire::i, LogDebug, cms::makeRotation3D(), cms::DDNamespace::name(), contentValuesFiles::number, cms::DDAlgoArguments::parentName(), idealTransformation::rotation, theta(), cms::DDAlgoArguments::value(), 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 zIn = args.value<double>("ZIn"); //z position for the even ones
19  double zOut = args.value<double>("ZOut"); //z position for the odd ones
20  int number = args.value<double>("Number"); //Number of copies
21  int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1; //Start copy number
22  int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1; //Increment in copy number
23 
24  LogDebug("TECGeom") << "debug: Parameters for "
25  << "positioning--"
26  << "\tStartAngle " << convertRadToDeg(startAngle) << "\tIncrAngle " << convertRadToDeg(incrAngle)
27  << "\tZ in/out " << zIn << ", " << zOut << "\tCopy Numbers " << number << " Start/Increment "
28  << startCopyNo << ", " << incrCopyNo;
29  LogDebug("TECGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name();
30 
31  if (number > 0) {
32  double theta = 90._deg;
33  int copyNo = startCopyNo;
34  for (int i = 0; i < number; i++) {
35  double phix = startAngle + i * incrAngle;
36  double phiy = phix + 90._deg;
37  Rotation3D rotation = makeRotation3D(theta, phix, theta, phiy, 0, 0);
38  Position tran(0., 0., (i % 2 == 0) ? zIn : zOut);
39  /* PlacedVolume pv = */ mother.placeVolume(child, copyNo, Transform3D(rotation, tran));
40  LogDebug("TECGeom") << "test: " << child.name() << " number " << copyNo << " positioned in " << mother.name()
41  << " at " << tran << " with " << rotation;
42  copyNo += incrCopyNo;
43  }
44  }
45  return 1;
46 }
#define LogDebug(id)
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Geom::Theta< T > theta() const
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
dd4hep::Volume Volume
DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTECPhiAlgo   
)

Definition at line 49 of file DDTECPhiAlgo.cc.