Skip to content

Commit

Permalink
first draft version of analysis output
Browse files Browse the repository at this point in the history
  • Loading branch information
kreczko committed Aug 8, 2016
1 parent 61fb2fc commit 6cedb04
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 52 deletions.
14 changes: 8 additions & 6 deletions plugins/VariableProducer.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "BristolAnalysis/NTupleTools/interface/PatUtilities.h"
#include "BristolAnalysis/NTupleTools/plugins/VariableProducer.h"
#include "DataFormats/Math/interface/angle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "BristolAnalysis/NTupleTools/interface/PatUtilities.h"
#include "DataFormats/Math/interface/angle.h"

namespace ntp {
VariableProducer::VariableProducer(const edm::ParameterSet& iConfig) :
Expand Down Expand Up @@ -34,8 +35,8 @@ VariableProducer::VariableProducer(const edm::ParameterSet& iConfig) :
produces<double>(prefix_ + "MT" + suffix_);
produces<double>(prefix_ + "WPT" + suffix_);

produces<double>(prefix_ + "lepton_eta" + suffix_);
produces<double>(prefix_ + "lepton_pt" + suffix_);
produces<double>(prefix_ + "leptonEta" + suffix_);
produces<double>(prefix_ + "leptonPt" + suffix_);

produces<unsigned int>(prefix_ + "NJets" + suffix_);
produces<unsigned int>(prefix_ + "NBJets" + suffix_);
Expand Down Expand Up @@ -73,8 +74,8 @@ void VariableProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup
iEvent.put(MT, prefix_ + "MT" + suffix_);
iEvent.put(WPT, prefix_ + "WPT" + suffix_);

iEvent.put(leptonEta, prefix_ + "lepton_eta" + suffix_);
iEvent.put(leptonPt, prefix_ + "lepton_pt" + suffix_);
iEvent.put(leptonEta, prefix_ + "leptonEta" + suffix_);
iEvent.put(leptonPt, prefix_ + "leptonPt" + suffix_);

iEvent.put(nJets, prefix_ + "NJets" + suffix_);
iEvent.put(nBJets, prefix_ + "NBJets" + suffix_);
Expand Down Expand Up @@ -190,4 +191,5 @@ double VariableProducer::WPT(const LorentzVector& lepton, const pat::MET& met) {
LorentzVector W_boson(lepton + met.p4());
return W_boson.Pt();
}
DEFINE_FWK_MODULE (VariableProducer);
}
84 changes: 38 additions & 46 deletions python/NTupler_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,45 @@ def setup_ntupler(process, cms):
print '=' * 60
print "Setting up NTupler"
print '=' * 60
######################################################################################################
################################## nTuple Configuration ##############################################
######################################################################################################
##########################################################################
##################### nTuple Configuration ###############################
##########################################################################
process.load('BristolAnalysis.NTupleTools.Ntuple_cff')

process.nTupleTree = cms.EDAnalyzer("RootTupleMakerV2_Tree",
treeName = cms.string('tree'),
outputCommands=cms.untracked.vstring(
'drop *',
# Event
'keep *_nTupleEvent_*_*',
# Trigger
'keep *_nTupleTrigger*_*_*',
# Trigger Objects
# 'keep *_nTupleTriggerObjects*_*_*',
# Vertices
'keep *_nTupleVertex_*_*',
# muons
'keep *_nTupleMuons_*_*',
# electrons
'keep *_nTupleElectrons_*_*',
# jets
'keep *_nTuplePFJets_*_*',
# MET
'keep *_nTupleMET_*_*',
# Gen Event
'keep *_nTupleGenEventInfo_*_*',
# Gen Particles
'keep *_nTupleGenParticles_*_*',
# Gen Jets
'keep *_nTupleGenJets_*_*',
# Gen MET
'keep *_nTupleGenMET_*_*',
# Pseudo Top
'keep *_nTuplePseudoTop*_*_*',

'keep *_selectionCriteriaAnalyzer_*_*'
)
)

