Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-06 22:55:03

0001 import FWCore.ParameterSet.Config as cms
0002 import Validation.RecoParticleFlow.defaults_cfi as default
0003 from Validation.RecoParticleFlow.defaults_cfi import ptbins, etabins, response_distribution_name, genjet_distribution_name,jetResponseDir,genjetDir
0004 
0005 #----- ----- ----- ----- ----- ----- ----- -----
0006 #
0007 # Auxiliary definitions
0008 #
0009 
0010 def make_response_plot_pset(name, title, responseNbins, responseLow, responseHigh, ptBinLow, ptBinHigh, etaBinLow, etaBinHigh):
0011     return cms.PSet(
0012         name = cms.string(name),
0013         title = cms.string(title),
0014         responseNbins = cms.uint32(responseNbins),
0015         responseLow = cms.double(responseLow),
0016         responseHigh = cms.double(responseHigh),
0017         ptBinLow = cms.double(ptBinLow),
0018         ptBinHigh = cms.double(ptBinHigh),
0019         etaBinLow = cms.double(etaBinLow),
0020         etaBinHigh = cms.double(etaBinHigh),
0021     )
0022 
0023 #Jet response is plotted in histograms which can be subdivided by pt and |eta| of the genjet.
0024 #To minimize the amount of logic on the C++ side, we define all response plots here.
0025 #Each plot has low and high pt and |eta| edges, the plot is filled only if the genjet
0026 #is in the bin defined by the edges.
0027 #It is your job here to make sure you define the bins in a non-overlapping way if
0028 #you want to emulate a 2D map over (pT, |eta|) of 1D histograms.
0029 def createResponsePlots(ptbins, etabins):
0030     response_plots = []
0031     #we always use a range [ibin, ibin+1)
0032     for ietabin in range(len(etabins)-1):
0033         for iptbin in range(len(ptbins)-1):
0034 
0035             response_plots += [make_response_plot_pset(
0036                 response_distribution_name(iptbin, ietabin),
0037                 "Jet response (pT/pTgen) in {0} <= pt < {1}, {2} <= |eta| < {3}".format(ptbins[iptbin], ptbins[iptbin+1], etabins[ietabin], etabins[ietabin+1]),
0038                 100, 0.0, 3.0, ptbins[iptbin], ptbins[iptbin+1], etabins[ietabin], etabins[ietabin+1]
0039             )]
0040     return response_plots
0041 
0042 def createGenJetPlots(ptbins, etabins):
0043     plots = []
0044     for ietabin in range(len(etabins)-1):
0045         eta_low = etabins[ietabin]
0046         eta_high = etabins[ietabin + 1]
0047         plots += [
0048             cms.PSet(
0049             name = cms.string(genjet_distribution_name(ietabin)),
0050             title = cms.string("GenJet pT ({0} <= |eta| <= {1}".format(eta_low, eta_high)),
0051             ptBins = cms.vdouble(ptbins),
0052             etaBinLow = cms.double(eta_low),
0053             etaBinHigh = cms.double(eta_high),
0054         )]
0055     return plots
0056 
0057 #----- ----- ----- ----- ----- ----- ----- -----
0058 #
0059 # Config for analyzer and postprocessor
0060 #
0061 
0062 name = "genjet_pt"
0063 title = "genjet pt"
0064 pfJetAnalyzerDQM = cms.EDProducer("PFJetAnalyzerDQM",
0065 
0066     #match these reco-jets to the gen-jets and compute jet response
0067     recoJetCollection = cms.InputTag('slimmedJets'),
0068     genJetCollection = cms.InputTag('slimmedGenJets'),
0069     jetDeltaR = cms.double(0.2),
0070 
0071     # turn gen jets on or off
0072     genJetsOn = cms.bool(True),
0073 
0074     responsePlots = cms.VPSet(createResponsePlots(ptbins, etabins)),
0075     genJetPlots = cms.VPSet(createGenJetPlots(ptbins, etabins))
0076 
0077 )
0078 
0079 pfPuppiJetAnalyzerDQM = pfJetAnalyzerDQM.clone(
0080     recoJetCollection = 'slimmedJetsPuppi',
0081     genJetsOn = False
0082 )
0083 
0084 vjetResponseDir = [jetResponseDir + "slimmedJets/JEC/",
0085                    jetResponseDir + "slimmedJets/noJEC/",
0086                    jetResponseDir + "slimmedJetsPuppi/JEC/",
0087                    jetResponseDir + "slimmedJetsPuppi/noJEC/"]
0088 
0089 pfJetDQMPostProcessor = cms.EDProducer("PFJetDQMPostProcessor",
0090 
0091     jetResponseDir = cms.vstring( vjetResponseDir ),
0092     genjetDir = cms.string( genjetDir ),
0093     ptBins = cms.vdouble( ptbins ),
0094     etaBins = cms.vdouble( etabins ),
0095     recoPtCut = cms.double( 15. )
0096 
0097 )
0098 
0099 
0100 # PFCandidates
0101 PFCandAnalyzerDQM = cms.EDProducer("PFCandidateAnalyzerDQM",
0102     PFCandType = cms.InputTag("packedPFCandidates"),
0103     etabins = cms.vdouble( default.etaBinsOffset ),
0104     pdgKeys = cms.vuint32( default.pdgIDDict.keys() ),
0105     pdgStrs = cms.vstring( default.pdgIDDict.values() )
0106 )
0107 
0108 
0109 #----- ----- ----- ----- ----- ----- ----- -----