Esempio n. 1
0
)
hltMod.AddTrigger('HLT_IsoMu20_v*')

photonHltMod = mithep.HLTMod('PhotonHLT',
    BitsName = 'HLTBits',
    TrigObjsName = 'PhotonObjects',
    AbortIfNotAccepted = False
)
photonHltMod.AddTrigger('!+HLT_Photon165_HE10_v*')
photonHltMod.AddTrigger('!+HLT_Photon120_R9Id90_HE10_IsoM_v*')
photonHltMod.AddTrigger('!+HLT_Photon135_PFMET100_NoiseCleaned_v*')

goodPVFilterMod.SetIsMC(False)

muonIdMod.SetMinOutput(1)

flatTree = mithep.FlatTreeFiller(
    MuonsName = muonIdMod.GetOutputName(),
    TriggerObjectsName = photonHltMod.GetOutputName()
)

analysis.setSequence(
    hltMod *
    photonHltMod *
    goodPVFilterMod *
    separatePileUpMod *
    muonIdMod *
    flatTree
)

Esempio n. 2
0
output.Drop("InclusiveSecondaryVertexes")
output.Drop("CosmicMuons")
output.Drop("MergedElectronsStable")
output.Drop("MergedConversions*")
output.Drop("AKT8GenJets")
output.Drop("AKt4PFJets")
output.Drop("DCASig")
output.AddNewBranch(metCorrection.GetOutputName())
output.AddNewBranch(monojetSkim.GetCategoryFlagsName())
output.AddNewBranch(monophotonSkim.GetCategoryFlagsName())

output.AddCondition(skim)

analysis.setSequence(
    badEventsFilterMod * 
    (
        (metCorrection * jetCorrection) +
        monojetPrefilter +
        monophotonPrefilter +
        (
            prefilter * goodPVFilterMod * electronId * muonId * photonId * jetId *
            (
                monojetSkim +
                monophotonSkim +
                skim
            )
        )
    ) +
    output
)
metCorr = mithep.MetCorrectionMod(
    CorrectedName = 'PFType1CorrectedMet',
    JetsName = 'AKt4PFJetsCHS',
    CorrectedJetsName = jetCorr.GetOutputName()
)
metCorr.ApplyType1(True)
metCorr.IsData(False)

preRun2Sync = mithep.PreRun2SynchExercise(
    VerticesName = mithep.Names.gkPVBrn,
    MetName = metCorr.GetOutputName(),
    JetsName = jetId.GetOutputName(),
    ElectronsName = eleId.GetOutputName(),
    MuonsName = muId.GetOutputName(),
    TausName = tauId.GetOutputName(),
    PhotonsName = photonId.GetOutputName()
)

analysis.setSequence(
    goodPV *
    pfPU *
    eleId *
    muId *
    tauId *
    photonId *
    jetCorr *
    jetId *
    metCorr *
    preRun2Sync
)
Esempio n. 4
0
from MitAna.TreeMod.bambu import mithep, analysis
from MitPhysics.Mods.PuppiMod import puppiMod

puppiMod.SetEtaConfigName("/home/dabercro/cms/root/PUPPET/PuppiCfg.cfg")
puppiMod.SetR0(0.4)
puppiMod.SetAlpha(2)
puppiMod.SetBeta(2)
puppiMod.SetDump(True)
puppiMod.SetDZCut(0.3)
puppiMod.SetD0Cut(1)

analysis.SetUseHLT(False)
analysis.setSequence(puppiMod)
Esempio n. 5
0
    PrintLevel = 0
)
for filler in fillers:
    neroMod.AddFiller(filler)

sequence = goodPVFilterMod
if not analysis.isRealData:
    sequence *= generatorMod

sequence *= separatePileUpMod * \
    jetCorrectionMod * \
    jetIdMod * \
    metCorrectionMod * \
    pfTauIdMod * \
    electronIdMod * \
    muonIdMod * \
    photonIdMod * \
    electronTightId * \
    muonTightId * \
    muonTightIdMask * \
    fatJetCorrectionMod * \
    fatJetIdMod * \
    photonMediumId * \
    photonTightId * \
    neroMod

