source: fact/tools/pyscripts/sandbox/dneise/rdietlic/jitter.py@ 13408

Last change on this file since 13408 was 13368, checked in by neise, 12 years ago
initial commit of my sandbox
File size: 1.7 KB
Line 
1# Programm zur Jitter-Bestimmung
2#
3#
4# Remo Dietlicher
5# ETH Zürich
6#
7#
8
9
10import pyfact
11from myhisto import *
12from hist import *
13import numpy as np
14import numpy.random as rnd
15from scipy import interpolate as ip
16from ROOT import *
17from time import time
18from optparse import OptionParser
19
20jitterSummary = jitterHistograms( "jitter" )
21
22
23Data0 = np.loadtxt("20120106T162310_ch0.txt")
24
25NEvents, NROI = np.shape(Data0)
26
27Start0 = np.loadtxt("20120106T162310_start_ch0.txt")
28
29Data8 = np.loadtxt("20120106T162310_ch8.txt")
30
31Start8 = np.loadtxt("20120106T162310_start_ch8.txt")
32
33for 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
37Thresh = 250
38
39#rCellTime = np.load("Remo_dat_1000x15123.npy")
40rCellTime = np.load("CellTimeOliver.npy")
41
42
43def 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
59Diff = np.zeros(NEvents)
60
61count = 0
62
63for 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
76pyfact.SaveHistograms([jitterSummary], "Jitter_Histo_Oliver.root", "RECREATE")
77
78print "Number of skipped events: ", count
79print "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
Note: See TracBrowser for help on using the repository browser.