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"

Go to the source code of this file.

Namespaces

 DDHGCalGeom
 

Functions

static long algorithm (dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)
 
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

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

Definition at line 192 of file DDHGCalTBModuleX.cc.

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

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

Definition at line 368 of file DDHGCalTBModuleX.cc.