Skip to content

Commit

Permalink
Merge pull request #12100 from fwyzard/HLT_use_dedicated_calibrations
Browse files Browse the repository at this point in the history
use dedicated calibrations at HLT
  • Loading branch information
davidlange6 committed Oct 28, 2015
2 parents 8dbaa61 + cb1273c commit 0454537
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Configuration/AlCa/python/autoCond.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
# GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2
'run2_mc_hi' : '76X_mcRun2_HeavyIon_v10',
# GlobalTag for Run1 data reprocessing
'run1_data' : '76X_dataRun1_v9',
'run1_data' : '76X_dataRun1_v10',
# GlobalTag for Run2 data reprocessing
'run2_data' : '76X_dataRun2_v9',
'run2_data' : '76X_dataRun2_v10',
# GlobalTag for Run1 HLT: it points to the online GT
'run1_hlt' : '76X_dataRun1_HLT_frozen_v9',
# GlobalTag for Run2 HLT: it points to the online GT
Expand Down
20 changes: 17 additions & 3 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
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)
def producers_by_type(process, *types):
return (module for module in process._Process__producers.values() if module._TypedParameterizable__type in types)

def esproducers_by_type(process, *types):
return (module for module in process._Process__esproducers.values() if module._TypedParameterizable__type in types)


# Update to replace old jet corrector mechanism
Expand Down Expand Up @@ -184,13 +187,23 @@ def customiseFor11497(process):
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('')
module.calibrationsLabel = cms.string('HLT')
return process


def customiseFor12062(process):
# add a label to indentify the b-tagging calibrations
for module in esproducers_by_type(process, 'CombinedSecondaryVertexESProducer'):
if not 'recordLabel' in module.__dict__:
module.recordLabel = cms.string('HLT')
return process


# CMSSW version specific customizations
def customiseHLTforCMSSW(process, menuType="GRun", fastSim=False):
import os
Expand All @@ -203,6 +216,7 @@ def customiseHLTforCMSSW(process, menuType="GRun", fastSim=False):
process = customiseFor11183(process)
process = customiseFor11497(process)
process = customiseFor12044(process)
process = customiseFor12062(process)
if cmsswVersion >= "CMSSW_7_5":
process = customiseFor10927(process)
process = customiseFor9232(process)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'CombinedSVRecoVertexSoftElectronCvsL',
'CombinedSVPseudoVertexSoftElectronCvsL',
'CombinedSVNoVertexSoftElectronCvsL'),
recordLabel = cms.string(''),
categoryVariableName = cms.string('vertexLeptonCategory')
)

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
candidateCombinedMVAComputer = cms.ESProducer("CombinedMVAJetTagESProducer",
useCategories = cms.bool(False),
calibrationRecord = cms.string('CombinedMVA'),
recordLabel = cms.string(''),
jetTagComputers = cms.VPSet(
cms.PSet(
discriminator = cms.bool(True),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
candidateNegativeCombinedMVAComputer = cms.ESProducer("CombinedMVAJetTagESProducer",
useCategories = cms.bool(False),
calibrationRecord = cms.string('CombinedMVA'),
recordLabel = cms.string(''),
jetTagComputers = cms.VPSet(
cms.PSet(
discriminator = cms.bool(True),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
candidatePositiveCombinedMVAComputer = cms.ESProducer("CombinedMVAJetTagESProducer",
useCategories = cms.bool(False),
calibrationRecord = cms.string('CombinedMVA'),
recordLabel = cms.string(''),
jetTagComputers = cms.VPSet(
cms.PSet(
discriminator = cms.bool(True),
Expand Down
1 change: 1 addition & 0 deletions RecoBTag/Combined/python/combinedMVAComputer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
combinedMVAComputer = cms.ESProducer("CombinedMVAJetTagESProducer",
useCategories = cms.bool(False),
calibrationRecord = cms.string('CombinedMVA'),
recordLabel = cms.string(''),
jetTagComputers = cms.VPSet(
cms.PSet(
discriminator = cms.bool(True),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
negativeCombinedMVAComputer = cms.ESProducer("CombinedMVAJetTagESProducer",
useCategories = cms.bool(False),
calibrationRecord = cms.string('CombinedMVA'),
recordLabel = cms.string(''),
jetTagComputers = cms.VPSet(
cms.PSet(
discriminator = cms.bool(True),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
positiveCombinedMVAComputer = cms.ESProducer("CombinedMVAJetTagESProducer",
useCategories = cms.bool(False),
calibrationRecord = cms.string('CombinedMVA'),
recordLabel = cms.string(''),
jetTagComputers = cms.VPSet(
cms.PSet(
discriminator = cms.bool(True),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# impactParameterMVAComputer btag computer
impactParameterMVAComputer = cms.ESProducer("GenericMVAJetTagESProducer",
useCategories = cms.bool(False),
calibrationRecord = cms.string('ImpactParameterMVA')
calibrationRecord = cms.string('ImpactParameterMVA'),
recordLabel = cms.string('')
)


Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
'CombinedSVRecoVertex',
'CombinedSVPseudoVertex',
'CombinedSVNoVertex'),
recordLabel = cms.string(''),
categoryVariableName = cms.string('vertexCategory')
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'CombinedSVRecoVertexSoftElectron',
'CombinedSVPseudoVertexSoftElectron',
'CombinedSVNoVertexSoftElectron'),
recordLabel = cms.string(''),
categoryVariableName = cms.string('vertexLeptonCategory')
)

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
'CombinedSVIVFV2RecoVertex',
'CombinedSVIVFV2PseudoVertex',
'CombinedSVIVFV2NoVertex'),
recordLabel = cms.string(''),
categoryVariableName = cms.string('vertexCategory')
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
'CombinedSVRecoVertex',
'CombinedSVPseudoVertex',
'CombinedSVNoVertex'),
recordLabel = cms.string(''),
categoryVariableName = cms.string('vertexCategory')
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'CombinedSVRecoVertexSoftElectron',
'CombinedSVPseudoVertexSoftElectron',
'CombinedSVNoVertexSoftElectron'),
recordLabel = cms.string(''),
categoryVariableName = cms.string('vertexLeptonCategory')
)

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
'CombinedSVIVFV2RecoVertex',
'CombinedSVIVFV2PseudoVertex',
'CombinedSVIVFV2NoVertex'),
recordLabel = cms.string(''),
categoryVariableName = cms.string('vertexCategory')
)
1 change: 1 addition & 0 deletions RecoBTag/SecondaryVertex/python/ghostTrackComputer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
'GhostTrackRecoVertex',
'GhostTrackPseudoVertex',
'GhostTrackNoVertex'),
recordLabel = cms.string(''),
categoryVariableName = cms.string('vertexCategory')
)
5 changes: 3 additions & 2 deletions RecoBTau/JetTagComputer/interface/GenericMVAJetTagComputer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ class GenericMVAJetTagComputer : public JetTagComputer {
taggingVariables(const TagInfoHelper &info) const;

private:
std::auto_ptr<TagInfoMVACategorySelector> categorySelector;
GenericMVAComputerCache computerCache;
std::auto_ptr<TagInfoMVACategorySelector> categorySelector_;
GenericMVAComputerCache computerCache_;
std::string recordLabel_;
};

#endif // RecoBTau_JetTagComputer_GenericMVAJetTagComputer_h
13 changes: 7 additions & 6 deletions RecoBTau/JetTagComputer/src/GenericMVAJetTagComputer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ getCalibrationLabels(const edm::ParameterSet &params,

GenericMVAJetTagComputer::GenericMVAJetTagComputer(
const edm::ParameterSet &params) :
computerCache(getCalibrationLabels(params, categorySelector))
computerCache_(getCalibrationLabels(params, categorySelector_)),
recordLabel_(params.getParameter<std::string>("recordLabel"))
{
}

Expand All @@ -53,11 +54,11 @@ void GenericMVAJetTagComputer::initialize(const JetTagComputerRecord & record) {

// retrieve MVAComputer calibration container
edm::ESHandle<Calibration::MVAComputerContainer> calibHandle;
dependentRecord.get(calibHandle);
dependentRecord.get(recordLabel_, calibHandle);
const Calibration::MVAComputerContainer *calib = calibHandle.product();

// check for updates
computerCache.update(calib);
computerCache_.update(calib);
}

float GenericMVAJetTagComputer::discriminator(const TagInfoHelper &info) const
Expand All @@ -66,13 +67,13 @@ float GenericMVAJetTagComputer::discriminator(const TagInfoHelper &info) const

// retrieve index of computer in case categories are used
int index = 0;
if (categorySelector.get()) {
index = categorySelector->findCategory(variables);
if (categorySelector_.get()) {
index = categorySelector_->findCategory(variables);
if (index < 0)
return -10.0;
}

GenericMVAComputer const* computer = computerCache.getComputer(index);
GenericMVAComputer const* computer = computerCache_.getComputer(index);

if (!computer)
return -10.0;
Expand Down

0 comments on commit 0454537

Please sign in to comment.