Ejemplo n.º 1
0
    def conclude(self) :
        for configId, tag in enumerate(self.sideBySideAnalysisTags()) :
            org=organizer.organizer( self.sampleSpecs(tag) )
            org.mergeSamples(targetSpec = {"name":"g_jets_mg", "color":r.kGreen},
                             sources = ["g_jets_mg_pt%s"%bin for bin in ["40_100","100_200","200"] ])
            org.scale(10)

            pl = plotter.plotter(org, psFileName = self.psFileName(tag))
            pl.plotAll()

            def drawCut(hist,cut) :
                line = r.TLine(cut,0,cut,hist.GetMaximum())
                line.SetLineColor(r.kBlue)
                line.SetLineStyle(r.kDashed)
                r.SetOwnership( line, False )
                line.Draw("same")
            def drawOne() :
                one = r.TF1("one","1",0,5)
                one.SetLineColor(r.kRed)
                one.SetLineStyle(r.kDashed)
                one.SetLineWidth(1)
                r.SetOwnership(one,False)
                one.Draw("same")

            import utils
            r.gStyle.SetOptStat(0)
            c = r.TCanvas("c","",800,1000)
            outDir = self.outputDirectory(configId)+"/"
            for s in org.samples : c.Print(outDir+s["name"]+".ps[")
            iSelection = -4
            for key in sorted(org.selections[iSelection]):
                if key == "counts" : continue
                for hist,sample in zip(org.selections[iSelection][key],org.samples) :
                    if not hist : continue
                    ctr = hist.ProjectionX(hist.GetName()+"_ctr",0,2)
                    fwd = hist.ProjectionX(hist.GetName()+"_fwd",3)
                    if min(ctr.GetEntries(),fwd.GetEntries()) < 10: continue

                    leg = r.TLegend(0.52,0.7,0.9,0.9);
                    ctr.Scale(1/ctr.Integral());  ctr.SetLineColor(r.kBlack);  ctr.SetMarkerColor(r.kBlack); leg.AddEntry(ctr,"Central","lp")
                    fwd.Scale(1/fwd.Integral());  fwd.SetLineColor(r.kRed);    fwd.SetMarkerColor(r.kRed); leg.AddEntry(fwd,"Forward","lp")
                    ratio = utils.ratioHistogram(fwd,ctr)

                    m = 2*max(fwd.GetMaximum(),ctr.GetMaximum())
                    fwd.SetMaximum(m)
                    ctr.SetMaximum(m)
                    ratio.SetMinimum(0); ratio.SetMaximum(2)
                    ratio.SetTitle("fwd/ctr")

                    c.Clear(); c.Divide(1,2); 
                    c.cd(1).SetLogy(); ctr.Draw(); fwd.Draw("same"); drawCut(ctr,0.55); leg.Draw()
                    c.cd(2); ratio.Draw(); drawOne(); drawCut(ratio,0.55)
                    c.Print(outDir+sample["name"]+".ps")

            for s in org.samples :
                fileName = outDir+s["name"]+".ps]"
                c.Print(fileName)
                fileNamePDF = fileName.replace(".ps]",".pdf")
                os.system("ps2pdf "+fileName[:-1] + " " + fileNamePDF)
                print fileNamePDF, "has been printed."
Ejemplo n.º 2
0
 def conclude(self) :
     for tag in self.sideBySideAnalysisTags() :
         org=organizer.organizer( self.sampleSpecs(tag) )
         pl = plotter.plotter(org,
                              psFileName = self.psFileName(tag),
                              blackList = ["lumiHisto","xsHisto","nJobsHisto"]
                              )
         pl.plotAll()
