This commit is contained in:
Erik Frojdh 2023-05-30 16:49:44 +02:00
parent ae6aa5b58d
commit b996ce5fe6
2 changed files with 10 additions and 17 deletions

View File

@ -13,10 +13,15 @@ except:
fname = "Moench_LGAD_SIM_Nov22/moenchLGAD202211/clustW17new/beam_En800eV_-40deg_300V_10us_d0_f5_0.clust"
r = ClusterFileReader((base/fname).as_posix())
cl = r.read(10000)
hist1 = bh.Histogram(bh.axis.Regular(40, -2, 2**14))
hist1.fill(cl['data'].flat)
i = 0
while (cl:=r.read(100000)).size:
hist1.fill(cl['data'].flat)
print(i)
i+=1
fig, ax = plt.subplots()
ax.bar(hist1.axes[0].centers, hist1.values(), width=hist1.axes[0].widths)
ax.set_yscale('log')

View File

@ -211,23 +211,11 @@ static struct PyModuleDef creader_def = {
};
PyMODINIT_FUNC PyInit_creader(void) {
PyObject *m;
// if (PyType_Ready(&ClusterFileReaderType) < 0)
// return NULL;
m = PyModule_Create(&creader_def);
PyObject *m = PyModule_Create(&creader_def);
if (m == NULL)
return NULL;
// add numpy functionallity
import_array();
init_ClusterFileReader(m);
// add the cluster reader
// Py_INCREF(&ClusterFileReaderType);
// if (PyModule_AddObject(m, "ClusterFileReader",
// (PyObject *)&ClusterFileReaderType) < 0) {
// Py_DECREF(&ClusterFileReaderType);
// Py_DECREF(m);
// return NULL;
// }
return m;
}