Project

General

Profile

Tests and Cuts » History » Version 1

Ole Hansen, 04/05/2018 09:57 AM

1 1 Ole Hansen
h1. Tests and Cuts
2
3
h2. Controlling data analysis flow with cuts
4
5
To define tests/cuts to be evaluated at each stage of the analysis, test definitions are placed in a plain-text input file, the "cut definition file". The file name must be given to the analyzer via a call to "@SetCutFile()@":https://hallaweb.jlab.org/podd/html/THaAnalyzer.html#THaAnalyzer:SetCutFile. Example:
6
7
<pre>
8
analyzer [24] THaAnalyzer* analyzer = new THaAnalyzer;
9
analyzer [25] analyzer->SetCutFile("demo.cuts")
10
</pre>
11
12
The format of the file is illustrated in the following example:
13
14
<pre>
15
# Demo cut definition file demo.cuts
16
#
17
Block: RawDecode
18
19
evtyp1            g.evtyp==1          // Event type 1 (=HRSR main trigger)
20
poshel            g.helicity==1
21
neghel            g.helicity==-1
22
goodhel           poshel||neghel
23
RawDecode_master  evtyp1
24
25
Block: Decode
26
27
NoisyU1           R.vdc.u1.nhit>50
28
NoisyV1           R.vdc.v1.nhit>50
29
NoisyU2           R.vdc.u2.nhit>50
30
NoisyV2           R.vdc.v2.nhit>50
31
NoisyVDC          NoisyU1||NoisyV1||NoisyU2||NoisyV2
32
EnoughShowerHits  R.sh.nhit>10
33
Decode_master     !NoisyVDC
34
</pre>
35
36
If a test with the name "blockname"_master is defined (example "Decode_master"), then if this test is false for a given event, further analysis of that event will be skipped.
37
38
A summary of the test results is printed to the screen at the end of the analysis. A copy of the printout ("cut summary") can be written to a file if the name of the file is set via a call to "@SetSummaryFile()@":https://hallaweb.jlab.org/podd/html/THaAnalyzer.html#THaAnalyzer:SetSummaryFile before starting the analysis.
39
40
See the "examples" directory and the "Quickstart Guide":https://hallaweb.jlab.org/podd/doc/quickstart.html for more examples.
41
42
Notes on the format of the definition file:
43
44
* Comments start with "#" or "//". Inline comments are allowed. Empty lines (all whitespace) are ignored.
45
* Blocks of tests are introduced with a line containing "Block: name". The block names must correspond to the predefined names of the analysis stages. Each block will be evaluated at the end of the respective stage. The following stages are defined in the standard analyzer "@THaAnalyzer@":https://hallaweb.jlab.org/podd/html/THaAnalyzer.html:
46
** "RawDecode": After "@THaEvData::LoadEvent()@":https://hallaweb.jlab.org/podd/html/THaEvData.html#THaEvData:LoadEvent.
47
** "Decode": After Decode() of all detectors in all apparatuses.
48
** "CoarseTracking": After CoarseTrack() of all detectors of all apparatuses.
49
** "CoarseReconstruct": After CoarseProcess() of all detectors of all apparatuses.
50
** "Tracking": After FineTrack() of all detectors of all apparatuses.
51
** "Reconstruct": After FineProcess() of all detectors of all apparatuses.
52
** "Physics": After Process() of all physics modules, i.e. right before writing the output. 
53
* Test definitions start with the name of the test (which may not contain any whitespace) followed by the definition separated by whitespace. Unlike the name, the definition may contain arbitrary whitespace. Test names must be unique.
54
* The length of the block name, test name, and test definition strings is limited to 255 characters each.
55
* Tests will be defined exactly in the order in which they appear in the file. Within each block, tests will be evaluated exactly in the order in which they are defined. The blocks will be evaluated in the order the analysis stages occur.
56
* At present, the program does not check whether variables used in a certain test block are actually valid when the block is evaluated. The user must ensure that his/her test definitions make sense. For instance, variables filled by Physics Modules, such as "R.gold.dp", will not be valid in any test block other than "Physics". In particular they will be invalid (usually = 1e38) in the "Reconstruct" test block.
57
58
See also "@THaCutList::Load()@":https://hallaweb.jlab.org/podd/html/THaCutList.html#THaCutList:Load.
59
60
h2. Using tests as conditions in THaOutput
61
62
Tests defined in the cut definition file as well as separately-defined tests can be used as conditions for filling histograms. For details, please see the [[Output|documentation of THaOutput]].
63
64
h2. Programming documentation
65
66
Technical details about the test/cut classes and how to use them directly can be found the [[Programming Cuts|test/cut programming documentation]].