Beispiel #1
0
def custom_3dclustering_clusteringRadiusNoLayerDependenceVariableEta(process,
                                                                     distance_coefficientA=0.03,
                                                                     distance_coefficientB=0.02):
    parameters_c3d = process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters
    parameters_c3d.dR_multicluster_byLayer_coefficientA = cms.vdouble( [distance_coefficientA]*(MAX_LAYERS+1) )
    parameters_c3d.dR_multicluster_byLayer_coefficientB = cms.vdouble( [distance_coefficientB]*(MAX_LAYERS+1) )
    return process
Beispiel #2
0
def customiseFor2017DtUnpacking(process):
    """Adapt the HLT to run the legacy DT unpacking
    for pre2018 data/MC workflows as the default"""

    if hasattr(process,'hltMuonDTDigis'):
        process.hltMuonDTDigis = cms.EDProducer( "DTUnpackingModule",
            useStandardFEDid = cms.bool( True ),
            maxFEDid = cms.untracked.int32( 779 ),
            inputLabel = cms.InputTag( "rawDataCollector" ),
            minFEDid = cms.untracked.int32( 770 ),
            dataType = cms.string( "DDU" ),
            readOutParameters = cms.PSet(
                localDAQ = cms.untracked.bool( False ),
                debug = cms.untracked.bool( False ),
                rosParameters = cms.PSet(
                    localDAQ = cms.untracked.bool( False ),
                    debug = cms.untracked.bool( False ),
                    writeSC = cms.untracked.bool( True ),
                    readDDUIDfromDDU = cms.untracked.bool( True ),
                    readingDDU = cms.untracked.bool( True ),
                    performDataIntegrityMonitor = cms.untracked.bool( False )
                    ),
                performDataIntegrityMonitor = cms.untracked.bool( False )
                ),
            dqmOnly = cms.bool( False )
        )

    return process
def miniAOD_customizeMETFiltersFastSim(process):
    """Replace some MET filters that don't work in FastSim with trivial bools"""
    for X in 'CSCTightHaloFilter', 'HBHENoiseFilter', 'HBHENoiseFilterResultProducer':
        process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(True)))
    for X in 'manystripclus53X', 'toomanystripclus53X', 'logErrorTooManyClusters':
        process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(False)))
    return process
Beispiel #4
0
    def alcaHarvesting(self, globalTag, datasetName, **args):
        """
        _alcaHarvesting_

        Heavy-ion collisions data taking AlCa Harvesting

        """
        options = defaultOptions
        options.scenario = "HeavyIons"
        options.step = "ALCAHARVEST:BeamSpotByRun+BeamSpotByLumi"
        options.isMC = False
        options.isData = True
        options.beamspot = None
        options.eventcontent = None
        options.name = "ALCAHARVEST"
        options.conditions = globalTag
        options.arguments = ""
        options.evt_type = ""
        options.filein = []
 
        process = cms.Process("ALCAHARVEST")
        process.source = cms.Source("PoolSource")
        configBuilder = ConfigBuilder(options, process = process)
        configBuilder.prepare()

        #
        # customise process for particular job
        #
        process.source.processingMode = cms.untracked.string('RunsAndLumis')
        process.source.fileNames = cms.untracked(cms.vstring())
        process.maxEvents.input = -1
        process.dqmSaver.workflow = datasetName
        
        return process
def psetMinPtCut():
    return cms.PSet( 
        cutName = cms.string("MinPtCut"),
        minPt = cms.double(5.0),
        needsAdditionalProducts = cms.bool(False),
        isIgnored = cms.bool(False)                
        )
Beispiel #6
0
    def makeAnalysisStep(self, stepName, **inputs):
        step = super(GGHZZKFactors, self).makeAnalysisStep(stepName, **inputs)

        if stepName == 'initialStateEmbedding':
            sfFile = path.join(UWVV_BASE_PATH, 'data', 'kFactors',
                               'Kfactor_Collected_ggHZZ_2l2l_NNLO_NNPDF_NarrowWidth_13TeV.root')
            
            ggKEmbedding4e = cms.EDProducer(
                "GGHZZKFactorEmbedderEEEE",
                src = step.getObjTag('eeee'),
                fileName = cms.string(sfFile),
                )
            step.addModule('ggKEmbedding4e', ggKEmbedding4e, 'eeee')

            ggKEmbedding2e2m = cms.EDProducer(
                "GGHZZKFactorEmbedderEEMuMu",
                src = step.getObjTag('eemm'),
                fileName = cms.string(sfFile),
                )
            step.addModule('ggKEmbedding2e2m', ggKEmbedding2e2m, 'eemm')

            ggKEmbedding4m = cms.EDProducer(
                "GGHZZKFactorEmbedderMuMuMuMu",
                src = step.getObjTag('mmmm'),
                fileName = cms.string(sfFile),
                )
            step.addModule('ggKEmbedding4m', ggKEmbedding4m, 'mmmm')

        return step
