CMS 3D CMS Logo

Namespaces | Functions
DDHGCalTBModuleX.cc File Reference
#include <unordered_set>
#include "DataFormats/Math/interface/GeantUnits.h"
#include "DD4hep/DetFactoryHelper.h"
#include "DetectorDescription/Core/interface/DDSplit.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Geometry/HGCalCommonData/interface/HGCalTypes.h"

Go to the source code of this file.

Namespaces

 DDHGCalGeom
 

Functions

static long algorithm (dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
void DDHGCalGeom::constructLayers (const cms::DDNamespace &ns, const std::vector< std::string > &wafers, const std::vector< std::string > &covers, const std::vector< int > &layerType, const std::vector< int > &layerSense, const std::vector< int > &maxModule, const std::vector< std::string > &names, const std::vector< std::string > &materials, std::vector< int > &copyNumber, const std::vector< double > &layerThick, const double &absorbW, const double &absorbH, const double &waferTot, const double &rMax, const double &rMaxFine, std::unordered_set< int > &copies, int firstLayer, int lastLayer, double zFront, double totalWidth, bool ignoreCenter, dd4hep::Volume &module)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_hgcal_DDHGCalTBModuleX)
 

Function Documentation

◆ algorithm()

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

Definition at line 189 of file DDHGCalTBModuleX.cc.

