forked from kvtsang/Supera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupera.py
executable file
·66 lines (52 loc) · 1.54 KB
/
supera.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
import sys,os
if len(sys.argv) < 3:
msg = '\n'
msg += "Usage 1: %s CONFIG_FILE OUT_FILENAME $INPUT_ROOT_FILE(s)\n" % sys.argv[0]
msg += '\n'
sys.stderr.write(msg)
sys.exit(1)
#import ROOT
#from ROOT import larlite as fmwk
##from larlite import larlite as fmwk
import ROOT
from larlite import larlite as fmwk
fmwk.storage_manager
from larcv import larcv
LL_OUTFILE='larlite_supera_out.root'
LC_OUTFILE='larcv_supera_out.root'
if os.path.exists(LL_OUTFILE) or os.path.exists(LC_OUTFILE):
print "Output file exists. Please remove:",LL_OUTFILE,LC_OUTFILE
print "Giving up."
sys.exit(1)
# Create ana_processor instance
my_proc = fmwk.ana_processor()
my_proc.enable_filter(True)
# Set input root file
for argv in sys.argv:
if argv.endswith('.root'):
my_proc.add_input_file(argv)
# Specify IO mode
my_proc.set_io_mode(fmwk.storage_manager.kREAD)
#my_proc.set_output_file(LL_OUTFILE)
# Specify output root file name
my_proc.set_ana_output_file("")
# Attach an analysis unit ... here we use a base class which does nothing.
# Replace with your analysis unit if you wish.
unit = fmwk.LArLiteSuperaDriver()
unit.CoreDriver().configure(sys.argv[1])
unit.CoreDriver().override_output_file(LC_OUTFILE)
#unit.CoreDriver().initialize()
#unit.CoreDriver().finalize()
my_proc.add_process(unit)
#my_proc.enable_filter()
print
print "Finished configuring ana_processor. Start event loop!"
print
# Let's run it.
my_proc.run(0,5)
# done!
print
print "Finished running ana_processor event loop!"
print
sys.exit(0)