CMS 3D CMS Logo

Namespaces | Functions
DDHGCalTBModuleX.cc File Reference
#include <unordered_set>
#include "DataFormats/Math/interface/angle_units.h"
#include "DD4hep/DetFactoryHelper.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 "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 193 of file DDHGCalTBModuleX.cc.

References cms::DDNamespace::addSolidNS(), writedatasetfile::args, DDHGCalGeom::constructLayers(), cms::convert2mm(), DDSplit(), MillePedeFileConverter_cfg::e, 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, cond::impl::to_string(), cms::DDNamespace::volume(), and geometryCSVtoXML::zz.

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

Definition at line 364 of file DDHGCalTBModuleX.cc.