CMS 3D CMS Logo

Functions
DDHCalLinearXY.cc File Reference
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "DetectorDescription/DDCMS/interface/DDutils.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_DDHCalLinearXY)
 

Function Documentation

◆ algorithm()

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

Definition at line 8 of file DDHCalLinearXY.cc.

References writedatasetfile::args, submitPVValidationJobs::child, cms::convert2mm(), filterCSVwithJSON::copy, MillePedeFileConverter_cfg::e, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, class-composition::parent, PixelTestBeamValidation_cfi::Position, cms::s_executed, AlCaHLTBitMon_QueryRunRegistry::string, and cms::DDNamespace::volume().

8  {
9  cms::DDNamespace ns(ctxt, e, true);
11  // Header section of original DDHCalLinearXY.h
12  int numberX = args.value<int>("NumberX"); //Slices along X
13  int numberY = args.value<int>("NumberY"); //Slices along Y
14  double deltaX = args.value<double>("DeltaX"); //Step along X
15  double deltaY = args.value<double>("DeltaY"); //Step along Y
16  std::vector<double> centre = args.value<std::vector<double> >("Center");
17  dd4hep::Volume parent = ns.volume(args.parentName());
18  std::vector<std::string> childName = args.value<std::vector<std::string> >("Child");
19 
20 #ifdef EDM_ML_DEBUG
21  edm::LogVerbatim("HCalGeom") << "DDHCalLinearXY: Parent " << parent.name() << " \twith " << childName.size()
22  << " children";
23  unsigned int k(0);
24  for (auto const& child : childName) {
25  edm::LogVerbatim("HCalGeom") << "DDHCalLinearXY: Child[" << k << "] = " << child;
26  ++k;
27  }
28  edm::LogVerbatim("HCalGeom") << "DDHCalLinearXY: Number along X/Y " << numberX << "/" << numberY
29  << "\tDelta along X/Y " << cms::convert2mm(deltaX) << "/" << cms::convert2mm(deltaY)
30  << "\tCentre (" << cms::convert2mm(centre[0]) << ", " << cms::convert2mm(centre[1])
31  << "," << cms::convert2mm(centre[2]);
32 #endif
33  double xoff = centre[0] - (numberX - 1) * 0.5 * deltaX;
34  double yoff = centre[1] - (numberY - 1) * 0.5 * deltaY;
35  unsigned int copy = 0;
36  for (int i = 0; i < numberX; ++i) {
37  for (int j = 0; j < numberY; ++j) {
38  unsigned int k = (childName.size() == 1) ? 0 : copy;
39  ++copy;
40  if (k < childName.size() && (childName[k] != " " && childName[k] != "Null")) {
41  std::string child = childName[k];
42  dd4hep::Position tran(xoff + i * deltaX, yoff + j * deltaY, centre[2]);
43  parent.placeVolume(ns.volume(child), copy, tran);
44 #ifdef EDM_ML_DEBUG
45  edm::LogVerbatim("HCalGeom") << "DDHCalLinearXY: " << child << " number " << copy << " positioned in "
46  << parent.name() << " at (" << cms::convert2mm((xoff + i * deltaX)) << ", "
47  << cms::convert2mm((yoff + j * deltaY)) << ", " << cms::convert2mm(centre[2])
48  << ") with no rotation";
49 #endif
50  } else {
51 #ifdef EDM_ML_DEBUG
52  edm::LogVerbatim("HCalGeom") << "DDHCalLinearXY: no child placed for [" << copy << "]";
53 #endif
54  }
55  }
56  }
57  return cms::s_executed;
58 }
Log< level::Info, true > LogVerbatim
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
static constexpr long s_executed
dd4hep::Volume Volume

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalLinearXY   
)

Definition at line 61 of file DDHCalLinearXY.cc.