Esempio n. 1
0
    rate[region] = {}

    ttX_coeffList                     = ttXSample.weightInfo.getCoeffListFromDraw( ttXSample, selectionString = region.cutString() )
    rate[region][ttXSample.shortname] = ttXSample.weightInfo.get_weight_yield( ttX_coeffList )

    for i_background, background in enumerate(bg):
        rate[region][background.shortname] = background.getYieldFromDraw( selectionString=region.cutString() )['val']

    if args.nonInfoSignal:
        nonInfo_coeffList       = ttZISRSample.weightInfo.getCoeffListFromDraw( ttZISRSample, selectionString = region.cutString() )
        rate[region]['nonInfo'] = ttZISRSample.weightInfo.get_weight_yield( nonInfo_coeffList )

    if args.addNonPrompt:
        # scale nonprompt observation value from Run2 to args.luminosity
        rate[region]['nonPrompt'] = getObservationValue( args.additionalCardFile, args.addBinNumberShift + i_region, 'nonPromptDD' ) * float(args.luminosity) / 35.9

    if args.addOthers:
        rate[region]['rare'] = getObservationValue( args.additionalCardFile, args.addBinNumberShift + i_region, 'rare' ) * float(args.luminosity) / 35.9
        rate[region]['ttW'] = getObservationValue( args.additionalCardFile, args.addBinNumberShift + i_region, 'TTW' ) * float(args.luminosity) / 35.9
        rate[region]['ZZ'] = getObservationValue( args.additionalCardFile, args.addBinNumberShift + i_region, 'ZZ' ) * float(args.luminosity) / 35.9
        rate[region]['ZG'] = getObservationValue( args.additionalCardFile, args.addBinNumberShift + i_region, 'ZG' ) * float(args.luminosity) / 35.9

    if args.parameters is not None:
        rate[region]['signal'] = ttXSample.weightInfo.get_weight_yield( ttX_coeffList, **params)
        if args.nonInfoSignal: rate[region]['signal'] += ttZISRSample.weightInfo.get_weight_yield( nonInfo_coeffList, **params )

for i_region, region in enumerate(regions):

    totalUncertainty = 0
Esempio n. 2
0
                    background_rate_reweighted_down = background.getYieldFromDraw(
                        selectionString=region.cutString())['val']
                    # reset selectionstring
                    background.setSelectionString(selectionString)
                    #calculate JES uncert.
                    background_jes_uncertainty[region][background.name] = 1 + (
                        (background_rate_reweighted_up -
                         background_rate_reweighted_down) /
                        (2 * background_rate[region][background.name])
                    ) if background_rate[region][background.name] > 0 else 1.

            nonPromptObservation[region] = 0.
            if args.addNonPrompt:
                # scale nonprompt observation value from Run2 to args.luminosity
                nonPromptObservation[region] = getObservationValue(
                    args.additionalCardFile, args.addBinNumberShift + i_region,
                    'nonPromptDD') * float(args.luminosity) / 35.9

            # Our expected observation :-)
            # add nonPrompt observation to total observation
            observation[region] = int(
                round(
                    sum(background_rate[region].values()) +
                    ttX_SM_rate[region] + nonPromptObservation[region]))

    # Write temporary card file
    from TTXPheno.Tools.cardFileWriter import cardFileWriter
    #    c = cardFileWriter.cardFileWriter()
    if args.useCombine:
        from TTXPheno.Tools.user import combineReleaseLocation
#        c.releaseLocation = combineReleaseLocation