next up previous contents index
Next: Histogram Definitions Up: CTP Definition Files Previous: Parameter Definitions   Contents   Index


Test/Cut Definitions

A test package provides a means of gathering the logic decisions of event analysis in a concise yet readable ASCII file maintained separately from the analyzer code. The results of tests are typically used to condition the incrementing of histograms. Scalers of test results are useful for computing yields and efficiencies.

In the following example of a test block, fptheta, fpphi, mass, and the array njunk are event data that are computed each event by the analyzer. The variables thmin, thmax, phimin, and phimax are parameters that are set in the previous example.

begin test hms
 goodthe = (fptheta > thmin)&&(fptheta < thmax)
 goodphi = (fpphi > phimin)&&(fpphi < phimax)
 goodphase = goodthe && goodphi
       ; Acceptable phase space of particle
 electron = mass < 10
       ; Must be an electron
 clean(1) = njunk(1) < 2
       ; Less than 2 junk hits per plane
 clean(2) = njunk(2) < 2
 clean(3) = njunk(3) < 2
 clean(4) = njunk(4) < 2
 clean(5) = njunk(5) < 2
 clean(6) = njunk(6) < 2
 allclean = clean(1)&&clean(2)&&clean(3)
       &&clean(4)&&clean(5)&&clean(6)
 goodparticle = goodphase&&electron&&allclean
 missingmass = ebeam - e1 - e2
end test
The expressions on the right hand side use any combination of a set unary and binary operators similar to the standard C operators. These operators are shown in Table 6.1.

Table: Operators allowed in test expressions. In order of precedence.
() Fortran Array element reference
[] C Array element reference
- Unary Minus
! Logical Negation
~ Ones Complement
* Multiplication
/ Division
// Division, result integerized
% Modulus
+ Addition
- Subtraction
<< Left Shift
>> Right Shift
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal
== Equal to
!= Not equal to
& Bitwise AND
^ Bitwise XOR
| Bitwise OR
&& Logical AND
^^ Logical XOR
|| Logical OR
= Assignment operator
, C Comma operator

A limited set of single argument functions are also available as shown in Table 6.2.

Table: Functions allowed in test expressions.
abs() Absolute value
sqrt() Square root

The results of the expressions will be logical or arithmetic values depending on the operators. The variables on the left hand side of the expressions are the test results. The variables need not be registered by the analyzer, but must be if the test result is needed directly by the analyzer or is a real value. Test result variables that have not been registered may still be used in subsequent test expressions and as test flags in the histogram package, but these variables will all be established as integers.


next up previous contents index
Next: Histogram Definitions Up: CTP Definition Files Previous: Parameter Definitions   Contents   Index
Mohammad Ahmed 2003-07-23