CMS 3D CMS Logo

Functions
DDHCalForwardAlgo.cc File Reference
#include "DataFormats/Math/interface/angle_units.h"
#include "DetectorDescription/Core/interface/DDSplit.h"
#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_DDHCalForwardAlgo)
 

Function Documentation

◆ algorithm()

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

Definition at line 11 of file DDHCalForwardAlgo.cc.

References writedatasetfile::args, cms::convert2mm(), DDSplit(), PVValHelper::dx, MillePedeFileConverter_cfg::e, dqmdumpme::first, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, cms::DDNamespace::name(), contentValuesFiles::number, class-composition::parent, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), cms::s_executed, findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, cond::impl::to_string(), and cms::DDNamespace::volume().

11  {
12  cms::DDNamespace ns(ctxt, e, true);
14  // Header section
15  std::string parentName = DDSplit(args.parentName()).first;
16  std::string cellMat = args.value<std::string>("CellMaterial"); //Cell material
17  double cellDx = args.value<double>("CellDx"); //Cell size (x)
18  double cellDy = args.value<double>("CellDy"); //Cell size (y)
19  double cellDz = args.value<double>("CellDz"); //Cell size (z)
20  double startY = args.value<double>("StartY"); //Starting Y for Cell
21  std::vector<std::string> childName = args.value<std::vector<std::string> >("Child"); //Children name
22  std::vector<int> number = args.value<std::vector<int> >("Number"); //Number of cells
23  std::vector<int> size = args.value<std::vector<int> >("Size"); //Number of children
24  std::vector<int> type = args.value<std::vector<int> >("Type"); //First child
25 #ifdef EDM_ML_DEBUG
26  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: Cell material " << cellMat << "\tCell Size "
27  << cms::convert2mm(cellDx) << ", " << cms::convert2mm(cellDy) << ", "
28  << cms::convert2mm(cellDz) << "\tStarting Y " << cms::convert2mm(startY) << "\tChildren "
29  << childName[0] << ", " << childName[1]
30  << "\n Cell positioning done for " << number.size() << " times";
31  for (unsigned int i = 0; i < number.size(); ++i)
32  edm::LogVerbatim("HCalGeom") << "\t" << i << " Number of children " << size[i] << " occurence " << number[i]
33  << " first child index " << type[i];
34  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo debug: Parent " << args.parentName() << " NameSpace " << ns.name();
35 #endif
36 
37  dd4hep::Volume parent = ns.volume(args.parentName());
38  dd4hep::Material matter = ns.material(cellMat);
39 
40  double ypos = startY;
41  int box = 0;
42  for (unsigned int i = 0; i < number.size(); i++) {
43  double dx = cellDx * size[i];
44  int indx = type[i];
45  for (int j = 0; j < number[i]; j++) {
46  box++;
47  std::string name = parentName + std::to_string(box);
48  dd4hep::Solid solid = dd4hep::Box(ns.prepend(name), dx, cellDy, cellDz);
49 #ifdef EDM_ML_DEBUG
50  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: " << solid.name() << " Box made of " << cellMat << " of Size "
51  << cms::convert2mm(dx) << ", " << cms::convert2mm(cellDy) << ", "
52  << cms::convert2mm(cellDz);
53 #endif
54  dd4hep::Volume glog(solid.name(), solid, matter);
55 
56  parent.placeVolume(glog, box, dd4hep::Position(0.0, ypos, 0.0));
57 #ifdef EDM_ML_DEBUG
58  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: " << solid.name() << " number " << box << " positioned in "
59  << parent.name() << " at (0.0, " << cms::convert2mm(ypos)
60  << ", 0.0) with no rotation";
61 #endif
62 
63  double xpos = -dx + cellDx;
64  ypos += 2 * cellDy;
65  indx = 1 - indx;
66  for (int k = 0; k < size[i]; ++k) {
67  glog.placeVolume(ns.volume(childName[indx]), k + 1, dd4hep::Position(xpos, 0.0, 0.0));
68 #ifdef EDM_ML_DEBUG
69  edm::LogVerbatim("HCalGeom") << "DDHCalForwardAlgo: " << childName[indx] << " number " << (k + 1)
70  << " positioned in " << glog.name() << " at (" << cms::convert2mm(xpos)
71  << ", 0,0, 0.0) with no rotation";
72 #endif
73  xpos += 2 * cellDx;
74  }
75  }
76  }
77 #ifdef EDM_ML_DEBUG
78  edm::LogVerbatim("HCalGeom") << "<<== End of DDHCalForwardAlgo construction";
79 #endif
80  return cms::s_executed;
81 }
size
Write out results.
Log< level::Info, true > LogVerbatim
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
std::string to_string(const V &value)
Definition: OMSAccess.h:77
static constexpr long s_executed
dd4hep::Volume Volume
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalForwardAlgo   
)

Definition at line 84 of file DDHCalForwardAlgo.cc.