Skip to content

Commit

Permalink
Merge pull request #7 from camendola/chiara-modForVBFeff
Browse files Browse the repository at this point in the history
mod to produce ntuples for L1 VBF efficiency evaluation on data
  • Loading branch information
davignon authored Dec 5, 2017
2 parents 8dcd63f + 11da0de commit 624de80
Show file tree
Hide file tree
Showing 2 changed files with 183 additions and 0 deletions.
69 changes: 69 additions & 0 deletions TauTagAndProbe/python/DataAnalysis_noTagAndProbe_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import FWCore.ParameterSet.Config as cms

print "Running on Data"


HLTLIST = cms.VPSet(
cms.PSet (
HLT = cms.string("HLT_IsoMu17_eta2p1_LooseIsoPFTau20_SingleL1_v"),
path1 = cms.vstring ("hltL3crIsoL1sSingleMu16erL1f0L2f10QL3f17QL3trkIsoFiltered0p09", "hltOverlapFilterSingleIsoMu17LooseIsoPFTau20"),
path2 = cms.vstring ("hltPFTau20TrackLooseIsoAgainstMuon", "hltOverlapFilterSingleIsoMu17LooseIsoPFTau20"),
leg1 = cms.int32(13),
leg2 = cms.int32(15)
)
)



# filter HLT paths for T&P
import HLTrigger.HLTfilters.hltHighLevel_cfi as hlt
hltFilter = hlt.hltHighLevel.clone(
TriggerResultsTag = cms.InputTag("TriggerResults","","HLT"),
HLTPaths = ['HLT_IsoMu27_v'],
andOr = cms.bool(True), # how to deal with multiple triggers: True (OR) accept if ANY is true, False (AND) accept if ALL are true
throw = cms.bool(True) #if True: throws exception if a trigger path is invalid
)

## good taus - apply analysis selection
goodTaus = cms.EDFilter("PATTauRefSelector",
src = cms.InputTag("slimmedTaus"),
cut = cms.string(
'pt > 20 && abs(eta) < 2.1 ' #kinematics
'&& abs(charge) > 0 && abs(charge) < 2 ' #sometimes 2 prongs have charge != 1
'&& tauID("decayModeFinding") > 0.5 ' # tau ID
'&& tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits") < 2.5 ' # tau iso - NOTE: can as well use boolean discriminators with WP
'&& tauID("againstMuonTight3") > 0.5 ' # anti Muon tight
'&& tauID("againstElectronVLooseMVA6") > 0.5 ' # anti-Ele loose
),
filter = cms.bool(False)
)

genMatchedTaus = cms.EDFilter("genMatchTauFilter",
taus = cms.InputTag("goodTaus")
)

# Ntuplizer.taus = cms.InputTag("genMatchedTaus")
Ntuplizer_noTagAndProbe = cms.EDAnalyzer("Ntuplizer_noTagAndProbe",
treeName = cms.string("TagAndProbe"),
genCollection = cms.InputTag("generator"),
taus = cms.InputTag("goodTaus"),
triggerSet = cms.InputTag("slimmedPatTrigger"),
triggerResultsLabel = cms.InputTag("TriggerResults", "", "HLT"),
L1Tau = cms.InputTag("caloStage2Digis", "Tau", "RECO"),
L1EmuTau = cms.InputTag("simCaloStage2Digis", "MP"),
jetCollection = cms.InputTag("slimmedJets"),
l1tJetCollection = cms.InputTag("caloStage2Digis","Jet"),
Vertexes = cms.InputTag("offlineSlimmedPrimaryVertices"),
triggerList = HLTLIST,
L2CaloJet_ForIsoPix_Collection = cms.InputTag("hltL2TausForPixelIsolation", "", "TEST"),
L2CaloJet_ForIsoPix_IsoCollection = cms.InputTag("hltL2TauPixelIsoTagProducer", "", "TEST")
)

TAndPseq = cms.Sequence(
goodTaus
# genMatchedTaus
)

