@@ -2,15 +2,15 @@ package org.jlab.clas.timeline.util
22import org.jlab.groot.data.GraphErrors
33import org.jlab.groot.data.TDirectory
44
5- class QA {
5+ // / result of `QA.cutGraphs`
6+ class CutGraphResult {
7+ // / graphs which include only the "bad" points (points outside QA cuts)
8+ public ArrayList<GraphErrors > bad_graphs;
9+ // / cut lines
10+ public ArrayList<GraphErrors > cut_lines;
11+ }
612
7- // / result of `cutGraphs`
8- class CutGraphResult {
9- // / graphs which include only the "bad" points (points outside QA cuts)
10- public GraphErrors [] bad_graphs;
11- // / cut lines
12- public GraphErrors [] cut_lines;
13- }
13+ class QA {
1414
1515 // / @param input_graphs a list of graphs to cut
1616 // / @param args.lb lower QA bound (default: no bound)
@@ -19,8 +19,8 @@ class QA {
1919 // / @param args.ub_color color of upper bound line
2020 // / @param args.out TDirectory for adding graphs and lines, if defined
2121 // / @returns `CutGraphResult`
22- static CutGraphResult cutGraphs (Map args , GraphErrors [] input_graphs ) {
23- CutGraphResult result;
22+ static CutGraphResult cutGraphs (Map args , ArrayList< GraphErrors > input_graphs ) {
23+ CutGraphResult result = new CutGraphResult () ;
2424 // make lines
2525 result. cut_lines = [
2626 [args. lb, args. lb_color],
@@ -31,7 +31,7 @@ class QA {
3131 new GraphErrors ([
3232 ' plotLine' ,
3333 ' horizontal' ,
34- value ,
34+ val ,
3535 color ?: ' black' ,
3636 ]. join(' :' ));
3737 }
@@ -43,7 +43,7 @@ class QA {
4343 if (args. ub != null )
4444 qa_crit << {val -> val <= args. ub };
4545 def qa_cut = { val ->
46- allow = true ;
46+ def allow = true ;
4747 qa_crit. each{ crit -> allow &= crit(val) };
4848 allow;
4949 };
@@ -56,10 +56,9 @@ class QA {
5656 bad_graph. setTitleY(input_graph. getTitleY());
5757 // loop over points, checking the cuts
5858 input_graph. getDataSize(0 ). times{ i ->
59- def val_x = input_graph. getDataX(i);
60- def val_y = input_graph. getDataY(i);
61- if (! qa_cut(val_y))
62- bad_graph. addPoint(val_x, val_y);
59+ def val = input_graph. getDataY(i);
60+ if (! qa_cut(val))
61+ bad_graph. addPoint(input_graph. getDataX(i), val, input_graph. getDataEX(i), input_graph. getDataEY(i));
6362 }
6463 bad_graph;
6564 }
0 commit comments