analysis.SetAllowNoHLTTree(True)

analysis.setSequence(sequence)

Esempio n. 6
0
from MitAna.TreeMod.bambu import mithep, analysis

ntuples = mithep.GenKinTreeMod(
    OutputName = 'genkintree.root'
)

analysis.setSequence(ntuples)
Esempio n. 7
0
passingProbeMuonIdMod.SetIdType(mithep.MuonTools.kPog2015_Tight)
passingProbeMuonIdMod.SetIsoType(mithep.MuonTools.kPFIsoBetaPUCorrectedTight)
passingProbeMuonIdMod.SetApplyD0Cut(True)
passingProbeMuonIdMod.SetApplyDZCut(True)
passingProbeMuonIdMod.SetWhichVertex(0)
passingProbeMuonIdMod.SetInputName('Muons')
passingProbeMuonIdMod.SetOutputName('PassingProbeMuons')
passingProbeMuonIdMod.SetPFNoPileupCandidatesName('pfNoPU')
passingProbeMuonIdMod.SetPFPileupCandidatesName('pfPU')


probeMuonIdMod = mithep.MuonIdMod()
#probeMuonIdMod.SetPtMin(25.)
#probeMuonIdMod.SetEtaMax(2.4)
probeMuonIdMod.SetIdType(mithep.MuonTools.kPog2015_Loose)
probeMuonIdMod.SetIsoType(mithep.MuonTools.kPFIsoBetaPUCorrectedTight)
probeMuonIdMod.SetApplyD0Cut(False)
probeMuonIdMod.SetApplyDZCut(False)
probeMuonIdMod.SetInputName('Muons')
probeMuonIdMod.SetOutputName('ProbeMuons')
probeMuonIdMod.SetPFNoPileupCandidatesName('pfNoPU')
probeMuonIdMod.SetPFPileupCandidatesName('pfPU')

ntuplesMod = mithep.MuonNtuples('MuonNtuples', 'Flat ntuples producer')
ntuplesMod.SetTagMuonsName('TagMuons')
ntuplesMod.SetPassingProbeMuonsName('PassingProbeMuons')
ntuplesMod.SetProbeMuonsName('ProbeMuons')
ntuplesMod.SetTriggerObjectsName('SingleMuonTriggerObjects')

analysis.setSequence(hltMod * goodPVMod * pfPUMod * tagMuonIdMod * passingProbeMuonIdMod * probeMuonIdMod * ntuplesMod)
Esempio n. 8
0
        JetMinPt = 3.
    )

    postskimSequence *= Chain([generator, mcParticlesNoNu, genJets])

    metFiller.SetGenMetName(generator.GetMCMETName())

    mcFiller = mithep.nero.MonteCarloFiller(
        GenJetsName = genJets.GetOutputJetsName()
    )
    if 'pdfrwgt' in analysis.custom and analysis.custom['pdfrwgt'] != '-':
        if analysis.custom['pdfrwgt'] == 'amc_74':
            mcFiller.AddPdfReweightGroupName('PDF_variation')
        elif analysis.custom['pdfrwgt'] == 'mg5_74':
            mcFiller.AddPdfReweightGroupName('NNPDF30_lo_as_0130.LHgrid')
        elif analysis.custom['pdfrwgt'] == 'pwhg_74':
            for idx in range(9, 111):
                mcFiller.AddPdfReweightIndex(idx) # 9-108: 260000 family, 109: 265000, 110: 266000
        else:
            print 'Unrecognized pdfrwgt option', analysis.custom['pdfrwgt']
            sys.exit(1)
        
    neroMod.AddFiller(mcFiller)


# neroMod must be independent of the main chain
# to ensure that the all events tree is filled properly
analysis.setSequence(initialFilterSequence * (preskimSequence + filterMods + postskimSequence) + neroMod)

analysis.SetUseHLT(False)
Esempio n. 9
0
goodPV = mithep.GoodPVFilterMod(
    MinVertexNTracks = 0,
    MinNDof = 4,
    MaxAbsZ = 24.,
    MaxRho = 2.,
    IsMC = True,
    VertexesName = mithep.Names.gkPVBrn
)