Ejemplo n.º 3
0
    def conclude(self) :
        for tag in self.sideBySideAnalysisTags() :
            #organize
            org=organizer.organizer( self.sampleSpecs(tag) )
            org.mergeSamples(targetSpec = {"name":"g_jets_mg",     "color":r.kGreen},   sources = ["g_jets_mg_pt%s"%bin for bin in ["40_100","100_200","200"] ])
            #org.mergeSamples(targetSpec = {"name":"qcd_py"   ,     "color":r.kBlue},    sources = ["qcd_py_pt%d"%i         for i in [30,80,170,300,470,800,1400] ])
            #org.mergeSamples(targetSpec = {"name":"standard_model","color":r.kGreen+3},
            #                 sources = ["g_jets_mg","qcd_py","tt_tauola_mg","z_inv_mg_skim","z_jets_mg_skim","w_jets_mg_skim"], keepSources = True
            #                 )
            org.scale(100)

            #plot
            pl = plotter.plotter(org,
                                 psFileName = self.psFileName(tag),
                                 samplesForRatios=("JetMET_skim","standard_model"),
                                 sampleLabelsForRatios=("ctr","fwd"),
                                 )
            pl.plotAll()

            import utils
            c = r.TCanvas("c","",800,1000)
            for key in org.selections[-1]:
                if key == "counts" : continue
                for hist,sample in zip(org.selections[-1][key],org.samples) :
                    if not hist : continue
                    c.Clear()
                    c.Divide(1,2)
                    c.cd(1).SetLogy()
                    div = 1 if "z" in key else 2
                    ctr = hist.ProjectionX(hist.GetName()+"_ctr",0,div)
                    fwd = hist.ProjectionX(hist.GetName()+"_fwd",div+1)
                    if max(ctr.GetEntries(),fwd.GetEntries()) < 10: continue

                    ctr.Scale(1/ctr.Integral())
                    fwd.Scale(1/fwd.Integral())

                    ctr.SetLineColor(r.kBlack);  ctr.SetMarkerColor(r.kBlack)
                    fwd.SetLineColor(r.kRed);    fwd.SetMarkerColor(r.kRed)

                    leg = r.TLegend(0.52,0.7,0.9,0.9);
                    leg.AddEntry(ctr,"Central","lp")
                    leg.AddEntry(fwd,"Forward","lp")
                    m = 2*max(fwd.GetMaximum(),ctr.GetMaximum())
                    fwd.SetMaximum(m)
                    ctr.SetMaximum(m)
                    ctr.Draw("")
                    fwd.Draw("same")
                    leg.Draw()
                    c.cd(2)
                    ratio = utils.ratioHistogram(fwd,ctr)
                    ratio.SetMaximum(2)
                    one = r.TF1("one","1",0,5)
                    one.SetLineColor(r.kRed)
                    one.SetLineStyle(r.kDashed)
                    one.SetLineWidth(1)
                    ratio.Draw()
                    one.Draw("same")
                    c.Print(sample["name"]+'_'+key+"normSlice.eps")
Ejemplo n.º 4
0
    def conclude(self) :
        org=organizer.organizer( self.sampleSpecs() )
        org.mergeSamples(targetSpec = {"name":"qcd_py6","color":r.kBlue}, sources = ["qcd_py6_pt%d"%i for i in [15,30,80] ])
        org.scale(100.0)

        pl = supy.plotter(org,
                             pdfFileName = self.pdfFileName(""),
                             )
        pl.plotAll()
Ejemplo n.º 5
0
    def conclude(self) :
        for tag in self.sideBySideAnalysisTags() :
            #organize
            org=organizer.organizer( self.sampleSpecs(tag) )
            org.mergeSamples(targetSpec = {"name":"g_jets_mg",     "color":r.kGreen},   sources = ["g_jets_mg_pt%s"%bin for bin in ["40_100","100_200","200"] ])
            
            smSources = ["g_jets_mg","tt_tauola_mg","z_inv_mg_skim","z_jets_mg_skim","w_jets_mg_skim"]
            if "pythia6" in tag :
                org.mergeSamples(targetSpec = {"name":"qcd_py6",    "color":r.kBlue},    sources = ["qcd_py6_pt%d"%i      for i in [80,170,300] ])
                smSources.append("qcd_py6")
            if "pythia8" in tag :
                lowerPtList = [0,15,20,30,50,80,
                               120,170,230,300,380,470,600,800,
                               1000,1400,1800,2200,2600,3000,3500]
                org.mergeSamples(targetSpec = {"name":"qcd_py8","color":r.kBlue},
                                 sources = ["qcd_py8_pt%dto%d"%(lowerPtList[i],lowerPtList[i+1]) for i in range(len(lowerPtList)-1)] )
                smSources.append("qcd_py8")
            if "madgraph" in tag :
                org.mergeSamples(targetSpec = {"name":"qcd_mg",    "color":r.kBlue},
                                 sources = ["qcd_mg_ht_%s"%bin for bin in ["50_100","100_250","250_500","500_1000","1000_inf"] ])
                smSources.append("qcd_mg")
            
            org.mergeSamples(targetSpec = {"name":"standard_model","color":r.kGreen+3}, sources = smSources, keepSources = True)
            org.scale()


            def makeRate(hist,total,name) :
                if (not hist) or (not total): return 0
                hist.Scale(1./total)
                hist.SetMaximum(0.91)
                hist.GetXaxis().SetTitle("")
                if hist.GetYaxis().GetNbins()>1:
                    hist.GetYaxis().SetTitle("")
                    hist.GetZaxis().SetTitle("rate")
                else:
                    hist.GetYaxis().SetTitle("rate")
                    hist.SetTitle(name)
                return 1
                
            for iSel,selection in enumerate(org.selections) :
                if len(selection)>1 :
                    totals = tuple(map(lambda h: h.GetBinContent(2) if h else 0, selection["counts"]))
                    totals2 = tuple(map(lambda h: h.GetBinContent(1)+h.GetBinContent(2) if h else 0, org.selections[iSel+1]["counts"])) if \
                              iSel+1<len(org.selections) else [0]*len(totals)
                    totals = map(max,totals,totals2)
                    for name in selection:
                        if "VetoCounts" in name : 
                            result = map(makeRate, selection[name],totals, [name]*len(totals))

            pl = plotter.plotter(org,
                                 psFileName = self.psFileName(tag),
                                 samplesForRatios=("JetMET_skim","standard_model"),
                                 sampleLabelsForRatios=("data","s.m."),
                                 #compactOutput=True
                                 )
            pl.plotAll()
