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 DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
0004 from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
0005 
0006 def plotPSet(name, title, dir, nx, x0, x1, ny=0, y0=0, y1=0, vx=[0], vy=[0]):
0007     return cms.PSet(
0008         name = cms.string(name),
0009         title = cms.string(title),
0010         dir = cms.string(dir),
0011         nx = cms.uint32(nx),
0012         x0 = cms.double(x0),
0013         x1 = cms.double(x1),
0014         ny = cms.uint32(ny),
0015         y0 = cms.double(y0),
0016         y1 = cms.double(y1),
0017         vx = cms.vdouble(vx),
0018         vy = cms.vdouble(vy)
0019     )
0020 
0021 def createOffsetVPSet():
0022     plots = []
0023     murange = range( default.muLowOffset, default.muHighOffset )
0024     npvrange = range( default.npvLowOffset, default.npvHighOffset )
0025 
0026     for pftype in default.candidateType :
0027         for mu in murange :
0028             name = default.offset_name( "mu", mu, pftype )
0029             plots += [ plotPSet(
0030                 name,
0031                 name+";#eta;<Offset Energy_{T}> [GeV]",
0032                 "{0}muPlots/mu{1}".format(default.offsetDir, mu),
0033                 #variable xbinning
0034                 0, 0, 0, default.eBinsOffset, default.eLowOffset, default.eHighOffset,
0035                 default.etaBinsOffset
0036             )]
0037 
0038         for npv in npvrange :
0039             name = default.offset_name( "npv", npv, pftype )
0040             plots += [ plotPSet(
0041                 name,
0042                 name+";#eta;<Offset Energy_{T}> [GeV]",
0043                 "{0}npvPlots/npv{1}".format(default.offsetDir, npv),
0044                 #variable xbinning
0045                 0, 0, 0, default.eBinsOffset, default.eLowOffset, default.eHighOffset,
0046                 default.etaBinsOffset
0047             )]
0048     return plots
0049 
0050 def createTH1DVPSet():
0051     plots = []
0052     #hname, title, xmax
0053     toplot = ( ("mu", "#mu", 0, default.muHighOffset), ("npv", "N_{PV}", 0, default.npvHighOffset),
0054             ("pv_z", "z_{PV}", -default.pvzHighOffset, default.pvzHighOffset))
0055 
0056     for hname, title, xmin, xmax in toplot :
0057         plots += [ plotPSet(
0058                 hname,
0059                 hname + ";" + title,
0060                 default.offsetDir,
0061                 xmax-xmin, xmin, xmax
0062             )]
0063     return plots
0064 
0065 offsetAnalyzerDQM = DQMEDAnalyzer("OffsetAnalyzerDQM",
0066                                       
0067     pvTag = cms.InputTag('offlineSlimmedPrimaryVertices'),
0068     muTag = cms.InputTag('slimmedAddPileupInfo'),
0069     pfTag = cms.InputTag('packedPFCandidates'),
0070 
0071     pdgKeys = cms.vuint32( default.candidateDict.keys() ),
0072     pdgStrs = cms.vstring( default.candidateDict.values() ),
0073 
0074     offsetPlotBaseName = cms.string(default.offsetPlotBaseName),
0075     offsetPlots = cms.VPSet( createOffsetVPSet() ),
0076     th1dPlots = cms.VPSet( createTH1DVPSet() ),
0077 
0078     pftypes = cms.vstring( default.candidateType ),
0079     etabins = cms.vdouble( default.etaBinsOffset ),
0080     muHigh = cms.untracked.int32( default.muHighOffset ),
0081     npvHigh = cms.untracked.int32( default.npvHighOffset )                                        
0082 
0083 )
0084 
0085 offsetDQMPostProcessor = DQMEDHarvester("OffsetDQMPostProcessor",
0086 
0087     offsetPlotBaseName = cms.string( default.offsetPlotBaseName ),
0088     offsetDir = cms.string( default.offsetDir ),
0089     offsetVariableTypes = cms.vstring( default.offsetVariableType ),
0090     offsetR = cms.untracked.double( default.offsetR ),
0091     pftypes = cms.vstring( default.candidateType ),                                        
0092     muHigh = cms.untracked.int32( default.muHighOffset ),
0093     npvHigh = cms.untracked.int32( default.npvHighOffset )                                        
0094                                         
0095 )
0096