예제 #1
0
def addFlashggPuppiJets(process,
                        vertexIndex = 0,
                        doQGTagging = True,
                        label       ='',
                        useLocalJEC = True,
                        dbfile      = 'flashgg/MetaData/data/PuppiJEC/PY8_RunIISpring15DR74_bx50_MC.db',
                        debug       = False):
    
  from CommonTools.PileupAlgos.flashggPuppi_cff          import flashggPuppi 
  from RecoJets.JetProducers.ak4PFJets_cfi               import ak4PFJets

  # fill the puppi parameters
  setattr(process, 'flashggPuppi' + label,
          flashggPuppi.clone( candName              = cms.InputTag('packedPFCandidates'),
                              vertexName            = cms.InputTag('offlineSlimmedPrimaryVertices'),
                              diPhotonTag           = cms.InputTag('flashggDiPhotons'),
                              VertexCandidateMapTag = cms.InputTag('flashggVertexMapForPUPPI'),
                              vertexIndex           = cms.uint32(vertexIndex),
                              debug                 = cms.untracked.bool(debug)
                            )
  )
  setattr ( process, 'ak4PFJetsPuppi' + label,
            ak4PFJets.clone ( src = cms.InputTag('flashggPuppi' + label), doAreaFastjet = True)
          )
  
  if useLocalJEC :
    print ':: using a local JEC dbfile for PUPPI :',
    print '\t -- ',  dbfile
    
    from flashgg.MicroAOD.flashggJetTools_cfi import loadLocalJECDBfile
    loadLocalJECDBfile(process,
                       dbfile = os.environ['CMSSW_BASE'] + '/src/' + dbfile,
                       tag    = 'JetCorrectorParametersCollection_PY8_RunIISpring15DR74_bx50_MC_AK4PUPPI',
                       label  = 'AK4PFPuppi')
    
  # do jet clustering
  addJetCollection(
    process,
    postfix            = label,
    labelName          = 'AK4PUPPI',
    jetSource          = cms.InputTag('ak4PFJetsPuppi' + label),
    pvSource           = cms.InputTag('offlineSlimmedPrimaryVertices'),
    pfCandidates       = cms.InputTag('packedPFCandidates'),
    svSource           = cms.InputTag('slimmedSecondaryVertices'),
    btagDiscriminators = [ flashggBTag ],
    jetCorrections     = ('AK4PFPuppi',['L1FastJet',  'L2Relative', 'L3Absolute'], 'None'),
    genJetCollection   = cms.InputTag('slimmedGenJets'),
    genParticles       = cms.InputTag('prunedGenParticles'),
    # jet param
    algo = 'AK', rParam = 0.4
  )

  getattr(process, 'patJetCorrFactorsAK4PUPPI' + label).primaryVertices = "offlineSlimmedPrimaryVertices"
  setattr( process,'flashggPUPPIJets'+ label,
           cms.EDProducer('FlashggJetProducer',
                          DiPhotonTag           = cms.InputTag('flashggDiPhotons'),
                          VertexTag             = cms.InputTag('offlineSlimmedPrimaryVertices'),
                          JetTag                = cms.InputTag('patJetsAK4PUPPI' + label),
                          VertexCandidateMapTag = cms.InputTag("flashggVertexMapForPUPPI"),
                          UsePuppi              = cms.untracked.bool(True),
                          ComputeSimpleRMS = cms.bool(True)
#                          PileupJetIdParameters = cms.PSet(pu_jetid)
                        ))

  # randomize Jets
  from flashgg.MicroAOD.flashggRandomizedJetProducer_cfi import flashggRandomizedJets
  flashggRandomizedPUPPIJets = flashggRandomizedJets.clone()
  flashggRandomizedPUPPIJets.src = "flashggPUPPIJets" + label
  setattr(process.RandomNumberGeneratorService, 'flashggRandomizedPUPPIJets' + label, cms.PSet(initialSeed = cms.untracked.uint32(36421523 + int(label))))
  setattr( process, 'flashggRandomizedPUPPIJets' + label, flashggRandomizedPUPPIJets )

  setattr( process, 'selectedFlashggPUPPIJets'+ label,
           cms.EDFilter("FLASHggJetSelector",
                        src = cms.InputTag( 'flashggRandomizedPUPPIJets'+ label ),
                        cut = cms.string("pt > 15.")
                      ))
