Exemplo n.º 1
0
    def __init__(self, chain, new_chain, is_reco_level=True, **kwargs):
        self.chain = chain
        self.new_chain = new_chain

        self.chain.strategy = kwargs.get('strategy')
        self.chain.region = kwargs.get('region')
        self.chain.selection = kwargs.get('selection')
        self.additional_options = kwargs.get('additional_options', None)

        self.chain.obj_sel = getObjectSelection(self.chain.selection)

        self.event_category = EventCategory(self.chain)
        self.event_selector = EventSelector(
            self.chain.region,
            self.chain,
            self.new_chain,
            is_reco_level=is_reco_level,
            event_categorization=self.event_category,
            additional_options=self.additional_options)
Exemplo n.º 2
0
        max_events = 20000
        event_range = xrange(max_events) if max_events < len(
            sample.getEventRange(args.subJob)) else sample.getEventRange(
                args.subJob)
    else:
        event_range = sample.getEventRange(args.subJob)

    #
    # Get luminosity weight
    #
    from HNL.Weights.lumiweight import LumiWeight
    lw = LumiWeight(sample, sample_manager)

    from HNL.EventSelection.eventCategorization import EventCategory
    try:
        ec = EventCategory(chain)
    except:
        ec = None

    #
    # Define event selection
    #
    event = Event(chain,
                  chain,
                  is_reco_level=True,
                  selection=args.selection,
                  strategy='MVA',
                  region=region_to_select)

    #
    # Create fake rate objects
Exemplo n.º 3
0
    if args.removeOverlap:
        if 'DYJets' in sample.name and chain._zgEventType>=3: continue
        if sample.name == 'ZG' and chain._hasInternalConversion: continue

    if args.genSkim:
        if not select3GenLeptons(chain, new_vars):      continue
    elif not args.oldAnalysisSkim:
        # if not select3Leptons(chain, new_vars, light_algo=args.lightLeptonSelection, tau_algo=args.tauSelection):       continue
        select3Leptons(chain, new_vars, light_algo=args.lightLeptonSelection, tau_algo=args.tauSelection, workingpoint = 'loose')
        if len(chain.leptons) < 3:       continue
    else:
        select3Leptons(chain, new_vars, light_algo='cutbased', workingpoint = 'tight', no_tau = True, cutter = cutter)
        if len(chain.leptons) < 3:       continue

    
    ec = EventCategory(new_vars)
    c = ec.returnCategory()
    new_vars.event_category = c

    print 'calcing'
    calculateGeneralVariables(chain, new_vars, is_reco_level=not args.genSkim)
    calculateThreeLepVariables(chain, new_vars, is_reco_level=not args.genSkim)
    new_vars.lumiweight = lw.getLumiWeight()
    output_tree.Fill()

# print output_name.split('.')[-1]+'_cutflow.root'
# cutter.saveCutFlow(output_name.split('.')[-1]+'_cutflow.root')


output_tree.AutoSave()
#if hcounter is not None: