Beispiel #1
0
def makeSequence(dataType, jetContainer="AntiKt4EMPFlowJets"):

    algSeq = AlgSequence()

    # Set up the systematics loader/handler algorithm:
    sysLoader = createAlgorithm('CP::SysListLoaderAlg', 'SysLoaderAlg')
    sysLoader.sigmaRecommended = 1
    algSeq += sysLoader

    # Include, and then set up the jet analysis algorithm sequence:
    from JetAnalysisAlgorithms.JetAnalysisSequence import makeJetAnalysisSequence
    jetSequence = makeJetAnalysisSequence(dataType,
                                          jetContainer,
                                          enableCutflow=True,
                                          enableKinematicHistograms=True)
    from FTagAnalysisAlgorithms.FTagAnalysisSequence import makeFTagAnalysisSequence
    makeFTagAnalysisSequence(jetSequence,
                             dataType,
                             jetContainer,
                             noEfficiency=True,
                             legacyRecommendations=True,
                             enableCutflow=True)
    jetSequence.configure(inputName=jetContainer,
                          outputName='AnalysisJets_%SYS%')

    # Add the sequence to the job:
    algSeq += jetSequence

    return algSeq
Beispiel #2
0
def makeSequence(dataType):

    algSeq = AlgSequence()

    # Set up the systematics loader/handler algorithm:
    sysLoader = createAlgorithm('CP::SysListLoaderAlg', 'SysLoaderAlg')
    sysLoader.sigmaRecommended = 1
    algSeq += sysLoader

    # Include, and then set up the tau analysis algorithm sequence:
    from TauAnalysisAlgorithms.TauAnalysisSequence import makeTauAnalysisSequence
    tauSequence = makeTauAnalysisSequence(dataType,
                                          'Tight',
                                          postfix='tight',
                                          enableCutflow=True,
                                          enableKinematicHistograms=True)
    tauSequence.configure(inputName='TauJets',
                          outputName='AnalysisTauJets_%SYS%')

    # Add the sequence to the job:
    algSeq += tauSequence

    # Include, and then set up the tau analysis algorithm sequence:
    from TauAnalysisAlgorithms.DiTauAnalysisSequence import makeDiTauAnalysisSequence
    diTauSequence = makeDiTauAnalysisSequence(dataType,
                                              'Tight',
                                              postfix='tight')
    diTauSequence.configure(inputName='DiTauJets',
                            outputName='AnalysisDiTauJets_%SYS%')

    # Add the sequence to the job:
    # disabling this, the standard test files don't have DiTauJets
    # algSeq += diTauSequence

    return algSeq
Beispiel #3
0
def makeSequence(dataType):
    algSeq = AlgSequence()

    # Create the algorithm's configuration. Note that we'll be able to add
    # algorithm property settings here later on.
    alg = createAlgorithm('CP::SysListLoaderAlg', 'SysLoaderAlg')
    alg.sigmaRecommended = 1
    algSeq += alg

    # Include, and then set up the pileup analysis sequence:
    from AsgAnalysisAlgorithms.PileupAnalysisSequence import \
        makePileupAnalysisSequence
    pileupSequence = makePileupAnalysisSequence(dataType)
    pileupSequence.configure(inputName='EventInfo',
                             outputName='EventInfo_%SYS%')
    algSeq += pileupSequence

    # Include, and then set up the electron analysis sequence:
    from EgammaAnalysisAlgorithms.ElectronAnalysisSequence import \
        makeElectronAnalysisSequence
    electronSequence = makeElectronAnalysisSequence(
        dataType,
        'LooseLHElectron.GradientLoose',
        postfix='loose',
        recomputeLikelihood=True,
        enableCutflow=True,
        enableKinematicHistograms=True)
    electronSequence.configure(inputName='Electrons',
                               outputName='AnalysisElectrons_%SYS%')
    algSeq += electronSequence

    # Include, and then set up the photon analysis sequence:
    from EgammaAnalysisAlgorithms.PhotonAnalysisSequence import \
        makePhotonAnalysisSequence
    photonSequence = makePhotonAnalysisSequence(dataType,
                                                'Tight.FixedCutTight',
                                                postfix='tight',
                                                recomputeIsEM=True,
                                                enableCutflow=True,
                                                enableKinematicHistograms=True)
    photonSequence.configure(inputName='Photons',
                             outputName='AnalysisPhotons_%SYS%')
    algSeq += photonSequence

    return algSeq
