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::SensitiveDetector &)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_hcal_DDHCalLinearXY)
 

Function Documentation

◆ algorithm()

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

Definition at line 9 of file DDHCalLinearXY.cc.

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

References writedatasetfile::args, class-composition::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 65 of file DDHCalLinearXY.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:355
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
cms::DDNamespace
Definition: DDNamespace.h:16
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:62
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:45
geant_units::operators::convertCmToMm
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
edm::LogVerbatim
Definition: MessageLogger.h:297
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
class-composition.child
child
Definition: class-composition.py:91
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