Skip to content

Commit

Permalink
Merge CMSSW_7_6_X into CMSSW_8_0_X.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed Dec 3, 2015
2 parents 3c78246 + 0360c4e commit 77c6e15
Show file tree
Hide file tree
Showing 49 changed files with 5,221 additions and 229 deletions.
13 changes: 9 additions & 4 deletions Configuration/Applications/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1807,10 +1807,7 @@ def NFI(index):
return ''
else:
return '%s'%index

if not 'DIGI' in self.stepMap and not self._options.fast and not any(map( lambda s : s.startswith('genvalid'), valSeqName)):
if self._options.restoreRNDSeeds==False and not self._options.restoreRNDSeeds==True:
self._options.restoreRNDSeeds=True


#rename the HLT process in validation steps
if ('HLT' in self.stepMap and not self._options.fast) or self._options.hltProcess:
Expand All @@ -1826,6 +1823,14 @@ def NFI(index):
setattr(self.process,'validation_step%s'%NFI(i), cms.EndPath( getattr(self.process, s)))
self.schedule.append(getattr(self.process,'validation_step%s'%NFI(i)))

#needed in case the miniAODValidation sequence is run starting from AODSIM
if 'PAT' in self.stepMap and not 'RECO' in self.stepMap:
return

if not 'DIGI' in self.stepMap and not self._options.fast and not any(map( lambda s : s.startswith('genvalid'), valSeqName)):
if self._options.restoreRNDSeeds==False and not self._options.restoreRNDSeeds==True:
self._options.restoreRNDSeeds=True

if not 'DIGI' in self.stepMap and not self._options.fast:
self.executeAndRemember("process.mix.playback = True")
self.executeAndRemember("process.mix.digitizers = cms.PSet()")
Expand Down
39 changes: 22 additions & 17 deletions DataFormats/PatCandidates/interface/liblogintpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,32 @@

