示例#1
0
    def connect(self):
        '''Retrieves the relevant information
        (e.g. files location) for each component.
        To avoid multiple connections to the database
        is production == True, it checks for a cached
        pickle file containing all the info.

        FIXME! RIC: this should be done by default,
        but I make the use of the cached pickle explicit
        because the name of the parent dataset, and
        therefore the number of events and the
        computing efficiency, is not
        saved in the pickle file, and it can only be retrieved
        through a query to the database. This is
        necessary at the analysis level, but not at
        the production stage, where the only bit of info
        that's really needed is the location of the files.
        Should revisit the way the pickle file is saved
        so that ALL the relevant info is stored there.
        '''
        if self.production:
            self.connect_by_pck_()
        else:
            self.connect_by_db_()

        self.pruneSampleList_()
        for sample in self.MC_list:
            sample.splitFactor = splitFactor(sample, self.splitFactor)
示例#2
0
 def listify_(self):
     ''' '''
     self.MC_list = [v for k, v in self.mc_dict.items()]
     for sam in self.MC_list:
         sam.splitFactor     = splitFactor(sam, self.splitFactor)
         sam.fineSplitFactor = self.fineSplitFactor
         if self.triggers == 'mt': sam.triggers = mc_triggers_mt
         if self.triggers == 'et': sam.triggers = mc_triggers_et
         if self.triggers == 'tt': sam.triggers = mc_triggers_tt
         if self.triggers == 'em': sam.triggers = mc_triggers_em
示例#3
0
        sam.triggers = data_triggers_2012C
    elif '2012D' in sam.name:
        sam.triggers = data_triggers_2012D

allsamples1 = copy.copy( mc_higgs )
allsamples1.extend( ztt_mc_ewk )
allsamples1.extend( embed_list )
allsamples1.extend( mc_higgs_susy )

pat1 = '%HTT_Feb6_hinzmann_Nom'
connect( allsamples1, pat1, 'diTau.*root', aliases, cache=True, verbose=False)

allsamples2 = copy.copy( data_2012 )
allsamples2.extend( t_mc_ewk )
allsamples2.extend( mc_diboson_incl )
allsamples2.extend( w_mc_ewk )
pat2 = '%V5_8_0/HTT_Sep12_hinzmann'
connect( allsamples2, pat2, 'diTau.*root', aliases, cache=True, verbose=False)

allsamples = copy.copy(allsamples1)
allsamples.extend(allsamples2)

DYJets.nGenEvents /= 0.8 ## overall trigger efficiency in MC

for h in mc_higgs :
  h.nGenEvents /= 0.8 ## overall trigger efficiency in MC

for c in allsamples:
    c.splitFactor = splitFactor(c)

示例#4
0
# pat3 = '%HTT_22Jul_manzoni_Down'
pat3 = '%HTT_24Jul_newTES_manzoni_Down'

connect( allsamples0, pat0, 'diTau.*root', aliases, cache=True, verbose=False)
connect( allsamples1, pat1, 'diTau.*root', aliases, cache=True, verbose=False)
connect( allsamples2, pat2, 'diTau.*root', aliases, cache=True, verbose=False)
connect( allsamples3, pat3, 'diTau.*root', aliases, cache=True, verbose=False)

cache = True
T_tW.files = getFiles('/T_tW-channel-DR_TuneZ2star_8TeV-powheg-tauola/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/PAT_CMG_V5_16_0/HTT_22Jul_manzoni_Nom', 'manzoni', 'diTau_fullsel.*root', cache)
T_tW.nGenEvents = 497658.

#TTJetsHadronic.nGenEvents = 31223821.
#TTJetsHadronic.xSection = 249.5*0.676*0.676*0.96

TTJets_emb.files = getFiles('/TTJets_FullLeptMGDecays_8TeV-madgraph/StoreResults-Summer12_DR53X_PU_S10_START53_V7A_v1_ReplaceRecMuons_RHembedded_trans1_tau132_pthad1_30had2_30_v1-f456bdbb960236e5c696adfe9b04eaae/USER/V5_B/PAT_CMG_V5_16_0/HTT_22Jul_manzoni_Nom', 'manzoni', 'diTau_fullsel.*root', cache)
TTJets_emb.nGenEvents = 4243699.
TTJets_emb.xSection = 249.5 * (1-0.676)*(1-0.676)*0.96

allsamples = copy.copy( allsamples1 )
allsamples.extend( allsamples2 )
allsamples.extend( allsamples3 )

for c in allsamples:
    c.splitFactor = int(100*splitFactor(c)/1)