Beispiel #7
0
def CreatePlotEntry(analyzer, discriminatorLabel=None, step=True):
    """CreatePlotEntry(analyzer, discriminatorLabel)\n
    Creates a PSet with the informations used by TauDQMHistEffProducer\n
    where to find the numerator and denominator\n
    where to put the new plot and how to name it\n
    which variables control"""

    producer = analyzer.TauProducer.pythonValue()[1:-1]
    ext = analyzer.ExtensionName.pythonValue()[1:-1]
    if discriminatorLabel == None:
        num = 'RecoTauV/%s%s_Matched/%sMatched_vs_#PAR#TauVisible'%(producer,ext,producer)
        #out = 'RecoTauV/%s%s_Matched/PFJetMatchingEff#PAR#'%(producer,ext)
        if producer.find('caloReco') != -1:
            out = 'RecoTauV/%s%s_Matched/CaloJetMatchingEff#PAR#'%(producer,ext)
        else:
            out = 'RecoTauV/%s%s_Matched/PFJetMatchingEff#PAR#'%(producer,ext)
    else:
        num = 'RecoTauV/%s%s_%s/%s_vs_#PAR#TauVisible'%(producer,ext,discriminatorLabel,discriminatorLabel)
        if discriminatorLabel.find('DiscriminationBy') != -1:
            hname = discriminatorLabel[(discriminatorLabel.find('DiscriminationBy')+len('DiscriminationBy')):]
        else:
            hname = discriminatorLabel[(discriminatorLabel.find('Discrimination')+len('Discrimination')):]
        out = 'RecoTauV/%s%s_%s/%sEff#PAR#'%(producer,ext,discriminatorLabel,hname)

    den = 'RecoTauV/%s%s_ReferenceCollection/nRef_Taus_vs_#PAR#TauVisible'%(producer,ext)
    ret = cms.PSet(
        numerator = cms.string(num),
        denominator = cms.string(den),
        efficiency = cms.string(out),
        parameter = cms.vstring('pt', 'eta', 'phi', 'pileup'),
        stepByStep = cms.bool(step)
        )
    return ret
Beispiel #8
0
def setCondition(process,
                 connect = "frontier://FrontierProd/CMS_CONDITIONS",
                 record = None,
                 tag = None,
                 label = None):
    """
    Overrides a condition in startgeometry from globaltag.
    """

    if record is None or tag is None:
        raise ValueError("A 'record' and a 'tag' have to be provided to 'setCondition'.")

    if not hasattr(process, "GlobalTag"):
        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")

    args = {"connect": cms.string(connect),
            "record": cms.string(record),
            "tag": cms.string(tag)}
    if label is not None:
        args["label"] = cms.untracked.string(label)

    process.GlobalTag.toGet \
        = cms.VPSet(filter(lambda x: x.record.value() != record,
                           process.GlobalTag.toGet.value()))
    process.GlobalTag.toGet.append(cms.PSet(**args))
def loadLocalJECDBfile(process,
                       dbfile = '',
                       tag   = 'JetCorrectorParametersCollection_PY8_RunIISpring15DR74_bx50_MC_AK4PUPPI',
                       label = 'AK4PFPuppi'):
    #===================================================
    # local BD reader
    # load and replace the data base by the local one
    #===================================================
    #print ':: dbfile == ', dbfile
    
    process.load("CondCore.DBCommon.CondDBCommon_cfi")
    process.load("CondCore.DBCommon.CondDBSetup_cfi")
    setattr(process, 'jec' + label,
            cms.ESSource("PoolDBESSource",
                         DBParameters = cms.PSet(
                             messageLevel = cms.untracked.int32(0)
                         ),
                         timetype = cms.string('runnumber'),
                         toGet = cms.VPSet(cms.PSet(
                             record = cms.string('JetCorrectionsRecord'),
                             tag    = cms.string(tag),
                             label  = cms.untracked.string(label)
                         )),
                         connect = cms.string('sqlite_file:%s' % dbfile)
                     ))
    
    setattr(process,  'es_prefer_jec' + label,
            cms.ESPrefer('PoolDBESSource','jec'+ label))
