CMS 3D CMS Logo

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

Function Documentation

◆ algorithm()

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

Definition at line 10 of file DDHCalForwardAlgo.cc.

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

References writedatasetfile::args, geant_units::operators::convertCmToMm(), 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(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hcal_DDHCalForwardAlgo   
)

Definition at line 82 of file DDHCalForwardAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
g4SimHits_cfi.Material
Material
Definition: g4SimHits_cfi.py:560
cms::DDNamespace
Definition: DDNamespace.h:16
dqmdumpme.first
first
Definition: dqmdumpme.py:55
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
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
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Log
Definition: MessageLogger.h:70
class-composition.parent
parent
Definition: class-composition.py:88
PVValHelper::dx
Definition: PVValidationHelpers.h:48
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37