예제 #1
0
def ProcessFile(fname):

    r = fname.split('/')[-1].split('.')[0].split('_')
    runID, fID = map(int, r)

    print fname

    dp = DataFactory(fname, SQLpath + 'ProtoMap.db')
    dp.InitT3()
    dist = []
    for i in sorted(dp.t3['EventID'].unique()):

        try:
            #print i
            image = dp.ConstructImage(i)
            image = VertexAnalyzor.FilterBackground(image)
            points, (xc, yc) = VertexAnalyzor.GetEventPositions(image, 0)
            xscale, yscale = 80 / 1000.0 * 2.459, 0.1
            xc, yc = xc * xscale, yc * yscale
            points = [(x * xscale, y * yscale) for x, y in points] + [(xc, yc)]
            dist.append({
                'runID': runID,
                'fileID': fID,
                'eventID': i,
                'data': points
            })
            #r = VertexAnalyzor.GetEventInfo(points,(xc,yc))
            #dist.append({'runID':runID,'fileID':fID,
            #    'eventID':i,'data':r})

        except:
            pass

    return dist
예제 #2
0
def ProcessFile(fname):

    r = fname.split('/')[-1].split('.')[0].split('_')
    runID,fID = map(int,r)

    print(fname)

    dp = DataFactory(fname,SQLpath+'ProtoMap.db')
    dp.InitT3()
    dist = []

    for i in sorted(dp.t3['EventID'].unique()):
        try:
            image = dp.ConstructImage(i)
            image = VertexAnalyzor.FilterBackground(image)
            # print(image)
            points,(xc,yc) = VertexAnalyzor.GetEventPositions(image,0) ### was 0 for debug mode
            xscale , yscale = 80/1000.0*2.459,0.1 # 2.549 cm/ns drift velocity
            xc,yc = xc*xscale, yc*yscale
            points = [(float(x*xscale),float(y*yscale)) for x,y in points]+[(xc,yc)]
            dist.append({'runID':runID,'fileID':fID,'eventID':i.item(),'data':points})
            #print(type(runID),type(fID),type(i.item()),type(points),type(points[0][0]))

        except:
            #print("eventID type is:",type(i),"\tproblema")
            pass

    return dist
예제 #3
0
        #     continue

        # give the tracks a thickness
        image[new_y][new_x] = 255
        image[new_y - 1][new_x - 1] = 255
        image[new_y + 1][new_x + 1] = 255
        image[new_y][new_x] = 255

    image = image.astype(np.uint8)

    # dff = pd.DataFrame(image)
    # dff.to_csv("check1.csv",index=False,header=False)
    # break

    try:
        points, (xc, yc) = VertexAnalyzor.GetEventPositions(
            image, 1)  ## 1 for debug mode and plots, 0 for just running
        xc, yc = (xc - 150) * scale_x, (yc - 300) * scale_y
        points = [(float((x - 150) * scale_x), float((y - 300) * scale_y))
                  for x, y in points] + [(xc, yc)]
        dist.append({'eventID': stepper // 2, 'data': points})
    except:
        print('Failed')
        pass

    print('Iteration:', stepper // 2)
    stepper += 2

#print(dist)
print("Writing to 'geant.dat' file")
with open('geant.dat', 'w') as f:
    json.dump(dist, f, indent=4)
예제 #4
0
from Analyzor.DataFactory import DataFactory
from Analyzor import VertexAnalyzor
import pylab as plt
import matplotlib.path as mplPath
import seaborn as sns
import numpy as np

plt.rcParams['figure.figsize'] = (20, 20)

dp = DataFactory('0085_0000.db', 'ProtoMap.db')
dp.InitT3()

dp.InitMesh()
dp.mesh_df.loc[6].plot()

image = dp.ConstructImage(7)
image = VertexAnalyzor.FilterBackground(image)
points, (xc, yc) = VertexAnalyzor.GetEventPositions(image, 1)
plt.scatter(xc, yc, s=200, c='r')

plt.show()