Beispiel #10
0
        def testNoSchedule(self):
            import FWCore.ParameterSet.Config as cms
            process = cms.Process("TEST")

            process.a = cms.EDProducer("AProd")
            process.b = cms.EDProducer("BProd")
            process.c = cms.EDProducer("CProd")
            process.d = cms.EDProducer("DProd")
            process.m = cms.EDProducer("MProd")
            process.n = cms.EDProducer("NProd")
            process.r = cms.EDProducer("RProd")
            process.s = cms.EDProducer("SProd")

            process.t1 = cms.Task(process.m)
            t2 = cms.Task(process.n)

            process.f1 = cms.EDFilter("Filter")
            process.f2 = cms.EDFilter("Filter2")
            process.f3 = cms.EDFilter("Filter3")
            process.f4 = cms.EDFilter("FIlter4")

            process.out1 = cms.OutputModule("Output1")
            process.out2 = cms.OutputModule("Output2")

            process.analyzer1 = cms.EDAnalyzer("analyzerType1")
            process.analyzer2 = cms.EDAnalyzer("analyzerType2")

            process.p1 = cms.Path(process.a+process.b+process.f1+process.analyzer1+cms.ignore(process.d)+cms.ignore(process.f2))
            process.p4 = cms.Path(process.a+process.f2+process.b+~process.f1+cms.ignore(process.f4))
            process.p2 = cms.Path(process.a+process.b)
            process.p3 = cms.Path(process.f1, process.t1, t2)

            process.t3 = cms.Task(process.r)
            process.t4 = cms.Task(process.s)
            process.s1 = cms.Sequence(~process.a, process.t3)
            process.p5 = cms.Path(process.b + process.s1, process.t4)
            process.end1 = cms.EndPath(process.out1+process.out2+process.analyzer1+process.analyzer2+process.a+process.b+cms.ignore(process.f1))
            process.end2 = cms.EndPath()
            convertToUnscheduled(process)
            self.assert_(hasattr(process,'p2'))
            self.assert_(hasattr(process,'a'))
            self.assert_(hasattr(process,'b'))
            self.assert_(hasattr(process,'c'))
            self.assert_(hasattr(process,'d'))
            self.assert_(hasattr(process,'f1'))
            self.assert_(hasattr(process,'f2'))
            self.assert_(hasattr(process,'f3'))
            self.assert_(hasattr(process,'f4'))
            self.assert_(hasattr(process,'out1'))
            self.assert_(hasattr(process,'out2'))
            self.assert_(hasattr(process,'analyzer1'))
            self.assert_(hasattr(process,'analyzer2'))

            self.assertEqual(process.p1.dumpPython(None),'cms.Path(process.f1+process.analyzer1, cms.Task(process.a, process.b, process.d, process.f2))\n')
            self.assertEqual(process.p2.dumpPython(None),'cms.Path(cms.Task(process.a, process.b))\n')
            self.assertEqual(process.p3.dumpPython(None),'cms.Path(process.f1, cms.Task(process.m, process.n))\n')
            self.assertEqual(process.p4.dumpPython(None),'cms.Path(process.f2+~process.f1, cms.Task(process.a, process.b, process.f4))\n')
            self.assertEqual(process.p5.dumpPython(None),'cms.Path(cms.Task(process.a, process.b), cms.Task(process.r, process.s))\n')
            self.assertEqual(process.end1.dumpPython(None),'cms.EndPath(process.out1+process.out2+process.analyzer1+process.analyzer2, cms.Task(process.a, process.b, process.f1))\n')
            self.assertEqual(process.end2.dumpPython(None),'cms.EndPath()\n')
Beispiel #11
0
def customise_csc_cond_ungangedME11A_mc(process):
    """ Pick up upgrade condions data directly from DB tags using ESPrefer's.
    Might be useful when dealing with a global tag that doesn't include 
    'unganged' CSC conditions.
    """
    myconds = [
        ('CSCDBGainsRcd',       'CSCDBGains_ungangedME11A_mc'),
        ('CSCDBNoiseMatrixRcd', 'CSCDBNoiseMatrix_ungangedME11A_mc'),
        ('CSCDBCrosstalkRcd',   'CSCDBCrosstalk_ungangedME11A_mc'),
        ('CSCDBPedestalsRcd',   'CSCDBPedestals_ungangedME11A_mc'),
        ('CSCDBGasGainCorrectionRcd',   'CSCDBGasGainCorrection_ungangedME11A_mc'),
        ('CSCDBChipSpeedCorrectionRcd', 'CSCDBChipSpeedCorrection_ungangedME11A_mc')
    ]

    from CalibMuon.Configuration.getCSCConditions_frontier_cff import cscConditions
    for (classname, tag) in myconds:
      print classname, tag
      sourcename = 'unganged_' + classname
      process.__setattr__(sourcename, cscConditions.clone())
      process.__getattribute__(sourcename).toGet = cms.VPSet( cms.PSet( record = cms.string(classname), tag = cms.string(tag)) )
      process.__getattribute__(sourcename).connect = cms.string('frontier://FrontierProd/CMS_COND_CSC_000')
      process.__setattr__('esp_' + classname, cms.ESPrefer("PoolDBESSource", sourcename) )
    
    del cscConditions

    return process
