All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Base/mac/example_ertool.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\n" % sys.argv[0]
6  msg += '\n'
7  sys.stderr.write(msg)
8  sys.exit(1)
9 
10 from seltool import ertool
11 from larlite import larlite as fmwk
12 
13 # Create ana_processor instance
14 my_proc = fmwk.ana_processor()
15 
16 # Set input root file
17 for x in xrange(len(sys.argv)-1):
18  my_proc.add_input_file(sys.argv[x+1])
19 
20 # Specify IO mode
21 my_proc.set_io_mode(fmwk.storage_manager.kREAD)
22 
23 # Specify output root file name
24 my_proc.set_ana_output_file("ertool_hist.root")
25 
26 # Create ERTool algorithm (empty base class for this example)
27 my_algo = ertool.AlgoBase()
28 
29 # Create ERTool analysis (empty base class for this example)
30 my_ana = ertool.AnaBase()
31 
32 # Create larlite interfce analysis unit for ERTool
33 my_anaunit = fmwk.ExampleERSelection()
34 
35 # Set Producers
36 # First Argument: True = MC, False = Reco
37 # Second Argument: producer module label
38 my_anaunit.SetShowerProducer(True,"mcreco");
39 my_anaunit.SetTrackProducer(True,"mcreco");
40 my_anaunit.SetVtxProducer(True,"generator");
41 
42 # Implement manager
43 my_anaunit._mgr.AddAlgo(my_algo)
44 my_anaunit._mgr.AddAna(my_ana)
45 my_ana._mode =True # True = Select. False = Fill mode
46 my_proc.add_process(my_anaunit)
47 
48 # run!
49 my_proc.run()
50 
51 # done!
52 print
53 print "Finished running ana_processor event loop!"
54 print
55 
56 #my_algo.StoreParams()
57 sys.exit(0)
58