def createAnalyzer(dataVersion):
    a = Analyzer("CorrelationAnalysis")
    if dataVersion.isMC():
        a.tauPtCut = 10
    else:
        a.tauPtCut = 20
    return a
Esempio n. 2
0
def createAnalyzer(dataVersion):
    a = Analyzer("MetAnalysis")
    if dataVersion.isMC():
        a.tauPtCut = 10
    else:
        a.tauPtCut = 20
    return a
Esempio n. 3
0
def createAnalyzer(dataVersion):
    a = Analyzer("ExampleAnalysis")
    if dataVersion.isMC():
        a.tauPtCut = 10
    else:
        a.tauPtCut = 20
    return a
Esempio n. 4
0
def createAnalyzer(dataVersion,era):
    a = Analyzer("L1Study",
        usePileupWeights = True,
        L1TauPt        = 0,
        L1ETM          = 120,
        L1JetPt        = 0,
        TransverseMass = 0
    )
    a.runMin  = runmin
    a.runMax  = runmax
    return a
Esempio n. 5
0
def createAnalyzer(dataVersion, era):
    a = Analyzer(
        "TriggerEfficiency",
        name=era,
        Trigger=PSet(triggerOR=[], triggerOR2=[]),
        usePileupWeights=True,
        offlineSelection=leg,
        MuonSelection=PSet(
            #            discriminators = ["muIDMedium"],
            #            discriminators = ["TrgMatch_IsoMu20_eta2p1"],
            #            discriminators = ["Muons_TrgMatch_IsoMu16_eta2p1"],
        ),
        TauSelection=PSet(
            discriminators=[
                "byLooseCombinedIsolationDeltaBetaCorr3Hits",  #"byMediumIsolationMVA3newDMwLT",
                "againstMuonTight3",
                "againstElectronMediumMVA6"
            ],
            nprongs=1,
            relaxedOfflineSelection=False,
        ),
        binning=binning,
        xLabel=xLabel,
        yLabel=yLabel,
    )

    if isData(dataVersion):
        if "2016" in era:
            a.Trigger.triggerOR = ["HLT_IsoMu22_eta2p1_vx"]
            a.Trigger.triggerOR2 = [
                "HLT_VLooseIsoPFTau" + tauThreshold + "_Trk50_eta2p1_vx"
            ]
            if tauThreshold == "50":
                a.Trigger.triggerOR2 = ["HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"]

        a.runMin = runmin
        a.runMax = runmax
    else:
        if "2016" in era:
            a.Trigger.triggerOR = ["HLT_IsoMu22_eta2p1_vx"]
            a.Trigger.triggerOR2 = [
                "HLT_VLooseIsoPFTau" + tauThreshold + "_Trk50_eta2p1_vx"
            ]
            if tauThreshold == "50":
                a.Trigger.triggerOR2 = ["HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"]

    return a
def createAnalyzer(dataVersion,era):
    a = Analyzer("TriggerEfficiency",
        name = era,
        Trigger = PSet(
            triggerOR  = [],
            triggerOR2 = []
        ),
        usePileupWeights = True,
        offlineSelection = leg,
        MuonSelection = PSet(
#            discriminators = ["muIDMedium"],
#            discriminators = ["TrgMatch_IsoMu20_eta2p1"],
#            discriminators = ["Muons_TrgMatch_IsoMu16_eta2p1"],
        ),
        TauSelection = PSet(
            discriminators = ["byLooseCombinedIsolationDeltaBetaCorr3Hits",#"byMediumIsolationMVA3newDMwLT",
                              "againstMuonTight3",
                              "againstElectronMediumMVA6"],
            nprongs = 1,
            relaxedOfflineSelection = False,
        ),
        binning = binning,
        xLabel  = xLabel,
        yLabel  = yLabel,
    )

    if isData(dataVersion):
        if "2016" in era:
            a.Trigger.triggerOR = ["HLT_IsoMu22_eta2p1_vx"]
            a.Trigger.triggerOR2= ["HLT_VLooseIsoPFTau"+tauThreshold+"_Trk50_eta2p1_vx"]
            if tauThreshold == "50":
                a.Trigger.triggerOR2= ["HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"]

        a.runMin  = runmin
        a.runMax  = runmax
    else:
        if "2016" in era:
            a.Trigger.triggerOR = ["HLT_IsoMu22_eta2p1_vx"]
            a.Trigger.triggerOR2= ["HLT_VLooseIsoPFTau"+tauThreshold+"_Trk50_eta2p1_vx"]
            if tauThreshold == "50":
                a.Trigger.triggerOR2= ["HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"]

    return a