def customise_Validation(process,pileup):
    process.validation_step.remove(process.PixelTrackingRecHitsValid)
    process.validation_step.remove(process.stripRecHitsValid)
    process.validation_step.remove(process.trackerHitsValid)
    process.validation_step.remove(process.StripTrackingRecHitsValid)
    # We don't run the HLT
    process.validation_step.remove(process.HLTSusyExoVal)
    process.validation_step.remove(process.hltHiggsValidator)
    process.validation_step.remove(process.relvalMuonBits)
    if pileup>30:
        process.trackValidator.label=cms.VInputTag(cms.InputTag("cutsRecoTracksHp"))
        process.tracksValidationSelectors = cms.Sequence(process.cutsRecoTracksHp)
        process.globalValidation.remove(process.recoMuonValidation)
        process.validation.remove(process.recoMuonValidation)
        process.validation_preprod.remove(process.recoMuonValidation)
        process.validation_step.remove(process.recoMuonValidation)
        process.validation.remove(process.globalrechitsanalyze)
        process.validation_prod.remove(process.globalrechitsanalyze)
        process.validation_step.remove(process.globalrechitsanalyze)
        process.validation.remove(process.stripRecHitsValid)
        process.validation_step.remove(process.stripRecHitsValid)
        process.validation_step.remove(process.StripTrackingRecHitsValid)
        process.globalValidation.remove(process.vertexValidation)
        process.validation.remove(process.vertexValidation)
        process.validation_step.remove(process.vertexValidation)
        process.mix.input.nbPileupEvents.averageNumber = cms.double(0.0)
        process.mix.minBunch = cms.int32(0)
        process.mix.maxBunch = cms.int32(0)

    if hasattr(process,'simHitTPAssocProducer'):    
        process.simHitTPAssocProducer.simHitSrc=cms.VInputTag(cms.InputTag("g4SimHits","TrackerHitsPixelBarrelLowTof"),
                                                              cms.InputTag("g4SimHits","TrackerHitsPixelEndcapLowTof"))

    return process
def customise(process):
        process.load('GeneratorInterface.RivetInterface.rivetAnalyzer_cfi')
        process.rivetAnalyzer.AnalysisNames = cms.vstring('CMS_EWK_10_012')
        process.rivetAnalyzer.OutputFile= cms.string('WToENuPythia.aida')
        process.generation_step+=process.rivetAnalyzer
        process.schedule.remove(process.RAWSIMoutput_step)
        return(process)
Beispiel #14
0
def custom_3dclustering_distance(process,
        distance=0.01
        ):
    parameters_c3d = process.hgcalTriggerPrimitiveDigiProducer.BEConfiguration.algorithms[0].C3d_parameters
    parameters_c3d.dR_multicluster = cms.double(distance)
    parameters_c3d.type_multicluster = cms.string('dRC3d')
    return process
def miniAOD_customizeMETFiltersFastSim(process):
    """Replace some MET filters that don't work in FastSim with trivial bools"""
    for X in 'CSCTightHaloFilter', 'CSCTightHaloTrkMuUnvetoFilter','CSCTightHalo2015Filter','HcalStripHaloFilter','HBHENoiseFilter', 'HBHENoiseIsoFilter', 'HBHENoiseFilterResultProducer', 'chargedHadronTrackResolutionFilter', 'muonBadTrackFilter':
        process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(True)))
    for X in 'manystripclus53X', 'toomanystripclus53X', 'logErrorTooManyClusters':
        process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(False)))
    return process
Beispiel #16
0
def calculateMetPhiCorrectedMET(process, prefix, conf, src):
    process.load("JetMETCorrections.Type1MET.pfMETsysShiftCorrections_cfi")

    if conf.isMC:
        process.pfMEtSysShiftCorr.parameter = process.pfMEtSysShiftCorrParameters_2012runABCDvsNvtx_mc
    else:
        process.pfMEtSysShiftCorr.parameter = process.pfMEtSysShiftCorrParameters_2012runABCDvsNvtx_data

    selectedVerticesForMETCorr = process.selectedVerticesForMEtCorr.clone(
        src=cms.InputTag("goodOfflinePrimaryVertices")
    )
    systShiftMETCorr = process.pfMEtSysShiftCorr.clone(
        src=cms.InputTag(src), srcVertices=cms.InputTag(prep(prefix, "selectedVerticesForMETCorr"))
    )

    prod = cms.EDProducer(
        "CorrectedPATMETProducer",
        src=cms.InputTag(src),
        applyType1Corrections=cms.bool(True),
        srcType1Corrections=cms.VInputTag(cms.InputTag(prep(prefix, "systShiftMETCorr"))),
        type0Rsoft=cms.double(0.6),
        applyType2Corrections=cms.bool(False),
        srcCHSSums=cms.VInputTag(cms.InputTag("pfchsMETcorr", "type0")),
        applyType0Corrections=cms.bool(False),
    )
    seq = cms.Sequence(selectedVerticesForMETCorr * systShiftMETCorr * prod)
    sa(process, prefix, "systShiftMETCorr", systShiftMETCorr)
    sa(process, prefix, "selectedVerticesForMETCorr", selectedVerticesForMETCorr)
    sa(process, prefix, "phiCorrMETs", prod)
    sa(process, prefix, "metPhiCorrSequence", seq)
    return seq
