Skip to content

Commit

Permalink
Merge pull request cms-sw#148 from arizzi/runOnData
Browse files Browse the repository at this point in the history
Cleaner implementation to run on data, cms-sw#160 should fix the rest
  • Loading branch information
arizzi committed Sep 15, 2015
2 parents 5c6267d + ce28095 commit f161530
Show file tree
Hide file tree
Showing 75 changed files with 45 additions and 309 deletions.
2 changes: 1 addition & 1 deletion VHbbAnalysis/Heppy/test/crab/heppy_config.py
8 changes: 4 additions & 4 deletions VHbbAnalysis/Heppy/test/crab/heppy_crab_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
'../vhbb.py',
'TMVAClassification_BDT.weights.xml',
'pdfQG_AK4chs_antib_13TeV_v1.root',
'../jec/PHYS14_V4_MC_L1FastJet_AK4PFchs.txt',
'../jec/PHYS14_V4_MC_L2Relative_AK4PFchs.txt',
'../jec/PHYS14_V4_MC_L3Absolute_AK4PFchs.txt',
'../jec/Uncertainty_FAKE.txt',
# '../jec/PHYS14_V4_MC_L1FastJet_AK4PFchs.txt',
# '../jec/PHYS14_V4_MC_L2Relative_AK4PFchs.txt',
# '../jec/PHYS14_V4_MC_L3Absolute_AK4PFchs.txt',
# '../jec/Uncertainty_FAKE.txt',
'../csv/csv_rwt_hf_IT_FlatSF.root',
'../csv/csv_rwt_lf_IT_FlatSF.root',
'Wln_weights_phys14.xml',
Expand Down
11 changes: 8 additions & 3 deletions VHbbAnalysis/Heppy/test/vhbb.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import logging
logging.basicConfig(level=logging.ERROR)

import os

cfg.Analyzer.nosubdir = True

Expand All @@ -24,7 +25,7 @@
verbose=False,
vectorTree = True,
globalVariables = [
NTupleVariable("nPU0", lambda ev : [bx.nPU() for bx in ev.pileUpInfo if bx.getBunchCrossing()==0][0], help="nPU in BX=0"),
NTupleVariable("nPU0", lambda ev : [bx.nPU() for bx in ev.pileUpInfo if bx.getBunchCrossing()==0][0], help="nPU in BX=0",mcOnly=True),
NTupleVariable("nPVs", lambda ev : len(ev.goodVertices), help="total number of good PVs"),
NTupleVariable("Vtype", lambda ev : ev.Vtype, help="Event classification"),
NTupleVariable("VtypeSim", lambda ev : ev.VtypeSim, help="Event classification",mcOnly=True),
Expand Down Expand Up @@ -206,8 +207,9 @@
JetAna.doQG=True
JetAna.QGpath="pdfQG_AK4chs_antib_13TeV_v1.root"
JetAna.recalibrateJets=True
JetAna.jecPath="jec"
JetAna.jecPath=os.environ['CMSSW_BASE']+"/src/VHbbAnalysis/Heppy/data/jec"
JetAna.mcGT="PHYS14_V4_MC"
JetAna.dataGT = "Summer15_50nsV4_DATA"

VHbb = cfg.Analyzer(
verbose=False,
Expand Down Expand Up @@ -244,11 +246,14 @@
#sh = cfg.Analyzer( class_object=HeppyShell)

from PhysicsTools.Heppy.analyzers.core.TriggerBitAnalyzer import TriggerBitAnalyzer

from VHbbAnalysis.Heppy.TriggerTable import triggerTable
from VHbbAnalysis.Heppy.TriggerTableData import triggerTable as triggerTableData

TrigAna = cfg.Analyzer(
verbose = False,
class_object = TriggerBitAnalyzer,
triggerBits = triggerTable,
triggerBits = triggerTable, #default is MC, use the triggerTableData in -data.py files
# processName = 'HLT',
# outprefix = 'HLT'
)
Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions VHbbAnalysis/Heppy/test/vhbb_combined_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /usr/bin/env python

from vhbb_combined import *

sample.isMC=False
sample.isData=True
sample.files=[
"root://xrootd.unl.edu//store/data/Run2015B/SingleMuon/MINIAOD/PromptReco-v1/000/251/162/00000/160C08A3-4227-E511-B829-02163E01259F.root"
]
FlagsAna.processName='RECO'
TrigAna.triggerBits = triggerTableData

# and the following runs the process directly
if __name__ == '__main__':
from PhysicsTools.HeppyCore.framework.looper import Looper
looper = Looper( 'Loop', config, nPrint = 1, nEvents = 1000)

import time
import cProfile
p = cProfile.Profile(time.clock)
p.runcall(looper.loop)
p.print_stats()
looper.write()
310 changes: 9 additions & 301 deletions VHbbAnalysis/Heppy/test/vhbb_data.py

Large diffs are not rendered by default.

0 comments on commit f161530

Please sign in to comment.