Skip to content

Commit

Permalink
Merge pull request #30125 from vargasa/tmx
Browse files Browse the repository at this point in the history
DD4hep: SimTracker/TrackerMaterialAnalysis Migrated plugin Test
  • Loading branch information
cmsbuild committed Jun 8, 2020
2 parents 1b0ecb3 + 2144981 commit 3f8a32a
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 3 deletions.
@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<DDDefinition xmlns="http://www.cern.ch/cms/DDL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd">

<IncludeSection>
<Include ref="Geometry/CMSCommonData/data/materials.xml"/>
<Include ref="Geometry/TrackerCommonData/data/trackermaterial.xml"/>
<Include ref="Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2026D41.xml"/>
</IncludeSection>

<SpecParSection label="spec-pars2.xml">
<SpecPar name="TrackerRecMaterialPixelBarrelLayer0_Z0">
<PartSelector path="//Tracker/PixelBarrel/PixelBarrelLayer0/PixelBarrelLadderFull/PixelBarrelModuleBoxFull/PixelBarrelModuleFullPlus[1]/PixelBarrelSensorFull/PixelBarrelActiveFull" />
Expand Down
Expand Up @@ -41,6 +41,7 @@ DD4hep_TrackingMaterialAnalyser::DD4hep_TrackingMaterialAnalyser(const edm::Para
<< "Invalid SplitMode \"" << splitmode
<< "\". Acceptable values are \"NearestLayer\", \"InnerLayer\", \"OuterLayer\".";
}
m_tag = iPSet.getParameter<edm::ESInputTag>("DDDetector");
m_skipAfterLastDetector = iPSet.getParameter<bool>("SkipAfterLastDetector");
m_skipBeforeFirstDetector = iPSet.getParameter<bool>("SkipBeforeFirstDetector");
m_saveSummaryPlot = iPSet.getParameter<bool>("SaveSummaryPlot");
Expand Down Expand Up @@ -149,7 +150,7 @@ void DD4hep_TrackingMaterialAnalyser::endJob(void) {
void DD4hep_TrackingMaterialAnalyser::analyze(const edm::Event& event, const edm::EventSetup& setup) {
using namespace edm;
ESTransientHandle<cms::DDCompactView> hDDD;
setup.get<IdealGeometryRecord>().get(hDDD);
setup.get<IdealGeometryRecord>().get(m_tag, hDDD);

m_groups.reserve(m_groupNames.size());
// Initialize m_groups iff it has size equal to zero, so that we are
Expand Down
Expand Up @@ -33,6 +33,7 @@ class DD4hep_TrackingMaterialAnalyser : public edm::one::EDAnalyzer<> {
void saveLayerPlots();

edm::EDGetTokenT<std::vector<MaterialAccountingTrack> > m_materialToken;
edm::ESInputTag m_tag;
SplitMode m_splitMode;
bool m_skipAfterLastDetector;
bool m_skipBeforeFirstDetector;
Expand Down
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# Analyze and plot the tracking material
from SimTracker.TrackerMaterialAnalysis.trackingMaterialAnalyser_ForPhaseII_dd4hep_cfi import *
@@ -0,0 +1,46 @@
import FWCore.ParameterSet.Config as cms

trackingMaterialAnalyser = cms.EDAnalyzer("DD4hep_TrackingMaterialAnalyser",
MaterialAccounting = cms.InputTag("trackingMaterialProducer"),
SplitMode = cms.string("NearestLayer"),
DDDetector = cms.ESInputTag("","CMS"),
SkipBeforeFirstDetector = cms.bool(False),
SkipAfterLastDetector = cms.bool(True),
SaveSummaryPlot = cms.bool(True),
SaveDetailedPlots = cms.bool(False),
SaveParameters = cms.bool(True),
SaveXML = cms.bool(True),
isHGCal = cms.bool(False),
isHFNose = cms.bool(False),
# to derive the following list:
# cat ../data/trackingMaterialGroups_ForPhaseII.xml | grep TrackingMaterialGroup | sed -e 's/\s*//' | cut -d ' ' -f 3 | tr '=' ' ' | cut -d ' ' -f 2 | tr -d '"' | sed -e 's/\(.*\)/"\1",/'
Groups = cms.vstring(
"TrackerRecMaterialPhase2PixelBarrelLayer1",
"TrackerRecMaterialPhase2PixelBarrelLayer2",
"TrackerRecMaterialPhase2PixelBarrelLayer3",
"TrackerRecMaterialPhase2PixelBarrelLayer4",
"TrackerRecMaterialPhase2PixelForwardDisk1",
"TrackerRecMaterialPhase2PixelForwardDisk2",
"TrackerRecMaterialPhase2PixelForwardDisk3",
"TrackerRecMaterialPhase2PixelForwardDisk4",
"TrackerRecMaterialPhase2PixelForwardDisk5",
"TrackerRecMaterialPhase2PixelForwardDisk6",
"TrackerRecMaterialPhase2PixelForwardDisk7",
"TrackerRecMaterialPhase2PixelForwardDisk8",
"TrackerRecMaterialPhase2PixelForwardDisk9",
"TrackerRecMaterialPhase2PixelForwardDisk10",
"TrackerRecMaterialPhase2PixelForwardDisk11",
"TrackerRecMaterialPhase2PixelForwardDisk12",
"TrackerRecMaterialPhase2OTBarrelLayer1",
"TrackerRecMaterialPhase2OTBarrelLayer2",
"TrackerRecMaterialPhase2OTBarrelLayer3",
"TrackerRecMaterialPhase2OTBarrelLayer4",
"TrackerRecMaterialPhase2OTBarrelLayer5",
"TrackerRecMaterialPhase2OTBarrelLayer6",
"TrackerRecMaterialPhase2OTForwardDisk1",
"TrackerRecMaterialPhase2OTForwardDisk2",
"TrackerRecMaterialPhase2OTForwardDisk3",
"TrackerRecMaterialPhase2OTForwardDisk4",
"TrackerRecMaterialPhase2OTForwardDisk5"
)
)
@@ -0,0 +1,47 @@
#! /usr/bin/env cmsRun

import FWCore.ParameterSet.Config as cms

process = cms.Process("MaterialAnalyser")

process.DDDetectorESProducer = cms.ESSource(
"DDDetectorESProducer",
confGeomXMLFiles = cms.FileInPath('SimTracker/TrackerMaterialAnalysis/data/dd4hep_trackingMaterialGroups.xml'),
appendToDataLabel = cms.string('CMS')
)

from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff import *
from SLHCUpgradeSimulations.Geometry.fakeConditions_phase2TkT14_cff import *
from Geometry.EcalCommonData.ecalSimulationParameters_cff import *
from Geometry.HcalCommonData.hcalDDDSimConstants_cff import *
from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import *
from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import *
from Geometry.MuonNumbering.muonGeometryConstants_cff import *
from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import *

process.load('FWCore.MessageService.MessageLogger_cfi')

process.DDCompactViewESProducer = cms.ESProducer(
"DDCompactViewESProducer",
appendToDataLabel = cms.string('CMS')
)

# Analyze and plot the tracking material
process.load("SimTracker.TrackerMaterialAnalysis.trackingMaterialAnalyser_ForPhaseII_dd4hep_cff")
process.trackingMaterialAnalyser.SplitMode = "NearestLayer"
process.trackingMaterialAnalyser.SaveParameters = True
process.trackingMaterialAnalyser.SaveXML = True
process.trackingMaterialAnalyser.SaveDetailedPlots = False

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring('file:material.root')
)

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)

process.MessageLogger.destinations.extend(["LogTrackingMaterialAnalysis"])
process.MessageLogger.categories.append("TrackingMaterialAnalysis")
process.path = cms.Path(process.trackingMaterialAnalyser)

3 changes: 1 addition & 2 deletions SimTracker/TrackerMaterialAnalysis/test/listIds_dd4hep.py
Expand Up @@ -27,8 +27,7 @@


process.DDSpecParRegistryESProducer = cms.ESProducer(
"DDSpecParRegistryESProducer",
appendToDataLabel = cms.string('CMS')
"DDSpecParRegistryESProducer"
)

process.DDCompactViewESProducer = cms.ESProducer(
Expand Down

0 comments on commit 3f8a32a

Please sign in to comment.