def addEventHypothesis(process,label,thisMuTag,thisEleTag,thisSoftMuTag='wwMuons4Veto',preSequence=cms.Sequence()):
    hypos = ['ellell']
    #hypos = ['mumu','muel','elmu','elel']
    process.peakingFilter = cms.EDFilter("GenFilterDiBosons")

    tempSkimEventFilter = cms.EDFilter("SkimEventSelector",
       src = cms.InputTag(""),
       filter = cms.bool(True),
       cut = cms.string("nLep >=2 "),                                   
    )

    for hypo in hypos:
        #create the four hypothesis:
        setattr(process,'ww'+hypo+label,process.skimEventProducer.clone(hypoType='WW'+hypo.upper(),muTag=thisMuTag,elTag=thisEleTag,softMuTag=thisSoftMuTag))
        #create SkimEventSelectors (asking for nLep >=2) 
        setattr(process,'skim'+hypo+label,tempSkimEventFilter.clone(src='ww'+hypo+label))
        # create sequence
#         p = cms.Path(preSequence)
#         if peakingType == 'peaking':     p = cms.Path( process.peakingFilter)
#         if peakingType == 'non-peaking': p = cms.Path(~process.peakingFilter)
        p = cms.Path( 
            getattr(process,thisMuTag)  +
            getattr(process,thisEleTag)  +
            getattr(process,thisSoftMuTag)  +
            getattr(process,'ww'+hypo+label)  +
            getattr(process,'skim'+hypo+label)
        )
        setattr(process,'sel'+hypo+label,p)
        # add to scheduler
        if getattr(process,'schedule') != None: process.schedule.append( getattr(process,'sel'+hypo+label) )
        # add to pooloutput module
        if hasattr(process,'out'): process.out.outputCommands.append( 'keep *_{0}_*_*'.format( 'ww'+hypo+label ) )
        if hasattr(process,'out'): process.out.SelectEvents.SelectEvents.append( 'sel'+hypo+label )
Beispiel #18
0
def miniAOD_customizeMETFiltersFastSim(process):
    """Replace some MET filters that don't work in FastSim with trivial bools"""
    for X in 'CSCTightHaloFilter', 'CSCTightHaloTrkMuUnvetoFilter','CSCTightHalo2015Filter','globalTightHalo2016Filter','globalSuperTightHalo2016Filter','HcalStripHaloFilter':
        process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(True)))    
    for X in 'manystripclus53X', 'toomanystripclus53X', 'logErrorTooManyClusters':
        process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(False)))
    return process
Beispiel #19
0
def SpawnPSet(lArgument, subPset):
    """SpawnPSet(lArgument, subPset) --> cms.PSet\n
    lArgument is a list containing a list of three strings/values:\n
           1-name to give to the spawned pset\n
           2-variable(s) to be changed\n
           3-value(s) of the variable(s): SAME LENGTH OF 2-!\n
           Supported types: int string float(converted to double)"""
    ret = cms.PSet()
    for spawn in lArgument:
        if len(spawn) != 3:
            print "ERROR! SpawnPSet uses argument of three data\n"
            print self.__doc__
            return None
        if len(spawn[1]) != len(spawn[2]):
            print "ERROR! Lists of arguments to replace must have the same length"
            print self.__doc__
            return None
        spawnArg = copy.deepcopy(subPset)
        for par, val in zip(spawn[1],spawn[2]):
            if isinstance(val, str) :
                setattr(spawnArg,par,cms.string(val))
            elif isinstance(val, int) :
                setattr(spawnArg,par,cms.int32(val))
            elif isinstance(val, float) :
                setattr(spawnArg,par,cms.double(val))
        setattr(ret,spawn[0],spawnArg)
    return ret