# when stitching
WJets.nGenEvents += WJets_v2.nGenEvents


示例#5
0


MC_list = copy.copy( mc_ewk )
MC_list.extend( mc_diboson_inc ) 
    
allsamples = copy.copy(MC_list)
allsamples.extend( data_list )

# the pattern provided to this function is a SQL pattern.
# % represents the wildcard.
# this pattern allows to select a whole group of samples.

connect( allsamples, '%CMGPF_V5_16_0', 'cmgTuple.*root', aliases, cache=True, verbose=False)


# guessing the best split factor for each component,
# to get about the same number of events in each job
for c in allsamples:
    c.splitFactor = splitFactor(c, nEventsPerJob=2e5)

# picking up the json file automatically. Here, we use the dcs jsons.
for data in data_list:
    if len(data.files):
        data.json = jsonPick( data.files[0], jsonMap )


if __name__ == '__main__':
    from CMGTools.RootTools.fwlite.Config import printComps
    printComps(allsamples, True)
示例#6
0
###################################################
###                   OPTIONS                   ###
###################################################
# Get all heppy options; set via "-o production" or "-o production=True"
# production = True run on batch, production = False (or unset) run locally
production         = getHeppyOption('production' , False)
pick_events        = getHeppyOption('pick_events', False)
###################################################
###               HANDLE SAMPLES                ###
###################################################
samples = [BdKstEE]

for sample in samples:
    sample.triggers  = ['HLT_DoubleMu3_Trk_Tau3mu_v%d' %i for i in range(3, 12)]
    sample.splitFactor = splitFactor(sample, 2e4)
    sample.puFileData = puFileData
    sample.puFileMC   = puFileMC

selectedComponents = samples

###################################################
###                  ANALYSERS                  ###
###################################################
eventSelector = cfg.Analyzer(
    EventSelector,
    name='EventSelector',
    toSelect=[4148011548]
)

lheWeightAna = cfg.Analyzer(
示例#7
0
    '/WZJetsTo3LNu.*START42.*': 'WZJetsTo3LNu',
    '/ZZJetsTo2L2Nu.*START42.*': 'ZZJetsTo2L2Nu',
    '/ZZJetsTo2L2Q.*START42.*': 'ZZJetsTo2L2Q',
    '/ZZJetsTo4L.*START42.*': 'ZZJetsTo4L',
}

MC_list = copy.copy(mc_ewk)
MC_list.extend(mc_higgs)
MC_list.extend(mc_diboson)
for sam in MC_list:
    sam.triggers = mc_triggers
for data in data_list_2011A:
    data.triggers = data_triggers_2011A
for data in data_list_2011B:
    data.triggers = data_triggers_2011B

allsamples = copy.copy(MC_list)
allsamples.extend(data_list_2011)
allsamples.extend(embed_list_2011)

connect(allsamples,
        '%TAUMU_2011_Colin_Oct24',
        'tauMu.*root',
        aliases,
        cache=True,
        verbose=False)
Tbar_tW.nGenEvents = 809984.

for c in allsamples:
    c.splitFactor = splitFactor(c)
示例#8
0
]
for dy in mc_dy:
    dy.nevents = dy_nevents

# Attach number of generated events for stitching
w_nevents = [
    WJets.nGenEvents, W1Jets.nGenEvents, W2Jets.nGenEvents, W3Jets.nGenEvents,
    W4Jets.nGenEvents
]
for w in mc_w:
    w.nevents = w_nevents

print[(s.name, s.dataset_entries) for s in allsamples if s.dataset_entries]
print[(s.name, s.dataset_entries) for s in allsamples if not s.dataset_entries]

for mc in MC_list:
    mc.triggers = mc_triggers
    # allsamples.append(mc)
for data in data_list:
    if len(data.files):
        data.json = jsonPick(data.files[0], jsonMap)
        data.triggers = data_triggers
        # allsamples.append(data)
for embed in embed_list:
    if len(embed.files):
        embed.json = jsonPick(embed.files[0], jsonMap)
        embed.triggers = embed_triggers
        # No trigger requirements for embedded samples
for c in allsamples:
    c.splitFactor = splitFactor(c, 5e4)
示例#9
0
# Add trigger corrections for the prompt lepton l0
MU_PROMPT_SFS = dc(MU_SFS)
MU_PROMPT_SFS['trigger'] = (SF_FILE, 'm_trg24_27_kit')

###################################################
###               HANDLE SAMPLES                ###
###################################################
samples = all_samples + all_signals
# samples = [TTJets, TTJets_ext]
###################################################