#plotMetDirect = mithep.MetCorrPlotMod('DirectMet',
#    InputName = 'PFMet',
#    CorrLevel = 1
#)

metCorr = mithep.MetCorrectionMod(
    CorrectedName = 'PFType1CorrectedMet',
    JetsName = 'AKt4PFJetsCHS',
    CorrectedJetsName = jetCorr.GetOutputName()
)
metCorr.ApplyType1(True)
metCorr.IsData(False)

plotMetCorr = mithep.MetCorrPlotMod('CorrMet',
    InputName = metCorr.GetOutputName(),
    CorrLevel = 0
)

#analysis.setSequence(plotJetDirect * jetCorr * plotJetCorr + goodPV * plotMetDirect * metCorr * plotMetCorr)
analysis.setSequence(plotJetDirect * jetCorr * plotJetCorr + goodPV * metCorr * plotMetCorr)
Esempio n. 10
0
from MitAna.TreeMod.bambu import mithep, analysis

from MitPhysics.Mods.GoodPVFilterMod import goodPVFilterMod
from MitPhysics.Mods.ElectronIdMod import electronIdMod

electronTightId = electronIdMod.clone(
    OutputName = 'GoodElectrons',
    IdType = mithep.ElectronTools.kPhys14Tight,
    IsoType = mithep.ElectronTools.kPhys14TightIso
)

eoverP = mithep.EOverPMod('EOverP', 'E/P',
    ElectronsName = eleId.GetOutputName(), # use the output of eleId as the input
    OutputName = 'EPSelectedElectrons',
    DoCopy = True,
    MinPt = 10.
)

outMod = mithep.OutputMod(
    FileName = 'TightEPElectrons',
    PathName = '.'
)
outMod.Drop('*')
outMod.Keep('Electrons')
outMod.AddNewBranch('EPSelectedElectrons')

 # Join the modules with * (dependent - the later modules will not execute if the earlier one aborts) or + (non-dependent)
analysis.setSequence(goodPVFilterMod * electronTightId * eoverP * outMod)
Esempio n. 11
0
#
outMod = mithep.OutputMod(
    UseBrDep = False,
    KeepTamBr = False,
    FileName = 'ntuples.root',
    MaxFileSize = 4096
)
outMod.Drop("*")
outMod.Keep(mithep.Names.gkMCEvtInfoBrn)
outMod.Keep(mithep.Names.gkMCPartBrn)
outMod.Keep(mithep.Names.gkPVBeamSpotBrn)
outMod.Keep(mithep.Names.gkPileupInfoBrn)
outMod.Keep(mithep.Names.gkPileupEnergyDensityBrn)
outMod.Keep("PFMet")

readMC = mithep.ReadMCWeights()

analysis.setSequence(
    goodPVFilterMod * 
    muonIdIsoMod * 
    eleIdMod * 
    photonIdMod * 
    pftauIdMod * 
#    pubAk4Jet * 
#    ak4JetId
    outMod *
    readMC
)

analysis.SetUseMC(True)
Esempio n. 12
0
#
#ak8JetId = mithep.JetIDMod(
#    InputName = pubAk8Jet.GetOutputName(),
#    PtCut = 30.0,
#    EtaMaxCut = 2.5,
#    JetEEMFractionMinCut = 0.00,
#    OutputName = "GoodAk8Jets"
#)
#
outMod = mithep.OutputMod(UseBrDep=False,
                          KeepTamBr=False,
                          FileName='ntuples.root',
                          MaxFileSize=4096)
outMod.Drop("*")
outMod.Keep(mithep.Names.gkMCEvtInfoBrn)
outMod.Keep(mithep.Names.gkMCPartBrn)
outMod.Keep(mithep.Names.gkPVBeamSpotBrn)
outMod.Keep(mithep.Names.gkPileupInfoBrn)
outMod.Keep(mithep.Names.gkPileupEnergyDensityBrn)
outMod.Keep("PFMet")

