The following set of exercises is meant to drive you through the AIDA interfaces. The suggested exercises are ordered by increasing complexity. Feel free to start from the complexity level you feel comfortable with. Our solutions to the exercises are also provided both in java and in the pnut scripting language. You can run them with JAS3 or JAIDA.
Please use the AIDA API documentation as your main reference.
Before you get started it is necessary to download the file JAS3DataSet.aida and to open it in JAS3.
Please take some time to inspect it; it contains the following objects:
Use the following skeletons as a starting point for your pnut script or java code.
use("pnuts.lib") IAnalysisFactory = class hep.aida.IAnalysisFactory; af = IAnalysisFactory::create() //Use the aidaMasterTree as the main ITree aidaMasterTree.cd("/JAS3DataSet.aida"); //.... your code goes here |
import hep.aida.*; import org.freehep.application.*; import org.freehep.application.studio.*; public class myExample { public static void main( String[] argv ) throws java.io.IOException { IAnalysisFactory af = IAnalysisFactory.create(); ITree tree = (ITree) ((Studio) Application.getApplication()).getLookup().lookup(ITree.class); tree.cd("/JAS3DataSet.aida"); //..... your code goes here } } |
Important: part of the AIDA standard is the creation of the IAnalysisFactory and of all the factories you need. With the following code you can open the JAS3DataSet.aida file (assuming it is located in C:/Examples/JAS3 Tutorial/)
IAnalysisFactory analysisFactory = IAnalysisFactory.create(); ITree tree = analysisFactory.createTreeFactory().create("C:\\Examlpes\\JAS3 Tutorial\\JAS3DataSet.aida"); |
In the above skeletons we used a different way to access the already open JAS3 default masterTree. This is a JAS3 specific way to access the main tree aidaMasterTree with which you can navigate the whole tree (the one displayed on the left of the JAS3 panel). The advantage is that you need to open the file only once, accessing it then via the aidaMasterTree. The disadvantage is that the code is no longer AIDA compliant.
It is possible to perform some of the above exercises (the easier ones) through the GUI, by graphically manipulating functions and controlling the fit.