# FIXME! are trigger names and filters correct regardless of the year?
# triggers same for 2018: https://tomc.web.cern.ch/tomc/triggerPrescales/2018//?match=Ele
for sample in samples:
    sample.triggers = triggers_ele_mc + triggers_mu_mc
    sample.splitFactor = splitFactor(sample, 7e5)
    if sample in all_signals:
        sample.splitFactor = splitFactor(sample, 5e5)
        
    sample.puFileMC   = '$CMSSW_BASE/src/CMGTools/HNL/data/pileup/mc/2018/MC_PileUp_2018_Autumn18.root'
    sample.puFileData = '$CMSSW_BASE/src/CMGTools/HNL/data/pileup/data/2018/Data_PileUp_2018_69p2.root'

selectedComponents = samples

###################################################
# set to True if you want to run interactively on a selected portion of samples/files/whatnot
testing = True 
if testing:
    # run on a single component
    # comp = samples[0]
    # comp.files = comp.files[:1]
示例#10
0
n_events_per_job = 1e6
if test:
    n_events_per_job = 1e5
    if embedded:
        n_events_per_job = 3e4

for sample in selectedComponents:
    if data:
        sample.triggers = data_triggers
        sample.triggerobjects = data_triggerfilters
        if embedded:
            sample.triggerobjects = embedded_triggerfilters
    else:
        sample.triggers = mc_triggers
        sample.triggerobjects = mc_triggerfilters
    sample.splitFactor = splitFactor(sample, n_events_per_job)
    sample.channel = 'tt'

if test:
    cache = True
    selectedComponents = [selectedComponents[0]]
    for comp in selectedComponents:
        comp.files = comp.files[:1]
        comp.splitFactor = 1
        comp.fineSplitFactor = 1

events_to_pick = []


#KIT's skimming function
def skim_KIT(event):
示例#11
0
    '/DoubleMu/Run2011B-16Jan2012-v1/AOD/V5/PAT_CMG_V5_6_0_B$':'data_Run2011B',
    '/DoubleMu/Run2011A-16Jan2012-v1/AOD/V5/PAT_CMG_V5_6_0_B$':'data_Run2011A',
    '/TTJets.*START42.*/VertexWeight':'TTJets',
    '/WWJetsTo2L2Nu.*START42.*/VertexWeight':'WWJetsTo2L2Nu',
    '/WZJetsTo2L2Q.*START42.*/VertexWeight':'WZJetsTo2L2Q',
    '/WZJetsTo3LNu.*START42.*/VertexWeight':'WZJetsTo3LNu',
    '/ZZJetsTo2L2Nu.*START42.*/VertexWeight':'ZZJetsTo2L2Nu',
    '/ZZJetsTo2L2Q.*START42.*/VertexWeight':'ZZJetsTo2L2Q',
    '/ZZJetsTo4L.*START42.*/VertexWeight':'ZZJetsTo4L',
    }


data_list = data_list_2011

MC_list = copy.copy( mc_ewk )
MC_list.extend( mc_diboson ) 
    
allsamples = copy.copy(MC_list)
allsamples.extend( data_list_2011 )

connect( allsamples, '%PAT_CMG_V5_6_0_B%', 'cmgTuple.*root', aliases, cache=True, verbose=False)

for c in allsamples:
    c.splitFactor = splitFactor(c, nEventsPerJob=2e5)

for data in data_list:
    if len(data.files):
        data.json = jsonPick( data.files[0])


    WJetsToLNu, WJetsToLNu_ext, TTJets
]
#samples = all_signals_m
auxsamples = []  #[ttbar, DYJetsToLL_M50]

# samples = [comp for comp in samples if comp.name=='TTJets_amcat']

for sample in samples + auxsamples:
    sample.triggers = ['HLT_IsoMu24_v%d' % i
                       for i in range(1, 15)]  #muon trigger
    sample.triggers += ['HLT_IsoMu27_v%d' % i
                        for i in range(1, 15)]  #muon trigger
    sample.triggers += ['HLT_Mu50_v%d' % i
                        for i in range(1, 15)]  #muon trigger

    sample.splitFactor = splitFactor(sample, 1e5)

selectedComponents = samples

###################################################
###                  ANALYSERS                  ###
###################################################
eventSelector = cfg.Analyzer(EventSelector,
                             name='EventSelector',
                             toSelect=[326])

lheWeightAna = cfg.Analyzer(LHEWeightAnalyzer,
                            name="LHEWeightAnalyzer",
                            useLumiInfo=False)

