CMS 3D CMS Logo

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