Ejemplo n.º 6
0
def main():
    media = ['.jpg', '.mp4', '.mp3', '.png', '.jpeg']
    programs = ['.deb', '.tar.gz', '.tar.bz2', '.exe', '.msi', '.AppImage', '.tar.xz', '.tgz']
    code = ['.py', '.js', '.html', '.css', '.jar', '.cpp', '.c', '.rs', '.cs', '.php', '.sh']
    compress = ['.zip', '.rar', '.7zip']
    text = ['.doc', '.docx', '.pdf', '.txt', '.log', '.odt', '.ppt', '.pptx']

    user_system_type = platform.system()
    user_name = getpass.getuser()
    folderSystem.detect_create_folders(user_name, user_system_type, 'MEDIA')
    folderSystem.detect_create_folders(user_name, user_system_type, 'PROGRAMS')
    folderSystem.detect_create_folders(user_name, user_system_type, 'TEXT')
    folderSystem.detect_create_folders(user_name, user_system_type, 'CODE')
    folderSystem.detect_create_folders(user_name, user_system_type, 'COMPRESS')
    folderSystem.detect_create_folders(user_name, user_system_type, 'OTHER')
    organizer.organizer(user_name, programs, 'PROGRAMS', user_system_type)
    organizer.organizer(user_name, text, 'TEXT', user_system_type)
    organizer.organizer(user_name, media, 'MEDIA', user_system_type)
    organizer.organizer(user_name, code, 'CODE', user_system_type)
    organizer.organizer(user_name, compress, 'COMPRESS', user_system_type)
    organizer.organizer_other(user_name, user_system_type)
Ejemplo n.º 7
0
    def conclude(self) :
        for tag in self.sideBySideAnalysisTags() :
            #organize
            org=organizer.organizer( self.sampleSpecs(tag) )
            self.mergeSamples(org, tag)
            org.scale()

            pl = plotter.plotter(org,
                                 psFileName = self.psFileName(tag),
                                 samplesForRatios=("2010 Data","standard_model"),
                                 sampleLabelsForRatios=("data","s.m."),
                                 )
            pl.plotAll()
Ejemplo n.º 8
0
    def conclude(self) :
        for tag in self.sideBySideAnalysisTags() :

            org=organizer.organizer( self.sampleSpecs(tag) )
            org.mergeSamples(targetSpec = {"name":"qcd_py8", "color":r.kBlue}, allWithPrefix="qcd_py8")
            org.mergeSamples(targetSpec = {"name":"2010 Data", "color":r.kBlack, "markerStyle":20}, allWithPrefix="Run2010")
            org.scale()

            pl = supy.plotter(org,
                                 pdfFileName = self.pdfFileName(tag),
                                 samplesForRatios=("2010 Data","qcd_py8"),
                                 sampleLabelsForRatios=("data","qcd"),
                                 )
            pl.plotAll()