Beispiel #20
0
def addPhotonReReco(process, isAOD=False):
    """Include the photon re-reco sequence in the patDefaultSequence
    See https://hypernews.cern.ch/HyperNews/CMS/get/egamma/960.html
    and
    https://hypernews.cern.ch/HyperNews/CMS/get/egamma/958/1/1/1/1/1/1/1/1/1/1/1.html
    """
    if isAOD:
        process.photons.barrelEcalHits = cms.InputTag("reducedEcalRecHitsEB")
        process.photons.endcapEcalHits = cms.InputTag("reducedEcalRecHitsEE")

        from RecoEgamma.PhotonIdentification.isolationCalculator_cfi \
            import isolationSumsCalculator as isc

        isc.barrelEcalRecHitProducer = cms.string('reducedEcalRecHitsEB')
        isc.endcapEcalRecHitProducer = cms.string('reducedEcalRecHitsEE')
        isc.barrelEcalRecHitCollection = cms.InputTag('reducedEcalRecHitsEB')
        isc.endcapEcalRecHitCollection = cms.InputTag('reducedEcalRecHitsEE')

        process.photons.isolationSumsCalculatorSet = isc

        process.photonReReco = cms.Sequence( process.photonSequence *
                                             process.photonIDSequence )

    else:
        process.photonReReco = cms.Sequence( process.ckfTracksFromConversions *
                                             process.conversionSequence *
                                             process.photonSequence *
                                             process.photonIDSequence )

    # Edit the pat sequence to do the rereco
    process.patDefaultSequence = cms.Sequence(process.photonReReco*
                                              process.patDefaultSequence)
def get(todo):
    defs = {}

    # HFRecHits
    defs["HFRecHitView"]  = cms.PSet(
        miniView = cms.string("HFRecHitView"),
        branchPrefix = cms.untracked.string("HFRecHit"),
    )

    # HBHERecHits 
    defs["HBHERecHitView"]  = cms.PSet(
        miniView = cms.string("HBHERecHitView"),
        branchPrefix = cms.untracked.string("HBHERecHit"),
    )

   # EcalRecHits
    defs["EcalRecHitView"]  = cms.PSet(
        miniView = cms.string("EcalRecHitView"),
        branchPrefix = cms.untracked.string("EcalRecHit"),
    )
 
    # main function
    ret = {}
    for t in todo:
        if t not in defs:
            raise Exception("miniView def not known "+t)

        ret[t] = defs[t]
    return ret
def addEventHypothesis(process,label,thisMuTag,thisEleTag,thisSoftMuTag='wwMuons4Veto',preSequence=cms.Sequence()):

    process.peakingFilter = cms.EDFilter("GenFilterDiBosons")

    tempSkimEventFilter = cms.EDFilter("SkimEventSelector",
       src = cms.InputTag(""),
       filter = cms.bool(True),
       cut = cms.string("1"),
       #cut = cms.string("nLep >=2 "),
    )

    #create the only hypothesis (>= 1 lepton):
    setattr(process,'ww'+label,process.skimEventProducer.clone(muTag=thisMuTag,elTag=thisEleTag,softMuTag=thisSoftMuTag))
    #create SkimEventSelectors (asking for nLep >=2)
    setattr(process,'skim'+label,tempSkimEventFilter.clone(src='ww'+label))
    # create sequence
    p = cms.Path(
        getattr(process,'ww'+label) +
        getattr(process,'skim'+label)
    )
    setattr(process,'sel'+label,p)
    # add to scheduler
    if getattr(process,'schedule') != None: process.schedule.append( getattr(process,'sel'+label) )
    # add to pooloutput module
    if hasattr(process,'out'): process.out.outputCommands.append( 'keep *_{0}_*_*'.format( 'ww'+label ) )
    if hasattr(process,'out'): process.out.SelectEvents.SelectEvents.append( 'sel'+label )
Beispiel #23
0
    def addPoolDBESSource( process,
                           moduleName,
                           record,
                           tag,
                           connect='sqlite_file:',
                           label='',):

        from CondCore.CondDB.CondDB_cfi import CondDB

        calibDB = cms.ESSource("PoolDBESSource",
                               CondDB,
                               timetype = cms.string('runnumber'),
                               toGet = cms.VPSet(cms.PSet(
                                   record = cms.string(record),
                                   tag = cms.string(tag),
                                   label = cms.untracked.string(label)
                                    )),
                               )
        calibDB.connect = cms.string( str(connect) )
        #if authPath: calibDB.DBParameters.authenticationPath = authPath
        if 'oracle:' in connect:
            calibDB.DBParameters.authenticationPath = '/afs/cern.ch/cms/DB/conddb'
        setattr(process,moduleName,calibDB)
        setattr(process,"es_prefer_" + moduleName,cms.ESPrefer('PoolDBESSource',
                                                                moduleName)
                                                                )
