You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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");

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.
When registering a user defined function, the user must provide a valid codelet for the function's factory to be able to create and clone the new function.
It is possible to create functions from:

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