readMC = mithep.ReadMCWeights()

analysis.setSequence(goodPVFilterMod * muonIdIsoMod * eleIdMod * photonIdMod *
                     pftauIdMod *
                     #    pubAk4Jet *
                     #    ak4JetId
                     outMod * readMC)

analysis.SetUseMC(True)
Esempio n. 13
0
    ntuples.SetGenMetName(generator.GetMCMETName())
    ntuples.SetGenJetsName(storedGenJets.GetOutputName())

    if 'pdfrwgt' in analysis.custom and analysis.custom['pdfrwgt'] != '-':
        ntuples.SetPdfReweight(analysis.custom['pdfrwgt'])

    if jerVersion != '':
        smearedJets = mithep.JetCorrectionMod('JetSmearing',
            InputName = correctedJets.GetOutputName(),
            CorrectedJetsName = 'SmearedJets',
            GenJetsName = genJets.GetOutputJetsName()
        )

        jc = mithep.JetCorrector.Corrector
        for level, ftype in [('PtResolution', jc.kPtResolution), ('PhiResolution', jc.kPhiResolution), ('SF', jc.nFactorTypes)]:
            smearedJets.AddCorrectionFromFile(jecPattern.format(version = jerVersion, level = level), ftype)

        correctedMetJER = correctedMet.clone('MetCorrectionJER',
            OutputName = 'PFType1MetJER',
            JetsName = smearedJets.GetOutputName()
        )
    
        recoSequence *= smearedJets * correctedMetJER

        ntuples.SetJetsResCorrName(smearedJets.GetOutputName())
        ntuples.SetJetResMetName(correctedMetJER.GetOutputName())

ntuples.SetCondition(list(recoSequence)[-1])

analysis.setSequence(preskimSequence + (skim * recoSequence) + ntuples)
Esempio n. 14
0
# only contains on-the-fly JetId calculation (and therefore does not
# agree perfectly with other groups).

from MitAna.TreeMod.bambu import mithep, analysis
import os

mitdata = os.environ['MIT_DATA']

from MitPhysics.Mods.GoodPVFilterMod import goodPVFilterMod
from MitPhysics.Mods.SeparatePileUpMod import separatePileUpMod
from MitPhysics.Mods.ElectronIdMod import electronIdMod
from MitPhysics.Mods.MuonIdMod import muonIdMod
from MitPhysics.Mods.PFTauIdMod import pfTauIdMod
from MitPhysics.Mods.PhotonIdMod import photonIdMod
from MitPhysics.Mods.JetCorrectionMod import jetCorrectionMod
from MitPhysics.Mods.JetIdMod import jetIdMod
from MitPhysics.Mods.MetCorrectionMod import metCorrectionMod

preRun2Sync = mithep.PreRun2SynchExercise(
    VerticesName=mithep.Names.gkPVBrn,
    MetName=metCorrectionMod.GetOutputName(),
    JetsName=jetIdMod.GetOutputName(),
    ElectronsName=electronIdMod.GetOutputName(),
    MuonsName=muonIdMod.GetOutputName(),
    TausName=pfTauIdMod.GetOutputName(),
    PhotonsName=photonIdMod.GetOutputName())

analysis.setSequence(goodPVFilterMod * separatePileUpMod * electronIdMod *
                     muonIdMod * pfTauIdMod * photonIdMod * jetCorrectionMod *
                     jetIdMod * metCorrectionMod * preRun2Sync)
Esempio n. 15
0
from MitAna.TreeMod.bambu import mithep, analysis

goodPV = mithep.GoodPVFilterMod(
    VertexesName = 'PrimaryVertexes',
    OutputName = mithep.ModNames.gkGoodVertexesName,
    MinNDof = 4,
    MaxAbsZ = 24.,
    MaxRho = 2.,
    IsMC = True
)
 
