@@ -47,7 +47,7 @@ def exp(x, a, b):
47
47
nXtDel += debug .nDXt
48
48
nAp += debug .nAp
49
49
50
- dcrDelays = np .diff (dcrDelays )
50
+ dcrDelays = np .diff (np . sort ( dcrDelays )) * 1e-9
51
51
52
52
dcr = nDcr / (1e-9 * N * sensor .properties ().signalLength ())
53
53
xt = nXt / nPe
@@ -64,25 +64,25 @@ def exp(x, a, b):
64
64
65
65
print (tabulate (tableData , headers = "keys" , floatfmt = ".2f" ))
66
66
67
- cost = ExtendedUnbinnedNLL (dcrDelays , exp )
68
- fit = Minuit (cost , a = sensor . properties (). dcr (), b = sensor . properties (). dcr ( ))
67
+ cost = UnbinnedNLL (dcrDelays , exp )
68
+ fit = Minuit (cost , a = 1 / np . mean ( dcrDelays ))
69
69
fit .migrad ()
70
70
fit .minos ()
71
71
72
72
print (fit )
73
73
74
- plt .figure ( )
75
- h = np .histogram (
76
- dcrTimes ,
77
- np . arange (
78
- 0 ,
79
- sensor . properties (). signalLength () + 10 ,
80
- 10 ,
81
- ),
82
- )
83
- mplhep . histplot ( h , label = "Time distribution of DCR " )
84
- plt . xlabel ("Time [ns ]" )
85
- plt .legend (frameon = False )
74
+ fig , ax = plt .subplots ( 2 , 1 )
75
+ h = np .histogram (dcrTimes , 300 )
76
+ mplhep . histplot ( h , label = "Time distribution of DCR" , ax = ax [ 0 ])
77
+ ax [ 0 ]. set_xlabel ( "Time [ns]" )
78
+ ax [ 0 ]. legend ( frameon = False )
79
+
80
+ h = np . histogram ( dcrDelays , 300 , density = True )
81
+ mplhep . histplot ( h , label = "Inter-arriving time distribution of DCR" , ax = ax [ 1 ])
82
+ x = np . linspace ( 0 , dcrDelays . max (), 100 )
83
+ ax [ 1 ]. plot ( x , exp ( x , * fit . values ), label = "Exponential fit " )
84
+ ax [ 1 ]. set_xlabel ("Time [s ]" )
85
+ ax [ 1 ] .legend (frameon = False )
86
86
plt .show ()
87
87
88
88
tableData = {
0 commit comments