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

◆ algorithm()

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

Definition at line 191 of file DDHGCalTBModuleX.cc.

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

References cms::DDNamespace::addSolidNS(), writedatasetfile::args, DDHGCalGeom::constructLayers(), geant_units::operators::convertCmToMm(), DDSplit(), MillePedeFileConverter_cfg::e, 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, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, photonAnalyzer_cfi::rMax, 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 367 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:355
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
g4SimHits_cfi.Material
Material
Definition: g4SimHits_cfi.py:547
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:122
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:62
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:45
geant_units::operators::convertCmToMm
constexpr NumType convertCmToMm(NumType centimeters)
Definition: GeantUnits.h:68
edm::LogVerbatim
Definition: MessageLogger.h:297
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
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:21
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
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