Skip to content

Commit

Permalink
Merge pull request #27783 from bsunanda/Phase2-hgx212
Browse files Browse the repository at this point in the history
Phase2-hgx212 Rearrange Geometry/HGCalCommonData in view of DD4Hep transition
  • Loading branch information
cmsbuild committed Aug 23, 2019
2 parents dc71c16 + 163c416 commit 7408a92
Show file tree
Hide file tree
Showing 32 changed files with 346 additions and 68 deletions.
@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<DDDefinition>
<debug>
<debug_shapes/>
<debug_includes/>
<debug_rotations/>
<debug_includes/>
<debug_volumes/>
<debug_constants/>
<!-- debug_materials/ -->
<debug_namespaces/>
<debug_placements/>
<debug_algorithms/>

<!--
<debug_materials/>
<debug_visattr/>
-->
</debug>

<open_geometry/>
<close_geometry/>

<IncludeSection>
<Include ref="Geometry/CMSCommonData/data/materials.xml"/>
<Include ref="Geometry/CMSCommonData/data/rotations.xml"/>
<Include ref="Geometry/CMSCommonData/data/extend/cmsextent.xml"/>
<Include ref="Geometry/CMSCommonData/data/cms/2019/v1/cms.xml"/>
<Include ref="Geometry/CMSCommonData/data/eta3/etaMax.xml"/>
<Include ref="Geometry/CMSCommonData/data/cmsMother.xml"/>
<Include ref="Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml"/>
<Include ref="Geometry/CMSCommonData/data/cmsCalo.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml"/>
</IncludeSection>

</DDDefinition>

@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<DDDefinition>
<debug>
<debug_shapes/>
<debug_includes/>
<debug_rotations/>
<debug_includes/>
<debug_volumes/>
<debug_constants/>
<!-- debug_materials/ -->
<debug_namespaces/>
<debug_placements/>
<debug_algorithms/>

<!--
<debug_materials/>
<debug_visattr/>
-->
</debug>

<open_geometry/>
<close_geometry/>

<IncludeSection>
<Include ref="Geometry/CMSCommonData/data/materials.xml"/>
<Include ref="Geometry/CMSCommonData/data/rotations.xml"/>
<Include ref="Geometry/CMSCommonData/data/extend/cmsextent.xml"/>
<Include ref="Geometry/CMSCommonData/data/cms/2019/v1/cms.xml"/>
<Include ref="Geometry/CMSCommonData/data/eta3/etaMax.xml"/>
<Include ref="Geometry/CMSCommonData/data/cmsMother.xml"/>
<Include ref="Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml"/>
<Include ref="Geometry/CMSCommonData/data/cmsCalo.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml"/>
</IncludeSection>

</DDDefinition>

@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<DDDefinition>
<debug>
<debug_shapes/>
<debug_includes/>
<debug_rotations/>
<debug_includes/>
<debug_volumes/>
<debug_constants/>
<!-- debug_materials/ -->
<debug_namespaces/>
<debug_placements/>
<debug_algorithms/>

<!--
<debug_materials/>
<debug_visattr/>
-->
</debug>

<open_geometry/>
<close_geometry/>

<IncludeSection>
<Include ref="Geometry/CMSCommonData/data/materials.xml"/>
<Include ref="Geometry/CMSCommonData/data/rotations.xml"/>
<Include ref="Geometry/CMSCommonData/data/extend/cmsextent.xml"/>
<Include ref="Geometry/CMSCommonData/data/cms/2019/v1/cms.xml"/>
<Include ref="Geometry/CMSCommonData/data/eta3/etaMax.xml"/>
<Include ref="Geometry/CMSCommonData/data/cmsMother.xml"/>
<Include ref="Geometry/CMSCommonData/data/caloBase/2026/v1/caloBase.xml"/>
<Include ref="Geometry/CMSCommonData/data/cmsCalo.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml"/>
</IncludeSection>

</DDDefinition>

@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<DDDefinition>
<debug>
<debug_shapes/>
<debug_includes/>
<debug_rotations/>
<debug_includes/>
<debug_volumes/>
<debug_constants/>
<!-- debug_materials/ -->
<debug_namespaces/>
<debug_placements/>
<debug_algorithms/>

