The filter request banks (FLTR) work in almost exactly the same way as ntuple requests (NTPRs) as demonstrated by the following example:-
*DO FLTR 200 -i(35I 1F 3I -H) #. FLTR: Big event inside 4m #. #. Standard Database Header #. 19750101 0 20380516 223319 #. 1..4 Intrinsic validity 0 0 0 #. 5..7 Data type, Task type, Format no. 0 0 0 #. 8..10 Creation Date, Time, Source Id. 19750101 0 20380516 223319 #. 11..14 Effective validity 0 0 #. 15..16 Entry Date Time 4*0 #. 17..20 Spare 10*0 #. 21..30 Temporary data (not in database) #. #. User Data #. 3*0 #. 3 Reserved words (don't touch!). 0 #. Enable flag: =0 Disable, =1 Enable. 5000 #. Primary allocation (not critical). -999999. #. "Undefined" value. 1 #. Discard partial entry: =0 No, =1 Yes. 0 #. Scan D/S: =0 No, =1 AND scan, = 2 OR scan. 0 #. Call NTP_PACK_USER: =0 No, =1 Yes 'fltdata; ' #. Ntuple name. #. #. There now comes the FLTR test definition. The test is true if the #. last variable has a non-zero value. #. #. Variable Function Parameter(s) #. Name #. ' nhits float_equals EV+$KEV_NPM; ' ' rfit magnitude FTTV+$KFTXV_X; ' ' nhit_cut gt nhits,50.; ' ' r_cut lt rfit,400.; ' ' test and nhit_cut, r_cut; ' #. ' END_OF_NTUPLE; ' #. This marks the end of the ntuple. |
The event passes the test if the last variable (in this case `test')
has a non-zero value, but fails if it is zero or if no filter entry is
generated. An entry is not generated if one of the banks referenced is
not present (and Discard Partial Entry switch is on) or if a variable
is out of bounds. The latter case allows tests to be constructed with
a single line such as this one for (
):
' nhits float_equals EV+$KEV_NPM: 50 999; '
but this construction should not be used if AND scanning is involved as
explained below. It is better to play safe and use a logical DQF, for example,
the above test is better written as:-
although this now costs the an extra line, getting the number of hits and converting it to floating point before applying the test.' nhits float_equals EV+$KEV_NPM; '
' nhits_ok in_range 50, nhits, 999; '
There are a few subtle differences between ntuple requests and filter requests. Firstly, it must be remembered that filter variables are never stored (that's what HBOOK ntuples are for!). Secondly, the idea of scanning the data structure takes on a different meaning. When scanning is switched on in an ntuple request (scan D/S = 1), any banks referenced in the ntuple definition with multiple occurrences in the datastructure (eg MCVX) will generate a separate ntuple entry. With the filter, such banks are scanned according to the same rules but instead generate individual tests which are treated in one of three ways:-
Scan D/S | Meaning |
0 | No scan - take the first bank reached for the test. |
1 | Form the logical AND of the tests. |
2 | Form the logical OR of the tests. |