CMS 3D CMS Logo

Functions
DDTIDRingAlgo.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_DDTIDRingAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 11 of file DDTIDRingAlgo.cc.

11  {
12  cms::DDNamespace ns(ctxt, e, true);
13  DDAlgoArguments args(ctxt, e);
14  Volume mother = ns.volume(args.parentName());
15  vector<string> moduleName = args.value<vector<string> >("ModuleName"); //Name of the module
16  string iccName = args.value<string>("ICCName"); //Name of the ICC
17  int number = args.value<int>("Number"); //Number of copies
18  double startAngle = args.value<double>("StartAngle"); //Phi offset
19  double rModule = args.value<double>("ModuleR"); //Location of module in R
20  vector<double> zModule = args.value<vector<double> >("ModuleZ"); // in Z
21  double rICC = args.value<double>("ICCR"); //Location of ICC in R
22  double sICC = args.value<double>("ICCShift"); //Shift of ICC per to R
23  vector<double> zICC = args.value<vector<double> >("ICCZ"); // in Z
24 
25  LogDebug("TIDGeom") << "Parent " << mother.name() << "\tModule " << moduleName[0] << ", " << moduleName[1] << "\tICC "
26  << iccName << "\tNameSpace " << ns.name();
27  LogDebug("TIDGeom") << "Parameters for positioning--"
28  << " StartAngle " << convertRadToDeg(startAngle) << " Copy Numbers " << number << " Modules at R "
29  << rModule << " Z " << zModule[0] << ", " << zModule[1] << " ICCs at R " << rICC << " Z "
30  << zICC[0] << ", " << zICC[1];
31  double theta = 90._deg;
32  double phiy = 0._deg;
33  double dphi = 2_pi / number;
34 
35  //Loop over modules
36  Volume icc = ns.volume(iccName);
37  Volume mod0 = ns.volume(moduleName[0]);
38  Volume mod1 = ns.volume(moduleName[1]);
39  for (int i = 0; i < number; i++) {
40  //First the module
41  double phiz = startAngle + i * dphi;
42  double xpos = rModule * cos(phiz);
43  double ypos = rModule * sin(phiz);
44  double zpos, thetay, phix;
45  Volume module;
46  if (i % 2 == 0) {
47  phix = phiz + 90._deg;
48  thetay = 0._deg;
49  zpos = zModule[0];
50  module = mod0;
51  } else {
52  phix = phiz - 90._deg;
53  thetay = 180._deg;
54  zpos = zModule[1];
55  module = mod1;
56  }
57 
58  // stereo face inside toward structure, rphi face outside
59  phix = phix - 180._deg;
60  thetay = thetay + 180._deg;
61  //
62  Position trmod(xpos, ypos, zpos);
63  Rotation3D rotation = makeRotation3D(theta, phix, thetay, phiy, theta, phiz);
64  // int copyNr = i+1;
65  /* PlacedVolume pv = */ mother.placeVolume(module, i + 1, Transform3D(rotation, trmod));
66  LogDebug("TIDGeom") << module.name() << " number " << i + 1 << " positioned in " << mother.name() << " at " << trmod
67  << " with " << rotation;
68  //Now the ICC
69  if (i % 2 == 0) {
70  zpos = zICC[0];
71  xpos = rICC * cos(phiz) + sICC * sin(phiz);
72  ypos = rICC * sin(phiz) - sICC * cos(phiz);
73  } else {
74  zpos = zICC[1];
75  xpos = rICC * cos(phiz) - sICC * sin(phiz);
76  ypos = rICC * sin(phiz) + sICC * cos(phiz);
77  }
78  // int copyNr = i+1;
79  Position tricc(xpos, ypos, zpos);
80  /* PlacedVolume pv = */ mother.placeVolume(icc, i + 1, Transform3D(rotation, tricc));
81  LogDebug("TIDGeom") << iccName << " number " << i + 1 << " positioned in " << mother.name() << " at " << tricc
82  << " with " << rotation;
83  }
84  return 1;
85 }

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

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTIDRingAlgo   
)

Definition at line 88 of file DDTIDRingAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
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
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
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:233
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
EcalCalibMonitorClient_cfi.moduleName
moduleName
Definition: EcalCalibMonitorClient_cfi.py:17
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37