NtupleSeq = cms.Sequence(
Ntuplizer_noTagAndProbe
)
114 changes: 114 additions & 0 deletions TauTagAndProbe/test/test_data_noTagAndProbe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import FWCore.ParameterSet.VarParsing as VarParsing
import FWCore.PythonUtilities.LumiList as LumiList
import FWCore.ParameterSet.Config as cms
process = cms.Process("TagAndProbe")

#isMC = True
isMC = False

process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")

#### handling of cms line options for tier3 submission
#### the following are dummy defaults, so that one can normally use the config changing file list by hand etc.

options = VarParsing.VarParsing ('analysis')
options.register ('skipEvents',
-1, # default value
VarParsing.VarParsing.multiplicity.singleton, # singleton or list
VarParsing.VarParsing.varType.int, # string, int, or float
"Number of events to skip")
options.register ('JSONfile',
"", # default value
VarParsing.VarParsing.multiplicity.singleton, # singleton or list
VarParsing.VarParsing.varType.string, # string, int, or float
"JSON file (empty for no JSON)")
options.outputFile = 'NTuple.root'
options.inputFiles = []
options.maxEvents = -999
options.parseArguments()

if not isMC: # will use 92X
from Configuration.AlCa.autoCond import autoCond
process.GlobalTag.globaltag = '92X_dataRun2_HLT_v7'
process.load('TauTagAndProbe.TauTagAndProbe.DataAnalysis_noTagAndProbe_cff')
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'/store/data/Run2017C/SingleMuon/MINIAOD/12Sep2017-v1/00000/001BA513-7DBB-E711-B839-7CD30ACE1762.root'
#'/store/data/Run2017A/SingleMuon/MINIAOD/PromptReco-v2/000/296/168/00000/084C505D-784C-E711-8140-02163E019DA4.root'
#'/store/data/Run2016H/SingleMuon/MINIAOD/PromptReco-v2/000/282/092/00000/DE499C8E-1B8B-E611-8C93-02163E014207.root'
#'/store/data/Run2016H/SingleMuon/MINIAOD/PromptReco-v2/000/282/092/00000/ACA10D13-2D8B-E611-820E-FA163E8FD709.root'
#'/store/data/Run2016H/SingleMuon/MINIAOD/PromptReco-v2/000/282/092/00000/20AE9A37-2D8B-E611-8405-02163E0119B8.root'
#/store/data/Run2016H/SingleMuon/MINIAOD/PromptReco-v2/000/282/092/00000/1E61B437-358B-E611-91C5-02163E011AEE.root'
#'/store/data/Run2016H/SingleMuon/MINIAOD/PromptReco-v2/000/282/092/00000/BC5DD41A-2E8B-E611-B4EF-02163E012B59.root'
#'/store/mc/RunIISpring16MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/MINIAODSIM/PUSpring16RAWAODSIM_reHLT_80X_mcRun2_asymptotic_v14-v1/40000/00200284-F15C-E611-AA9B-002590574776.root',
# '/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/082EC2A0-4C28-E611-BC61-02163E014412.root',
# '/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/1014078C-4C28-E611-85FB-02163E0141C1.root',
# '/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/203E5176-4C28-E611-B4F8-02163E014743.root',
# '/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/32508866-4C28-E611-A38D-02163E011BAF.root',
# '/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/44AF1068-4C28-E611-80D0-02163E01367B.root',
# '/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/5AF4B08A-4C28-E611-AEC9-02163E01342C.root',
# '/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/6E3FD070-4C28-E611-9A1E-02163E011DC7.root',

