Exemplo n.º 1
0
        for event in events:
            row = []
            if len(event.clusters.clusters.clusters) is 1:
                row.append(event.energy)
                row.append(event.clusters.clusters.clusters[0].pulse_height)
                row.append(event.clusters.clusters.clusters[0].x.value)
                row.append(event.clusters.clusters.clusters[0].x.error)
                row.append(event.clusters.clusters.clusters[0].y.value)
                row.append(event.clusters.clusters.clusters[0].y.error)
                row.append(event.clusters.clusters.clusters[0].z.value)
                row.append(event.clusters.clusters.clusters[0].z.error)
                row.append(event.clusters.clusters.clusters[0].ywidth)
                row.append(event.clusters.clusters.clusters[0].zwidth)
                dataset.append(row)
        with open(EXEL_OUTPUT, 'wb') as f:
            f.write(dataset.export('xls'))

    elif particle is 'electron' or particle is 'muon':
        events = parse(text)
        dataset = Dataset()
        dataset.headers = ('P', 'tandip', 'Kappa', 'd Kappa',
                           'Calorimeter Pulse Heights')
        for event in events:
            row = []
            row.append(event.energy)
            if len(event.tracks.tracks) is not 0:
                if event.tracks.tracks[0].parameters.tandip is not None:
                    row.append(event.tracks.tracks[0].parameters.tandip)
                else:
                    row.append('No tandip')
                tmpTrk = event.tracks.tracks[0]
Exemplo n.º 2
0
            row_raw.append(number_of_decays + 1)
            row_raw.append(momentum)

            y1 = event.calorimeter.clusters.clusters[0].y.value
            z1 = event.calorimeter.clusters.clusters[0].z.value
            y2 = event.calorimeter.clusters.clusters[1].y.value
            z2 = event.calorimeter.clusters.clusters[1].z.value
            ph1 = event.calorimeter.clusters.clusters[0].pulse_height
            ph2 = event.calorimeter.clusters.clusters[1].pulse_height

            row_raw.append(y1)
            row_raw.append(z1)
            row_raw.append(ph1)
            row_raw.append(y2)
            row_raw.append(z2)
            row_raw.append(ph2)

            raw.append(row_raw)
            number_of_decays += 1

        with open(RAW_OUTPUT, 'wb') as f:
            f.write(raw.export('xlsx'))

    if (progress < 98):
        print('Something went wrong. Please run the program again.')
    else:
        print('Execution completed.')
        print(event_id, 'event(s) were simulated.')
        print('There were', number_of_decays, 'interesting events out of',
              event_id, 'events.')
Exemplo n.º 3
0
from gimel_parser import parse


USER_NAME = ''
PASSWORD = ''
SESSION_FILE = 'calibration.txt'
EXEL_OUTPUT = 'calibration_stats.xlsx'

minimum_energy = 1
step_size = 0.2
number_of_injections = 250

if __name__ == '__main__':
    with GimelSession(user=USER_NAME, password=PASSWORD, output_file=SESSION_FILE) as g:
        g.start_gimmel()
        g.send_particles_ascending_energies('electron', minimum_energy, step_size, number_of_injections)
    with open(SESSION_FILE) as f:
        text = f.read()
    events = parse(text)
    dataset = Dataset()
    dataset.headers = ('P', 'Kappa', 'd Kappa', 'Calorimeter Pulse Hight')
    for event in events:
        row = []
        row.append(event.energy)
        row.append(event.tracks.tracks[0].parameters.akappa)
        row.append(event.tracks.tracks[0].error_matrix['akappa']['akappa'])
        row.append(event.calorimeter.clusters['PULSE-HEIGHT'][0])
        dataset.append(row)
    with open(EXEL_OUTPUT, 'wb') as f:
        f.write(dataset.export('xlsx'))