Esempio n. 7
0
 def registerAnalysis(self, process):
     '''
     Create and register the analysis after the changes have bene done to the config
     '''
     process.addAnalyzer(self._moduleName, Analyzer(self._selectorName, config=self._config, silent=True))
     return
Esempio n. 8
0
 def registerAnalysis(self, process):
     Verbose("registerAnalysis()", True)
     process.addAnalyzer(self._moduleName, Analyzer(self._selectorName, config=self._config, silent=True))
     return
Esempio n. 9
0
 def registerAnalysis(self, process):
     process.addAnalyzer(self._moduleName, Analyzer(self._selectorName, config=self._config, silent=True))
def createAnalyzer(dataVersion,era,onlineSelection = "MET80"):
    useCaloMET = False
    if "CaloMET" in era:
        useCaloMET = True
        era = era[:-8]

    a = Analyzer("TriggerEfficiency",
        name = era,
        Trigger = PSet(
            triggerOR  = [],
            triggerOR2 = []
        ),
        METFilter = signalAnalysis.metFilter,
        usePileupWeights = True,
#        usePileupWeights = False,
        onlineSelection = onlineSelection,
        offlineSelection = leg,
        TauSelection      = TauSelection,
        ElectronSelection = signalAnalysis.eVeto,
        MuonSelection     = signalAnalysis.muVeto,
        JetSelection      = signalAnalysis.jetSelection,
        BJetSelection     = signalAnalysis.bjetSelection,
        binning = binning,
        xLabel  = xLabel,
        yLabel  = yLabel,
    )
#    a.TauSelection.applyTriggerMatching = False
    a.JetSelection.numberOfJetsCutValue = 3
#    a.BJetSelection.bjetDiscrWorkingPoint = "Medium"
    a.BJetSelection.numberOfBJetsCutValue = 1

    if dataVersion.isData():
        a.Trigger.triggerOR = ["HLT_LooseIsoPFTau35_Trk20_Prong1_v2",
                               "HLT_LooseIsoPFTau35_Trk20_Prong1_v3",
                               "HLT_LooseIsoPFTau35_Trk20_Prong1_v4",
                               "HLT_LooseIsoPFTau35_Trk20_Prong1_v6",
                               "HLT_LooseIsoPFTau35_Trk20_Prong1_v7",
                               "HLT_LooseIsoPFTau35_Trk20_Prong1_v9",
                               "HLT_LooseIsoPFTau35_Trk20_Prong1_v10"]
        a.Trigger.triggerOR2 = ["HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v2",
                                "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v3",
                                "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v4",
                                "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v6",
                                "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v7",
                                "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v9",
                                "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v10"]
        if era == "2015C" or era == "2015D" or era == "2015CD":
            a.Trigger.triggerOR = ["HLT_LooseIsoPFTau50_Trk30_eta2p1_v1",
                                   "HLT_LooseIsoPFTau50_Trk30_eta2p1_v2",
                                   "HLT_LooseIsoPFTau50_Trk30_eta2p1_v3",
                                   "HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"]
            a.Trigger.triggerOR2 = ["HLT_LooseIsoPFTau50_Trk30_eta2p1_"+onlineSelection+"_JetIdCleaned_v1",
                                    "HLT_LooseIsoPFTau50_Trk30_eta2p1_"+onlineSelection+"_JetIdCleaned_v2",
                                    "HLT_LooseIsoPFTau50_Trk30_eta2p1_"+onlineSelection+"_v1",
                                    "HLT_LooseIsoPFTau50_Trk30_eta2p1_"+onlineSelection+"_JetIdCleaned_vx",
                                    "HLT_LooseIsoPFTau50_Trk30_eta2p1_"+onlineSelection+"_vx"]
        if "2016" in era:
            a.Trigger.triggerOR = ["HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"]
            a.Trigger.triggerOR2 = ["HLT_LooseIsoPFTau50_Trk30_eta2p1_"+onlineSelection+"_vx"]


