CMS 3D CMS Logo

Functions
DDBHMAngular.cc File Reference
#include "DataFormats/Math/interface/GeantUnits.h"
#include "DetectorDescription/Core/interface/DDSplit.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DD4hep/DetFactoryHelper.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ algorithm()

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

Definition at line 10 of file DDBHMAngular.cc.

References writedatasetfile::args, angle_units::operators::convertMmToCm(), angle_units::operators::convertRadToDeg(), funct::cos(), DDSplit(), MillePedeFileConverter_cfg::e, isotrackTrainRegressor::fac1(), isotrackTrainRegressor::fac2(), findQualityFiles::jj, class-composition::parent, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), makeMuonMisalignmentScenario::rot, cms::DDNamespace::rotation(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::rotMat, findQualityFiles::rr, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, units(), and cms::DDNamespace::volume().

10  {
11  cms::DDNamespace ns(ctxt, e, true);
13  int units = args.value<int>("number");
14  double rr = args.value<double>("radius");
15  double dphi = args.value<double>("deltaPhi");
16 #ifdef EDM_ML_DEBUG
17  edm::LogVerbatim("ForwardGeom") << "DDBHMAngular debug: Parameters for positioning-- " << units
18  << " copies at radius " << convertMmToCm(rr) << " cm with delta(phi) "
19  << convertRadToDeg(dphi);
20 #endif
21  std::string rotMat = args.value<std::string>("Rotation");
22  std::string childName = args.value<std::string>("ChildName");
23  dd4hep::Volume parent = ns.volume(args.parentName());
24  dd4hep::Volume child = ns.volume(ns.prepend(childName));
25 #ifdef EDM_ML_DEBUG
26  edm::LogVerbatim("ForwardGeom") << "DDBHMAngular debug: Parent " << parent.name() << "\tChild " << child.name()
27  << "\tRotation matrix " << rotMat;
28 #endif
29  std::string rotstr = DDSplit(rotMat).first;
30  dd4hep::Rotation3D rot;
31  if (rotstr != "NULL") {
32  rot = ns.rotation(rotMat);
33  }
34  static const int startpos = 16;
35  static const double fac1 = 0.5;
36  static const double fac2 = 1.5;
37  for (int jj = 0; jj < units; jj++) {
38  double driverX(0), driverY(0), driverZ(0);
39  if (jj < startpos) {
40  driverX = rr * cos((jj + fac1) * dphi);
41  driverY = sqrt(rr * rr - driverX * driverX);
42  } else if (jj == startpos) {
43  driverX = rr * cos((startpos - fac1) * dphi);
44  driverY = -sqrt(rr * rr - driverX * driverX);
45  } else if (jj == startpos + 1) {
46  driverX = rr * cos((startpos - fac2) * dphi);
47  driverY = -sqrt(rr * rr - driverX * driverX);
48  } else if (jj == startpos + 2) {
49  driverX = rr * cos(fac1 * dphi);
50  driverY = -sqrt(rr * rr - driverX * driverX);
51  } else if (jj == startpos + 3) {
52  driverX = rr * cos(fac2 * dphi);
53  driverY = -sqrt(rr * rr - driverX * driverX);
54  }
55  dd4hep::Position tran(driverX, driverY, driverZ);
56 
57  parent.placeVolume(child, jj + 1, dd4hep::Transform3D(rot, tran));
58 #ifdef EDM_ML_DEBUG
59  edm::LogVerbatim("ForwardGeom") << "DDBHMAngular test: " << child.name() << " number " << jj + 1
60  << " positioned in " << parent.name() << " at " << tran << " with " << rotMat
61  << " : " << rot;
62 #endif
63  }
64  return 1;
65 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
dd4hep::Volume Volume
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
TString units(TString variable, Char_t axis)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_bhmalgo_DDBHMAngular   
)

Definition at line 68 of file DDBHMAngular.cc.