# # Example program to analyse Landau data read from file # # run with interactive python python3 -i HistLandau.py # from ROOT import TCanvas, TGraph, TH1D, TFile from ROOT import gROOT # read data from Text file import numpy as np data = np.loadtxt("./measuredLandau.txt") print("shape of data:",data.shape) print("datatype of data:",data.dtype) # Create a new canvas, and customize it. c1 = TCanvas( 'c1', 'Landau Distribution', 200, 10, 700, 500 ) # Create Histogramm landau = TH1D( 'landau', 'Landau distribution', 100, 0., 250.) for l in data: landau.Fill(l) landau.Draw() c1.Modified() c1.Update() # # Open a ROOT file and save the Canvas and Histogramm # myFile = TFile( 'py-Landau.root', 'RECREATE' ) landau.Write() c1.Write() myFile.Close()