#        lumi,runmin,runmax = runRange(era)
#        a.lumi    = lumi
        a.runMin  = runmin
        a.runMax  = runmax
    else:
        a.Trigger.triggerOR = ["HLT_LooseIsoPFTau35_Trk20_Prong1_v6"]
        a.Trigger.triggerOR2 = ["HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v6"]
        if era == "2015C" or era == "2015D" or era == "2015CD" or "2016" in era:
            a.Trigger.triggerOR = ["HLT_LooseIsoPFTau50_Trk30_eta2p1_v1",
                                   "HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"]
            a.Trigger.triggerOR2 = ["HLT_LooseIsoPFTau50_Trk30_eta2p1_"+onlineSelection+"_v1",
                                    "HLT_LooseIsoPFTau50_Trk30_eta2p1_"+onlineSelection+"_vx"]

    if useCaloMET:
        a.Trigger.triggerOR2 = []

    return a
Esempio n. 11
0
def main():

    # Require at least two arguments (script-name, path to multicrab)
    if len(sys.argv) < 2:
        Print(
            "Not enough arguments passed to script execution. Printing docstring & EXIT."
        )
        print __doc__
        sys.exit(0)
    else:
        pass

    # ================================================================================================
    # Setup the process
    # ================================================================================================
    maxEvents = {}
    maxEvents["All"] = opts.nEvts
    process = Process(prefix, postfix, maxEvents)

    # ================================================================================================
    # Add the datasets (according to user options)
    # ================================================================================================
    if (opts.includeOnlyTasks):
        Print("Adding only dataset \"%s\" from multiCRAB directory %s" %
              (opts.includeOnlyTasks, opts.mcrab))
        process.addDatasetsFromMulticrab(
            opts.mcrab, includeOnlyTasks=opts.includeOnlyTasks)
    elif (opts.excludeTasks):
        Print("Adding all datasets except \"%s\" from multiCRAB directory %s" %
              (opts.excludeTasks, opts.mcrab))
        Print(
            "If collision data are present, then vertex reweighting is done according to the chosen data era (era=2015C, 2015D, 2015) etc..."
        )
        process.addDatasetsFromMulticrab(opts.mcrab,
                                         excludeTasks=opts.excludeTasks)
    else:
        myBlackList = []
        if opts.analysisType == "HToTB":
            myBlackList = [
                "QCD_b", "ChargedHiggs", "DY", "WZ", "WW", "ZZ", "TTTT", "ST",
                "TTWJets", "TTZ"
            ]

        Print("Adding all datasets from multiCRAB directory %s" % (opts.mcrab))
        Print(
            "If collision data are present, then vertex reweighting is done according to the chosen data era (era=2015C, 2015D, 2015) etc..."
        )
        regex = "|".join(myBlackList)
        if len(myBlackList) > 0:
            process.addDatasetsFromMulticrab(opts.mcrab, excludeTasks=regex)
        else:
            process.addDatasetsFromMulticrab(opts.mcrab)

    # ================================================================================================
    # Selection customisations
    # ================================================================================================
    if opts.analysisType == "HToTauNu":
        from HiggsAnalysis.NtupleAnalysis.parameters.signalAnalysisParameters import allSelections
        # Disable rtau
        allSelections.TauSelection.prongs = 1
        allSelections.TauSelection.rtau = 0.0
    elif opts.analysisType == "HToTB":
        from HiggsAnalysis.NtupleAnalysis.parameters.hplus2tbAnalysis import allSelections
    else:
        raise Exception(
            "Invalid analysis selection \"%s\"! Valid options are: %s" %
            (opts.analysisType, ", ".join(allowedAnalysis)))

    # Jet cut values
    allSelections.__setattr__("jetPtCutMin", 0.0)
    allSelections.__setattr__("jetPtCutMax", 99990.0)
    allSelections.__setattr__("jetEtaCutMin", -2.5)
    allSelections.__setattr__("jetEtaCutMax", 2.5)
    if 0:
        for algo in ["combinedInclusiveSecondaryVertexV2BJetTags"]:
            for wp in ["Loose", "Medium", "Tight"]:
                selections = allSelections.clone()
                selections.BJetSelection.bjetDiscr = algo
                selections.BJetSelection.bjetDiscrWorkingPoint = wp
                suffix = "_%s_%s" % (algo, wp)
                print "Added analyzer for algo/wp: %s" % suffix
                process.addAnalyzer(
                    "BTagEfficiency" + suffix,
                    Analyzer("BTagEfficiencyAnalysis",
                             config=selections,
                             silent=False))

    # Set the analysis type
    allSelections.__setattr__("AnalysisType", opts.analysisType)

    # Overwrite verbosity
    allSelections.verbose = opts.verbose

    # Overwrite histo ambient level (Options: Systematics, Vital, Informative, Debug)
    allSelections.histogramAmbientLevel = opts.histoLevel

    #================================================================================================
    # Build analysis modules
    #================================================================================================
    PrintOptions(opts)
    builder = AnalysisBuilder(
        prefix,
        dataEras,
        searchModes,
        #### Options ####
        usePUreweighting=opts.usePUreweighting,
        useTopPtReweighting=opts.useTopPtReweighting,
        doSystematicVariations=opts.doSystematics)

    # ================================================================================================
    # Add Analysis Variations
    # ================================================================================================
    builder.addVariation("BJetSelection.bjetDiscr",
                         ["pfCombinedInclusiveSecondaryVertexV2BJetTags"])
    builder.addVariation("BJetSelection.bjetDiscrWorkingPoint",
                         ["Loose", "Medium", "Tight"])

    # ================================================================================================
    # Build the builder
    # ================================================================================================
    builder.build(process, allSelections)

    # ================================================================================================
    # Run the analysis
    # ================================================================================================
    Print("Running process", True)
    process.run()
