def __init__(self, geom, file=None): super(larlite_manager_base, self).__init__(geom, file) manager.__init__(self, geom, file) QtCore.QObject.__init__(self) # For the larlite manager, need both the ana_processor and # the storage manager self._process = fmwk.ana_processor() self._mgr = fmwk.storage_manager() self._keyTable = dict() self._drawnClasses = dict() if file != None: self.setInputFiles(file) self._n_entries = 0 # Toggle whether or not to draw wires: self._drawWires = False self._drawParams = False self._drawTruth = False self._wireDrawer = None self._truthDrawer = None # Lariat has special meanings to event/spill/run self._spill = 0
def getLArLiteManager(self): manager = larlite.storage_manager() manager.reset() self.usedfiles = [] for dataproduct,filelist in self.dataproduct_files.items(): for f in filelist: manager.add_in_filename(f) self.usedfiles.append( f ) manager.set_io_mode(larlite.storage_manager.kREAD) manager.open() return manager
def __init__(self,inputfile): super(RawLArLiteOpData, self).__init__() # set input file name self.fname = inputfile # get the producer name self.producer = 'pmt_xmit' # set the slot number to use self.slot = 5 # call larlite manager self.manager = larlite.storage_manager() self.manager.reset() self.manager.add_in_filename(self.fname) self.manager.set_io_mode(larlite.storage_manager.kREAD) self.manager.open() # wf and pedestal holder self.opdetdigits = {} self.pedestals = {} # cosmics window holder self.cosmics = cd.CosmicDiscVector() # event location self.first_event = 0 self.event_range = [ self.first_event, self.first_event+100 ] self.entry_points = {} self.entry_points[ self.first_event ] = 0 self.maxevent = None self.samplesPerFrame = 102400 self.nspertick = 15.625 # number of samples per beam-gate window self.nsamples = 1000 # number of PMT channels to use self.n_pmts = 48 # fill pedestals w/ baseline self.pedestals[self.slot] = np.ones( self.n_pmts ) *2048.
# coding: utf-8 # In[ ]: #get_ipython().magic(u'matplotlib inline') import matplotlib.pyplot as plt import numpy as np import ROOT from ROOT import larlite import sys # In[ ]: mgr = larlite.storage_manager() mgr.set_io_mode(mgr.kREAD) infile = sys.argv[1] #infile = "output_simpleflash.root" flashproducer = str(sys.argv[2]) #flashproducer = "SimpleFlashFinder" mgr.add_in_filename(infile) mgr.open() b = [] print mgr while mgr.next_event():
if len(sys.argv) == 1: print "\n-------You forgot to include a source file!-------\n" print "Usage: python hitviewr.py /input/file/with/gaushits.root" quit() my_proc = fmwk.ana_processor() my_proc.enable_filter(True) my_proc.set_io_mode(fmwk.storage_manager.kREAD) for x in xrange(len(sys.argv)-1): my_proc.add_input_file(sys.argv[x+1]) myfilter = fmwk.michelfilter() my_proc.add_process(myfilter) #Get access to the larlite data manager mgr = fmwk.storage_manager() mgr.set_io_mode(mgr.kREAD) #Add input files for x in xrange(len(sys.argv)-1): mgr.add_in_filename(sys.argv[x+1]) mgr.open() #Make a canvas to draw the hits canvas=TCanvas("HitViewer","HitViewer",1200,600) canvas.Divide(2,1) gStyle.SetOptStat(0) canvas.SetGridx(1) canvas.SetGridy(1) #canvas.SetLogz()
import sys import ROOT from ROOT import * from ROOT import larlite as fmwk if len(sys.argv) == 1: print "\n-------You forgot to include a source file!-------\n" print "Usage: python hitviewr.py /input/file/with/gaushits.root" quit() if len(sys.argv) != 2: print "Usage: python hitviewr.py /input/file/with/gaushits.root" quit() #Get access to the larlite data manager mgr = fmwk.storage_manager() mgr.set_io_mode(mgr.kREAD) #Add input file mgr.add_in_filename(sys.argv[1]) mgr.open() #Make a canvas to draw the hits canvas = TCanvas("HitViewer", "HitViewer", 600, 500) gStyle.SetOptStat(0) canvas.SetGridx(1) canvas.SetGridy(1) #canvas.SetLogz() #Make an instance of the HitViewer algo = fmwk.HitViewer()
import sys from ROOT import larlite import ROOT man=larlite.storage_manager() man.set_io_mode(man.kBOTH) # you can generate the input file using # core/DataFormat/bin/simple_write.cc man.add_in_filename("trial.root") man.set_out_filename("fakeclusters.root") man.set_verbosity(larlite.msg.kDEBUG) man.open() while man.next_event() : man.set_id(man.run_id(), man.subrun_id(), man.event_id()) helper = ROOT.demonstrators.ClusterFinderHelper() helper.findClusters(man, "test") man.close()
protrr, protx, proty, protz, protdQdxY = [], [], [], [], [] # ---------------------------------------------------------------------------------------# # loads track_reco tree and selects the crossing comsmic tracks (thrumu) for the spatial # calibration and proton tracks for the recombination parameters. # thrumu -- selects based on: # 1) length of combined tracks about size of the detector # 2) length of individual tracks greater than 30 cm (to account for Michel's) # protons -- selects based on: # 1) 2 tracks from vertex, chooses higher, average dQdx AND shorter length # 2) good3dreco # 3) cosmicll > 4 # ---------------------------------------------------------------------------------------# track_infile = argv[2] track_manager = larlite.storage_manager() track_manager.set_io_mode(track_manager.kREAD) track_manager.add_in_filename(track_infile) track_manager.set_in_rootdir("") track_manager.open() while track_manager.next_event(): track = track_manager.get_data(larlite.data.kTrack, "trackReco") vertex = track_manager.get_data(larlite.data.kVertex, "trackReco") if track.size() != 0L: vert = [] xprev = track[0].Vertex().x() vertex_number = 0 for idx in range(len(track)): xver = track[idx].Vertex().x() if xver == xprev: