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:
With the aida standards it is possible to open the JAS3DataSet.aida file (assuming it is located in C:/Examples/JAS3 Tutorial/) in the following way:
IAnalysisFactory analysisFactory = IAnalysisFactory.create(); ITree tree = analysisFactory.createTreeFactory().create("C:\\Examlpes\\JAS3 Tutorial\\JAS3DataSet.aida"); |
Once a file has been open by hand it is possible to access its contents via the JAS3 navigation tree. In the code skeletons below show how to access the aidaMasterTree and cd into the already opened file.
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.
Use the following skeletons as a starting point for your pnut script or java code if you want to use this approach.
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 } } |
It is possible to perform some of the above exercises (the easier ones) through the GUI, by graphically manipulating functions and controlling the fit.