Esempio n. 12
0
def createAnalyzer(dataVersion, era, onlineSelection="MET80"):
    useCaloMET = False
    if "CaloMET" in era:
        useCaloMET = True
        era = era[:-8]

    a = Analyzer(
        "TriggerEfficiency",
        name=era,
        Trigger=PSet(triggerOR=[], triggerOR2=[]),
        usePileupWeights=True,
        #        usePileupWeights = False,
        onlineSelection=onlineSelection,
        offlineSelection=leg,
        TauSelection=signalAnalysis.tauSelection,
        #        TauSelection = PSet(
        #            discriminators = ["byLooseCombinedIsolationDeltaBetaCorr3Hits",
        #                             "againstMuonTight3",
        #                             "againstElectronMediumMVA5"],
        #        ),
        ElectronSelection=signalAnalysis.eVeto,
        MuonSelection=signalAnalysis.muVeto,
        JetSelection=signalAnalysis.jetSelection,
        BJetSelection=signalAnalysis.bjetSelection,
        binning=binning,
        xLabel=xLabel,
        yLabel=yLabel,
    )
    #    a.TauSelection.applyTriggerMatching = False
    a.JetSelection.numberOfJetsCutValue = 3
    #    a.BJetSelection.bjetDiscrWorkingPoint = "Medium"
    a.BJetSelection.numberOfBJetsCutValue = 1

    if dataVersion.isData():
        a.Trigger.triggerOR = [
            "HLT_LooseIsoPFTau35_Trk20_Prong1_v2",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_v3",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_v4",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_v6",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_v7",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_v9",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_v10"
        ]
        a.Trigger.triggerOR2 = [
            "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v2",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v3",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v4",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v6",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v7",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v9",
            "HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v10"
        ]
        if era == "2015C" or era == "2015D" or era == "2015CD":
            a.Trigger.triggerOR = [
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_v2",
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_v3",
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_" + onlineSelection +
                "_JetIdCleaned_v1", "HLT_LooseIsoPFTau50_Trk30_eta2p1_" +
                onlineSelection + "_JetIdCleaned_v2",
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_" + onlineSelection + "_v1",
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_" + onlineSelection +
                "_JetIdCleaned_vx",
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_" + onlineSelection + "_vx"
            ]

        lumi, runmin, runmax = runRange(era)
        a.lumi = lumi
        a.runMin = runmin
        a.runMax = runmax
    else:
        a.Trigger.triggerOR = ["HLT_LooseIsoPFTau35_Trk20_Prong1_v6"]
        a.Trigger.triggerOR2 = ["HLT_LooseIsoPFTau35_Trk20_Prong1_MET70_v6"]
        if era == "2015C" or era == "2015D" or era == "2015CD":
            a.Trigger.triggerOR = [
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_" + onlineSelection + "_v1",
                "HLT_LooseIsoPFTau50_Trk30_eta2p1_" + onlineSelection + "_vx"
            ]

    if useCaloMET:
        a.Trigger.triggerOR2 = []

    return a