Beispiel #24
0
def custom_cluster_calibration_global(process,
        factor=1.084
        ):
    parameters_c2d = process.hgcalBackEndLayer1Producer.ProcessorParameters.C2d_parameters
    parameters_c2d.calibSF_cluster = cms.double(factor) 
    parameters_c2d.applyLayerCalibration = cms.bool(False)
    return process
    def addHLT(self,path,triggerProcess,summaryText = ''):
               hltSkimmer = cms.EDFilter("HLTHighLevel",
                          TriggerResultsTag = cms.InputTag("TriggerResults","",triggerProcess),
                          HLTPaths = cms.vstring(path),           # provide list of HLT paths (or patterns) you want
                          eventSetupPathsKey = cms.string(''), # not empty => use read paths from AlCaRecoTriggerBitsRcd via this key
                          andOr = cms.bool(True),             # how to deal with multiple triggers: True (OR) accept if ANY is true, False (AND) accept if ALL are true
                          throw = cms.bool(True)    # throw exception on unknown path names
               )

               pyModule = sys.modules[self.pyModuleName[0]]
               if pyModule is None:
                 raise ValueError("'pyModuleName' Parameter invalid")
               setattr(pyModule,'hltSkimmer',hltSkimmer)
               self.sequence*=hltSkimmer

          #now the counter
               if summaryText is not '':
                   counter  = cms.EDProducer("EventCounter")
                   counter.name=cms.string(summaryText)
                   counter.setLabel('hltSkimmerCounter')
                   pyModule = sys.modules[self.pyModuleName[0]]
                   if pyModule is None:
                       raise ValueError("'pyModuleName' Parameter invalid")
                   setattr(pyModule,'hltSkimmerCounter',counter)
                   self.sequence*=counter
def electronTriggerMatchPT(process,triggerProcess):

   process.triggeredPatElectronsL = cms.EDProducer("ElectronTriggerMatcher",
                                            src = cms.InputTag("cleanPatElectrons"),
                                            trigEvent = cms.InputTag("hltTriggerSummaryAOD"),
                                            filters = cms.VInputTag(
                                                cms.InputTag('hltEle17CaloIdLCaloIsoVLPixelMatchFilterDoubleEG125','',triggerProcess),
                                            ),
                                            pdgId = cms.int32(0)
   )
   process.triggeredPatElectrons = cms.EDProducer("ElectronTriggerMatcher",
                                            src = cms.InputTag("triggeredPatElectronsL"),
                                            trigEvent = cms.InputTag("hltTriggerSummaryAOD"),
                                            filters = cms.VInputTag(
                                                cms.InputTag('hltOverlapFilterIsoEle15IsoPFTau20','',triggerProcess),
                                                cms.InputTag('hltOverlapFilterIsoEle15TightIsoPFTau20','',triggerProcess),
                                                cms.InputTag('hltOverlapFilterIsoEle18MediumIsoPFTau20','',triggerProcess),                                                
                                                cms.InputTag('hltOverlapFilterIsoEle18TightIsoPFTau20','',triggerProcess),
                                                cms.InputTag('hltOverlapFilterIsoEle18IsoPFTau20','',triggerProcess),
                                                cms.InputTag('hltOverlapFilterIsoEle20MediumIsoPFTau20','',triggerProcess),
                                                cms.InputTag('hltOverlapFilterIsoEle20LooseIsoPFTau20','',triggerProcess),
                                                cms.InputTag('hltOverlapFilterIsoEle20WP90LooseIsoPFTau20','',triggerProcess),
                                                cms.InputTag('hltEle20CaloIdVTCaloIsoTTrkIdTTrkIsoTTrackIsoFilterL1IsoEG18OrEG20','',triggerProcess),
                                                cms.InputTag('hltEle22WP90RhoTrackIsoFilter','',triggerProcess),
                                                cms.InputTag('hltEle27WP80TrackIsoFilter','',triggerProcess),
                                                cms.InputTag('hltEle17TightIdLooseIsoEle8TightIdLooseIsoTrackIsoFilter','',triggerProcess),
                                                cms.InputTag('hltEle17TightIdLooseIsoEle8TightIdLooseIsoTrackIsoDoubleFilter','',triggerProcess),
                                                cms.InputTag('hltEle17CaloIdVTCaloIsoVTTrkIdTTrkIsoVTEle8TrackIsoFilter','',triggerProcess),
                                                cms.InputTag('hltEle20CaloIdVTCaloIsoVTTrkIdTTrkIsoVTSC4TrackIsoFilter','',triggerProcess)
                                            ),
                                            pdgId = cms.int32(11)
   )
   
   process.analysisSequence=cms.Sequence(process.analysisSequence*process.triggeredPatElectronsL*process.triggeredPatElectrons)
def customise_pu_protons_ctpps(process):
	
	process=customise(process)
        
	process.mix.mixObjects.mixHepMC.makeCrossingFrame = cms.untracked.bool(True)

	process.ppssim.UseHepMCProducer = cms.untracked.bool(False)
	# PU gen particle   		
	process.genParticlesPU = cms.EDProducer("GenParticleProducer",
	saveBarCodes = cms.untracked.bool(True),
	mix = cms.string("mix"),
	abortOnUnknownPDGCode = cms.untracked.bool(False),
	useCrossingFrame = cms.untracked.bool(True)
	)
	process.genProtonsPU = cms.EDFilter("GenParticleSelector",
		filter = cms.bool(False),
		src = cms.InputTag("genParticlesPU"),
		cut = cms.string('')
	)

	process.genProtonsPU.cut = 'status = 1 & pdgId == 2212 & abs(pz) >= %f' % ( 0.5*13000./2.0)
	outputCommandsPU = [ 'keep *_genParticlesPU_*_*', 'keep *_genProtonsPU_*_*']
	
	process.ppssim.genSource = cms.InputTag("genProtonsPU") # for Pile-up events

	#process.digitisation_step.replace(process.pdigi_valid, process.pdigi_valid * process.genParticlesPU * process.genProtonsPU)
	process.digitisation_step.replace(process.ppssim, process.genParticlesPU * process.genProtonsPU * process.ppssim)

	return (process)
