NA62 beam studies (23/3/23) (main plots from beam/html)
--------------------------

Time series analysis.
--------------------

The objective of a time series analysis is to determine the trend, 
periodic, irregular and random components of the time series. 
Here the time series is the rate of NA62 triggers taken
to be characteristic of the SPS spill. 


Introduction.
------------

To illustrate some of the analysis techniques, a simulation of the spill and 
and its analysis using Fourier transforms , periodograms
and difference plots is shown here 

Fig 1 shows a simulation of the spill. A histogram of the number of events (triggers) per ms  
is plotted over a one second period. 10**5 events are plotted. The trend is ~100 events per ms 
and the random component is consequently  ~10 events per ms.

In the simulation, sinusoidal components of 10, 50, 100  and 150 Hz  have been 
added to the trend with the 100 Hz present at the 10% level.  The 10 Hz signal
has been added to illustrate the effect of a low frequency component (see the
autocorrelation plot).  In addition, as frequently found in the data, there are 
gaps in the spill; this has been simulated by the random addition of 25 1 ms 
gaps in the spill.  In reality, the length of these gaps varies. These gaps 
constitute the irregular component of the time series.

Figure 2 shows two analyses that measure the periodic components of the histogram
of the spill. Figure 2a shows the sample autocorrelation.  The dominant 100 Hz component 
of the time series, modulated by the 10 Hz low frequency component, is clear.
Carefull inspection also indicates the influence of the 50 and 150 Hz signals.
A FFT analysis is shown in Fig. 2b. With the exception of the 150 Hz signal,
the Fourier transform separates the periodic parts of the spill fronm the background.

The same periodic analysis is repeated in Fig 3 using a periodogram and a Fourier transform
with a log axis that shows the zero frequency term measuring the total number of events 
in Figure 1. 
The periodogram confirms the  results of  the Fourier transform. 

Figure 3 has two histogram showing the gross characteristics of the spill.
Fig. 3a plots a histogram of the size of the difference between two successive 
bins of Fig. 1. This is, in effect, the first derivative of Fig 1 and should therefore
be a gaussian centered at zero with a width of  sqrt(2*trend) in the absence of periodic
and irregular terms.  Fig 3a shows that the periodic terms have only a small effect
on the gaussian peak. The irregular  part of the spill forms tails about the peak; 
consequently, the ratio RMS/Sigma is a good measure of the significance of the irregular component
of  the spill.
Fig. 3b shows a histogram of the number of  entries/ms of the spill.  As would be 
expected, the histogram is closely gaussian with a peak at trend and a width
larger than sqrt(trend) due to the periodic components. Any deviation from a uniform
trend will also increase the width of this distribution.
The irregular component  appears as a separate peak at low counts for
the chosen form of simulation.


Data Analysis
-------------

The techniques discussed in the introduction have been applied to
nine bursts from the 2022 run. The sections below follow approximately
a sequence from low frequency millisecond  general parameterisation of the spill
to spill characterisation in the microsecond range.


1)  Frequency and first difference analysis.    

The plots here  show, for each burst, 
in  Fig.1  the spill histogrammed in 1 ms bins, together with histogram of the first
difference, again in 1 ms intervals.  In the absence of irregular noise this histogram 
would lie within the 2 sd cyan lines drawn on this plot.
Fig. 2 shows a frequency  
analysis of the spill in four one second time intervals. 
Difference plots  for 1.5 - 5.5 secs of the spill are shown in Fig. 3. In these 
plots RMS refers  to the root mean square(rms) of the histogram and 
sigma to the rms of the gaussian fit to the central peak. The ratio, RMS/sigma, 
is thus a measure of the significance of tails in the difference plots..
The legend 'expected sigma' is, as explained
in the Introduction, sqrt(2*mean). The  plot in Fig. 4 is a histogram 
of the number of entries per ms for the 1.5 to 5.5 second region of the spill
and shows clearly any  irregular component of the spill as a peak at ~ 20 counts.

The first burst analysed,  12567/336 , is typical of the majority of
the bursts in the sequence presented here: the periodic frequency 100 Hz 
is dominant, 50 Hz is present over part of the spill, and an irregular term
is present in the middle of the spill.  There is also low frequency 'noise'
present which is largest in the center of the spill and consequently may
result from irregular gaps in the spill.

The final burst in this list, 12066/1129, has no irregular component.
Consequently, there are no tails to the first difference distrubution and
RMS/sigma ~ 1.0 . The spill distribution, however, does not have the 
expected sigma, sqrt(mean),  since the trend of the spill is not flat.