<!--
<debug_materials/>
<debug_visattr/>
-->
</debug>

<open_geometry/>
<close_geometry/>

<IncludeSection>
<Include ref="Geometry/CMSCommonData/data/materials.xml"/>
<Include ref="Geometry/CMSCommonData/data/rotations.xml"/>
<Include ref="Geometry/HGCalCommonData/test/cms.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalcell/v9/hgcal.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml"/>
</IncludeSection>

</DDDefinition>

53 changes: 40 additions & 13 deletions Geometry/HGCalCommonData/plugins/BuildFile.xml
@@ -1,14 +1,41 @@
<use name="DetectorDescription/Parser"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="Geometry/HGCalCommonData"/>
<use name="Geometry/Records"/>
<use name="CondFormats/GeometryObjects"/>
<use name="FWCore/MessageLogger"/>
<use name="DetectorDescription/Core"/>
<library name="GeometryHGCalCommonDataPlugin" file="DD*.cc">
<use name="CondFormats/GeometryObjects"/>
<use name="DetectorDescription/Core"/>
<use name="DetectorDescription/Parser"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/PluginManager"/>
<use name="Geometry/HGCalCommonData"/>
<use name="Geometry/Records"/>
<flags EDM_PLUGIN="1"/>
</library>

<flags EDM_PLUGIN="1"/>
<library file="DD*.cc,module.cc" name="GeometryHGCalCommonDataPlugin"> </library>
<library file="HGCal*.cc" name="GeometryHGCalCommonDataESModules"> </library>
<library file="FastTime*.cc" name="GeometryHGCalCommonDataFastTimeESModules"> </library>
<library name="GeometryHGCalCommonDataESModules" file="HGCal*.cc">
<use name="DetectorDescription/Core"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/PluginManager"/>
<use name="Geometry/HGCalCommonData"/>
<use name="Geometry/Records"/>
<flags EDM_PLUGIN="1"/>
</library>

<library name="GeometryHGCalCommonDataFastTimeESModules" file="FastTime*.cc">
<use name="DetectorDescription/Core"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/PluginManager"/>
<use name="Geometry/HGCalCommonData"/>
<use name="Geometry/Records"/>
<flags EDM_PLUGIN="1"/>
</library>

<library name="DD4hep_GeometryHGCalCommonDataPlugins" file="dd4hep/*.cc">
<use name="DetectorDescription/DDCMS"/>
<use name="dd4hep"/>
<lib name="Geom"/>
<flags DD4HEP_PLUGIN="1"/>
</library>
47 changes: 46 additions & 1 deletion Geometry/HGCalCommonData/plugins/DDAHcalModuleAlgo.cc
Expand Up @@ -5,19 +5,62 @@

#include <algorithm>
#include <cmath>
#include <string>
#include <unordered_set>
#include <vector>

#include "DetectorDescription/Core/interface/DDAlgorithm.h"
#include "DetectorDescription/Core/interface/DDAlgorithmFactory.h"
#include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDSplit.h"
#include "DetectorDescription/Core/interface/DDTypes.h"
#include "DetectorDescription/Core/interface/DDutils.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/PluginManager/interface/PluginFactory.h"
#include "Geometry/HGCalCommonData/interface/AHCalParameters.h"
#include "Geometry/HGCalCommonData/plugins/DDAHcalModuleAlgo.h"

//#define EDM_ML_DEBUG

class DDAHcalModuleAlgo : public DDAlgorithm {
public:
// Constructor and Destructor
DDAHcalModuleAlgo(); // const std::string & name);
~DDAHcalModuleAlgo() override;

void initialize(const DDNumericArguments& nArgs,
const DDVectorArguments& vArgs,
const DDMapArguments& mArgs,
const DDStringArguments& sArgs,
const DDStringVectorArguments& vsArgs) override;
void execute(DDCompactView& cpv) override;

protected:
void constructLayers(const DDLogicalPart&, DDCompactView& cpv);
void positionSensitive(DDLogicalPart& glog, DDCompactView& cpv);

private:
std::string tile; // Scintillator tile
std::vector<std::string> materials; // Materials
std::vector<std::string> names; // Names
std::vector<double> thick; // Thickness of the material
std::vector<int> copyNumber; // Initial copy numbers
std::vector<int> layers; // Number of layers in a section
std::vector<double> layerThick; // Thickness of each section
std::vector<int> layerType; // Type of the layer
std::vector<int> layerSense; // Content of a layer (sensitive?)
std::vector<double> widths; // Width (passive, active)
std::vector<double> heights; // Heights (passive, active)
std::vector<int> tileN; // # of tiles (along x, y)
std::vector<double> tileStep; // Separation between tiles (x, y)
double zMinBlock; // Starting z-value of the block
std::string idName; // Name of the "parent" volume.
std::string idNameSpace; // Namespace of this and ALL sub-parts
std::unordered_set<int> copies; // List of copy #'s
};

