12 from ctypes
import POINTER
13 from SQLamarr
import clib
19 clib.new_HepMC2DataLoader.argtypes = (ctypes.c_void_p,)
20 clib.new_HepMC2DataLoader.restype = ctypes.c_void_p
22 clib.del_HepMC2DataLoader.argtypes = (ctypes.c_void_p,)
24 clib.HepMC2DataLoader_load.argtypes = (
25 ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t, ctypes.c_size_t
30 Data loader for HepMC2-format ASCII files.
34 # Create the database connection
35 db = SQLamarr.SQLite3DB()
37 # Create the data loader
38 data_loader = HepMCDataLoader(db)
40 # Create the pipeline with a CleanEventStore algorithm
41 clean_all = SQLamarr.Pipeline([
42 SQLamarr.CleanEventStore(db)
45 # For each file in an input file list,
46 for file in my_list_of_files:
48 data_loader.load(file)
56 """Acquires the reference to an open connection to the DB"""
59 def load(self, filename: str, runNumber: int, evtNumber: int):
60 """Loads an ASCII file with
61 [HepMC3::ReaderAsciiHepMC2](http://hepmc.web.cern.ch/hepmc/classHepMC3_1_1ReaderAsciiHepMC2.html).
63 if not os.path.exists(filename):
64 raise FileNotFoundError(filename)
66 _self = clib.new_HepMC2DataLoader(self.
_db_db.get())
67 clib.HepMC2DataLoader_load(
68 _self, filename.encode(
'ascii'), runNumber, evtNumber, self.
_db_db.path.encode(
'ascii')
70 clib.del_HepMC2DataLoader(_self)
Data loader for HepMC2-format ASCII files.
def __init__(self, SQLite3DB db)
Acquires the reference to an open connection to the DB.
def load(self, str filename, int runNumber, int evtNumber)
Loads an ASCII file with HepMC3::ReaderAsciiHepMC2.