---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
MUV1 PULSE ANALYSIS 14/4/2025 ---------Split-normal fits-------------------------------------
---------------------------------------------------------------------------------------------------------

INTRODUCTION
------------

As shown below, a split-normal function gives a good description of MUV1 data.
The chi**2/ndf  of the fit of the function to the data is ~1; high chi**2 fits are probably
due to an underestimate of the errors for high-amplitude pulses.

The split-normal PDF is defined in terms of the mode, amplitude, sigma1 and sigma2
of the time distribution of the number of counts in a MUV1 signal. From these variables, the
mean and area of the pulse can be calculated.

 split-normal reference.

In addition, trial fits of a log-normal function to the MUV1 data are discussed  in Section 5 below.

 Log-normal reference.



ONE-PEAK FITS
-------------

1)   muvfit1.pdf  One peak fits.   split-normal  HIGH + LOW  AMP. 11/4/25

Comment:  The pulse data is well fitted by a split-normal.  Error set = 4 . 5-constraint fits.
Fitted variables:  baseline + amplitude, time, sigma1,sigma2 of single peak. 
Fits: sigma1 (lhs) ~ 30 ns,  sigma2 (rhs) ~ 43 ns;   mean = mode + 10 ns, error of mode ~ 4 ns.
Overall RMS  ~ 36 ns. Mean baseline ~ 1 count.

Further work is required to remove  early out-of-time data from the fits and to study high chi**2 and high sigma fits.
Also, it would be useful to have muon and pion MC data over a range of momenta to check these results. 



2)  muvfit1devb.pdf  One peak fits. . no baseline fit.
  error fixed at 4  counts.. 
Fitted variables:   amplitude, time, sigma1,sigma2 of single peak. 
The baseline is set at the minimum count of the pulse data.
This 6-constraint fit fits the pulse data well. The results of the fit agree within errors with those obtained with a 5-constraint
(baseline-incuded) fit.  
Note the profile plot on page 55  that demonstrates that the error on the number of counts is
amplitude dependent.

Addition 21/06/25
The Plots on Pages 57,58, 59  show that the mean time and rms of the histograms of the pulses are consistent 
wirh the corresponding values found from the fits of a split-normal function to the histograms. Note that
some early-out-of-time signals have been removed in this analysis. 

Conclusion:  for single-peak pulses, after removal of early-out-of-time data,  the remaining data can be described 
with equal accuracy by the mean time and rms of this data,  or  the parameters of a split-normal function fitted to
this data.

The advantage of the fit is that it gives the correlated errors for  the parameters describing the pulse distribution.


muvfit1devb2.pdf  One peak fits. . no baseline fit.
High statistics comparison of  fit and data mean and rms. 22/6/25

Conclusion: For single peak pulses, if the meant time of the data lies within 150 - 250 ns, 
define the pulse parameters from the data (the mean, rms, sum counts); otherwise make a fit
to get the pulse parameters, either a split-normal or log-normal fit. 


muvfit1devb3.pdf  Add counts comparison.
muvfit1devb4.pdf   150 gt  data-mean lt 250 selected. 


3)  muvfit1devba.pdf  One peak fits. dev. no baseline fit.
  error fixed at 4  counts.  Additional 2D plots to study sigma1,sigma2 vs channel number see plot 57.
  Now  obsolete;  see muvfit1devbb.pdf below.



4) Study of sigma1 and sigma2 vs MUV1 channel number

  muvfit1devbb.pdf   Split-normal fits. Sigma1 and sigma2 vs channel and side number.
  28000 fits, sigma plots only, 5 pages.
  One peak fits. dev. no baseline fit.  error fixed at 4  counts.  

Conclude: the Page 1 plots of sigma1 and sigma2  show that sigma1 is, within errors, independent of the MUV1 channel number.
          In contrast, sigma2, the variable  that describes the trailing edge of the MUV1 pulse, is channel dependent;
          for channels in the range 9 - 40, sigma2 is, within errors, independent of channel number and has a value of ~ 42 ns.
          Outside the 9 - 40 range , for sides 0 and 2, sigma2 is equal to ~50 ns. For sides 1 and 3, sigma 2 is ~ 50 ns
          for channels greater than 40. 
          
           
5)  muvfitln1b.pdf  log-normal test

   This is a first trial of a 3 - parameter log-normal fit to MUV1 pulse data.
   The fit parameters are amplitude, mu  and sigma, where exp(mu) = the median of the log-normal, and the mode 
   =  exp(mu - sigma**2) ,   mean = exp(mu + sigma**2/2) , variance = (exp(sigma**2) -1)*exp(2*mu +sigma**2)

Conclude: By eye,  the log-normal is a good representaion of the data but the fit tends to overestimate the mean 
          and rms of the data;   Compare with the split-normal plots:   muvfit1devb.pdf  . 
          Both the log-normal and split-normal functions describe the single pulse data well.
          Work in progress. 

 Log-normal reference.



