Skip to content

Commit

Permalink
Merge pull request #90 from jjacob/master
Browse files Browse the repository at this point in the history
Updates required for latest version of ntuples.
  • Loading branch information
senkin committed Jun 16, 2014
2 parents 7186eb1 + 5f4d99e commit 2a47272
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 54 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,26 @@ export CMSSW_GIT_REFERENCE=/storage/.cmsgit-cache
#change CMSSW installation paths
export SCRAM_ARCH=slc5_amd64_gcc462
scram p -n CMSSW_5_3_16_patch1_nTuple_v10 CMSSW_5_3_16_patch1
cd CMSSW_5_3_16_patch1_nTuple_v10/src
scram p -n CMSSW_5_3_18_nTuple_v10 CMSSW_5_3_18
cd CMSSW_5_3_18_nTuple_v10/src
cmsenv
# Latest PAT recipe
# https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuidePATReleaseNotes52X#Add_CSCTightHaloFilter_CMSSW_5_3
# https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuidePATReleaseNotes52X#Add_new_jet_flavour
git cms-addpkg PhysicsTools/PatAlgos
git cms-addpkg CommonTools/Utils
git cms-addpkg PhysicsTools/Configuration
git cms-addpkg PhysicsTools/PatExamples
git cms-addpkg PhysicsTools/PatUtils
git cms-addpkg PhysicsTools/SelectorUtils
git cms-addpkg PhysicsTools/UtilAlgos
git cms-addpkg RecoBTag/SoftLepton
git cms-addpkg RecoMET/METFilters
git cms-merge-topic -u cms-analysis-tools:5_3_13-newJetFlavour
git cms-merge-topic -u cms-analysis-tools:5_3_13-updatedPATConfigs
git cms-addpkg EgammaAnalysis/ElectronTools
git cms-addpkg PhysicsTools/PatUtils
# ElectroWeakAnalysis needed for full LHAPDF libraries to work
git cms-addpkg ElectroWeakAnalysis/Utilities
Expand Down
6 changes: 3 additions & 3 deletions plugins/EventWeight_Producer_PU.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ EventWeight_Producer_PU::EventWeight_Producer_PU(const edm::ParameterSet& cfg) :

error_code = 0;