Beispiel #4
0
def makeSequence (dataType) :

    # Config:
    triggerChains = [
        'HLT_2mu14',
        'HLT_mu20_mu8noL1',
        'HLT_2e17_lhvloose_nod0'
        ]


    algSeq = AlgSequence()

    # Set up the systematics loader/handler algorithm:
    alg = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' )
    alg.sigmaRecommended = 1
    algSeq += alg

    # Include, and then set up the pileup analysis sequence:
    from TriggerAnalysisAlgorithms.TriggerAnalysisSequence import \
        makeTriggerAnalysisSequence
    triggerSequence = makeTriggerAnalysisSequence( dataType, triggerChains=triggerChains )
    algSeq += triggerSequence

    # Set up an ntuple to check the job with:
    treeMaker = createAlgorithm( 'CP::TreeMakerAlg', 'TreeMaker' )
    treeMaker.TreeName = 'events'
    algSeq += treeMaker
    ntupleMaker = createAlgorithm( 'CP::AsgxAODNTupleMakerAlg', 'NTupleMaker' )
    ntupleMaker.TreeName = 'events'
    ntupleMaker.Branches = [
        'EventInfo.runNumber   -> runNumber',
        'EventInfo.eventNumber -> eventNumber',
        ]
    ntupleMaker.Branches += ['EventInfo.trigPassed_' + t + ' -> trigPassed_' + t for t in triggerChains]
    ntupleMaker.systematicsRegex = '.*'
    algSeq += ntupleMaker
    treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' )
    treeFiller.TreeName = 'events'
    algSeq += treeFiller

    return algSeq
Beispiel #5
0
def makeSequence(dataType, jetContainer="AntiKt4EMPFlowJets"):

    # config

    algSeq = AlgSequence()

    # Set up the systematics loader/handler algorithm:
    sysLoader = createAlgorithm('CP::SysListLoaderAlg', 'SysLoaderAlg')
    sysLoader.sigmaRecommended = 1
    algSeq += sysLoader

    # Include, and then set up the pileup analysis sequence:
    from AsgAnalysisAlgorithms.PileupAnalysisSequence import \
        makePileupAnalysisSequence
    pileupSequence = makePileupAnalysisSequence(dataType)
    pileupSequence.configure(inputName='EventInfo',
                             outputName='EventInfo_%SYS%')
    print(pileupSequence)  # For debugging

    # Include, and then set up the jet analysis algorithm sequence:
    from JetAnalysisAlgorithms.JetAnalysisSequence import makeJetAnalysisSequence
    jetSequence = makeJetAnalysisSequence(dataType,
                                          jetContainer,
                                          enableCutflow=True,
                                          enableKinematicHistograms=True)
    jetSequence.configure(inputName=jetContainer,
                          outputName='AnalysisJetsBase_%SYS%')
    print(jetSequence)  # For debugging

    # Include, and then set up the jet analysis algorithm sequence:
    from JetAnalysisAlgorithms.JetJvtAnalysisSequence import makeJetJvtAnalysisSequence
    jvtSequence = makeJetJvtAnalysisSequence(dataType,
                                             jetContainer,
                                             enableCutflow=True)
    jvtSequence.configure(
        inputName={
            'eventInfo': 'EventInfo_%SYS%',
            'jets': 'AnalysisJetsBase_%SYS%'
        },
        outputName={'jets': 'AnalysisJets_%SYS%'},
        affectingSystematics={'jets': jetSequence.affectingSystematics()})
    print(jvtSequence)  # For debugging

    # Add the sequences to the job:
    algSeq += pileupSequence
    algSeq += jetSequence
    algSeq += jvtSequence

    # Set up an ntuple to check the job with:
    treeMaker = createAlgorithm('CP::TreeMakerAlg', 'TreeMaker')
    treeMaker.TreeName = 'jets'
    algSeq += treeMaker
    ntupleMaker = createAlgorithm('CP::AsgxAODNTupleMakerAlg', 'NTupleMaker')
    ntupleMaker.TreeName = 'jets'
    ntupleMaker.Branches = [
        'EventInfo.runNumber   -> runNumber',
        'EventInfo.eventNumber -> eventNumber',
        'AnalysisJets_%SYS%.pt -> jet_%SYS%_pt',
    ]
    if dataType != 'data':
        ntupleMaker.Branches += [
            # 'EventInfo.jvt_effSF_%SYS% -> jvtSF_%SYS%',
            # 'EventInfo.fjvt_effSF_%SYS% -> fjvtSF_%SYS%',
            'AnalysisJets_%SYS%.jvt_effSF_NOSYS -> jet_%SYS%_jvtEfficiency',
            # 'AnalysisJets_%SYS%.fjvt_effSF_NOSYS -> jet_%SYS%_fjvtEfficiency',
        ]
        ntupleMaker.systematicsRegex = '(^$)|(^JET_.*)'
        algSeq += ntupleMaker
    treeFiller = createAlgorithm('CP::TreeFillerAlg', 'TreeFiller')
    treeFiller.TreeName = 'jets'
    algSeq += treeFiller

    return algSeq
