Skip to content

Commit

Permalink
Merge pull request #30280 from bsunanda/Run3-gem41
Browse files Browse the repository at this point in the history
Run3-gem41 Update the RPC ESModule so that it can follow the ERA easily
  • Loading branch information
cmsbuild authored Jun 24, 2020
2 parents f18f5a7 + 8ce8c6a commit 3e445fe
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 116 deletions.
4 changes: 4 additions & 0 deletions Geometry/RPCGeometry/python/rpcGeometryInMTCC_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# kept for backward compatibility
from Geometry.RPCGeometryBuilder.rpcGeometry_cfi import *
10 changes: 2 additions & 8 deletions Geometry/RPCGeometry/python/rpcGeometry_cfi.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import FWCore.ParameterSet.Config as cms

#
# This cfi should be included to build the RPC geometry model.
#
RPCGeometryESModule = cms.ESProducer("RPCGeometryESModule",
useDDD = cms.untracked.bool(True)
)


# kept for backward compatibility
from Geometry.RPCGeometryBuilder.rpcGeometry_cfi import *
51 changes: 42 additions & 9 deletions Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,46 @@ DD4hep part added to the original old file (DD version) made by M. Maggi (INFN B
// Created: Fri, 20 Sep 2019
// Modified: Fri, 29 May 2020, following what Sunanda Banerjee made in PR #29842 PR #29943 and Ianna Osborne in PR #29954
*/
#include "Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.h"
#include "CondFormats/GeometryObjects/interface/RecoIdealGeometry.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "DetectorDescription/DDCMS/interface/DDCompactView.h"
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "Geometry/MuonNumbering/interface/MuonGeometryConstants.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/Records/interface/RPCRecoGeometryRcd.h"
#include "Geometry/RPCGeometryBuilder/src/RPCGeometryBuilder.h"
#include "Geometry/RPCGeometryBuilder/src/RPCGeometryBuilderFromCondDB.h"
#include "Geometry/MuonNumbering/interface/MuonGeometryConstants.h"
#include "Geometry/MuonNumbering/interface/MuonBaseNumber.h"
#include <FWCore/Framework/interface/EventSetup.h>
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include <FWCore/Framework/interface/ESHandle.h>
#include <FWCore/Framework/interface/ModuleFactory.h>
#include <FWCore/Framework/interface/ESProducer.h>
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"
#include <unordered_map>
#include <memory>

using namespace edm;
class RPCGeometryESModule : public edm::ESProducer {
public:
RPCGeometryESModule(const edm::ParameterSet& p);

static void fillDescriptions(edm::ConfigurationDescriptions&);

std::unique_ptr<RPCGeometry> produce(const MuonGeometryRecord& record);

private:
//DDD
edm::ESGetToken<DDCompactView, IdealGeometryRecord> idealGeomToken_;
edm::ESGetToken<MuonGeometryConstants, IdealGeometryRecord> dddConstantsToken_;
// dd4hep
edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> idealDD4hepGeomToken_;
// Reco
edm::ESGetToken<RecoIdealGeometry, RPCRecoGeometryRcd> recoIdealToken_;

const bool useDDD_;
const bool useDD4hep_;
};

RPCGeometryESModule::RPCGeometryESModule(const edm::ParameterSet& p)
: useDDD_{p.getUntrackedParameter<bool>("useDDD", true)},
Expand All @@ -37,6 +63,13 @@ RPCGeometryESModule::RPCGeometryESModule(const edm::ParameterSet& p)
}
}

void RPCGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.addUntracked<bool>("useDDD", true);
desc.addUntracked<bool>("useDD4hep", false);
descriptions.add("RPCGeometryESModule", desc);
}