Esempio n. 13
0
from HiggsAnalysis.NtupleAnalysis.main import Process, PSet, Analyzer

process = Process()

# Example of adding a dataset which has its files defined in data/<dataset_name>.txt file
#process.addDatasets(["TTbar_HBWB_HToTauNu_M_160_13TeV_pythia6"])

# Example of adding datasets from a multicrab directory
import sys
if len(sys.argv) != 2:
    print "Usage: ./exampleAnalysis.py <path-to-multicrab-directory>"
    sys.exit(0)
process.addDatasetsFromMulticrab(sys.argv[1])

# Example of adding an analyzer
process.addAnalyzer("test", Analyzer("ExampleAnalysis", tauPtCut=10))


# Example of adding an analyzer whose configuration depends on dataVersion
def createAnalyzer(dataVersion):
    a = Analyzer("ExampleAnalysis")
    if dataVersion.isMC():
        a.tauPtCut = 10
    else:
        a.tauPtCut = 20
    return a


process.addAnalyzer("test2", createAnalyzer)

# Run the analysis
def createAnalyzer(dataVersion, era):
    a = Analyzer(
        "TriggerEfficiency",
        name=era,
        Trigger=PSet(triggerOR=[], triggerOR2=[]),
        METFilter=metFilter,
        usePileupWeights=True,
        offlineSelection=leg,
        MuonSelection=PSet(
            #            discriminators = ["muIDMedium"],
            #            discriminators = ["TrgMatch_IsoMu20_eta2p1"],
            discriminators=["Muons_TrgMatch_IsoMu16_eta2p1"], ),
        TauSelection=PSet(
            discriminators=[
                "byLooseCombinedIsolationDeltaBetaCorr3Hits",  #"byMediumIsolationMVA3newDMwLT",
                "againstMuonTight3",
                "againstElectronMediumMVA6"
            ],
            nprongs=1,
            relaxedOfflineSelection=False),
        binning=binning,
        xLabel=xLabel,
        yLabel=yLabel,
    )

    if isData(dataVersion):
        a.Trigger.triggerOR = [
            "HLT_IsoMu15_eta2p1_L1ETM20_v3", "HLT_IsoMu15_eta2p1_L1ETM20_v4",
            "HLT_IsoMu15_eta2p1_L1ETM20_v5", "HLT_IsoMu15_eta2p1_L1ETM20_v6",
            "HLT_IsoMu15_eta2p1_L1ETM20_v7"
        ]
        a.Trigger.triggerOR2 = [
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v2",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v4",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v6",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v7",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v9",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v10"
        ]
        if era == "2015C":
            #            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_CaloMET30_v1",
            #                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1"]
            #            a.Trigger.triggerOR2 = ["HLT_IsoMu16_eta2p1_CaloMET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
            #                                    "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1"]
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]
#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v2"]
#            a.Trigger.triggerOR2 = ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v2"]
        if era == "2015D":
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v2",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v3",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx",
                "HLT_IsoMu16_eta2p1_MET30_v1", "HLT_IsoMu16_eta2p1_MET30_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v2",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v3",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx",
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]
        if era == "2015CD":
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v2",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v3",
                "HLT_IsoMu16_eta2p1_MET30_v1"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v2",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v3",
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_v1"
            ]
        if "2016" in era:
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_MET30_vx", "HLT_IsoMu22_eta2p1_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx",
                "HLT_IsoMu21_eta2p1_LooseIsoPFTau50_Trk30_eta2p1_SingleL1_vx"
            ]

        if era == "2016ICHEP":
            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_MET30_vx"]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]

        if era == "2016HIPFIXED":
            a.Trigger.triggerOR = ["HLT_IsoMu22_eta2p1_vx"]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu21_eta2p1_LooseIsoPFTau50_Trk30_eta2p1_SingleL1_vx"
            ]

