ertool.Manager # Create ana_processor instance my_proc = fmwk.ana_processor() # Set input root file my_proc.add_input_file(sys.argv[1]) # Specify IO mode my_proc.set_io_mode(fmwk.storage_manager.kREAD) # Specify output root file name my_proc.set_ana_output_file("from_test_ana_you_can_remove_me.root") ana_unit = fmwk.ExampleERSelection() ana_unit._mgr.SetAlgo(ertool.AlgoPi0()) # Attach a template process my_proc.add_process(ana_unit) print print "Finished configuring ana_processor. Start event loop!" print # Let's run it. my_proc.run() # done! print print "Finished running ana_processor event loop!" print
def main(): if len(sys.argv) < 2: msg = '\n' msg += "Usage: %s $INPUT_ROOT_FILE\n" % sys.argv[0] msg += '\n' sys.stderr.write(msg) sys.exit(1) ertool.Manager() print "manager" #viewer plt.ion() display_reco = ERViewer() print "display" display_mc = ERViewer() print "display" display_reco.show() print "show" display_mc.show() print "show" # Create ana_processor instance my_proc = fmwk.ana_processor() # Create algorithm my_algo = ertool.AlgoPi0() my_algo.setVerbose(True) my_algo.setMinShrEnergy(10) my_algo.setMaxShrEnergy(1000) my_algo.setIPMax(10) my_algo.setMinFitMass(50) my_algo.setMaxFitMass(200) my_algo.setAngleMax(3.14) # Create analysis unit my_ana = fmwk.Pi0Reco() # ************Set Producers************** # First Argument: True = MC, False = Reco #my_ana.SetShowerProducer(True,"mcreco"); #my_ana.SetTrackProducer(True,"mcreco"); my_ana.SetVtxProducer(False, "") #my_ana.SetShowerProducer(False,"pandoraNuShower") #my_ana.SetTrackProducer(False,""); #my_ana.SetVtxProducer(False,""); my_ana.SetShowerProducer(True, "showerreco") #my_ana.SetTrackProducer(True,"mcreco"); #my_ana.SetVtxProducer(False,""); # ************Set Producers************** #help(my_ana._mgr) my_ana._mgr.SetAlgo(my_algo) my_ana._mgr._training_mode = True # Obtain input root files files = [] for x in xrange(len(sys.argv) - 1): fname = sys.argv[x + 1] if fname.endswith('.root'): files.append(fname) print print ' Running AlgoPi0 training script...' print print ' Identified %2d input files' % len(files) if not ask_binary(' Proceed? [y/n]:'): return False print if ask_binary(' Load previously extracted fit parameters? [y/n]:'): my_algo.LoadParams() my_proc.set_io_mode(fmwk.storage_manager.kREAD) my_proc.add_process(my_ana) for f in files: my_proc.add_input_file(f) my_ana._mgr.Reset() my_proc.set_ana_output_file("pi0_viewing.root") print ' Start running pi0 training...' # Start event-by-event loop counter = 0 while (counter < 1000): try: counter = input( 'Hit Enter to continue to next evt, or type in an event number to jump to that event:' ) except SyntaxError: counter = counter + 1 my_proc.process_event(counter) # get objets and display display_reco.clear() display_mc.clear() data_reco = my_ana.GetData() part_reco = my_ana.GetParticles() data_mc = my_ana.GetData(True) part_mc = my_ana.GetParticles(True) #display_reco.add(part_reco, data_reco, False) display_mc.add(part_mc, data_mc, False) display_reco.add(part_reco, data_reco, False) for x in xrange(part_mc.size()): print part_mc[x].Diagram() #for x in xrange(part_reco.size()): # print part_reco[x].Diagram() #Last argument decides if un-taggeg showers/tracks should have random color (True) or grey (False) display_reco.show() display_mc.show() #my_proc.run() print print ' Finished running pi0 training...' print # # Store trained parameters # if ask_binary(' Store train result parameters? [y/n]:'): my_algo.StoreParams() print ' Parameter stored...' print return True
def main(): if len(sys.argv) < 2: msg = '\n' msg += "Usage: %s $INPUT_ROOT_FILE\n" % sys.argv[0] msg += '\n' sys.stderr.write(msg) sys.exit(1) # Create Pi0 Filter pi0_filter = fmwk.Pi0ContainmentFilter(); # Create ana_processor instance my_proc = fmwk.ana_processor() my_proc.enable_filter(True) # Create algorithm my_algo = ertool.AlgoPi0() my_algo.setVerbose(True) my_algo.setMinShrEnergy(10) my_algo.setMaxShrEnergy(1000) my_algo.setIPMax(10) my_algo.setMinFitMass(50) my_algo.setMaxFitMass(200) my_algo.setAngleMax(3.14) # Create filter my_filter = ertool.FilterECut() my_filter.SetECut(10) #cut on 10 MeV # Create analysis unit my_ana = fmwk.ExampleERSelection() # Set Producers # First Argument: True = MC, False = Reco my_ana.SetShowerProducer(True,"mcreco"); my_ana.SetTrackProducer(True,"mcreco"); my_ana.SetVtxProducer(True,"generator"); #my_ana.SetShowerProducer(False,"showerreco"); #my_ana.SetTrackProducer(False,""); #my_ana.SetVtxProducer(False,""); my_ana._mgr.SetFilter(my_filter) my_ana._mgr.SetAlgo(my_algo) my_ana._mgr._training_mode =False # Obtain input root files files = [] for x in xrange(len(sys.argv)-1): fname = sys.argv[x+1] if fname.endswith('.root'): files.append(fname) print print ' Running AlgoPi0 training script...' print print ' Identified %2d input files' % len(files) if not ask_binary(' Proceed? [y/n]:'): return False print if ask_binary(' Load previously extracted fit parameters? [y/n]:'): my_algo.LoadParams() my_proc.set_io_mode(fmwk.storage_manager.kREAD) #my_proc.add_process(pi0_filter); my_proc.add_process(my_ana) for f in files: my_proc.add_input_file(f) my_ana._mgr.Reset() my_proc.set_ana_output_file("pi0_reco.root") print ' Start running pi0 reco...' my_proc.run() print print ' Finished running pi0 reco...' print return True
# Create ana_processor instance my_proc = fmwk.ana_processor() my_proc.enable_filter(False) # Get Default CCSingleE Algorithm instance # this sets default parameters # this information is loaded from: # $LARLITE_BASEDIR/python/seltool/GetCCSingleEInstance # and the algorithm instance is the return of the # function GetCCSingleEInstance() #my_algo = GetCCSingleEInstance() #~my_algo.setVerbose(True) # Create algorithm my_algo = ertool.AlgoPi0() my_algo.setVerbose(False) #my_algo.setMinShrEnergy(10) my_algo.setMinShrEnergy(0) my_algo.setMaxShrEnergy(1000) my_algo.setIPMax(10) my_algo.setMinFitMass(50) my_algo.setMaxFitMass(200) my_algo.setAngleMax(3.14) my_algo2 = ertool.AlgoPrimaryFinder() my_algo2.setVtxToTrkStartDist(1) my_algo2.setVtxToTrkDist(1) my_algo2.setVtxToShrStartDist(1) my_algo2.setMaxIP(5)