Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase2-hgx212 Rearrange Geometry/HGCalCommonData in view of DD4Hep transition #27783

Merged
merged 3 commits into from Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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.

4 changes: 0 additions & 4 deletions Geometry/HGCalCommonData/plugins/module.cc

This file was deleted.

25 changes: 25 additions & 0 deletions Geometry/HGCalCommonData/test/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)
25 changes: 25 additions & 0 deletions Geometry/HGCalCommonData/test/testHGCalEEGeometry_cfg.py
@@ -0,0 +1,25 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("DDHGCalEETest")

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-ddhgcalEE-algorithm.xml'),
appendToDataLabel = cms.string('DDHGCalEE')
)

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

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