1 | # Programm zur Jitter-Bestimmung
|
---|
2 | #
|
---|
3 | #
|
---|
4 | # Remo Dietlicher
|
---|
5 | # ETH Zürich
|
---|
6 | #
|
---|
7 | #
|
---|
8 |
|
---|
9 |
|
---|
10 | import pyfact
|
---|
11 | from myhisto import *
|
---|
12 | from hist import *
|
---|
13 | import numpy as np
|
---|
14 | import numpy.random as rnd
|
---|
15 | from scipy import interpolate as ip
|
---|
16 | from ROOT import *
|
---|
17 | from time import time
|
---|
18 | from optparse import OptionParser
|
---|
19 |
|
---|
20 | jitterSummary = jitterHistograms( "jitter" )
|
---|
21 |
|
---|
22 |
|
---|
23 | Data0 = np.loadtxt("20120106T162310_ch0.txt")
|
---|
24 |
|
---|
25 | NEvents, NROI = np.shape(Data0)
|
---|
26 |
|
---|
27 | Start0 = np.loadtxt("20120106T162310_start_ch0.txt")
|
---|
28 |
|
---|
29 | Data8 = np.loadtxt("20120106T162310_ch8.txt")
|
---|
30 |
|
---|
31 | Start8 = np.loadtxt("20120106T162310_start_ch8.txt")
|
---|
32 |
|
---|
33 | for i in range(NROI):
|
---|
34 | jitterSummary.dict["data0"].SetBinContent(i+1, Data0[10][i])
|
---|
35 | jitterSummary.dict["data8"].SetBinContent(i+1, Data8[10][i])
|
---|
36 |
|
---|
37 | Thresh = 250
|
---|
38 |
|
---|
39 | #rCellTime = np.load("Remo_dat_1000x15123.npy")
|
---|
40 | rCellTime = np.load("CellTimeOliver.npy")
|
---|
41 |
|
---|
42 |
|
---|
43 | def Crossing(Data):
|
---|
44 |
|
---|
45 | TimeXing = "gugus"
|
---|
46 | CellTime = np.roll(rCellTime, -int(Start0[Event][0]))
|
---|
47 |
|
---|
48 | for i in range(NROI-1):
|
---|
49 |
|
---|
50 | if((Data[i] < Thresh) & (Data[i+1] > Thresh) & (Data[np.mod(i+300, NROI)] > Thresh)):
|
---|
51 |
|
---|
52 | FirstCell = CellTime[i]
|
---|
53 | SecondCell = CellTime[i+1]
|
---|
54 |
|
---|
55 | TimeXing = FirstCell+(SecondCell-FirstCell)/(1.-Data[i+1]/(Data[i]))*(1.-Thresh/(Data[i]))
|
---|
56 |
|
---|
57 | return TimeXing
|
---|
58 |
|
---|
59 | Diff = np.zeros(NEvents)
|
---|
60 |
|
---|
61 | count = 0
|
---|
62 |
|
---|
63 | for Event in range(NEvents):
|
---|
64 | print Event
|
---|
65 |
|
---|
66 | Time0 = Crossing(Data0[Event])
|
---|
67 | Time8 = Crossing(Data8[Event])
|
---|
68 |
|
---|
69 | if((Time0 == "gugus") or (Time8 == "gugus")):
|
---|
70 | count += 1
|
---|
71 | continue
|
---|
72 |
|
---|
73 | Diff[Event] = Time0 - Time8
|
---|
74 | jitterSummary.dict["diff"].Fill(Diff[Event])
|
---|
75 |
|
---|
76 | pyfact.SaveHistograms([jitterSummary], "Jitter_Histo_Oliver.root", "RECREATE")
|
---|
77 |
|
---|
78 | print "Number of skipped events: ", count
|
---|
79 | print "Histo saved as = ", "Jitter_Histo.root"
|
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 |
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 |
|
---|
89 |
|
---|
90 |
|
---|
91 |
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 |
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 |
|
---|
101 |
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 |
|
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 |
|
---|
113 |
|
---|
114 |
|
---|