Beispiel #6
0
def makeSequence(dataType):
    algSeq = AlgSequence()

    # Set up the systematics loader/handler algorithm:
    sysLoader = createAlgorithm('CP::SysListLoaderAlg', 'SysLoaderAlg')
    sysLoader.sigmaRecommended = 1
    algSeq += sysLoader

    # Include, and then set up the jet analysis algorithm sequence:
    from JetAnalysisAlgorithms.JetAnalysisSequence import makeJetAnalysisSequence
    jetContainer = 'AntiKt4EMPFlowJets'
    jetSequence = makeJetAnalysisSequence(dataType, jetContainer)
    jetSequence.configure(inputName=jetContainer,
                          outputName='AnalysisJets_%SYS%')

    # Add all algorithms to the job:
    algSeq += jetSequence

    # Set up a selection alg for demonstration purposes
    # Also to avoid warnings from building MET with very soft electrons
    selalg = createAlgorithm('CP::AsgSelectionAlg', 'METEleSelAlg')
    addPrivateTool(selalg, 'selectionTool', 'CP::AsgPtEtaSelectionTool')
    selalg.selectionTool.minPt = 10e3
    selalg.selectionTool.maxEta = 2.47
    selalg.selectionDecoration = 'selectPtEta'
    selalg.particles = 'Electrons'
    # We need to copy here, because w/o an output container, it's assumed
    # that the input container is non-const
    selalg.particlesOut = 'DecorElectrons_%SYS%'
    algSeq += selalg

    # Now make a view container holding only the electrons for the MET calculation
    viewalg = createAlgorithm('CP::AsgViewFromSelectionAlg', 'METEleViewAlg')
    viewalg.selection = ['selectPtEta']
    viewalg.input = 'DecorElectrons_%SYS%'
    viewalg.output = 'METElectrons_%SYS%'
    algSeq += viewalg

    # Include, and then set up the met analysis algorithm sequence:
    from MetAnalysisAlgorithms.MetAnalysisSequence import makeMetAnalysisSequence
    metSequence = makeMetAnalysisSequence(dataType,
                                          metSuffix=jetContainer[:-4])
    metSequence.configure(inputName={
        'jets': 'AnalysisJets_%SYS%',
        'muons': 'Muons',
        'electrons': 'METElectrons_%SYS%'
    },
                          outputName='AnalysisMET_%SYS%',
                          affectingSystematics={
                              'jets': jetSequence.affectingSystematics(),
                              'muons': '(^$)',
                              'electrons': '(^$)'
                          })

    # Add the sequence to the job:
    algSeq += metSequence

    # Write the freshly produced MET object(s) to an output file:
    treeMaker = createAlgorithm('CP::TreeMakerAlg', 'TreeMaker')
    treeMaker.TreeName = 'met'
    algSeq += treeMaker
    ntupleMaker = createAlgorithm('CP::AsgxAODNTupleMakerAlg', 'NTupleMaker')
    ntupleMaker.TreeName = 'met'
    ntupleMaker.Branches = [
        'EventInfo.runNumber     -> runNumber',
        'EventInfo.eventNumber   -> eventNumber',
        'AnalysisMET_%SYS%.mpx   -> met_%SYS%_mpx',
        'AnalysisMET_%SYS%.mpy   -> met_%SYS%_mpy',
        'AnalysisMET_%SYS%.sumet -> met_%SYS%_sumet',
        'AnalysisMET_%SYS%.name  -> met_%SYS%_name',
    ]
    ntupleMaker.systematicsRegex = '.*'
    algSeq += ntupleMaker
    treeFiller = createAlgorithm('CP::TreeFillerAlg', 'TreeFiller')
    treeFiller.TreeName = 'met'
    algSeq += treeFiller

    return algSeq
