All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Algorithms/mac/example_anaunit.py
Go to the documentation of this file.
1 import sys
2 
3 if len(sys.argv) < 2:
4  msg = '\n'
5  msg += "Usage 1: %s $INPUT_ROOT_FILE(s)\n" % sys.argv[0]
6  msg += '\n'
7  sys.stderr.write(msg)
8  sys.exit(1)
9 
10 from larlite import larlite as fmwk
11 
12 # Create ana_processor instance
13 my_proc = fmwk.ana_processor()
14 
15 # Set input root file
16 for x in xrange(len(sys.argv)-1):
17  my_proc.add_input_file(sys.argv[x+1])
18 
19 # Specify IO mode
20 my_proc.set_io_mode(fmwk.storage_manager.kREAD)
21 
22 # Specify output root file name
23 my_proc.set_ana_output_file("from_test_ana_you_can_remove_me.root");
24 
25 # Attach an analysis unit ... here we use a base class which does nothing.
26 # Replace with your analysis unit if you wish.
27 my_proc.add_process(fmwk.ana_base())
28 
29 print
30 print "Finished configuring ana_processor. Start event loop!"
31 print
32 
33 # Let's run it.
34 my_proc.run();
35 
36 # done!
37 print
38 print "Finished running ana_processor event loop!"
39 print
40 
41 sys.exit(0)