CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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.

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 }

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, cms::DDNamespace::volume(), and geometryCSVtoXML::zz.

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_hgcal_DDHGCalTBModuleX   
)

Definition at line 364 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:594
cms::DDNamespace
Definition: DDNamespace.h:22
versionedElectronIDProducer_cfi.idName
idName
Definition: versionedElectronIDProducer_cfi.py:11
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:83
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
cms::convert2mm
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:23
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:98
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