eleId = mithep.ElectronIDMod(
    InputName = 'Electrons',
    OutputName = 'LooseElectrons',
    ApplyD0Cut = True,
    ApplyDZCut = True,
    PtMin = 20.,
    EtaMax = 2.2,
    ApplyEcalFiducial = True,
    RhoAlgo = mithep.PileupEnergyDensity.kFixedGridFastjetAll,
    IDType = mithep.ElectronTools.kPhys14Loose,
    IsoType = mithep.ElectronTools.kPhys14LooseIso
)

fill = mithep.FlatTreeFiller(
    ElectronsName = 'LooseElectrons'
)

analysis.SetUseHLT(False)
analysis.setSequence(goodPV * eleId * fill)
tagElectronIdMod = mithep.ElectronIdMod()
tagElectronIdMod.SetPtMin(25.)
tagElectronIdMod.SetEtaMax(2.4)
tagElectronIdMod.SetIdType(mithep.ElectronTools.kTight)
tagElectronIdMod.SetIsoType(mithep.ElectronTools.kNoIso)
tagElectronIdMod.SetApplyD0Cut(True)
tagElectronIdMod.SetApplyDZCut(True)
tagElectronIdMod.SetWhichVertex(0)
tagElectronIdMod.SetInputName('Electrons')
tagElectronIdMod.SetOutputName('TightElectrons')
tagElectronIdMod.SetPFNoPileupCandidatesName('pfNoPU')
tagElectronIdMod.SetPFPileupCandidatesName('pfPU')

probeElectronIdMod = mithep.ElectronIdMod()
probeElectronIdMod.SetPtMin(25.)
probeElectronIdMod.SetEtaMax(2.4)
probeElectronIdMod.SetIdType(mithep.ElectronTools.kLoose)
probeElectronIdMod.SetIsoType(mithep.ElectronTools.kNoIso)
probeElectronIdMod.SetApplyD0Cut(False)
probeElectronIdMod.SetApplyDZCut(False)
probeElectronIdMod.SetOutputName('LooseElectrons')
probeElectronIdMod.SetPFNoPileupCandidatesName('pfNoPU')
probeElectronIdMod.SetPFPileupCandidatesName('pfPU')

ntuplesMod = mithep.ElectronNtuples('ElectronNtuples', 'Flat ntuples producer')
ntuplesMod.SetTagElectronsName('TightElectrons')
ntuplesMod.SetProbeElectronsName('LooseElectrons')
ntuplesMod.SetTriggerObjectsName('SingleElectronTriggerObjects')

analysis.setSequence(hltMod * goodPVMod * pfPUMod * tagElectronIdMod * probeElectronIdMod * ntuplesMod)
Esempio n. 17
0
    PFCHSJetsName      = PFCHSJetCorrection.GetCorrectedJetsName(),
    L1PFPuppiJetsName  = L1PFPuppiJetCorrection.GetCorrectedJetsName(),
    PFPuppiJetsName    = PFPuppiJetCorrection.GetCorrectedJetsName(),
    CleanedJetsName    = PFPuppiJetCleaningMod.GetCleanName(),
    InvertedName       = puppiMod.GetInvertedName(),
    PFCandidateName    = removeBosonMod.GetOutputName(),
    BosonName          = removeBosonMod.GetBosonName(),
    PuppiParticlesName = puppiMod.GetOutputName(),
    UseEtaCut          = True,
    EtaCut             = 3.0
)