#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v1",
#                                   "HLT_IsoMu20_eta2p1_v2",
#                                   "HLT_IsoMu17_eta2p1_v2"]
#            a.Trigger.triggerOR2= ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v1",
#                                   "HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v2"]

#        runmin,runmax = process.getRuns()
#        a.lumi    = lumi
        a.runMin = runmin
        a.runMax = runmax
    else:
        a.Trigger.triggerOR = ["HLT_IsoMu15_eta2p1_L1ETM20_v5"]
        a.Trigger.triggerOR2 = [
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v6"
        ]
        if era == "2015C" or era == "2015D" or era == "2015CD" or "2016" in era:
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_CaloMET30_v1",
                "HLT_IsoMu16_eta2p1_MET30_vx",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_CaloMET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]


#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v1"]
#            a.Trigger.triggerOR2 = ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v1"]

#print "check triggerOR",a.Trigger.triggerOR
    return a
from HiggsAnalysis.NtupleAnalysis.main import Process, PSet, Analyzer

process = Process()

# Example of adding a dataset which has its files defined in data/<dataset_name>.txt file
#process.addDatasets(["TTbar_HBWB_HToTauNu_M_160_13TeV_pythia6"])

# Example of adding datasets from a multicrab directory
import sys
if len(sys.argv) != 2:
    print "Usage: ./metAnalysis.py <path-to-multicrab-directory>"
    sys.exit(0)
process.addDatasetsFromMulticrab(sys.argv[1])

# Example of adding an analyzer
process.addAnalyzer("test", Analyzer("CorrelationAnalysis", tauPtCut=10))


# Example of adding an analyzer whose configuration depends on dataVersion
def createAnalyzer(dataVersion):
    a = Analyzer("CorrelationAnalysis")
    if dataVersion.isMC():
        a.tauPtCut = 10
    else:
        a.tauPtCut = 20
    return a


process.addAnalyzer("test2", createAnalyzer)

# Run the analysis
Esempio n. 16
0
from HiggsAnalysis.NtupleAnalysis.main import Process, PSet, Analyzer

process = Process()

# Example of adding a dataset which has its files defined in data/<dataset_name>.txt file
#process.addDatasets(["TTbar_HBWB_HToTauNu_M_160_13TeV_pythia6"])

# Example of adding datasets from a multicrab directory
import sys
if len(sys.argv) != 2:
    print "Usage: ./metAnalysis.py <path-to-multicrab-directory>"
    sys.exit(0)
process.addDatasetsFromMulticrab(sys.argv[1])

# Example of adding an analyzer
process.addAnalyzer("test", Analyzer("MetAnalysis", tauPtCut=10))


# Example of adding an analyzer whose configuration depends on dataVersion
def createAnalyzer(dataVersion):
    a = Analyzer("MetAnalysis")
    if dataVersion.isMC():
        a.tauPtCut = 10
    else:
        a.tauPtCut = 20
    return a


process.addAnalyzer("test2", createAnalyzer)

# Run the analysis
Esempio n. 17
0
def createAnalyzer(dataVersion,era):
    a = Analyzer("TriggerEfficiency",
        name = era,
        Trigger = PSet(
            triggerOR  = [],
            triggerOR2 = []
        ),
        usePileupWeights = True,
        offlineSelection = leg,
        MuonSelection = PSet(
#            discriminators = ["muIDMedium"],
#            discriminators = ["TrgMatch_IsoMu20_eta2p1"],
            discriminators = ["Muons_TrgMatch_IsoMu16_eta2p1"],
        ),
        TauSelection = PSet(
            discriminators = ["byLooseCombinedIsolationDeltaBetaCorr3Hits",#"byMediumIsolationMVA3newDMwLT",
                              "againstMuonTight3",
                              "againstElectronMediumMVA6"],
            nprongs = 1,
        ),
        binning = binning,
        xLabel  = xLabel,
        yLabel  = yLabel,
    )

    if isData(dataVersion):
        a.Trigger.triggerOR = ["HLT_IsoMu15_eta2p1_L1ETM20_v3",
                               "HLT_IsoMu15_eta2p1_L1ETM20_v4",
                               "HLT_IsoMu15_eta2p1_L1ETM20_v5",
                               "HLT_IsoMu15_eta2p1_L1ETM20_v6",
                               "HLT_IsoMu15_eta2p1_L1ETM20_v7"]
        a.Trigger.triggerOR2 = ["HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v2",
                                "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v4",
                                "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v6",
                                "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v7",
                                "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v9",
                                "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v10"]
        if era == "2015C":
