CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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

Definition at line 11 of file DDTIDRingAlgo.cc.

References writedatasetfile::args, angle_units::operators::convertRadToDeg(), funct::cos(), mps_fire::i, cms::makeRotation3D(), callgraph::module, convertParamsToOnlineFormat::moduleName, cms::DDNamespace::name(), contentValuesFiles::number, cms::DDAlgoArguments::parentName(), PixelTestBeamValidation_cfi::Position, idealTransformation::rotation, funct::sin(), 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  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  edm::LogVerbatim("TIDGeom") << "Parent " << mother.name() << "\tModule " << moduleName[0] << ", " << moduleName[1]
26  << "\tICC " << iccName << "\tNameSpace " << ns.name();
27  edm::LogVerbatim("TIDGeom") << "Parameters for positioning--"
28  << " StartAngle " << convertRadToDeg(startAngle) << " Copy Numbers " << number
29  << " Modules at R " << rModule << " Z " << zModule[0] << ", " << zModule[1]
30  << " ICCs at R " << rICC << " Z " << 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  edm::LogVerbatim("TIDGeom") << module.name() << " number " << i + 1 << " positioned in " << mother.name() << " at "
67  << trmod << " 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  edm::LogVerbatim("TIDGeom") << icc.name() << " number " << i + 1 << " positioned in " << mother.name() << " at "
82  << tricc << " with " << rotation;
83  }
84  return 1;
85 }
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
Geom::Theta< T > theta() const
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
tuple module
Definition: callgraph.py:69
DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTIDRingAlgo   
)

Definition at line 88 of file DDTIDRingAlgo.cc.