예제 #2
0
def addFlashggPuppiJets(
        process,
        vertexIndex=0,
        doQGTagging=True,
        label='',
        useLocalJEC=True,
        dbfile='flashgg/MetaData/data/PuppiJEC/PY8_RunIISpring15DR74_bx50_MC.db',
        debug=False):

    from CommonTools.PileupAlgos.flashggPuppi_cff import flashggPuppi
    from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets

    # fill the puppi parameters
    setattr(
        process, 'flashggPuppi' + label,
        flashggPuppi.clone(
            candName=cms.InputTag('packedPFCandidates'),
            vertexName=cms.InputTag('offlineSlimmedPrimaryVertices'),
            diPhotonTag=cms.InputTag('flashggDiPhotons'),
            VertexCandidateMapTag=cms.InputTag('flashggVertexMapForPUPPI'),
            vertexIndex=cms.uint32(vertexIndex),
            debug=cms.untracked.bool(debug)))
    setattr(
        process, 'ak4PFJetsPuppi' + label,
        ak4PFJets.clone(src=cms.InputTag('flashggPuppi' + label),
                        doAreaFastjet=True))

    if useLocalJEC:
        print ':: using a local JEC dbfile for PUPPI :',
        print '\t -- ', dbfile

        from flashgg.MicroAOD.flashggJetTools_cfi import loadLocalJECDBfile
        loadLocalJECDBfile(
            process,
            dbfile=os.environ['CMSSW_BASE'] + '/src/' + dbfile,
            tag=
            'JetCorrectorParametersCollection_PY8_RunIISpring15DR74_bx50_MC_AK4PUPPI',
            label='AK4PFPuppi')

    # do jet clustering
    addJetCollection(
        process,
        postfix=label,
        labelName='AK4PUPPI',
        jetSource=cms.InputTag('ak4PFJetsPuppi' + label),
        pvSource=cms.InputTag('offlineSlimmedPrimaryVertices'),
        pfCandidates=cms.InputTag('packedPFCandidates'),
        svSource=cms.InputTag('slimmedSecondaryVertices'),
        btagDiscriminators=[flashggBTag],
        jetCorrections=('AK4PFPuppi',
                        ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
        genJetCollection=cms.InputTag('slimmedGenJets'),
        genParticles=cms.InputTag('prunedGenParticles'),
        # jet param
        algo='AK',
        rParam=0.4)

    getattr(process, 'patJetCorrFactorsAK4PUPPI' +
            label).primaryVertices = "offlineSlimmedPrimaryVertices"
    setattr(
        process,
        'flashggPUPPIJets' + label,
        cms.EDProducer(
            'FlashggJetProducer',
            DiPhotonTag=cms.InputTag('flashggDiPhotons'),
            VertexTag=cms.InputTag('offlineSlimmedPrimaryVertices'),
            JetTag=cms.InputTag('patJetsAK4PUPPI' + label),
            VertexCandidateMapTag=cms.InputTag("flashggVertexMapForPUPPI"),
            UsePuppi=cms.untracked.bool(True),
            ComputeSimpleRMS=cms.bool(True),
            ComputeRegVars=cms.bool(False)
            #                          PileupJetIdParameters = cms.PSet(pu_jetid)
        ))

    # randomize Jets
    from flashgg.MicroAOD.flashggRandomizedJetProducer_cfi import flashggRandomizedJets
    flashggRandomizedPUPPIJets = flashggRandomizedJets.clone()
    flashggRandomizedPUPPIJets.src = "flashggPUPPIJets" + label
    setattr(process.RandomNumberGeneratorService,
            'flashggRandomizedPUPPIJets' + label,
            cms.PSet(initialSeed=cms.untracked.uint32(36421523 + int(label))))
    setattr(process, 'flashggRandomizedPUPPIJets' + label,
            flashggRandomizedPUPPIJets)

    setattr(
        process, 'selectedFlashggPUPPIJets' + label,
        cms.EDFilter("FLASHggJetSelector",
                     src=cms.InputTag('flashggRandomizedPUPPIJets' + label),
                     cut=cms.string("pt > 15.")))