Example #1
0
    def __init__(self, indir="./METSkim_v1", outdir='./output/stacker/',
                 channel='inclusive',  whichregion='SR', zpt_cut='100', met_cut= '100',  lumi = 2.318278305,  
                 sepSig=True, LogY=True, doRatio=True, addSig=True, addData=True, scaleDphi=False, onlyStats=False):
        self.outdir=outdir
        self.channel=channel
        self.whichregion=whichregion
        self.zpt_cut, self.met_cut = zpt_cut, met_cut
        self.lumi=lumi
        CheckDir(self.outdir) # if not, this will create it
        #channel='inclusive'#raw_input("Please choose a channel (el or mu): \n")
        self.tag0='ZJstudy'
                
        self.plotter_dd = InitializePlotter(indir=indir, addSig=addSig, addData=addData, doRatio=doRatio, scaleDphi=scaleDphi, onlyStats=onlyStats)

        self.plotter = InitializePlotter(indir=indir, addSig=addSig, addData=addData, doRatio=doRatio, onlyStats=onlyStats)
        self.plotter.Stack.rmPlotter(self.plotter.ZJets, "ZJets","Z+Jets", "background")
        
        setcuts = SetCuts()
        self.cuts_eld = setcuts.abcdCuts(channel=self.channel, whichRegion=whichregion, zpt_cut=zpt_cut, met_cut=met_cut)
        zjcuts = setcuts.GetZjetsCuts(whichRegion=whichregion, zpt_cut=zpt_cut, met_cut=met_cut)
        self.cuts = zjcuts[self.channel]
        
        # self.fabsDphi={'A': "fabs(llnunu_deltaPhi)",
        #                'B': "fabs(llnunu_deltaPhi)+TMath::Pi()/4",
        #                'C': "fabs(llnunu_deltaPhi)+TMath::Pi()/2",
        #                'D': "fabs(llnunu_deltaPhi)+TMath::Pi()*3/4"}
        self.fabsDphi="fabs(llnunu_deltaPhi)"
        
        # et1="TMath::Sqrt(llnunu_l1_pt*llnunu_l1_pt+llnunu_l1_mass*llnunu_l1_mass)"
        # et2="TMath::Sqrt(llnunu_l2_pt*llnunu_l2_pt+llnunu_l1_mass*llnunu_l1_mass)"
        # newMtB='TMath::Sqrt(2.0*(llnunu_l1_mass*llnunu_l1_mass+'+et1+'*'+et2+'-llnunu_l1_pt*llnunu_l2_pt*cos('+self.fabsDphi['B']+')))'
        # newMtC='TMath::Sqrt(2.0*(llnunu_l1_mass*llnunu_l1_mass+'+et1+'*'+et2+'-llnunu_l1_pt*llnunu_l2_pt*cos('+self.fabsDphi['C']+')))'
        # newMtD='TMath::Sqrt(2.0*(llnunu_l1_mass*llnunu_l1_mass+'+et1+'*'+et2+'-llnunu_l1_pt*llnunu_l2_pt*cos('+self.fabsDphi['D']+')))'
        # self.Mt={'A':'llnunu_mt',
        #          'B':newMtB,
        #          'C':newMtC,
        #          'D':newMtD}
        self.Mt='llnunu_mt'
        
        self.mtxbins=[150,200,250,300,350,400,450,550,850]
        self.mtnbins, self.mtxmin, self.mtxmax= len(self.mtxbins), min(self.mtxbins), max(self.mtxbins)#14, 150.0, 850.0
                        
        
        ROOT.gROOT.ProcessLine('.x ../src/tdrstyle.C')
        ROOT.gStyle.SetPadBottomMargin(0.2)
        ROOT.gStyle.SetPadLeftMargin(0.15)
Example #2
0
whichbcd = 'zjets' if doSub else 'allmc'

tag = tag0 + '_' + 'printer'
outTag = outdir + '/' + tag

CheckDir(outdir)
outtxt = open(outdir + '/num_out.txt', 'a')

### ----- Initialize (samples):
plotter = InitializePlotter(indir=indir)

setcuts = SetCuts()
#cuts=setcuts.abcdCuts(channel=channel, whichRegion=whichregion, zpt_cut=zpt_cut, met_cut=met_cut)
#preselect=setcuts.abcdCuts(channel=channel, whichRegion=whichregion, zpt_cut=zpt_cut, met_cut=met_cut,isPreSelect=True)
zjcuts = setcuts.GetZjetsCuts(whichRegion=whichregion,
                              zpt_cut=zpt_cut,
                              met_cut=met_cut)
cuts = zjcuts[channel]

outtxt.write('\n' + '*' * 20 + '\n')
outtxt.write('\n' + whichregion + '\n')
for reg in cuts:
    outtxt.write(reg + " " + channel + " : " + cuts[reg] + '\n' + '-' * 20 +
                 '\n')

histo = OrderedDict()  # will have histo[<reg>]=[h1, h2...]
yields = OrderedDict()  # will have yields[<reg>][<memeber>]=yield
err = OrderedDict()  # will have yields[<reg>][<memeber>]=err
nbins, xmin, xmax = 32, 0.0, 3.2
members = {
    'non-zjets': plotter.NonZBG,