This is a description of a package called MFINDR adapted 
to fit photon pairs to Pi0, Eta and Eta primes using E852 
data. 
The library required to link is  "mfindr.o" in the
/home/lemond/e852/lib.irix5 directory, with the corresponding
RS6000 version, named "mfindr_i.o", in 
/home/lemond/e852/lib.rs6000.

In the absence of covariant matrices for photons the following
input errors are suggested (see below):
    sigma(E)     = ( ( 2 + ( 6 / sqrt(E) ) ) / 100 ) * E,  The energy;
    sigma(theta) = 0.028 * theta,  The polar angle;
    sigma(phi)   = 0.028 * phi,    The azimuthal angle . 
 
The current version is preliminary with future improvements
and additions possible.


Usage
-----

In order to utilise this package, the following two (FORTRAN) 
routines need to be called.     

(N.B. 
  For the purposes of this description, 

    (a) it is assumed that this package is called from 
        within a "C" program,

    (b) the word meson(s) generically refers to Pi0, Eta, 
        Eta prime, or a combination thereof as determined
        by the value of the integer "imcode" below. )



1- 
  ebpini(imcode, idump) 

where,
  imcode is an integer with the following possible values:
    imcode =   1 ---->  only Pi0 fits are attempted,
    imcode =  11 ---->  only Pi0 and Eta fits are attempted,
    imcode = 111 ---->  Pi0, Eta and Eta prime fits are attempted.

  idump is an integer with the following possible values:
    idump = 1   ---->  Provides limited dumping of information
                        in a separate file (unit 25) from the
                        standard output file. This would be
                        appropriate for debugging and/or dumping 
                        of a small number of events,
    idump = 0   ---->  No dumping carried out.

   
This routine should be called only once in the initialization
stage of the ("main") analysis program.


2-
  ebpift( NGAMMA, GP4, GERR, npar, npardx, mesatt, mesmas, meschi,
         mesflg, mesbst, pull )

where
  INPUT
  -----
 NGAMMA  = (integer) Total number of photons to be used,
 GP4(L1, M1) = (real) The 4-momentum (L1=1,4 -> Px, Py, Pz, E)
                      for each photon number M1,  

                      Maximum size of L1 is 20
                      Maximum size of M1 is 30

 GERR(L1, M1) = (real) The photon errors for each photon number M1;
                       L1=1 --> sigma(E)/E          See above, 
                       L1=2 --> sigma(theta)/theta   "    " 
                       L1=3 --> sigma(phi)/phi       "    "

                      Maximum size of L1 is 20
                      Maximum size of M1 is 30

 OUTPUT
 ------

npar(k) = (integer) k = 1 --> Number of photons (for self-
                              containment and consistency),
                    k = 2 --> Total Number of fits (or mesons),
                    k = 3 --> Number of gamma-gamma combinations
                    k = 4 --> Number of Pi0s,
                    k = 5 --> Number of Etas.
                    k = 6 --> Number of Eta primes.

                      Maximum size of k is 20
     
npardx(L2, M2) = (integer) L2 = 1 --> fit index
                           L2 = 2 --> fit's identification
                                      number (7 for Pi0,
                                      17 for Eta, 30 for Etaprime) 
                           L2 = 3 --> photon-pair index
                                      (= gamma1 index * 1000 + 
                                         gamma2 index)
                           L2 = 4 --> photon-pair mass flag
                                      flag = 1. for pi0,
                                      flag = 2. for eta,
                                      flag = 3. for eta prime,

                           M2 --> fit(meson) number

                      Maximum size of L2 is 20
                      Maximum size of M2 is 10

mesatt(L3, M3) = (real) L3 =  1- 5 --> meson's Px, Py, Pz, E, P 
                                       respectively
                        L3 =  6-10 --> absolute errors for the above
                        L3 = 11    --> reconstructed meson mass

                        M3 --> meson number

                      Maximum size of L3 is 40
                      Maximum size of M3 is 10


mesmas(L4, L5) = (real) pair mass of photons L4 and L5

                      Maximum size of L4 is 20
                      Maximum size of L5 is 20


meschi(L6, L7) = (real) pair chi**2 of photons L6 and L7

                      Maximum size of L6 is 20
                      Maximum size of L7 is 20

mesflg(L8, L9) = (real) meson mass flag of photons L8 and L9
                        flag = 1. for pi0,
                        flag = 2. for eta,
                        flag = 3. for eta prime,
                       

                      Maximum size of L8 is 20
                      Maximum size of L9 is 20


mesbst(L10, M4) = (real) L10 = 1 --> Best pair mass 
                         L10 = 2 --> Best pair chi**2
                         L10 = 3 --> Best pair Confidence Level

                         M4 = pair number

                      Maximum size of L10 is 20
                      Maximum size of M4  is 10 .

pull(L11, M5)   = (real) L11 = 1 --> Pull in the polar 
                                     angle (theta) of 
                                     photon # 1 in the 
                                     pair combination M5
                         L11 = 2 --> Pull in the azimuthal 
                                     angle (phi) of photon # 1
                         L11 = 3 --> Pull in the polar 
                                     angle (theta) of photon # 2
                         L11 = 4 --> Pull in the azimuthal 
                                     angle (phi) of photon # 2
                         L11 = 5 --> Pull in Mass of photons 
                                     1 & 2 in combination M5

                         M5 = Pair combination of photons 1 & 2.

                      Maximum size of L11 is 20  .
                      Maximum size of M5  is 400 .




Note:
----
This routine should be called only once per event in the
analysis program.

This package maybe utilised in a generalized form whereby only
the information coming from all the gamma-gamma combinations
is used (mesmas & meschi), hence, permitting the user to make 
selections based upon that information. 
Alternatively, or additionally, the user may take advantage of
the fit results (mesatt, mesbst & pull) of the meson pair 
reconstruction.
------------------------------------------------------------

The following points should be noted:

a)
The maximum number of input photons allowed is 20, otherwise
only the first 20 photons are considered by the fitter. 

b)
The input photon attributes (GP4) should be provided consecutively
for photons with index 1 to NGAMMA).

c)
Future  improvements will include handling of merged-photons 
(single-cluster mesons) capability, if required.

d)
This package does not carry out any vertex fitting.




Please refer all relevant queries and bug reports to me.
               
                                      Amir H Sanjari