示例#1
0
def make_puCorrector(dataset, kind=None):
    if not kind:
        kind = 'S6' if is7TeV else 'S10'
    if dataset is 'doublemu':
        return PileupWeight.PileupWeight( 'S6' if is7TeV else 'S10', *pu_distributions_doublemu)
    elif dataset is 'doublee':
        return PileupWeight.PileupWeight( 'S6' if is7TeV else 'S10', *pu_distributions_doublee)
    return None
示例#2
0
def make_puCorrectorDown(dataset, kind=None):
    'makes PU reweighting according to the pu distribution of the reference data and the MC, MC distribution can be forced'
    if not kind:
        kind = mc_pu_tag
    if dataset in pu_distributions:
        return PileupWeight.PileupWeight( 'S6' if is7TeV else 'MC_Moriond17', *(pu_distributionsDown[dataset]))
    else:
        raise KeyError('dataset not present. Please check the spelling or add it to mcCorrectors.py')
示例#3
0
 def __init__(self, tree, outfile, **kwargs):
     super(WHAnalyzeMMT, self).__init__(tree, outfile, MuMuTauTree,
                                        **kwargs)
     # Hack to use S6 weights for the one 7TeV sample we use in 8TeV
     target = os.environ['megatarget']
     if 'HWW3l' in target:
         print "HACK using S6 PU weights for HWW3l"
         global pu_corrector
         pu_corrector = PileupWeight.PileupWeight('S6', *pu_distributions)
示例#4
0
def make_puCorrector(dataset, kind=None):
    'makes PU reweighting according to the pu distribution of the reference data and the MC, MC distribution can be forced'
    if not kind:
        kind = mc_pu_tag
    weights = []
    if dataset in pu_distributions:  # and dataset in pu_distributionsUp and dataset in pu_distributionsDown:
        return PileupWeight.PileupWeight('S6' if is7TeV else 'S10',
                                         *(pu_distributions[dataset]))


#        weights = (PileupWeight.PileupWeight( 'S6' if is7TeV else 'S10', *(pu_distributions[dataset])), PileupWeight.PileupWeight( 'S6' if is7TeV else 'S10', *(pu_distributionsUp[dataset])), PileupWeight.PileupWeight( 'S6' if is7TeV else 'S10', *(pu_distributionsDown[dataset])))
#        return weights
    else:
        raise KeyError(
            'dataset not present. Please check the spelling or add it to mcCorrectors.py'
        )
示例#5
0
    'fit_efficiency',  # workspace name
    'efficiency')

################################################################################
#### MC-DATA and PU corrections ################################################
################################################################################

# Determine MC-DATA corrections
is7TeV = bool('7TeV' in os.environ['jobid'])
print "Is 7TeV:", is7TeV

# Make PU corrector from expected data PU distribution
# PU corrections .root files from pileupCalc.py
pu_distributions = glob.glob(
    os.path.join('inputs', os.environ['jobid'], 'data_DoubleMu*pu.root'))
pu_corrector = PileupWeight.PileupWeight('S6' if is7TeV else 'S7',
                                         *pu_distributions)

muon_pog_PFTight_2011 = MuonPOGCorrections.make_muon_pog_PFTight_2011()
muon_pog_PFTight_2012 = MuonPOGCorrections.make_muon_pog_PFTight_2012()

muon_pog_PFRelIsoDB02_2011 = MuonPOGCorrections.make_muon_pog_PFRelIsoDB02_2011(
)
muon_pog_PFRelIsoDB02_2012 = MuonPOGCorrections.make_muon_pog_PFRelIsoDB02_2012(
)

muon_pog_Mu17Mu8_Mu17_2012 = MuonPOGCorrections.make_muon_pog_Mu17Mu8_Mu17_2012(
)
muon_pog_Mu17Mu8_Mu8_2012 = MuonPOGCorrections.make_muon_pog_Mu17Mu8_Mu8_2012()

# takes etas of muons
muon_pog_Mu17Mu8_2011 = MuonPOGCorrections.muon_pog_Mu17Mu8_eta_eta_2011
示例#6
0
    den = math.sqrt(xth)

    mass = row.m_t_Mass / den

    #print '%4.2f, %4.2f, %4.2f, %4.2f, %4.2f' %(scaleMass(row), den, xth, METproj,mass)

    return mass


pu_distributions = glob.glob(
    os.path.join(
        #    'inputs', os.environ['jobid'], 'data_TauPlusX*pu.root'))
        'inputs',
        os.environ['jobidpu'],
        'data_SingleMu*pu.root'))
pu_corrector = PileupWeight.PileupWeight('Asympt25ns', *pu_distributions)


def fakeWeight(row):
    if row.tDecayMode == 0:
        return 0.62  # 0.81
    if row.tDecayMode == 1:
        return 0.76  #0.80
    if row.tDecayMode == 10:
        return 0.44  #0.44


class AnalyzeLFVMuTau(MegaBase):
    tree = 'mt/final/Ntuple'

    #tree = 'New_Tree'