Ejemplo n.º 1
0
def fitMany(fitManyConfig):
    """does multiple spectrumGlobal fit for different spectrums and fit ranges and fit functions, saves the best fit params in a txt file"""
    print("got here 1")
    spectrumLogList=[]
    for h5File in os.listdir(fitManyConfig["inputH5Dir"]):

        if os.path.isfile(fitManyConfig["inputH5Dir"]+"/"+h5File):
            print("h5File: ", h5File)
            print("got here 2")
            spectrumT=spectrumType(h5File)


            print("fitRange: ", fitManyConfig["spectrumFitRanges"][spectrumT])
            for fitRange in fitManyConfig["spectrumFitRanges"][spectrumT]:
                for functionCode in fitManyConfig["functionCodes"]:
                    print("got here 3")
                    # hard coded to use the UA 2 params for now
                    initParams=fitManyConfig["initParams"][spectrumT][1]
                    #initParams=fitManyConfig[spectrumT][functionCode]
                    config=initConfig(fitManyConfig["inputH5Dir"], h5File, fitRange, functionCode, initParams)
                    spectrumLog=spectrumGlobalFit.spectrumGlobalFit(config)
                    spectrumLogList.append(spectrumLog)

    #writing to a output file
    print("got here 4")
    output_file=open(fitManyConfig["outputTxt"], "w+")
    for spectrumFitLog in spectrumLogList:
        output_file.write('\n'.join(f for f in spectrumFitLog))
    output_file.close()
Ejemplo n.º 2
0
        1500,
        "xMinGP":
        300,
        "xMaxGP":
        1500,
        #-----Spectrum file input
        "dataFile":
        "/lustre/SCRATCH/atlas/ywng/WorkSpace/r21/gp-toys/data/all/btagged/jan2018/trijet_HLT_j380_inclusive.h5",
        "dataFileTDir":
        "",
        "dataFileHist":
        "background_mjj_var",
        #------put some placeholder file here
        "officialFitFile":
        "/lustre/SCRATCH/atlas/ywng/WorkSpace/r21/gp-toys/data/all/Step1_SearchPhase_Zprime_mjj_var.h5",
        #-----Fit function
        "fitFunction":
        0,  #0: UA2; 1: 4 params
        #initial parameter for fitting
        "initParam": [
            2114090.3221715163, -0.10249143346059597, 110.96753410590006,
            -41.90626047681503
        ],
        #the range of the parameter value within which it is throwing from
        "initFitParam": [10000000, 50, 200, 500],
        # the allowed range of variable values
        "initRange": [(2000000, 50000000.), (-10, 10), (-100, 600.),
                      (-300, 300.)]
    }  #None(default): [(-100000, 1000000.),(-100., 100.),(-100., 100.),(-100., 100.)]
    spectrumGlobalFit.spectrumGlobalFit(config)