Skip to content

NewLRFHowTo

Raimundo Martins edited this page Apr 15, 2017 · 4 revisions

Back to How-to guides


Quick guide

An LRF is essentially a form of detector response model. In order to create them you need to have a geometrical model (at least the correct sensor positions), and events (either simulated or reconstructed. The ideal number of events depends on a number of factors, such as the type of LRFs, number of sensors, quality of data, etc, but about 5000 flood simulated events is usually a good initial guess.

Now we need to inform ANTS2 on how to reconstruct the LRFs. As a simple case, let us consider that we have enough simulated events, and the detector has an axial symmetry so we want to end up with Axial LRFs. We need to add an Instruction and Make LRFs:

  • If you are using GUI:

    • Press the Add instruction button, and by default it should be as desired:
      • Instruction type (the combobox next to the name of the instruction) is Fit a layer of LRFs
      • Lrf Category is set to Bspline
      • Lrf Type is set to Axial
      • Nodes are set to 10
    • After confirming that the instruction is as desired, press the Make Lrfs button
  • If you are using script mode, you can copy-paste the following script, and run it:

    var instructions = [
    { type : "Fit Layer",
      data : {
          Lrf : {
              Category : "Bspline", Type : "Axial",
              Settings : {"flat top" : true, nint : 10 }
          }
      }
    }
    ]
    newLrf.Make("Recipe's name", instructions, true, true, true)
    

Now you should have a set of LRFs. You can confirm it by observing that the History (the middle treewidget) has a new entry, with a sub-entry (these are explained in Basic concepts). For script you can check if the return value is an empty string. It is possible to fit to multiple (different) types of LRFs, choose the sensors that get fit, and more. See Instruction types for that.

Now you can use the newly created LRFs. Just make sure you selected the new module in the LRFs tab in the Reconstruction Window! But before that, you can check if you have sane LRFs by activating the Add data checkbox and pressing the Plot Radial button. This shows a plot of the resulting LRF for the selected sensor number on top of a histogram of the data used for fitting, which gives a chance to analyze what went wrong:

  • if the fit can't change quickly enough to keep up with the data, you should increase the number of nodes
  • if the fit is too jagged, you should decrease the number of nodes or increase the number of events
  • if the fit is too jagged but only towards the end of the range, you can try to mess with the compression settings (see the Bspline LRFs for that)

Basic concepts

By now you may be wondering what exactly is an Instruction, or the History, and how they work together. Let us then go through the major concepts of this module:

  • A Sensor is a sum of Layers associated with a particular photosensor from the geometry.
  • A Layer is simply an LRF and a coefficient.
  • A Recipe is a set of Instructions used to create the LRFs. With input data (e.g. events) it produces a group of Sensors, a so-called Version. If you are familiar with the old LRF module, a Recipe of a single Instruction of Fit a Layer of LRFs is similar to the Make LRF Settings.
  • An Instruction describes how input data is to be interpreted (e.g. fit LRFs) in order to create/manipulate a Sensor group.
  • A Recipe Version is a group of Sensors resulting from applying a Recipe on some input data. If you are familiar with the old LRF module a Version is similar to an Iteration.
  • The History contains all Recipes and their respective Versions. You can use the History tree to explore these.

Instruction types

Fit layer of LRFs

This instruction uses the event signals and positions of each sensor to fit an LRF, which is then assigned as a new layer to a Sensor. The LRF creation settings dictate how the LRF is fit, and are dependent on the Category and Type of LRF. The resulting layers' gains are always 1.0 except in the case of groupping, where the LRF's coefficient is the strength of an LRF relative to the LRFs of the other Sensors.

This instruction's settings have the following effects:

  • Sensor group: Works only with the sensors from the selected reconstruction group.
  • Composition: Allows to further limit the selection of the above group.
  • Stack operation dictates how the generated layers will stack with the ones generated from previous instructions:
    • Append to group: The Layer will be appended to the Sensor.
    • Overwrite group: The Sensor will consist only of the new layer.
  • Groupping: If some kind of symmetry is assumed on the detector, it is possible to improve statistics by selecting the proper groupping. THe following symmetries are supported:
    • One for all
    • By distance to center of detector
    • Assume square packing
    • Assume hexagonal packing
  • Lrf Category and Lrf Type: This is the determining factor of how LRFs are to be fit. See LRF Types for a better description.
  • The remaining settings that show in this instruction are regarding the chosen Lrf Type.

Inherit a set of sensors

Uses a duplicate of the Sensors of another Recipe. With Sensor selection it is possible to filter the desired Sensors.

LRF Types

Bspline Category

ANTS2 can use Cardinal Bsplines of the 3rd degree as LRFs.

Axial(3D)

(Sliced)XY

Script Category

Types in this category make use of a Javascript-like language to describe the LRFs. The contents of the script itself are up to the user. However, there are some common rules:

  • It is mandatory to have an eval function: it is the LRF! It must return a number (the light response of the sensor), and it can contain any combination of the following arguments:
    • r: an array containing the event coordinates relative to the LRF.
    • R: an array containing the global event coordinates.
    • Any other argument will be undefined.
  • All variables must be declared begining with the keyword var.
  • The function will be fit to some set of data provided by the user. In order to do that, the script defines free parameters which will be fit. Every variable that does not start with a _ (underscore), and is a number or an object which contains an 'init' and/or the 'min' and 'max' members, is considered to be a free parameter.
  • The fitting procedure is done using ROOT's TProfile* and TF* classes, by filling a TProfile with the events' positions and signals and then using a proxy TF* (which just calls the script's eval function) to fit the TProfile.

Polar(+Z)

For this type, the r and R parameters contain 1 element: the distance of the respective x and y values. In case of Polar+Z there is a second element, which is z.

Cartesian(+Z)

For this type, the r and R parameters contain 2 elements which are the respective x and y values. In case of Cartesian+Z there is a third element, which is z.

For Cartesian+Z there are also two extra special variables:

  • _ants2_nbinsz: Fitting a 3D function might take much more time than what is desired. In order to attenuate the issue, this variable indicates the number of z bins in the TProfile3D. Values higher than 263 are known to crash ROOT (and consequently ANTS2) on some systems, regardless of available memory. Default: 100.
  • _ants2_use_fitter: It is also possible to fit the LRF using ROOT::Fit::BinData and ROOT::Fit::Fitter classes. Setting this variable to true will do that. Default: false.

Plugins

Other categories may be available with the use of plugins. Those are not in the scope of this page.

Clone this wiki locally