Beispiel #28
0
def addSusyParticleVariables(pt):
    if hasattr(pt,"variables"):

        pt.variables.std_vector_susy_pt           = cms.string("susyParticlePt/4")
        pt.variables.std_vector_susy_eta          = cms.string("susyParticleEta/4")
        pt.variables.std_vector_susy_phi          = cms.string("susyParticlePhi/4")
        pt.variables.std_vector_susy_id           = cms.string("susyParticleID/4")
Beispiel #29
0
def customise_L1simulation(process):
  if (not hasattr(process, 'caloConfigSource')) :
    process.load('L1Trigger.L1TCalorimeter.caloConfigStage1PP_cfi')
  from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi import cscTriggerPrimitiveDigis
  process.simCscTriggerPrimitiveDigis = cscTriggerPrimitiveDigis
  process.simCscTriggerPrimitiveDigis.commonParam.isSLHC = True
  process.simCscTriggerPrimitiveDigis.commonParam.smartME1aME1b = True

  from Validation.MuonGEMDigis.MuonGEMDigis_cff import me11tmbSLHCGEM
  process.simCscTriggerPrimitiveDigis.commonParam.runME11ILT = cms.bool(True)
  process.simCscTriggerPrimitiveDigis.me11tmbSLHCGEM = me11tmbSLHCGEM
  process.simCscTriggerPrimitiveDigis.clctSLHC.clctNplanesHitPattern = 3
  process.simCscTriggerPrimitiveDigis.clctSLHC.clctPidThreshPretrig = 2
  process.simCscTriggerPrimitiveDigis.clctParam07.clctPidThreshPretrig = 2
  process.simCscTriggerPrimitiveDigis.GEMPadDigiProducer = "simMuonGEMPadDigis"

  from Validation.MuonGEMDigis.MuonGEMDigis_cff import me21tmbSLHCGEM
  process.simCscTriggerPrimitiveDigis.commonParam.runME21ILT = cms.bool(True)
  process.simCscTriggerPrimitiveDigis.me21tmbSLHCGEM = me21tmbSLHCGEM
  ## ME21 has its own SLHC processors
  process.simCscTriggerPrimitiveDigis.alctSLHCME21 = process.simCscTriggerPrimitiveDigis.alctSLHC.clone()
  process.simCscTriggerPrimitiveDigis.clctSLHCME21 = process.simCscTriggerPrimitiveDigis.clctSLHC.clone()
  process.simCscTriggerPrimitiveDigis.alctSLHCME21.alctNplanesHitPattern = 3
  #process.simCscTriggerPrimitiveDigis.alctSLHCME21.runME21ILT = cms.bool(True)
  process.simCscTriggerPrimitiveDigis.clctSLHCME21.clctNplanesHitPattern = 3
  process.simCscTriggerPrimitiveDigis.clctSLHCME21.clctPidThreshPretrig = 2
  return process
def addTauEmbeddingMuonTausUsingVisible(process, prefix = "tauEmbeddingGenTauVisibleMatch"):
    seq = cms.Sequence()

    m = cms.EDFilter("GenParticleSelector",
        src = cms.InputTag("genParticles", "", "EMBEDDING"),
        cut = cms.string(generatorTauSelection % generatorTauPt)
    )
    genTausName = prefix+"GenTaus"
    setattr(process, genTausName, m)
    seq *= m

    m = cms.EDProducer("HPlusGenVisibleTauComputer",
        src = cms.InputTag(genTausName)
    )
    visibleName = prefix+"GenTausVisible"
    setattr(process, visibleName, m)
    seq *= m

    m = cms.EDProducer("HPlusPATTauLorentzVectorViewClosestDeltaRSelector",
#        src = cms.InputTag("selectedPatTaus"+PF2PATVersion), # not trigger matched
#        src = cms.InputTag("selectedPatTausHpsPFTau", "", "EMBEDDING"), # 2011
        src = cms.InputTag("selectedPatTaus", "", "EMBEDDING"),
        refSrc = cms.InputTag(visibleName),
        maxDeltaR = cms.double(0.5),
    )
    setattr(process, prefix+"TauMatched", m)
    seq *= m

    return seq