CMS 3D CMS Logo

Functions
DDHCalLinearXY.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_DDHCalLinearXY)
 

Function Documentation

◆ algorithm()

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

Definition at line 9 of file DDHCalLinearXY.cc.

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

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

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalLinearXY   
)

Definition at line 62 of file DDHCalLinearXY.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
cms::DDNamespace
Definition: DDNamespace.h:16
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
geant_units::operators::convertCmToMm
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
submitPVValidationJobs.child
child
Definition: submitPVValidationJobs.py:119
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
child
Definition: simpleInheritance.h:11
class-composition.parent
parent
Definition: class-composition.py:88
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37