#            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_CaloMET30_v1",
#                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1"]
#            a.Trigger.triggerOR2 = ["HLT_IsoMu16_eta2p1_CaloMET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
#                                    "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1"]
            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1","HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx"]
            a.Trigger.triggerOR2= ["HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1","HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx"]
#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v2"]
#            a.Trigger.triggerOR2 = ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v2"]
        if era == "2015D":
            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v2",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v3",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx",
                                   "HLT_IsoMu16_eta2p1_MET30_v1",
                                   "HLT_IsoMu16_eta2p1_MET30_vx"]
            a.Trigger.triggerOR2= ["HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v2",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v3",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx",
                                   "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
                                   "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx"]
        if era == "2015CD":
            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v2",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v3",
                                   "HLT_IsoMu16_eta2p1_MET30_v1"]
            a.Trigger.triggerOR2= ["HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v2",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v3",
                                   "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_v1"]
        if "2016" in era:
            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_MET30_vx","HLT_IsoMu22_eta2p1_vx"]
            a.Trigger.triggerOR2= ["HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx","HLT_IsoMu21_eta2p1_LooseIsoPFTau50_Trk30_eta2p1_SingleL1_vx"]

        if era == "2016ICHEP":
            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_MET30_vx"]
            a.Trigger.triggerOR2= ["HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx"]

        if era == "2016HIPFIXED":
            a.Trigger.triggerOR = ["HLT_IsoMu22_eta2p1_vx"]
            a.Trigger.triggerOR2= ["HLT_IsoMu21_eta2p1_LooseIsoPFTau50_Trk30_eta2p1_SingleL1_vx"]
                                    
#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v1",
#                                   "HLT_IsoMu20_eta2p1_v2",
#                                   "HLT_IsoMu17_eta2p1_v2"]
#            a.Trigger.triggerOR2= ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v1",
#                                   "HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v2"]

#        runmin,runmax = process.getRuns()
#        a.lumi    = lumi
        a.runMin  = runmin
        a.runMax  = runmax
    else:
        a.Trigger.triggerOR = ["HLT_IsoMu15_eta2p1_L1ETM20_v5"]
        a.Trigger.triggerOR2 = ["HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v6"]
        if era == "2015C" or era == "2015D" or era == "2015CD" or "2016" in era:
            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_CaloMET30_v1",
                                   "HLT_IsoMu16_eta2p1_MET30_vx",
                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx"]
            a.Trigger.triggerOR2 = ["HLT_IsoMu16_eta2p1_CaloMET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
                                    "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx",
                                    "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx"]
#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v1"]
#            a.Trigger.triggerOR2 = ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v1"]

    #print "check triggerOR",a.Trigger.triggerOR
    return a
