コード例 #1
0
ファイル: NLLPlot_combined.py プロジェクト: llechner/TTXPheno
        loadedSamples, 'fwlite_Zgamma_LO_order2_15weights_%s' % args.detector)
    ttgammaSample = getattr(
        loadedSamples,
        'fwlite_ttgamma_bg_LO_order2_15weights_%s' % args.detector)

    signal = [ttZSample, ttgamma1lSample, ttgamma2lSample]
    ttZBg = [WZSample, tWZSample, tZqSample, ttgammaSample]
    ttgammaBg = [ttSample, tWSample, tWZSample, tZqSample, ZgammaSample]

    def checkReferencePoint(sample):
        ''' check if sample is simulated with a reference point
        '''
        return pickle.load(file(sample.reweight_pkl))['ref_point'] != {}

    # set selection string
    ttZSelectionString = cutInterpreter.cutString(
        'lepSel3-onZ-njet3p-nbjet1p-Zpt0-leptonIso3')
    ttgamma1lSelectionString = cutInterpreter.cutString(
        'lepSel1-gammapt40-njet3p-nbjet1p-relIso0to0.12-met40-leptonIso1')
    ttgamma2lSelectionString = cutInterpreter.cutString(
        'lepSel2-gammapt40-njet2p-nbjet1p-relIso0to0.12-met40-leptonIso2')

    ttZSample.setSelectionString(ttZSelectionString)
    ttgamma1lSample.setSelectionString(ttgamma1lSelectionString)
    ttgamma2lSample.setSelectionString(ttgamma2lSelectionString)

    # somehow has to be separate from the next loop
    if args.small:
        for s in signal + ttZBg + ttgammaBg:
            s.reduceFiles(to=20)

    # configure samples
コード例 #2
0
    import TTXPheno.Tools.logger as logger
    import RootTools.core.logger as logger_rt
    logger    = logger.get_logger(   'INFO', logFile = None)
    logger_rt = logger_rt.get_logger('INFO', logFile = None)
    # TTXPheno
    from TTXPheno.Tools.cutInterpreterGen import cutInterpreter
    from TTXPheno.samples.benchmarks import * 

    # Sample
    sample = fwlite_ttZ_ll_LO_order2_15weights_ref
    # Debug 1 event
    sample.reduceFiles( to = 1 )
    w = WeightInfo(sample.reweight_pkl)
    w.set_order( 2 )

    selection_string = cutInterpreter.cutString('lepSel3-onZ-njet3p-nbjet1p-Zpt0')
    #selection_string = "evt==955001&&run==1&&lumi==9551"

    #    return [ histo_to_list(histo.ProjectionX("%i_px"%i, i+1, i+1)) for i in range( histo.GetNbinsY() ) ]
#   #     return histo_to_list( histo )

    # Fisher information in ptZ histo
    coeff_Z_pt = w.getCoeffPlotFromDraw( sample, 'genZ_pt', [ 20, 0, 500 ], selection_string, weightString='150*ref_lumiweight1fb')
    # Fisher information in x-sec
    #coeff_tot = getCoeffListFromDraw( sample, selection_string, weightString='150*lumiweight1fb')
    coeff_tot = w.getCoeffListFromDraw( sample, selection_string, weightString='150*ref_lumiweight1fb' )

    print w.get_weight_yield(coeff_tot, ctZ=0.),  w.get_weight_yield(coeff_tot, ctZ=5)


    #print(len(coeff_Z_pt))
コード例 #3
0
ファイル: signalRegion.py プロジェクト: llechner/TTXPheno
ttgammaSample   = getattr( loadedSamples, 'fwlite_ttgamma_bg_LO_order2_15weights_%s' %args.detector )

bg = [ WZSample, tZqSample, tWZSample, ttgammaSample ]
nonInfo = []
if args.nonInfoSignal:
    ttZISRSample  = copy.deepcopy( ttXSample ) #select ttgamma events with isolated gamma from ISR (cat a2)
    ttZISRSample.name = 'fwlite_nonInfo_LO_order2_15weights_ref'
    nonInfo.append( ttZISRSample)

def checkReferencePoint( sample ):
    ''' check if sample is simulated with a reference point
    '''
    return pickle.load(file(sample.reweight_pkl))['ref_point'] != {}

# set selection string
selectionString      = cutInterpreter.cutString(args.selection)
selectionString_up   = selectionString.replace('nBTag','nBTag_JEC_up').replace('nrecoJet','nrecoJets_JEC_up')
selectionString_down = selectionString.replace('nBTag','nBTag_JEC_down').replace('nrecoJet','nrecoJets_JEC_down')

# somehow has to be separate from the next loop
if args.small:
    for s in [ttXSample] + bg + nonInfo:
        s.reduceFiles( to = 30 )

# configure samples
for i, s in enumerate([ttXSample] + bg + nonInfo):

    s.shortname = s.name.split('_')[1]
    s.event_factor = s.nEvents / float( s.chain.GetEntries() )
    s.xsecScaleFactor = s.xsec14 / s.xsec if args.scale14TeV else 1.
    s.weightInfo = WeightInfo( s.reweight_pkl )
コード例 #4
0
    def __init__(self, name, relative_fraction):
        self.name = name
        self.relative_fraction = relative_fraction

    def setSelectionString(self, *args, **kwargs):
        pass


# Lumi
lumi = 150

# Backgrounds
backgrounds = [FakeBackground("bkg1", .1), FakeBackground("bkg2", .2)]

# set selection string
selectionString = cutInterpreter.cutString('lepSel3-onZ-njet3p-nbjet1p')
for sample in [ttZ_sample] + list(backgrounds):
    sample.setSelectionString(
        cutInterpreter.cutString('lepSel3-onZ-njet3p-nbjet1p'))

# parameter point
params = {'ctZ': 0., 'ctZI': 0.}  # Can specify any EFT parameter here

observation = {}
signal_jec_uncertainty = {}
signal_fakerate_uncertainty = {}
ttZ_SM_rate = {}
ttZ_SM_jec_uncertainty = {}
ttZ_SM_fakerate_uncertainty = {}
background_rate = {}
background_jec_uncertainty = {}