namespace logintpack
{
constexpr int8_t smallestPositive = 0;
// note that abs(unpack(smallestNegative)) == unpack(1), i.e. there
// is no "x" such that "unpack(x) == -unpack(0)"
constexpr int8_t smallestNegative = -1;

int8_t pack8logCeil(double x,double lmin, double lmax, uint8_t base=128)
{
if(base>128) base=128;
float l =log(fabs(x));
float centered = (l-lmin)/(lmax-lmin)*base;
int8_t r=ceil(centered);
const double l = std::log(std::abs(x));
const double centered = (l-lmin)/(lmax-lmin)*base;
int8_t r=std::ceil(centered);
if(centered >= base-1) r=base-1;
if(centered < 0) r=0;
if(x<0) r=-r;
if(x<0) r = r==0 ? -1 : -r;
return r;
}

int8_t pack8log(double x,double lmin, double lmax, uint8_t base=128)
{
if(base>128) base=128;
float l =log(fabs(x));
float centered = (l-lmin)/(lmax-lmin)*base;
const double l = std::log(std::abs(x));
const double centered = (l-lmin)/(lmax-lmin)*base;
int8_t r=centered;
if(centered >= base-1) r=base-1;
if(centered < 0) r=0;
if(x<0) r=-r;
if(x<0) r = r==0 ? -1 : -r;
return r;
}

Expand All @@ -34,33 +39,33 @@ namespace logintpack
int8_t pack8logClosed(double x,double lmin, double lmax, uint8_t base=128)
{
if(base>128) base=128;
float l =log(fabs(x));
float centered = (l-lmin)/(lmax-lmin)*(base-1);
const double l = std::log(std::abs(x));
const double centered = (l-lmin)/(lmax-lmin)*(base-1);
int8_t r=round(centered);
if(centered >= base-1) r=base-1;
if(centered < 0) r=0;
if(x<0) r=-r;
if(x<0) r = r==0 ? -1 : -r;
return r;
}


double unpack8log(int8_t i,double lmin, double lmax, uint8_t base=128)
{
if(base>128) base=128;
float basef=base;
float l=lmin+abs(i)/basef*(lmax-lmin);
float val=exp(l);
const double basef=base;
const double l=lmin+std::abs(i)/basef*(lmax-lmin);
const double val=std::exp(l);
if(i<0) return -val; else return val;
}

/// reverse of pack8logClosed
double unpack8logClosed(int8_t i,double lmin, double lmax, uint8_t base=128)
{
if(base>128) base=128;
float basef=base-1;
float l=lmin+abs(i)/basef*(lmax-lmin);
if (abs(i) == base-1) l = lmax;
float val=exp(l);
const double basef=base-1;
double l=lmin+std::abs(i)/basef*(lmax-lmin);
if (std::abs(i) == base-1) l = lmax;
const double val=std::exp(l);
if(i<0) return -val; else return val;
}

Expand Down
6 changes: 4 additions & 2 deletions DataFormats/PatCandidates/src/PackedCandidate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ pat::PackedCandidate::~PackedCandidate() {

float pat::PackedCandidate::dxy(const Point &p) const {
maybeUnpackBoth();
return -(vertex_.load()->X()-p.X()) * std::sin(float(p4_.load()->Phi())) + (vertex_.load()->Y()-p.Y()) * std::cos(float(p4_.load()->Phi()));
const float phi = float(p4_.load()->Phi())+dphi_;
return -(vertex_.load()->X()-p.X()) * std::sin(phi) + (vertex_.load()->Y()-p.Y()) * std::cos(phi);
}
float pat::PackedCandidate::dz(const Point &p) const {
maybeUnpackBoth();
return (vertex_.load()->Z()-p.Z()) - ((vertex_.load()->X()-p.X()) * std::cos(float(p4_.load()->Phi())) + (vertex_.load()->Y()-p.Y()) * std::sin(float(p4_.load()->Phi()))) * p4_.load()->Pz()/p4_.load()->Pt();
const float phi = float(p4_.load()->Phi())+dphi_;
return (vertex_.load()->Z()-p.Z()) - ((vertex_.load()->X()-p.X()) * std::cos(phi) + (vertex_.load()->Y()-p.Y()) * std::sin(phi)) * p4_.load()->Pz()/p4_.load()->Pt();
}

void pat::PackedCandidate::unpackTrk() const {
Expand Down
92 changes: 92 additions & 0 deletions DataFormats/PatCandidates/test/testlogintpack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include <cppunit/extensions/HelperMacros.h>
#include <iostream>
#include <iomanip>
#include <limits>

#include "DataFormats/PatCandidates/interface/liblogintpack.h"

class testlogintpack : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(testlogintpack);

CPPUNIT_TEST(test);

CPPUNIT_TEST_SUITE_END();
public:
void setUp() {}
void tearDown() {}

void test();

private:
};

namespace {
int8_t pack(double x) { return logintpack::pack8log (x, -15, 0); }
int8_t packceil(double x) { return logintpack::pack8logCeil (x, -15, 0); }
int8_t packclosed(double x) { return logintpack::pack8log (x, -15, 0); }
double unpack(int8_t x) { return logintpack::unpack8log (x, -15, 0); }
double unpackclosed(int8_t x) { return logintpack::unpack8logClosed(x, -15, 0); }
}

void testlogintpack::test() {
using logintpack::smallestPositive;
using logintpack::smallestNegative;
constexpr int8_t largestPositive = 127;
constexpr int8_t largestNegative = -127;

const double smallestValuePos = std::exp(-15.);
const double smallestValueNeg = -std::exp(-15.+1./128.*15.);
const double smallestValueNegForClosed = -std::exp(-15.+1./127.*15.);
CPPUNIT_ASSERT(pack(smallestValuePos) == smallestPositive);
CPPUNIT_ASSERT(packceil(smallestValuePos) == smallestPositive);
CPPUNIT_ASSERT(packclosed(smallestValuePos) == smallestPositive);
CPPUNIT_ASSERT(unpack(smallestPositive) == smallestValuePos);
CPPUNIT_ASSERT(unpackclosed(smallestPositive) == smallestValuePos);

CPPUNIT_ASSERT(pack(smallestValueNeg) == smallestNegative);
CPPUNIT_ASSERT(packceil(smallestValueNeg) == smallestNegative);
CPPUNIT_ASSERT(unpack(smallestNegative) == smallestValueNeg);
CPPUNIT_ASSERT(unpack(pack(smallestValueNeg)) == smallestValueNeg);
CPPUNIT_ASSERT(unpack(packceil(smallestValueNeg)) == smallestValueNeg);
CPPUNIT_ASSERT(unpackclosed(packclosed(smallestValueNegForClosed)) == smallestValueNegForClosed);

const double largestValuePos = std::exp(-15.+127./128.*15.);
const double largestValueNeg = -largestValuePos;
CPPUNIT_ASSERT(pack(largestValuePos) == largestPositive);
CPPUNIT_ASSERT(packceil(largestValuePos) == largestPositive);
CPPUNIT_ASSERT(unpack(largestPositive) == largestValuePos);

CPPUNIT_ASSERT(pack(largestValueNeg) == largestNegative);
CPPUNIT_ASSERT(packceil(largestValueNeg) == largestNegative);
CPPUNIT_ASSERT(unpack(largestNegative) == largestValueNeg);

const double largestValueClosedPos = std::exp(0.);
const double largestValueClosedNeg = -largestValueClosedPos;
CPPUNIT_ASSERT(packclosed(largestValueClosedPos) == largestPositive);
CPPUNIT_ASSERT(unpackclosed(largestPositive) == largestValueClosedPos);
CPPUNIT_ASSERT(packclosed(largestValueClosedNeg) == largestNegative);
CPPUNIT_ASSERT(unpackclosed(largestNegative) == largestValueClosedNeg);

const double someValue = std::exp(-15. + 1/128.*15.);
const float someValueFloat = std::exp(-15.f + 1/128.f*15.f);
CPPUNIT_ASSERT(unpack(packceil(someValue)) == someValue);
CPPUNIT_ASSERT(static_cast<float>(unpack(packceil(someValue))) == someValueFloat);
{
union { float flt; uint32_t i32; } conv;
conv.flt = someValueFloat;
conv.i32 += 1;
const float someValuePlus1Ulp32 = conv.flt;
CPPUNIT_ASSERT(static_cast<float>(unpack(packceil(someValuePlus1Ulp32))) >= someValuePlus1Ulp32);
}
{
union { double flt; uint64_t i64; } conv;
conv.flt = someValue;
conv.i64 += 1;
const float someValuePlus1Ulp64 = conv.flt;
CPPUNIT_ASSERT(unpack(packceil(someValuePlus1Ulp64)) >= someValuePlus1Ulp64);
}

}

CPPUNIT_TEST_SUITE_REGISTRATION(testlogintpack);

4 changes: 2 additions & 2 deletions JetMETCorrections/Type1MET/python/pfMETCorrectionType0_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@


type0PFMEtCorrectionPFCandToVertexAssociationForValidationMiniAOD = cms.Sequence(
selectedVerticesForPFMEtCorrType0
* selectedPrimaryVertexHighestPtTrackSumForPFMEtCorrType0
cms.ignore(selectedVerticesForPFMEtCorrType0)
* cms.ignore(selectedPrimaryVertexHighestPtTrackSumForPFMEtCorrType0)
* particleFlowDisplacedVertex
* pfCandidateToVertexAssociation
)
Expand Down
18 changes: 7 additions & 11 deletions PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
, 'pfInclusiveSecondaryVertexFinderTagInfosCA15'
, 'pfInclusiveSecondaryVertexFinderNegativeTagInfos'
, 'softPFMuonsTagInfos'
, 'softPFMuonsTagInfosAK8'
, 'softPFMuonsTagInfosCA15'
, 'softPFElectronsTagInfos'
, 'softPFElectronsTagInfosAK8'
, 'softPFElectronsTagInfosCA15'
#C-Tagging tag infos
# C-Tagging tag infos
, 'pfInclusiveSecondaryVertexFinderCvsLTagInfos'
# TopTagInfos (unrelated to b tagging)
# TopTagInfos (unrelated to b tagging)
, 'caTopTagInfos'
]
# extend for "internal use" in PAT/MINIAOD (renaming)
Expand Down Expand Up @@ -130,9 +126,9 @@
, 'pfCombinedMVAV2BJetTags' : ['pfImpactParameterTagInfos', 'pfSecondaryVertexTagInfos', 'pfInclusiveSecondaryVertexFinderTagInfos', 'softPFMuonsTagInfos', 'softPFElectronsTagInfos']
, 'pfCombinedSecondaryVertexSoftLeptonBJetTags' : ['pfImpactParameterTagInfos', 'pfInclusiveSecondaryVertexFinderTagInfos', 'softPFMuonsTagInfos', 'softPFElectronsTagInfos']
, 'pfNegativeCombinedSecondaryVertexSoftLeptonBJetTags' : ['pfImpactParameterTagInfos', 'pfInclusiveSecondaryVertexFinderNegativeTagInfos', 'softPFMuonsTagInfos', 'softPFElectronsTagInfos']
, 'pfBoostedDoubleSecondaryVertexAK8BJetTags' : ['pfImpactParameterTagInfosAK8', 'pfInclusiveSecondaryVertexFinderTagInfosAK8', 'softPFMuonsTagInfosAK8', 'softPFElectronsTagInfosAK8']
, 'pfBoostedDoubleSecondaryVertexCA15BJetTags' : ['pfImpactParameterTagInfosCA15', 'pfInclusiveSecondaryVertexFinderTagInfosCA15', 'softPFMuonsTagInfosCA15', 'softPFElectronsTagInfosCA15']
#C-Tagging
, 'pfCombinedCvsLJetTags' : ["pfImpactParameterTagInfos", "pfInclusiveSecondaryVertexFinderCvsLTagInfos", "softPFMuonsTagInfos", "softPFElectronsTagInfos"]
, 'pfCombinedCvsBJetTags' : ["pfImpactParameterTagInfos", "pfInclusiveSecondaryVertexFinderCvsLTagInfos", "softPFMuonsTagInfos", "softPFElectronsTagInfos"]
, 'pfBoostedDoubleSecondaryVertexAK8BJetTags' : ['pfImpactParameterTagInfosAK8', 'pfInclusiveSecondaryVertexFinderTagInfosAK8']
, 'pfBoostedDoubleSecondaryVertexCA15BJetTags' : ['pfImpactParameterTagInfosCA15', 'pfInclusiveSecondaryVertexFinderTagInfosCA15']
# C-Tagging
, 'pfCombinedCvsLJetTags' : ["pfImpactParameterTagInfos", "pfInclusiveSecondaryVertexFinderCvsLTagInfos", "softPFMuonsTagInfos", "softPFElectronsTagInfos"]
, 'pfCombinedCvsBJetTags' : ["pfImpactParameterTagInfos", "pfInclusiveSecondaryVertexFinderCvsLTagInfos", "softPFMuonsTagInfos", "softPFElectronsTagInfos"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def applySubstructure( process ) :
jetSource = cms.InputTag('ak8PFJetsCHS'),
algo= 'AK', rParam = 0.8,
jetCorrections = ('AK8PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'),
btagDiscriminators = [x.getModuleLabel() for x in patJetsDefault.discriminatorSources],
btagDiscriminators = ([x.getModuleLabel() for x in patJetsDefault.discriminatorSources] + ['pfBoostedDoubleSecondaryVertexAK8BJetTags']),
genJetCollection = cms.InputTag('slimmedGenJetsAK8')
)
process.patJetsAK8.userData.userFloats.src = [] # start with empty list of user floats
Expand Down
7 changes: 5 additions & 2 deletions PhysicsTools/PatAlgos/python/slimming/metFilterPaths_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from RecoMET.METFilters.metFilters_cff import EcalDeadCellTriggerPrimitiveFilter, eeBadScFilter, ecalLaserCorrFilter, EcalDeadCellBoundaryEnergyFilter
from RecoMET.METFilters.metFilters_cff import primaryVertexFilter, CSCTightHaloFilter, CSCTightHaloTrkMuUnvetoFilter, CSCTightHalo2015Filter, HcalStripHaloFilter
from RecoMET.METFilters.metFilters_cff import goodVertices, trackingFailureFilter, trkPOGFilters, manystripclus53X, toomanystripclus53X, logErrorTooManyClusters
from RecoMET.METFilters.metFilters_cff import chargedHadronTrackResolutionFilter, muonBadTrackFilter
from RecoMET.METFilters.metFilters_cff import metFilters

# individual filters
Expand All @@ -23,6 +24,8 @@
Flag_eeBadScFilter = cms.Path(eeBadScFilter)
Flag_ecalLaserCorrFilter = cms.Path(ecalLaserCorrFilter)
Flag_trkPOGFilters = cms.Path(trkPOGFilters)
Flag_chargedHadronTrackResolutionFilter = cms.Path(chargedHadronTrackResolutionFilter)
Flag_muonBadTrackFilter = cms.Path(muonBadTrackFilter)
# and the sub-filters
Flag_trkPOG_manystripclus53X = cms.Path(~manystripclus53X)
Flag_trkPOG_toomanystripclus53X = cms.Path(~toomanystripclus53X)
Expand All @@ -34,12 +37,12 @@

#add your new path here!!
allMetFilterPaths=['HBHENoiseFilter','HBHENoiseIsoFilter','CSCTightHaloFilter','CSCTightHaloTrkMuUnvetoFilter','CSCTightHalo2015Filter','HcalStripHaloFilter','hcalLaserEventFilter','EcalDeadCellTriggerPrimitiveFilter','EcalDeadCellBoundaryEnergyFilter','goodVertices','eeBadScFilter',
'ecalLaserCorrFilter','trkPOGFilters','trkPOG_manystripclus53X','trkPOG_toomanystripclus53X','trkPOG_logErrorTooManyClusters','METFilters']
'ecalLaserCorrFilter','trkPOGFilters','chargedHadronTrackResolutionFilter','muonBadTrackFilter','trkPOG_manystripclus53X','trkPOG_toomanystripclus53X','trkPOG_logErrorTooManyClusters','METFilters']


