In order to be able to match correctly the track elements produced by a muon in the Tracker and the Muon System of the CMS experiment [1] the mutual alignment precision between the Tracker and the Barrel Muon System must be no worse than 100-400 micrometers depending on the radial distance of the muon chambers from the Tracker. To fulfill this requirement an alignment system had to be designed. This system contains subsystems for determining the positions of the barrel and endcap chambers while a third one connects these two to the Tracker. Since the Barrel muon chambers are embedded into the magnet yoke of the experiment a nonconventional alignment method had to be developed. In this paper we restrict ourselves to the Barrel Alignment System and the calibration methods of its components. I. THE BARREL MUON ALIGNMENT SYSTEM The CMS Barrel Muon Alignment System (Fig. 1) is based on an optical network of LED light sources and videocameras. The full system contains very large number of cameras (approx. 600 pcs) and LEDs (approx. 10000 pcs). Overwhelming part of these LEDs are mounted on the 250 barrel muon chambers while the cameras observing these LEDs are mounted on rigid structures called MABs (Module for Alignment of the Barrel). The MABs (36 pieces altogether) are fixed on the iron yoke of the magnet. Furthermore, there are about 300 LEDs and 100 cameras making direct connections between the MABs (called diagonal connections). Finally there are 6 long carbon-fiber bars located inside the barrel muon system containing in total 144 LED light sources allowing direct measurement of the Z coordinates of 24 MABs (where Z direction in the experiment corresponds to the direction of the proton beam path). The results of individual measurements are the positions of the centroids of the images of the LEDs measured by the cameras. In order to be able to reconstruct the positions of the muon chambers additional data -in addition to the measured centroidsis required. These are the parameters of the cameras (magnification, and tilt angles of the sensor with respect to the optical axis of the camera, sensitivity and homogeneity of the video-sensors of the cameras) and the positions of the LEDs on their holders. Also, the positions of the cameras and the LED holders in their embedding objects (muon chambers, MABs, Z-bars) are also needed. These additional data are obtained by the calibration of the elements. Figure 1. CMS Barrel Muon Alignment scheme II. CALIBRATION OF THE COMPONENTS The main requirement on the muon chamber alignment precision is in the range of 100-400 microns. Since this value depends also on the calibration precision of the components, the calibration methods had to be established such that the resulted precision of the full system could meet the above mentioned requirements. The individual calibration steps of the light source-related objects are the LED holder calibration and the barrel muon chamber alignment calibration, while calibration steps of the camera related objects are the camera quality control, the camera calibration and the MAB calibration. A. Light source related objects As it is mentioned above the basic components of the Barrel Muon Alignment System are the LEDs and the cameras. Individual LEDs are grouped into mechanical structures called LED holders containing 10 (for DT chambers), 3 (diagonal LED holders) or 6 (Z-LED holders) LEDs according to the measurement type. During the calibration process positions of the LED centroids in the frame of the LED holder are determined. The optical network requires most of the LED holders to be observed from both sides. This can be solved by introducing an auxiliary frame of reference which can be seen from both sides. Technically, this is a calibration tool containing multimode optical fibers illuminated by noncoherent light sources and shining into both directions. Positions of these light sources are measured in a high precision metrology lab and produce light distributions similar to those of the LEDs to be measured. Since the light spots are observed by cameras there was a requirement to exclude geometrical distortions and the error on centroid calculation caused by the un-even gain on the sensor surface. This has been solved by mounting the calibration tool (and therefore the LED holders) on a precise two-dimensional moving table and by constructing a successive method for moving all the centroids to a predefined position on the sensor surfaces. Therefore LED positions correspond to the position readouts of the moving table. Figure 2. Calibration bench for the LED holders. As the amount of LED holders is very large (>1200 pieces) a highly automated measurement method had to be developed. Both the successive centroid measurements and the control of the moving table and the LED holders are computerized. The operator only has to change the LED holders, identify it and start the measurement. The successive status then can be monitored on the computer console. Also due to the large number of LED holders an effective way of data handling and storage had to be developed. For such a large number of data (five complete measurements of all the LED holders ~ 100 k lines of raw data + 20 k lines of analyzed data) the use of a commercially available database solution is inevitable. Our team decided to use MySQL because it supports all the programming languages used in this calibration process under all operating systems. This database server also had an advantage because its installation requires only a moderate disk space and it is also freely available for research purposes. For data security reasons measurements are recorded as ASCII files which are automatically uploaded as the measurement finishes. Therefore one can assure to have two identical copies of the raw data and in case of critical failure of the database server data can be recuperated by using the same method used for synchronizing the database to the ASCII files. However, storage of data in a relational database provides a very easy way to compare the individual measurements therefore pinpointing any measurement errors based on statistical methods. This statistical analysis and the data recuperation are done by web-based Perl scripts allowing the access to the data from virtually everywhere without the need for special data handling software. Calibration methods of the diagonal and Z-LED holders are very similar to that of those ones described above. Figure 3. Data flow during the LED holder calibration [5] The main goal of the alignment system is to locate the anode wires of the muon chambers with respect to the Tracker. Muon chambers have a construction which doesn’t allow the observation of their anode wires after construction. This construction doesn’t allow either to determine the LED holder’s position with respect to the wires during chamber building. To overcome this problem the following technology has been developed: 1. During construction position of every anode wire (approx. 400 per chamber) is measured during the construction with respect to mechanical reference objects known as corner blocks mounted on each corner of a muon chamber’s Super Layer [2] (4 pieces per Super Layer). Since a muon chamber consists of two or three Super Layers depending on its type, a muon chamber can have eight or twelve corner blocks in total. These corner blocks serve as position references. 2. Since the position measurement of the LED holders is based on a centroid measurement while positions of the corner blocks can be determined by standard survey techniques (photogrammetry) an additional calibration bench had to be built. Here the corner blocks can be located by photogrammetry and the LED holders mounted on the chambers can be measured by cameras with pre-calibrated (known) positions with respect to the calibration bench. For this pre-calibration a specially designed calibration plate containing both optical fiber light sources and target holes for the photogrammetry is used. Internal parameters of these plates could be determined by a metrology laboratory. During the precalibration of the chamber bench these plates are localized by photogrammetry while a simultaneous measurement of the optical fibers has been performed by the cameras. A geometrical reconstruction is able to recuperate both the camera positions and their internal parameters needed for a correct measurement of the LED holders. 3. Applying mathematical transformations the positions of the LED holders can be determined in the chamber’s frame. As a byproduct the localization of all the Super Layers in the chamber’s frame can also be performed. The number of muon chambers to be measured was 264, therefore this calibration step also requires a reliable data handling strategy. Since during LED holder calibration the LED Holder Calibration