if (inTag_MCSampleTag == "Fall11" || inTag_MCSampleTag == "Summer12") {
if (inTag_MCSampleTag == "Fall11" || inTag_MCSampleTag == "Summer12" || inTag_MCSampleTag == "Summer11Leg") {

LumiWeights_ = edm::LumiReWeighting(inTag_MCSampleFile.fullPath(), inTag_DataFile.fullPath(),
inTag_MCSampleHistoName, inTag_DataHistoName);
Expand Down Expand Up @@ -65,13 +65,13 @@ void EventWeight_Producer_PU::produce(edm::Event& evt, const edm::EventSetup& se
{
int BX = iterPU->getBunchCrossing(); // -1: previous BX, 0: current BX, 1: next BX

if (inTag_MCSampleTag == "Fall11" || inTag_MCSampleTag == "Summer12") {
if (inTag_MCSampleTag == "Fall11" || inTag_MCSampleTag == "Summer12" || inTag_MCSampleTag == "Summer11Leg") {
if (BX == 0)
nvtx = iterPU->getTrueNumInteractions();
}
}

if (inTag_MCSampleTag == "Fall11" || inTag_MCSampleTag == "Summer12")
if (inTag_MCSampleTag == "Fall11" || inTag_MCSampleTag == "Summer12" || inTag_MCSampleTag == "Summer11Leg")
wght_ = LumiWeights_.weight(nvtx);
}
std::auto_ptr<double> eventWeightPUProduct(new double(wght_));
Expand Down
2 changes: 2 additions & 0 deletions plugins/TopPairElectronPlusJetsSelectionFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ bool TopPairElectronPlusJetsSelectionFilter::passesTriggerSelection() const {
return triggerFired("HLT_Ele25_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_TriCentralJet30", hltConfig_, triggerResults_);
} else if (MCSampleTag_ == "Summer12") { //Summer12 MC
return triggerFired("HLT_Ele27_WP80_v", hltConfig_, triggerResults_);
} else if (MCSampleTag_ == "Summer11Leg") { //7TeV legacy MC
return true; // to be updated once we have trigger efficiencies
} else
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/TopPairMuonPlusJetsSelectionFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,12 @@ bool TopPairMuonPlusJetsSelectionFilter::passesTriggerSelection() const {
else //2012 Data
return triggerFired("HLT_IsoMu24_eta2p1_v", hltConfig_, triggerResults_);
} else {
if (MCSampleTag_ == "Fall11") {
//Fall11 MC
if (MCSampleTag_ == "Fall11") {//Fall11 MC
return triggerFired("HLT_IsoMu24", hltConfig_, triggerResults_);
} else {//Summer12 MC

} else if (MCSampleTag_ == "Summer12") {//Summer12 MC
return triggerFired("HLT_IsoMu24_eta2p1_v", hltConfig_, triggerResults_);
} else if (MCSampleTag_ == "Summer11Leg") {//Summer11Leg
return true; // to be updated once we have trigger efficiencies
}
}
return false;
Expand Down
6 changes: 3 additions & 3 deletions python/EventFilter_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
TracksInput=cms.InputTag('generalTracks'),

# Specify input collections
electronInput=cms.InputTag("gsfElectrons"),
muonInput=cms.InputTag("cleanPatMuons"),
jetInput=cms.InputTag("ak5CaloJets"),
electronInput=cms.InputTag("selectedPatElectronsLoosePFlow"),
muonInput=cms.InputTag("selectedPatMuonsLoosePFlow"),
jetInput=cms.InputTag("selectedPatJetsPFlow"),

# Specifiy number of jets
minNJets=cms.int32(-1),
Expand Down
2 changes: 1 addition & 1 deletion python/EventWeight_Producer_PU_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
PUSource = cms.InputTag("addPileupInfo"),
WeightName = cms.string("eventWeightPU"),

MCSampleTag = cms.string("Summer12"), # valid identifier: Fall11, Summer12
MCSampleTag = cms.string("Summer12"), # valid identifier: Fall11, Summer12 or Summer11Leg

MCSampleFile = cms.FileInPath("BristolAnalysis/NTupleTools/data/PileUp/MC_PUDist_Default2012.root"),
MCSampleHistoName = cms.string("puhisto"),
Expand Down
20 changes: 1 addition & 19 deletions python/Jets_Setup_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ def setup_jets(process, cms, options, postfix="PFlow"):
print '=' * 60
#MC setup
inputJetCorrLabel = ('AK5PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'])
caloJetCorrection = ('AK5Calo', ['L1Offset' , 'L2Relative', 'L3Absolute'])

if options.useData :#data set up
inputJetCorrLabel = ('AK5PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute', 'L2L3Residual'])
caloJetCorrection = ('AK5Calo', ['L1Offset' , 'L2Relative', 'L3Absolute', 'L2L3Residual'])

print 'Using jet energy corrections: '
print 'Calo Jets'
print caloJetCorrection
print 'PF Jets'
print inputJetCorrLabel

Expand All @@ -37,21 +33,6 @@ def setup_jets(process, cms, options, postfix="PFlow"):

from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters


###############################
#### Calo Jet Setup ########
###############################
#this has to run after PF2PAT and before removeMCMatching
#see https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookPAT38xChanges#Details_with_PF2PAT
from PhysicsTools.PatAlgos.tools.jetTools import switchJetCollection, addJetCollection
# print 'adding calo jets'
switchJetCollection(process,
jetCollection=cms.InputTag('ak5CaloJets'),
jetCorrLabel=caloJetCorrection,
doBTagging=True,
doType1MET=False,)


###############################
###### Bare KT 0.6 jets #######
###############################
Expand Down Expand Up @@ -97,3 +78,4 @@ def setup_jets(process, cms, options, postfix="PFlow"):
pfNoElectron = getattr(process, "pfNoElectron" + postfix)
for module in additionalJets :
getattr(process, "patPF2PATSequence" + postfix).replace(pfNoElectron, pfNoElectron * module)

20 changes: 15 additions & 5 deletions python/MET_Setup_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,27 @@ def setup_MET_uncertainties(process, cms, options, postfix="PFlow"):
#runMEtUncertainties(process, doSmearJets=not options.useData, jetCollection='goodPatJetsPFlow', addToPatDefaultSequence=False)
if options.useData:
inputJetCorrLabelForMETuncertainties = 'L2L3Residual'
metSysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2012runAvsNvtx_data
if options.centreOfMassEnergy == 8:
metSysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2012runABCDvsNvtx_data
print "using pfMEtSysShiftCorrParameters_2012runABCDvsNvtx_data"
elif options.centreOfMassEnergy == 7:
metSysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2011runAplusBvsNvtx_data
print "using pfMEtSysShiftCorrParameters_2011runAplusBvsNvtx_data"
else:
inputJetCorrLabelForMETuncertainties = 'L3Absolute'
metSysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2012runAvsNvtx_mc
if options.centreOfMassEnergy == 8:
metSysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2012runABCDvsNvtx_mc
print "using pfMEtSysShiftCorrParameters_2012runABCDvsNvtx_mc"
elif options.centreOfMassEnergy == 7:
metSysShiftCorrParameter = process.pfMEtSysShiftCorrParameters_2011runAplusBvsNvtx_mc
print "using pfMEtSysShiftCorrParameters_2011runAplusBvsNvtx_mc"

process.pfMEtSysShiftCorr.parameter = metSysShiftCorrParameter

runMEtUncertainties(process,
electronCollection = cms.InputTag('cleanPatElectrons'),
muonCollection = 'cleanPatMuons',
tauCollection = 'cleanPatTaus',
electronCollection = cms.InputTag('patElectronsPFlow'),
muonCollection = 'patMuonsPFlow',
tauCollection = 'patTausPFlow',
jetCollection = cms.InputTag('goodPatJetsPFlow'),
jetCorrLabel = inputJetCorrLabelForMETuncertainties,
doSmearJets = not options.useData,
Expand Down
28 changes: 17 additions & 11 deletions python/NTupleTools_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,20 @@

if options.CMSSW == "53X" and options.centreOfMassEnergy == 8:
#Data Global Tag
GLOBALTAG_DATA = 'FT_53_V21_AN3::All' # Used for 2012 A, B, C and D: 22Jan2013 re-reco
GLOBALTAG_DATA = 'FT53_V21A_AN6::All' # Used for 2012 A, B, C and D: 22Jan2013 re-reco: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideFrontierConditions#Winter13_2012_A_B_C_D_datasets_r
#Monte Carlo Global Tag
GLOBALTAG_MC = 'START53_V21::All' #TO BE UPDATED TO RELEVANT 5_3_X 2011 7TEV PRODUCTION GLOBAL TAGS
GLOBALTAG_MC = 'START53_V27::All' #https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideFrontierConditions#Winter13_2012_A_B_C_D_datasets_r
FILETAG = '53X'
TEST_DATA_FILE = 'file:///storage/TopQuarkGroup/test/SingleElectron_Run2012B_13Jul2012_ReReco_AOD.root'
TEST_MC_FILE = 'file:///storage/TopQuarkGroup/mc/8TeV/SynchEx/Summer12_DR53X_TTJets_MassiveBinDECAY_TuneZ2star_8TeV-madgraph-tauola_AODSIM_PU_S10_START53_V7A-v1.root'
elif options.CMSSW == "53X" and options.centreOfMassEnergy == 7:
#Data Global Tag
GLOBALTAG_DATA = 'FT_R_53_LV5::All' #Winter 2013 2011A&B Legacy re-reco in CMSSW_5_3_X
GLOBALTAG_DATA = 'FT_53_LV5_AN1::All' #2011 7TeV 53X legacy data re-reco: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideFrontierConditions#2011AB_Legacy_re_reco_CMSSW_5_3
#Monte Carlo Global Tag
GLOBALTAG_MC = 'START53_V21::All' #TO BE UPDATED TO RELEVANT 5_3_X 2011 7TEV PRODUCTION GLOBAL TAGS WHEN AVAILABLE
GLOBALTAG_MC = 'START53_LV6A1::All' #2011 7TeV 53X legaco MC: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideFrontierConditions#7_TeV_MC_Legacy_reprocessing_in
FILETAG = '53X'
TEST_DATA_FILE = 'file:///storage/TopQuarkGroup/test/ElectronHad_Run2011A-12Oct2013-v1_AOD.root' #test file for 2011 7TEV RunA Oct2013 re-reco
TEST_MC_FILE = 'file:///storage/TopQuarkGroup/test/TTJets_TuneZ2_7TeV-madgraph-tauola_Summer11LegDR_53X_AODSIM.root'
TEST_DATA_FILE = 'file:///storage/TopQuarkGroup/test/ElectronHad_Run2011A-12Oct2013-v1_AOD.root' #test file for 2011 7TeV 53X RunA Oct2013 re-reco
TEST_MC_FILE = 'file:///storage/TopQuarkGroup/test/TTJets_TuneZ2_7TeV-madgraph-tauola_Summer11LegDR_53X_AODSIM.root' #test file for 2011 7TeV 53X TTJets Monte Carlo
elif options.CMSSW == '44X':
GLOBALTAG_DATA = 'GR_R_44_V15::All'
GLOBALTAG_MC = 'START44_V13::All'
Expand Down Expand Up @@ -313,8 +313,8 @@
process.genParticlesForJetsNoNu *
getattr(process, "patPF2PATSequence" + postfix) *
process.looseLeptonSequence *
process.patDefaultSequence *
process.goodPatJets *
#process.patDefaultSequence *
#process.goodPatJets *
process.goodPatJetsPFlow *
process.metUncertaintySequence *
process.EventFilters *
Expand Down Expand Up @@ -352,11 +352,17 @@
process.eventWeightPU.MCSampleHistoName = cms.string("histo_Fall11_true")
process.eventWeightPU.DataFile = cms.FileInPath("BristolAnalysis/NTupleTools/data/PileUp/Data_PUDist_2011Full.root")
process.eventWeightPU.DataHistoName = cms.string("histoData_true")
else:
elif options.CMSSW == '53X' and options.centreOfMassEnergy == 7:
process.eventWeightPU.MCSampleTag = cms.string("Summer11Leg")
process.eventWeightPU.MCSampleFile = cms.FileInPath("BristolAnalysis/NTupleTools/data/PileUp/MC_PUDist_Default2011.root")
process.eventWeightPU.MCSampleHistoName = cms.string("histo_Fall11_true")
process.eventWeightPU.DataFile = cms.FileInPath("BristolAnalysis/NTupleTools/data/PileUp/Data_PUDist_2011Full.root")
process.eventWeightPU.DataHistoName = cms.string("histoData_true")
elif options.CMSSW == '53X' and options.centreOfMassEnergy == 8:
process.eventWeightPU.MCSampleTag = cms.string("Summer12")
#process.eventWeightPU.MCSampleFile = cms.FileInPath("BristolAnalysis/NTupleTools/data/PileUp/MC_PUDist_Summer2012.root")
# process.eventWeightPU.MCSampleFile = cms.FileInPath("BristolAnalysis/NTupleTools/data/PileUp/MC_PUDist_Summer2012.root")
process.eventWeightPU.MCSampleFile = cms.FileInPath("BristolAnalysis/NTupleTools/data/PileUp/MC_PUDist_Default2012.root")
process.eventWeightPU.MCSampleHistoName = cms.string("puhisto")
process.eventWeightPU.MCSampleHistoName = cms.string("puhisto")

process.TFileService = cms.Service("TFileService",
fileName=cms.string('ntuple.root')
Expand Down
1 change: 1 addition & 0 deletions python/NTupler_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def setup_ntupler(process, cms, options):
process.rootNTuples.remove(process.rootTupleCaloMET)
process.rootNTuples.remove(process.rootTupleElectrons)
process.rootNTuples.remove(process.nTupleMuons)
process.rootNTuples.remove(process.rootTuplePhotons)

if not options.writeFat and not options.writeIsolatedPFLeptons:#write only PF particles
#isolated leptons
Expand Down
3 changes: 2 additions & 1 deletion python/TopPairElectronPlusJetsSelectionFilter_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
dropTriggerSelection = cms.bool(False),

prefix=cms.untracked.string('TopPairElectronPlusJetsSelection.'),
MCSampleTag = cms.string('Summer12'),#Fall11 or Summer12
MCSampleTag = cms.string('Summer12'),#Fall11 or Summer12 or Summer11Leg

#flags
debug=cms.untracked.bool(False),
taggingMode=cms.untracked.bool(False),
Expand Down
3 changes: 2 additions & 1 deletion python/TopPairMuonPlusJetsSelectionFilter_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
dropTriggerSelection = cms.bool(False),

prefix=cms.untracked.string('TopPairMuonPlusJetsSelection.'),
MCSampleTag = cms.string('Summer12'),#Fall11 or Summer12
MCSampleTag = cms.string('Summer12'),#Fall11 or Summer12 or Summer11Leg

#flags
debug=cms.untracked.bool(False),
taggingMode=cms.untracked.bool(False),
Expand Down
8 changes: 6 additions & 2 deletions test/unfoldingAndCutflow_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@

if options.CMSSW == '44X':
process.topPairEPlusJetsSelection.MCSampleTag = cms.string( 'Fall11' )
process.topPairMuPlusJetsSelection.MCSampleTag = cms.string( 'Fall11' )
else:
process.topPairMuPlusJetsSelection.MCSampleTag = cms.string( 'Fall11' )
elif options.CMSSW == '53X' and options.centreOfMassEnergy == 8:
process.topPairEPlusJetsSelection.MCSampleTag = cms.string( 'Summer12' )
process.topPairMuPlusJetsSelection.MCSampleTag = cms.string( 'Summer12' )
elif options.CMSSW == '53X' and options.centreOfMassEnergy == 7:
process.topPairEPlusJetsSelection.MCSampleTag = cms.string( 'Summer11Leg' )
process.topPairMuPlusJetsSelection.MCSampleTag = cms.string( 'Summer11Leg' )

if options.applyZselection:
process.topPairEPlusJetsSelection.tagAndProbeStudies = cms.bool( True )
Expand All @@ -70,6 +73,7 @@

electronselectionPrefix = 'TopPairElectronPlusJetsSelection.'
muonselectionPrefix = 'TopPairMuonPlusJetsSelection.'

process.topPairEPlusJetsSelection.prefix = cms.untracked.string( electronselectionPrefix )
process.topPairMuPlusJetsSelection.prefix = cms.untracked.string( muonselectionPrefix )

Expand Down

0 comments on commit 2a47272

Please sign in to comment.