#analysis.setSequence(hltMod * goodPVMod
analysis.setSequence(goodPVMod
                     * separatePileUpMod 
                     * muonIdMod
                     * electronIdMod
                     * photonIdMod
                     * removeBosonMod 
                     * puppiMod
                     * puppiJets
                     * L1PFJetCorrection 
                     * PFJetCorrection 
                     * L1PFCHSJetCorrection
                     * PFCHSJetCorrection
                     * L1PFPuppiJetCorrection
                     * PFPuppiJetCorrection
                     * PFPuppiJetCleaningMod
                     * puppetFillerMod
)
Esempio n. 18
0
                                JetMinPt=3.)

    postskimSequence *= Chain([generator, mcParticlesNoNu, genJets])

    metFiller.SetGenMetName(generator.GetMCMETName())

    mcFiller = mithep.nero.MonteCarloFiller(
        GenJetsName=genJets.GetOutputJetsName())
    if 'pdfrwgt' in analysis.custom and analysis.custom['pdfrwgt'] != '-':
        if analysis.custom['pdfrwgt'] == 'amc_74':
            mcFiller.AddPdfReweightGroupName('PDF_variation')
        elif analysis.custom['pdfrwgt'] == 'mg5_74':
            mcFiller.AddPdfReweightGroupName('NNPDF30_lo_as_0130.LHgrid')
        elif analysis.custom['pdfrwgt'] == 'pwhg_74':
            for idx in range(9, 111):
                mcFiller.AddPdfReweightIndex(
                    idx)  # 9-108: 260000 family, 109: 265000, 110: 266000
        else:
            print 'Unrecognized pdfrwgt option', analysis.custom['pdfrwgt']
            sys.exit(1)

    neroMod.AddFiller(mcFiller)

# neroMod must be independent of the main chain
# to ensure that the all events tree is filled properly
analysis.setSequence(initialFilterSequence *
                     (preskimSequence + filterMods + postskimSequence) +
                     neroMod)

analysis.SetUseHLT(False)
Esempio n. 19
0
    PathName=".",
    CheckTamBr=False,
    KeepTamBr=False,
    CheckBrDep=True,
    UseBrDep=True)
output.Keep("*")
output.Drop("L1TechBits*")
output.Drop("L1AlgoBits*")
output.Drop("MCVertexes")
output.Drop("PFEcal*SuperClusters")
output.Drop("*Tracks")
output.Drop("StandaloneMuonTracksWVtxConstraint")
output.Drop("PrimaryVertexesBeamSpot")
output.Drop("InclusiveSecondaryVertexes")
output.Drop("CosmicMuons")
output.Drop("MergedElectronsStable")
output.Drop("MergedConversions*")
output.Drop("AKT8GenJets")
output.Drop("AKt4PFJets")
output.Drop("DCASig")
output.AddNewBranch(metCorrection.GetOutputName())
output.AddNewBranch(monojetSkim.GetCategoryFlagsName())
output.AddNewBranch(monophotonSkim.GetCategoryFlagsName())

output.AddCondition(skim)

analysis.setSequence(badEventsFilterMod * (
    (metCorrection * jetCorrection) + monojetPrefilter + monophotonPrefilter +
    (prefilter * goodPVFilterMod * electronId * muonId * photonId * jetId *
     (monojetSkim + monophotonSkim + skim))) + output)
from MitPhysics.Mods.ElectronIdMod import electronIdMod
from MitPhysics.Mods.MuonIdMod import muonIdMod
from MitPhysics.Mods.PFTauIdMod import pfTauIdMod
from MitPhysics.Mods.PhotonIdMod import photonIdMod
from MitPhysics.Mods.JetCorrectionMod import jetCorrectionMod
from MitPhysics.Mods.JetIdMod import jetIdMod
from MitPhysics.Mods.MetCorrectionMod import metCorrectionMod

preRun2Sync = mithep.PreRun2SynchExercise(
    VerticesName = mithep.Names.gkPVBrn,
    MetName = metCorrectionMod.GetOutputName(),
    JetsName = jetIdMod.GetOutputName(),
    ElectronsName = electronIdMod.GetOutputName(),
    MuonsName = muonIdMod.GetOutputName(),
    TausName = pfTauIdMod.GetOutputName(),
    PhotonsName = photonIdMod.GetOutputName()
)

analysis.setSequence(
    goodPVFilterMod *
    separatePileUpMod *
    electronIdMod *
    muonIdMod *
    pfTauIdMod *
    photonIdMod *
    jetCorrectionMod *
    jetIdMod *
    metCorrectionMod *
    preRun2Sync
)
Esempio n. 21
0
from MitAna.TreeMod.bambu import mithep, analysis

listMod = mithep.RunLumiListMod()

# RunLumiSelectionMod will be applied automatically from the command-line option to analysis.py / runOnDatasets.py

analysis.setSequence(listMod)

analysis.SetUseReadCache(False)