jsonAna = cfg.Analyzer(
示例#13
0
###################################################
###                   OPTIONS                   ###
###################################################
# Get all heppy options; set via "-o production" or "-o production=True"
# production = True run on batch, production = False (or unset) run locally
production = getHeppyOption('production', False)
pick_events = getHeppyOption('pick_events', False)
###################################################
###               HANDLE SAMPLES                ###
###################################################
samples = [HN3L_M_7_V_0p00547722557505_mu_onshell]

for sample in samples:
    sample.triggers = ['HLT_IsoMu24_v%d' % i for i in range(4, 5)]
    sample.splitFactor = splitFactor(sample, nEventsPerJob=1e5)
    sample.puFileData = puFileData
    sample.puFileMC = puFileMC

selectedComponents = samples

###################################################
###                  ANALYSERS                  ###
###################################################
eventSelector = cfg.Analyzer(EventSelector, name='EventSelector', toSelect=[])

lheWeightAna = cfg.Analyzer(LHEWeightAnalyzer,
                            name="LHEWeightAnalyzer",
                            useLumiInfo=False)

jsonAna = cfg.Analyzer(
示例#14
0
文件: hn3l_cfg.py 项目: mschoene/HNL
def generateKeyConfigs(samples,production, promptLeptonType, L1L2LeptonType, isData, isSignal):
    import os
    from collections import OrderedDict
    import PhysicsTools.HeppyCore.framework.config as cfg
    from PhysicsTools.HeppyCore.framework.config     import printComps
    from PhysicsTools.HeppyCore.framework.heppy_loop import getHeppyOption
    from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
    from CMGTools.RootTools.utils.splitFactor import splitFactor

    # import Heppy analyzers:
    from PhysicsTools.Heppy.analyzers.core.JSONAnalyzer      import JSONAnalyzer
    from PhysicsTools.Heppy.analyzers.core.SkimAnalyzerCount import SkimAnalyzerCount
    from PhysicsTools.Heppy.analyzers.core.EventSelector     import EventSelector
    from PhysicsTools.Heppy.analyzers.objects.VertexAnalyzer import VertexAnalyzer
    from PhysicsTools.Heppy.analyzers.core.PileUpAnalyzer    import PileUpAnalyzer
    from PhysicsTools.Heppy.analyzers.gen.GeneratorAnalyzer  import GeneratorAnalyzer
    from PhysicsTools.Heppy.analyzers.gen.LHEWeightAnalyzer  import LHEWeightAnalyzer

    from CMGTools.H2TauTau.proto.analyzers.TriggerAnalyzer   import TriggerAnalyzer

    # import HNL analyzers:
    from CMGTools.HNL.analyzers.HNLAnalyzer        import HNLAnalyzer
    from CMGTools.HNL.analyzers.HNLTreeProducer    import HNLTreeProducer
    from CMGTools.HNL.analyzers.HNLGenTreeAnalyzer import HNLGenTreeAnalyzer
    from CMGTools.HNL.analyzers.RecoGenAnalyzer    import RecoGenAnalyzer
    from CMGTools.HNL.analyzers.TriggerAnalyzer    import TriggerAnalyzer
    from CMGTools.HNL.analyzers.JetAnalyzer        import JetAnalyzer
    from CMGTools.HNL.analyzers.METFilter          import METFilter
    from CMGTools.HNL.analyzers.LeptonWeighter     import LeptonWeighter
    from pdb import set_trace

    ###################################################
    ###                   OPTIONS                   ###
    ###################################################
    # Get all heppy options; set via "-o production" or "-o production=True"
    # production = True run on batch, production = False (or unset) run locally

    production         = getHeppyOption('production' , production)
    pick_events        = getHeppyOption('pick_events', False)

    promptLeptonType = promptLeptonType # choose from 'ele' or 'mu'
    L1L2LeptonType = L1L2LeptonType  #choose from 'ee', 'mm', 'em'

    ###################################################
    ###               HANDLE SAMPLES                ###
    ###################################################

    #samples = [comp for comp in samples if comp.name=='TTJets_amcat']
    if promptLeptonType == 'ele':
        for sample in samples:
            sample.triggers  = ['HLT_Ele27_WPTight_Gsf_v%d'          %i for i in range(1, 15)] #electron trigger
            sample.triggers += ['HLT_Ele32_WPTight_Gsf_v%d'          %i for i in range(1, 15)] #electron trigger
            sample.triggers += ['HLT_Ele35_WPTight_Gsf_v%d'          %i for i in range(1, 15)] #electron trigger
            sample.triggers += ['HLT_Ele115_CaloIdVT_GsfTrkIdT_v%d'  %i for i in range(1, 15)] #electron trigger
            sample.triggers += ['HLT_Ele135_CaloIdVT_GsfTrkIdT_v%d'  %i for i in range(1, 15)] #electron trigger
            sample.splitFactor = splitFactor(sample, 1e5)
    if promptLeptonType == 'mu':
        for sample in samples:
            sample.triggers  = ['HLT_IsoMu24_v%d' %i for i in range(1, 15)] #muon trigger
            sample.triggers += ['HLT_IsoMu27_v%d' %i for i in range(1, 15)] #muon trigger
            sample.triggers += ['HLT_Mu50_v%d'    %i for i in range(1, 15)] #muon trigger
            sample.splitFactor = splitFactor(sample, 1e5)

    selectedComponents = samples

    ###################################################
    ###                  ANALYZERS                  ###
    ###################################################
    eventSelector = cfg.Analyzer(
        EventSelector,
        name='EventSelector',
        toSelect=[326]
    )

    lheWeightAna = cfg.Analyzer(
        LHEWeightAnalyzer, name="LHEWeightAnalyzer",
        useLumiInfo=False
    )

    jsonAna = cfg.Analyzer(
        JSONAnalyzer,
        name='JSONAnalyzer',
    )

    skimAna = cfg.Analyzer(
        SkimAnalyzerCount,
        name='SkimAnalyzerCount'
    )

    triggerAna = cfg.Analyzer(
        TriggerAnalyzer,
        name='TriggerAnalyzer',
        addTriggerObjects=True,
        requireTrigger=True,
        usePrescaled=False,
        unpackLabels=True,
    )

    vertexAna = cfg.Analyzer(
        VertexAnalyzer,
        name='VertexAnalyzer',
        fixedWeight=1,
        keepFailingEvents=False,
        verbose=False
    )

    pileUpAna = cfg.Analyzer(
        PileUpAnalyzer,
        name='PileUpAnalyzer',
        true=True
    )

    metFilter = cfg.Analyzer(
        METFilter,
        name='METFilter',
        processName='PAT',  #mschoene: Filters very much do exist in MC and most of them should be applied to MC as well, but not all!
        fallbackProcessName = 'RECO',
        triggers=[
            'Flag_goodVertices',
            'Flag_globalSuperTightHalo2016Filter',
            'Flag_HBHENoiseFilter',
            'Flag_HBHENoiseIsoFilter',
            'Flag_EcalDeadCellTriggerPrimitiveFilter',
            'Flag_BadPFMuonFilter',
            'Flag_BadChargedCandidateFilter',
            'Flag_eeBadScFilter',
            'Flag_ecalBadCalibFilter',
        ]
    )

    HNLTreeProducer = cfg.Analyzer(
        HNLTreeProducer,
        name='HNLTreeProducer',
        L1L2LeptonType=L1L2LeptonType,
        promptLepType=promptLeptonType,
    )

    HNLGenTreeAnalyzer = cfg.Analyzer(
        HNLGenTreeAnalyzer,
        name='HNLGenTreeAnalyzer',
    )

    RecoGenAnalyzer = cfg.Analyzer(
        RecoGenAnalyzer,
        name='RecoGenAnalyzer',
    )

    genAna = GeneratorAnalyzer.defaultConfig
    genAna.allGenTaus = True # save in event.gentaus *ALL* taus, regardless whether hadronic / leptonic decay

    # for each path specify which filters you want the electrons/muons to match to
    triggers_and_filters = OrderedDict()

    if promptLeptonType == 'ele':
        triggers_and_filters['HLT_Ele27_WPTight_Gsf']         = 'hltEle27WPTightGsfTrackIsoFilter'
        triggers_and_filters['HLT_Ele32_WPTight_Gsf']         = 'hltEle32WPTightGsfTrackIsoFilter'
        triggers_and_filters['HLT_Ele35_WPTight_Gsf']         = 'hltEle35noerWPTightGsfTrackIsoFilter'
        triggers_and_filters['HLT_Ele115_CaloIdVT_GsfTrkIdT'] = 'hltEle115CaloIdVTGsfTrkIdTGsfDphiFilter'
        triggers_and_filters['HLT_Ele135_CaloIdVT_GsfTrkIdT'] = 'hltEle135CaloIdVTGsfTrkIdTGsfDphiFilter'

    if promptLeptonType == 'mu':
        triggers_and_filters['HLT_IsoMu24'] = 'hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3trkIsoFiltered0p07'
        triggers_and_filters['HLT_IsoMu27'] = 'hltL3crIsoL1sMu22Or25L1f0L2f10QL3f27QL3trkIsoFiltered0p07'
        triggers_and_filters['HLT_Mu50']    = 'hltL3fL1sMu22Or25L1f0L2f10QL3Filtered50Q'

    HNLAnalyzer = cfg.Analyzer(
        HNLAnalyzer,
        name='HNLAnalyzer',
        promptLepton=promptLeptonType,
        L1L2LeptonType=L1L2LeptonType,
        triggersAndFilters=triggers_and_filters,
        candidate_selection='maxpt',
    )

    if promptLeptonType == 'ele':
        Weighter_l0 = cfg.Analyzer(
            LeptonWeighter,
            name='LeptonWeighter_l0',
            scaleFactorFiles={
                'trigger' :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_trg_SingleEle_Ele32OREle35_desy'),
                'idiso'   :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_id'),
                'tracking':('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_iso'),
            },
            dataEffFiles={
                # 'trigger':('$CMSSW_BASE/src/CMGTools/H2TauTau/data/htt_scalefactors_v16_2.root', 'm_trgIsoMu22orTkIsoMu22_desy'),
            },
            getter = lambda event : event.the_3lep_cand.l0(),
            disable=False
        )

    if promptLeptonType == 'mu':
        Weighter_l0 = cfg.Analyzer(
            LeptonWeighter,
            name='LeptonWeighter_l0',
            scaleFactorFiles={
                'trigger' :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_trg_SingleMu_Mu24ORMu27_desy'),
                'idiso'   :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_id'),
                'tracking':('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_iso'),
            },
            dataEffFiles={
                # 'trigger':('$CMSSW_BASE/src/CMGTools/H2TauTau/data/htt_scalefactors_v16_2.root', 'm_trgIsoMu22orTkIsoMu22_desy'),
            },
            getter = lambda event : event.the_3lep_cand.l0(),
            disable=False
        )

    if L1L2LeptonType == 'mm':
        Weighter_l1 = cfg.Analyzer(
            LeptonWeighter,
            name='LeptonWeighter_l1',
            scaleFactorFiles={
                'idiso'   :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_id'),
                'tracking':('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_iso'),
            },
            dataEffFiles={
                # 'trigger':('$CMSSW_BASE/src/CMGTools/H2TauTau/data/htt_scalefactors_v16_2.root', 'm_trgIsoMu22orTkIsoMu22_desy'),
            },
            getter = lambda event : event.the_3lep_cand.l1(),
            disable=True
        )
        Weighter_l2 = cfg.Analyzer(
            LeptonWeighter,
            name='LeptonWeighter_l2',
            scaleFactorFiles={
                'idiso'   :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_id'),
                'tracking':('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_iso'),
            },
            dataEffFiles={
                # 'trigger':('$CMSSW_BASE/src/CMGTools/H2TauTau/data/htt_scalefactors_v16_2.root', 'm_trgIsoMu22orTkIsoMu22_desy'),
            },
            getter = lambda event : event.the_3lep_cand.l2(),
            disable=True
        )

    if L1L2LeptonType == 'em':
        Weighter_l1 = cfg.Analyzer(
            LeptonWeighter,
            name='LeptonWeighter_l1',
            scaleFactorFiles={
                'idiso'   :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_id'),
                'tracking':('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_iso'),
            },
            dataEffFiles={
                # 'trigger':('$CMSSW_BASE/src/CMGTools/H2TauTau/data/htt_scalefactors_v16_2.root', 'm_trgIsoMu22orTkIsoMu22_desy'),
            },
            getter = lambda event : event.the_3lep_cand.l1(),
            disable=True
        )
        Weighter_l2 = cfg.Analyzer(
            LeptonWeighter,
            name='LeptonWeighter_l2',
            scaleFactorFiles={
                'idiso'   :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_id'),
                'tracking':('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'm_iso'),
            },
            dataEffFiles={
                # 'trigger':('$CMSSW_BASE/src/CMGTools/H2TauTau/data/htt_scalefactors_v16_2.root', 'm_trgIsoMu22orTkIsoMu22_desy'),
            },
            getter = lambda event : event.the_3lep_cand.l2(),
            disable=True
        )

    if L1L2LeptonType == 'ee':
        Weighter_l1 = cfg.Analyzer(
            LeptonWeighter,
            name='LeptonWeighter_l1',
            scaleFactorFiles={
                'idiso'   :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_id'),
                'tracking':('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_iso'),
            },
            dataEffFiles={
                # 'trigger':('$CMSSW_BASE/src/CMGTools/H2TauTau/data/htt_scalefactors_v16_2.root', 'm_trgIsoMu22orTkIsoMu22_desy'),
            },
            getter = lambda event : event.the_3lep_cand.l1(),
            disable=True
        )
        Weighter_l2 = cfg.Analyzer(
            LeptonWeighter,
            name='LeptonWeighter_l2',
            scaleFactorFiles={
                'idiso'   :('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_id'),
                'tracking':('$CMSSW_BASE/src/CMGTools/HNL/data/leptonsf/htt_scalefactors_v17_1.root', 'e_iso'),
            },
            dataEffFiles={
                # 'trigger':('$CMSSW_BASE/src/CMGTools/H2TauTau/data/htt_scalefactors_v16_2.root', 'm_trgIsoMu22orTkIsoMu22_desy'),
            },
            getter = lambda event : event.the_3lep_cand.l2(),
            disable=True
        )

    # see SM HTT TWiki
    # https://twiki.cern.ch/twiki/bin/viewauth/CMS/SMTauTau2016#Jet_Energy_Corrections
    jetAna = cfg.Analyzer(
        JetAnalyzer,
        name              = 'JetAnalyzer',
        jetCol            = 'slimmedJets',
        jetPt             = 20.,
        jetEta            = 5.,
        relaxJetId        = False, # relax = do not apply jet ID
        relaxPuJetId      = True, # relax = do not apply pileup jet ID
        jerCorr           = False,
        puJetIDDisc       = 'pileupJetId:fullDiscriminant',
        recalibrateJets   = False,
        applyL2L3Residual = 'MC',
        # RM: FIXME! check the GTs
    #    mcGT              = '94X_mc2017_realistic_v14',
    #    dataGT            = '94X_dataRun2_v6',
        #jesCorr = 1., # Shift jet energy scale in terms of uncertainties (1 = +1 sigma)
    )
    ###################################################
    ###                  SEQUENCE                   ###
    ###################################################
    if isData == True:
        sequence = cfg.Sequence([
        #     eventSelector,
            jsonAna,
            skimAna,
            triggerAna,
            vertexAna,
            pileUpAna,
            HNLAnalyzer,
            jetAna,
            metFilter,
            HNLTreeProducer,
        ])

    if isData == False:
        if isSignal == True:
            sequence = cfg.Sequence([
            #     eventSelector,
                lheWeightAna, # les houches
                jsonAna,
                skimAna,
                triggerAna,
                vertexAna,
                pileUpAna,
                genAna,
                HNLGenTreeAnalyzer,
                # RecoGenAnalyzer,
                HNLAnalyzer,
                Weighter_l0, 
                Weighter_l1, 
                Weighter_l2, 
                jetAna,
                metFilter,
                HNLTreeProducer,
            ])
        if isSignal == False:
            sequence = cfg.Sequence([
            #     eventSelector,
                lheWeightAna, # les houches
                jsonAna,
                skimAna,
                triggerAna,
                vertexAna,
                pileUpAna,
                genAna,
                HNLGenTreeAnalyzer,
                HNLAnalyzer,
                Weighter_l0, 
                Weighter_l1, 
                Weighter_l2, 
                jetAna,
                metFilter,
                HNLTreeProducer,
            ])

    ###################################################
    ###            SET BATCH OR LOCAL               ###
    ###################################################
    if not production:
    #     comp                 = HN3L_M_2p5_V_0p0173205080757_e_onshell
    #     comp                 = HN3L_M_2p5_V_0p00707106781187_e_onshell
        # comp                 = all_signals_e[0]
        # comp                 = DYJetsToLL_M50
        comp                 = samples[0]
        # comp                 = samples
    #     comp                 = ttbar
        # comp                 = bkg
        selectedComponents   = [comp]
        comp.splitFactor     = 1
        comp.fineSplitFactor = 1
        comp.files           = comp.files[:1] #mschoene: for testing it's much quicker to run just on the first file

    ###################################################
    ###            PREPROCESSOR                     ###
    ###################################################
    preprocessor = True  #mschoene: for false it will use EOSEventsWithDownload, which actually copies the file, which is extremely slow

    #temporary copy remote files using xrd
    from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
    from CMGTools.HNL.utils.EOSEventsWithDownload import EOSEventsWithDownload
    event_class = EOSEventsWithDownload if not preprocessor else Events

    EOSEventsWithDownload.aggressive = 2 # always fetch if running on Wigner
    EOSEventsWithDownload.long_cache = getHeppyOption('long_cache', False)

    #    if preprocessor: preprocessor.prefetch = prefetch #mschoene: removed as unused

    # if extrap_muons_to_L1:
        # fname = '$CMSSW_BASE/src/CMGTools/WTau3Mu/prod/muon_extrapolator_cfg.py'
        # sequence.append(fileCleaner)
        # preprocessor = CmsswPreprocessor(fname, addOrigAsSecondary=False)

    # if compute_mvamet:
        # fname = '$CMSSW_BASE/src/CMGTools/WTau3Mu/prod/compute_mva_met_data_cfg.py'
        # sequence.append(fileCleaner)
        # preprocessor = CmsswPreprocessor(fname, addOrigAsSecondary=False)

    # the following is declared in case this cfg is used in input to the heppy.py script
    config = cfg.Config(
        components   = selectedComponents,
        sequence     = sequence,
        services     = [],
        #        preprocessor = preprocessor, #mschoene: removed as unused
        events_class = event_class
    )

    printComps(config.components, True)

    return config
示例#15
0
sequence.append(treeProducer)

if syncntuple:
    sequence.append(syncTreeProducer)

###################################################

# Minimal list of samples

if computeSVfit:
    split_factor = 5e3

for sample in samples:
    sample.triggers = mc_triggers
    sample.triggerobjects = mc_triggerfilters
    sample.splitFactor = splitFactor(sample, nevts_per_file)
    sample.puFileData = puFileData
    sample.puFileMC = puFileMC

for sample in data_list:
    sample.triggers = data_triggers
    sample.triggerobjects = data_triggerfilters
    sample.splitFactor = splitFactor(sample, split_factor)

# Samples to be processed
selectedComponents = samples

if pick_events:
    eventSelector.toSelect = [71838, 55848]
    sequence.insert(0, eventSelector)
if cmssw:
    tauMuAna.from_single_objects = False

# Minimal list of samples
samples = backgrounds_mu + sm_signals + sync_list + mssm_signals

split_factor = 1e5

if computeSVfit:
    split_factor = 5e3

for sample in samples:
    sample.triggers = mc_triggers
    sample.triggerobjects = mc_triggerfilters
    sample.splitFactor = splitFactor(sample, split_factor)
    sample.puFileData = puFileData
    sample.puFileMC = puFileMC

data_list = data_single_muon

for sample in data_list:
    sample.triggers = data_triggers
    sample.triggerobjects = data_triggerfilters
    sample.splitFactor = splitFactor(sample, split_factor)
    sample.json = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions15/13TeV/Cert_246908-260627_13TeV_PromptReco_Collisions15_25ns_JSON_v2.txt'
    sample.lumi = 2260.


###################################################
###             SET COMPONENTS BY HAND          ###
示例#17
0
                                     "/Tau/Run2015B-PromptReco-v1/MINIAOD", 
                                     "CMS", 
                                     ".*root", 
                                     "/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions15/13TeV/DCSOnly/json_DCSONLY_Run2015B.txt"
                                     )

MC_list = [ggh160]

run2015B.intLumi  = '2.0' # in pb
run2015B.triggers = mc_triggers_tt

split_factor = 1e5

for sample in MC_list:
    sample.triggers = mc_triggers_tt
    sample.splitFactor = splitFactor(sample, split_factor)
    
data_list = [run2015B]

###################################################
###              ASSIGN PU to MC                ###
###################################################
for mc in MC_list:
    mc.puFileData = puFileData
    mc.puFileMC = puFileMC

###################################################
###             SET COMPONENTS BY HAND          ###
###################################################
selectedComponents = MC_list #+ data_list
# selectedComponents = mc_dict['HiggsGGH125']
示例#18
0
# from CMGTools.Production.getFiles import getFiles
from CMGTools.RootTools.utils.connect import connect
from CMGTools.RootTools.utils.splitFactor import splitFactor

from CMGTools.H2TauTau.proto.samples.phys14.higgs import mc_higgs
from CMGTools.H2TauTau.proto.samples.phys14.triggers_tauMu import mc_triggers

aliases = {
    '/GluGluToHToTauTau.*Phys14DR.*' : 'HiggsGGH',
    '/VBF_HToTauTau_M-125_13TeV-powheg-pythia6.*Phys14DR.*' : 'HiggsVBF',
}

# dictionarize
mc_dict = {}
for s in mc_higgs:
    mc_dict[s.name] = s

MC_list = [v for k, v in mc_dict.items()]#[mc_dict['HiggsGGH125'], mc_dict['HiggsVBF125']]
for sam in MC_list:
    # Set MC triggers
    sam.triggers = mc_triggers

connect(MC_list, '%TAUMU_MINIAOD_SVFIT25ns_steggema', '.*root', aliases, cache=True, verbose=False)

MC_list = [m for m in MC_list if m.files]

for sample in MC_list:
    sample.splitFactor = splitFactor(sample, 10e4)