CMS 3D CMS Logo

particleFlowDQM_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 import Validation.RecoParticleFlow.defaults_cfi as default
3 from Validation.RecoParticleFlow.defaults_cfi import ptbins, etabins, response_distribution_name, genjet_distribution_name,jetResponseDir,genjetDir
4 
5 #----- ----- ----- ----- ----- ----- ----- -----
6 #
7 # Auxiliary definitions
8 #
9 
10 def make_response_plot_pset(name, title, responseNbins, responseLow, responseHigh, ptBinLow, ptBinHigh, etaBinLow, etaBinHigh):
11  return cms.PSet(
12  name = cms.string(name),
13  title = cms.string(title),
14  responseNbins = cms.uint32(responseNbins),
15  responseLow = cms.double(responseLow),
16  responseHigh = cms.double(responseHigh),
17  ptBinLow = cms.double(ptBinLow),
18  ptBinHigh = cms.double(ptBinHigh),
19  etaBinLow = cms.double(etaBinLow),
20  etaBinHigh = cms.double(etaBinHigh),
21  )
22 
23 #Jet response is plotted in histograms which can be subdivided by pt and |eta| of the genjet.
24 #To minimize the amount of logic on the C++ side, we define all response plots here.
25 #Each plot has low and high pt and |eta| edges, the plot is filled only if the genjet
26 #is in the bin defined by the edges.
27 #It is your job here to make sure you define the bins in a non-overlapping way if
28 #you want to emulate a 2D map over (pT, |eta|) of 1D histograms.
29 def createResponsePlots(ptbins, etabins):
30  response_plots = []
31  #we always use a range [ibin, ibin+1)
32  for ietabin in range(len(etabins)-1):
33  for iptbin in range(len(ptbins)-1):
34 
35  response_plots += [make_response_plot_pset(
36  response_distribution_name(iptbin, ietabin),
37  "Jet response (pT/pTgen) in {0} <= pt < {1}, {2} <= |eta| < {3}".format(ptbins[iptbin], ptbins[iptbin+1], etabins[ietabin], etabins[ietabin+1]),
38  100, 0.0, 3.0, ptbins[iptbin], ptbins[iptbin+1], etabins[ietabin], etabins[ietabin+1]
39  )]
40  return response_plots
41 
42 def createGenJetPlots(ptbins, etabins):
43  plots = []
44  for ietabin in range(len(etabins)-1):
45  eta_low = etabins[ietabin]
46  eta_high = etabins[ietabin + 1]
47  plots += [
48  cms.PSet(
49  name = cms.string(genjet_distribution_name(ietabin)),
50  title = cms.string("GenJet pT ({0} <= |eta| <= {1}".format(eta_low, eta_high)),
51  ptBins = cms.vdouble(ptbins),
52  etaBinLow = cms.double(eta_low),
53  etaBinHigh = cms.double(eta_high),
54  )]
55  return plots
56 
57 #----- ----- ----- ----- ----- ----- ----- -----
58 #
59 # Config for analyzer and postprocessor
60 #
61 
62 name = "genjet_pt"
63 title = "genjet pt"
64 pfJetAnalyzerDQM = cms.EDProducer("PFJetAnalyzerDQM",
65 
66  #match these reco-jets to the gen-jets and compute jet response
67  recoJetCollection = cms.InputTag('slimmedJets'),
68  genJetCollection = cms.InputTag('slimmedGenJets'),
69  jetDeltaR = cms.double(0.2),
70 
71  # turn gen jets on or off
72  genJetsOn = cms.bool(True),
73 
74  responsePlots = cms.VPSet(createResponsePlots(ptbins, etabins)),
75  genJetPlots = cms.VPSet(createGenJetPlots(ptbins, etabins))
76 
77 )
78 
79 pfPuppiJetAnalyzerDQM = pfJetAnalyzerDQM.clone(
80  recoJetCollection = 'slimmedJetsPuppi',
81  genJetsOn = False
82 )
83 
84 vjetResponseDir = [jetResponseDir + "slimmedJets/JEC/",
85  jetResponseDir + "slimmedJets/noJEC/",
86  jetResponseDir + "slimmedJetsPuppi/JEC/",
87  jetResponseDir + "slimmedJetsPuppi/noJEC/"]
88 
89 pfJetDQMPostProcessor = cms.EDProducer("PFJetDQMPostProcessor",
90 
91  jetResponseDir = cms.vstring( vjetResponseDir ),
92  genjetDir = cms.string( genjetDir ),
93  ptBins = cms.vdouble( ptbins ),
94  etaBins = cms.vdouble( etabins ),
95  recoPtCut = cms.double( 15. )
96 
97 )
98 
99 
100 # PFCandidates
101 PFCandAnalyzerDQM = cms.EDProducer("PFCandidateAnalyzerDQM",
102  PFCandType = cms.InputTag("packedPFCandidates"),
103  etabins = cms.vdouble( default.etaBinsOffset ),
104  pdgKeys = cms.vuint32( default.pdgIDDict.keys() ),
105  pdgStrs = cms.vstring( default.pdgIDDict.values() )
106 )
107 
108 
109 #----- ----- ----- ----- ----- ----- ----- -----
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
particleFlowDQM_cff.createResponsePlots
def createResponsePlots(ptbins, etabins)
Definition: particleFlowDQM_cff.py:29
defaults_cfi.genjet_distribution_name
def genjet_distribution_name(ietabin)
Definition: defaults_cfi.py:14
particleFlowDQM_cff.createGenJetPlots
def createGenJetPlots(ptbins, etabins)
Definition: particleFlowDQM_cff.py:42
particleFlowDQM_cff.make_response_plot_pset
def make_response_plot_pset(name, title, responseNbins, responseLow, responseHigh, ptBinLow, ptBinHigh, etaBinLow, etaBinHigh)
Definition: particleFlowDQM_cff.py:10
defaults_cfi.response_distribution_name
def response_distribution_name(iptbin, ietabin)
Definition: defaults_cfi.py:9
format