@@ -4,20 +4,6 @@ import org.jlab.groot.data.TDirectory
44
55class QA {
66
7- // / @returns a single horizontal cut line
8- // / @param value the y-axis value of this line
9- // / @param the color of this line
10- static GraphErrors makeCutLine (double value , String color = null ) {
11- if (value== null ) return null ;
12- line_name = [
13- ' plotLine' ,
14- ' horizontal' ,
15- value,
16- color ?: ' black' ,
17- ]. join(' :' );
18- new GraphErrors (line_name);
19- }
20-
217 // / result of `cutGraphs`
228 class CutGraphResult {
239 // / graphs which include only the "bad" points (points outside QA cuts)
@@ -40,18 +26,26 @@ class QA {
4026 [args. lb, args. lb_color],
4127 [args. ub, args. ub_color],
4228 ]
43- .collect{makeCutLine(* it)}
29+ .collect{ val , color ->
30+ if (val== null ) return null ;
31+ new GraphErrors ([
32+ ' plotLine' ,
33+ ' horizontal' ,
34+ value,
35+ color ?: ' black' ,
36+ ]. join(' :' ));
37+ }
4438 .findAll{it != null };
45- // define QA cut
46- def reqs = []
39+ // define QA criteria
40+ def qa_crit = []
4741 if (args. lb != null )
48- reqs << {val -> val >= args. lb };
42+ qa_crit << {val -> val >= args. lb };
4943 if (args. ub != null )
50- reqs << {val -> val <= args. ub };
51- def checkPoint = { val ->
44+ qa_crit << {val -> val <= args. ub };
45+ def qa_cut = { val ->
5246 allow = true ;
53- reqs . each{ req -> allow &= req (val) };
54- pass ;
47+ qa_crit . each{ crit -> allow &= crit (val) };
48+ allow ;
5549 };
5650 // apply cuts
5751 result. bad_graphs = input_graphs. collect{ input_graph ->
@@ -64,7 +58,7 @@ class QA {
6458 input_graph. getDataSize(0 ). times{ i ->
6559 def val_x = input_graph. getDataX(i);
6660 def val_y = input_graph. getDataY(i);
67- if (! checkPoint (val_y))
61+ if (! qa_cut (val_y))
6862 bad_graph. addPoint(val_x, val_y);
6963 }
7064 bad_graph;
0 commit comments