process.nTupleTreeMuon = process.nTupleTree.clone( treeName = cms.string('muonTree') )
process.nTupleTreeMuon.outputCommands.append( 'keep *_topPairMuPlusJetsSelectionTagging_*_*' )
process.nTupleTreeElectron = process.nTupleTree.clone( treeName = cms.string('electronTree') )
process.nTupleTreeElectron.outputCommands.append( 'keep *_topPairEPlusJetsSelectionTagging_*_*' )
from BristolAnalysis.NTupleTools.rootTupleMaker_cfi import rootTupleMaker
process.nTupleTree = rootTupleMaker.clone(
treeName='tree',
outputCommands=[
'drop *',
# Event
'keep *_nTupleEvent_*_*',
# Trigger
'keep *_nTupleTrigger*_*_*',
# Trigger Objects
# 'keep *_nTupleTriggerObjects*_*_*',
# Vertices
'keep *_nTupleVertex_*_*',
# muons
'keep *_nTupleMuons_*_*',
# electrons
'keep *_nTupleElectrons_*_*',
# jets
'keep *_nTuplePFJets_*_*',
# MET
'keep *_nTupleMET_*_*',
# Gen Event
'keep *_nTupleGenEventInfo_*_*',
# Gen Particles
'keep *_nTupleGenParticles_*_*',
# Gen Jets
'keep *_nTupleGenJets_*_*',
# Gen MET
'keep *_nTupleGenMET_*_*',
# Pseudo Top
'keep *_nTuplePseudoTop*_*_*',

'keep *_selectionCriteriaAnalyzer_*_*'
]
)

process.nTuples = cms.Sequence(
# Event
Expand Down Expand Up @@ -90,6 +85,3 @@ def setup_ntupler(process, cms):
# Pseudo Top
process.pseudoTopSequence
)

process.muonNTuples = cms.Sequence( process.nTuples * process.nTupleTreeMuon )
process.electronNTuples = cms.Sequence( process.nTuples * process.nTupleTreeElectron )
Empty file added python/analysis/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions python/analysis/content_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import FWCore.ParameterSet.Config as cms

from BristolAnalysis.NTupleTools.rootTupleMaker_cfi import rootTupleMaker
analysisTree = rootTupleMaker.clone(
treeName='FitVariables',
outputCommands=[
'drop *',
'keep bool_topPairEPlusJetsSelectionTagging_*_*',
'keep *_globalVariablesElectron_*_*',
],
)

from BristolAnalysis.NTupleTools.analysis.variableProducer_cfi import variableProducer
globalVariablesElectron = variableProducer.clone(
channel='electron',
prefix='EPlusJets.',
)
14 changes: 14 additions & 0 deletions python/analysis/variableProducer_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import FWCore.ParameterSet.Config as cms

variableProducer = cms.EDProducer(
'VariableProducer',
cleanedJets=cms.InputTag('goodJets'),
cleanedBJets=cms.InputTag('goodBJets'),
signalElectrons=cms.InputTag('goodElectrons'),
signalMuons=cms.InputTag('goodMuons'),
met=cms.InputTag('slimmedMETs'),
minJetPtForHT=cms.double(20.),
channel=cms.string('electron'),
prefix=cms.string('prefix.'),
suffix=cms.string(''),
)
9 changes: 9 additions & 0 deletions python/rootTupleMaker_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import FWCore.ParameterSet.Config as cms

rootTupleMaker = cms.EDAnalyzer(
"RootTupleMakerV2_Tree",
treeName=cms.string('test'),
outputCommands=cms.untracked.vstring(
'drop *',
)
)
3 changes: 3 additions & 0 deletions python/run/miniAODToNTuple_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@
process.nTupleMuons.InputTag = 'muonUserData'
process.nTuplePFJets.InputTag = 'jetUserData'

# analysis output
process.load('BristolAnalysis.NTupleTools.analysis.content_cff')
process.makingNTuples *= process.globalVariablesElectron*process.analysisTree
# EDM NTuples
# process.load('BristolAnalysis.NTupleTools.content')
#
Expand Down

0 comments on commit 6cedb04

Please sign in to comment.