From bd3966026faeea5b62967ecb92a6de8049675169 Mon Sep 17 00:00:00 2001 From: Lauren Hay Date: Thu, 23 Apr 2020 20:54:34 +0200 Subject: [PATCH 01/33] Add AK4 and AK8 candidates without overlap. --- BuildFile.xml | 4 ++ plugins/BuildFile.xml | 3 +- python/addPFCands_cff.py | 101 ++++++++++++++++++++++----------------- 3 files changed, 62 insertions(+), 46 deletions(-) diff --git a/BuildFile.xml b/BuildFile.xml index c36ed41..b60e7e7 100644 --- a/BuildFile.xml +++ b/BuildFile.xml @@ -3,6 +3,10 @@ + + + + diff --git a/plugins/BuildFile.xml b/plugins/BuildFile.xml index 5c87904..f4cef0f 100644 --- a/plugins/BuildFile.xml +++ b/plugins/BuildFile.xml @@ -5,9 +5,10 @@ + + - diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index d7b8fdc..1c4870d 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -5,19 +5,34 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): process.customizedPFCandsTask = cms.Task( ) process.schedule.associate(process.customizedPFCandsTask) - process.customAK8ConstituentsTable = cms.EDProducer("JetConstituentTableProducer", - src = cms.InputTag("finalJetsAK8"), - cut = cms.string("pt()>170"), - name = cms.string("FatJetPFCands")) - - process.customAK8ConstituentsExtTable = cms.EDProducer("SimpleCandidateFlatTableProducer", - src = cms.InputTag("customAK8ConstituentsTable"), - cut = cms.string(""), #we should not filter after pruning - name = cms.string("FatJetPFCands"), - doc = cms.string("interesting particles from AK8 jets"), - singleton = cms.bool(False), # the number of entries is variable - extension = cms.bool(True), # this is the extension table for the AK8 constituents - variables = cms.PSet(CandVars, + process.finalJetsAK8Constituents = cms.EDProducer("PatJetConstituentPtrSelector", + src = cms.InputTag("finalJetsAK8"), + cut = cms.string("pt > 170.0") + ) + process.finalJetsAK4Constituents = cms.EDProducer("PatJetConstituentPtrSelector", + src = cms.InputTag("finalJets"), + cut = cms.string("pt > 30.0") + ) + if onlyAK4: + candList = cms.VInputTag(cms.InputTag("finalJetsAK4Constituents", "constituents")) + process.customizedPFCandsTask.add(process.finalJetsAK4Constituents) + elif onlyAK8: + candList = cms.VInputTag(cms.InputTag("finalJetsAK8Constituents", "constituents")) + process.customizedPFCandsTask.add(process.finalJetsAK8Constituents) + else: + candList = cms.VInputTag(cms.InputTag("finalJetsAK4Constituents", "constituents"), cms.InputTag("finalJetsAK8Constituents", "constituents")) + process.customizedPFCandsTask.add(process.finalJetsAK4Constituents) + process.customizedPFCandsTask.add(process.finalJetsAK8Constituents) + process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", + src = candList) + process.customConstituentsExtTable = cms.EDProducer("SimpleCandidateFlatTableProducer", + src = cms.InputTag("finalJetsConstituents"), + cut = cms.string(""), #we should not filter after pruning + name = cms.string("JetPFCands"), + doc = cms.string("interesting particles from AK4 and AK8 jets"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the extension table for the AK8 constituents + variables = cms.PSet(CandVars, puppiWeight = Var("puppiWeight()", float, doc="Puppi weight",precision=10), puppiWeightNoLep = Var("puppiWeightNoLep()", float, doc="Puppi weight removing leptons",precision=10), vtxChi2 = Var("?hasTrackDetails()?vertexChi2():-1", float, doc="vertex chi2",precision=10), @@ -31,16 +46,9 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): trkQuality = Var("?hasTrackDetails()?pseudoTrack().qualityMask():0", int, doc="track quality mask"), ) ) - - process.customAK4ConstituentsTable = process.customAK8ConstituentsTable.clone( src = 'finalJets', cut = 'pt()>20', name = 'JetPFCands' ) - process.customAK4ConstituentsExtTable = process.customAK8ConstituentsExtTable.clone( src = 'customAK4ConstituentsTable', name = 'JetPFCands', doc = 'interesting particles from AK4 jets' ) - - if not onlyAK4: - process.customizedPFCandsTask.add(process.customAK8ConstituentsTable) - process.customizedPFCandsTask.add(process.customAK8ConstituentsExtTable) - if not onlyAK8: - process.customizedPFCandsTask.add(process.customAK4ConstituentsTable) - process.customizedPFCandsTask.add(process.customAK4ConstituentsExtTable) + + process.customizedPFCandsTask.add(process.finalJetsConstituents) + process.customizedPFCandsTask.add(process.customConstituentsExtTable) if runOnMC: @@ -49,32 +57,35 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): cut = cms.string("pt > 100.0") ) - process.genJetsAK8ParticleTable = cms.EDProducer("SimpleCandidateFlatTableProducer", - src = cms.InputTag("genJetsAK8Constituents", "constituents"), - cut = cms.string(""), #we should not filter after pruning - name= cms.string("GenJetAK8Cands"), - doc = cms.string("interesting gen particles from AK8 jets"), - singleton = cms.bool(False), # the number of entries is variable - extension = cms.bool(False), # this is the main table for the AK8 constituents - variables = cms.PSet(CandVars - ) - ) - + process.genJetsAK4Constituents = process.genJetsAK8Constituents.clone( src = cms.InputTag("slimmedGenJets"), cut = cms.string("pt > 20.0") ) - process.genJetsAK4ParticleTable = process.genJetsAK8ParticleTable.clone( - src = cms.InputTag("genJetsAK4Constituents", "constituents"), - name= cms.string("GenJetCands"), - doc = cms.string("interesting gen particles from AK4 jets"), - ) - - if not onlyAK8: + if onlyAK4: + genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents")) process.customizedPFCandsTask.add(process.genJetsAK4Constituents) - process.customizedPFCandsTask.add(process.genJetsAK4ParticleTable) - if not onlyAK4: + elif onlyAK8: + genCandList = cms.VInputTag(cms.InputTag("genJetsAK8Constituents", "constituents")) process.customizedPFCandsTask.add(process.genJetsAK8Constituents) - process.customizedPFCandsTask.add(process.genJetsAK8ParticleTable) - + else: + genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents"), cms.InputTag("genJetsAK8Constituents", "constituents")) + process.customizedPFCandsTask.add(process.genJetsAK4Constituents) + process.customizedPFCandsTask.add(process.genJetsAK8Constituents) + process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", + src = genCandList + ) + process.genJetsParticleTable = cms.EDProducer("SimpleCandidateFlatTableProducer", + src = cms.InputTag("genJetsConstituents"), + cut = cms.string(""), #we should not filter after pruning + name= cms.string("GenJetCands"), + doc = cms.string("interesting gen particles from AK4 and AK8 jets"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the AK8 constituents + variables = cms.PSet(CandVars + ) + ) + process.customizedPFCandsTask.add(process.genJetsConstituents) + process.customizedPFCandsTask.add(process.genJetsParticleTable) + return process From d51cea2cd1cdcbc0627c46b2c5e9dea8d50b57b3 Mon Sep 17 00:00:00 2001 From: Salvatore Rappoccio Date: Tue, 28 Apr 2020 16:13:37 +0200 Subject: [PATCH 02/33] Adding test file --- test/nano111x_on_2020_mc_NANO.py | 120 +++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 test/nano111x_on_2020_mc_NANO.py diff --git a/test/nano111x_on_2020_mc_NANO.py b/test/nano111x_on_2020_mc_NANO.py new file mode 100644 index 0000000..1b0b49d --- /dev/null +++ b/test/nano111x_on_2020_mc_NANO.py @@ -0,0 +1,120 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: myNanoProdMc -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --no_exec --conditions run2_mc --era Run2_2018,run2_nanoAOD_102Xv1 +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 +from Configuration.Eras.Modifier_run2_nanoAOD_102Xv1_cff import run2_nanoAOD_102Xv1 + +process = cms.Process('NANO',Run2_2018,run2_nanoAOD_102Xv1) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('PhysicsTools.NanoAOD.nano_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('/store/mc/RunIISummer19UL17MiniAOD/QCD_HT700to1000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/MINIAODSIM/106X_mc2017_realistic_v6-v2/280000/958303DA-D6A9-5D47-8A71-4D8F39FFC221.root'), + secondaryFileNames = cms.untracked.vstring() +) + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('myNanoProdMc nevts:1'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.NANOAODSIMoutput = cms.OutputModule("NanoAODOutputModule", + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(9), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('NANOAODSIM'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('myNanoProdMc_NANO.root'), + outputCommands = process.NANOAODSIMEventContent.outputCommands +) + +# Additional output definition + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') + +# Path and EndPath definitions +process.nanoAOD_step = cms.Path(process.nanoSequenceMC) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.NANOAODSIMoutput_step = cms.EndPath(process.NANOAODSIMoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.nanoAOD_step,process.endjob_step,process.NANOAODSIMoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + +# customisation of the process. + +# Automatic addition of the customisation function from PhysicsTools.NanoAOD.nano_cff +from PhysicsTools.NanoAOD.nano_cff import nanoAOD_customizeMC + +#call to customisation function nanoAOD_customizeMC imported from PhysicsTools.NanoAOD.nano_cff +process = nanoAOD_customizeMC(process) + +# Automatic addition of the customisation function from PhysicsTools.NanoAODJMAR.nano_jmar_cff +from PhysicsTools.NanoAODJMAR.nano_jmar_cff import JMARnano_customizeMC + +#call to customisation function JMARnano_customizeMC imported from PhysicsTools.NanoAODJMAR.nano_jmar_cff +process = JMARnano_customizeMC(process) + +# End of customisation functions + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion From a591a50284f0ea811038852391f76ceaf2e872b4 Mon Sep 17 00:00:00 2001 From: Salvatore Rappoccio Date: Thu, 30 Apr 2020 17:48:17 +0200 Subject: [PATCH 03/33] First working version of merged AK4 and AK8 candidate maps --- plugins/JetConstituentTableProducer.cc | 139 ++++++++++++---------- python/addPFCands_cff.py | 38 +++++- test/nano106X_on_mini106X_2017_mc_NANO.py | 2 +- 3 files changed, 107 insertions(+), 72 deletions(-) diff --git a/plugins/JetConstituentTableProducer.cc b/plugins/JetConstituentTableProducer.cc index cf39c9a..4db9bf6 100644 --- a/plugins/JetConstituentTableProducer.cc +++ b/plugins/JetConstituentTableProducer.cc @@ -12,12 +12,15 @@ #include "DataFormats/PatCandidates/interface/Jet.h" #include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/Candidate/interface/CandidateFwd.h" + #include "RecoBTag/FeatureTools/interface/TrackInfoBuilder.h" #include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "CommonTools/Utils/interface/StringCutObjectSelector.h" #include "DataFormats/NanoAOD/interface/FlatTable.h" +template class JetConstituentTableProducer : public edm::stream::EDProducer<> { public: explicit JetConstituentTableProducer(const edm::ParameterSet &); @@ -28,83 +31,82 @@ class JetConstituentTableProducer : public edm::stream::EDProducer<> { private: void produce(edm::Event &, const edm::EventSetup &) override; - typedef edm::Ptr CandidatePtr; - typedef edm::View CandidateView; typedef reco::VertexCollection VertexCollection; const std::string name_; - const StringCutObjectSelector jetCut_; + const bool readBtag_; - edm::EDGetTokenT> jet_token_; + edm::EDGetTokenT> jet_token_; edm::EDGetTokenT vtx_token_; - edm::EDGetTokenT pfcand_token_; + edm::EDGetTokenT cand_token_; edm::Handle vtxs_; - edm::Handle pfcands_; + edm::Handle cands_; edm::ESHandle track_builder_; }; // // constructors and destructor // -JetConstituentTableProducer::JetConstituentTableProducer(const edm::ParameterSet &iConfig) +template< typename T> +JetConstituentTableProducer::JetConstituentTableProducer(const edm::ParameterSet &iConfig) : name_(iConfig.getParameter("name")), - jetCut_(iConfig.getParameter("cut"), true), - jet_token_(consumes>(iConfig.getParameter("src"))), + readBtag_(iConfig.getParameter("readBtag")), + jet_token_(consumes>(iConfig.getParameter("jets"))), vtx_token_(consumes(iConfig.getParameter("vertices"))), - pfcand_token_(consumes(iConfig.getParameter("pf_candidates"))) { + cand_token_(consumes(iConfig.getParameter("candidates"))) { produces(name_); - produces>(); + produces>(); } -JetConstituentTableProducer::~JetConstituentTableProducer() {} +template< typename T> +JetConstituentTableProducer::~JetConstituentTableProducer() {} -void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { +template< typename T> +void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { // elements in all these collections must have the same order! - auto outCands = std::make_unique>(); - std::vector jetIdx; + auto outCands = std::make_unique>(); + std::vector jetIdx, candIdx; std::vector btagEtaRel, btagPtRatio, btagPParRatio, btagSip3dVal, btagSip3dSig, btagJetDistVal; + auto jets = iEvent.getHandle(jet_token_); + iEvent.getByToken(cand_token_, cands_); - iEvent.getByToken(vtx_token_, vtxs_); - if (!vtxs_->empty()) { - auto jets = iEvent.getHandle(jet_token_); - iEvent.getByToken(pfcand_token_, pfcands_); + if(readBtag_){ + iEvent.getByToken(vtx_token_, vtxs_); iSetup.get().get("TransientTrackBuilder", track_builder_); + } - for (unsigned i_jet = 0; i_jet < jets->size(); ++i_jet) { - const auto &jet = jets->at(i_jet); - if (!jetCut_(jet)) - continue; - - math::XYZVector jet_dir = jet.momentum().Unit(); - GlobalVector jet_ref_track_dir(jet.px(), jet.py(), jet.pz()); - - std::vector daughters; - for (const auto &cand : jet.daughterPtrVector()) { - const auto *packed_cand = dynamic_cast(&(*cand)); - assert(packed_cand != nullptr); - // remove particles w/ extremely low puppi weights (needed for 2017 MiniAOD) - if (packed_cand->puppiWeight() < 0.01) - continue; - // get the original reco/packed candidate not scaled by the puppi weight - daughters.push_back(pfcands_->ptrAt(cand.key())); + for (unsigned i_jet = 0; i_jet < jets->size(); ++i_jet) { + const auto &jet = jets->at(i_jet); + math::XYZVector jet_dir = jet.momentum().Unit(); + GlobalVector jet_ref_track_dir(jet.px(), jet.py(), jet.pz()); + + std::vector const & daughters = jet.daughterPtrVector(); + + for (const auto &cand : daughters) { + auto candPtrs = cands_->ptrs(); + auto candInNewList = std::find( candPtrs.begin(), candPtrs.end(), cand ); + if ( candInNewList == candPtrs.end() ) { + std::cout << "Cannot find candidate : " << cand.id() << ", " << cand.key() << ", pt = " << cand->pt() << std::endl; + continue; } - // sort by original pt (not Puppi-weighted) - std::sort(daughters.begin(), daughters.end(), [](const auto &a, const auto &b) { return a->pt() > b->pt(); }); - - for (const auto &cand : daughters) { - outCands->push_back(cand); - jetIdx.push_back(i_jet); - if (cand->hasTrackDetails()){ - btagbtvdeep::TrackInfoBuilder trkinfo(track_builder_); - trkinfo.buildTrackInfo(&(*cand), jet_dir, jet_ref_track_dir, vtxs_->at(0)); - btagEtaRel.push_back(trkinfo.getTrackEtaRel()); - btagPtRatio.push_back(trkinfo.getTrackPtRatio()); - btagPParRatio.push_back(trkinfo.getTrackPParRatio()); - btagSip3dVal.push_back(trkinfo.getTrackSip3dVal()); - btagSip3dSig.push_back(trkinfo.getTrackSip3dSig()); - btagJetDistVal.push_back(trkinfo.getTrackJetDistVal()); - } else { + outCands->push_back(cand); + jetIdx.push_back(i_jet); + candIdx.push_back( candInNewList - candPtrs.begin() ); + if (readBtag_ && !vtxs_->empty()) { + if ( cand.isNull() ) continue; + auto const *packedCand = dynamic_cast (cand.get()); + if ( packedCand == nullptr ) continue; + if ( packedCand && packedCand->hasTrackDetails()){ + btagbtvdeep::TrackInfoBuilder trkinfo(track_builder_); + trkinfo.buildTrackInfo(&(*packedCand), jet_dir, jet_ref_track_dir, vtxs_->at(0)); + btagEtaRel.push_back(trkinfo.getTrackEtaRel()); + btagPtRatio.push_back(trkinfo.getTrackPtRatio()); + btagPParRatio.push_back(trkinfo.getTrackPParRatio()); + btagSip3dVal.push_back(trkinfo.getTrackSip3dVal()); + btagSip3dSig.push_back(trkinfo.getTrackSip3dSig()); + btagJetDistVal.push_back(trkinfo.getTrackJetDistVal()); + } else { btagEtaRel.push_back(0); btagPtRatio.push_back(0); btagPParRatio.push_back(0); @@ -118,26 +120,33 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::EventSe auto candTable = std::make_unique(outCands->size(), name_, false); // We fill from here only stuff that cannot be created with the SimpleFlatTableProducer + candTable->addColumn("candIdx", candIdx, "Index in the candidate list", nanoaod::FlatTable::IntColumn); candTable->addColumn("jetIdx", jetIdx, "Index of the parent jet", nanoaod::FlatTable::IntColumn); - candTable->addColumn("btagEtaRel", btagEtaRel, "btagEtaRel", nanoaod::FlatTable::FloatColumn, 10); - candTable->addColumn("btagPtRatio", btagPtRatio, "btagPtRatio", nanoaod::FlatTable::FloatColumn, 10); - candTable->addColumn("btagPParRatio", btagPParRatio, "btagPParRatio", nanoaod::FlatTable::FloatColumn, 10); - candTable->addColumn("btagSip3dVal", btagSip3dVal, "btagSip3dVal", nanoaod::FlatTable::FloatColumn, 10); - candTable->addColumn("btagSip3dSig", btagSip3dSig, "btagSip3dSig", nanoaod::FlatTable::FloatColumn, 10); - candTable->addColumn("btagJetDistVal", btagJetDistVal, "btagJetDistVal", nanoaod::FlatTable::FloatColumn, 10); - + if (readBtag_) { + candTable->addColumn("btagEtaRel", btagEtaRel, "btagEtaRel", nanoaod::FlatTable::FloatColumn, 10); + candTable->addColumn("btagPtRatio", btagPtRatio, "btagPtRatio", nanoaod::FlatTable::FloatColumn, 10); + candTable->addColumn("btagPParRatio", btagPParRatio, "btagPParRatio", nanoaod::FlatTable::FloatColumn, 10); + candTable->addColumn("btagSip3dVal", btagSip3dVal, "btagSip3dVal", nanoaod::FlatTable::FloatColumn, 10); + candTable->addColumn("btagSip3dSig", btagSip3dSig, "btagSip3dSig", nanoaod::FlatTable::FloatColumn, 10); + candTable->addColumn("btagJetDistVal", btagJetDistVal, "btagJetDistVal", nanoaod::FlatTable::FloatColumn, 10); + } iEvent.put(std::move(candTable), name_); iEvent.put(std::move(outCands)); } -void JetConstituentTableProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { +template< typename T> +void JetConstituentTableProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; - desc.add("src", edm::InputTag("slimmedJetsAK8")); - desc.add("name", "AK8PFCands"); - desc.add("cut", "pt()>170"); + desc.add("name", "JetPFCands"); + desc.add("readBtag", true); + desc.add("jets", edm::InputTag("slimmedJetsAK8")); desc.add("vertices", edm::InputTag("offlineSlimmedPrimaryVertices")); - desc.add("pf_candidates", edm::InputTag("packedPFCandidates")); + desc.add("candidates", edm::InputTag("packedPFCandidates")); descriptions.addWithDefaultLabel(desc); } -DEFINE_FWK_MODULE(JetConstituentTableProducer); +typedef JetConstituentTableProducer PatJetConstituentTableProducer; +typedef JetConstituentTableProducer GenJetConstituentTableProducer; + +DEFINE_FWK_MODULE(PatJetConstituentTableProducer); +DEFINE_FWK_MODULE(GenJetConstituentTableProducer); diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index 1c4870d..0605ca2 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -7,11 +7,11 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): process.finalJetsAK8Constituents = cms.EDProducer("PatJetConstituentPtrSelector", src = cms.InputTag("finalJetsAK8"), - cut = cms.string("pt > 170.0") + cut = cms.string("") ) process.finalJetsAK4Constituents = cms.EDProducer("PatJetConstituentPtrSelector", src = cms.InputTag("finalJets"), - cut = cms.string("pt > 30.0") + cut = cms.string("") ) if onlyAK4: candList = cms.VInputTag(cms.InputTag("finalJetsAK4Constituents", "constituents")) @@ -46,21 +46,33 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): trkQuality = Var("?hasTrackDetails()?pseudoTrack().qualityMask():0", int, doc="track quality mask"), ) ) - + process.customAK8ConstituentsTable = cms.EDProducer("PatJetConstituentTableProducer", + candidates = cms.InputTag("finalJetsConstituents"), + #candidates = cms.InputTag("packedPFCandidates"), + jets = cms.InputTag("finalJetsAK8"), + name = cms.string("JetPFCandsAK8")) + process.customAK4ConstituentsTable = cms.EDProducer("PatJetConstituentTableProducer", + #candidates = cms.InputTag("packedPFCandidates"), + candidates = cms.InputTag("finalJetsConstituents"), + jets = cms.InputTag("finalJets"), + name = cms.string("JetPFCandsAK4")) + process.customizedPFCandsTask.add(process.finalJetsConstituents) process.customizedPFCandsTask.add(process.customConstituentsExtTable) - + process.customizedPFCandsTask.add(process.customAK8ConstituentsTable) + process.customizedPFCandsTask.add(process.customAK4ConstituentsTable) + if runOnMC: process.genJetsAK8Constituents = cms.EDProducer("GenJetPackedConstituentPtrSelector", src = cms.InputTag("slimmedGenJetsAK8"), - cut = cms.string("pt > 100.0") + cut = cms.string("") ) process.genJetsAK4Constituents = process.genJetsAK8Constituents.clone( src = cms.InputTag("slimmedGenJets"), - cut = cms.string("pt > 20.0") + cut = cms.string("") ) if onlyAK4: genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents")) @@ -85,7 +97,21 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): variables = cms.PSet(CandVars ) ) + process.genAK8ConstituentsTable = cms.EDProducer("GenJetConstituentTableProducer", + candidates = cms.InputTag("genJetsConstituents"), + #candidates = cms.InputTag("packedGenParticles"), + jets = cms.InputTag("slimmedGenJetsAK8"), + name = cms.string("GenJetCandsAK8"), + readBtag = cms.bool(False)) + process.genAK4ConstituentsTable = cms.EDProducer("GenJetConstituentTableProducer", + candidates = cms.InputTag("genJetsConstituents"), + #candidates = cms.InputTag("packedGenParticles"), + jets = cms.InputTag("slimmedGenJets"), + name = cms.string("GenJetCandsAK4"), + readBtag = cms.bool(False)) process.customizedPFCandsTask.add(process.genJetsConstituents) process.customizedPFCandsTask.add(process.genJetsParticleTable) + process.customizedPFCandsTask.add(process.genAK8ConstituentsTable) + process.customizedPFCandsTask.add(process.genAK4ConstituentsTable) return process diff --git a/test/nano106X_on_mini106X_2017_mc_NANO.py b/test/nano106X_on_mini106X_2017_mc_NANO.py index 8c67c44..4f3eb21 100644 --- a/test/nano106X_on_mini106X_2017_mc_NANO.py +++ b/test/nano106X_on_mini106X_2017_mc_NANO.py @@ -73,7 +73,7 @@ associatePatAlgosToolsTask(process) #Setup FWK for multithreaded -process.options.numberOfThreads=cms.untracked.uint32(2) +process.options.numberOfThreads=cms.untracked.uint32(1) process.options.numberOfStreams=cms.untracked.uint32(0) process.options.numberOfConcurrentLuminosityBlocks=cms.untracked.uint32(1) From ca2a868b517b7976d8eb2e02474e4deb5b0bd018 Mon Sep 17 00:00:00 2001 From: rappoccio Date: Thu, 30 Apr 2020 14:22:16 -0400 Subject: [PATCH 04/33] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0a5f699..e5bdcab 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ For **UL** 2016, 2017 and 2018 data and MC **NanoAODv6** according to the [XPOG cmsrel CMSSW_10_6_5 cd CMSSW_10_6_5/src cmsenv +git cms-merge-topic laurenhay:setmerger_10_6_5 git clone git@github.com:cms-jet/NanoAODJMAR.git -b dev_106x PhysicsTools/NanoAODJMAR scram b -j 10 cd PhysicsTools/NanoAODJMAR/test From 8423c6e02d62fa3616adc3a841bc7a977c684c7d Mon Sep 17 00:00:00 2001 From: Andrzej Date: Fri, 8 May 2020 00:59:12 +0200 Subject: [PATCH 05/33] Working rebase SV --- plugins/JetConstituentTableProducer.cc | 149 ++++++++++++++++++---- python/addPFCands_cff.py | 8 +- test/nano106X_on_mini106X_2017_mc_NANO.py | 3 +- 3 files changed, 131 insertions(+), 29 deletions(-) diff --git a/plugins/JetConstituentTableProducer.cc b/plugins/JetConstituentTableProducer.cc index 4db9bf6..437f43e 100644 --- a/plugins/JetConstituentTableProducer.cc +++ b/plugins/JetConstituentTableProducer.cc @@ -17,6 +17,12 @@ #include "RecoBTag/FeatureTools/interface/TrackInfoBuilder.h" #include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "DataFormats/BTauReco/interface/TrackIPTagInfo.h" +#include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h" +#include "RecoBTag/FeatureTools/interface/deep_helpers.h" +#include "DataFormats/Candidate/interface/VertexCompositePtrCandidate.h" +using namespace btagbtvdeep; + #include "CommonTools/Utils/interface/StringCutObjectSelector.h" #include "DataFormats/NanoAOD/interface/FlatTable.h" @@ -32,17 +38,27 @@ class JetConstituentTableProducer : public edm::stream::EDProducer<> { void produce(edm::Event &, const edm::EventSetup &) override; typedef reco::VertexCollection VertexCollection; + //===== + typedef reco::VertexCompositePtrCandidateCollection SVCollection; + //const std::string name_; const std::string name_; + const std::string nameSV_; const bool readBtag_; + const double jet_radius_; edm::EDGetTokenT> jet_token_; edm::EDGetTokenT vtx_token_; edm::EDGetTokenT cand_token_; + edm::EDGetTokenT sv_token_; edm::Handle vtxs_; edm::Handle cands_; + edm::Handle svs_; edm::ESHandle track_builder_; + + const reco::Vertex *pv_ = nullptr; + }; // @@ -50,12 +66,18 @@ class JetConstituentTableProducer : public edm::stream::EDProducer<> { // template< typename T> JetConstituentTableProducer::JetConstituentTableProducer(const edm::ParameterSet &iConfig) - : name_(iConfig.getParameter("name")), + : //name_(iConfig.getParameter("name")), + name_(iConfig.getParameter("name")), + nameSV_(iConfig.getParameter("nameSV")), readBtag_(iConfig.getParameter("readBtag")), + jet_radius_(iConfig.getParameter("jet_radius")), jet_token_(consumes>(iConfig.getParameter("jets"))), vtx_token_(consumes(iConfig.getParameter("vertices"))), - cand_token_(consumes(iConfig.getParameter("candidates"))) { + cand_token_(consumes(iConfig.getParameter("candidates"))), + sv_token_(consumes(iConfig.getParameter("secondary_vertices"))){ + //produces(name_); produces(name_); + produces(nameSV_); produces>(); } @@ -66,13 +88,21 @@ template< typename T> void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { // elements in all these collections must have the same order! auto outCands = std::make_unique>(); - std::vector jetIdx, candIdx; + auto outSVs = std::make_unique> (); + std::vector jetIdx_pf, jetIdx_sv, candIdx; + //std::vector jetIdx, candIdx; + // PF Cands std::vector btagEtaRel, btagPtRatio, btagPParRatio, btagSip3dVal, btagSip3dSig, btagJetDistVal; + // Secondary vertices + std::vector sv_mass, sv_pt, sv_ntracks, sv_chi2, sv_normchi2, sv_dxy, sv_dxysig, sv_d3d, sv_d3dsig, sv_costhetasvpv; + std::vector sv_ptrel, sv_phirel, sv_deltaR, sv_enratio; + auto jets = iEvent.getHandle(jet_token_); + iEvent.getByToken(vtx_token_, vtxs_); iEvent.getByToken(cand_token_, cands_); + iEvent.getByToken(sv_token_, svs_); if(readBtag_){ - iEvent.getByToken(vtx_token_, vtxs_); iSetup.get().get("TransientTrackBuilder", track_builder_); } @@ -80,7 +110,48 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::Even const auto &jet = jets->at(i_jet); math::XYZVector jet_dir = jet.momentum().Unit(); GlobalVector jet_ref_track_dir(jet.px(), jet.py(), jet.pz()); - + + pv_ = &vtxs_->at(0); + ////////////////////// + // Secondary Vertices + std::vector jetSVs; + for (const auto &sv : *svs_) { + if (reco::deltaR2(sv, jet) < jet_radius_ * jet_radius_) { + jetSVs.push_back(&sv); + } + } + // sort by dxy significance + std::sort(jetSVs.begin(), + jetSVs.end(), + [&](const reco::VertexCompositePtrCandidate *sva, const reco::VertexCompositePtrCandidate *svb) { + return sv_vertex_comparator(*sva, *svb, *pv_); + }); + + for (const auto &sv : jetSVs) { + outSVs->push_back(sv); + jetIdx_sv.push_back(i_jet); + // Jet independent + sv_mass.push_back(sv->mass()); + sv_pt.push_back(sv->pt()); + + sv_ntracks.push_back(sv->numberOfDaughters()); + sv_chi2.push_back(sv->vertexChi2()); + sv_normchi2.push_back(catch_infs_and_bound(sv->vertexChi2() / sv->vertexNdof(), 1000, -1000, 1000)); + const auto& dxy_meas = vertexDxy(*sv, *pv_); + sv_dxy.push_back(dxy_meas.value()); + sv_dxysig.push_back(catch_infs_and_bound(dxy_meas.value() / dxy_meas.error(), 0, -1, 800)); + const auto& d3d_meas = vertexD3d(*sv, *pv_); + sv_d3d.push_back(d3d_meas.value()); + sv_d3dsig.push_back(catch_infs_and_bound(d3d_meas.value() / d3d_meas.error(), 0, -1, 800)); + sv_costhetasvpv.push_back(vertexDdotP(*sv, *pv_)); + // Jet related + sv_ptrel.push_back(sv->pt() / jet.pt()); + sv_phirel.push_back(reco::deltaPhi(*sv, jet)); + sv_deltaR.push_back(catch_infs_and_bound(std::fabs(reco::deltaR(*sv, jet_dir)) - 0.5, 0, -2, 0)); + sv_enratio.push_back(sv->energy() / jet.energy()); + } + + // PF Cands std::vector const & daughters = jet.daughterPtrVector(); for (const auto &cand : daughters) { @@ -91,28 +162,28 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::Even continue; } outCands->push_back(cand); - jetIdx.push_back(i_jet); + jetIdx_pf.push_back(i_jet); candIdx.push_back( candInNewList - candPtrs.begin() ); if (readBtag_ && !vtxs_->empty()) { - if ( cand.isNull() ) continue; - auto const *packedCand = dynamic_cast (cand.get()); - if ( packedCand == nullptr ) continue; - if ( packedCand && packedCand->hasTrackDetails()){ - btagbtvdeep::TrackInfoBuilder trkinfo(track_builder_); - trkinfo.buildTrackInfo(&(*packedCand), jet_dir, jet_ref_track_dir, vtxs_->at(0)); - btagEtaRel.push_back(trkinfo.getTrackEtaRel()); - btagPtRatio.push_back(trkinfo.getTrackPtRatio()); - btagPParRatio.push_back(trkinfo.getTrackPParRatio()); - btagSip3dVal.push_back(trkinfo.getTrackSip3dVal()); - btagSip3dSig.push_back(trkinfo.getTrackSip3dSig()); - btagJetDistVal.push_back(trkinfo.getTrackJetDistVal()); - } else { - btagEtaRel.push_back(0); - btagPtRatio.push_back(0); - btagPParRatio.push_back(0); - btagSip3dVal.push_back(0); - btagSip3dSig.push_back(0); - btagJetDistVal.push_back(0); + if ( cand.isNull() ) continue; + auto const *packedCand = dynamic_cast (cand.get()); + if ( packedCand == nullptr ) continue; + if ( packedCand && packedCand->hasTrackDetails()){ + btagbtvdeep::TrackInfoBuilder trkinfo(track_builder_); + trkinfo.buildTrackInfo(&(*packedCand), jet_dir, jet_ref_track_dir, vtxs_->at(0)); + btagEtaRel.push_back(trkinfo.getTrackEtaRel()); + btagPtRatio.push_back(trkinfo.getTrackPtRatio()); + btagPParRatio.push_back(trkinfo.getTrackPParRatio()); + btagSip3dVal.push_back(trkinfo.getTrackSip3dVal()); + btagSip3dSig.push_back(trkinfo.getTrackSip3dSig()); + btagJetDistVal.push_back(trkinfo.getTrackJetDistVal()); + } else { + btagEtaRel.push_back(0); + btagPtRatio.push_back(0); + btagPParRatio.push_back(0); + btagSip3dVal.push_back(0); + btagSip3dSig.push_back(0); + btagJetDistVal.push_back(0); } } } // end jet loop @@ -121,7 +192,7 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::Even auto candTable = std::make_unique(outCands->size(), name_, false); // We fill from here only stuff that cannot be created with the SimpleFlatTableProducer candTable->addColumn("candIdx", candIdx, "Index in the candidate list", nanoaod::FlatTable::IntColumn); - candTable->addColumn("jetIdx", jetIdx, "Index of the parent jet", nanoaod::FlatTable::IntColumn); + candTable->addColumn("jetIdx", jetIdx_pf, "Index of the parent jet", nanoaod::FlatTable::IntColumn); if (readBtag_) { candTable->addColumn("btagEtaRel", btagEtaRel, "btagEtaRel", nanoaod::FlatTable::FloatColumn, 10); candTable->addColumn("btagPtRatio", btagPtRatio, "btagPtRatio", nanoaod::FlatTable::FloatColumn, 10); @@ -131,6 +202,29 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::Even candTable->addColumn("btagJetDistVal", btagJetDistVal, "btagJetDistVal", nanoaod::FlatTable::FloatColumn, 10); } iEvent.put(std::move(candTable), name_); + + // SV table + auto svTable = std::make_unique(outSVs->size(), nameSV_, false); + // We fill from here only stuff that cannot be created with the SimpleFlatTnameableProducer + svTable->addColumn("jetIdx", jetIdx_sv, "Index of the parent jet", nanoaod::FlatTable::IntColumn); + svTable->addColumn("mass", sv_mass, "SV mass", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("pt", sv_pt, "SV pt", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("ntracks", sv_ntracks, "Number of trakcs associated to SV", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("chi2", sv_chi2, "chi2", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("normchi2", sv_normchi2, "chi2/ndof", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("dxy", sv_dxy, "", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("dxysig", sv_dxysig, "", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("d3d", sv_d3d, "", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("d3dsig", sv_d3dsig, "", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("costhetasvpv", sv_costhetasvpv, "", nanoaod::FlatTable::FloatColumn, 10); + // Jet related + svTable->addColumn("phirel", sv_phirel, "DeltaPhi(sv, jet)", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("ptrel", sv_ptrel, "pT relative to parent jet", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("deltaR", sv_deltaR, "dR from parent jet", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("enration", sv_enratio, "energy relative to parent jet", nanoaod::FlatTable::FloatColumn, 10); + + iEvent.put(std::move(svTable), nameSV_); + iEvent.put(std::move(outCands)); } @@ -138,10 +232,13 @@ template< typename T> void JetConstituentTableProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; desc.add("name", "JetPFCands"); + desc.add("nameSV", "JetSV"); + desc.add("jet_radius", true); desc.add("readBtag", true); desc.add("jets", edm::InputTag("slimmedJetsAK8")); desc.add("vertices", edm::InputTag("offlineSlimmedPrimaryVertices")); desc.add("candidates", edm::InputTag("packedPFCandidates")); + desc.add("secondary_vertices", edm::InputTag("slimmedSecondaryVertices")); descriptions.addWithDefaultLabel(desc); } diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index 0605ca2..519822a 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -50,12 +50,14 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): candidates = cms.InputTag("finalJetsConstituents"), #candidates = cms.InputTag("packedPFCandidates"), jets = cms.InputTag("finalJetsAK8"), - name = cms.string("JetPFCandsAK8")) + name = cms.string("JetPFCandsAK8"), + nameSV = cms.string("JetSVsAK8")) process.customAK4ConstituentsTable = cms.EDProducer("PatJetConstituentTableProducer", #candidates = cms.InputTag("packedPFCandidates"), candidates = cms.InputTag("finalJetsConstituents"), jets = cms.InputTag("finalJets"), - name = cms.string("JetPFCandsAK4")) + name = cms.string("JetPFCandsAK4"), + nameSV = cms.string("JetSVsAK4")) process.customizedPFCandsTask.add(process.finalJetsConstituents) process.customizedPFCandsTask.add(process.customConstituentsExtTable) @@ -102,12 +104,14 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): #candidates = cms.InputTag("packedGenParticles"), jets = cms.InputTag("slimmedGenJetsAK8"), name = cms.string("GenJetCandsAK8"), + nameSV = cms.string("GenJetSVsAK8"), readBtag = cms.bool(False)) process.genAK4ConstituentsTable = cms.EDProducer("GenJetConstituentTableProducer", candidates = cms.InputTag("genJetsConstituents"), #candidates = cms.InputTag("packedGenParticles"), jets = cms.InputTag("slimmedGenJets"), name = cms.string("GenJetCandsAK4"), + nameSV = cms.string("GenJetSVsAK4"), readBtag = cms.bool(False)) process.customizedPFCandsTask.add(process.genJetsConstituents) process.customizedPFCandsTask.add(process.genJetsParticleTable) diff --git a/test/nano106X_on_mini106X_2017_mc_NANO.py b/test/nano106X_on_mini106X_2017_mc_NANO.py index 4f3eb21..df9bd11 100644 --- a/test/nano106X_on_mini106X_2017_mc_NANO.py +++ b/test/nano106X_on_mini106X_2017_mc_NANO.py @@ -28,7 +28,8 @@ # Input source process.source = cms.Source("PoolSource", - fileNames = cms.untracked.vstring('/store/mc/RunIISummer19UL17MiniAOD/QCD_HT700to1000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/MINIAODSIM/106X_mc2017_realistic_v6-v2/280000/958303DA-D6A9-5D47-8A71-4D8F39FFC221.root'), + #fileNames = cms.untracked.vstring('/store/mc/RunIISummer19UL17MiniAOD/QCD_HT700to1000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/MINIAODSIM/106X_mc2017_realistic_v6-v2/280000/958303DA-D6A9-5D47-8A71-4D8F39FFC221.root'), + fileNames = cms.untracked.vstring('/store/mc/RunIIAutumn18MiniAOD/BulkGravTohhTohWWhbb_narrow_M-2800_TuneCP2_13TeV-madgraph_pythia8/MINIAODSIM/102X_upgrade2018_realistic_v15-v1/70000/DFABF044-2025-6E49-800A-C5BD664F8E55.root'), secondaryFileNames = cms.untracked.vstring() ) From 52d662af36dfab1f5e3d432fa2edaacdd2fea7e0 Mon Sep 17 00:00:00 2001 From: Andrzej Date: Fri, 8 May 2020 01:45:22 +0200 Subject: [PATCH 06/33] feat: Add SV variables --- plugins/JetConstituentTableProducer.cc | 77 +++++++------ python/addBTV.py | 154 +++++++++++++++++++++++++ python/nano_jmar_cff.py | 7 ++ test/check_info.py | 55 +++++++++ 4 files changed, 256 insertions(+), 37 deletions(-) create mode 100644 python/addBTV.py create mode 100644 test/check_info.py diff --git a/plugins/JetConstituentTableProducer.cc b/plugins/JetConstituentTableProducer.cc index 437f43e..90d9c2e 100644 --- a/plugins/JetConstituentTableProducer.cc +++ b/plugins/JetConstituentTableProducer.cc @@ -130,25 +130,27 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::Even for (const auto &sv : jetSVs) { outSVs->push_back(sv); jetIdx_sv.push_back(i_jet); - // Jet independent - sv_mass.push_back(sv->mass()); - sv_pt.push_back(sv->pt()); - - sv_ntracks.push_back(sv->numberOfDaughters()); - sv_chi2.push_back(sv->vertexChi2()); - sv_normchi2.push_back(catch_infs_and_bound(sv->vertexChi2() / sv->vertexNdof(), 1000, -1000, 1000)); - const auto& dxy_meas = vertexDxy(*sv, *pv_); - sv_dxy.push_back(dxy_meas.value()); - sv_dxysig.push_back(catch_infs_and_bound(dxy_meas.value() / dxy_meas.error(), 0, -1, 800)); - const auto& d3d_meas = vertexD3d(*sv, *pv_); - sv_d3d.push_back(d3d_meas.value()); - sv_d3dsig.push_back(catch_infs_and_bound(d3d_meas.value() / d3d_meas.error(), 0, -1, 800)); - sv_costhetasvpv.push_back(vertexDdotP(*sv, *pv_)); - // Jet related - sv_ptrel.push_back(sv->pt() / jet.pt()); - sv_phirel.push_back(reco::deltaPhi(*sv, jet)); - sv_deltaR.push_back(catch_infs_and_bound(std::fabs(reco::deltaR(*sv, jet_dir)) - 0.5, 0, -2, 0)); - sv_enratio.push_back(sv->energy() / jet.energy()); + if (readBtag_ && !vtxs_->empty()) { + // Jet independent + sv_mass.push_back(sv->mass()); + sv_pt.push_back(sv->pt()); + + sv_ntracks.push_back(sv->numberOfDaughters()); + sv_chi2.push_back(sv->vertexChi2()); + sv_normchi2.push_back(catch_infs_and_bound(sv->vertexChi2() / sv->vertexNdof(), 1000, -1000, 1000)); + const auto& dxy_meas = vertexDxy(*sv, *pv_); + sv_dxy.push_back(dxy_meas.value()); + sv_dxysig.push_back(catch_infs_and_bound(dxy_meas.value() / dxy_meas.error(), 0, -1, 800)); + const auto& d3d_meas = vertexD3d(*sv, *pv_); + sv_d3d.push_back(d3d_meas.value()); + sv_d3dsig.push_back(catch_infs_and_bound(d3d_meas.value() / d3d_meas.error(), 0, -1, 800)); + sv_costhetasvpv.push_back(vertexDdotP(*sv, *pv_)); + // Jet related + sv_ptrel.push_back(sv->pt() / jet.pt()); + sv_phirel.push_back(reco::deltaPhi(*sv, jet)); + sv_deltaR.push_back(catch_infs_and_bound(std::fabs(reco::deltaR(*sv, jet_dir)) - 0.5, 0, -2, 0)); + sv_enratio.push_back(sv->energy() / jet.energy()); + } } // PF Cands @@ -158,8 +160,8 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::Even auto candPtrs = cands_->ptrs(); auto candInNewList = std::find( candPtrs.begin(), candPtrs.end(), cand ); if ( candInNewList == candPtrs.end() ) { - std::cout << "Cannot find candidate : " << cand.id() << ", " << cand.key() << ", pt = " << cand->pt() << std::endl; - continue; + std::cout << "Cannot find candidate : " << cand.id() << ", " << cand.key() << ", pt = " << cand->pt() << std::endl; + continue; } outCands->push_back(cand); jetIdx_pf.push_back(i_jet); @@ -207,22 +209,23 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::Even auto svTable = std::make_unique(outSVs->size(), nameSV_, false); // We fill from here only stuff that cannot be created with the SimpleFlatTnameableProducer svTable->addColumn("jetIdx", jetIdx_sv, "Index of the parent jet", nanoaod::FlatTable::IntColumn); - svTable->addColumn("mass", sv_mass, "SV mass", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("pt", sv_pt, "SV pt", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("ntracks", sv_ntracks, "Number of trakcs associated to SV", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("chi2", sv_chi2, "chi2", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("normchi2", sv_normchi2, "chi2/ndof", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("dxy", sv_dxy, "", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("dxysig", sv_dxysig, "", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("d3d", sv_d3d, "", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("d3dsig", sv_d3dsig, "", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("costhetasvpv", sv_costhetasvpv, "", nanoaod::FlatTable::FloatColumn, 10); - // Jet related - svTable->addColumn("phirel", sv_phirel, "DeltaPhi(sv, jet)", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("ptrel", sv_ptrel, "pT relative to parent jet", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("deltaR", sv_deltaR, "dR from parent jet", nanoaod::FlatTable::FloatColumn, 10); - svTable->addColumn("enration", sv_enratio, "energy relative to parent jet", nanoaod::FlatTable::FloatColumn, 10); - + if (readBtag_) { + svTable->addColumn("mass", sv_mass, "SV mass", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("pt", sv_pt, "SV pt", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("ntracks", sv_ntracks, "Number of trakcs associated to SV", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("chi2", sv_chi2, "chi2", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("normchi2", sv_normchi2, "chi2/ndof", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("dxy", sv_dxy, "", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("dxysig", sv_dxysig, "", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("d3d", sv_d3d, "", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("d3dsig", sv_d3dsig, "", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("costhetasvpv", sv_costhetasvpv, "", nanoaod::FlatTable::FloatColumn, 10); + // Jet related + svTable->addColumn("phirel", sv_phirel, "DeltaPhi(sv, jet)", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("ptrel", sv_ptrel, "pT relative to parent jet", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("deltaR", sv_deltaR, "dR from parent jet", nanoaod::FlatTable::FloatColumn, 10); + svTable->addColumn("enration", sv_enratio, "energy relative to parent jet", nanoaod::FlatTable::FloatColumn, 10); + } iEvent.put(std::move(svTable), nameSV_); iEvent.put(std::move(outCands)); diff --git a/python/addBTV.py b/python/addBTV.py new file mode 100644 index 0000000..224ee77 --- /dev/null +++ b/python/addBTV.py @@ -0,0 +1,154 @@ +import FWCore.ParameterSet.Config as cms +# from PhysicsTools.NanoAOD.common_cff import * +from PhysicsTools.NanoAOD.common_cff import Var +from PhysicsTools.NanoAOD.jets_cff import jetTable, fatJetTable, subJetTable +from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection + + +def update_jets_AK4(process): + # Based on ``nanoAOD_addDeepInfo`` + # in https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py + _btagDiscriminators = [ + 'pfJetProbabilityBJetTags' + ] + updateJetCollection( + process, + jetSource=cms.InputTag('slimmedJets'), + jetCorrections=('AK4PFchs', + cms.vstring( + ['L1FastJet', 'L2Relative', 'L3Absolute', + 'L2L3Residual']), 'None'), + btagDiscriminators=_btagDiscriminators, + postfix='WithDeepInfo', + ) + process.load("Configuration.StandardSequences.MagneticField_cff") + process.jetCorrFactorsNano.src = "selectedUpdatedPatJetsWithDeepInfo" + process.updatedJets.jetSource = "selectedUpdatedPatJetsWithDeepInfo" + return process + + +def update_jets_AK8(process): + # Based on ``nanoAOD_addDeepInfoAK8`` + # in https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py + _btagDiscriminators = [ + 'pfJetProbabilityBJetTags' + ] + updateJetCollection( + process, + jetSource=cms.InputTag('slimmedJetsAK8'), + pvSource=cms.InputTag('offlineSlimmedPrimaryVertices'), + svSource=cms.InputTag('slimmedSecondaryVertices'), + rParam=0.8, + jetCorrections=('AK8PFPuppi', + cms.vstring([ + 'L1FastJet', 'L2Relative', 'L3Absolute', + 'L2L3Residual' + ]), 'None'), + btagDiscriminators=_btagDiscriminators, + postfix='AK8WithDeepInfo', + printWarning=False) + process.jetCorrFactorsAK8.src = "selectedUpdatedPatJetsAK8WithDeepInfo" + process.updatedJetsAK8.jetSource = "selectedUpdatedPatJetsAK8WithDeepInfo" + return process + + +def update_jets_AK8_subjet(process): + # Based on ``nanoAOD_addDeepInfoAK8`` + # in https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py + # and https://github.com/alefisico/RecoBTag-PerformanceMeasurements/blob/10_2_X_boostedCommissioning/test/runBTagAnalyzer_cfg.py + _btagDiscriminators = [ + 'pfJetProbabilityBJetTags' + ] + updateJetCollection( + process, + labelName='SoftDropSubjetsPF', + jetSource=cms.InputTag("slimmedJetsAK8PFPuppiSoftDropPacked", "SubJets"), + jetCorrections=('AK4PFPuppi', + ['L2Relative', 'L3Absolute'], 'None'), + btagDiscriminators=list(_btagDiscriminators), + explicitJTA=True, # needed for subjet b tagging + svClustering=False, # needed for subjet b tagging (IMPORTANT: Needs to be set to False to disable ghost-association which does not work with slimmed jets) + fatJets=cms.InputTag('slimmedJetsAK8'), # needed for subjet b tagging + rParam=0.8, # needed for subjet b tagging + postfix='AK8SubjetsWithDeepInfo') + + process.subJetTable.src = 'updatedPatJetsTransientCorrectedSoftDropSubjetsPFAK8SubjetsWithDeepInfo' ### VERY LONG NAME!!! :P + return process + + +def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): + addAK4 = not onlyAK8 + addAK8 = not onlyAK4 + + if addAK4: + process = update_jets_AK4(process) + if addAK8: + process = update_jets_AK8(process) + process = update_jets_AK8_subjet(process) + + process.customizeJetTask = cms.Task() + process.schedule.associate(process.customizeJetTask) + + CommonVars = cms.PSet( + Proba=Var("bDiscriminator('pfJetProbabilityBJetTags')", + float, + doc="Jet Probability (Usage:BTV)", + precision=10), + nBHadrons=Var("jetFlavourInfo().getbHadrons().size()", + int, + doc="number of b-hadrons"), + nCHadrons=Var("jetFlavourInfo().getcHadrons().size()", + int, + doc="number of c-hadrons"), + ) + + # AK4 + process.customJetExtTable = cms.EDProducer( + "SimpleCandidateFlatTableProducer", + src=jetTable.src, + cut=jetTable.cut, + name=jetTable.name, + doc=jetTable.doc, + singleton=cms.bool(False), # the number of entries is variable + extension=cms.bool(True), # this is the extension table for Jets + variables=cms.PSet( + CommonVars, + )) + + # AK8 + process.customFatJetExtTable = cms.EDProducer( + "SimpleCandidateFlatTableProducer", + src=fatJetTable.src, + cut=fatJetTable.cut, + name=fatJetTable.name, + doc=fatJetTable.doc, + singleton=cms.bool(False), # the number of entries is variable + extension=cms.bool(True), # this is the extension table for FatJets + variables=cms.PSet( + CommonVars, + )) + + # Subjets + process.customSubJetExtTable = cms.EDProducer( + "SimpleCandidateFlatTableProducer", + src=subJetTable.src, + cut=subJetTable.cut, + name=subJetTable.name, + doc=subJetTable.doc, + singleton=cms.bool(False), # the number of entries is variable + extension=cms.bool(True), # this is the extension table for FatJets + variables=cms.PSet( + CommonVars, + # Proba=Var("bDiscriminator('pfJetProbabilityBJetTags')", + # float, + # doc="Jet Probability (Usage:BTV)", + # precision=10), + )) + + if addAK4: + process.customizeJetTask.add(process.customJetExtTable) + if addAK8: + process.customizeJetTask.add(process.customFatJetExtTable) + process.customizeJetTask.add(process.customSubJetExtTable) + + return process diff --git a/python/nano_jmar_cff.py b/python/nano_jmar_cff.py index 2322939..cd1518b 100644 --- a/python/nano_jmar_cff.py +++ b/python/nano_jmar_cff.py @@ -1,35 +1,42 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAODJMAR.addPFCands_cff import addPFCands +from PhysicsTools.NanoAODJMAR.addBTV import add_BTV from PhysicsTools.NanoAOD.common_cff import Var def JMARnano_customizeMC(process): addPFCands(process, True) + add_BTV(process, True) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process def JMARnano_customizeMC_AK4JetsOnly(process): addPFCands(process, True, True, False) + add_BTV(process, True, True, False) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process def JMARnano_customizeMC_AK8JetsOnly(process): addPFCands(process, True, False, True) + add_BTV(process, True, False, True) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process #### DATA customization def JMARnano_customizeData(process): addPFCands(process, False) + add_BTV(process, False) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process def JMARnano_customizeData_AK4JetsOnly(process): addPFCands(process, False, True, False) + add_BTV(process, False, True, False) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process def JMARnano_customizeData_AK8JetsOnly(process): addPFCands(process, False, False, True) + add_BTV(process, False, False, True) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process diff --git a/test/check_info.py b/test/check_info.py new file mode 100644 index 0000000..25b9b2d --- /dev/null +++ b/test/check_info.py @@ -0,0 +1,55 @@ +import uproot + +f = uproot.open("nano106X_on_mini106X_2017_mc_NANO.root") +print('File contents:') +print(' ', f.keys()) + +print('File/Events contents:') +for key in f['Events'].keys(): + #if key.startswith("Jet_") or key.startswith("FatJet_") or key.startswith("SubJet_"): + pass + if "Jet" in key: + print(" ", key) + +interest = [ + "Jet_Proba", + "FatJet_Proba", + "SubJet_Proba", + "Jet_nBHadrons", + "FatJet_nBHadrons", + "SubJet_nBHadrons", + "nFatJet", + "FatJet_Proba", + "FatJetSV_jetIdx", + "FatJetSV_mass", + #"FatJetSV_phirel", + "nJetSV", + "JetSV_jetIdx", + "JetSV_mass", + #"JetSV_phirel", + "SV_mass", + 'FatJetSV_mass', + 'FatJetSV_pt', + 'FatJetSV_ntracks', + 'FatJetSV_chi2', + 'FatJetSV_normchi2', + 'FatJetSV_dxy', + 'FatJetSV_dxysig', + 'FatJetSV_d3d', + 'FatJetSV_d3dsig', + 'FatJetSV_costhetasvpv', + 'FatJetSV_phirel', + 'FatJetSV_ptrel', + 'FatJetSV_deltaR', + 'FatJetSV_enration', + 'FatJetSV_jetIdx', +] + +for var in interest: + print(var) + print(f['Events'].arrays([var])[var]) + +# for ev in f['Events'].arrays(['Jet_Proba'])['Jet_Proba']: +# print(ev) +# print("Jet") +# From 6029d0bf831b139a6d9251c340d923915e213b75 Mon Sep 17 00:00:00 2001 From: Andrzej Date: Fri, 8 May 2020 11:06:09 +0200 Subject: [PATCH 07/33] Fix dRs --- python/addPFCands_cff.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index 519822a..afe444d 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -50,12 +50,14 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): candidates = cms.InputTag("finalJetsConstituents"), #candidates = cms.InputTag("packedPFCandidates"), jets = cms.InputTag("finalJetsAK8"), + jet_radius = cms.double(0.8), name = cms.string("JetPFCandsAK8"), nameSV = cms.string("JetSVsAK8")) process.customAK4ConstituentsTable = cms.EDProducer("PatJetConstituentTableProducer", #candidates = cms.InputTag("packedPFCandidates"), candidates = cms.InputTag("finalJetsConstituents"), jets = cms.InputTag("finalJets"), + jet_radius = cms.double(0.4), name = cms.string("JetPFCandsAK4"), nameSV = cms.string("JetSVsAK4")) From 253b4c0852a3e87df4e61a6b5a6b3083952230e4 Mon Sep 17 00:00:00 2001 From: Andrzej Date: Fri, 8 May 2020 11:07:50 +0200 Subject: [PATCH 08/33] Checkout nano first --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e5bdcab..503f23a 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ For **UL** 2016, 2017 and 2018 data and MC **NanoAODv6** according to the [XPOG cmsrel CMSSW_10_6_5 cd CMSSW_10_6_5/src cmsenv +git cms-addpkg PhysicsTools/NanoAOD git cms-merge-topic laurenhay:setmerger_10_6_5 git clone git@github.com:cms-jet/NanoAODJMAR.git -b dev_106x PhysicsTools/NanoAODJMAR scram b -j 10 From f476a7df54496ae76cc66eac6c08385d702a94fc Mon Sep 17 00:00:00 2001 From: Alejandro Date: Fri, 8 May 2020 11:36:42 +0200 Subject: [PATCH 09/33] updating README --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e5bdcab..6f52068 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ cmsrel CMSSW_10_6_5 cd CMSSW_10_6_5/src cmsenv git cms-merge-topic laurenhay:setmerger_10_6_5 +git cms-addpkg Physics/NanoAOD git clone git@github.com:cms-jet/NanoAODJMAR.git -b dev_106x PhysicsTools/NanoAODJMAR scram b -j 10 cd PhysicsTools/NanoAODJMAR/test @@ -33,6 +34,21 @@ cmsRun nano106X_on_mini106X_2017_mc_NANO.py cmsRun nano106X_on_mini106X_2017_data_NANO.py ``` +### How to create python files using cmsDriver + +All the previous python config files were produced with `cmsDriver.py`. Two imporant parameters that one needs to verify in the central nanoAOD documentation are `--conditions` and `--era`. Then, an example of how to create those file, if needed, is shown below: + +``` +cmsDriver.py nano102x_on_mini94x_2016_mc --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 102X_mcRun2_asymptotic_v8 --step NANO --era Run2_2016,run2_nanoAOD_94X2016 --customise_commands="process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False)))\n" -n 100 --filein /store/mc/RunIISummer16MiniAODv3/QCD_HT1000to1500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/120000/086BBC76-7AEA-E811-AA5A-6CC2173D9FB0.root --nThreads 2 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeMC +``` + +## How to create website with nanoAOD content + +To create nice websites like [this one](http://algomez.web.cern.ch/algomez/testWeb/JMECustomNano102x_mc_v01.html#Jet) with the content of nanoAOD, use the `inspectNanoFile.py` file from the `PhysicsTools/nanoAOD` package as: +``` +python PhysicsTools/NanoAOD/test/inspectNanoFile.py NANOAOD.root -s website_with_collectionsize.html -d website_with_collectiondescription.html +``` + ## Running brilcalc These are condensed instructions from the lumi POG TWiki (https://twiki.cern.ch/twiki/bin/view/CMS/TWikiLUM). Also see the brilcalc quickstart guide: https://twiki.cern.ch/twiki/bin/viewauth/CMS/BrilcalcQuickStart. @@ -90,4 +107,3 @@ The luminosity of interest will be listed under "totrecorded(/fb)." You can also Note: '-b "STABLE BEAMS"' is optional if you've already run over the golden json. Using the normtag is NOT OPTIONAL, as it defines the final calibrations and detectors that are used for a given run. ---> From 09fc4e87e9c71cd4f05faff1b820c8c950a7f215 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Fri, 8 May 2020 12:05:32 +0200 Subject: [PATCH 10/33] fixing README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 6a08aa6..fa8582e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ cd CMSSW_10_6_5/src cmsenv git cms-addpkg PhysicsTools/NanoAOD git cms-merge-topic laurenhay:setmerger_10_6_5 -git cms-addpkg Physics/NanoAOD git clone git@github.com:cms-jet/NanoAODJMAR.git -b dev_106x PhysicsTools/NanoAODJMAR scram b -j 10 cd PhysicsTools/NanoAODJMAR/test From f1d161eb1ba29eb4403e2f88bccccb80322609c6 Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Espinosa Date: Fri, 8 May 2020 19:14:06 +0200 Subject: [PATCH 11/33] updating README --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 503f23a..d4181d0 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # NanoAODJMAR This is a [NanoAOD](https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookNanoAOD) framework for advance developments of jet algorithms. -The current preliminary content of this development branch can be seen [here](http://algomez.web.cern.ch/algomez/testWeb/JMARNanoAODv6_106X_v00_size.html). +The current preliminary content of this development branch can be seen [here](http://algomez.web.cern.ch/algomez/testWeb/JMARnanoplusBTag_content_v01.html) and the size [here](http://algomez.web.cern.ch/algomez/testWeb/JMARnanoplusBTag_size_v01.html). This format can be used with [fastjet](http://fastjet.fr) directly. ## Recipe -**THIS IS A DEVELOPMENT BRANCH dev_106x** +**THIS IS A DEVELOPMENT BRANCH** For **UL** 2016, 2017 and 2018 data and MC **NanoAODv6** according to the [XPOG recommendations](https://gitlab.cern.ch/cms-nanoAOD/nanoaod-doc/-/wikis/Releases/NanoAODv6): @@ -34,6 +34,21 @@ cmsRun nano106X_on_mini106X_2017_mc_NANO.py cmsRun nano106X_on_mini106X_2017_data_NANO.py ``` +### How to create python files using cmsDriver + +All the previous python config files were produced with `cmsDriver.py`. Two imporant parameters that one needs to verify in the central nanoAOD documentation are `--conditions` and `--era`. Then, an example of how to create those file, if needed, is shown below: + +``` +cmsDriver.py nano102x_on_mini94x_2016_mc --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 102X_mcRun2_asymptotic_v8 --step NANO --era Run2_2016,run2_nanoAOD_94X2016 --customise_commands="process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False)))\n" -n 100 --filein /store/mc/RunIISummer16MiniAODv3/QCD_HT1000to1500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/120000/086BBC76-7AEA-E811-AA5A-6CC2173D9FB0.root --nThreads 2 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeMC +``` + +## How to create website with nanoAOD content + +To create nice websites like [this one](http://algomez.web.cern.ch/algomez/testWeb/JMECustomNano102x_mc_v01.html#Jet) with the content of nanoAOD, use the `inspectNanoFile.py` file from the `PhysicsTools/nanoAOD` package as: +``` +python PhysicsTools/NanoAOD/test/inspectNanoFile.py NANOAOD.root -s website_with_collectionsize.html -d website_with_collectiondescription.html +``` + ## Running brilcalc These are condensed instructions from the lumi POG TWiki (https://twiki.cern.ch/twiki/bin/view/CMS/TWikiLUM). Also see the brilcalc quickstart guide: https://twiki.cern.ch/twiki/bin/viewauth/CMS/BrilcalcQuickStart. @@ -91,4 +107,4 @@ The luminosity of interest will be listed under "totrecorded(/fb)." You can also Note: '-b "STABLE BEAMS"' is optional if you've already run over the golden json. Using the normtag is NOT OPTIONAL, as it defines the final calibrations and detectors that are used for a given run. ---> + From aa34769771169a9e0d958e9b8ab832b2225ae277 Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Espinosa Date: Fri, 8 May 2020 19:18:43 +0200 Subject: [PATCH 12/33] Fixing README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ad2243..c7e2beb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ cd CMSSW_10_6_5/src cmsenv git cms-addpkg PhysicsTools/NanoAOD git cms-merge-topic laurenhay:setmerger_10_6_5 -git clone git@github.com:cms-jet/NanoAODJMAR.git -b dev_106x PhysicsTools/NanoAODJMAR +git clone git@github.com:cms-jet/NanoAODJMAR.git PhysicsTools/NanoAODJMAR scram b -j 10 cd PhysicsTools/NanoAODJMAR/test ``` From e316b0c8c51d990b8ccd204f4d4850c287c942d7 Mon Sep 17 00:00:00 2001 From: Lauren Hay Date: Tue, 12 May 2020 22:58:29 +0200 Subject: [PATCH 13/33] add all PF cands option --- python/addPFCands_cff.py | 84 ++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index 0605ca2..76ef4b7 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -1,32 +1,38 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.common_cff import * -def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): +def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=False): process.customizedPFCandsTask = cms.Task( ) process.schedule.associate(process.customizedPFCandsTask) process.finalJetsAK8Constituents = cms.EDProducer("PatJetConstituentPtrSelector", src = cms.InputTag("finalJetsAK8"), - cut = cms.string("") + cut = cms.string("pt > 170.0") ) process.finalJetsAK4Constituents = cms.EDProducer("PatJetConstituentPtrSelector", src = cms.InputTag("finalJets"), - cut = cms.string("") + cut = cms.string("pt > 30.0") ) - if onlyAK4: + if allPF: + candInput = cms.InputTag("packedPFCandidates") + elif onlyAK4: candList = cms.VInputTag(cms.InputTag("finalJetsAK4Constituents", "constituents")) process.customizedPFCandsTask.add(process.finalJetsAK4Constituents) + process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList) + candInput = cms.InputTag("finalJetsConstituents") elif onlyAK8: candList = cms.VInputTag(cms.InputTag("finalJetsAK8Constituents", "constituents")) process.customizedPFCandsTask.add(process.finalJetsAK8Constituents) + process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList) + candInput = cms.InputTag("finalJetsConstituents") else: candList = cms.VInputTag(cms.InputTag("finalJetsAK4Constituents", "constituents"), cms.InputTag("finalJetsAK8Constituents", "constituents")) process.customizedPFCandsTask.add(process.finalJetsAK4Constituents) process.customizedPFCandsTask.add(process.finalJetsAK8Constituents) - process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", - src = candList) + process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList) + candInput = cms.InputTag("finalJetsConstituents") process.customConstituentsExtTable = cms.EDProducer("SimpleCandidateFlatTableProducer", - src = cms.InputTag("finalJetsConstituents"), + src = candInput, cut = cms.string(""), #we should not filter after pruning name = cms.string("JetPFCands"), doc = cms.string("interesting particles from AK4 and AK8 jets"), @@ -46,49 +52,52 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): trkQuality = Var("?hasTrackDetails()?pseudoTrack().qualityMask():0", int, doc="track quality mask"), ) ) - process.customAK8ConstituentsTable = cms.EDProducer("PatJetConstituentTableProducer", - candidates = cms.InputTag("finalJetsConstituents"), - #candidates = cms.InputTag("packedPFCandidates"), + process.customAK8ConstituentsTable = cms.EDProducer("JetConstituentTableProducer", + candidates = candInput, jets = cms.InputTag("finalJetsAK8"), name = cms.string("JetPFCandsAK8")) - process.customAK4ConstituentsTable = cms.EDProducer("PatJetConstituentTableProducer", - #candidates = cms.InputTag("packedPFCandidates"), - candidates = cms.InputTag("finalJetsConstituents"), - jets = cms.InputTag("finalJets"), - name = cms.string("JetPFCandsAK4")) - - process.customizedPFCandsTask.add(process.finalJetsConstituents) + process.customAK4ConstituentsTable = cms.EDProducer("JetConstituentTableProducer", + candidates = candInput, + jets = cms.InputTag("finalJets"), + name = cms.string("JetPFCandsAK4")) + if not allPF: + process.customizedPFCandsTask.add(process.finalJetsConstituents) process.customizedPFCandsTask.add(process.customConstituentsExtTable) process.customizedPFCandsTask.add(process.customAK8ConstituentsTable) - process.customizedPFCandsTask.add(process.customAK4ConstituentsTable) +# process.customizedPFCandsTask.add(process.customAK4ConstituentsTable) if runOnMC: process.genJetsAK8Constituents = cms.EDProducer("GenJetPackedConstituentPtrSelector", src = cms.InputTag("slimmedGenJetsAK8"), - cut = cms.string("") + cut = cms.string("pt > 100.0") ) process.genJetsAK4Constituents = process.genJetsAK8Constituents.clone( src = cms.InputTag("slimmedGenJets"), - cut = cms.string("") + cut = cms.string("pt > 20.0") ) - if onlyAK4: + if allPF: + genCandInput = cms.InputTag("packedGenParticles") + elif onlyAK4: genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents")) process.customizedPFCandsTask.add(process.genJetsAK4Constituents) + genCandInput = cms.InputTag("genJetsConstituents") + process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) elif onlyAK8: genCandList = cms.VInputTag(cms.InputTag("genJetsAK8Constituents", "constituents")) process.customizedPFCandsTask.add(process.genJetsAK8Constituents) + genCandInput = cms.InputTag("genJetsConstituents") + process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) else: genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents"), cms.InputTag("genJetsAK8Constituents", "constituents")) process.customizedPFCandsTask.add(process.genJetsAK4Constituents) process.customizedPFCandsTask.add(process.genJetsAK8Constituents) - process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", - src = genCandList - ) + genCandInput = cms.InputTag("genJetsConstituents") + process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) process.genJetsParticleTable = cms.EDProducer("SimpleCandidateFlatTableProducer", - src = cms.InputTag("genJetsConstituents"), + src = genCandInput, cut = cms.string(""), #we should not filter after pruning name= cms.string("GenJetCands"), doc = cms.string("interesting gen particles from AK4 and AK8 jets"), @@ -97,19 +106,18 @@ def addPFCands(process, runOnMC=False, onlyAK4=False, onlyAK8=False): variables = cms.PSet(CandVars ) ) - process.genAK8ConstituentsTable = cms.EDProducer("GenJetConstituentTableProducer", - candidates = cms.InputTag("genJetsConstituents"), - #candidates = cms.InputTag("packedGenParticles"), - jets = cms.InputTag("slimmedGenJetsAK8"), - name = cms.string("GenJetCandsAK8"), - readBtag = cms.bool(False)) - process.genAK4ConstituentsTable = cms.EDProducer("GenJetConstituentTableProducer", - candidates = cms.InputTag("genJetsConstituents"), - #candidates = cms.InputTag("packedGenParticles"), - jets = cms.InputTag("slimmedGenJets"), - name = cms.string("GenJetCandsAK4"), - readBtag = cms.bool(False)) - process.customizedPFCandsTask.add(process.genJetsConstituents) + process.genAK8ConstituentsTable = cms.EDProducer("JetConstituentTableProducer", + candidates = genCandInput, + jets = cms.InputTag("slimmedGenJetsAK8"), + name = cms.string("GenJetCandsAK8"), + readBtag = cms.bool(False)) + process.genAK4ConstituentsTable = cms.EDProducer("JetConstituentTableProducer", + candidates = genCandInput, + jets = cms.InputTag("slimmedGenJets"), + name = cms.string("GenJetCandsAK4"), + readBtag = cms.bool(False)) + if not allPF: + process.customizedPFCandsTask.add(process.genJetsConstituents) process.customizedPFCandsTask.add(process.genJetsParticleTable) process.customizedPFCandsTask.add(process.genAK8ConstituentsTable) process.customizedPFCandsTask.add(process.genAK4ConstituentsTable) From e78dfad3869f79240e0a7763888fbbfbc31fb855 Mon Sep 17 00:00:00 2001 From: Lauren Hay Date: Tue, 12 May 2020 23:12:00 +0200 Subject: [PATCH 14/33] Removed cuts. --- python/addPFCands_cff.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index da9273d..91e9363 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -7,11 +7,11 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal process.finalJetsAK8Constituents = cms.EDProducer("PatJetConstituentPtrSelector", src = cms.InputTag("finalJetsAK8"), - cut = cms.string("pt > 170.0") + cut = cms.string("") ) process.finalJetsAK4Constituents = cms.EDProducer("PatJetConstituentPtrSelector", src = cms.InputTag("finalJets"), - cut = cms.string("pt > 30.0") + cut = cms.string("") ) if allPF: candInput = cms.InputTag("packedPFCandidates") @@ -75,13 +75,13 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal process.genJetsAK8Constituents = cms.EDProducer("GenJetPackedConstituentPtrSelector", src = cms.InputTag("slimmedGenJetsAK8"), - cut = cms.string("pt > 100.0") + cut = cms.string("") ) process.genJetsAK4Constituents = process.genJetsAK8Constituents.clone( src = cms.InputTag("slimmedGenJets"), - cut = cms.string("pt > 20.0") + cut = cms.string("") ) if allPF: genCandInput = cms.InputTag("packedGenParticles") From 6478e416ab290d48a2e2d1ea11f2a65acd2c0e2f Mon Sep 17 00:00:00 2001 From: Salvatore Rappoccio Date: Tue, 19 May 2020 19:59:08 +0200 Subject: [PATCH 15/33] Somehow the cherry-pick maimed the addPFCands class --- python/addPFCands_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index 91e9363..1888aba 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -52,7 +52,7 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal trkQuality = Var("?hasTrackDetails()?pseudoTrack().qualityMask():0", int, doc="track quality mask"), ) ) - process.customAK8ConstituentsTable = cms.EDProducer("JetConstituentTableProducer", + process.customAK8ConstituentsTable = cms.EDProducer("PatJetConstituentTableProducer", candidates = candInput, jets = cms.InputTag("finalJetsAK8"), jet_radius = cms.double(0.8), From 18713b523510b61dad8f971d890defdfcf9a3df5 Mon Sep 17 00:00:00 2001 From: Salvatore Rappoccio Date: Tue, 19 May 2020 20:02:35 +0200 Subject: [PATCH 16/33] Adjusting README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c7e2beb..527d1fb 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ cmsrel CMSSW_10_6_5 cd CMSSW_10_6_5/src cmsenv git cms-addpkg PhysicsTools/NanoAOD -git cms-merge-topic laurenhay:setmerger_10_6_5 -git clone git@github.com:cms-jet/NanoAODJMAR.git PhysicsTools/NanoAODJMAR +git cms-merge-topic rappoccio:setmerger_10_6_5 +git clone https://github.com/cms-jet/NanoAODJMAR.git PhysicsTools/NanoAODJMAR scram b -j 10 cd PhysicsTools/NanoAODJMAR/test ``` From f0cdfe243a3a3e1bef295d92947dd294a2ecdc6f Mon Sep 17 00:00:00 2001 From: Salvatore Rappoccio Date: Wed, 20 May 2020 22:03:01 +0200 Subject: [PATCH 17/33] Protecting against null pointers in miniaod jets with some kinematic cuts --- python/addPFCands_cff.py | 18 ++++++++---------- python/nano_jmar_cff.py | 13 +++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index 1888aba..d8e8769 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -60,7 +60,7 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal nameSV = cms.string("JetSVsAK8")) process.customAK4ConstituentsTable = cms.EDProducer("PatJetConstituentTableProducer", #candidates = cms.InputTag("packedPFCandidates"), - candidates = cms.InputTag("finalJetsConstituents"), + candidates = candInput, jets = cms.InputTag("finalJets"), jet_radius = cms.double(0.4), name = cms.string("JetPFCandsAK4"), @@ -69,19 +69,19 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal process.customizedPFCandsTask.add(process.finalJetsConstituents) process.customizedPFCandsTask.add(process.customConstituentsExtTable) process.customizedPFCandsTask.add(process.customAK8ConstituentsTable) -# process.customizedPFCandsTask.add(process.customAK4ConstituentsTable) + process.customizedPFCandsTask.add(process.customAK4ConstituentsTable) if runOnMC: process.genJetsAK8Constituents = cms.EDProducer("GenJetPackedConstituentPtrSelector", src = cms.InputTag("slimmedGenJetsAK8"), - cut = cms.string("") + cut = cms.string("pt > 100") ) process.genJetsAK4Constituents = process.genJetsAK8Constituents.clone( src = cms.InputTag("slimmedGenJets"), - cut = cms.string("") + cut = cms.string("pt > 20") ) if allPF: genCandInput = cms.InputTag("packedGenParticles") @@ -112,16 +112,14 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal ) ) process.genAK8ConstituentsTable = cms.EDProducer("GenJetConstituentTableProducer", - candidates = cms.InputTag("genJetsConstituents"), - #candidates = cms.InputTag("packedGenParticles"), - jets = cms.InputTag("slimmedGenJetsAK8"), + candidates = genCandInput, + jets = cms.InputTag("genJetsAK8Constituents"), # Note: The name has "Constituents" in it, but these are the jets name = cms.string("GenJetCandsAK8"), nameSV = cms.string("GenJetSVsAK8"), readBtag = cms.bool(False)) process.genAK4ConstituentsTable = cms.EDProducer("GenJetConstituentTableProducer", - candidates = cms.InputTag("genJetsConstituents"), - #candidates = cms.InputTag("packedGenParticles"), - jets = cms.InputTag("slimmedGenJets"), + candidates = genCandInput, + jets = cms.InputTag("genJetsAK4Constituents"), # Note: The name has "Constituents" in it, but these are the jets name = cms.string("GenJetCandsAK4"), nameSV = cms.string("GenJetSVsAK4"), readBtag = cms.bool(False)) diff --git a/python/nano_jmar_cff.py b/python/nano_jmar_cff.py index cd1518b..3f3dd73 100644 --- a/python/nano_jmar_cff.py +++ b/python/nano_jmar_cff.py @@ -10,6 +10,13 @@ def JMARnano_customizeMC(process): process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process +def JMARnano_customizeMC_allPF(process): + addPFCands(process, True, True) + add_BTV(process, True) + process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication + return process + + def JMARnano_customizeMC_AK4JetsOnly(process): addPFCands(process, True, True, False) add_BTV(process, True, True, False) @@ -29,6 +36,12 @@ def JMARnano_customizeData(process): process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process +def JMARnano_customizeData_allPF(process): + addPFCands(process, False, True) + add_BTV(process, False) + process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication + return process + def JMARnano_customizeData_AK4JetsOnly(process): addPFCands(process, False, True, False) add_BTV(process, False, True, False) From efd7f6ed417d49c2170ed441c2064501129e07f8 Mon Sep 17 00:00:00 2001 From: Lauren Hay Date: Thu, 21 May 2020 22:58:47 +0200 Subject: [PATCH 18/33] Fixing jet collections added to the process for gen cuts. --- plugins/JetConstituentTableProducer.cc | 2 +- python/addPFCands_cff.py | 8 +++----- python/nano_jmar_cff.py | 12 ++++++------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/plugins/JetConstituentTableProducer.cc b/plugins/JetConstituentTableProducer.cc index 90d9c2e..ae1b2dd 100644 --- a/plugins/JetConstituentTableProducer.cc +++ b/plugins/JetConstituentTableProducer.cc @@ -160,7 +160,7 @@ void JetConstituentTableProducer::produce(edm::Event &iEvent, const edm::Even auto candPtrs = cands_->ptrs(); auto candInNewList = std::find( candPtrs.begin(), candPtrs.end(), cand ); if ( candInNewList == candPtrs.end() ) { - std::cout << "Cannot find candidate : " << cand.id() << ", " << cand.key() << ", pt = " << cand->pt() << std::endl; + //std::cout << "Cannot find candidate : " << cand.id() << ", " << cand.key() << ", pt = " << cand->pt() << std::endl; continue; } outCands->push_back(cand); diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index d8e8769..93e9b73 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -87,18 +87,14 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal genCandInput = cms.InputTag("packedGenParticles") elif onlyAK4: genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents")) - process.customizedPFCandsTask.add(process.genJetsAK4Constituents) genCandInput = cms.InputTag("genJetsConstituents") process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) elif onlyAK8: genCandList = cms.VInputTag(cms.InputTag("genJetsAK8Constituents", "constituents")) - process.customizedPFCandsTask.add(process.genJetsAK8Constituents) genCandInput = cms.InputTag("genJetsConstituents") process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) else: genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents"), cms.InputTag("genJetsAK8Constituents", "constituents")) - process.customizedPFCandsTask.add(process.genJetsAK4Constituents) - process.customizedPFCandsTask.add(process.genJetsAK8Constituents) genCandInput = cms.InputTag("genJetsConstituents") process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) process.genJetsParticleTable = cms.EDProducer("SimpleCandidateFlatTableProducer", @@ -123,10 +119,12 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal name = cms.string("GenJetCandsAK4"), nameSV = cms.string("GenJetSVsAK4"), readBtag = cms.bool(False)) + process.customizedPFCandsTask.add(process.genJetsAK4Constituents) #Note: For gen need to add jets to the process to keep pt cuts. + process.customizedPFCandsTask.add(process.genJetsAK8Constituents) if not allPF: process.customizedPFCandsTask.add(process.genJetsConstituents) process.customizedPFCandsTask.add(process.genJetsParticleTable) process.customizedPFCandsTask.add(process.genAK8ConstituentsTable) process.customizedPFCandsTask.add(process.genAK4ConstituentsTable) - + return process diff --git a/python/nano_jmar_cff.py b/python/nano_jmar_cff.py index 3f3dd73..5dc67ce 100644 --- a/python/nano_jmar_cff.py +++ b/python/nano_jmar_cff.py @@ -18,13 +18,13 @@ def JMARnano_customizeMC_allPF(process): def JMARnano_customizeMC_AK4JetsOnly(process): - addPFCands(process, True, True, False) - add_BTV(process, True, True, False) + addPFCands(process, True, False, True) + add_BTV(process, True, True) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process def JMARnano_customizeMC_AK8JetsOnly(process): - addPFCands(process, True, False, True) + addPFCands(process, True, False, False, True) add_BTV(process, True, False, True) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process @@ -43,13 +43,13 @@ def JMARnano_customizeData_allPF(process): return process def JMARnano_customizeData_AK4JetsOnly(process): - addPFCands(process, False, True, False) - add_BTV(process, False, True, False) + addPFCands(process, False, False, True) + add_BTV(process, False, True) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process def JMARnano_customizeData_AK8JetsOnly(process): - addPFCands(process, False, False, True) + addPFCands(process, False, False, False, True) add_BTV(process, False, False, True) process.NANOAODSIMoutput.fakeNameForCrab = cms.untracked.bool(True) # needed for crab publication return process From d6fa44c21fea203c19b16f4362a9213e74632d8d Mon Sep 17 00:00:00 2001 From: Alena Date: Thu, 28 May 2020 19:00:50 +0200 Subject: [PATCH 19/33] discriminators and sub idx --- python/addBTV.py | 99 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 7 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index 224ee77..da8c03d 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -9,7 +9,21 @@ def update_jets_AK4(process): # Based on ``nanoAOD_addDeepInfo`` # in https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py _btagDiscriminators = [ - 'pfJetProbabilityBJetTags' + 'pfJetProbabilityBJetTags', + 'pfDeepCSVJetTags:probb', + 'pfNegativeDeepCSVJetTags:probb', + 'pfPositiveDeepCSVJetTags:probb', + 'pfDeepCSVJetTags:probc', + 'pfNegativeDeepCSVJetTags:probc', + 'pfPositiveDeepCSVJetTags:probc', + 'pfDeepCSVJetTags:probbb', + 'pfNegativeDeepCSVJetTags:probbb', + 'pfPositiveDeepCSVJetTags:probbb', + 'pfDeepCSVJetTags:probudsg', + 'pfNegativeDeepCSVJetTags:probudsg', + 'pfPositiveDeepCSVJetTags:probudsg', + #'pfCombinedMVAV2BJetTags', + #'pfCombinedInclusiveSecondaryVertexV2BJetTags' ] updateJetCollection( process, @@ -31,7 +45,21 @@ def update_jets_AK8(process): # Based on ``nanoAOD_addDeepInfoAK8`` # in https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py _btagDiscriminators = [ - 'pfJetProbabilityBJetTags' + 'pfJetProbabilityBJetTags', + 'pfDeepCSVJetTags:probb', + 'pfNegativeDeepCSVJetTags:probb', + 'pfPositiveDeepCSVJetTags:probb', + 'pfDeepCSVJetTags:probc', + 'pfNegativeDeepCSVJetTags:probc', + 'pfPositiveDeepCSVJetTags:probc', + 'pfDeepCSVJetTags:probbb', + 'pfNegativeDeepCSVJetTags:probbb', + 'pfPositiveDeepCSVJetTags:probbb', + 'pfDeepCSVJetTags:probudsg', + 'pfNegativeDeepCSVJetTags:probudsg', + 'pfPositiveDeepCSVJetTags:probudsg', + #'pfCombinedMVAV2BJetTags', + #'pfCombinedInclusiveSecondaryVertexV2BJetTags' ] updateJetCollection( process, @@ -57,7 +85,21 @@ def update_jets_AK8_subjet(process): # in https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py # and https://github.com/alefisico/RecoBTag-PerformanceMeasurements/blob/10_2_X_boostedCommissioning/test/runBTagAnalyzer_cfg.py _btagDiscriminators = [ - 'pfJetProbabilityBJetTags' + 'pfJetProbabilityBJetTags', + 'pfDeepCSVJetTags:probb', + 'pfNegativeDeepCSVJetTags:probb', + 'pfPositiveDeepCSVJetTags:probb', + 'pfDeepCSVJetTags:probc', + 'pfNegativeDeepCSVJetTags:probc', + 'pfPositiveDeepCSVJetTags:probc', + 'pfDeepCSVJetTags:probbb', + 'pfNegativeDeepCSVJetTags:probbb', + 'pfPositiveDeepCSVJetTags:probbb', + 'pfDeepCSVJetTags:probudsg', + 'pfNegativeDeepCSVJetTags:probudsg', + 'pfPositiveDeepCSVJetTags:probudsg', + 'pfCombinedMVAV2BJetTags', + #'pfCombinedInclusiveSecondaryVertexV2BJetTags' ] updateJetCollection( process, @@ -79,6 +121,7 @@ def update_jets_AK8_subjet(process): def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): addAK4 = not onlyAK8 addAK8 = not onlyAK4 + addMC = runOnMC if addAK4: process = update_jets_AK4(process) @@ -100,7 +143,21 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): nCHadrons=Var("jetFlavourInfo().getcHadrons().size()", int, doc="number of c-hadrons"), - ) + #RENAME THEM! + btagDeepB_sin=Var("bDiscriminator('pfDeepCSVJetTags:probb')", + float, + doc="DeepCSV b tag discriminator", + precision=22), + btagDeepB_dob=Var("bDiscriminator('pfDeepCSVJetTags:probbb')", + float, + doc="DeepCSV bb tag discriminator", + precision=22), + btagDeepL = Var("bDiscriminator('pfDeepCSVJetTags:probudsg')", + float, + doc="DeepCSV light btag discriminator", + precision=22), + #RENAME THEM! If you can + ) # AK4 process.customJetExtTable = cms.EDProducer( @@ -112,7 +169,7 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): singleton=cms.bool(False), # the number of entries is variable extension=cms.bool(True), # this is the extension table for Jets variables=cms.PSet( - CommonVars, + CommonVars, )) # AK8 @@ -125,7 +182,12 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): singleton=cms.bool(False), # the number of entries is variable extension=cms.bool(True), # this is the extension table for FatJets variables=cms.PSet( - CommonVars, + CommonVars, + btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", + float, + doc="DeepCSV charm btag discriminator", + precision=22), + )) # Subjets @@ -143,12 +205,35 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): # float, # doc="Jet Probability (Usage:BTV)", # precision=10), - )) + btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", + float, + doc="DeepCSV charm btag discriminator", + precision=22), + + )) + + process.customSubJetMCExtTable = cms.EDProducer( + "SimpleCandidateFlatTableProducer", + src = subJetTable.src, + cut = subJetTable.cut, + name = subJetTable.name, + doc=subJetTable.doc, + singleton = cms.bool(False), + extension = cms.bool(True), + variables = cms.PSet( + genJetAK8Idx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", + int, + doc="index of matched gen AK8 jet"), + ) + ) if addAK4: process.customizeJetTask.add(process.customJetExtTable) if addAK8: process.customizeJetTask.add(process.customFatJetExtTable) process.customizeJetTask.add(process.customSubJetExtTable) + if addMC and addAK8: + process.customizeJetTask.add(process.customSubJetMCExtTable) return process + From 31f29bcb19fe5efe3cb4e6e90d2d1682344b3ab1 Mon Sep 17 00:00:00 2001 From: Alena Date: Fri, 29 May 2020 14:21:27 +0200 Subject: [PATCH 20/33] SubGen Idx name --- python/addBTV.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index da8c03d..5360057 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -221,9 +221,9 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): singleton = cms.bool(False), extension = cms.bool(True), variables = cms.PSet( - genJetAK8Idx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", + subGenJetAK8Idx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", int, - doc="index of matched gen AK8 jet"), + doc="index of matched gen Sub jet"), ) ) From a7bf59c982060ab387741e2e72371319ce0d69fe Mon Sep 17 00:00:00 2001 From: Alena Date: Fri, 29 May 2020 14:32:09 +0200 Subject: [PATCH 21/33] Discriminators names --- python/addBTV.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index 5360057..2255bec 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -144,11 +144,11 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): int, doc="number of c-hadrons"), #RENAME THEM! - btagDeepB_sin=Var("bDiscriminator('pfDeepCSVJetTags:probb')", + btagDeepB_b=Var("bDiscriminator('pfDeepCSVJetTags:probb')", float, doc="DeepCSV b tag discriminator", precision=22), - btagDeepB_dob=Var("bDiscriminator('pfDeepCSVJetTags:probbb')", + btagDeepB_bb=Var("bDiscriminator('pfDeepCSVJetTags:probbb')", float, doc="DeepCSV bb tag discriminator", precision=22), From 9c95c027f6987efd0459b93494f61286e757bd2c Mon Sep 17 00:00:00 2001 From: Alena Date: Fri, 29 May 2020 14:40:32 +0200 Subject: [PATCH 22/33] btagDiscriminators --- python/addBTV.py | 54 +++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index 2255bec..2e06e3c 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -11,19 +11,17 @@ def update_jets_AK4(process): _btagDiscriminators = [ 'pfJetProbabilityBJetTags', 'pfDeepCSVJetTags:probb', - 'pfNegativeDeepCSVJetTags:probb', - 'pfPositiveDeepCSVJetTags:probb', + #'pfNegativeDeepCSVJetTags:probb', + #'pfPositiveDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', - 'pfNegativeDeepCSVJetTags:probc', - 'pfPositiveDeepCSVJetTags:probc', + #'pfNegativeDeepCSVJetTags:probc', + #'pfPositiveDeepCSVJetTags:probc', 'pfDeepCSVJetTags:probbb', - 'pfNegativeDeepCSVJetTags:probbb', - 'pfPositiveDeepCSVJetTags:probbb', + #'pfNegativeDeepCSVJetTags:probbb', + #'pfPositiveDeepCSVJetTags:probbb', 'pfDeepCSVJetTags:probudsg', - 'pfNegativeDeepCSVJetTags:probudsg', - 'pfPositiveDeepCSVJetTags:probudsg', - #'pfCombinedMVAV2BJetTags', - #'pfCombinedInclusiveSecondaryVertexV2BJetTags' + #'pfNegativeDeepCSVJetTags:probudsg', + #'pfPositiveDeepCSVJetTags:probudsg', ] updateJetCollection( process, @@ -47,19 +45,17 @@ def update_jets_AK8(process): _btagDiscriminators = [ 'pfJetProbabilityBJetTags', 'pfDeepCSVJetTags:probb', - 'pfNegativeDeepCSVJetTags:probb', - 'pfPositiveDeepCSVJetTags:probb', + #'pfNegativeDeepCSVJetTags:probb', + #'pfPositiveDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', - 'pfNegativeDeepCSVJetTags:probc', - 'pfPositiveDeepCSVJetTags:probc', + #'pfNegativeDeepCSVJetTags:probc', + #'pfPositiveDeepCSVJetTags:probc', 'pfDeepCSVJetTags:probbb', - 'pfNegativeDeepCSVJetTags:probbb', - 'pfPositiveDeepCSVJetTags:probbb', + #'pfNegativeDeepCSVJetTags:probbb', + #'pfPositiveDeepCSVJetTags:probbb', 'pfDeepCSVJetTags:probudsg', - 'pfNegativeDeepCSVJetTags:probudsg', - 'pfPositiveDeepCSVJetTags:probudsg', - #'pfCombinedMVAV2BJetTags', - #'pfCombinedInclusiveSecondaryVertexV2BJetTags' + #'pfNegativeDeepCSVJetTags:probudsg', + #'pfPositiveDeepCSVJetTags:probudsg', ] updateJetCollection( process, @@ -87,19 +83,17 @@ def update_jets_AK8_subjet(process): _btagDiscriminators = [ 'pfJetProbabilityBJetTags', 'pfDeepCSVJetTags:probb', - 'pfNegativeDeepCSVJetTags:probb', - 'pfPositiveDeepCSVJetTags:probb', + #'pfNegativeDeepCSVJetTags:probb', + #'pfPositiveDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', - 'pfNegativeDeepCSVJetTags:probc', - 'pfPositiveDeepCSVJetTags:probc', + #'pfNegativeDeepCSVJetTags:probc', + #'pfPositiveDeepCSVJetTags:probc', 'pfDeepCSVJetTags:probbb', - 'pfNegativeDeepCSVJetTags:probbb', - 'pfPositiveDeepCSVJetTags:probbb', + #'pfNegativeDeepCSVJetTags:probbb', + #'pfPositiveDeepCSVJetTags:probbb', 'pfDeepCSVJetTags:probudsg', - 'pfNegativeDeepCSVJetTags:probudsg', - 'pfPositiveDeepCSVJetTags:probudsg', - 'pfCombinedMVAV2BJetTags', - #'pfCombinedInclusiveSecondaryVertexV2BJetTags' + #'pfNegativeDeepCSVJetTags:probudsg', + #'pfPositiveDeepCSVJetTags:probudsg', ] updateJetCollection( process, From 45f6450928b757ee7f2c043f9367350f750c1031 Mon Sep 17 00:00:00 2001 From: Alena Date: Fri, 29 May 2020 14:44:53 +0200 Subject: [PATCH 23/33] runOnMC --- python/addBTV.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index 2e06e3c..e941ca4 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -115,7 +115,6 @@ def update_jets_AK8_subjet(process): def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): addAK4 = not onlyAK8 addAK8 = not onlyAK4 - addMC = runOnMC if addAK4: process = update_jets_AK4(process) @@ -226,7 +225,7 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): if addAK8: process.customizeJetTask.add(process.customFatJetExtTable) process.customizeJetTask.add(process.customSubJetExtTable) - if addMC and addAK8: + if runOnMC and addAK8: process.customizeJetTask.add(process.customSubJetMCExtTable) return process From 6ddd77211a9552f2b122125459f0a0518470ad5f Mon Sep 17 00:00:00 2001 From: Alena Date: Fri, 29 May 2020 14:50:11 +0200 Subject: [PATCH 24/33] Precision --- python/addBTV.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index e941ca4..08eb5e6 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -140,15 +140,15 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): btagDeepB_b=Var("bDiscriminator('pfDeepCSVJetTags:probb')", float, doc="DeepCSV b tag discriminator", - precision=22), + precision=10), btagDeepB_bb=Var("bDiscriminator('pfDeepCSVJetTags:probbb')", float, doc="DeepCSV bb tag discriminator", - precision=22), + precision=10), btagDeepL = Var("bDiscriminator('pfDeepCSVJetTags:probudsg')", float, doc="DeepCSV light btag discriminator", - precision=22), + precision=10), #RENAME THEM! If you can ) @@ -179,7 +179,7 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", float, doc="DeepCSV charm btag discriminator", - precision=22), + precision=10), )) @@ -201,7 +201,7 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", float, doc="DeepCSV charm btag discriminator", - precision=22), + precision=10), )) From ae1a78a49eff13b82470bb9b912c7cc08fca3fb0 Mon Sep 17 00:00:00 2001 From: Alena Date: Tue, 2 Jun 2020 11:38:07 +0200 Subject: [PATCH 25/33] Discriminators --- python/addBTV.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index 08eb5e6..31b76a4 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -11,17 +11,9 @@ def update_jets_AK4(process): _btagDiscriminators = [ 'pfJetProbabilityBJetTags', 'pfDeepCSVJetTags:probb', - #'pfNegativeDeepCSVJetTags:probb', - #'pfPositiveDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', - #'pfNegativeDeepCSVJetTags:probc', - #'pfPositiveDeepCSVJetTags:probc', 'pfDeepCSVJetTags:probbb', - #'pfNegativeDeepCSVJetTags:probbb', - #'pfPositiveDeepCSVJetTags:probbb', 'pfDeepCSVJetTags:probudsg', - #'pfNegativeDeepCSVJetTags:probudsg', - #'pfPositiveDeepCSVJetTags:probudsg', ] updateJetCollection( process, @@ -45,17 +37,9 @@ def update_jets_AK8(process): _btagDiscriminators = [ 'pfJetProbabilityBJetTags', 'pfDeepCSVJetTags:probb', - #'pfNegativeDeepCSVJetTags:probb', - #'pfPositiveDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', - #'pfNegativeDeepCSVJetTags:probc', - #'pfPositiveDeepCSVJetTags:probc', 'pfDeepCSVJetTags:probbb', - #'pfNegativeDeepCSVJetTags:probbb', - #'pfPositiveDeepCSVJetTags:probbb', 'pfDeepCSVJetTags:probudsg', - #'pfNegativeDeepCSVJetTags:probudsg', - #'pfPositiveDeepCSVJetTags:probudsg', ] updateJetCollection( process, @@ -83,17 +67,9 @@ def update_jets_AK8_subjet(process): _btagDiscriminators = [ 'pfJetProbabilityBJetTags', 'pfDeepCSVJetTags:probb', - #'pfNegativeDeepCSVJetTags:probb', - #'pfPositiveDeepCSVJetTags:probb', 'pfDeepCSVJetTags:probc', - #'pfNegativeDeepCSVJetTags:probc', - #'pfPositiveDeepCSVJetTags:probc', 'pfDeepCSVJetTags:probbb', - #'pfNegativeDeepCSVJetTags:probbb', - #'pfPositiveDeepCSVJetTags:probbb', 'pfDeepCSVJetTags:probudsg', - #'pfNegativeDeepCSVJetTags:probudsg', - #'pfPositiveDeepCSVJetTags:probudsg', ] updateJetCollection( process, From c40f8efa587e9deb56757d63ef4c37c74a326dda Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Fri, 29 May 2020 18:44:55 -0500 Subject: [PATCH 26/33] Insert jet-level deep double x var --- python/addBTV.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/addBTV.py b/python/addBTV.py index 31b76a4..fa82f79 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -57,6 +57,9 @@ def update_jets_AK8(process): printWarning=False) process.jetCorrFactorsAK8.src = "selectedUpdatedPatJetsAK8WithDeepInfo" process.updatedJetsAK8.jetSource = "selectedUpdatedPatJetsAK8WithDeepInfo" + # add DeepDoubleX taginfos + process.updatedPatJetsTransientCorrectedAK8WithDeepInfo.tagInfoSources.append(cms.InputTag("pfDeepDoubleXTagInfosAK8WithDeepInfo")) + process.updatedPatJetsTransientCorrectedAK8WithDeepInfo.addTagInfos = cms.bool(True) return process @@ -157,6 +160,7 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): doc="DeepCSV charm btag discriminator", precision=10), + DDX_jetNTracks = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.jetNTracks", float, doc="something useful", precision=10), )) # Subjets From ba9da8b8d3fc995b6378d27694124f907042aad1 Mon Sep 17 00:00:00 2001 From: Nick Smith Date: Fri, 29 May 2020 19:19:53 -0500 Subject: [PATCH 27/33] document failed attempt --- python/addBTV.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/addBTV.py b/python/addBTV.py index fa82f79..9d10218 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -54,6 +54,8 @@ def update_jets_AK8(process): ]), 'None'), btagDiscriminators=_btagDiscriminators, postfix='AK8WithDeepInfo', + # this should work but doesn't seem to enable the tag info with addTagInfos + # btagInfos=['pfDeepDoubleXTagInfos'], printWarning=False) process.jetCorrFactorsAK8.src = "selectedUpdatedPatJetsAK8WithDeepInfo" process.updatedJetsAK8.jetSource = "selectedUpdatedPatJetsAK8WithDeepInfo" From cd87059fc0d4220a6a322c4096c0cef979f49c58 Mon Sep 17 00:00:00 2001 From: Javier Duarte Date: Tue, 2 Jun 2020 15:15:13 -0700 Subject: [PATCH 28/33] add all 27 db variables --- python/addBTV.py | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index 9d10218..2f167b4 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -92,6 +92,41 @@ def update_jets_AK8_subjet(process): process.subJetTable.src = 'updatedPatJetsTransientCorrectedSoftDropSubjetsPFAK8SubjetsWithDeepInfo' ### VERY LONG NAME!!! :P return process +def get_DDX_vars(): + # retreive 27 jet-level features used in double-b and deep double-x taggers + # defiend in arXiv:1712.07158 + + DDXVars = cms.PSet( + DDX_jetNTracks = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.jetNTracks", int, doc="number of tracks associated with the jet"), + DDX_jetNSecondaryVertices = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.jetNSecondaryVertices", int, doc="number of SVs associated with the jet"), + DDX_tau1_trackEtaRel_0 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackEtaRel_0", float, doc="1st smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis", precision=10), + DDX_tau1_trackEtaRel_1 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackEtaRel_1", float, doc="2nd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis", precision=10), + DDX_tau1_trackEtaRel_2 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackEtaRel_2", float, doc="3rd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis", precision=10), + DDX_tau2_trackEtaRel_0 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackEtaRel_0", float, doc="1st smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis", precision=10), + DDX_tau2_trackEtaRel_1 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackEtaRel_1", float, doc="2nd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis", precision=10), + DDX_tau2_trackEtaRel_3 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackEtaRel_2", float, doc="3rd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis", precision=10), + DDX_tau1_flightDistance2dSig = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_flightDistance2dSig", float, doc="transverse distance significance between primary and secondary vertex associated to the 1st N-subjettiness axis", precision=10), + DDX_tau2_flightDistance2dSig = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_flightDistance2dSig", float, doc="transverse distance significance between primary and secondary vertex associated to the 2nd N-subjettiness axis", precision=10), + DDX_tau1_vertexDeltaR = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_vertexDeltaR", float, doc="deltaR between the 1st N-subjettiness axis and secondary vertex direction", precision=10), + DDX_tau1_vertexEnergyRatio = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_vertexEnergyRatio", float, doc="ratio of energy at secondary vertex over total energy associated to the 1st N-subjettiness axis", precision=10), + DDX_tau2_vertexEnergyRatio = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_vertexEnergyRatio", float, doc="ratio of energy at secondary vertex over total energy associated to the 2nd N-subjettiness axis", precision=10), + DDX_tau1_vertexMass = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_vertexMass", float, doc="mass of track sum at secondary vertex associated to the 1st N-subjettiness axis", precision=10), + DDX_tau2_vertexMass = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_vertexMass", float, doc="mass of track sum at secondary vertex associated to the 2nd N-subjettiness axis", precision=10), + DDX_trackSip2dSigAboveBottom_0 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip2dSigAboveBottom_0", float, doc="track 2D signed impact parameter significance of 1st track lifting mass above bottom", precision=10), + DDX_trackSip2dSigAboveBottom_1 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip2dSigAboveBottom_1", float, doc="track 2D signed impact parameter significance of 2nd track lifting mass above bottom", precision=10), + DDX_trackSip2dSigAboveCharm = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip2dSigAboveCharm", float, doc="track 2D signed impact parameter significance of 1st track lifting mass above charm", precision=10), + DDX_trackSip3dSig_0 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_0", float, doc="1st largest track 3D signed impact parameter significance", precision=10), + DDX_tau1_trackSip3dSig_0 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackSip3dSig_0", float, doc="1st largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis", precision=10), + DDX_tau1_trackSip3dSig_1 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackSip3dSig_1", float, doc="2nd largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis", precision=10), + DDX_trackSip3dSig_1 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_1", float, doc="2nd largest track 3D signed impact parameter significance", precision=10), + DDX_tau2_trackSip3dSig_0 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackSip3dSig_0", float, doc="1st largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis", precision=10), + DDX_tau2_trackSip3dSig_1 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackSip3dSig_1", float, doc="2nd largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis", precision=10), + DDX_trackSip3dSig_2 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_2", float, doc="3rd largest track 3D signed impact parameter significance", precision=10), + DDX_trackSip3dSig_3 = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_3", float, doc="4th largest track 3D signed impact parameter significance", precision=10), + DDX_z_ratio = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.z_ratio", float, doc="z = deltaR(SV0,SV1)*pT(SV1)/m(SV0,SV1), defined in Eq. 7 of arXiv:1712.07158", precision=10) + ) + + return DDXVars def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): addAK4 = not onlyAK8 @@ -156,13 +191,12 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): singleton=cms.bool(False), # the number of entries is variable extension=cms.bool(True), # this is the extension table for FatJets variables=cms.PSet( - CommonVars, - btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", - float, - doc="DeepCSV charm btag discriminator", - precision=10), - - DDX_jetNTracks = Var("tagInfo(\'pfDeepDoubleX\').features().tag_info_features.jetNTracks", float, doc="something useful", precision=10), + CommonVars, + btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", + float, + doc="DeepCSV charm btag discriminator", + precision=10), + get_DDX_vars(), )) # Subjets From 79855ac516aa7d92e8509d9ab0095489a3f0864f Mon Sep 17 00:00:00 2001 From: Javier Duarte Date: Tue, 2 Jun 2020 15:31:21 -0700 Subject: [PATCH 29/33] rebase --- python/addBTV.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/addBTV.py b/python/addBTV.py index 2f167b4..dcc978e 100644 --- a/python/addBTV.py +++ b/python/addBTV.py @@ -192,10 +192,10 @@ def add_BTV(process, runOnMC=False, onlyAK4=False, onlyAK8=False): extension=cms.bool(True), # this is the extension table for FatJets variables=cms.PSet( CommonVars, - btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", - float, - doc="DeepCSV charm btag discriminator", - precision=10), + cms.PSet(btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')", + float, + doc="DeepCSV charm btag discriminator", + precision=10)), get_DDX_vars(), )) From d9d8f9ee01e61a0ec44df3c60a9ea75da0dc05da Mon Sep 17 00:00:00 2001 From: Lauren Hay Date: Thu, 25 Jun 2020 18:49:41 +0200 Subject: [PATCH 30/33] Updated for compatibility with new version of UniqueMerger.h --- python/addPFCands_cff.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/python/addPFCands_cff.py b/python/addPFCands_cff.py index 93e9b73..ab8e7ff 100644 --- a/python/addPFCands_cff.py +++ b/python/addPFCands_cff.py @@ -18,18 +18,18 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal elif onlyAK4: candList = cms.VInputTag(cms.InputTag("finalJetsAK4Constituents", "constituents")) process.customizedPFCandsTask.add(process.finalJetsAK4Constituents) - process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList) + process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(True), warnOnSkip = cms.bool(True)) candInput = cms.InputTag("finalJetsConstituents") elif onlyAK8: candList = cms.VInputTag(cms.InputTag("finalJetsAK8Constituents", "constituents")) process.customizedPFCandsTask.add(process.finalJetsAK8Constituents) - process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList) + process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(True), warnOnSkip = cms.bool(True)) candInput = cms.InputTag("finalJetsConstituents") else: candList = cms.VInputTag(cms.InputTag("finalJetsAK4Constituents", "constituents"), cms.InputTag("finalJetsAK8Constituents", "constituents")) process.customizedPFCandsTask.add(process.finalJetsAK4Constituents) process.customizedPFCandsTask.add(process.finalJetsAK8Constituents) - process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList) + process.finalJetsConstituents = cms.EDProducer("PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(True), warnOnSkip = cms.bool(True)) candInput = cms.InputTag("finalJetsConstituents") process.customConstituentsExtTable = cms.EDProducer("SimpleCandidateFlatTableProducer", src = candInput, @@ -75,7 +75,7 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal process.genJetsAK8Constituents = cms.EDProducer("GenJetPackedConstituentPtrSelector", src = cms.InputTag("slimmedGenJetsAK8"), - cut = cms.string("pt > 100") + cut = cms.string("pt > 80") ) @@ -88,15 +88,15 @@ def addPFCands(process, runOnMC=False, allPF = False, onlyAK4=False, onlyAK8=Fal elif onlyAK4: genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents")) genCandInput = cms.InputTag("genJetsConstituents") - process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) + process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList, skipNulls = cms.bool(True), warnOnSkip = cms.bool(True)) elif onlyAK8: genCandList = cms.VInputTag(cms.InputTag("genJetsAK8Constituents", "constituents")) genCandInput = cms.InputTag("genJetsConstituents") - process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) + process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList, skipNulls = cms.bool(True), warnOnSkip = cms.bool(True)) else: genCandList = cms.VInputTag(cms.InputTag("genJetsAK4Constituents", "constituents"), cms.InputTag("genJetsAK8Constituents", "constituents")) genCandInput = cms.InputTag("genJetsConstituents") - process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList) + process.genJetsConstituents = cms.EDProducer("PackedGenParticlePtrMerger", src = genCandList, skipNulls = cms.bool(True), warnOnSkip = cms.bool(True)) process.genJetsParticleTable = cms.EDProducer("SimpleCandidateFlatTableProducer", src = genCandInput, cut = cms.string(""), #we should not filter after pruning From 36e64343a8e1c7f6536beb003b7ae190efa6989c Mon Sep 17 00:00:00 2001 From: laurenhay Date: Thu, 25 Jun 2020 12:50:33 -0400 Subject: [PATCH 31/33] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 527d1fb..fd5821e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ cmsrel CMSSW_10_6_5 cd CMSSW_10_6_5/src cmsenv git cms-addpkg PhysicsTools/NanoAOD -git cms-merge-topic rappoccio:setmerger_10_6_5 +git cms-merge-topic laurenhay:uniquemerger_10_6_5 git clone https://github.com/cms-jet/NanoAODJMAR.git PhysicsTools/NanoAODJMAR scram b -j 10 cd PhysicsTools/NanoAODJMAR/test From 68748942260ecd9dea081178d9c4a650029b0d1d Mon Sep 17 00:00:00 2001 From: Alejandro Date: Fri, 10 Jul 2020 15:57:00 +0200 Subject: [PATCH 32/33] updating recipe --- README.md | 7 +++---- test/nano106X_on_mini106X_2017_data_NANO.py | 7 +++---- test/nano106X_on_mini106X_2017_mc_NANO.py | 10 ++++------ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fd5821e..016c299 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,13 @@ This format can be used with [fastjet](http://fastjet.fr) directly. **THIS IS A DEVELOPMENT BRANCH** -For **UL** 2016, 2017 and 2018 data and MC **NanoAODv6** according to the [XPOG recommendations](https://gitlab.cern.ch/cms-nanoAOD/nanoaod-doc/-/wikis/Releases/NanoAODv6): +For **UL** 2016, 2017 and 2018 data and MC **NanoAODv6** according to the [XPOG](https://gitlab.cern.ch/cms-nanoAOD/nanoaod-doc/-/wikis/Releases/NanoAODv6) and [PPD](https://twiki.cern.ch/twiki/bin/view/CMS/PdmVLegacy2017Analysis) recommendations: ``` -cmsrel CMSSW_10_6_5 -cd CMSSW_10_6_5/src +cmsrel CMSSW_10_6_14 +cd CMSSW_10_6_14/src cmsenv git cms-addpkg PhysicsTools/NanoAOD -git cms-merge-topic laurenhay:uniquemerger_10_6_5 git clone https://github.com/cms-jet/NanoAODJMAR.git PhysicsTools/NanoAODJMAR scram b -j 10 cd PhysicsTools/NanoAODJMAR/test diff --git a/test/nano106X_on_mini106X_2017_data_NANO.py b/test/nano106X_on_mini106X_2017_data_NANO.py index de4f4b3..2d3ea8a 100644 --- a/test/nano106X_on_mini106X_2017_data_NANO.py +++ b/test/nano106X_on_mini106X_2017_data_NANO.py @@ -2,13 +2,12 @@ # using: # Revision: 1.19 # Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v -# with command line options: nano106X_on_mini106X_2017_data -s NANO --data --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 106X_dataRun2_v24 --era Run2_2017,run2_nanoAOD_106Xv1 --customise_commands=process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False))) --nThreads 2 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeData -n 100 --filein /store/data/Run2017B/JetHT/MINIAOD/09Aug2019_UL2017-v1/50000/421E15F6-C6DA-D848-9537-FEC70D67C61C.root +# with command line options: nano106X_on_mini106X_2017_data -s NANO --data --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 106X_dataRun2_v28 --era Run2_2017 --customise_commands=process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False))) --nThreads 2 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeData -n 100 --filein /store/data/Run2017B/JetHT/MINIAOD/09Aug2019_UL2017-v1/50000/421E15F6-C6DA-D848-9537-FEC70D67C61C.root import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 -from Configuration.Eras.Modifier_run2_nanoAOD_106Xv1_cff import run2_nanoAOD_106Xv1 -process = cms.Process('NANO',Run2_2017,run2_nanoAOD_106Xv1) +process = cms.Process('NANO',Run2_2017) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -59,7 +58,7 @@ # Other statements from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, '106X_dataRun2_v24', '') +process.GlobalTag = GlobalTag(process.GlobalTag, '106X_dataRun2_v28', '') # Path and EndPath definitions process.nanoAOD_step = cms.Path(process.nanoSequence) diff --git a/test/nano106X_on_mini106X_2017_mc_NANO.py b/test/nano106X_on_mini106X_2017_mc_NANO.py index df9bd11..4999175 100644 --- a/test/nano106X_on_mini106X_2017_mc_NANO.py +++ b/test/nano106X_on_mini106X_2017_mc_NANO.py @@ -2,13 +2,12 @@ # using: # Revision: 1.19 # Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v -# with command line options: nano106X_on_mini106X_2017_mc -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 106X_mc2017_realistic_v6 --era Run2_2017,run2_nanoAOD_106Xv1 --customise_commands=process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False))) --nThreads 2 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeMC -n 100 --filein /store/mc/RunIISummer19UL17MiniAOD/QCD_HT700to1000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/MINIAODSIM/106X_mc2017_realistic_v6-v2/280000/958303DA-D6A9-5D47-8A71-4D8F39FFC221.root +# with command line options: nano106X_on_mini106X_2017_mc -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 106X_mc2017_realistic_v6 --era Run2_2017 --customise_commands=process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False))) --nThreads 8 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeMC -n 100 --filein /store/mc/RunIISummer19UL17MiniAOD/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/MINIAODSIM/106X_mc2017_realistic_v6_ext2-v2/40000/DC8FEA2E-191B-834F-96C3-53FCF0291ADB.root import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 -from Configuration.Eras.Modifier_run2_nanoAOD_106Xv1_cff import run2_nanoAOD_106Xv1 -process = cms.Process('NANO',Run2_2017,run2_nanoAOD_106Xv1) +process = cms.Process('NANO',Run2_2017) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -28,8 +27,7 @@ # Input source process.source = cms.Source("PoolSource", - #fileNames = cms.untracked.vstring('/store/mc/RunIISummer19UL17MiniAOD/QCD_HT700to1000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/MINIAODSIM/106X_mc2017_realistic_v6-v2/280000/958303DA-D6A9-5D47-8A71-4D8F39FFC221.root'), - fileNames = cms.untracked.vstring('/store/mc/RunIIAutumn18MiniAOD/BulkGravTohhTohWWhbb_narrow_M-2800_TuneCP2_13TeV-madgraph_pythia8/MINIAODSIM/102X_upgrade2018_realistic_v15-v1/70000/DFABF044-2025-6E49-800A-C5BD664F8E55.root'), + fileNames = cms.untracked.vstring('/store/mc/RunIISummer19UL17MiniAOD/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/MINIAODSIM/106X_mc2017_realistic_v6_ext2-v2/40000/DC8FEA2E-191B-834F-96C3-53FCF0291ADB.root'), secondaryFileNames = cms.untracked.vstring() ) @@ -74,7 +72,7 @@ associatePatAlgosToolsTask(process) #Setup FWK for multithreaded -process.options.numberOfThreads=cms.untracked.uint32(1) +process.options.numberOfThreads=cms.untracked.uint32(8) process.options.numberOfStreams=cms.untracked.uint32(0) process.options.numberOfConcurrentLuminosityBlocks=cms.untracked.uint32(1) From 98e54bf1e6be28d5cf02dc9502375838361ece99 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Mon, 13 Jul 2020 10:35:43 +0200 Subject: [PATCH 33/33] updating files --- test/datasets/2016data_17Jul2018.txt | 25 ------------ test/datasets/2016mc_miniAODv3_DY.txt | 11 ------ test/datasets/2017data_31Mar2018.txt | 15 -------- test/datasets/2017mc_miniAODv2_DY.txt | 12 ------ test/datasets/2017mc_miniAODv2_ST.txt | 5 --- test/datasets/2018data_17Sep2018.txt | 14 ------- test/datasets/2018data_17Sep2018_test.txt | 1 - test/datasets/2018mc_DY.txt | 9 ----- test/datasets/DY_102X_test.txt | 1 - test/datasets/DY_80X_test.txt | 1 - test/datasets/DY_94X_test.txt | 1 - test/datasets/MC_UL2017.txt | 7 ++++ test/datasets/SingleMuon_UL2017.txt | 5 +++ test/datasets/UL2017_MC.txt | 1 + test/nano106X_on_mini106X_2017_data_NANO.py | 14 ++++--- test/nano106X_on_mini106X_2017_mc_NANO.py | 24 ++++++------ test/submit_all.py | 42 +++++++++++---------- 17 files changed, 55 insertions(+), 133 deletions(-) delete mode 100644 test/datasets/2016data_17Jul2018.txt delete mode 100644 test/datasets/2016mc_miniAODv3_DY.txt delete mode 100644 test/datasets/2017data_31Mar2018.txt delete mode 100644 test/datasets/2017mc_miniAODv2_DY.txt delete mode 100644 test/datasets/2017mc_miniAODv2_ST.txt delete mode 100644 test/datasets/2018data_17Sep2018.txt delete mode 100644 test/datasets/2018data_17Sep2018_test.txt delete mode 100644 test/datasets/2018mc_DY.txt delete mode 100644 test/datasets/DY_102X_test.txt delete mode 100644 test/datasets/DY_80X_test.txt delete mode 100644 test/datasets/DY_94X_test.txt create mode 100644 test/datasets/MC_UL2017.txt create mode 100644 test/datasets/SingleMuon_UL2017.txt create mode 100644 test/datasets/UL2017_MC.txt diff --git a/test/datasets/2016data_17Jul2018.txt b/test/datasets/2016data_17Jul2018.txt deleted file mode 100644 index c313eb4..0000000 --- a/test/datasets/2016data_17Jul2018.txt +++ /dev/null @@ -1,25 +0,0 @@ -/SingleMuon/Run2016H-17Jul2018-v1/MINIAOD -/SingleMuon/Run2016G-17Jul2018-v1/MINIAOD -/SingleMuon/Run2016F-17Jul2018-v1/MINIAOD -/SingleMuon/Run2016E-17Jul2018-v1/MINIAOD -/SingleMuon/Run2016D-17Jul2018-v1/MINIAOD -/SingleMuon/Run2016C-17Jul2018-v1/MINIAOD -/SingleMuon/Run2016B-17Jul2018_ver2-v1/MINIAOD -/SingleMuon/Run2016B-17Jul2018_ver1-v1/MINIAOD -/SingleElectron/Run2016H-17Jul2018-v1/MINIAOD -/SingleElectron/Run2016G-17Jul2018-v1/MINIAOD -/SingleElectron/Run2016F-17Jul2018-v1/MINIAOD -/SingleElectron/Run2016E-17Jul2018-v1/MINIAOD -/SingleElectron/Run2016D-17Jul2018-v1/MINIAOD -/SingleElectron/Run2016C-17Jul2018-v1/MINIAOD -/SingleElectron/Run2016B-17Jul2018_ver2-v1/MINIAOD -/SingleElectron/Run2016B-17Jul2018_ver1-v1/MINIAOD -/JetHT/Run2016H-17Jul2018-v1/MINIAOD -/JetHT/Run2016G-17Jul2018-v1/MINIAOD -/JetHT/Run2016F-17Jul2018-v1/MINIAOD -/JetHT/Run2016E-17Jul2018-v1/MINIAOD -/JetHT/Run2016D-17Jul2018-v1/MINIAOD -/JetHT/Run2016C-17Jul2018-v1/MINIAOD -/JetHT/Run2016B-17Jul2018_ver2-v2/MINIAOD -/JetHT/Run2016B-17Jul2018_ver2-v1/MINIAOD -/JetHT/Run2016B-17Jul2018_ver1-v1/MINIAOD diff --git a/test/datasets/2016mc_miniAODv3_DY.txt b/test/datasets/2016mc_miniAODv3_DY.txt deleted file mode 100644 index ea651fc..0000000 --- a/test/datasets/2016mc_miniAODv3_DY.txt +++ /dev/null @@ -1,11 +0,0 @@ -/DYJetsToLL_M-50_HT-800to1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-70to100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-600to800_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3_ext1-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-2500toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3_ext1-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-1200to2500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3_ext1-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM diff --git a/test/datasets/2017data_31Mar2018.txt b/test/datasets/2017data_31Mar2018.txt deleted file mode 100644 index f0ecbdd..0000000 --- a/test/datasets/2017data_31Mar2018.txt +++ /dev/null @@ -1,15 +0,0 @@ -/SingleMuon/Run2017B-31Mar2018-v1/MINIAOD -/SingleMuon/Run2017C-31Mar2018-v1/MINIAOD -/SingleMuon/Run2017D-31Mar2018-v1/MINIAOD -/SingleMuon/Run2017E-31Mar2018-v1/MINIAOD -/SingleMuon/Run2017F-31Mar2018-v1/MINIAOD -/SingleElectron/Run2017B-31Mar2018-v1/MINIAOD -/SingleElectron/Run2017C-31Mar2018-v1/MINIAOD -/SingleElectron/Run2017D-31Mar2018-v1/MINIAOD -/SingleElectron/Run2017E-31Mar2018-v1/MINIAOD -/SingleElectron/Run2017F-31Mar2018-v1/MINIAOD -/JetHT/Run2017B-31Mar2018-v1/MINIAOD -/JetHT/Run2017C-31Mar2018-v1/MINIAOD -/JetHT/Run2017D-31Mar2018-v1/MINIAOD -/JetHT/Run2017E-31Mar2018-v1/MINIAOD -/JetHT/Run2017F-31Mar2018-v1/MINIAOD diff --git a/test/datasets/2017mc_miniAODv2_DY.txt b/test/datasets/2017mc_miniAODv2_DY.txt deleted file mode 100644 index ae2b851..0000000 --- a/test/datasets/2017mc_miniAODv2_DY.txt +++ /dev/null @@ -1,12 +0,0 @@ -/DYJetsToLL_M-50_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14_ext1-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-1200to2500_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14_ext1-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-2500toInf_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14_ext1-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-600to800_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-70to100_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-800to1200_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM diff --git a/test/datasets/2017mc_miniAODv2_ST.txt b/test/datasets/2017mc_miniAODv2_ST.txt deleted file mode 100644 index 7dc81f2..0000000 --- a/test/datasets/2017mc_miniAODv2_ST.txt +++ /dev/null @@ -1,5 +0,0 @@ -/ST_tW_top_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v2/MINIAODSIM -/ST_tW_antitop_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v2/MINIAODSIM -/ST_t-channel_top_4f_inclusiveDecays_TuneCP5_13TeV-powhegV2-madspin-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM -/ST_t-channel_antitop_4f_inclusiveDecays_TuneCP5_13TeV-powhegV2-madspin-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v2/MINIAODSIM -/ST_s-channel_4f_leptonDecays_TuneCP5_13TeV-amcatnlo-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v2/MINIAODSIM diff --git a/test/datasets/2018data_17Sep2018.txt b/test/datasets/2018data_17Sep2018.txt deleted file mode 100644 index bb6074a..0000000 --- a/test/datasets/2018data_17Sep2018.txt +++ /dev/null @@ -1,14 +0,0 @@ -/SingleMuon/Run2018A-17Sep2018-v2/MINIAOD -/SingleMuon/Run2018B-17Sep2018-v1/MINIAOD -/SingleMuon/Run2018C-17Sep2018-v1/MINIAOD -/SingleMuon/Run2018D-PromptReco-v2/MINIAOD -/EGamma/Run2018A-17Sep2018-v2/MINIAOD -/EGamma/Run2018B-17Sep2018-v1/MINIAOD -/EGamma/Run2018C-17Sep2018-v1/MINIAOD -/EGamma/Run2018D-PromptReco-v1/MINIAOD -/EGamma/Run2018D-PromptReco-v2/MINIAOD -/JetHT/Run2018A-17Sep2018-v1/MINIAOD -/JetHT/Run2018C-17Sep2018-v1/MINIAOD -/JetHT/Run2018B-17Sep2018-v1/MINIAOD -/JetHT/Run2018D-PromptReco-v1/MINIAOD -/JetHT/Run2018D-PromptReco-v2/MINIAOD diff --git a/test/datasets/2018data_17Sep2018_test.txt b/test/datasets/2018data_17Sep2018_test.txt deleted file mode 100644 index 753119f..0000000 --- a/test/datasets/2018data_17Sep2018_test.txt +++ /dev/null @@ -1 +0,0 @@ -/SingleMuon/Run2018B-17Sep2018-v1/MINIAOD diff --git a/test/datasets/2018mc_DY.txt b/test/datasets/2018mc_DY.txt deleted file mode 100644 index ade41e3..0000000 --- a/test/datasets/2018mc_DY.txt +++ /dev/null @@ -1,9 +0,0 @@ -/DYJetsToLL_M-50_HT-800to1200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-70to100_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v1/MINIAODSIM -/DYJetsToLL_M-50_HT-600to800_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-400to600_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15_ext2-v3/MINIAODSIM -/DYJetsToLL_M-50_HT-400to600_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v7/MINIAODSIM -/DYJetsToLL_M-50_HT-2500toInf_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-200to400_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-1200to2500_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v2/MINIAODSIM -/DYJetsToLL_M-50_HT-100to200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v2/MINIAODSIM diff --git a/test/datasets/DY_102X_test.txt b/test/datasets/DY_102X_test.txt deleted file mode 100644 index 0f745ec..0000000 --- a/test/datasets/DY_102X_test.txt +++ /dev/null @@ -1 +0,0 @@ -/DYJetsToLL_M-50_HT-800to1200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v2/MINIAODSIM diff --git a/test/datasets/DY_80X_test.txt b/test/datasets/DY_80X_test.txt deleted file mode 100644 index df1adeb..0000000 --- a/test/datasets/DY_80X_test.txt +++ /dev/null @@ -1 +0,0 @@ -/DYJetsToLL_M-50_HT-800to1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/MINIAODSIM diff --git a/test/datasets/DY_94X_test.txt b/test/datasets/DY_94X_test.txt deleted file mode 100644 index f3599c1..0000000 --- a/test/datasets/DY_94X_test.txt +++ /dev/null @@ -1 +0,0 @@ -/DYJetsToLL_M-50_HT-2500toInf_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_new_pmx_94X_mc2017_realistic_v14-v2/MINIAODSIM diff --git a/test/datasets/MC_UL2017.txt b/test/datasets/MC_UL2017.txt new file mode 100644 index 0000000..c9d1d96 --- /dev/null +++ b/test/datasets/MC_UL2017.txt @@ -0,0 +1,7 @@ +/TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM +/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM +/ST_s-channel_4f_leptonDecays_TuneCP5_13TeV-mcatnlo-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM +/ST_tW_antitop_5f_DS_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v1/MINIAODSIM +/ST_tW_top_5f_DS_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v1/MINIAODSIM +/WJetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM + diff --git a/test/datasets/SingleMuon_UL2017.txt b/test/datasets/SingleMuon_UL2017.txt new file mode 100644 index 0000000..b58dff1 --- /dev/null +++ b/test/datasets/SingleMuon_UL2017.txt @@ -0,0 +1,5 @@ +/SingleMuon/Run2017B-09Aug2019_UL2017-v1/MINIAOD +/SingleMuon/Run2017C-09Aug2019_UL2017-v1/MINIAOD +/SingleMuon/Run2017D-09Aug2019_UL2017-v1/MINIAOD +/SingleMuon/Run2017E-09Aug2019_UL2017-v1/MINIAOD +/SingleMuon/Run2017F-09Aug2019_UL2017-v1/MINIAOD diff --git a/test/datasets/UL2017_MC.txt b/test/datasets/UL2017_MC.txt new file mode 100644 index 0000000..0e701ae --- /dev/null +++ b/test/datasets/UL2017_MC.txt @@ -0,0 +1 @@ +/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/RunIISummer19UL17MiniAOD-106X_mc2017_realistic_v6-v2/MINIAODSIM diff --git a/test/nano106X_on_mini106X_2017_data_NANO.py b/test/nano106X_on_mini106X_2017_data_NANO.py index de4f4b3..b95d3b0 100644 --- a/test/nano106X_on_mini106X_2017_data_NANO.py +++ b/test/nano106X_on_mini106X_2017_data_NANO.py @@ -1,7 +1,7 @@ # Auto generated configuration file -# using: -# Revision: 1.19 -# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v # with command line options: nano106X_on_mini106X_2017_data -s NANO --data --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 106X_dataRun2_v24 --era Run2_2017,run2_nanoAOD_106Xv1 --customise_commands=process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False))) --nThreads 2 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeData -n 100 --filein /store/data/Run2017B/JetHT/MINIAOD/09Aug2019_UL2017-v1/50000/421E15F6-C6DA-D848-9537-FEC70D67C61C.root import FWCore.ParameterSet.Config as cms @@ -79,16 +79,18 @@ # customisation of the process. # Automatic addition of the customisation function from PhysicsTools.NanoAOD.nano_cff -from PhysicsTools.NanoAOD.nano_cff import nanoAOD_customizeData +from PhysicsTools.NanoAOD.nano_cff import nanoAOD_customizeData #call to customisation function nanoAOD_customizeData imported from PhysicsTools.NanoAOD.nano_cff process = nanoAOD_customizeData(process) # Automatic addition of the customisation function from PhysicsTools.NanoAODJMAR.nano_jmar_cff -from PhysicsTools.NanoAODJMAR.nano_jmar_cff import JMARnano_customizeData +from PhysicsTools.NanoAODJMAR.nano_jmar_cff import JMARnano_customizeData, JMARnano_customizeData_allPF, JMARnano_customizeData_AK8JetsOnly #call to customisation function JMARnano_customizeData imported from PhysicsTools.NanoAODJMAR.nano_jmar_cff -process = JMARnano_customizeData(process) +process = JMARnano_customizeData(process) #### Only PF cands from AK4 CHS and AK8 PUPPI jets +#process = JMARnano_customizeData_allPF(process) +#process = JMARnano_customizeData_AK8JetsOnly(process) # End of customisation functions diff --git a/test/nano106X_on_mini106X_2017_mc_NANO.py b/test/nano106X_on_mini106X_2017_mc_NANO.py index df9bd11..2b16d83 100644 --- a/test/nano106X_on_mini106X_2017_mc_NANO.py +++ b/test/nano106X_on_mini106X_2017_mc_NANO.py @@ -1,14 +1,13 @@ # Auto generated configuration file -# using: -# Revision: 1.19 -# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v -# with command line options: nano106X_on_mini106X_2017_mc -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 106X_mc2017_realistic_v6 --era Run2_2017,run2_nanoAOD_106Xv1 --customise_commands=process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False))) --nThreads 2 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeMC -n 100 --filein /store/mc/RunIISummer19UL17MiniAOD/QCD_HT700to1000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/MINIAODSIM/106X_mc2017_realistic_v6-v2/280000/958303DA-D6A9-5D47-8A71-4D8F39FFC221.root +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: nano106X_on_mini106X_2017_mc -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --conditions 106X_mc2017_realistic_v6 --era Run2_2017 --customise_commands=process.add_(cms.Service('InitRootHandlers', EnableIMT = cms.untracked.bool(False))) --nThreads 8 --customise PhysicsTools/NanoAODJMAR/nano_jmar_cff.JMARnano_customizeMC -n 100 --filein /store/mc/RunIISummer19UL17MiniAOD/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/MINIAODSIM/106X_mc2017_realistic_v6_ext2-v2/40000/DC8FEA2E-191B-834F-96C3-53FCF0291ADB.root import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 -from Configuration.Eras.Modifier_run2_nanoAOD_106Xv1_cff import run2_nanoAOD_106Xv1 -process = cms.Process('NANO',Run2_2017,run2_nanoAOD_106Xv1) +process = cms.Process('NANO',Run2_2017) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -28,8 +27,7 @@ # Input source process.source = cms.Source("PoolSource", - #fileNames = cms.untracked.vstring('/store/mc/RunIISummer19UL17MiniAOD/QCD_HT700to1000_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8/MINIAODSIM/106X_mc2017_realistic_v6-v2/280000/958303DA-D6A9-5D47-8A71-4D8F39FFC221.root'), - fileNames = cms.untracked.vstring('/store/mc/RunIIAutumn18MiniAOD/BulkGravTohhTohWWhbb_narrow_M-2800_TuneCP2_13TeV-madgraph_pythia8/MINIAODSIM/102X_upgrade2018_realistic_v15-v1/70000/DFABF044-2025-6E49-800A-C5BD664F8E55.root'), + fileNames = cms.untracked.vstring('/store/mc/RunIISummer19UL17MiniAOD/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/MINIAODSIM/106X_mc2017_realistic_v6_ext2-v2/40000/DC8FEA2E-191B-834F-96C3-53FCF0291ADB.root'), secondaryFileNames = cms.untracked.vstring() ) @@ -74,23 +72,25 @@ associatePatAlgosToolsTask(process) #Setup FWK for multithreaded -process.options.numberOfThreads=cms.untracked.uint32(1) +process.options.numberOfThreads=cms.untracked.uint32(8) process.options.numberOfStreams=cms.untracked.uint32(0) process.options.numberOfConcurrentLuminosityBlocks=cms.untracked.uint32(1) # customisation of the process. # Automatic addition of the customisation function from PhysicsTools.NanoAOD.nano_cff -from PhysicsTools.NanoAOD.nano_cff import nanoAOD_customizeMC +from PhysicsTools.NanoAOD.nano_cff import nanoAOD_customizeMC #call to customisation function nanoAOD_customizeMC imported from PhysicsTools.NanoAOD.nano_cff process = nanoAOD_customizeMC(process) # Automatic addition of the customisation function from PhysicsTools.NanoAODJMAR.nano_jmar_cff -from PhysicsTools.NanoAODJMAR.nano_jmar_cff import JMARnano_customizeMC +from PhysicsTools.NanoAODJMAR.nano_jmar_cff import JMARnano_customizeMC, JMARnano_customizeMC_allPF, JMARnano_customizeMC_AK8JetsOnly #call to customisation function JMARnano_customizeMC imported from PhysicsTools.NanoAODJMAR.nano_jmar_cff -process = JMARnano_customizeMC(process) +process = JMARnano_customizeMC(process) #### Only PF cands from AK4 CHS and AK8 PUPPI jets +#process = JMARnano_customizeMC_allPF(process) +#process = JMARnano_customizeMC_AK8JetsOnly(process) # End of customisation functions diff --git a/test/submit_all.py b/test/submit_all.py index 34409c9..ded7ed1 100644 --- a/test/submit_all.py +++ b/test/submit_all.py @@ -14,7 +14,7 @@ def getOptions() : """ usage = ('usage: python submit_all.py -c CONFIG -d DIR -f DATASETS_FILE') - parser = OptionParser(usage=usage) + parser = OptionParser(usage=usage) parser.add_option("-c", "--config", dest="cfg", default="test94X_NANO.py", help=("The crab script you want to submit "), metavar="CONFIG") @@ -35,25 +35,25 @@ def getOptions() : if options.cfg == None or options.dir == None or options.datasets == None or options.storageSite == None: parser.error(usage) - + return options - + def main(): options = getOptions() + from CRABAPI.RawCommand import crabCommand from WMCore.Configuration import Configuration config = Configuration() - from CRABAPI.RawCommand import crabCommand from httplib import HTTPException - + # We want to put all the CRAB project directories from the tasks we submit here into one common directory. # That's why we need to set this parameter (here or above in the configuration file, it does not matter, we will not overwrite it). config.section_("General") - config.General.workArea = options.dir + config.General.workArea = options.dir config.General.transferLogs = True config.section_("JobType") @@ -61,6 +61,8 @@ def main(): config.JobType.psetName = options.cfg config.JobType.maxMemoryMB = 5000 # Default is 2500 : Max I have used is 13000 config.JobType.maxJobRuntimeMin = 2750 #Default is 1315; 2750 minutes guaranteed to be available; Max I have used is 9000 + config.JobType.numCores = 8 + config.JobType.allowUndistributedCMSSW = True config.section_("Debug") config.Debug.extraJDL = ['+CMS_ALLOW_OVERFLOW=False'] @@ -70,17 +72,17 @@ def main(): config.Data.splitting = '' #config.Data.unitsPerJob = 1 config.Data.ignoreLocality = False - config.Data.publication = True + config.Data.publication = True config.Data.publishDBS = 'phys03' config.section_("Site") - config.Site.blacklist = ['T2_IN_TIFR','T2_US_Caltech'] + #config.Site.blacklist = ['T2_IN_TIFR','T2_US_Caltech'] #config.Site.whitelist = ['T2_US_UCSD','T2_DE_DESY', 'T1_US_FNAL','T2_UK_SGrid_RALPP','T2_PL_Swierk','T2_TW_NCHC','T2_BR_SPRACE'] config.Site.storageSite = options.storageSite print 'Using config ' + options.cfg print 'Writing to directory ' + options.dir - + def submit(config): try: crabCommand('submit', config = config) @@ -101,27 +103,27 @@ def submit(config): s = ijob.rstrip() jobs.append( s ) print ' --> added ' + s - + for ijob, job in enumerate(jobs) : ptbin = job.split('/')[1] cond = job.split('/')[2] datatier = job.split('/')[3] requestname = ptbin + '_' + cond - if len(requestname) > 93: + if len(requestname) > 93: requestname = ''.join((requestname[:93-len(requestname)]).split('_')[:-1]) if 'ext' in cond and not 'ext' in requestname: requestname = requestname + '_' + cond.split('_')[-1] - #requestname = requestname + '_try3' print 'requestname = ', requestname - config.General.requestName = requestname + config.General.requestName = requestname.split('AOD')[0]+'AOD_PFNano' config.Data.inputDataset = job - config.Data.outputDatasetTag = requestname - config.Data.outLFNDirBase = '/store/group/lpctlbsm/NanoAODJMAR_2019_V1/Production/CRAB/' - if datatier == 'MINIAODSIM': + config.Data.outputDatasetTag = 'RunII'+requestname.split('RunII')[1]+'_PFNano' + #config.Data.outLFNDirBase = '/store/group/lpctlbsm/NanoAODJMAR_2019_V1/Production/CRAB/' + config.Data.outLFNDirBase = '/store/user/'+os.environ['USER']+'/PFNano/' + if datatier == 'MINIAODSIM': config.Data.splitting = 'FileBased' - config.Data.unitsPerJob = 1 - elif datatier == 'MINIAOD': + config.Data.unitsPerJob = 10 + elif datatier == 'MINIAOD': config.Data.splitting = 'LumiBased' config.Data.lumiMask = options.lumiMask config.Data.unitsPerJob = 50 #10 # 200 @@ -130,7 +132,7 @@ def submit(config): print config try : from multiprocessing import Process - + p = Process(target=submit, args=(config,)) p.start() p.join() @@ -141,4 +143,4 @@ def submit(config): if __name__ == '__main__': - main() + main()