Exemplo n.º 1
0
    'runs': [1181]
}, {
    'TCN': '18-380 (high position: UGD22+20)',
    'runs': [1188]
}, {
    'TCN': '18-310 (high position: UGD22+20, smooth elbow)',
    'runs': [1192]
}]

ReadCycles(ROOT.TFile(sys.argv[1]), experiments)

# loop over experiments and analyze transmission in runs
for ex in experiments:
    Transmission(ex)

UCN.PrintBackground(experiments, 'li6')
UCN.PrintMonitorCounts(experiments)

Normalize(experiments, '18-215', '18-380')  # Ti foil in high position
Normalize(experiments, '18-115', '18-480')  # Ti foil in low position
Normalize(experiments, '18-240', '18-302')  # Al foil above detector
Normalize(experiments, '18-310', '18-380')  # smooth elbow
Normalize(experiments, '18-035', '18-031')  # UGD22+IV3 compared to UGD17 only
Normalize(experiments, '18-045', '18-035')  # UGD22+IV3 compared to UGD17 only
Normalize(experiments, '18-057', '18-045')  # spider + UGD2 compared to UGD22
Normalize(experiments, '18-053',
          '18-045')  # burst disk + UGD2 compared to UGD22
Normalize(experiments, '18-053', '18-480')  # burst disk compared to UGD22
Normalize(experiments, '18-057', '18-053')  # spider compared to burst disk
Normalize(experiments, '18-480',
          '18-045')  # Stainless guide compared to no guide
        'TCN': '18-381 (UGD22+20, high pos, IV2-IV3)',
        'runs': [1189, 1190]
    },
    {
        'TCN': '18-382 (UGD22+20, high pos, IV1-IV3)',
        'runs': [1191]
    }
]

ReadCycles(ROOT.TFile(sys.argv[1]), experiments)

# loop over experiments
for ex in experiments:
    StorageLifetime(ex)

UCN.PrintBackground(experiments)

canvas = ROOT.TCanvas('c', 'c')
for tcn in ['18-066', '18-068', '18-268', '18-266']:
    SCMex = [ex for ex in experiments if ex['TCN'].startswith(tcn)]
    gr = ROOT.TGraphErrors()
    for ex in SCMex:
        SCMcurrent = numpy.concatenate(ex['SCMcurrent'])
        i = gr.GetN()
        gr.SetPoint(i, numpy.mean(SCMcurrent), ex['tau'])
        gr.SetPointError(i,
                         numpy.std(SCMcurrent) / math.sqrt(len(SCMcurrent)),
                         ex['tauerr'])
    gr.SetTitle('TCN' + tcn)
    gr.GetXaxis().SetTitle('SCM current (A)')
    gr.GetYaxis().SetTitle('Storage lifetime (s)')
]

ReadCycles(ROOT.TFile(sys.argv[1]), experiments)

tauvstemp = [
    ex for ex in experiments if ex['TCN'] == '18-300' or 1167 in ex['runs']
]
for ex in tauvstemp:
    StorageLifetime(ex)
r = DoCombinedFit(tauvstemp, 'combinedfit.pdf')

for ex in experiments:
    if ex['TCN'] != '18-300':
        StorageLifetime(ex, r)

UCN.PrintBackground(experiments, 'li6', 930, 1206)
UCN.PrintBackground(experiments, 'he3')


def TauVsTime(experiments, parameter, variable, timeformat, color):
    exs = [ex for ex in experiments if ex[variable] > 0.]
    x = numpy.array([float(min(ex[parameter])) for ex in exs])
    y = numpy.array([ex[variable] for ex in exs])
    yerr = numpy.array([ex[variable + 'err'] for ex in exs])
    grtaus = ROOT.TGraphErrors(len(exs), x, y, numpy.array([0. for _ in exs]),
                               yerr)
    if timeformat:
        grtaus.GetXaxis().SetTimeDisplay(1)
        grtaus.GetXaxis().SetTimeFormat('%m-%d%F2018-01-01 00:00:00')
        grtaus.GetXaxis().SetNdivisions(10, 10, 0)
        grtaus.GetXaxis().SetTitle('Date')