next up previous contents
Next: Replacing the Main Event Up: Using the Standard User Previous: Calling a Processor from   Contents

Adding User Titles

Adding your own titles allows you to control your software at execution time. This is explained in detail in the Programmer's Manual, but a simple example here can illustrate the main points. Suppose, for example 1 above, you want to be able to control the PMT hit cut. Proceed as follows:-

  1. Create a titles bank, say USER 1, and store it in the file user.dat:-
    *DO   USER   1  -i(-I)           #.  User titles.
    #.
    #.
    #.       Standard Database Header
    #.
    19750101        0 20380516   223319  #.  1..4  
           0        0        0           #.  5..7  
           0        0        0           #.  8..10 
    19750101        0 20380516   223319  #. 11..14 
           0        0                    #. 15..16 
    4*0                                  #. 17..20 
    10*0                                 #. 21..30 
    #.
    #.    End of Standard Database Header
    #.
    50                               #.  PMT hit cut.
    
    This creates a titles bank USER 1 containing a standard (but still to be defined) database header, and 1 word of user data, currently set to 50. The -i signals a format description option and (-I) means that all words are integer.

  2. Create a common block, say USER_COM, and store it in the file user_com.inc:-
          integer           lauser(8),luser,lduser
          equivalence       (lauser(6),luser), (lauser(7),lduser)
     
          common /user_com/   lauser
    
    This defines a Link Access Block, the most important word of which is LDUSER, which will point to the word before the first data word in the USER 1 bank.

  3. Now update user_ini.for:-
          include 'user_com.inc'
    .
    .
    .
     
    *     Request management of USER 1 without memory mapping.
    *     Specify request level 2 (abort if bank missing)
    *     Don't declare an SU id.
          lauser(8) = 0
          call mt_request_titles( 'USER', 1, 2, lauser, 0)
    
    Once this call has been made you can use the LDUSER link.

  4. Update user_exe.for, adding the include files:-
          include 'mt.inc'
          include 'user_com.inc'
    
    and replacing:-
          if (num_hits .le. 40 ) call ztell( 800 , 1 )
    
    by:-
          if (num_hits .le. icons(lduser+1) ) call ztell( 800 , 1 )
    
    The array ICONS (and equivalenced RCONS), which is defined in mt.inc, holds all titles banks. LDUSER+1 points to the first data word (i.e. the PMT hit cut).

  5. Recompile and relink the program.

  6. Update my_run.cmd to load the user.dat file:-
    set bank job 1 word 2 to 10
    set bank job 1 word 20 to 'my_event_output.dat'
    titles user.dat
    @run
    

  7. Now run the program. To change the PMT cut, edit user.dat or simply type e.g.:-
    set bank user 1 word 1 to 60
    
    before typing @my_run.cmd.


next up previous contents
Next: Replacing the Main Event Up: Using the Standard User Previous: Calling a Processor from   Contents
sno Guest Acct 2009-09-09