The function's catalog ([IFunctionCatalog|http://aida.freehep.org/doc/v3.2.1/api/hep/aida/IFunctionCatalog.html
]) is to be used to register user defined functions so that they can be easily created or cloned through the IFunctionFactory.

Registering User Defined Functions

After defining a function, eigher by scripting or coding it, it is possible to register it with the function's catalog by simply adding it specifying a name that will be used when creating it via the IFunctionFactory.
In the following example a function is registered with the catalog and used by name when creating a new function (the sum of a gaussian with the newly registered function):

// The AIDA Factories
IAnalysisFactory af = IAnalysisFactory.create();
ITree = af.createTreeFactory().create();
IFunctionFactory ff = af.createFunctionFactory(tree);

// Register the function myFunc with the catalog.
// Note that there are many ways in which myFunc could have been created.
ff.catalog().add("myFunc",myFunc);

IFunction func = ff.createFunctionByName("func","g+myFunc");

When registering a coded function with the function's catalog it is imperative to properly define the function's codelet in the function's implementation. For scripted functions the codelet is defined automatically by the underlying implementation.

Codelet

Feedback needed

The function's codelet is a unique string that is used internally by the function's factory to uniquely identify a function and be able to create it and clone it. It basically tells the function factory where to find the code to instantiate the given function.
It is possible to create functions from:

  • scripts
  • jar files
  • URLs
  • other exising catalogs
  • No labels