Prerequisites
Please make sure you have installed JAS3 and Netbeans.
With JAS3, you should have downloaded the org.lcsim plugin.
This guide is meant primarily for people who want to get started with an analysis without having to learn about building org.lcsim, and installing extra dependencies. If you are planning on writing some code to run in JAS3 to perform an analysis, then this guide is for you. Otherwise you can skip ahead to the "Further Reading" section at the bottom of the page.
Introduction
We are writing analysis code in forms of Drivers, classes that inherit from org.lcsim.util.Driver.
Your analysis will be performed by a special method of that class, called process.
This method manipulates object in one event, you can store the results of your analysis in an AIDA cloud.
When loading your file into JAS3, you tell the JAS3 org.lcsim plugin about it, and it then calls this code for every single event in a given file.
These concepts will become clearer as you work your way through the other tutorials, but it helps to have a rough idea of what's going behind the scenes.
In Netbeans, create a new project with File -> New Project. The type of project is a Java Class Library.
Enter the path where you want the Project to be located, and click Finish.

You should now see the new project in the frame on the left.
Next, right click on the project name. The context menu will appear; click Properties.
This is where we add the jar files for org.lcsim to get code completion.
Click on Libraries in the left frame. In the Compile tab in the right frame, click Add Jar/Folder.
In the File field, type .JAS3/extensions/lcsim.jar and click open.
Repeat the same steps for .JAS3/extensions/freehep-physics.jar.
| On Mac OS X, there seems to be no field to type a file name, and the directory .JAS3 is hidden. You can create a symbolic link to the hidden dir by typing ln -s ~/.JAS3 ~/JAS3 in a terminal window. Then the directory JAS3 will show up and you can select the files there. |

Other libraries that you may want to add are in the JAS3 installation directory. You can find the location from within JAS3 by selecting View->Plugin Manager from the menu and clicking on the "Available" tab. You will see the two directories that contain all JAS3 plugins. We have chosen two files from one of the two locations, but you can in principle add all .jar files in the two directories. Especially "aida.jar" from the JAS3 installation is recommended. When you are done, you can close the properties window.
Right click on the project name, and select New -> Java Class. Name it Analysis103 and click Finish.
Change the line
public class Analysis103 {
to
public class Analysis103 extends Driver {
Place the cursor immediately after Driver and hit CTRL+Space. If everything is set up correctly, a menu will appear and let you choose which Driver you want to import. Choose org.lcsim.util.
Notice that Netbeans has added an import at the top of the file.
In order to get used to this code completion feature, please make the rest of the file now look like the Analysis101 example. If everything was set up properly, you will see that every time you hit a ., a list of possible completions will pop up.
This list should contain all possible methods of the objects you are using. It saves you from browsing http://www.lcsim.org/software/lcsim/apidocs/ to see what's available in a certain class.
Code completion is activated with CTRL+Space. Everytime you use a class that's new to you, you can put the cursor immediately after the class name and hit CTRL+Space to ask Netbeans to find the definition and import it for you. If you place the cursor directly after the . behind a class instance, you will see a list of member functions appear.
If you encounter a red underline, it's a sign that Netbeans spots an error in your code.
When you have finished you can open the file Analysis103.java in JAS3 and compile it with F9.
Load an event file, right click on the code of Analysis103.java and choose Load.
Then run the code by clicking on the "Go" button at the top. We are providing more detailed instructions that also show how to save your data.
Equipped with this knowledge you can now work through the other tutorials.
Please don't hesitate to post questions to the Forum and good luck.
Further reading
When you get more proficient with the code base and encounter more and more names that Netbeans complains about, you may want to follow the instructions on Creating a Driver using Netbeans