muvfit1.f muvfit1.kumac xfun used.
Fits made using HBOOK routine HFITH.


TWO-PEAK FITS
-------------

  muvfit2.pdf  Two-peak fits. split-normal  HIGH + LOW  AMP. 11/4/25

Comment: Split- normal fits data well. Error set = 4. 2-constraint fits.
Fitted variables: amplitude,time,sigma1,sigma2 for peak1; amplitude,time,sigma1,sigma2 for peak2. Baseline = 0.
Fits: Mean sigmas fitted 31 ns ,35 ns  apparently inconsistent with single peak fits (see muvfi1.pdf).

Work is needed to determine the point error as a function of amplitude and to study high chi**2 fits.

muvfit2.f muvfit2.kumac fun6 used.
Fits made using HBOOK routine HFITH.

NOTE: pulses selected with max - min greater than 25 counts;  peak - min greater than 15 counts.
      Plots are in units  (counts - minimum counts).

 split-normal reference.



General remark
--------------

A model of the MUV pulse distribution is useful to determine:

1) the mode  of the distribution;
2) the mean for a asymmetric distribution;
3) the amplitude at the mode;
4) the area of the distribution;
5) the size of the tails;
6) the level of background;
7) the error-matrix for the above variables.

---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------

cd MUVdev
./clg753 x x   
./x  to produce x.dat
paw  exec x     for x.dat to x.ps
./trans x       for x.ps tc  public_html/newplots/x.pdf


public_html/MUV1.html


---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------

Development and old fits.

  muvfit1dev.pdf  One peak fits. dev. residuals added 24/04/25 
  muvfit1deva.pdf  One peak fits. dev. baseline fit iplots 141 601 added. errors fixed 4 28/4/25
  muvfit1devb.pdf  One peak fits. dev. no baseline fit. errors fixed at 4 counts. 

................................................................................................................
  muvfit1devc.pdf  One peak fits. dev. no baseline fit. error studies.
  errors set in muvfit1devc.f  010525



      do kk =1,11
      hh = cont(kk)  ! mod 010425
      errors(kk) = 1.75
      hh = cont(kk)  ! mod 010425
      if(hh.gt.25.)errors(kk) = 1.75*(hh/25.)
      enddo


Structure  in chi**2 / amplitude  ??


.....  CORRELATIONS ...........................................................................................................


  muvfit1devd.pdf  One peak fits. dev. no baseline fit. 
   errors = 4.  correlation study.  8/5/25 

     p1  = amplitude (counts)
     p2  = time (ns)
     P3  = sigma lhs (ns)
     p4  = sigma rhs (ns)

     **********************************************
     *                                            *
     * FUNCTION MINIMIZATION BY SUBROUTINE HFITL  *
     * VARIABLE-METRIC METHOD                     *
     * ID =       2000                            *
     *                                            *
     **********************************************
 CONVERGENCE WHEN ESTIMATED DISTANCE TO MINIMUM (EDM) .LT.  0.10E-03

 FCN=  0.9209323E-01 FROM MIGRAD    STATUS=CONVERGED    110 CALLS      111 TOTAL
                     EDM=  0.75E-05    STRATEGY= 1      ERROR MATRIX ACCURATE 

  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME        VALUE          ERROR          SIZE      DERIVATIVE 
   1      P1        99.951        6.9200       0.25286       0.67947E-04   amplitude
   2      P2        175.26        5.1412       0.44339      -0.13379E-02   time
   3      P3        27.183        3.2930       0.68769E-01   0.13004E-02   sigma1
   4      P4        42.963        4.2528       0.10869       0.57200E-04   sigma2

 PARAMETER  CORRELATION COEFFICIENTS
       NO.  GLOBAL     1     2     3     4
        1  0.63137  1.000 0.076-0.153-0.383   amplitude
        2  0.92902  0.076 1.000 0.867-0.801   time
        3  0.89475 -0.153 0.867 1.000-0.624   sigma1
        4  0.86393 -0.383-0.801-0.624 1.000   sigma2

 CHISQUARE = 0.3070E-01  NPFIT =     7

Conclude:  ~ 80% correlation between fitted time of pulse and sigmas.
           ~ 60% correlation between sigmas.
           amplitude is the least correlated variable

NOTE: fitted values agree between muvfit1devb.f and muvfit1devd.f to 3 figures. 
      chi**2 shows significant differences between HFITH and HFITL. Needs study:
      HFITH  is cj**2/dof, HFITL is chi**2.
     
 

................................................................................................................
 
  muvfitln1b.pdf  log-normal test


 
  muvfit2dev.pdf  Two-peak fits. dev.

  muvplots5askew2.pdf   dev. version,  two-piece normal (2PN) HIGH +LOW  AMP. 26/3/25
  muvplotskew41.pdf   dev. version, 2-peak fits, two-piece normal (2PN) HIGH AMP. 10/4/25