Beispiel #7
0
def makeSequence(dataType):

    algSeq = AlgSequence()

    # Set up the systematics loader/handler algorithm:
    sysLoader = createAlgorithm('CP::SysListLoaderAlg', 'SysLoaderAlg')
    sysLoader.sigmaRecommended = 1
    algSeq += sysLoader

    # Include, and then set up the pileup analysis sequence:
    from AsgAnalysisAlgorithms.PileupAnalysisSequence import \
        makePileupAnalysisSequence
    pileupSequence = makePileupAnalysisSequence(dataType)
    pileupSequence.configure(inputName='EventInfo',
                             outputName='EventInfo_%SYS%')

    # Add the pileup sequence to the job:
    algSeq += pileupSequence

    # Include, and then set up the muon analysis algorithm sequence:
    from MuonAnalysisAlgorithms.MuonAnalysisSequence import makeMuonAnalysisSequence
    muonSequenceMedium = makeMuonAnalysisSequence(
        dataType,
        deepCopyOutput=True,
        shallowViewOutput=False,
        workingPoint='Medium.Iso',
        postfix='medium',
        enableCutflow=True,
        enableKinematicHistograms=True)
    muonSequenceMedium.configure(inputName='Muons',
                                 outputName='AnalysisMuonsMedium_%SYS%')

    # Add the sequence to the job:
    algSeq += muonSequenceMedium

    muonSequenceTight = makeMuonAnalysisSequence(
        dataType,
        deepCopyOutput=True,
        shallowViewOutput=False,
        workingPoint='Tight.Iso',
        postfix='tight',
        enableCutflow=True,
        enableKinematicHistograms=True)
    muonSequenceTight.removeStage("calibration")
    muonSequenceTight.configure(
        inputName='AnalysisMuonsMedium_%SYS%',
        outputName='AnalysisMuons_%SYS%',
        affectingSystematics=muonSequenceMedium.affectingSystematics())

    # Add the sequence to the job:
    algSeq += muonSequenceTight

    # Add an ntuple dumper algorithm:
    treeMaker = createAlgorithm('CP::TreeMakerAlg', 'TreeMaker')
    treeMaker.TreeName = 'muons'
    algSeq += treeMaker
    ntupleMaker = createAlgorithm('CP::AsgxAODNTupleMakerAlg',
                                  'NTupleMakerEventInfo')
    ntupleMaker.TreeName = 'muons'
    ntupleMaker.Branches = [
        'EventInfo.runNumber     -> runNumber',
        'EventInfo.eventNumber   -> eventNumber',
    ]
    ntupleMaker.systematicsRegex = '(^$)'
    algSeq += ntupleMaker
    ntupleMaker = createAlgorithm('CP::AsgxAODNTupleMakerAlg',
                                  'NTupleMakerMuons')
    ntupleMaker.TreeName = 'muons'
    ntupleMaker.Branches = [
        'AnalysisMuons_NOSYS.eta -> mu_eta',
        'AnalysisMuons_NOSYS.phi -> mu_phi',
        'AnalysisMuons_%SYS%.pt  -> mu_%SYS%_pt',
    ]
    ntupleMaker.systematicsRegex = '(^MUON_.*)'
    algSeq += ntupleMaker
    treeFiller = createAlgorithm('CP::TreeFillerAlg', 'TreeFiller')
    treeFiller.TreeName = 'muons'
    algSeq += treeFiller

    return algSeq