Histogram complete
This commit is contained in:
parent
c75458515d
commit
00d885ee57
@ -1,6 +1,8 @@
|
|||||||
package inr.numass.data
|
package inr.numass.data
|
||||||
|
|
||||||
import groovy.transform.CompileStatic
|
import groovy.transform.CompileStatic
|
||||||
|
import hep.dataforge.maths.histogram.Histogram
|
||||||
|
import hep.dataforge.maths.histogram.UnivariateHistogram
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by darksnake on 27-Jun-17.
|
* Created by darksnake on 27-Jun-17.
|
||||||
@ -22,9 +24,24 @@ class PointAnalyzer {
|
|||||||
}
|
}
|
||||||
lastEvent = event
|
lastEvent = event
|
||||||
}
|
}
|
||||||
double cr = 1d/(totalT/totalN - t0);
|
double cr = 1d / (totalT / totalN - t0);
|
||||||
return new Result(cr: cr, crErr: cr / Math.sqrt(totalN), num: totalN, t0: t0, loChannel: loChannel, upChannel: upChannel)
|
return new Result(cr: cr, crErr: cr / Math.sqrt(totalN), num: totalN, t0: t0, loChannel: loChannel, upChannel: upChannel)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Histogram histogram(RawNMPoint point, int loChannel = 0, int upChannel = 4000) {
|
||||||
|
List<Double> ts = new ArrayList<>();
|
||||||
|
NMEvent lastEvent = point.events[0];
|
||||||
|
|
||||||
|
for (int i = 1; i < point.events.size(); i++) {
|
||||||
|
NMEvent event = point.events[i];
|
||||||
|
double t = event.time - lastEvent.time;
|
||||||
|
if (t >= 0 && event.chanel <= upChannel && event.chanel >= loChannel) {
|
||||||
|
ts << t
|
||||||
|
}
|
||||||
|
lastEvent = event
|
||||||
|
}
|
||||||
|
return UnivariateHistogram.buildUniform(0d, 5e-4, 1e-6).fill(ts.stream().mapToDouble { it })
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Result {
|
static class Result {
|
||||||
|
@ -29,8 +29,19 @@ shell.eval {
|
|||||||
|
|
||||||
NumassStorage storage = NumassStorageFactory.buildLocal(rootDir);
|
NumassStorage storage = NumassStorageFactory.buildLocal(rootDir);
|
||||||
|
|
||||||
def hv = 14000;
|
def hv = 15000;
|
||||||
def point = storage.provide("loader::set_2/rawPoint::$hv", RawNMPoint.class).get();
|
def point = storage.provide("loader::set_5/rawPoint::$hv", RawNMPoint.class).get();
|
||||||
|
|
||||||
|
def histogram = PointAnalyzer.histogram(point,1000,1300).asTable();
|
||||||
|
|
||||||
|
plot.configure("histogram"){
|
||||||
|
yAxis(type:"log")
|
||||||
|
}
|
||||||
|
|
||||||
|
plot.plot(histogram, ["frame": "histogram","showLine": true, "showSymbol": false, "showErrors": false, "connectionType": "step"]){
|
||||||
|
adapter("x.value": "x", "y.value": "count")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def t0 = (1..150).collect { 5.5e-6 + 2e-7 * it }
|
def t0 = (1..150).collect { 5.5e-6 + 2e-7 * it }
|
||||||
|
|
||||||
@ -42,8 +53,7 @@ shell.eval {
|
|||||||
|
|
||||||
plot.plot(plotPoints, ["name": hv])
|
plot.plot(plotPoints, ["name": hv])
|
||||||
|
|
||||||
|
// plot.plot(title: "dead time", from: 5.5e-6, to: 2e-5) { point.cr * 1d / (1d - 6.55e-6 * point.cr) }
|
||||||
plot.plot(title: "dead time", from: 5.5e-6, to: 2e-5) { point.cr * 1d / (1d - 6.55e-6 * point.cr) }
|
|
||||||
|
|
||||||
storage.close()
|
storage.close()
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user