Esempio n. 18
0
def createAnalyzer(dataVersion, era):
    a = Analyzer(
        "TriggerEfficiency",
        name=era,
        Trigger=PSet(triggerOR=[], triggerOR2=[]),
        usePileupWeights=True,
        offlineSelection=leg,
        MuonSelection=PSet(
            #            discriminators = ["muIDMedium"],
            #            discriminators = ["TrgMatch_IsoMu20_eta2p1"],
            discriminators=["Muons_TrgMatch_IsoMu16_eta2p1"], ),
        TauSelection=PSet(discriminators=[
            "byLooseCombinedIsolationDeltaBetaCorr3Hits", "againstMuonTight3",
            "againstElectronMediumMVA5"
        ], ),
        binning=binning,
        xLabel=xLabel,
        yLabel=yLabel,
    )

    if isData(dataVersion):
        a.Trigger.triggerOR = [
            "HLT_IsoMu15_eta2p1_L1ETM20_v3", "HLT_IsoMu15_eta2p1_L1ETM20_v4",
            "HLT_IsoMu15_eta2p1_L1ETM20_v5", "HLT_IsoMu15_eta2p1_L1ETM20_v6",
            "HLT_IsoMu15_eta2p1_L1ETM20_v7"
        ]
        a.Trigger.triggerOR2 = [
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v2",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v4",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v6",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v7",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v9",
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v10"
        ]
        if era == "2015C":
            #            a.Trigger.triggerOR = ["HLT_IsoMu16_eta2p1_CaloMET30_v1",
            #                                   "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1"]
            #            a.Trigger.triggerOR2 = ["HLT_IsoMu16_eta2p1_CaloMET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
            #                                    "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1"]
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]
#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v2"]
#            a.Trigger.triggerOR2 = ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v2"]
        if era == "2015D":
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v2",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v3",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx",
                "HLT_IsoMu16_eta2p1_MET30_v1", "HLT_IsoMu16_eta2p1_MET30_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v2",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v3",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx",
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]
        if era == "2015CD":
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v1",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v2",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_v3",
                "HLT_IsoMu16_eta2p1_MET30_v1"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v2",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_v3",
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_v1"
            ]
#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v1",
#                                   "HLT_IsoMu20_eta2p1_v2",
#                                   "HLT_IsoMu17_eta2p1_v2"]
#            a.Trigger.triggerOR2= ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v1",
#                                   "HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v2"]

        lumi, runmin, runmax = runRange(era)
        a.lumi = lumi
        a.runMin = runmin
        a.runMax = runmax
    else:
        a.Trigger.triggerOR = ["HLT_IsoMu15_eta2p1_L1ETM20_v5"]
        a.Trigger.triggerOR2 = [
            "HLT_IsoMu15_eta2p1_LooseIsoPFTau35_Trk20_Prong1_L1ETM20_v6"
        ]
        if era == "2015C" or era == "2015D" or era == "2015CD":
            a.Trigger.triggerOR = [
                "HLT_IsoMu16_eta2p1_CaloMET30_v1",
                "HLT_IsoMu16_eta2p1_MET30_vx",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_vx"
            ]
            a.Trigger.triggerOR2 = [
                "HLT_IsoMu16_eta2p1_CaloMET30_LooseIsoPFTau50_Trk30_eta2p1_v1",
                "HLT_IsoMu16_eta2p1_MET30_LooseIsoPFTau50_Trk30_eta2p1_vx",
                "HLT_IsoMu16_eta2p1_MET30_JetIdCleaned_LooseIsoPFTau50_Trk30_eta2p1_vx"
            ]


#            a.Trigger.triggerOR = ["HLT_IsoMu20_eta2p1_v1"]
#            a.Trigger.triggerOR2 = ["HLT_IsoMu17_eta2p1_LooseIsoPFTau20_v1"]

#print "check triggerOR",a.Trigger.triggerOR
    return a
Esempio n. 19
0
    sys.exit(0)

#print sys.argv[1]

process.addDatasetsFromMulticrab(sys.argv[1])

import HiggsAnalysis.NtupleAnalysis.tools.aux as aux
PileupHistogramPath = os.path.join(aux.higgsAnalysisPath(), "NtupleAnalysis", "data", "PUWeights")

process.addAnalyzer("generatorComparison", 
    Analyzer("GeneratorComparison",
        histogramAmbientLevel = "Informative",
        tauPtCut = 41.0,
        tauEtaCut = 2.1,
        bjetEtCut = 30.0,
        bjetEtaCut = 2.4,

        lumi    = 7274,
        runMin  = 202807,
        runMax  = 208686,
    ),
    #includeOnlyTasks="TauPlusX_\S+_2012D_Jan22"
)

# Run the analysis
process.run()


# Run the analysis with PROOF
# By default it uses all cores, but you can give proofWorkers=<N> as a parameter
#process.run(proof=True)