DDAHcalModuleAlgo::DDAHcalModuleAlgo() {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: Creating an instance";
Expand Down Expand Up @@ -202,3 +245,5 @@ void DDAHcalModuleAlgo::positionSensitive(DDLogicalPart& glog, DDCompactView& cp
edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << kount << " tiles for " << glog.ddname();
#endif
}

DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDAHcalModuleAlgo, "hgcal:DDAHcalModuleAlgo");
48 changes: 0 additions & 48 deletions Geometry/HGCalCommonData/plugins/DDAHcalModuleAlgo.h

This file was deleted.

Expand Up @@ -13,6 +13,7 @@ static long algorithm(dd4hep::Detector& /* description */,
dd4hep::SensitiveDetector& /* sens */) {
cms::DDNamespace ns(ctxt, e, true);
cms::DDAlgoArguments args(ctxt, e);
std::string nsName = static_cast<std::string>(ns.name());
// Header section of original DDHGCalWafer.h
double waferSize = args.value<double>("WaferSize");
int cellType = args.value<int>("CellType");
Expand All @@ -23,7 +24,7 @@ static long algorithm(dd4hep::Detector& /* description */,
std::vector<int> angleEdges = args.value<std::vector<int> >("AngleEdges");
std::vector<int> detectorType = args.value<std::vector<int> >("DetectorType");
std::string parentName = args.parentName();
dd4hep::Volume mother = ns.volume(parentName);
dd4hep::Volume mother = ns.volume(args.parentName());
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << childNames.size() << " children: " << childNames[0] << "; " << childNames[1]
<< " positioned in " << nCellsRow.size() << " rows and " << nColumns
Expand Down Expand Up @@ -66,11 +67,12 @@ static long algorithm(dd4hep::Detector& /* description */,
double phiy = convertDegToRad(90 + irot);
rotation = cms::makeRotation3D(90._deg, phix, 90._deg, phiy, 0., 0.);
}
std::string namx = nsName + name;
double xpos = dx * nx;
nx += incAlongX;
dd4hep::Position tran(xpos, ypos, 0);
int copy = cellType * 1000 + kount;
mother.placeVolume(ns.volume(name), copy, dd4hep::Transform3D(rotation, tran));
mother.placeVolume(ns.volume(namx), copy, dd4hep::Transform3D(rotation, tran));
++kount;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer: " << name << " number " << copy << " positioned in " << parentName
Expand Down
4 changes: 0 additions & 4 deletions Geometry/HGCalCommonData/plugins/module.cc

This file was deleted.

25 changes: 25 additions & 0 deletions Geometry/HGCalCommonData/test/python/testHGCalCellGeometry_cfg.py
@@ -0,0 +1,25 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("DDHGCalCellTest")

process.load('FWCore.MessageService.MessageLogger_cfi')
process.source = cms.Source("EmptySource")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)

process.MessageLogger.cerr.FwkReport.reportEvery = 5
if hasattr(process,'MessageLogger'):
process.MessageLogger.categories.append('HGCalGeom')

process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer",
confGeomXMLFiles = cms.FileInPath('Geometry/HGCalCommonData/data/dd4hep/cms-test-ddhgcalcell-algorithm.xml'),
appendToDataLabel = cms.string('DDHGCalCell')
)

process.testDump = cms.EDAnalyzer("DDTestDumpFile",
outputFileName = cms.untracked.string('hgcalcellDD4Hep.root'),
DDDetector = cms.ESInputTag('','DDHGCalCell')
)

process.p = cms.Path(process.testDump)

0 comments on commit 7408a92

Please sign in to comment.