CMS 3D CMS Logo

Functions
DDHGCalWafer.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 (dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_hgcal_DDHGCalWafer)
 

Function Documentation

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

Definition at line 10 of file DDHGCalWafer.cc.

References writedatasetfile::args, angle_units::operators::convertDegToRad(), filterCSVwithJSON::copy, PVValHelper::dx, PVValHelper::dy, dqmdumpme::k, cms::makeRotation3D(), Skims_PA_cff::name, cms::DDNamespace::name(), hgcaltilesconstants::nColumns, cms::DDAlgoArguments::parentName(), idealTransformation::rotation, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), cms::DDAlgoArguments::value(), and cms::DDNamespace::volume().

13  {
14  cms::DDNamespace ns(ctxt, e, true);
16  std::string nsName = static_cast<std::string>(ns.name());
17  // Header section of original DDHGCalWafer.h
18  double waferSize = args.value<double>("WaferSize");
19  int cellType = args.value<int>("CellType");
20  int nColumns = args.value<int>("NColumns");
21  int nBottomY = args.value<int>("NBottomY");
22  std::vector<std::string> childNames = args.value<std::vector<std::string> >("ChildNames");
23  std::vector<int> nCellsRow = args.value<std::vector<int> >("NCellsRow");
24  std::vector<int> angleEdges = args.value<std::vector<int> >("AngleEdges");
25  std::vector<int> detectorType = args.value<std::vector<int> >("DetectorType");
26  std::string parentName = args.parentName();
27  dd4hep::Volume mother = ns.volume(args.parentName());
28 #ifdef EDM_ML_DEBUG
29  edm::LogVerbatim("HGCalGeom") << childNames.size() << " children: " << childNames[0] << "; " << childNames[1]
30  << " positioned in " << nCellsRow.size() << " rows and " << nColumns
31  << " columns with lowest column at " << nBottomY << " in mother " << parentName
32  << " of size " << waferSize;
33  for (unsigned int k = 0; k < nCellsRow.size(); ++k)
34  edm::LogVerbatim("HGCalGeom") << "[" << k << "] Ncells " << nCellsRow[k] << " Edge rotations " << angleEdges[2 * k]
35  << ":" << angleEdges[2 * k + 1] << " Type of edge cells " << detectorType[2 * k]
36  << ":" << detectorType[2 * k + 1];
37 #endif
38 
39  static const int incAlongX = 2;
40  static const int incAlongY = 6;
41  double dx = 0.5 * waferSize / nColumns;
42  double dy = 0.5 * dx * tan(30._deg);
43  int ny = nBottomY;
44  int kount(0);
45 
46  for (unsigned int ir = 0; ir < nCellsRow.size(); ++ir) {
47  int nx = 1 - nCellsRow[ir];
48  double ypos = dy * ny;
49  for (int ic = 0; ic < nCellsRow[ir]; ++ic) {
50  std::string name(childNames[0]);
51  int irot(0);
52  if (ic == 0) {
53  name = childNames[detectorType[2 * ir]];
54  irot = angleEdges[2 * ir];
55  } else if (ic + 1 == nCellsRow[ir]) {
56  name = childNames[detectorType[2 * ir + 1]];
57  irot = angleEdges[2 * ir + 1];
58  }
59  dd4hep::Rotation3D rotation;
60  if (irot != 0) {
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferAlgo: Creating "
63  << "rotation "
64  << "\t90, " << irot << ", 90, " << (irot + 90) << ", 0, 0";
65 #endif
66  double phix = convertDegToRad(irot);
67  double phiy = convertDegToRad(90 + irot);
68  rotation = cms::makeRotation3D(90._deg, phix, 90._deg, phiy, 0., 0.);
69  }
70  std::string namx = nsName + name;
71  double xpos = dx * nx;
72  nx += incAlongX;
73  dd4hep::Position tran(xpos, ypos, 0);
74  int copy = cellType * 1000 + kount;
75  mother.placeVolume(ns.volume(namx), copy, dd4hep::Transform3D(rotation, tran));
76  ++kount;
77 #ifdef EDM_ML_DEBUG
78  edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer: " << name << " number " << copy << " positioned in " << parentName
79  << " at " << tran << " with " << rotation;
80 #endif
81  }
82  ny += incAlongY;
83  }
84  return 1;
85 }
constexpr long double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
dd4hep::Volume Volume
DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hgcal_DDHGCalWafer   
)

Definition at line 88 of file DDHGCalWafer.cc.