Ejemplo n.º 9
0
 def conclude(self) :
     #organize
     org = organizer.organizer( self.sampleSpecs() )
     #org.scale()
         
     ##plot
     #pl = plotter.plotter(org,
     #                     psFileName = self.psFileName(),
     #                     doLog = False,
     #                     #compactOutput = True,
     #                     #noSci = True,
     #                     #pegMinimum = 0.1,
     #                     blackList = ["lumiHisto","xsHisto","nJobsHisto"],
     #                     )
     #pl.plotAll()
     
     self.makeXsPlot(org, "", "scan_tanbeta10_tanja1")
Ejemplo n.º 10
0
    def conclude(self) :
        for tag in self.sideBySideAnalysisTags() :
            #organize
            org=organizer.organizer( self.sampleSpecs(tag) )
            org.mergeSamples(targetSpec = {"name":"g_jets_mg",     "color":r.kGreen},   sources = ["g_jets_mg_pt%s"%bin for bin in ["40_100","100_200","200"] ])
            
            smSources = ["g_jets_mg","tt_tauola_mg","z_inv_mg_skim","z_jets_mg_skim","w_jets_mg_skim"]
            if "pythia6" in tag :
                org.mergeSamples(targetSpec = {"name":"qcd_py6",    "color":r.kBlue},    sources = ["qcd_py6_pt%d"%i      for i in [80,170,300] ])
                smSources.append("qcd_py6")
            if "pythia8" in tag :
                lowerPtList = [0,15,20,30,50,80,
                               120,170,230,300,380,470,600,800,
                               1000,1400,1800,2200,2600,3000,3500]
                org.mergeSamples(targetSpec = {"name":"qcd_py8","color":r.kBlue},
                                 sources = ["qcd_py8_pt%dto%d"%(lowerPtList[i],lowerPtList[i+1]) for i in range(len(lowerPtList)-1)] )
                smSources.append("qcd_py8")
            if "madgraph" in tag :
                org.mergeSamples(targetSpec = {"name":"qcd_mg",    "color":r.kBlue},
                                 sources = ["qcd_mg_ht_%s"%bin for bin in ["50_100","100_250","250_500","500_1000","1000_inf"] ])
                smSources.append("qcd_mg")
            
            org.mergeSamples(targetSpec = {"name":"standard_model","color":r.kGreen+3}, sources = smSources, keepSources = True)
            org.scale()


            ##other
            #import deltaPhiLook
            #numers = ["JetMET_skim","standard_model"]
            #if "pythia" in tag :   qcdLabel = "qcd_py"
            #if "madgraph" in tag : qcdLabel = "qcd_mg"
            #
            #for numer,denom in zip(numers,[qcdLabel]*len(numers)) :
            #    d = deltaPhiLook.deltaPhiLooker(org,tag,(numer,denom))
            #    d.makeSlicePlots()
            #    if numer==numers[0] :
            #        d.makeSliceComparisonPlots(qcdLabel)

            #plot
            pl = plotter.plotter(org,
                                 psFileName = self.psFileName(tag),
                                 samplesForRatios=("JetMET_skim","standard_model"),
                                 sampleLabelsForRatios=("data","s.m."),
                                 )
            pl.plotAll()
Ejemplo n.º 11
0
 def conclude(self) :
     ##for skimming only
     #org = organizer.organizer( self.sampleSpecs() )
     #utils.printSkimResults(org)            
         
     #organize
     org=organizer.organizer( self.sampleSpecs() )
     #org.scale()
         
     ##plot
     #pl = supy.plotter(org,
     #                     pdfFileName = self.pdfFileName(),
     #                     doLog = False,
     #                     #compactOutput = True,
     #                     #noSci = True,
     #                     #pegMinimum = 0.1,
     #                     blackList = ["lumiHisto","xsHisto","nJobsHisto"],
     #                     )
     #pl.plotAll()
     
     self.makeScanPlots(org)
Ejemplo n.º 12
0
    def conclude(self) :
        smSources = ["g_jets_mg","tt_tauola_mg","z_inv_mg_skim","z_jets_mg_skim","w_jets_mg_skim"]

        for tag in self.sideBySideAnalysisTags() :

            org = organizer.organizer( self.sampleSpecs(tag) )
            org.mergeSamples(targetSpec = {"name":"g_jets_mg", "color":r.kGreen}, allWithPrefix = "g_jets_mg")
            for color,qcd in zip([r.kRed,r.kBlue,r.kGreen],["qcd_py6", "qcd_py8", "qcd_mg"]) :
                org.mergeSamples(targetSpec = {"name":qcd, "color":r.kBlue}, allWithPrefix = qcd)
                if qcd in [sample["name"] for sample in org.samples]:
                    org.mergeSamples(targetSpec = {"name":"sm_w_"+qcd,"color":color}, sources = smSources+[qcd], keepSources = True)
                    org.drop(qcd)
            for sample in smSources: org.drop(sample)                    
            org.scale()

            pl = plotter.plotter(org,
                                 psFileName = self.psFileName(tag),
                                 samplesForRatios=("JetMET_skim", filter(lambda name: "sm_w_qcd" in name, [sample["name"] for sample in org.samples])),
                                 sampleLabelsForRatios=("data","s.m.")
                                 )
            pl.plotAll()
