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

Various NanoAOD fixes (PDF, PS weights, jets) 102X version #23839

Merged
merged 8 commits into from Jul 25, 2018
20 changes: 12 additions & 8 deletions PhysicsTools/NanoAOD/plugins/GenWeightsTableProducer.cc
Expand Up @@ -237,13 +237,15 @@ class GenWeightsTableProducer : public edm::global::EDProducer<edm::StreamCache<
if (mNamed != namedWeightIDs_.end()) wNamed[mNamed-namedWeightIDs_.begin()] = weight.wgt/w0;
}

int vectorSize = genProd.weights().size() > 1 ? genProd.weights().size()-2 : 0;
int vectorSize = genProd.weights().size() == 14 ? 4 : 1;
std::vector<double> wPS(vectorSize, 1);
for (unsigned int i=2; i<genProd.weights().size(); i++){
wPS[i-2] = (genProd.weights()[i])/w0;
if (vectorSize > 1 ) {
for (unsigned int i=6; i<10; i++){
wPS[i-6] = (genProd.weights()[i])/w0;
}
}
outPS.reset(new nanoaod::FlatTable(wPS.size(), "PSWeight", false));
outPS->addColumn<float>("", wPS, "PS weights (w_var / w_nominal); [0] is ISR=0.707 FSR=1; [1] is ISR=1 FSR=0.707; [2] is ISR=1.41 FSR=1; [3] is ISR=1 FSR=1.41; [4] is ISR=0.5 FSR=1; [5] is ISR=1 FSR=0.5; [6] is ISR=2 FSR=1; [7] is ISR=1 FSR=2; [8] is ISR=0.25 FSR=1 [9] is ISR=1 FSR=0.25; [10] is ISR=4 FSR=1 [11] is ISR=1 FSR=4 ", nanoaod::FlatTable::FloatColumn, lheWeightPrecision_);
outPS->addColumn<float>("", wPS, vectorSize > 1 ? "PS weights (w_var / w_nominal); [0] is ISR=0.5 FSR=1; [1] is ISR=1 FSR=0.5; [2] is ISR=2 FSR=1; [3] is ISR=1 FSR=2 " : "dummy PS weight (1.0) ", nanoaod::FlatTable::FloatColumn, lheWeightPrecision_);

outScale.reset(new nanoaod::FlatTable(wScale.size(), "LHEScaleWeight", false));
outScale->addColumn<float>("", wScale, weightChoice->scaleWeightsDoc, nanoaod::FlatTable::FloatColumn, lheWeightPrecision_);
Expand All @@ -266,15 +268,17 @@ class GenWeightsTableProducer : public edm::global::EDProducer<edm::StreamCache<
const GenEventInfoProduct & genProd,
std::unique_ptr<nanoaod::FlatTable> & outPS ) const
{
int vectorSize = genProd.weights().size() > 1 ? genProd.weights().size()-2 : 0;
int vectorSize = genProd.weights().size() == 14 ? 4 : 1;

std::vector<double> wPS(vectorSize, 1);
for (unsigned int i=2; i<genProd.weights().size(); i++){
wPS[i-2] = (genProd.weights()[i])/genWeight;
if (vectorSize > 1 ){
for (unsigned int i=6; i<10; i++){
wPS[i-6] = (genProd.weights()[i])/genWeight;
}
}

outPS.reset(new nanoaod::FlatTable(wPS.size(), "PSWeight", false));
outPS->addColumn<float>("", wPS, "PS weights (w_var / w_nominal); [0] is ISR=0.707 FSR=1; [1] is ISR=1 FSR=0.707; [2] is ISR=1.41 FSR=1; [3] is ISR=1 FSR=1.41; [4] is ISR=0.5 FSR=1; [5] is ISR=1 FSR=0.5; [6] is ISR=2 FSR=1; [7] is ISR=1 FSR=2; [8] is ISR=0.25 FSR=1 [9] is ISR=1 FSR=0.25; [10] is ISR=4 FSR=1 [11] is ISR=1 FSR=4 ", nanoaod::FlatTable::FloatColumn, lheWeightPrecision_);
outPS->addColumn<float>("", wPS, vectorSize > 1 ? "PS weights (w_var / w_nominal); [0] is ISR=0.5 FSR=1; [1] is ISR=1 FSR=0.5; [2] is ISR=2 FSR=1; [3] is ISR=1 FSR=2 " : "dummy PS weight (1.0) " , nanoaod::FlatTable::FloatColumn, lheWeightPrecision_);

counter->incGenOnly(genWeight);
counter->incPSOnly(genWeight,wPS);
Expand Down
4 changes: 3 additions & 1 deletion PhysicsTools/NanoAOD/python/jets_cff.py
Expand Up @@ -203,7 +203,8 @@
chHEF = Var("chargedHadronEnergyFraction()", float, doc="charged Hadron Energy Fraction", precision= 6),
neHEF = Var("neutralHadronEnergyFraction()", float, doc="neutral Hadron Energy Fraction", precision= 6),
chEmEF = Var("chargedEmEnergyFraction()", float, doc="charged Electromagnetic Energy Fraction", precision= 6),
neEmEF = Var("neutralEmEnergyFraction()", float, doc="neutral Electromagnetic Energy Fraction", precision= 6)
neEmEF = Var("neutralEmEnergyFraction()", float, doc="neutral Electromagnetic Energy Fraction", precision= 6),
muEF = Var("muonEnergyFraction()", float, doc="muon Energy Fraction", precision= 6),
)
)

