Home
Short
Presentation
Mechanical
Constraints
Misalignment
Studies
Alignment
Techniques
Application
to VELO
C++ code
Latest News
Links

Standalone C++ Millepede

A. Introduction

This page is intended to give access to the C++ version of Millepede used for the VELO (available on LHCb software repository in the AlignmentTools package), but in a standalone way.

This standalone code is based on the Knossos interface develloped by Matt Needham in order to run the old Millepede C++ code. It has been updated (and modified a little bit...) in order to use the latest Millepede version.

All six degrees of freedom could be tested with this code, however, it's only a toy detector and toy tracks, so keep in mind that it will always work better than in real life...

B. How to run the code?

B1. First quick look

Get the Knossos package which is available here. Then untar it:

tar -zxf Knossos_v*.tar.gz

It will create a Knossos_v* directory containing all the sources of the code. You just have to compile it (you need to have ROOT installed to do this):

make

Then (if it doesn't compile check that the ROOTSYS directory is correctly entered into the Makefile. You will also need to replace -m32 by -m64 if you are using 64 bit machine.), run the code:

./knossos -r 1 -n 100 -o Result.root > output.log

to see what the commands represent, type:

./knossos --help

The command will perform the alignment of the toy detector with 100 events, with one set of misalignment (1 run). An event consists in a set of tracks coming from the same primary vertex, centered on (X,Y) = (0,0). Mean Z position of the primary vertex could be set in constants.h (dist_PV parameter). In order to see the results, just type:

root Analyze.C

This root program will produce the following plots, giving you, for the differents degrees of freedom, the misalignment before correction (fig. 1), after correction (fig. 2), and the corresponding pull (fig. 3). Plots shown here have been obtained with 50 runs, ie 100 different sets of misalignments.
1. Misalignments before correction.
2. Misalignments after correction.
3. Corresponding pulls

B2. Going a little bit further...

In this example we use a toy detector which is just a set of XY planes along the Z axis. Planes characteristics are set in the file constants.h.

Then, having setup the geometry (look at myAlg.cpp to learn more about that), one generate a set of misalignments, depending on the degrees of freedoms one want to include and on their scales. As for the geometry, all these parameters are set in constants.h and initialized in myAlg.cpp.

Then a set of toy tracks is generated, corresponding to the number of events you want. This part is handled by a TrackStore tool (TrackStore.cpp). Then those tracks are feeded to Millepede via the interface code MilleTool.cpp. Misalignements are taken into account before feeding Millepede (tracks slopes are recomputed with misaligned measurements).

Once all the track are generated and locally fitted by Millepede the global alignment is performed, and the results are stored into the ROOTfile. If you want to see more deeply how Millepede is working, there are two different level of output you could set in Millepede.h: Now, you could also try to modify the parameters of the geometry or the Millepede tuning (see for example the effect of changing the initial estimated error of misalignments on the pulls, or add some sensor thickness). All that is set in constants.h.

Now you could also take into account non-linear derivatives only after few iterations (NonLin arrays in MilleTool), altough up to now results seems equivalent when taking directly a first guess of the misaligned track slopes. The following plots show the same 50 runs than before, but using the 'non-linear' treatment.
1. Misalignments before correction.
2. Misalignments after correction.
3. Corresponding pulls

C. Conclusions

All these programs are 'of course' not 100% failsafe. So if you find a bug, something wrong, or only if you have questions or remarks, please send me a mail.

D. Older versions

Version 1.2 : version still available here. Version 1.3 has now a fully generic treatment of non-linear terms.

Version 1.1 : version still available here. Few memory bugs corrected (thanks to M. Deissenroth and A. Perieanu). Other improvements were also added to version 1.2.

Version 1.0 : version still available here. Was bugged in MilleTool.cpp, as the slopes of the aligned track were used to feed non-linear global derivatives.