189  {
190  cms::DDNamespace ns(ctxt, e, true);
191  cms::DDAlgoArguments args(ctxt, e);
192 
193  const auto& wafers = args.value<std::vector<std::string> >("WaferName"); // Wafers
194  const auto& covers = args.value<std::vector<std::string> >("CoverName"); // Insensitive layers of hexagonal size
195  const auto& genMat = args.value<std::string>("GeneralMaterial"); // General material used for blocks
196 #ifdef EDM_ML_DEBUG
197  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: Material " << genMat << " with " << wafers.size() << " wafers";
198  unsigned int i(0);
199  for (auto wafer : wafers) {
200  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << wafer;
201  ++i;
202  }
203  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: " << covers.size() << " covers";
204  i = 0;
205  for (auto cover : covers) {
206  edm::LogVerbatim("HGCalGeom") << "Cover[" << i << "] " << cover;
207  ++i;
208  }
209 #endif
210  const auto& materials = args.value<std::vector<std::string> >("MaterialNames"); // Material names in each layer
211  const auto& names = args.value<std::vector<std::string> >("VolumeNames"); // Names of each layer
212  const auto& layerThick = args.value<std::vector<double> >("Thickness"); // Thickness of the material
213  std::vector<int> copyNumber; // Copy numbers (initiated to 1)
214  copyNumber.resize(materials.size(), 1);
215 #ifdef EDM_ML_DEBUG
216  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: " << materials.size() << " types of volumes";
217  for (unsigned int i = 0; i < names.size(); ++i)
218  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names[i] << " of thickness "
219  << convertCmToMm(layerThick[i]) << " filled with " << materials[i]
220  << " first copy number " << copyNumber[i];
221 #endif
222  const auto& blockThick = args.value<std::vector<double> >("BlockThick"); // Thickness of each section
223  const auto& inOut = args.value<int>("InOut"); // Number of inner+outer parts
224  const auto& layerFrontIn = args.value<std::vector<int> >("LayerFrontIn"); // First layer index (inner) in block
225  const auto& layerBackIn = args.value<std::vector<int> >("LayerBackIn"); // Last layer index (inner) in block
226  std::vector<int> layerFrontOut; // First layer index (outner) in block
227  std::vector<int> layerBackOut; // Last layer index (outner) in block
228  if (inOut > 1) {
229  layerFrontOut = args.value<std::vector<int> >("LayerFrontOut");
230  layerBackOut = args.value<std::vector<int> >("LayerBackOut");
231  }
232 #ifdef EDM_ML_DEBUG
233  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: " << blockThick.size() << " blocks with in/out " << inOut;
234  for (unsigned int i = 0; i < blockThick.size(); ++i) {
235  if (inOut > 1)
236  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << convertCmToMm(blockThick[i])
237  << " with inner layers " << layerFrontIn[i] << ":" << layerBackIn[i]
238  << " and outer layers " << layerFrontOut[i] << ":" << layerBackOut[i];
239  else
240  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << convertCmToMm(blockThick[i])
241  << " with inner layers " << layerFrontIn[i] << ":" << layerBackIn[i];
242  }
243 #endif
244  const auto& layerType = args.value<std::vector<int> >("LayerType"); // Type of the layer
245  const auto& layerSense = args.value<std::vector<int> >("LayerSense"); // Content of a layer
246  const auto& maxModule = args.value<std::vector<int> >("MaxModule"); // Maximum # of row/column
247 #ifdef EDM_ML_DEBUG
248  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: " << layerType.size() << " layers";
249  for (unsigned int i = 0; i < layerType.size(); ++i)
250  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType[i] << " sensitive class "
251  << layerSense[i] << " and " << maxModule[i] << " maximum row/columns";
252 #endif
253  const auto& zMinBlock = args.value<double>("zMinBlock"); // Starting z-value of the block
254  const auto& rMaxFine = args.value<double>("rMaxFine"); // Maximum r-value for fine wafer
255  const auto& waferW = args.value<double>("waferW"); // Width of the wafer
256  const auto& waferGap = args.value<double>("waferGap"); // Gap between 2 wafers
257  const auto& absorbW = args.value<double>("absorberW"); // Width of the absorber
258  const auto& absorbH = args.value<double>("absorberH"); // Height of the absorber
259  const auto& rMax = args.value<double>("rMax"); // Maximum radial extent
260  const auto& rMaxB = args.value<double>("rMaxB"); // Maximum radial extent of a block
261  double waferTot = waferW + waferGap;
262  std::string idName = DDSplit(args.parentName()).first;
263 #ifdef EDM_ML_DEBUG
264  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: zStart " << convertCmToMm(zMinBlock) << " rFineCoarse "
265  << convertCmToMm(rMaxFine) << " wafer width " << convertCmToMm(waferW)
266  << " gap among wafers " << convertCmToMm(waferGap) << " absorber width "
267  << convertCmToMm(absorbW) << " absorber height " << convertCmToMm(absorbH) << " rMax "
268  << convertCmToMm(rMax) << ":" << convertCmToMm(rMaxB);
269  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: NameSpace " << ns.name() << " Parent Name " << idName;
270 #endif
271  std::unordered_set<int> copies; // List of copy #'s
272  copies.clear();
273 
274  dd4hep::Volume parent = ns.volume(args.parentName());
275  double zi(zMinBlock);
276  for (unsigned int i = 0; i < blockThick.size(); i++) {
277  double zo = zi + blockThick[i];
278  std::string name = idName + "Block" + std::to_string(i);
279 #ifdef EDM_ML_DEBUG
280  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: Block " << i << ":" << name << " z " << convertCmToMm(zi) << ":"
281  << convertCmToMm(zo) << " R " << convertCmToMm(rMaxB) << " T "
282  << convertCmToMm(blockThick[i]);
283 #endif
284  dd4hep::Material matter = ns.material(genMat);
285  dd4hep::Solid solid = dd4hep::Tube(0, rMaxB, 0.5 * blockThick[i], 0.0, 2._pi);
286  ns.addSolidNS(ns.prepend(name), solid);
287  dd4hep::Volume glog = dd4hep::Volume(solid.name(), solid, matter);
288  double zz = zi + 0.5 * blockThick[i];
289  dd4hep::Position r1(0, 0, zz);
290  parent.placeVolume(glog, i, r1);
291 #ifdef EDM_ML_DEBUG
292  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: " << glog.name() << " number " << i << " positioned in "
293  << args.parentName() << " at " << r1 << " with no rotation";
294  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: \t\tInside Block " << i << " Layers " << layerFrontIn[i] << ":"
295  << layerBackIn[i] << " zFront " << convertCmToMm(-0.5 * blockThick[i])
296  << " thickness " << convertCmToMm(blockThick[i]) << " ignore Center 0";
297 #endif
299  wafers,
300  covers,
301  layerType,
302  layerSense,
303  maxModule,
304  names,
305  materials,
306  copyNumber,
307  layerThick,
308  absorbW,
309  absorbH,
310  waferTot,
311  rMax,
312  rMaxFine,
313  copies,
314  layerFrontIn[i],
315  layerBackIn[i],
316  -0.5 * blockThick[i],
317  blockThick[i],
318  false,
319  glog);
320  if (inOut > 1) {
321 #ifdef EDM_ML_DEBUG
322  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: \t\tInside Block " << i << " Layers " << layerFrontOut[i]
323  << ":" << layerBackOut[i] << " zFront " << convertCmToMm(-0.5 * blockThick[i])
324  << " thickness " << convertCmToMm(blockThick[i]) << " ignore Center 1";
325 #endif
327  wafers,
328  covers,
329  layerType,
330  layerSense,
331  maxModule,
332  names,
333  materials,
334  copyNumber,
335  layerThick,
336  absorbW,
337  absorbH,
338  waferTot,
339  rMax,
340  rMaxFine,
341  copies,
342  layerFrontOut[i],
343  layerBackOut[i],
344  -0.5 * blockThick[i],
345  blockThick[i],
346  true,
347  glog);
348  }
349  zi = zo;
350  }
351 #ifdef EDM_ML_DEBUG
352  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModuleX: All blocks are placed in " << convertCmToMm(zMinBlock) << ":"
353  << convertCmToMm(zi) << " with " << copies.size() << " different wafer copy numbers";
354 #endif
355 
356  return cms::s_executed;
357 }

