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

add a label to indentify the PFProducer calibrations #12044

Merged
merged 1 commit into from
Oct 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import FWCore.ParameterSet.Config as cms

# reusable functions
def producers_by_type(process, type):
return (module for module in process._Process__producers.values() if module._TypedParameterizable__type == type)


# Update to replace old jet corrector mechanism
from HLTrigger.Configuration.customizeHLTforNewJetCorrectors import customizeHLTforNewJetCorrectors

Expand Down Expand Up @@ -55,9 +60,6 @@ def customiseFor8356(process):
input = cms.InputTag( 'hltL2Muons','UpdatedAtVtx' )
)

def producers_by_type(process, type):
return (module for module in process._Process__producers.values() if module._TypedParameterizable__type == type)

for l3MPModule in producers_by_type(process, 'L3MuonProducer'):
if hasattr(l3MPModule, 'GlbRefitterParameters'):
l3MPModule.GlbRefitterParameters.RefitFlag = cms.bool(True)
Expand Down Expand Up @@ -175,12 +177,22 @@ def replaceInPSet(pset, moduleLabel):

return process


def customiseFor11497(process):
# Take care of CaloTowerTopology
if not hasattr(process,'CaloTowerTopologyEP'):
process.CaloTowerTopologyEP = cms.ESProducer( 'CaloTowerTopologyEP' )
return process


def customiseFor12044(process):
# add a label to indentify the PFProducer calibrations
for module in producers_by_type(process, 'PFProducer'):
if not 'calibrationsLabel' in module.__dict__:
module.calibrationsLabel = cms.string('')
return process


# CMSSW version specific customizations
def customiseHLTforCMSSW(process, menuType="GRun", fastSim=False):
import os
Expand All @@ -192,6 +204,7 @@ def customiseHLTforCMSSW(process, menuType="GRun", fastSim=False):
process = customiseFor10911(process)
process = customiseFor11183(process)
process = customiseFor11497(process)
process = customiseFor12044(process)
if cmsswVersion >= "CMSSW_7_5":
process = customiseFor10927(process)
process = customiseFor9232(process)
Expand Down
13 changes: 8 additions & 5 deletions RecoParticleFlow/PFProducer/plugins/PFProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ PFProducer::PFProducer(const edm::ParameterSet& iConfig) {
// fToRead = iConfig.getUntrackedParameter<vector<string> >("toRead");

useCalibrationsFromDB_
= iConfig.getParameter<bool>("useCalibrationsFromDB");
= iConfig.getParameter<bool>("useCalibrationsFromDB");

if (useCalibrationsFromDB_)
calibrationsLabel_ = iConfig.getParameter<std::string>("calibrationsLabel");

boost::shared_ptr<PFEnergyCalibration>
calibration( new PFEnergyCalibration() );
Expand Down Expand Up @@ -424,11 +427,11 @@ PFProducer::beginRun(const edm::Run & run,
*/

if ( useCalibrationsFromDB_ ) {
// Read the PFCalibration functions from the global tags.
// read the PFCalibration functions from the global tags
edm::ESHandle<PerformancePayload> perfH;
es.get<PFCalibrationRcd>().get(perfH);
const PerformancePayloadFromTFormula *pfCalibrations = static_cast< const PerformancePayloadFromTFormula *>(perfH.product());
es.get<PFCalibrationRcd>().get(calibrationsLabel_, perfH);

PerformancePayloadFromTFormula const * pfCalibrations = static_cast< const PerformancePayloadFromTFormula *>(perfH.product());

pfAlgo_->thePFEnergyCalibration()->setCalibrationFunctions(pfCalibrations);
}
Expand Down
2 changes: 1 addition & 1 deletion RecoParticleFlow/PFProducer/plugins/PFProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class PFProducer : public edm::stream::EDProducer<> {

// Take PF cluster calibrations from Global Tag ?
bool useCalibrationsFromDB_;

std::string calibrationsLabel_;

bool postHFCleaning_;
// Name of the calibration functions to read from the database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@

# ECAL/HCAL PF cluster calibration : take it from global tag ?
useCalibrationsFromDB = cms.bool(True),
calibrationsLabel = cms.string(''),

# calibration parameters for HF:
calibHF_use = cms.bool(False),
Expand Down
1 change: 1 addition & 0 deletions RecoParticleFlow/PFProducer/python/particleFlow_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@

# ECAL/HCAL PF cluster calibration : take it from global tag ?
useCalibrationsFromDB = cms.bool(True),
calibrationsLabel = cms.string(''),

# calibration parameters for HF:
calibHF_use = cms.bool(False),
Expand Down