def miniAOD_customizeMETFiltersFastSim(process):
"""Replace some MET filters that don't work in FastSim with trivial bools"""
for X in 'CSCTightHaloFilter', 'CSCTightHaloTrkMuUnvetoFilter','CSCTightHalo2015Filter','HcalStripHaloFilter','HBHENoiseFilter', 'HBHENoiseIsoFilter', 'HBHENoiseFilterResultProducer':
for X in 'CSCTightHaloFilter', 'CSCTightHaloTrkMuUnvetoFilter','CSCTightHalo2015Filter','HcalStripHaloFilter','HBHENoiseFilter', 'HBHENoiseIsoFilter', 'HBHENoiseFilterResultProducer', 'chargedHadronTrackResolutionFilter', 'muonBadTrackFilter':
process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(True)))
for X in 'manystripclus53X', 'toomanystripclus53X', 'logErrorTooManyClusters':
process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(False)))
Expand Down
7 changes: 7 additions & 0 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ def miniAOD_customizeCommon(process):
cms.InputTag('reducedEgamma','reducedGedPhotons')
for idmod in photon_ids:
setupAllVIDIdsInModule(process,idmod,setupVIDPhotonSelection,None,False)

#----------------------------------------------------------------------------
# CV: add old and new tau ID discriminators for CMSSW 7_6_x reminiAOD v2
process.load("RecoTauTag.Configuration.RecoPFTauTag_reminiAOD_cff")
from PhysicsTools.PatAlgos.tools.tauTools import switchToPFTauHPS76xReMiniAOD
switchToPFTauHPS76xReMiniAOD(process)
#----------------------------------------------------------------------------

