CMS 3D CMS Logo

DDHCalLinearXY.cc
Go to the documentation of this file.
4 #include "DD4hep/DetFactoryHelper.h"
5 
6 //#define EDM_ML_DEBUG
7 
8 static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) {
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 }
59 
60 // first argument is the type from the xml file
61 DECLARE_DDCMS_DETELEMENT(DDCMS_hcal_DDHCalLinearXY, algorithm)
algorithm
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
Definition: DDHCalLinearXY.cc:8
writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
DECLARE_DDCMS_DETELEMENT
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition: DDPlugins.h:25
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
cms::DDParsingContext
Definition: DDParsingContext.h:13
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
DDPlugins.h
cms::convert2mm
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
align::Detector
Definition: StructureType.h:92
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
cms::DDNamespace::volume
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition: DDNamespace.cc:205
DDutils.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37