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 using namespace geant_units::operators;
8 
9 static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext& ctxt, xml_h e) {
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 }
60 
61 // first argument is the type from the xml file
62 DECLARE_DDCMS_DETELEMENT(DDCMS_hcal_DDHCalLinearXY, algorithm)
algorithm
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
Definition: DDHCalLinearXY.cc:9
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
geant_units::operators
Definition: GeantUnits.h:18
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
GeantUnits.h
DDPlugins.h
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
align::Detector
Definition: StructureType.h:86
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
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37