Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:15

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, recojet_distribution_name, jetResponseDir, genjetDir, offsetDir
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 def createRecoJetPlots(ptbins, etabins):
0058     plots = []
0059     for ietabin in range(len(etabins)-1):
0060         eta_low = etabins[ietabin]
0061         eta_high = etabins[ietabin + 1]
0062         plots += [
0063             cms.PSet(
0064             name = cms.string(recojet_distribution_name(ietabin)),
0065             title = cms.string("RecoJet ({0} <= |eta| <= {1})".format(eta_low, eta_high)),
0066             ptBins = cms.vdouble(ptbins),
0067             etaBinLow = cms.double(eta_low),
0068             etaBinHigh = cms.double(eta_high),
0069         )]
0070     return plots
0071 
0072 #----- ----- ----- ----- ----- ----- ----- -----
0073 #
0074 # Config for analyzer and postprocessor
0075 #
0076 
0077 name = "genjet_pt"
0078 title = "genjet pt"
0079 pfJetAnalyzerDQM = cms.EDProducer("PFJetAnalyzerDQM",
0080 
0081     #match these reco-jets to the gen-jets and compute jet response
0082     recoJetCollection = cms.InputTag('slimmedJets'),
0083     genJetCollection = cms.InputTag('slimmedGenJets'),
0084     jetDeltaR = cms.double(0.2),
0085 
0086     # turn gen jets on or off
0087     genJetsOn = cms.bool(True),
0088     recoJetsOn = cms.bool(True),
0089     responsePlots = cms.VPSet(createResponsePlots(ptbins, etabins)),
0090     genJetPlots = cms.VPSet(createGenJetPlots(ptbins, etabins)),
0091     recoJetPlots = cms.VPSet(createRecoJetPlots(ptbins, etabins)),
0092 )
0093 
0094 pfPuppiJetAnalyzerDQM = pfJetAnalyzerDQM.clone(
0095     recoJetCollection = 'slimmedJetsPuppi',
0096     genJetsOn = False
0097 )
0098 
0099 vjetResponseDir = [jetResponseDir + "slimmedJets/JEC/",
0100                    jetResponseDir + "slimmedJets/noJEC/",
0101                    jetResponseDir + "slimmedJetsPuppi/JEC/",
0102                    jetResponseDir + "slimmedJetsPuppi/noJEC/"]
0103 
0104 pfJetDQMPostProcessor = cms.EDProducer("PFJetDQMPostProcessor",
0105 
0106     jetResponseDir = cms.vstring( vjetResponseDir ),
0107     genjetDir = cms.string( genjetDir ),
0108     offsetDir = cms.string( offsetDir ),
0109     ptBins = cms.vdouble( ptbins ),
0110     etaBins = cms.vdouble( etabins ),
0111     recoPtCut = cms.double(10. )
0112 )
0113 
0114 
0115 # PFCandidates
0116 PFCandAnalyzerDQM = cms.EDProducer("PFCandidateAnalyzerDQM",
0117     PFCandType = cms.InputTag("packedPFCandidates"),
0118     etabins = cms.vdouble( default.etaBinsOffset ),
0119     pdgKeys = cms.vuint32( default.pdgIDDict.keys() ),
0120     pdgStrs = cms.vstring( default.pdgIDDict.values() )
0121 )
0122 
0123 
0124 #----- ----- ----- ----- ----- ----- ----- -----