std::unique_ptr<RPCGeometry> RPCGeometryESModule::produce(const MuonGeometryRecord& record) {
if (useDDD_) {
edm::ESTransientHandle<DDCompactView> cpv = record.getTransientHandle(idealGeomToken_);
Expand Down
43 changes: 0 additions & 43 deletions Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.h

This file was deleted.

3 changes: 2 additions & 1 deletion Geometry/RPCGeometryBuilder/python/rpcGeometryDB_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# This cfi should be included to build the RPC geometry model.
#
RPCGeometryESModule = cms.ESProducer("RPCGeometryESModule",
useDDD = cms.untracked.bool(False)
useDDD = cms.untracked.bool(False),
useDD4hep = cms.untracked.bool(False)
)


12 changes: 4 additions & 8 deletions Geometry/RPCGeometryBuilder/python/rpcGeometry_cfi.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import FWCore.ParameterSet.Config as cms

#
# This cfi should be included to build the RPC geometry model.
#
RPCGeometryESModule = cms.ESProducer("RPCGeometryESModule",
useDDD = cms.untracked.bool(True)
)
from Geometry.RPCGeometryBuilder.RPCGeometryESModule_cfi import RPCGeometryESModule as _RPCGeometryESModuleDefault
RPCGeometryESModule = _RPCGeometryESModuleDefault.clone()

from Configuration.ProcessModifiers.dd4hep_cff import dd4hep

dd4hep.toModify(RPCGeometryESModule, useDDD = False, useDD4hep = True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep

process = cms.Process('VALID',Run3_dd4hep)

process.source = cms.Source('EmptySource')

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

process.load('Configuration.StandardSequences.DD4hep_GeometrySim_cff')
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.load("Geometry.MuonNumbering.muonGeometryConstants_cff")
process.load("Geometry.RPCGeometryBuilder.rpcGeometry_cfi")

process.valid = cms.EDAnalyzer("RPCGeometryValidate",
infileName = cms.untracked.string('cmsRecoGeom-2021.root'),
outfileName = cms.untracked.string('validateRPCGeometry.root'),
tolerance = cms.untracked.int32(7)
)

process.p = cms.Path(process.valid)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run3_cff import Run3

process = cms.Process('VALID',Run3)

process.source = cms.Source('EmptySource')

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

process.load('Configuration.Geometry.GeometryExtended2021_cff')
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.load("Geometry.MuonNumbering.muonGeometryConstants_cff")
process.load("Geometry.RPCGeometryBuilder.rpcGeometry_cfi")

process.valid = cms.EDAnalyzer("RPCGeometryValidate",
infileName = cms.untracked.string('cmsRecoGeom-2021.root'),
outfileName = cms.untracked.string('validateRPCGeometry.root'),
tolerance = cms.untracked.int32(7)
)

process.p = cms.Path(process.valid)
47 changes: 0 additions & 47 deletions Geometry/RPCGeometryBuilder/test/python/validateRPCGeometry_cfg.py

This file was deleted.

25 changes: 25 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,35 @@ def customiseFor2017DtUnpacking(process):

return process

def customiseFor30280(process):
"""Adapt the HLT to adapt the recent changed in Muon Geometry"""

if hasattr(process,'RPCGeometryESModule'):
process.RPCGeometryESModule = cms.ESProducer( "RPCGeometryESModule",
useDDD = cms.untracked.bool( False ),
useDD4hep = cms.untracked.bool( False )
)
if hasattr(process,'CSCGeometryESModule'):
process.CSCGeometryESModule = cms.ESProducer( "CSCGeometryESModule",
useRealWireGeometry = cms.bool( True ),
appendToDataLabel = cms.string( "" ),
alignmentsLabel = cms.string( "" ),
useGangedStripsInME1a = cms.bool( False ),
debugV = cms.untracked.bool( False ),
useOnlyWiresInME1a = cms.bool( False ),
useDDD = cms.bool( False ),
useDD4hep = cms.bool( False ),
useCentreTIOffsets = cms.bool( False ),
applyAlignment = cms.bool( True )
)

return process

# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):

# add call to action function in proper order: newest last!
# process = customiseFor12718(process)
process = customiseFor30060(process, menuType)
process = customiseFor30280(process)
return process

0 comments on commit 3e445fe

Please sign in to comment.