References cms::DDNamespace::addSolidNS(), writedatasetfile::args, DDHGCalGeom::constructLayers(), geant_units::operators::convertCmToMm(), DDSplit(), MillePedeFileConverter_cfg::e, dqmdumpme::first, mps_fire::i, versionedElectronIDProducer_cfi::idName, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, cms::DDNamespace::name(), names, class-composition::parent, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, photonAnalyzer_cfi::rMax, cms::s_executed, AlCaHLTBitMon_QueryRunRegistry::string, cms::DDNamespace::volume(), and geometryCSVtoXML::zz.

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hgcal_DDHGCalTBModuleX   
)

Definition at line 360 of file DDHGCalTBModuleX.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
photonAnalyzer_cfi.rMax
rMax
Definition: photonAnalyzer_cfi.py:91
mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
g4SimHits_cfi.Material
Material
Definition: g4SimHits_cfi.py:560
cms::DDNamespace
Definition: DDNamespace.h:16
versionedElectronIDProducer_cfi.idName
idName
Definition: versionedElectronIDProducer_cfi.py:11
dqmdumpme.first
first
Definition: dqmdumpme.py:55
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
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
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
DDHGCalGeom::constructLayers
void constructLayers(const cms::DDNamespace &ns, const std::vector< std::string > &wafers, const std::vector< std::string > &covers, const std::vector< int > &layerType, const std::vector< int > &layerSense, const std::vector< int > &maxModule, const std::vector< std::string > &names, const std::vector< std::string > &materials, std::vector< int > &copyNumber, const std::vector< double > &layerThick, const double &absorbW, const double &absorbH, const double &waferTot, const double &rMax, const double &rMaxFine, std::unordered_set< int > &copies, int firstLayer, int lastLayer, double zFront, double totalWidth, bool ignoreCenter, dd4hep::Volume &module)
Definition: DDHGCalTBModuleX.cc:22
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::Log
Definition: MessageLogger.h:70
class-composition.parent
parent
Definition: class-composition.py:88
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37