CMS 3D CMS Logo

Functions
DDHCalAngular.cc File Reference
#include "DataFormats/Math/interface/GeantUnits.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_hcal_DDHCalAngular)
 

Function Documentation

◆ algorithm()

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

Definition at line 9 of file DDHCalAngular.cc.

9  {
10  cms::DDNamespace ns(ctxt, e, true);
12  // Header section of original DDHCalAngular.h
13  int n = args.value<int>("n");
14  int startCopyNo = args.value<int>("startCopyNo");
15  int incrCopyNo = args.value<int>("incrCopyNo");
16  double rangeAngle = args.value<double>("rangeAngle"); //Angular range
17  double startAngle = args.value<double>("startAngle"); //Start anle
18  double shiftX = args.value<double>("shiftX"); //x Shift
19  double shiftY = args.value<double>("shiftY"); //y Shift
20  double zoffset = args.value<double>("zoffset"); //z offset
21  dd4hep::Volume mother = ns.volume(args.parentName());
22  std::string childName = args.value<std::string>("ChildName");
23  childName = ns.prepend(childName);
24  dd4hep::Volume child = ns.volume(childName);
25 
26  // Increment
27  double dphi = rangeAngle / n;
28 #ifdef EDM_ML_DEBUG
29  edm::LogVerbatim("HCalGeom") << "DDHCalAngular: Parameters for positioning::"
30  << " n " << n << " Start, Range, Delta " << convertRadToDeg(startAngle) << " "
31  << convertRadToDeg(rangeAngle) << " " << convertRadToDeg(dphi) << " Shift "
32  << convertCmToMm(shiftX) << ":" << convertCmToMm(shiftY) << "\n Parent " << mother.name()
33  << "\tChild " << child.name() << " NameSpace " << ns.name();
34 #endif
35  int copy = startCopyNo;
36  double phix = startAngle;
37  for (int ii = 0; ii < n; ++ii) {
38  if (phix >= 2._pi)
39  phix -= 2._pi;
40  else if (phix < 0)
41  phix += 2._pi;
42  dd4hep::Rotation3D rotation;
43  if (std::abs(phix) >= 0.1_deg) {
44 #ifdef EDM_ML_DEBUG
45  edm::LogVerbatim("HCalGeom") << "DDHCalAngular::Creating a rotation:"
46  << "\t90., " << convertRadToDeg(phix) << ", 90.," << (90.0 + convertRadToDeg(phix))
47  << ", 0, 0";
48 #endif
49  rotation = dd4hep::RotationZ(phix);
50  }
51 
52  double xpos = shiftX * cos(phix) - shiftY * sin(phix);
53  double ypos = shiftX * sin(phix) + shiftY * cos(phix);
54  dd4hep::Position tran(xpos, ypos, zoffset);
55  mother.placeVolume(child, copy, dd4hep::Transform3D(rotation, tran));
56 #ifdef EDM_ML_DEBUG
57  edm::LogVerbatim("HCalGeom") << "DDHCalAngular:: " << child.name() << " number " << copy << " positioned in "
58  << mother.name() << " at (" << convertCmToMm(xpos) << ", " << convertCmToMm(ypos)
59  << ", " << convertCmToMm(zoffset) << ") with rotation matrix: " << rotation;
60 #endif
61  copy += incrCopyNo;
62  phix += dphi;
63  }
64  return 1;
65 }

References funct::abs(), writedatasetfile::args, geant_units::operators::convertCmToMm(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), MillePedeFileConverter_cfg::e, cuy::ii, dqmiodumpmetadata::n, cms::DDNamespace::name(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), idealTransformation::rotation, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalAngular   
)

Definition at line 68 of file DDHCalAngular.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:16
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
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
geant_units::operators::convertCmToMm
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
child
Definition: simpleInheritance.h:11
cuy.ii
ii
Definition: cuy.py:590
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37