Ejemplo n.º 13
0
Archivo: sync.py Proyecto: aharel/supy
 def conclude(self) :
     for tag in self.sideBySideAnalysisTags() :
         ##for skimming only
         #org = organizer.organizer( self.sampleSpecs(tag) )
         #utils.printSkimResults(org)            
         
         #organize
         org=organizer.organizer( self.sampleSpecs(tag) )
         org.mergeSamples( targetSpec = {"name":"2010 Data", "color":r.kBlack, "markerStyle":20}, allWithPrefix="Run2010" )
         #self.mergeSamples(org, tag)
         org.scale()
         
         #plot
         pl = plotter.plotter(org,
                              psFileName = self.psFileName(tag),
                              #samplesForRatios = ("2010 Data","standard_model"),
                              #sampleLabelsForRatios = ("data","s.m."),
                              #whiteList = ["xcak5JetAlphaTPat","xcak5JetAlphaTZoomPat"],
                              blackList = ["nJobsHisto","lumiHisto"]
                              #compactOutput = True
                              )
         pl.plotAll()
Ejemplo n.º 14
0
 def conclude(self):
     org = organizer.organizer(self.sampleSpecs())
     pl = plotter.plotter(
         org, psFileName=self.psFileName(), doLog=False, blackList=["lumiHisto", "xsHisto", "nJobsHisto"]
     )
     pl.plotAll()
Ejemplo n.º 15
0
 def conclude(self) :
     for tag in self.sideBySideAnalysisTags() :
         org = organizer.organizer( self.sampleSpecs(tag) )
         utils.printSkimResults(org)
Ejemplo n.º 16
0
import case
import organizer
from zencad import *

w = 27
h = 20
l = 64
t = 1.5
r = 27 / 2 - 4
z = 1
s = 0.965

d = 5
d2 = 5

m = 3
n = 5

st = organizer.organizer(m, n, w, h, l, t, d, d2)
cs = case.case(w, h, l, t, r, z, s)

ucs = union([
    cs.translate(t * 1.5 + (w + t) * i, 0, t + (h + t) * j)
    for i in range(0, m) for j in range(0, n)
])

disp(ucs)
disp(st, color(1, 1, 1))
show()
Ejemplo n.º 17
0
    def organizer(self, config) : return organizer.organizer(config['tag'], self.sampleSpecs(config['tag']))

############
    def __init__(self, options) :
Ejemplo n.º 18
0
 def conclude(self) :
     org = organizer.organizer( self.sampleSpecs() )
     utils.printSkimResults(org)
Ejemplo n.º 19
0
Default is false.
If it is desired to be made true,
it should be included in command without any value.
''')

parser.add_argument('--ignore',
                    type=str,
                    metavar='IGNORE',
                    nargs='+',
                    help='''
Used to ignore files/directories from the source directory.
Add space-separated names.
''')

args = parser.parse_args()

if args.src[0] == '.':
    args.src = args.src[1:]
    args.src = os.getcwd() + args.src

if args.dist[0] == '.':
    args.dist = args.dist[1:]
    args.dist = os.getcwd() + args.dist

if __name__ == "__main__":
    print('\norganize_by:', args.organize_by, '\nsrc:', args.src, '\ndist:',
          args.dist, '\nignore:', args.ignore, '\ninclude_sub_directories:',
          args.include_sub_directories, '\n')
    organizer(args.organize_by, args.src, args.dist, args.ignore,
              args.include_sub_directories)
Ejemplo n.º 20
0
 def conclude(self) :
     for tag in self.sideBySideAnalysisTags() :
         org=organizer.organizer( self.sampleSpecs(tag) )
         org.mergeSamples(targetSpec = {"name":"2010 Data", "color":r.kBlack, "markerStyle":20}, allWithPrefix = "Run2010" )
         pl = supy.plotter(org, pdfFileName = self.pdfFileName(tag))
         pl.plotAll()