Esempio n. 1
0
def testme(files=None):
    """
    Test function
    """
    import Tests
    from ROOT import TH1F,TFile
    if files != None:
        in1 = TFile( files[0] )
        in2 = TFile( files[1] )
        hname = "Spectra/hProtonSpectrum"
        h1=in1.Get( hname )
        h2=in2.Get( hname )
        print h1,h2
    else:
        h1 = TH1F("h1","h",100,-10,10)
        h2 = TH1F("h2","h",100,-10,10)
        h1.FillRandom("gaus")
        h2.FillRandom("gaus")
    from ROOT import TCanvas
    global c
    c=TCanvas()
    c.Divide(1,2)
    c.cd(1)
    h1.DrawCopy()
    h2.SetLineColor(2)
    h2.DrawCopy("same")
    from Utils import DataType
    #aTest = Tests.KolmogorovSmirnovTest( h1 , h2 , DataType.BINNED1D)
    aTest = Tests.Binned1DChi2Test(h1,h2)
    #print aTest.pval(),aTest.stat()
    aResult = Output("A-Test")
    anAlgo = Algorithm( aTest , aResult )
    c.cd(2)
    anAlgo.test.residuals.Draw()
    anAlgo.test.residuals.Draw()
    print anAlgo.check()
    print aResult
    return h1,h2,anAlgo.test.residuals