This repository is the common code basis of acqu users within the A2 collaboration. It will (at least) cover the calibration and a simple physics analysis.
However, this master branch is still under heavy development and many changes could break your workflow or personal code. But this will improve!
So be warned, but don't hesitate to fork this repo here and contribute your personal changes if there useful by providing pull requests.
NOTE: As of July 2013, the acqu_user folder is based on Cristina Collicott's analysis efforts, see collicott/acqu. It "does" something, but many issues are not fixed yet.
- CERN ROOT > 5.30 with MySQL support (enabled by default, if you have mysql development files installed)
- CMake > 2.8 (most Linux distributions provide packages)
- Zlib and Ncurses development packages (see also troubleshooting)
- git
- Doxygen for documentation support (nicely integrated into QtCreator)
You probably want to create a GitHub account and fork from this repository. Then clone this personal "acqu" distribution (it is still very easy to get updates later).
If you have a working ROOT installation you can use these commands to get ready to build acqu:
Ubuntu 10.04.4:
sudo apt-get install git-core cmake zlib1g-dev doxygen libncurses-dev
With CMake, it is required to build "outside" of the source
directory (e.g. in an empty subfolder). Thus, we create an extra
build
sub-directory including all Makefiles (execute in "acqu"
basedir containing acqu_core, acqu_user, ...):
mkdir build && cd build && cmake ..
Note that the two dots in the end really mean the parent directory (where the central CMakeLists.txt is located). Furthermore, it defaults to Debug mode and tells you exactly where the to-be-built libraries and binaries are located. You might want to add the binary path to your PATH environment (but if you use QtCreator, not even that is required).
Then start the parallel compilation for example on a QuadCore machine as
make -j5
You can also create some documentation with
make doc
If you already opened QtCreator before, it should tell you that it registered automatically the generated help file.
If you want to build only the DAQ part (no analysis), change the above cmake call to
mkdir build && cd build && cmake -DACQU_DAQ=On ..
which also automatically detects and includes EPICS, if available.
With the new CMake system, it is very easy to use QtCreator as an Integrated Development Environment. Just ensure that your version is recent enough (something like 2.5). Then do the following to set it up in QtCreator:
-
Import the
acqu
project as a CMake project by opening the CMakeLists.txt in the basedir. A wizard dialog should pop up. -
You should get asked for a build directory. Create a new subdir
build
and choose that. You can also choose an already existing one. -
Run cmake from the GUI as required from the Wizard and check if it found the correct ROOT installation. If it did not find the correct one, either remove your ROOTSYS environment variable or add one by starting QtCreator from the console like this:
ROOTSYS=/path/to/root qtcreator &
. -
Then set the working directory in "Project (left tab) --> Run Settings" to your acqu_user directory and provide the correct *.dat file to AcquRoot as an argument. At this point, you can also set
-j5
as an argument to make in the build settings tab. -
Hit F5 and you should be able to build, run and debug AcquRoot. That means you can set breakpoints, have sophisticated code completion and a Doxygen-driven help system. You can still use in parallel the command line, if you find that more useful in some cases.
The following hints are certainly incomplete (and there are much better tutorials out there), but it should guide you how to track your own changes and easily fetch updates from other repositories. For a good overview who is working on what, have a look at the network.
Track your changes with git:
- First of all, you should create a GitHub account and fork from the
A2-Collaboration's repository. Then clone this forked version to
some local folder, say
git clone https://github.com/myusername/acqu.git
. - Then, after you changed something of the code or config files,
review the state with
git status
. Please take care of untracked files and do not add binary or other "generated" files to the index. A good idea is to add them selectively to the index bygit add acqu_user/root/src/MyCoolAnalyis.cpp
. - Now, if you're happy with the to-be-committed changes, commit them
using
git commit
. It asks you for a commit message and some commented out lines telling you again what you're about to commit. Please use this message as an opportunity to describe your work. If in doubt, create more smaller commits than a single big one. - You should publish your work, this can also serve as a nice backup.
Updating or fetching work from others:
- It's best to add the remote permanently to your own local
repository:
git remote add A2-Collaboration https://github.com/A2-Collaboration/acqu.git
- Get the cool new stuff from that repository:
git fetch A2-Collaboration
. You should see the branches, have a look at them by usinggitk --all
. - Now, it is highly recommended to rebase (instead of using merge)
your work on top of the other:
git rebase A2-Collaboration/master
. This might produce conflicts, which you need to resolve. There are many tools out there to handle this, but whatever you do: Read carefully the instructions and do not commit merge markers like <<<<<<<<. Also check if it still works before committing the resolved conflict. You can always abort the rebase bygit rebase --abort
. - Most likely after a successful rebase, you need to
git push --force
your branch (a normal push will reject your update). Do not follow the recommendation ofgit push
togit pull
since this creates a merge (this complicates the commit tree unnecessarily).
- If the detection of some libraries still fails despite installing the necessary *-dev packages from your distribution, delete CMakeCache.txt in your build directory and run cmake again. In general, cmake caches already found packages and also settings, so don't be confused by this "feature".
- Note that with CMake no environment variables are really needed anymore. This is why all setup files have been deleted. However, you might want to add the binary directory to your PATH environment.
- Since the .gitignore's have changed, you can get rid of old build
files by
git clean -fdn
, which lists all files, and if that is okay, delete them withgit clean -fd
. - If the compilation fails, check if you have some previous ROOT
Dictionary source files. You can find them by
find | grep Dict
(in basedir) and if that lists only unneeded files delete them byfind | grep Dict | xargs rm
. Also git should report some of them as untracked (see above item how to get rid of them). - If you just want to run AcquRoot, then the Debug mode (=no
optimizations) can be unnecessarily slow. Enable the Release mode by
executing
cmake -DCMAKE_BUILD_TYPE=Release ..
inside the build directory (can also be a new build directory). - If you're changing header files and compiling breaks, a
make clean
could help since not all dependencies are correctly identified at the moment (but most should be!). - If the help in QtCreator does not work (i.e. F1 does not show you something when the pointer in the editor is located at some acqu class), then try registering manually the help file "build/doc/qthelp.qch" via "Tools --> Options... --> Help". Restart QtCreator.