CMS 3D CMS Logo

offsetAnalyzerDQM_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 DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
4 from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
5 
6 def plotPSet(name, title, dir, nx, x0, x1, ny=0, y0=0, y1=0, vx=[0], vy=[0]):
7  return cms.PSet(
8  name = cms.string(name),
9  title = cms.string(title),
10  dir = cms.string(dir),
11  nx = cms.uint32(nx),
12  x0 = cms.double(x0),
13  x1 = cms.double(x1),
14  ny = cms.uint32(ny),
15  y0 = cms.double(y0),
16  y1 = cms.double(y1),
17  vx = cms.vdouble(vx),
18  vy = cms.vdouble(vy)
19  )
20 
22  plots = []
23  murange = range( default.muLowOffset, default.muHighOffset )
24  npvrange = range( default.npvLowOffset, default.npvHighOffset )
25 
26  for pftype in default.candidateType :
27  for mu in murange :
28  name = default.offset_name( "mu", mu, pftype )
29  plots += [ plotPSet(
30  name,
31  name+";#eta;<Offset Energy_{T}> [GeV]",
32  "{0}muPlots/mu{1}".format(default.offsetDir, mu),
33  #variable xbinning
34  0, 0, 0, default.eBinsOffset, default.eLowOffset, default.eHighOffset,
35  default.etaBinsOffset
36  )]
37 
38  for npv in npvrange :
39  name = default.offset_name( "npv", npv, pftype )
40  plots += [ plotPSet(
41  name,
42  name+";#eta;<Offset Energy_{T}> [GeV]",
43  "{0}npvPlots/npv{1}".format(default.offsetDir, npv),
44  #variable xbinning
45  0, 0, 0, default.eBinsOffset, default.eLowOffset, default.eHighOffset,
46  default.etaBinsOffset
47  )]
48  return plots
49 
51  plots = []
52  #hname, title, xmax
53  toplot = ( ("mu", "#mu", 0, default.muHighOffset), ("npv", "N_{PV}", 0, default.npvHighOffset),
54  ("pv_z", "z_{PV}", -default.pvzHighOffset, default.pvzHighOffset))
55 
56  for hname, title, xmin, xmax in toplot :
57  plots += [ plotPSet(
58  hname,
59  hname + ";" + title,
60  default.offsetDir,
61  xmax-xmin, xmin, xmax
62  )]
63  return plots
64 
65 offsetAnalyzerDQM = DQMEDAnalyzer("OffsetAnalyzerDQM",
66 
67  pvTag = cms.InputTag('offlineSlimmedPrimaryVertices'),
68  muTag = cms.InputTag('slimmedAddPileupInfo'),
69  pfTag = cms.InputTag('packedPFCandidates'),
70 
71  pdgKeys = cms.vuint32( default.candidateDict.keys() ),
72  pdgStrs = cms.vstring( default.candidateDict.values() ),
73 
74  offsetPlotBaseName = cms.string(default.offsetPlotBaseName),
75  offsetPlots = cms.VPSet( createOffsetVPSet() ),
76  th1dPlots = cms.VPSet( createTH1DVPSet() ),
77 
78  pftypes = cms.vstring( default.candidateType ),
79  etabins = cms.vdouble( default.etaBinsOffset ),
80  muHigh = cms.untracked.int32( default.muHighOffset ),
81  npvHigh = cms.untracked.int32( default.npvHighOffset )
82 
83 )
84 
85 offsetDQMPostProcessor = DQMEDHarvester("OffsetDQMPostProcessor",
86 
87  offsetPlotBaseName = cms.string( default.offsetPlotBaseName ),
88  offsetDir = cms.string( default.offsetDir ),
89  offsetVariableTypes = cms.vstring( default.offsetVariableType ),
90  offsetR = cms.untracked.double( default.offsetR ),
91  pftypes = cms.vstring( default.candidateType ),
92  muHigh = cms.untracked.int32( default.muHighOffset ),
93  npvHigh = cms.untracked.int32( default.npvHighOffset )
94 
95 )
96 
def plotPSet(name, title, dir, nx, x0, x1, ny=0, y0=0, y1=0, vx=[0], vy=[0])