2) High frequency spill characteristics.

The plots  to be discussed in this Section
show the high frequency characterists of the spill that result, in part, from
the 5 x 2 structure of the SPS fill. 

Fig. 1 shows the time structure of the spill in 5 ms bins, with Fig. 2 showing
the same distrution in 0.2 bins to illustrate the fine structure.
The large-scale characteristics are tabulated  in Fig. 3 together with a histogram 
of the number of triggers per ms.  Typically, Fig 3 shows that the spill 
has negative skewness due to the gaps in the spill, kurtosis greater than the 3 
expected for a gaussian distribution, and a mean number of triggers/ms ~ 100.
Bursts such as 12066/1129, that have no irregular term, tend to have a positive
skewness due to the periodic component.
Fig. 4 demonstrates the spill structure that results from the SPS. 
Here is plotted the spill trigger time (ms) vs the  trigger time in 25 ns bins  modulo 923.99xx
(the 'folded time').
The 923.99xx term ( the fold time) is found by  minimizing the signal in the gaps in  the projection of the 
spill time on the folded  time axis after correcting the folded time.  The correction
to the folded time used is 2.4*(spill_time -1.5)**3 in folded time units with spill time in secs.
This correcion partially removes the effect of the reduction in momentum of the 
beam as it circulates the SPS.
The corrected spill vs folded time is shown in Fig 5. Three projections 
on the folded time axis are shown in Fig. 6  to illustrate the influence of the correction
and the fine structure of the beam.  These two Figures suggest that the beam is rarely
fully debunched and that, especially at the start of the spill, there can be substantial
variations in intensity in a bunch.
Figure 7 has autocorrelation plots for folded time (7a)  and spill time (7b).
Fig 7a has a peak at zero time lag showing a strong correlation over short time intervals.
Other peaks correspond to the bunch structure.  Fig. 7b shows  the dominant 50 Hz 
or 100 Hz periodic term in the time series of triggers that is often modulated by a
low freqency component of the spill.
Figures 8a and b illustrate a section of the spill and its associated Fourier analysis
indicating the dominant low frequency periodic components of the trigger times.

3) Time difference analysis

Histograms of the interval in time between succesive triggers are shown here   
These plots illustrate the higher frequency components of the spill originating from the SPS..
The first three Figures show the general spill characteristics: firstly, a histogram af the spill
in 1 ms bins; secondly, a smoothed histograms of the spill to indicate the dominant periodicity 
and, thirdly, a histogram of the number of entries per bin in the first histogram to give the mean
and rms of the trend of the spill.
Figure 4 is a log plot of a histogram of the time between triggers in microsecond bins.
As expected for a Poisson distribution this is a straight line with slope ~0.1 events/musec.
Deviations from the straight line are evident at half the circulation period of the SPS.
Figure 5 repeats this plot over a wider range of time intervals.  The majority 
of bursts have peaks at ~ 0.2 and 0.33 ms. that are probably the irregular terms in the spill. 
Finally, Figure 6 repeats Figure 5 with a plot of the difference between the histogram
of time differences and the ftted line.  The plot again shows evidence for the 5 X 2 
bunch structure of the SPS beam.


Summary and conclusions.
-----------------------

The time series of the triggers of 2022  NA62 detector have been examined 
with the object of determining the trend, periodic, irregular and random components 
of this series.  This study has been motivated by the fact that any departure from statistical 
uniformity of the time series may reduce the efficiency of data taking.

The periodic components have been identified using periodograms and Fourier analysis
together with sample autocorrelation plots. The random (shot noise) and irregular components
in the spill have been measured using first and second difference plots.

It has been  found that the periodic frequencies 50 Hz and 100 Hz are preent 
at the levels of typically 5% and 10% ,respectively.  Low frequency noise 
and an irregular component are found at a level about twice that expected from the trend 
of the data ie at ~ 2*sqrt(N), where N is the trend level of the triggers, nominally  
~ 100 events/ms.

A 5X2 structure of the triggers, charactersitic of the SPS bunch filling and extraction,   
is evident at the microsecond level giving rise to a distortion of the time structure
that is otherwise Poissonian. 

The SPS spill is rarely completely debunched, the bunches may have diferent intensities, 
and there are frequently intensity variations across a bunch.

The effect on the efficiency of data taking of the above described time characteristics
of the triggers  has yet to be determined, but is likely to be in the few percent range.






 













plots   in  ~/public_html/newplots