CMS 3D CMS Logo

Functions
DDHGCalWaferAlgo.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"
#include "Geometry/HGCalCommonData/interface/HGCalTypes.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_hgcal_DDHGCalWaferAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 10 of file DDHGCalWaferAlgo.cc.

10  {
11  cms::DDNamespace ns(ctxt, e, true);
13 
14  // Header section of original DDHGCalWafer.h
15  const auto& cellSize = args.value<double>("CellSize"); // Cell Size
16  const auto& cellType = args.value<int>("CellType"); // Type (1 fine; 2 coarse)
17  const auto& childNames = args.value<std::vector<std::string> >("ChildNames"); // Names of children
18  const auto& positionX = args.value<std::vector<int> >("PositionX"); // Position in X
19  const auto& positionY = args.value<std::vector<int> >("PositionY"); // Position in Y
20  const auto& angles = args.value<std::vector<double> >("Angles"); // Rotation angle
21  const auto& detectorType = args.value<std::vector<int> >("DetectorType"); // Detector type
22 #ifdef EDM_ML_DEBUG
23  edm::LogVerbatim("HGCalGeom") << childNames.size() << " children: " << childNames[0] << "; " << childNames[1]
24  << " positioned " << positionX.size() << " times with cell size " << cellSize;
25  for (unsigned int k = 0; k < positionX.size(); ++k)
26  edm::LogVerbatim("HGCalGeom") << "[" << k << "] x " << positionX[k] << " y " << positionY[k] << " angle "
27  << angles[k] << " detector " << detectorType[k];
28 
29  std::string idName = args.parentName(); // Name of the "parent" volume.
30  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferAlgo debug: Parent " << idName << " NameSpace " << ns.name();
31 #endif
32 
33  dd4hep::Volume mother = ns.volume(args.parentName());
34  double dx = 0.5 * cellSize;
35  double dy = 0.5 * dx * tan(30._deg);
36 
37  for (unsigned int k = 0; k < positionX.size(); ++k) {
38  std::string name(childNames[detectorType[k]]);
39  name = ns.prepend(name);
40  dd4hep::Rotation3D rotation;
41  if (angles[k] != 0) {
42  double phi = convertDegToRad(angles[k]);
43 #ifdef EDM_ML_DEBUG
44  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferAlgo: Creating new rotation \t90, " << angles[k] << ", 90, "
45  << (angles[k] + 90) << ", 0, 0";
46 #endif
47  rotation = cms::makeRotation3D(90._deg, phi, 90._deg, (90._deg + phi), 0, 0);
48  }
49  double xpos = dx * positionX[k];
50  double ypos = dy * positionY[k];
51  dd4hep::Position tran(xpos, ypos, 0);
52  int copy = HGCalTypes::packCellType6(cellType, k);
53  mother.placeVolume(ns.volume(name), copy, dd4hep::Transform3D(rotation, tran));
54 #ifdef EDM_ML_DEBUG
55  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferAlgo: " << name << " number " << copy << " positioned in " << idName
56  << " at " << tran << " with " << rotation;
57 #endif
58  }
59 
60  return cms::s_executed;
61 }

References particleFlowDisplacedVertex_cfi::angles, writedatasetfile::args, angle_units::operators::convertDegToRad(), filterCSVwithJSON::copy, PVValHelper::dx, PVValHelper::dy, MillePedeFileConverter_cfg::e, versionedElectronIDProducer_cfi::idName, dqmdumpme::k, cms::makeRotation3D(), Skims_PA_cff::name, cms::DDNamespace::name(), HGCalTypes::packCellType6(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), idealTransformation::rotation, cms::s_executed, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hgcal_DDHGCalWaferAlgo   
)

Definition at line 64 of file DDHGCalWaferAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
cms::DDNamespace
Definition: DDNamespace.h:16
angle_units::operators::convertDegToRad
constexpr long double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
cms::makeRotation3D
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
Definition: DDAlgoArguments.cc:20
versionedElectronIDProducer_cfi.idName
idName
Definition: versionedElectronIDProducer_cfi.py:11
HGCalTypes::packCellType6
static int32_t packCellType6(int type, int cell)
Definition: HGCalTypes.cc:36
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
dqmdumpme.k
k
Definition: dqmdumpme.py:60
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
PVValHelper::phi
Definition: PVValidationHelpers.h:68
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
PVValHelper::dy
Definition: PVValidationHelpers.h:49
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
particleFlowDisplacedVertex_cfi.angles
angles
Definition: particleFlowDisplacedVertex_cfi.py:84
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::Log
Definition: MessageLogger.h:70
PVValHelper::dx
Definition: PVValidationHelpers.h:48
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37