Below we describe proposed changes to the AIDA interfaces together with some discussion. Changes are based on our experience with current version of AIDA and attempts to extend it.

General Suggestions:

1. Filters.

It would be useful to have an "enable/disable" and "invert" switches for IFilters:

public interface IFilter



    // New methods

    public void setEnabled(boolean state);

    public boolean isEnabled();

    public void setInverted(boolean state);

    public Boolean isInverted();



There should also be a convenient way to apply analysis cuts not only to ITuple, but to a IHistogram and ICloud as well - imagine fitting function to a histogram and excluding tails from the fit. Also more flexible cut manipulation is desired: dynamically add more cuts and remove some of previous cuts. One way to do it is to create cuts that don't depend on an ITuple and include "add/remove" methods in the ITuple interface:

public interface ITuple



    // New ITuple methods here:

    // can add as many filters as you like, they will be applied 

    // sequentially in the order they were added

    public void addFilter(IFilter filter);

    public void removeFilter(String name);

    public void removeAllFilters();

   // Returns array of filters that are currently added to the ITuple

   public IFilter[] filters();



public interface IFilterFactory


    public IFilter create(String name, String script);


This way has one disadvantage though - one has to assume what filters are attached to ITuple - filters are not passed to the "client" explicitly. So it may happen that some filters added (or created) earlier are forgotten and can have an unexpected effect.


2. IEvaluator

How should IEvaluator handle external parameters?


double normalization = tuple.columnMax(2);

IEvaluator ev = evaluatorFactory.create(tuple, "signal/normalization");



3. IFunction


User should be able to manipulate IFunctions: add, multiply them, maybe even convolute two functions. Registering user-defined function with AIDA IFunctionFactory on the fly also seems like a nice feature. Also ability to generate a set of numbers according to a given distribution can be useful in fit cross-checks and toy Monte Carlo studies.


public interface IFunctionFactory



   // Allows user to register new function factory 

   // IUserFunctionFactory should have method "String[] types()" that

   // return all IFunction types that this user factory can make

   public void register(IUserFunctionFactory userFunctionFactory);


   // Do arithmetics with functions, Example: "add" f_new=c1*p+c2*(1-p)

   // Note that "div" does not make much sence for PDFs

   public IFunction add(IFunction f1, IFunction f2, double p);

   public IFunction add(IFunction[] f, double[] p);

   public IFunction mul(IFunction f1, IFunction f2, double c);

   public IFunction mul(IFunction[] f, double c);

   public IFunction div(IFunction f1, IFunction f2);



Another useful feature would be ability to generate set of random numbers distributed according to a given function:


   // Create ITuple with one column and nEv rows, filled with random numbers

   // distributed according to the given IFunction

   public ITuple generate(String name, String label, IFunction f, int nEv);


This method can be put in the ITupleFactory as a convenience method, or it can be implemented in some additional package (say hep.aida.util), as this functionality can be achieved by using already defined AIDA interfaces.



There will be more about IFunctions in the Fitting Proposal section.


6. Plotting

Configuring plot attributes, like histogram statistics, function parameters, fit results is a complicated task. One way to simplify it would be to associate some "hash-type" object (like IAnnotation, maybe) with any plottable class (IFunction, IHistogram1D, ...) and mark items there as "displayable" or "non-displayable". Displayable items then will be picked up and displayed by IPlotter.