# Adding puppi jets
process.load('CommonTools.PileupAlgos.Puppi_cff')
Expand Down
8 changes: 0 additions & 8 deletions PhysicsTools/PatAlgos/python/tools/jetTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,16 +488,8 @@ def toolCode(self, process):
setattr(process, btagInfo+_labelName+postfix, btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource))
if btagInfo == 'softPFMuonsTagInfos':
setattr(process, btagInfo+_labelName+postfix, btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource))
if btagInfo == 'softPFMuonsTagInfosAK8':
setattr(process, btagInfo+_labelName+postfix, btag.softPFMuonsTagInfosAK8.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource))
if btagInfo == 'softPFMuonsTagInfosCA15':
setattr(process, btagInfo+_labelName+postfix, btag.softPFMuonsTagInfosCA15.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource))
if btagInfo == 'softPFElectronsTagInfos':
setattr(process, btagInfo+_labelName+postfix, btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource))
if btagInfo == 'softPFElectronsTagInfosAK8':
setattr(process, btagInfo+_labelName+postfix, btag.softPFElectronsTagInfosAK8.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource))
if btagInfo == 'softPFElectronsTagInfosCA15':
setattr(process, btagInfo+_labelName+postfix, btag.softPFElectronsTagInfosCA15.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource))
acceptedTagInfos.append(btagInfo)
elif hasattr(toptag, btagInfo) :
acceptedTagInfos.append(btagInfo)
Expand Down
Loading

0 comments on commit 77c6e15

Please sign in to comment.