Skip to content

rootana_module_TemplateCreator

AndrewEdmonds11 edited this page Aug 1, 2014 · 2 revisions

Template Creator (Documentation In Progress)

Introduction

This rootana module creates all the templates that we can use in TemplateAPGenerator to produce TAnalysedPulses from TPulseIslands.

What It Does

For each channel, there is a separate template that is constructed.

For each TPI in the channel (ProcessPulses()):

  • First, we use the PulseCandidateFinder to check that there is only one pulse candidate on the TPI.

  • We also check that the digitiser has not overflowed or underflowed.

  • If the template does not exist yet:

    • We check that the pulse peak is not located in the last 20% of the TPI (if (pulse->GetPeakSample() >= pulse_length - pulse_length/5.0))
      • This was because I was having problems with additional pulses fitting to the template if the peak was too close to the end of the TPI
    • If that's OK, then we refine the pulse to get the first iteration of the template (CreateRefinedPulseHistogram()) and interpolate between the samples to get a smoother template to start with
  • If the template does exist:

    • We create a refined pulse histogram but without interpolating between sample values
    • We then make rough estimates of the pedestal, amplitude and time of both the pulse and template. Currently (as of 1st August), these are:
      • Pedestal (both template and pulse): value in the first bin of the histogram
      • Amplitude (both template and pulse): max (or min) bin with the pedestal subtracted (max/min depends on pulse polarity)
      • Time (both template and pulse): max (or min) bin with 1 subtracted to go from bin numbering (1, n_samples) to clock ticks (0, n_samples-1)
    • and then we make initial estimates of the fit parameters:
      • pedestal_offset_estimate = pulse_pedestal
      • amplitude_scale_factor_estimate = pulse_amplitude / template_amplitude
      • time_offset_estimate = pulse_time - template_time

Then we use the TemplateFitter to fit the template to the pulse. A few important things to note:

  • HistogramFitFCN is used to fit the pedestal offset and amplitude scale factor parameters and TemplateFitter iterates around the initial time offset estimate
    • this is because I was having poor fits when I was letting Minuit try to fit all three

If the fit is successful, we then add it to the template, making sure that we update the bin errors appropriately (AddPulseToTemplate()).

The last thing that happens in ProcessPulses() is that we check to see if the template has converged by seeing if the error on the maximum (or minimum) bin has been consistent over a certain number of iterations (on 1st August, we check that the difference between errors is less than 0.1 for 10 consecutive iterations).

Finally, in AfterLastEntry(), we normalise and save the template.

Module Options

refine_factor: we create a template with this times more bins than in the pulses (e.g. if the first pulse added to the template has 64 bins, then the template will have 64*5 = 320 bins). This allows us to have a finer timing resolution. (default: 5)

pulse_debug: used during development to produce histograms of pulses (before and after fitting) and templates at various stages during the template construction. Only use for an event or two (default: false)

Clone this wiki locally