#'/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/7005DB70-4C28-E611-8628-02163E0144DD.root',
#'/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/7C2CB76B-4C28-E611-8D90-02163E01467F.root',
#'/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/274/199/00000/86B68469-4C28-E611-92A6-02163E01419C.root',
#'/store/data/Run2016B/SingleMuon/MINIAOD/PromptReco-v2/000/275/125/00000/24FC42B2-8036-E611-B42D-02163E012BD1.root'
),
#eventsToProcess = cms.untracked.VEventRange('282092:1057805498')
)
else:
process.GlobalTag.globaltag = '92X_upgrade2017_TSG_For90XSamples_V2' #MC 25 ns miniAODv2
#process.GlobalTag.globaltag = '80X_mcRun2_asymptotic_2016_miniAODv2' #MC 25 ns miniAODv2
# process.GlobalTag.globaltag = '76X_dataRun2_16Dec2015_v0'
process.load('TauTagAndProbe.TauTagAndProbe.MCanalysis_noTagAndProbe_cff')
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'/store/mc/PhaseIFall16MiniAOD/VBFHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/FlatPU28to62HcalNZSRAW_PhaseIFall16_90X_upgrade2017_realistic_v6_C1-v1/00000/182AC7D1-661B-E711-BA96-0242AC130006.root'
#'/store/mc/RunIISpring16MiniAODv2/GluGluHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/FlatPU20to70HcalNZSRAW_withHLT_80X_mcRun2_asymptotic_v14-v1/50000/B0D22F36-9567-E611-A5FB-0CC47A4DEE76.root'
#'/store/mc/RunIISpring16MiniAODv2/GluGluHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/FlatPU20to70HcalNZSRAW_withHLT_80X_mcRun2_asymptotic_v14-v1/50000/B0D22F36-9567-E611-A5FB-0CC47A4DEE76.root'
#'file:B0D22F36-9567-E611-A5FB-0CC47A4DEE76.root'
#'/store/mc/RunIIFall15MiniAODv2/GluGluToRadionToHHTo2B2Tau_M-700_narrow_13TeV-madgraph/MINIAODSIM/PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1/60000/2CD9692A-9EB8-E511-A944-FACADE0000C9.root'
#'/store/mc/RunIIFall15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1/70000/02A85EE9-70BA-E511-A0A2-0CC47A4D7678.root',
#'/store/mc/RunIIFall15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1/70000/08C274E5-70BA-E511-920F-0CC47A78A458.root',
#'/store/mc/RunIIFall15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1/70000/06E9C8D6-79BA-E511-9EB0-0CC47A4D7600.root',
#'/store/mc/RunIIFall15MiniAODv2/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1/70000/08B579D9-C7B8-E511-861F-00259021A526.root'

#'/store/mc/RunIISpring16MiniAODv2/GluGluHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/PUSpring16RAWAODSIM_reHLT_80X_mcRun2_asymptotic_v14-v1/80000/065837E2-DA38-E611-9157-008CFA50291C.root',
#'/store/mc/RunIISpring16MiniAODv2/GluGluHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/PUSpring16RAWAODSIM_reHLT_80X_mcRun2_asymptotic_v14-v1/80000/0C6A2B22-DA38-E611-AA0C-842B2B2AB616.root',
#'/store/mc/RunIISpring16MiniAODv2/GluGluHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/PUSpring16RAWAODSIM_reHLT_80X_mcRun2_asymptotic_v14-v1/80000/0EB9BEA7-D938-E611-85DD-0242AC130003.root',
#'/store/mc/RunIISpring16MiniAODv2/GluGluHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/PUSpring16RAWAODSIM_reHLT_80X_mcRun2_asymptotic_v14-v1/80000/12DC7ABE-DA38-E611-9BA2-0242AC130005.root'

)
)

if options.JSONfile:
print "Using JSON: " , options.JSONfile
process.source.lumisToProcess = LumiList.LumiList(filename = options.JSONfile).getVLuminosityBlockRange()

if options.inputFiles:
process.source.fileNames = cms.untracked.vstring(options.inputFiles)

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(10000)
)

if options.maxEvents >= -1:
process.maxEvents.input = cms.untracked.int32(options.maxEvents)
if options.skipEvents >= 0:
process.source.skipEvents = cms.untracked.uint32(options.skipEvents)

process.options = cms.untracked.PSet(
wantSummary = cms.untracked.bool(True)
)

process.p = cms.Path(
process.TAndPseq +
process.NtupleSeq
)

# Silence output
process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000

# Adding ntuplizer
process.TFileService=cms.Service('TFileService',fileName=cms.string(options.outputFile))

0 comments on commit 624de80

Please sign in to comment.