Expand Down Expand Up @@ -335,6 +336,7 @@
variables = cms.PSet(P4Vars,
jetId = Var("userInt('tightId')*2+4*userInt('tightIdLepVeto')",int,doc="Jet ID flags bit1 is loose (always false in 2017 since it does not exist), bit2 is tight, bit3 is tightLepVeto"),
area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
rawFactor = Var("1.-jecFactor('Uncorrected')",float,doc="1 - Factor to get back to raw pT",precision=6),
tau1 = Var("userFloat('NjettinessAK8Puppi:tau1')",float, doc="Nsubjettiness (1 axis)",precision=10),
tau2 = Var("userFloat('NjettinessAK8Puppi:tau2')",float, doc="Nsubjettiness (2 axis)",precision=10),
tau3 = Var("userFloat('NjettinessAK8Puppi:tau3')",float, doc="Nsubjettiness (3 axis)",precision=10),
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/met_cff.py
Expand Up @@ -52,7 +52,7 @@
caloMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
src = metTable.src,
name = cms.string("CaloMET"),
doc = cms.string("CaloMET"),
doc = cms.string("Offline CaloMET (muon corrected)"),
singleton = cms.bool(True), # there's always exactly one MET per event
extension = cms.bool(False), # this is the main table for the MET
variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
Expand Down
4 changes: 3 additions & 1 deletion PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Expand Up @@ -85,6 +85,7 @@
Plot1D('n3b1', 'n3b1', 20, 0, 5, 'N3 (beta=1)'),
Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
Plot1D('pt', 'pt', 20, 0, 800, 'pt'),
Plot1D('rawFactor', 'rawFactor', 20, -0.5, 0.5, '1 - Factor to get back to raw pT'),
NoPlot('subJetIdx1'),
NoPlot('subJetIdx2'),
Plot1D('tau1', 'tau1', 20, 0, 1, 'Nsubjettiness (1 axis)'),
Expand Down Expand Up @@ -236,6 +237,7 @@
Plot1D('hadronFlavour', 'hadronFlavour', 6, -0.5, 5.5, 'flavour from hadron ghost clustering'),
Plot1D('jetId', 'jetId', 8, -0.5, 7.5, 'Jet ID flags bit1 is loose (always false in 2017 since it does not exist), bit2 is tight, bit3 is tightLepVeto'),
Plot1D('mass', 'mass', 20, 0, 200, 'mass'),
Plot1D('muEF', 'muEF', 20, 0, 1, 'muon Energy Fraction'),
NoPlot('muonIdx1'),
NoPlot('muonIdx2'),
Plot1D('nConstituents', 'nConstituents', 20, 0, 80, 'Number of particles in the jet'),
Expand All @@ -248,7 +250,7 @@
Plot1D('pt', 'pt', 20, 0, 400, 'pt'),
Plot1D('puId', 'puId', 8, -0.5, 7.5, 'Pilup ID flags'),
Plot1D('qgl', 'qgl', 20, 0, 1, 'Quark vs Gluon likelihood discriminator'),
Plot1D('rawFactor', 'rawFactor', 20, 0.5, 1.5, '1 - Factor to get back to raw pT'),
Plot1D('rawFactor', 'rawFactor', 20, -0.5, 0.5, '1 - Factor to get back to raw pT'),
)
),
MET = cms.PSet(
Expand Down
2 changes: 2 additions & 0 deletions PhysicsTools/NanoAOD/python/nano_cff.py
Expand Up @@ -102,6 +102,8 @@
cms.PSet( name = cms.string("NNPDF31_nnlo_hessian_pdfas"), lhaid = cms.uint32(306000) ),
cms.PSet( name = cms.string("NNPDF30_nlo_as_0118"), lhaid = cms.uint32(260000) ), # for some 92X samples. Note that the nominal weight, 260000, is not included in the LHE ...
cms.PSet( name = cms.string("NNPDF30_lo_as_0130"), lhaid = cms.uint32(262000) ), # some MLM 80X samples have only this (e.g. /store/mc/RunIISummer16MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v2/120000/02A210D6-F5C3-E611-B570-008CFA197BD4.root )
cms.PSet( name = cms.string("NNPDF30_nlo_nf_4_pdfas"), lhaid = cms.uint32(292000) ), # some FXFX 80X samples have only this (e.g. WWTo1L1Nu2Q, WWTo4Q)
cms.PSet( name = cms.string("NNPDF30_nlo_nf_5_pdfas"), lhaid = cms.uint32(292200) ), # some FXFX 80X samples have only this (e.g. DYJetsToLL_Pt, WJetsToLNu_Pt, DYJetsToNuNu_Pt)
),
namedWeightIDs = cms.vstring(),
namedWeightLabels = cms.vstring(),
Expand Down
8 changes: 8 additions & 0 deletions PhysicsTools/NanoAOD/python/triggerObjects_cff.py
Expand Up @@ -96,6 +96,14 @@
l2seed = cms.string("type(85) && coll('hltAK4CaloJetsCorrectedIDPassed')"), l2deltaR = cms.double(0.3),
qualityBits = cms.string("filter('*CrossCleaned*LooseChargedIsoPFTau*')"), qualityBitsDoc = cms.string("1 = VBF cross-cleaned from loose iso PFTau"),
),
cms.PSet(
name = cms.string("FatJet"),
id = cms.int32(6),
sel = cms.string("type(85) && pt > 120 && coll('hltAK8PFJetsCorrected')"),
l1seed = cms.string("type(-99)"), l1deltaR = cms.double(0.3),
l2seed = cms.string("type(85) && coll('hltAK8CaloJetsCorrectedIDPassed')"), l2deltaR = cms.double(0.3),
qualityBits = cms.string("0"), qualityBitsDoc = cms.string(""),
),
cms.PSet(
name = cms.string("MET"),
id = cms.int32(2),
Expand Down