Exemplo n.º 1
0
def main():
    setupROOT()
    elems = ['Si', 'Ge']
    filterxs = [(0, 1.8), (0, 1)]
    ymaxs = [0.25, 0.25]
    yundergrounds = [0.03, 0.1]
    energies = []
    for elem, filterx, ymax, yunderground in zip(elems, filterxs, ymaxs, yundergrounds):
        energies.append(fitAbsTrans(elem, filterx, ymax))
        plotMultiChannelSpectrum(elem, 'Messung',
                                 [(P1SemiCon.CANGLE, P1SemiCon.CPYRO), (P1SemiCon.CANGLE, P1SemiCon.CSAMPLE)],
                                 ['Signal des Pyrodetektors', 'Signal der Probe'], (-5, 80), connect=True)
        plotMultiChannelSpectrum(elem, 'Untergrund',
                                 [(P1SemiCon.CANGLE, P1SemiCon.CPYRO), (P1SemiCon.CANGLE, P1SemiCon.CSAMPLE)],
                                 ['Untergrund des Pyrodetektors', 'Untergrund der Probe'], (-5, 80), (0, yunderground))
        plotMultiChannelSpectrum(elem, 'Lampe', [(P1SemiCon.CANGLE, P1SemiCon.CPYRO)], ['Signal des Pyrodetektors'], (-5, 80), connect=True)
        plotMultiChannelSpectrum(elem, 'Messung',
                                 [(P1SemiCon.CANGLE, P1SemiCon.CENERGY)],
                                 ['Energie E(#alpha)'], (0, 80), connect=True, addlabel='_ea')

    for i, energie in enumerate(energies):
        listenergy = []
        listnewerrors = []
        with TxtFile('../calc/part1/%s_bandgap_syserror.txt' % elems[i], 'w') as f:
            for e, se in energie:
                listenergy.append(e)
                sesys = calcsE(convertEnergyToAngle(e, elems[i]), elems[i])
                newerror = np.sqrt(se ** 2 + sesys ** 2)
                listnewerrors.append(newerror)
                f.writeline('\t', str(e), str(se), str(sesys), str(newerror))
        with TxtFile('../calc/part1/%s_bandgap_avg.txt' % elems[i], 'w') as f:
            f.writeline('\t', *map(str, avgerrors(listenergy, listnewerrors)))
Exemplo n.º 2
0
Arquivo: cuts.py Projeto: Bigben37/FP2
    with TxtFile('../calc/efficencies.txt', 'w') as f:
        f.write2DArrayToFile(efficencies, ['%.8f'] * 4)
    with TxtFile('../calc/efficencies_error.txt', 'w') as f:
        f.write2DArrayToFile(sefficencies, ['%.8f'] * 4)
    with TxtFile('../calc/invEfficencies.txt', 'w') as f:
        f.write2DArrayToFile(inv(efficencies), ['%.8f'] * 4)
    with TxtFile('../calc/purities.txt', 'w') as f:
        f.write2DArrayToFile(list(zip(*[purities])), ['%.6f'])
    # output for protocol
    thead = [r"Schnitt$\backslash$MC-Daten", LATEXE, LATEXM, LATEXT, LATEXQ]
    firstrow = [LATEXE, LATEXM, LATEXT, LATEXQ]
    with TxtFile('../src/tab_effmat_val.tex', 'w') as f:
        f.write2DArrayToLatexTable(list(zip(*([firstrow] + list(zip(*efficencies))))), thead, 
                                   ['%s'] + ['%.6f']*4, 'Effizienzmatrix.', 'tab:effmat:val')
    with TxtFile('../src/tab_effmat_err.tex', 'w') as f:
        f.write2DArrayToLatexTable(list(zip(*([firstrow] + list(zip(*sefficencies))))), thead, 
                                   ['%s'] + ['%.6f']*4, 'Fehler der Effizienzmatrix.', 'tab:effmat:err')
    with TxtFile('../src/tab_effmat_inv_val.tex', 'w') as f:
        f.write2DArrayToLatexTable(list(zip(*([firstrow] + list(zip(*inv(efficencies)))))), thead, 
                                   ['%s'] + ['%.6f']*4, 'Inverse Effizienzmatrix.', 'tab:inveffmat:val')

if __name__ == '__main__':
    setupROOT()
    gStyle.SetOptStat(0)
    # load data
    filenames = ['ee', 'mm', 'tt', 'qq']
    datas = list(map(lambda f: Z0Data.fromROOTFile('../data/mc/%s.root' % f, "h3"), filenames))

    plotDistributions(datas)
    makeCuts(datas)
Exemplo n.º 3
0
    c.Print('../img/part6/BFit.pdf', 'pdf')


def makeFranzenFits():
    MAXFILE = 12
    plotParams = loadCSVToList(DIR + 'FitdataRoot.txt')
    results = []
    for i in range(1, MAXFILE + 1):
        results.append(makeFranzenFit(i, plotParams[i - 1]))
    mus, sigmas, Bs = list(zip(*results))

    # calculate delta T
    endtimes = loadCSVToList(DIR + 'endtimes.txt')[0]
    darkTimes = []
    for (mu, smu), e in zip(*[mus, endtimes]):
        dt = e - mu
        se = e * 0.01 + 0.1
        sdt = sqrt(smu ** 2 + se ** 2)
        darkTimes.append((dt, sdt))

    makeSigmaFit(darkTimes, sigmas)
    makeBFit(darkTimes, Bs)


def main():
    makeFranzenFits()

if __name__ == '__main__':
    setupROOT()
    main()
Exemplo n.º 4
0
def main():
    setupROOT()
    evalDistances()
Exemplo n.º 5
0
def main():
    setupROOT()
    evalPart3()
Exemplo n.º 6
0
def main():
    setupROOT()
    evalVoltages()