Adding Valuators
To add valuators in the SLD event display system,
you need to add some valuator code to the appropriate draw routine
and you need to add some constants data.
Modifying the Draw Routine
For valuators to work on a given object type,
the object type's draw routine must store some valuator information
for each DSPOBJ bank that it creates.
Take the overall structure from some draw routine that already
contains valuator code.
PHVKAL PREPMORT is a good example.
Near the bottom of PHVKAL is the comment "Add a valuator bank."
The few lines that appear after that comment are all you will need.
You may make cuts on up to eight quantities.
How you compute these quantities is of course up to you and depends
on the physics you wish to study.
Store the quantities in VALUES(1 through 8).
Set unused members of the VALUES array to zero.
Then call DSPUVAL as in PHVKAL.
The second argument tells which set of valuator definitions should apply.
It should match the VALTYPE in the DSPUVLU bank that you will write
(see below).
The third argument is generally set to false. Set it true only if you
have normalized your VALUES to run from 0 to 1.
Include the line P_DSPOBJ%(DSPOVAL) = P_DSPOVAL exactly as
in the example. This links the valuator data to the display object.
Then just make sure your new version of the draw routine gets loaded.
Adding Valuator Constants
Setting up constants to define the new valuator is a little bit
complicated because there are so many things to define.
You need to define what kind of cuts to make, which knobs to use and
what the initial knob positions should be.
But most of the work just involves borrowing definitions
from valuators that already exist.
The basic valuator cuts are defined by DSPVLU8 banks in DSPVALS CONSTANT.
You define additional valuator cuts by writing a new constant file
that contains DSPUVLU banks (and perhaps DSPUVPR, DSPUVUN and
DSPUVSC banks).
You then merge your banks into the display system by issuing the
IDA command DSP USERDATA followed by the filename of your constant file.
In writing your new dspuvlu banks, study the existing dspuvlu banks
in KALUDSP and CRDUDSP CONSTANT
(and the basic dspvlu8 banks in DSPVALS CONSTANT).
The DSPUVLU banks
-
VALTYPE
should be the string that you gave as the second argument to the
DSPUVAL call in your draw routine.
-
VALDESC
is the text string that will actually be written in the valuator menu.
It can be up to 64 characters.
-
IVALS
is the initial position for the valuator knobs.
This is important as it determines what cuts will be in effect
when you first draw.
The ivals index corresponds to the physical knob number
(this is KNOBNUM rather than the knob block index).
-
IVALS of 0 will start the cut at its minimum value,
-
IVALS of 1 will start the cut at its maximum value.
-
VALTEST
defines how the tests are to be done.
It has expressions like V1<P1<V5&V2<P2<V6.
-
P1 through P8 are the VALUES(1) through VALUES(8) that you set in your
valuator routine.
-
V1 through V8 are the physical knobs you use to make these cuts.
For each Vn, there should be a KNOBNUM / n / in some KNOB block.
-
The object is only displayed if its values pass the VALTEST.
-
For example, P1<V1 means the object will only be displayed if
the first of its values is less than where the first knob is set.
-
V1<P1 means the object will only be displayed if
the first of its values is more than where the first knob is set.
-
V1<P1<V5 means the object will only be displayed if the first of its
values is between the positions of the first knob and the fifth knob.
-
V1<P1<V1+V5 means the object will only be displayed if
the first of its values is between the positions of the first knob
and the sum of the first and fifth knob (i.e., the first knob has set
a beginning point and the fifth knob has set an interval).
-
By means of an ampersand, you can have several tests on the same object.
(To speed things up, put the test most likely to fail as your
first test.)
For example, you could specify V1<P1&P2<V2.
-
NKNOBS
is the number of knobs you are going to use.
For each knob, you must provide a KNOB block with the following three
entries:
-
KNOBNUM
is the physical knob that you want to do the cut
(the top left knob is number 1, below that is 2, 3 and 4,
the top right is number 5, below that is 6, 7 and 8).
It is important to keep clear the difference between KNOBNUM and the
KNOB block index. Any KNOB block could control the top left knob as
long as that block contained the line KNOBNUM / 1 /.
-
PARMTYPE
is the kind of parameter to be cut on.
For example, the parmtype CPHI denotes a phi angle.
The parmtype TMOM denotes a momentum.
Each parmtype is further defined in another kind of bank.
-
Sometimes, you can just use an existing parmtype.
For example, if you are making a phi cut on some DC data,
you can just use the parmtype CPHI that was already defined for MCTRACK
cuts.
These already-defined parmtypes can be found in the DSPVPRM banks of
DSPVALS CONSTANT.
-
At other times, you need to define a new parmtype.
You do this by supplying an appropriate DSPUVPR bank (details below).
Parmtype can be up to 8 characters.
-
KNOBNAME
is the knob name that will appear in the valuator menus.
You will pick on this text line to make the scale labels come up for
this cut.
It can be up to 40 characters.
The DSPUVPR banks
Recall that in the DSPUVLU bank, you had to supply a parmtype.
If this was a new parmtype, you need to define an appropriate
DSPUVPR bank.
-
PARMTYPE
should match the parmtype you used in your dspuvlu bank.
-
PARMDESC
is a text string that describes the parameter.
It can be up to 40 characters.
-
PRITEXT and SECTEXT
are a UG extended text strings to be used in the cut summary
that appears at the lower right of the screen.
See the UG manual for details (section 2.6, p-64,
"The Extended Character Set").
They can be up to 16 characters.
-
UNITTYPE
is the kind of units to display the cut in.
For example, GeV/C, or cm, or pi.
Each unittype is further defined in another kind of bank.
-
Sometimes, you can just use an existing unittype.
For example, if the parameter is the length of something,
you can just use the unittype cm that was already defined.
These already-defined unittypes can be found in the DSPVUNI banks of
DSPVALS CONSTANT.
-
At other times, you need to define a new unittype.
You do this by supplying an appropriate DSPUVUN bank (details below).
Unittype can be up to 8 characters.
-
MINVALUE and MAXVALUE
are the minimum and maximum values allowed for the parameter.
Values smaller than minvalue will be set to minvalue and
values larger than maxvalue will be set to maxvalue.
The valuator knob will run between these two values.
-
By default, values will be written at six points along the scale.
You may specify some other way to label the scale by supplying a
DSPUVSC bank (details below).
The DSPUVUN banks
Recall that in the DSPUVPR bank, you had to supply a unittype.
If this was a new unittype, you need to define an appropriate
DSPUVUN bank.
-
UNITTYPE
should match the unittype you used in you DSPUVUN bank.
-
USCALE
is a scale factor for the units.
This determines how the valuator scale will be marked off.
Often this is just one.
But if, for example, you want the scale to read in units of pi,
you would enter 3.1415927 as the USCALE.
-
PRITEXT and SECTEXT
are a UG extended text strings to be used in the cut summary
that appears at the lower right of the screen.
See the UG manual for details (section 2.6, p-64,
"The Extended Character Set").
They can be up to 16 characters.
The DSPUVSC banks
If you have created a new minvalue/maxvalue pair, values will be written
at six points along the scale.
You may specify some other way to label the scale by defining an
appropriate DSPUVSC bank.
-
MINVALUE and MAXVALUE
should match the minvalue and maxvalue you used in your DSPUVPR bank.
-
NLABELS
is the number of labels you want to appear on the scale.
There can be up to 11.
-
XCOORD
are the X positions (from 0 to 1) where the labels should be centered.
-
LABEL
are the labels to be written.
Each can be up to 8 characters.
Joseph Perl
25 September 1997