Alignment of the CMS tracker with LHC and cosmic ray data

The central component of the CMS detector is the largest silicon tracker ever built. The precise alignment of this complex device is a formidable challenge, and only achievable with a significant extension of the technologies routinely used for tracking detectors in the past. This article describes the full-scale alignment procedure as it is used during LHC operations. Among the specific features of the method are the simultaneous determination of up to 200,000 alignment parameters with tracks, the measurement of individual sensor curvature parameters, the control of systematic misalignment effects, and the implementation of the whole procedure in a multi-processor environment for high execution speed. Overall, the achieved statistical accuracy on the module alignment is found to be significantly better than 10 micrometers.


Introduction
The scientific programme of the Compact Muon Solenoid (CMS) experiment [1] at the Large Hadron Collider (LHC) [2] covers a very broad spectrum of physics and focuses on the search for new phenomena in the TeV range. Excellent tracking performance is crucial for reaching these goals, which requires high precision of the calibration and alignment of the tracking devices. The task of the CMS tracker [3,4] is to measure the trajectories of charged particles (tracks) with very high momentum, angle, and position resolutions, in combination with high reconstruction -1 - Figure 1. Schematic view of one quarter of the silicon tracker in the r-z plane. The positions of the pixel modules are indicated within the hatched area. At larger radii within the lightly shaded areas, solid rectangles represent single strip modules, while hollow rectangles indicate pairs of strip modules mounted back-to-back with a relative stereo angle. The figure also illustrates the paths of the laser rays (R), the alignment tubes (A) and the beam splitters (B) of the laser alignment system. layers, with radial positions at 4 cm, 7 cm, and 11 cm in the design layout. Similarly, four and six layers of microstrip modules compose the TIB and TOB half-barrels, respectively. The FPIX, TID, and TEC are all divided into two symmetrical parts in the forward (z > 0) and backward (z < 0) regions. Each of these halves is composed of a series of disks arranged at different z, with the FPIX, TID, and TEC having two, three, and nine such disks, respectively. Each FPIX disk is subdivided into two mechanically independent half-disks. The modules on the TID and TEC disks are further arranged in concentric rings numbered from 1 (innermost) to 3 (outermost) in TID and from 1 up to 7 in TEC.
Pixel modules provide a two-dimensional measurement of the hit position. The pixels composing the modules in BPIX have a rectangular shape, with the narrower side in the direction of the "global" rϕ and the larger one along the "global" z-coordinate, where "global" refers to the overall CMS coordinate system introduced at the beginning of this section. Pixel modules in the FPIX have a finer segmentation along global r and a coarser one roughly along global rϕ, but they are tilted by 20 • around r. Strip modules positioned at a given r in the barrel generally measure the global rϕ coordinate of the hit. Similarly, strip modules in the endcaps measure the global ϕ coordinate of the hit. The two layers of the TIB and TOB at smaller radii, rings 1 and 2 in the TID, and rings 1, 2, and 5 in the TEC are instrumented with pairs of microstrip modules mounted back-to-back, referred to as "rϕ" and "stereo" modules, respectively. The strip direction of the stereo modules is tilted by 100 mrad relative to that of the rϕ modules, which provides a measurement component in the z-direction in the barrel and in the r-direction in the endcaps. The modules in the TOB and in rings 5-7 of the TEC contain pairs of sensors with strips connected in series.
The strip modules have the possibility to take data in two different configurations, called "peak" and "deconvolution" modes [17,18]. The peak mode uses directly the signals from the analogue pipeline, which stores the amplified and shaped signals every 25 ns. In the deconvolution mode, a weighted sum of three consecutive samples is formed, which effectively reduces the rise time and contains the whole signal in 25 ns. Peak mode is characterised by a better signal--4 - over-noise ratio and a longer integration time, ideal for collecting cosmic ray tracks that appear at random times, but not suitable for the high bunch-crossing frequency of the LHC. Therefore, the strip tracker is operated in deconvolution mode when recording data during the LHC operation. The calibration and time synchronization of the strip modules are optimized for the two operation modes separately. A local right-handed coordinate system is defined for each module with the origin at the geometric centre of the active area of the module. As illustrated in the left panel of figure 2, the u-axis is defined along the more precisely measured coordinate of the module (typically along the azimuthal direction in the global system), the v-axis orthogonal to the u-axis and in the module plane, pointing away from the readout electronics, and the w-axis normal to the module plane. The origin of the w-axis is in the middle of the module thickness. For the pixel system, u is chosen orthogonal to the magnetic field, i.e. in the global rϕ direction in the BPIX and in the radial direction in the FPIX. The v-coordinate is perpendicular to u in the sensor plane, i.e. along global z in the BPIX and at a small angle to the global rϕ direction in the FPIX. The angles α, β , and γ indicate right-handed rotations about the u-, v-, and w-axes, respectively. As illustrated in the right panel of figure 2, the local track angle ψ (ζ ) with respect to the module normal is defined in the u-w (v-w) plane.

Global position and orientation of the tracker
While the track based internal alignment (see section 4) mainly adjusts the positions and angles of the tracker modules relative to each other, it cannot ascertain the absolute position and orientation of the tracker. Survey measurements of the TOB, as the largest single sub-component, are thus used to determine its shift and rotation around the beam axis relative to the design values. The other subcomponents are then aligned relative to the TOB by means of the track based internal alignment procedure. The magnetic field of the CMS solenoid is to good approximation parallel to the z-axis. The orientation of the tracker relative to the magnetic field is of special importance, since the correct parameterisation of the trajectory in the reconstruction depends on it. This global orientation is described by the angles θ x and θ y , which correspond to rotations of the whole tracker around the xand y-axes defined in the previous section. Uncorrected overall tilts of the tracker relative to the magnetic field could result in biases of the reconstructed parameters of the tracks and the measured masses of resonances inferred from their charged daughter particles. Such biases would be hard -5 -to disentangle from the other systematic effects addressed in section 4.4. It is therefore essential to determine the global tracker tilt angles prior to the overall alignment correction, because the latter might be affected by a wrong assumption on the magnetic field orientation. It is not expected that tilt angles will change significantly with time, hence one measurement should be sufficient for many years of operation. The tilt angles have been determined with the 2010 CMS data, and they have been used as the input for the internal alignment detailed in subsequent sections of this article. A repetition of the procedure with 2011 data led to compatible results.
The measurement of the tilt angles is based on the study of overall track quality as a function of the θ x and θ y angles. Any non-optimal setting of the tilt angles will result, for example, in incorrect assumptions on the transverse field components relative to the tracker axis. This may degrade the observed track quality. The tilt angles θ x and θ y are scanned in appropriate intervals centred around zero. For each set of values, the standard CMS track fit is applied to the whole set of tracks, and an overall track quality estimator is determined. The track quality is estimated by the total χ 2 of all the fitted tracks, ∑ χ 2 . As cross-checks, two other track quality estimators are also studied: the mean normalised track χ 2 per degree of freedom, χ 2 /N dof , and the mean p value, P(χ 2 , N dof ) , which is the probability of the χ 2 to exceed the value obtained in the track fit, assuming a χ 2 distribution with the appropriate number of degrees of freedom. All methods yield similar results; remaining small differences are attributed to the different relative weight of tracks with varying number of hits and the effect of any remaining outliers.
Events are considered if they have exactly one primary vertex reconstructed by using at least four tracks, and a reconstructed position along the beam line within ±24 cm of the nominal centre of the CMS detector. Tracks are required to have at least ten reconstructed hits and a pseudorapidity of |η| < 2.5. The track impact parameter with respect to the primary vertex must be less than 0.15 cm (2 cm) in the transverse (longitudinal) direction. For the baseline analysis that provides the central values, the transverse momentum threshold is set to 1 GeV/c; alternative values of 0.5 and 2 GeV/c are used to check the stability of the results. Only tracks with χ 2 /N dof < 4 are selected in order to reject those with wrongly associated hits. For each setting of the tilt angles, each track is refitted by using a full 3D magnetic field model [19,20] that also takes tangential field components into account. This field model is based on measurements obtained during a dedicated mapping operation with Hall and NMR probes [21].
Each tilt angle is scanned at eleven settings in the range ±2 mrad. The angle of correct alignment is derived as the point of maximum track quality, corresponding to minimum total χ 2 , determined by a least squares fit with a second-order polynomial function. The dependence of the total χ 2 divided by the number of tracks on the tilt angles θ x and θ y is shown in figure 3.
In each plot, only one angle is varied, while the other remains fixed at 0. The second-order polynomial fit describes the functional dependence very well. There is no result for the scan point at θ y = −2 mrad, because this setting is outside the range allowed by the track reconstruction programme. While the θ y dependence is symmetric with a maximum near θ y ≈ 0, the θ x dependence is shifted towards positive values, indicating a noticeable vertical downward tilt of the tracker around the x-axis with respect to the magnetic field. On an absolute scale, the tilt is small, but nevertheless visible within the resolution of beam line tilt measurements [15]. Figure 4 shows the resulting values of θ x and θ y for five intervals of track pseudorapidity, for tracks with p T > 1 GeV/c for the total χ 2 estimator. The statistical uncertainties are taken as the -6 -

JINST 9 P06009
[mrad] x θ -2 -1.5 -1 -0.5 0 0  distance corresponding to a one unit increase of the total χ 2 ; they are at most of the order of the symbol size and thus hardly visible. The outer error bars show the root mean square (RMS) of the changes observed in the tilt angle estimates when changing the track quality estimators and the p T threshold. The right plot shows the results of the method applied to simulated events without any tracker misalignment. They are consistent with zero tilt within the systematic uncertainty. The variations are smaller in the central region within |η| < 1.5, and they are well contained within a margin of ±0.1 mrad, which is used as a rough estimate of the systematic uncertainty of this method. The left plot in figure 4 shows the result obtained from data; the θ x values are systematically shifted by ≈0.3 mrad, while the θ y values are close to zero. The nominal tilt angle values used as alignment constants are extracted from the central η region of figure 4 (left) as θ x = (0.3 ± 0.1) mrad and θ y = (0 ± 0.1) mrad, thus eliminating an important potential source of systematic alignment uncertainty. These results represent an important complementary step to the internal alignment procedure described in the following sections.

Methodology of track based internal alignment
Track-hit residual distributions are generally broadened if the assumed positions of the silicon modules used in track reconstruction differ from the true positions. Therefore standard alignment algorithms follow the least squares approach and minimise the sum of squares of normalised residuals from many tracks. Assuming the measurements m i j , i.e. usually the reconstructed hit positions on the modules, with uncertainties σ i j are independent, the minimised objective function is where f i j is the trajectory prediction of the track model at the position of the measurement, depending on the geometry (p) and track (q j ) parameters. An initial geometry description p 0 is usually available from design drawings, survey measurements, or previous alignment results. This can be used to determine approximate track parameters q j0 . Since alignment corrections can be assumed to be small, f i j can be linearised around these initial values. Minimising χ 2 after the linearisation leads to the normal equations of least squares. These can be expressed as a linear equation system Ca = b with a T = (∆p, ∆q), i.e. the alignment parameters ∆p and corrections to all parameters of all n used tracks ∆q T = (∆q 1 , . . . , ∆q n ). If the alignment corrections are not small, the linear approximation is of limited precision and the procedure has to be iterated. For the alignment of the CMS tracker a global-fit approach [22] is applied, by using the MILLEPEDE II program [23]. It makes use of the special structure of C that facilitates, by means of block matrix algebra, the reduction of the large system of equations Ca = b to a smaller one for the alignment parameters only, Here C and b sum contributions from all tracks. To derive b , the solutions ∆q j of the track fit equations C j ∆q j = b j are needed. For C , also the covariance matrices C −1 j have to be calculated. The reduction of the matrix size from C to C is dramatic. For 10 7 tracks with on average 20 parameters and 10 5 alignment parameters, the number of matrix elements is reduced by a factor larger than 4 × 10 6 . Nevertheless, no information is lost for the determination of the alignment parameters ∆p.
The following subsections explain the track and alignment parameters ∆q and ∆p that are used for the CMS tracker alignment. Then the concept of a hierarchical and differential alignment by using equality constraints is introduced, followed by a discussion of "weak modes" and how they can be avoided. The section closes with the computing optimisations needed to make MILLE-PEDE II a fast tool with modest computer memory needs, even for the alignment of the CMS tracker with its unprecedented complexity.

Track parameterisation
In the absence of material effects, five parameters are needed to describe the trajectory of a charged particle in a magnetic field. Traversing material, the particle experiences multiple scattering, mainly due to Coulomb interactions with atomic nuclei. These effects are significant in the CMS tracker, i.e. the particle trajectory cannot be well described without taking them into account in the track -8 -model. This is achieved in a rigorous and efficient way as explained below in this section, representing an improvement compared to previous MILLEPEDE II alignment procedures [10,11,13] for the CMS silicon tracker, which ignored correlations induced by multiple scattering.
A rigorous treatment of multiple scattering can be achieved by increasing the number of track parameters to n par = 5 + 2n scat , e.g. by adding two deflection angles for each of the n scat thin scatterers traversed by the particle. For thin scatterers, the trajectory offsets induced by multiple scattering can be ignored. If a scatterer is thick, it can be approximately treated as two thin scatterers. The distributions of these deflection angles have mean values of zero. Their standard deviations can be estimated by using preliminary knowledge of the particle momentum and of the amount of material crossed. This theoretical knowledge is used to extend the list of measurements, originally containing all the track hits, by "virtual measurements". Each scattering angle is virtually measured to be zero with an uncertainty corresponding to the respective standard deviation. These virtual measurements compensate for the degrees of freedom introduced in the track model by increasing its number of parameters. For cosmic ray tracks this complete parameterisation often leads to n par > 50. Since in the general case the effort to calculate C −1 j is proportional to n 3 par , a significant amount of computing time would be spent to calculate C −1 j and thus C and b . The progressive Kalman filter fit, as used in the CMS track reconstruction [43], avoids the n 3 par scaling by a sequential fit procedure, determining five track parameters at each measurement. However, the Kalman filter does not provide the full (singular) covariance matrix C −1 j of these parameters as needed in a global-fit alignment approach. As shown in [24], the Kalman filter fit procedure can be extended to provide this covariance matrix, but since MILLEPEDE II is designed for a simultaneous fit of all measurements, another approach is followed here.
The general broken lines (GBL) track refit [25,26] that generalises the algorithm described in ref. [27], avoids the n 3 par scaling for calculating C −1 j by defining a custom track parameterisation. The parameters are q j = (∆ q p , u 1 , . . . , u (n scat +2) ), where ∆ q p is the change of the inverse momentum multiplied by the particle charge and u i are the two-dimensional offsets to an initial reference trajectory in local systems at each scatterer and at the first and last measurement. All parameters except ∆ q p influence only a small part of the track trajectory. This locality of all track parameters (but one) results in C j being a bordered band matrix with band width m ≤ 5 and border size b = 1, i.e. the matrix elements c kl j are non-zero only for k ≤ b, l ≤ b or |k − l| ≤ m. By means of root-free Cholesky decomposition (C band j = LDL T ) of the band part C band j into a diagonal matrix D and a unit left triangular band matrix L, the effort to calculate C −1 j and q j is reduced to ∝ n 2 par · (m + b) and ∝ n par · (m + b) 2 , respectively. This approach saves a factor of 6.5 in CPU time for track refitting in MILLEPEDE II for isolated muons (see section 5) and of 8.4 for cosmic ray tracks in comparison with an (equivalent) linear equation system with a dense matrix solved by inversion.
The implementation of the GBL refit used for the MILLEPEDE II alignment of the CMS tracker is based on a seed trajectory derived from the position and direction of the track at its first hit as resulting from the standard Kalman filter track fit. From the first hit, the trajectory is propagated taking into account magnetic-field inhomogeneities, by using the Runge-Kutta technique as described in [43], and the average energy loss in the material as for muons. As in the CMS Kalman filter track fit, all traversed material is assumed to coincide with the silicon measurement planes that are treated as thin scatterers. The curvilinear frame defined in [28] is chosen for the local coordinate systems at these scatterers. Parameter propagation along the trajectory needed to link the local systems uses Jacobians assuming a locally constant magnetic field between them [28].
To further reduce the computing time, two approximations are used in the standard processing: material assigned to stereo and rϕ modules that are mounted together is treated as a single thin scatterer, and the Jacobians are calculated assuming the magnetic field B to be parallel to the z-axis in the limit of weak deflection, | B| p → 0. This leads to a band width of m = 4 in the matrix C j .

Alignment parameterisation
To first approximation, the CMS silicon modules are flat planes. Previous alignment approaches in CMS ignored possible deviations from this approximation and determined only corrections to the initial module positions, i.e. up to three shifts (u, v, w) and three rotations (α, β , γ). However, tracks with large angles of incidence relative to the silicon module normal are highly sensitive to the exact positions of the modules along their w directions and therefore also to local w variations if the modules are not flat. These local variations can arise from possible curvatures of silicon sensors and, for strip modules with two sensors in a chain, from their relative misalignment. In fact, sensor curvatures can be expected because of tensions after mounting or because of single-sided silicon processing as for the strip sensors. The specifications for the construction of the sensors required the deviation from perfect planarity to be less than 100 µm [1]. To take into account such deviations, the vector of alignment parameters ∆p is extended to up to nine degrees of freedom per sensor instead of six per module. The sensor shape is parameterised as a sum of products of modified (orthogonal) Legendre polynomials up to the second order where the constant and linear terms are equivalent to the rigid body parameters w, α and β : 1]) is the position on the sensor in the u-(v-) direction, normalised to its width l u (length l v ). The coefficients w 20 , w 11 and w 02 quantify the sagittae of the sensor curvature as illustrated in figure 5. The CMS track reconstruction algorithm treats the hits under the assumption of a flat module surface. To take into account the determined sensor shapes, the reconstructed hit positions in u and (for pixel modules) v are corrected by (−w (u r , v r ) · tan ψ) and -10 -(−w (u r , v r ) · tan ζ ), respectively. Here the track angle from the sensor normal ψ (ζ ) is defined in the u-w (v-w) plane (figure 2), and the track predictions are used for u r and v r .
To linearise the track-model prediction f i j , derivatives with respect to the alignment parameters have to be calculated. If f i j is in the local u (v) direction, denoted as f u ( f v ) in the following, the derivatives are Unlike the parameterisation used in previous CMS alignment procedures [29], the coefficients of the first order polynomials w 01 = l v 2 · tan α and w 10 = −l u 2 · tan β are used as alignment parameters instead of the angles. This ensures the orthogonality of the sensor surface parameterisation. The in-plane rotation γ is replaced by γ = s · γ with s = l u +l v 2 . This has the advantage that all parameters have a length scale and their derivatives have similar numerical size.
The pixel modules provide uncorrelated measurements in both u and v directions. The strips of the modules in the TIB and TOB are parallel along v, so the modules provide measurements only in the u direction. For TID and TEC modules, where the strips are not parallel, the hit reconstruction provides highly correlated two-dimensional measurements in u and v. Their covariance matrix is diagonalised and the corresponding transformation applied to the derivatives and residuals as well. The measurement in the less precise direction, after the diagonalisation, is not used for the alignment.

Hierarchical and differential alignment by using equality constraints
The CMS tracker is built in a hierarchical way from mechanical substructures, e.g. three BPIX half-layers form each of the two BPIX half-shells. To treat translations and rotations of these substructures as a whole, six alignment parameters ∆p l for each of the considered substructures can be introduced. The derivatives of the track prediction with respect to these parameters, d f u/v /d∆p l , are obtained from the six translational and rotational parameters of the hit sensor ∆p s by coordinate transformation with the chain rule where d∆p s d∆p l is the 6 × 6 Jacobian matrix expressing the effect of translations and rotations of the large structure on the position of the sensor.
-11 -These large-substructure parameters are useful in two different cases. If the track sample is too small for the determination of the large number of alignment parameters at module level, the alignment can be restricted to the much smaller set of parameters of these substructures. In addition they can be used in a hierarchical alignment approach, simultaneously with the alignment parameters of the sensors. This has the advantage that coherent misplacements of large structures in directions of the non-sensitive coordinate v of strip sensors can be taken into account.
This hierarchical approach introduces redundant degrees of freedom since movements of the large structures can be expressed either by their alignment parameters or by combinations of the parameters of their components. These degrees of freedom are eliminated by using linear equality constraints. In general, such constraints can be formulated as where the index i runs over all the alignment parameters. In MILLEPEDE II these constraints are implemented by extending the matrix equation (4.2) by means of Lagrangian multipliers. In the hierarchical approach, for each parameter ∆p l of the larger structure one constraint with s = 0 has to be applied and then all constraints for one large structure form a matrix equation, where ∆p s,i are the shift and rotation parameters of component i of the large substructure. Similarly, the technique of equality constraints is used to fix the six undefined overall shifts and rotations of the complete tracker. The concept of "differential alignment" means that in one alignment step some parameters are treated as time-dependent while the majority of the parameters stays time-independent. Time dependence is achieved by replacing an alignment parameter ∆p t in the linearised form of equation (4.1) by several parameters, each to be used for one period of time only. This method allows the use of the full statistical power of the whole dataset for the determination of parameters that are stable with time, without neglecting the time dependence of others. This is especially useful in conjunction with a hierarchical alignment: the parameters of larger structures can vary with time, but the sensors therein are kept stable relative to their large structure.

Weak modes
A major difficulty of track based alignment arises if the matrix C in equation (4.2) is ill-conditioned, i.e. singular or numerically close to singular. This can result from linear combinations of the alignment parameters that do not (or only slightly) change the track-hit residuals and thus the overall χ 2 (∆p, ∆q) in equation (4.1), after linearisation of the track model f i j . These linear combinations are called "weak modes" since the amplitudes of their contributions to the solution are either not determinable or only barely so.
Weak modes can emerge if certain coherent changes of alignment parameters ∆p can be compensated by changes of the track parameters ∆q. The simplest example is an overall shift of the tracker that would be compensated by changes of the impact parameters of the tracks. For that reason the overall shift has to be fixed by using constraints as mentioned above. Other weak modes -12 -

JINST 9 P06009
discussed below influence especially the transverse momenta of the tracks. A specific problem is that even very small biases in the track model f i j can lead to a significant distortion of the tracker if a linear combination of the alignment parameters is not well determined by the data used in equation (4.1). As a result, weak modes contribute significantly to the systematic uncertainty of kinematic properties determined from the track fit.
The range of possible weak modes depends largely on the geometry and segmentation of the detector, the topology of the tracks used for alignment, and on the alignment and track parameters. The CMS tracker has a highly segmented detector geometry with a cylindrical layout within a solenoidal magnetic field. If aligned only with tracks passing through the beam line, the characteristic weak modes can be classified in cylindrical coordinates, i.e. by module displacements ∆r, ∆z, and ∆ϕ as functions of r, z, and ϕ [30]. To control these weak modes it is crucial to include additional information in equation (4.1), e.g. by combining track sets of different topological variety and different physics constraints by means of • cosmic ray tracks that break the cylindrical symmetry, • straight tracks without curvature, recorded when the magnetic field is off, • knowledge about the production vertex of tracks, • knowledge about the invariant mass of a resonance whose decay products are observed as tracks.
Earlier alignment studies [13] have shown that the usage of cosmic ray tracks is quite effective in controlling several classes of weak modes. However, for some types of coherent deformations of the tracker the sensitivity of an alignment based on cosmic ray tracks is limited. A prominent example biasing the track curvature κ ∝ q p T (with q being the track charge) is a twist deformation of the tracker, in which the modules are moved coherently in ϕ by an amount directly proportional to their longitudinal position (∆ϕ = τ · z). This has been studied extensively in [31]. Other potential weak modes are the off-centring of the barrel layers and endcap rings (sagitta), described by (∆x, ∆y) = σ · r · (sin ϕ σ , cos ϕ σ ), and a skew, parameterised as ∆z = ω · sin(ϕ + ϕ ω ). Here σ and ω denote the amplitudes of the sagitta and skew weak modes, whereas ϕ σ and ϕ ω are their azimuthal phases.
As a measure against weak modes that influence the track momenta, such as a twist deformation, information on the mass of a resonance decaying into two charged particles is included in the alignment fit with the following method. A common parameterisation for the two trajectories of the particles produced in the decay is defined as in [32]. Instead of 2 · 5 parameters (plus those accounting for multiple scattering), the nine common parameters are the position of the decay vertex, the momentum of the resonance candidate, two angles defining the direction of the decay products in the rest-frame of the resonance, and the mass of the resonance. The mean mass of the resonance is added as a virtual measurement with an uncertainty equal to the standard deviation of its invariant mass distribution. Mean and standard deviation are estimated from the distribution of the invariant mass in simulated decays, calculated from the decay particles after final-state radiation. In the sum on the right hand side of equation (4.1), the two individual tracks are replaced by the common fit object. With the broken lines parameterisation the corresponding C j has the border size b = 9. This -13 -approach to include resonance mass information in the alignment fit implies an implementation of a vertex constraint as well, since the coordinates of the decay vertex are parameters of the combined fit object and thus force the tracks to a common vertex.
The dependence of the reconstructed resonance mass M on the size τ of a twist deformation can be shown to follow Here B z denotes the strength of the solenoidal magnetic field along the z-axis, p + (p − ) and p + z (p − z ) are the momentum and its longitudinal component of the positively (negatively) charged particle, respectively. Equation (4.8) shows that the inclusion of a heavy resonance such as the Z boson in the alignment procedure is more effective for controlling the twist than the J/ψ and ϒ quarkonia, since at the LHC the decay products of the latter are usually boosted within a narrow cone, and the difference of their longitudinal momenta is small. The decay channel of Z to muons is particularly useful because the high-p T muons are measured precisely and with high efficiency by the CMS detector. The properties of the Z boson are predicted by the Standard Model and have been characterised experimentally very well at the LHC [33,34] and in past experiments [35]. This allows the muonic decay of the Z boson to be used as a standard reference to improve the ability of the alignment procedure to resolve systematic distortions, and to verify the absence of any bias on the track reconstruction.
Under certain conditions, equality constraints can be utilised against a distortion in the starting geometry p 0 induced by a weak mode in a previous alignment attempt. The linear combination of the alignment parameters corresponding to the weak mode and the amplitude of the distortion in the starting geometry have to be known. In this case, a constraint used in a further alignment step can remove the distortion, even if the data used in the alignment cannot determine the amplitude. If, for example, each aligned object i is, compared to its true position, misplaced in ϕ according to a twist τ with reference point z 0 (∆ϕ i = τ · (z i − z 0 )), this constraint takes the form where the sums over i and k include the aligned objects and the sum over j includes their active alignment parameters ∆p i j .

Computing optimisation
The MILLEPEDE II program proceeds in a two-step approach. First, the standard CMS software environment [5] is used to produce binary files containing the residuals m i j − f i j , their dependence on the parameters ∆p and ∆q of the linearised track model, the uncertainties σ i j , and labels identifying the fit parameters. Second, these binary files are read by an experiment-independent program that sets up equation (4.2), extends it to incorporate the Lagrangian multipliers to implement constraints, and solves it, e.g. by the iterative MINRES algorithm [36]. In contrast to other fast algorithms for solving large matrix equations, MINRES does not require a positive definite matrix, and because of the Lagrangian multipliers C is indefinite. Since the convergence speed of MINRES depends on the eigenvalue spectrum of the matrix C , preconditioning is used by multiplying equation (4.2) by the inverse of the diagonal of the matrix. The elements of the symmetric matrix C in general require storage in double precision while they are summed. For the 200 000 alignment parameters used in this study, this would require 160 GB of RAM. Although the matrix is rather -14 -sparse and only non-zero elements are stored, the reduction is not sufficient. High alignment precision also requires the use of many millions of tracks of different topologies that are fitted several times within MILLEPEDE II, leading to a significant contribution to the CPU time. To cope with the needs of the CMS tracker alignment described in this article, the MILLEPEDE II program has been further developed, in particular to reduce the computer memory needs, to enlarge the number of alignment parameters beyond what was used in [13], and to reduce the processing time. Details are described in the following.
Since the non-zero matrix elements are usually close to each other in the matrix, further reduction of memory needs is reached by bit-packed addressing of non-zero blocks in a row. In addition, some matrix elements sum contributions of only a few tracks, e.g. cosmic ray tracks from rare directions. For these elements, single precision storage is sufficient.
Processing time is highly reduced in MILLEPEDE II by shared-memory parallelisation by means of the Open Multi-Processing (OPENMP R ) package [37] for the most computing intensive parts like the product of the huge matrix C with a vector for MINRES, the track fits for the calculation of ∆q j and C −1 j , and the construction of C from those. Furthermore, bordered band matrices C j are automatically detected and root-free Cholesky decomposition is applied subsequently (see section 4.1).
Reading data from local disk and memory access are further potential bottlenecks. The band structure of C j that is due to the GBL refit and the approximations in the track model (see section 4.1) also aim to alleviate the binary file size. To further reduce the time needed for reading, MILLEPEDE II reads compressed input and caches the information of many tracks to reduce the number of disk accesses.

Strategy of the internal alignment of the CMS tracker
In general, the tracker has been sufficiently stable throughout 2011 to treat alignment parameters as constant in time. The stability of large structures has been checked as described in section 6. An exception to this stability is the pixel detector whose movements have been carefully monitored and are then treated as described below. Validating the statistical alignment precision by means of the methods of section 7 shows no need to have a further time dependent alignment at the single module parameter level. Also, calibration parameters influence the reconstructed position of a hit on a module. These parameters account for the Lorentz drift of the charge carriers in the silicon due to the magnetic field and for the inefficient collection of charge generated near the back-plane of strip sensors if these are operated in deconvolution mode [43]. Nevertheless, for 2011 data there is no need to integrate the determination of calibration parameters into the alignment procedure. The hit position effect of any Lorentz drift miscalibration is compensated by the alignment corrections and as long as the Lorentz drift is stable with time, the exact miscalibration has no influence on the statistical alignment precision. Also the back-plane correction has only a very minor influence. No significant degradation of the statistical alignment precision with time has been observed.
Given this stability, the 2011 alignment strategy of the CMS tracker consists of two steps; both apply the techniques and tools described in section 4. The first step uses data collected in 2011 up to the end of June, corresponding to an integrated luminosity of about 1 fb −1 . This step is based on the full exploitation of different track topologies, making use of resonance mass and -15 -vertex information. The details are described in the rest of this section. The second step treats the four relevant movements of the pixel detector after the end of June, identified with the methods of section 6.2. Six alignment parameters for each BPIX layer and FPIX half-disk are redetermined by a stand-alone alignment procedure, keeping their internal structures unchanged and the positions of the strip modules constant.
Tracks from several data sets are used simultaneously in the alignment procedure. Hit and track reconstruction are described in [43] and the following selection criteria are applied: • Isolated muons: global muons [16] are reconstructed in both the tracker and the muon system. They are selected if their number of hits N hit in the tracker exceeds nine (at least one of which is in the pixel detector, N hit (pixel) ≥ 1), their momenta p are above 8 GeV/c (in order to minimise the effects of Multiple Coulomb scattering), and their transverse momenta p T are above 5 GeV/c. Their distances ∆R = (∆ϕ) 2 + (∆η) 2 from the axes of jets reconstructed in the calorimeter and fulfilling p T > 40 GeV/c have to be larger than 0.1. This class of events is populated mainly by muons belonging to leptonic W -boson decays and about 15 million of these tracks are used for the alignment.
• Tracks from minimum bias events: a minimum bias data sample is selected online with a combination of triggers varying with pileup conditions, i.e. the mean number of additional collisions, overlapping to the primary one, within the same bunch crossing (on average 9.5 for the whole 2011 data sample). These triggers are based, for example, on pick-up signals indicating the crossing of two filled proton bunches, signals from the Beam Scintillator Counters [1], or moderate requirements on hit and track multiplicity in the pixel detectors. The offline track selection requires N hit > 7, p > 8 GeV/c. Three million of these tracks are used for alignment.
• Muons from Z-boson decays: events passing any trigger filter requesting two muons reconstructed online are used for reconstructing Z-boson candidates. Two muons with opposite charge must be identified as global muons and fulfil the requirement N hit > 9 (N hit (pixel) ≥ 1). Their transverse momenta must exceed p T > 15 GeV/c and their distances to jets reconstructed in the calorimeter ∆R > 0.2. The invariant mass of the reconstructed dimuon system must lie in the range 85.8 < M µ + µ − < 95.8 GeV/c 2 , in order to obtain a pure sample of Z-boson candidates. The total number of such muon pairs is 375 000.
• Cosmic ray tracks: cosmic ray events used in the alignment were recorded with the strip tracker operated both in peak and deconvolution modes. Data in peak mode were recorded in a dedicated cosmic data taking period before the restart of the LHC operations in 2011 and during the beam-free times between successive LHC fills. In addition, cosmic ray data were taken in deconvolution mode both during and between LHC fills, making use of a dedicated trigger selecting cosmic ray tracks passing through the tracker barrel. In total 3.6 million cosmic ray tracks with p > 4 GeV/c and N hit > 7 are used, where about half of the sample has been collected with the strip tracker operating in peak mode, while the other half during operations in deconvolution mode.
For all the data sets, basic quality criteria are applied on the hits used in the track fit and on the tracks themselves: -16 -• the signal-over-noise ratio of the strip hits must be higher than 12 (18) when the strip tracker records data in deconvolution (peak) mode; • for pixel hits, the probability of the hit to match the expected shape of the charge cluster for the given track parameters [38] must be higher than 0.001 (0.01) in the u (v) direction; • for all hits, the angle between the track and the module surface must be larger than 10 • (20 • ) for tracks from proton-proton collisions (cosmic rays) to avoid a region where the estimates of the hit position and uncertainty are less reliable; • to ensure a reliable determination of the polar track angle, θ , tracks have to have at least two hits in pixel or stereo strip modules; • tracks from proton-proton collisions have to satisfy the "high-purity" criteria [14,43] of the CMS track reconstruction code; • in the final track fit within MILLEPEDE II, tracks are rejected if their χ 2 value is larger than the 99.87% quantile (corresponding to three standard deviations) of the χ 2 distribution for the number of degrees of freedom N dof of the track.
The tracker geometry, as determined by the alignment with the 2010 data [31], is the starting point of the 2011 alignment procedure. In general, for each sensor all nine parameters are included in the alignment procedure. Exceptions are the v coordinate for strip sensors since it is orthogonal to the measurement direction, and the surface parameterisation parameters w 10 , w 01 , w 20 , w 11 , w 02 for the FPIX modules. The latter exception is due to their small size and smaller sensitivity compared to the other subdetectors, caused by the smaller spread of track angles with respect to the module surface.
The hierarchical alignment approach discussed in section 4.3 is utilised by introducing parameters for shifts and rotations of half-barrels and end-caps of the strip tracker and of the BPIX layers and FPIX half-disks. For the parameters of the BPIX layers and FPIX half-disks the differential alignment is used as well. The need for nine time periods (including one for the cosmic ray data before the LHC start) has been identified with the validation procedure of section 6.2. The parameters for the six degrees of freedom of each of the two TOB half-barrels are constrained to have opposite sign, fixing the overall reference system.
Three approaches have been investigated to overcome the twist weak mode introduced in section 4.4. The first uses tracks from cosmic rays, recorded in 2010 when the magnetic field was off. This successfully controls the twist, but no equivalent data were available in 2011. Second, the twist has been measured in the starting geometry with the method of section 9.2. An equality constraint has been introduced to compensate for it. While this method controls the twist, it does not reduce the dependence of the muon kinematics on the azimuthal angle seen in sections 9.1 and 9.2. Therefore the final alignment strategy is based on the muons from Z-boson decays to include mass information and vertex constraints in the alignment procedure as described in section 4.4, with a virtual mass measurement of M µ + µ − = 90.86 ± 1.86 GeV/c 2 .
In total, more than 200 000 alignment parameters are determined in the common fit, by using 138 constraints. To perform this fit, 246 parallel jobs produce the compressed input files containing residuals, uncertainties, and derivatives for the linearised track model for the MILLEPEDE II -17 -program. The total size of these files is 46.5 GB. The matrix C constructed from this by MILLE-PEDE II contains 31% non-zero off-diagonal elements. With a compression ratio of 40% this fits well into an affordable 32 GB of memory. The MINRES algorithm has been run four times with increasingly tighter rejection of bad tracks. Since C is not significantly changed by this rejection, it does not need to be recalculated after the first iteration. By means of eight threads on an Intel R Xeon R L5520 processor with 2.27 GHz, the CPU usage was 44:30 h with a wall clock time of only 9:50 h. This procedure has been repeated four times to treat effects from non-linearity: iterating the procedure is particularly important for eliminating the twist weak mode.
The same alignment procedure as used on real data was run on a sample of simulated tracks, prepared with the same admixture of track samples as in the recorded data. The geometry obtained in this way is characterised by a physics performance comparable to the one obtained with recorded data and can be used for comparisons with simulated events. This geometry is referred as the "realistic" misalignment scenario.

Monitoring of the large structures
A substantial fraction of the analyses in CMS use data reconstructed immediately after its acquisition (prompt reconstruction) for obtaining preliminary sets of results. Therefore, it is important to provide to the physics analyses the best possible geometry for use in the prompt reconstruction, immediately correcting any possible time-dependent large misalignment. Specifically, the position of the large structures in the pixel detector is relevant for the performance of b-tagging algorithms. As described in [8], misalignment at the level of a few tens of microns can seriously affect the b-tagging performance.
In order to obtain the best possible track reconstruction performance, the tracker geometry is carefully monitored as a function of time, so that corrections can be applied upon movements large enough to affect the reconstruction significantly. The CMS software and reconstruction framework accommodates time-dependent alignment and calibration conditions by "intervals of validity" (IOV), which are periods during which a specific set of constants retain the same values [5]. While the alignment at the level of the single modules needs data accumulated over substantial periods of time, the stability of the position of the large structures can be controlled with relatively small amounts of data or via a system of infrared lasers. The short data acquisition times required by these monitoring methods allow fast and frequent feedback to the alignment procedure. A system of laser beams is able to monitor the positions of a restricted number of modules in the silicon strip tracker. Movements of large structures in the pixel tracker can be detected with high precision with collision tracks by a statistical study of the primary-vertex residuals, defined as the distance between the tracks and the primary vertex at the point of closest approach of the tracks to the vertex. All these techniques allow the monitoring of the position of the large structures on a daily basis. This frequent monitoring, together with the fast turn-around of the alignment with MILLEPEDE II, allows, if needed, the correction of large movements on the timescale of one day.

Monitoring of the strip tracker geometry
The CMS laser alignment system (LAS) [39] provides a source of alignment information independent of tracks. It is based on 40 near-infrared (1075 nm) laser beams passing through a subset -18 -of the silicon sensors that are used also for the standard track reconstruction (see figure 1). The laser optics are mounted on mechanical structures independent of those used to support the tracker. With this limited number of laser beams one can align large-scale structures such as the TOB, TIB, and both TECs. The mechanical accuracy of LAS components limits the absolute precision of this alignment method to ∼50 µm in comparison to the alignment with tracks, which reaches better than 10 µm resolution (see section 7), but the response time of the LAS is at the level of only a few minutes. Within this margin of accuracy, the LAS measurement demonstrated very good stability of the strip detector geometry over the whole 2011 running period. This observation is confirmed by a dedicated set of alignments with tracks, where the dataset was divided into different time periods. No significant movements of the large structures of the silicon strip tracker were found.

Monitoring of the pixel detector geometry with tracks
The large number of tracks produced in a pp collision allows precise reconstruction of the interaction vertices [15]. The resolution of the reconstructed vertex position is driven by the pixel detector since it is the sub-structure that is closest to the interaction point and has the best hit resolution. The primary vertex residual method is based on the study the distance between the track and the vertex, the latter reconstructed without the track under scrutiny (unbiased track-vertex residual). Events used in this analysis are selected online with minimum bias triggers as mentioned in section 5. The analysis uses only vertices with distances from the nominal interaction point √ x 2 vtx + y 2 vtx < 2 cm and |z vtx | < 24 cm in the transverse and longitudinal direction, respectively. The fit of the vertex must have at least 4 degrees of freedom. For each of these vertices, the impact parameters are measured for tracks with: • more than six hits in the tracker, of which at least two are in the pixel detector, • at least one hit in the first layer of the BPIX or the first disk of the FPIX, • p T > 1 GeV/c, • χ 2 /N dof of the track smaller than 5.
The vertex position is recalculated excluding the track under scrutiny from the track collection. A deterministic annealing clustering algorithm [40] is used in order to make the method robust against pileup, as in the default reconstruction sequence.
The distributions of the unbiased track-vertex residuals in the transverse plane,d xy , and in the longitudinal direction,d z , are studied in bins of η and ϕ of the track. Random misalignments of the modules affect only the resolution of the unbiased track-vertex residual, increasing the width of the distributions, but without biasing their mean. Systematic movements of the modules will bias the distributions in a way that depends on the nature and size of the misalignment and the η and ϕ of the selected tracks. As an example, the dependence of the means of thed xy andd z distributions as a function of the azimuthal angle of the track is shown in figure 6. The focus on the ϕ-dependence is motivated by the design of the BPIX, which is divided into one half-shell with modules at ϕ ∈ [−π/2, π/2] and another with modules at ϕ ∈ [π/2, π] ∪ [−π, −π/2]. Small movements of the two half-shells are mechanically allowed by the mechanical design of the pixel detector. The observed movements have not been associated to a specific cause, although thermal -19 -

JINST 9 P06009
[degrees] ϕ cycles executed on the pixel detector increase the chances that such movements will happen. As an example, the impact of a movement of one half-shell with respect to the other in the longitudinal direction is shown by the open circles in figure 6 for a simulated sample of minimum bias events. Such a movement is reflected in a very distinctive feature in the dependence of the mean of thẽ d z distribution as a function of ϕ. The size of the movement can be estimated as the average bias in the two halves of the BPIX. The time dependence of this quantity in the 2011 data is illustrated in figure 7, which shows some discontinuities. Studies carried out on simulated data show that the b-tagging performance is visibly degraded in the case of uncorrected shifts with amplitude |∆z| > 20 µm [8]. For this reason, IOVs with different alignments of the pixel layers are conservatively defined according to the boundaries of periods with steps of |∆z| larger than 10 µm. The time-dependent alignment parameters of BPIX layers and FPIX half-disks during the first eight IOVs (until end of June 2011) were determined in a single global fit. Within each time interval, the positions of the modules with respect to the structure were found not to need any further correction. Because of this, the positions of the pixel layers and half-disks were determined by a dedicated alignment procedure keeping the other hierarchies of the geometry unchanged. The aligned geometry performs well over the entire data-taking period, reducing the observed jumps in the expected way. Residual variations can be attributed to small misalignments with negligible impact on physics performance and to the resolution of the validation method itself.

Statistical accuracy of the alignment
A method for assessing the achieved statistical precision of the aligned positions in the sensitive direction of the modules has been successfully explored and adopted in the alignment of the CMS tracker during commissioning with cosmic rays, described in [13]. The results from the validation are based on isolated muon tracks with a transverse momentum of p T > 40 GeV/c and at least ten hits in the tracker. The tracks are refitted with the alignment constants under study. Hit residuals are determined with respect to the track prediction, which is obtained without using the hit in -20 - question to avoid any correlation between hit and track. From the distribution of the unbiased hit residuals in each module, the median is taken and histogrammed for all modules in a detector subsystem. The median is relatively robust against stochastic effects from multiple scattering, and thus the distribution of the medians of residuals (DMR) is a measure of the alignment accuracy.
Only modules with at least 30 entries in their distribution of residuals are considered.
The addition of proton-proton collision events leads to a huge increase of the number of tracks available for the alignment, especially for the innermost parts of the tracker. Compared to the alignment with cosmic rays alone [13], considerable improvements are consequently observed in the pixel tracker, especially in the endcaps. The corresponding DMR are shown in the figure 8, separately for the u and v coordinates; for both pixel tracker barrel (BPIX) and endcap (FPIX) detectors, the RMS is well below 3 µm in both directions, compared to about 13 µm for the endcaps in the cosmic ray-only alignment. These numbers are identical or at most only slightly larger than those obtained in simulation without any misalignment, which are below 2 µm and thus far below the expected hit resolution. In the case of no misalignment, the remaining DMR width is non-zero because of statistical fluctuations reflecting the limited size of the track sample. Thus, the DMR width of the no-misalignment case indicates the intrinsic residual uncertainty of the DMR method itself. The remaining uncertainty after alignment determined from recorded data is close to the sensitivity limit of the DMR method. The DMR obtained with the realistic misalignment scenario (see section 5) are also shown in figure 8. The distributions are very close to the ideal case.
The alignment accuracy of the strip detector is investigated in smaller groups of sensors with a different method by using normalised residuals [41]. Each group consists of sensors that are expected to have similar alignment accuracy. The distinction is by layer ("L") or ring ("R") number, by longitudinal hemisphere ("+" and "−" for positive and negative z coordinate, respectively), and -21 - according to whether the surface of a barrel module points inwards ("i"), i.e. towards the beamline, or outwards ("o"). The letter "S" indicates a stereo module. The method applied here is based on the widths of the distributions of normalised unbiased residuals of each sensor group. Since the misalignment dilutes the apparent hit resolution, its degree can be derived from the widening of these distributions of normalised residuals. The residual resolution is the square root of the quadratic sum of the resolutions of the intrinsic hit reconstruction and of the track prediction, excluding the hit in question. The alignment uncertainty is added in quadrature to the intrinsic hit resolution of the cluster and adjusted such that the width of the distribution of normalised residuals matches the ideal one, which is determined from simulated events. In this way, misalignment in all degrees of freedom of the modules is contributing to the measurement. Since the width of each distribution of normalised residuals is also influenced by the alignment uncertainties of the surrounding detector areas, these parameters are highly coupled, and iteration is required. Each track is refitted with the current estimate of all alignment uncertainties taken into account, and the procedure is repeated. In each iteration, a damping factor of 0.6 is applied to the correction to mitigate oscillations. Convergence is achieved after 15 iterations.

JINST 9 P06009
The resulting alignment accuracy per sensor group, σ align, x , is shown in figure 9 for the TIB, TID and TEC subsystems. In all cases, a significant improvement resulting from the alignment procedure is observed. The alignment accuracy is between 3-8 µm for TIB, between 6-10 µm for TID, and better than 13 µm for the TEC. The only exception in ring 7 of the TEC is well understood; it is due to a systematic misplacement of these sensors in the (almost insensitive) radial direction -23 -by about 1.3 mm, which has been corrected for in further alignment procedures. For large parts of the TOB and the pixel detector, the remaining misalignment cannot be distinguished from zero within the systematic limitations of this method.
Overall, the statistical accuracy of the alignment is such that its effect is small compared to the intrinsic measurement precision of the sensors. It should be noted, however, that quality estimators based on track-residual distributions have little or no sensitivity to weak modes; these will be addressed in section 9.

Sensor and module shape parameters
As discussed in section 4.2, the tracker modules are not expected to be absolutely flat. If a silicon module is not flat, the local w-coordinate of the point where a track intersects the sensor (see figure 2) depends on the relative position (u r , v r ). The module shape can thus be investigated by track-hit residuals in w as a function of the track position on the module [30]. These residuals can be calculated from the one in the u-direction and the track angle ψ (figure 2), ∆w = ∆u/tan ψ.
The mean values of these residuals are shown in figures 10 and 11 as a function of the relative local track coordinates u r and v r , averaged over many modules of the strip and pixel subdetectors, respectively. Since tracks with a large angle ψ relative to the surface normal are most sensitive to any deviation from flatness, each residual in the average is weighted by tan 2 ψ.
Several module shape parameterisations are investigated in the alignment procedure as shown in figures 10 and 11. The blue open circles are deduced by using alignment constants obtained in a procedure similar to the one described in section 5, but without taking any module shape parameters into account. Clear deviations from zero are observed in almost all cases, indicating that the modules are systematically not flat. The red filled triangles are obtained with the same alignment procedure except that the two sensors of the modules in the TOB and in the TEC rings 5-7 are aligned independently. Finally, the black points represent the full alignment.
For the distributions along u r for "flat modules", a parabolic shape of the sensors of all subdetectors is clearly observed. These structures are correctly compensated when curvatures are taken into account as for the "curved sensors". At the largest values of |u r | in the TEC there are few tracks since the modules are wedge-like in shape and their widths l u are defined by their longer edges. The distributions along the strip direction (v r ) show more varied features. In the TIB, a structure remains that could be corrected by a fourth order polynomial, but the amplitude is only a few µm and thus negligible for tracking purposes. For the TOB, the V-shaped curve of the "flat modules" parameterisation indicates a systematic kink between the two sensors of the modules. After correcting for the relative misalignment of the sensors by means of the "flat sensors" parameterisation, a parabolic shape can be seen for the sensors at positive v r . Only the use of the "curved sensors" correction results in a flat dependence. For the double-sensor modules in the TEC rings 5-7, no systematic kink between the sensors is visible. However, both sensors are clearly curved, which is corrected for with the "curved sensors" parameterisation.
In the pixel detectors, no systematic structure is observed along the u-direction. The mean wresidual distributions along the v-direction, determined with tracks from proton-proton collisions, is shown in figure 11. An average curvature of the BPIX modules can clearly be seen. The FPIX -24 - modules also show curvatures, but with smaller amplitude. No corrections are necessary for this subtle effect.

JINST 9 P06009
The "curved sensor" parameterisation leads to a sizable improvement of the quality of the tracks that cross modules with large angles relative to the module normal; specifically, cosmic ray tracks crossing the barrel of the tracker from the top to the bottom with large distances of closest approach to the beam line d 0 predominantly have these large track angles. Figure 12 shows the average fit probability Prob(χ 2 , N dof ) as a function of |d 0 | for cosmic ray tracks. Tracks with small |d 0 | cross the modules with modest angles relative to the normal. With larger |d 0 |, the average angle of incidence of the track with respect to the module also increases, resulting in a significant degradation of the average fit quality for the "flat modules" parameterisation. For "curved sensors" the distribution is approximately flat for |d 0 | < 50 cm, resulting in improved consistency of the important cosmic ray track sample with tracks from proton-proton collisions. The remaining features of the dependence are correlated with the radii of the barrel layers. If tracks cross a layer tangentially, the treatment of multiple scattering effects by using thin scatterers only is an oversimplified approximation.
The average sizes of the sagittae of the sensor curvatures along the u-(w 20 ) and v-direction (w 02 ), as determined sensor-by-sensor, are shown in figure 13 for the different layers and rings, further differentiating for stereo and rϕ modules, i.e. grouping modules with similar sensors and mounting. While the average sagitta w 20 for BPIX sensors is almost zero, it is usually around −30 µm in the strip subdetectors. This matches well the sagittae of the average module shapes along u seen for the "flat module" distributions on the left pane of figure  sensor types in the TEC. While the average sensor sagittae shown here are clearly below the construction specifications of 100 µm, the tails of the distributions extend to |w i j | > 200 µm and even beyond. This could be due to stresses induced by the mechanics.
Aligning both sensors of the modules in the TOB and the TEC rings 5-7 independently indicates that the sensors were slightly misaligned with respect to each other during module assembly. As an example, figure 14 shows their average differences of the rotation angles around the local u-axis, ∆α = α 1 − α 2 , where the first sensor is the one closer to the readout electronics at v < 0. The TOB modules show an average kink of ∆α ≈ 1.6 mrad, matching well the kink seen in the TOB graph vs. v of figure 10. The value varies significantly among different modules in the TEC. This variation has averaged out the kink effect in the TEC distribution vs. v. The angular misalignment of the two sensors exhibits a significant spread as shown for ∆α and, for the rotation around v, ∆β of the TOB modules in figure 15. Values of ∆α = 6 mrad are reached, corresponding to ∆w ≈ 150 µm at the edges of the 10 cm long sensors.
In summary, the module shapes can be described with polynomials up to the second order for each sensor, and their coefficients are successfully determined sensor-by-sensor within the alignment procedure. Applying corrections to the hit positions that depend on the module parameters determined and on the track parameters on the module surface significantly improves the overall track description, especially for the important cosmic ray tracks. The sensor parameterisation used here is valid as long as the effect of the curvatures can be approximated by a change of the local w coordinate only, neglecting changes in u and v. Within these boundaries, the construction criterion of sensor bows below 100 µm could have been relaxed since the alignment successfully takes care of this effect.    Figure 14. Kink angle ∆α for double-sensor modules, averaged over layers (L) and rings (R), respectively. Stereo (s) and rϕ (ϕ) modules within the same layer or ring are separated. The monitoring of standard physics references and the comparison with other subdetectors of CMS provides a direct check of the robustness of the alignment procedure and potentially indicates the presence of systematic misalignments. This information can be included in the alignment algorithm in order to better constrain the systematic misalignments, as described in section 4.4. The sensitivity to weak modes of the alignment procedure followed in this analysis is discussed in section 9.3 following the approach presented in [13,30].
9.1 Monitoring of the tracker geometry with Z → µ µ events As described in sections 4.4 and 5, muonic decays of Z bosons provide a standard reference that can be used for validating the aligned geometry. The selection of well-reconstructed Z → µ + µ − candidates requires two muons reconstructed with both the tracker and the muon system (global muons), where at least one of them passes the tight quality selections as defined in [16]. The muons must pass the following kinematic selections: • p T > 20 GeV/c, The distribution of the mass of the Z candidates is then fitted with a Voigtian function to model the reconstructed Z-boson lineshape and an exponential function to model the background. The width of the Breit-Wigner component of the Voigtian function is fixed to the decay width of the Z boson. The mass of the Z candidates is estimated with the mean of the fitted Voigtian. The reconstructed mass is slightly below the nominal mass of 91.2 GeV/c 2 , at about 90.8 GeV/c 2 , mostly because of the presence of QED final-state radiation [16]. The mass of the Z candidates is measured as a function of η and ϕ of the positively charged muon. A twist-like weak mode would bias the curvature measurement of each muon depending on its polar angle, manifesting itself as a strong dependence of the Z-boson mass on the muon pseudorapidity (with opposite signs for the two muon charges).
The result of this study is presented in figure 16 for both the 2011 data and the simulation, and the corresponding dependence of the Z-boson mass on the difference in pseudorapidity of the two muons, ∆η = η + − η − , is shown in figure 17. By using the nominal geometry, the estimated value of the Z-boson mass in the simulation is 90.8 GeV/c 2 , as expected after final-state radiation. Without using the Z-boson mass information (downward-pointing triangles), a pronounced η and ∆η dependence of the reconstructed invariant mass is observed, which extends over a range of more than 5 GeV/c 2 and is attributed to a twist weak mode as seen in section 9.2. The inclusion of the Z-boson mass information (upward-pointing triangles) removes this bias and leads to an almost flat dependence on η and ∆η.
The agreement between the data and the simulation is good. A small offset of about 100 MeV/c 2 in the simulation with respect to the data is visible. The size of any remaining bias, also as a function of the azimuthal angle, is of the order of a few per mil and thus small compared to the p T resolution targeted for muons in the typical momentum range of the Z-boson decays, which is -29 -η positive muon  Figure 16. Invariant mass of Z → µ + µ − candidates as a function of η (left) and ϕ (right) of the positively charged muon. Distributions from aligned data are shown as black upward-pointing triangles. Distributions from a simulation without misalignment and with realistic misalignment (see section 5) are presented as blue hollow circles and red hollow markers, respectively. The same distribution with the data but with a geometry produced without using the Z-boson mass information is presented with green downward-pointing triangles. at best 1% [16]. This suggests that in terms of performance the aligned geometry in data is very close to a perfectly aligned tracker, with a beneficial impact on the physics measurements of CMS. Offline corrections to the muon momentum can be applied after the reconstruction level, further improving the momentum scale and resolution of the muons [16].

Monitoring of the tracker geometry with the CMS calorimeter
The measurements of the CMS electromagnetic and hadron calorimeters can be exploited to study systematic effects in the momentum measurement. This check is valuable since it is an alternative to the Z → µ + µ − decays, which are already used in the alignment procedure. Weak modes altering the true azimuthal angle of the modules would modify the track curvature in the opposite way for positively and negatively charged tracks. If φ denotes the change of the azimuthal position at the radius r of a track due to bending in the magnetic field, the following relation holds for the reconstructed p T of the track in case of a twist-like deformation: A longitudinal magnetic field strength of 3.8 T is assumed. The ± indicates the electric charge of the particle, r[m] is the radius (measured in metres) at which the particle leaves the tracker volume, and ∆φ is the azimuthal misplacement of the hits due to the deformation. So the relative angle ∆φ is related to the asymmetry in the p T measurement of oppositely charged tracks with the same true p T and same θ . An external measurement of the energy of the charged particle, E, is provided by the ECAL and the HCAL [42]. At a given value of E/p , the average ratio between the energy and -30 -

JINST 9 P06009
pos. muon η neg. muon -η  Figure 17. Invariant mass of Z → µ + µ − candidates as a function of the η separation of the two muons. Distributions from aligned data are shown as black upward-pointing triangles. Distributions from a simulation without misalignment and with realistic misalignment are presented as blue hollow circles and red hollow markers, respectively. The same distribution from the data but with a geometry produced without using the Z-boson mass information is presented with green downward-pointing triangles. momentum of a charged track at fixed p T , ∆φ is measured as a function of the asymmetry between positively and negatively charged tracks, ( E/p − − E/p + ): which for large p T (p T 10 GeV/c) and small misalignments (∆φ 1) approximates to 3) The track sample used for the validation is selected from an input data set of events triggered by requiring a track with a total momentum p > 38 GeV/c and matched to an HCAL cluster. A charged-track isolation requirement is applied at the trigger level ensuring that no track with a transverse momentum of p T > 2 GeV/c is allowed to be in a circle with a radius of 40 cm around the impact point on the ECAL surface of the track considered. The distributions of E/p − and E/p + for particles with similar energy E are fitted with a Gaussian function. The means of the fits are used in equation (9.3) in order to measure the ∆φ for that specific bin. The results for different bins of the calorimeter energy are finally averaged. This method uses the calorimetric information only to identify tracks with the same energy, improving its robustness against miscalibrations of the absolute energy scale of the calorimeters. The dependence of ∆φ on the z-component of the impact point at the radial position r = 1 m and on the ϕ of the track is shown in figure 18   observed dependence, no significant systematic distortion in the aligned geometry is visible within the current uncertainties of the validation method. A clear improvement with respect to a geometry not exploiting the mass information is visible. A linear fit to the distributions is performed in order to quantify the bias. In the absence of the mass information in the alignment procedure, the linear fit exhibits a slope significantly different from zero, (0.351 ± 0.012) mrad/m. In the case of the baseline alignment on data, the slope is 0.002 ± 0.012 mrad/m. Slopes compatible with zero are observed also in the simulation case, both without misalignment and in the realistic misalignment scenario. A layer rotation, i.e. a systematic rotation of the layers with an amplitude proportional to the radius (∆ϕ = ρ · (r − r 0 )), would appear as a constant offset. The ϕ-dependence displays the same trend as already seen in the validation with Z → µ + µ − decays of figure 16. The trend of ∆φ is quantitatively characterised by means of a fit to the binned distribution with a sinusoidal function. The fit returns a parameterisation of [(0.036 ± 0.005) · sin(ϕ + (2.8 ± 0.2) )] mrad.

Sensitivity to systematic misalignment
Beyond the validation of the aligned geometry, the sensitivity to weak modes of the alignment procedure has been studied. Following the approach in [13,30], a set of basic deformations were applied on top of the aligned tracker geometry. The full alignment procedure was then repeated starting from the misaligned scenario, obtaining a set of "realigned" geometries. Nine systematic misalignment scenarios were studied, giving a matrix of deformations expressed with ∆r, ∆z, and ∆ϕ as a function of the same three variables. These misalignments were applied only to the directions to which the silicon modules are effectively sensitive. Movements along non-measurement directions (e.g. the longitudinal direction for strip barrel modules) are irrelevant, since the alignment procedure does not associate any parameters with them.
-32 - The ability of the alignment procedure to compensate for misalignments indicates its robustness against systematic distortions of this or similar type. A close match between the realigned and initial geometry means that the procedure is fully sensitive to this specific deformation and able to keep it under control. On the other hand, few or no changes compared to the misaligned scenario indicate poor sensitivity.
The left-hand side of figure 19 displays the difference between the positions of the modules in the initial aligned and the deliberately misaligned geometry for some benchmark misalignment scenarios. The behaviour of the distribution of the normalised χ 2 for the three stages of the study (initially aligned, misaligned and realigned) is presented in the right-hand side of figure 19, by using a sample of isolated muons. The upper, middle and bottom rows present the cases of twist, skew and sagitta deformations as introduced in section 4.4. The results show that the alignment procedure has very good control over twist-like deformations. The normalised χ 2 of the isolated muons does not change significantly when introducing the twist-like deformation because this type of tracks does not have sensitivity to it. The control over twists comes largely from the constraining power of the muonic Z-boson decays. Skew and sagitta are interesting because they are the systematic distortions most difficult to control. The skew misalignment is fully recovered in the pixel barrel, but not in the other subdetectors. The alignment procedure is only partially resilient against sagitta distortion, with the best recovery observed at small radii. The other six misalignment scenarios considered prove to be well controlled. These results represent a significant improvement with respect to [13], thanks to the inclusion of tracks from proton-proton collisions with several different topologies and the usage of vertex constraint and mass information with muons coming from Zboson decays.

Summary
The alignment procedure for the CMS tracker and its results for the first high-luminosity datataking period during the year 2011 have been presented. Among the most prominent features are the successful handling of the large degree of complexity of a highly granular silicon detector, the simultaneous determination of shape parameters at the sensor level, the use of the Z resonance signature to control systematic effects, and the parallelised implementation of the whole procedure resulting in a fast execution of the workflow.
The alignment is based on global minimisation of track-to-hit residuals. The internal alignment is performed with the MILLEPEDE II algorithm, which is enhanced compared to its predecessor to handle about 200 000 alignment parameters simultaneously. A dedicated track parameterisation is included, based on the general broken lines method, which allows rigorous and executiontime-efficient treatment of multiple scattering in the global fit. The execution time of the fit is considerably shortened by parallelisation on a multi-core architecture.
The time dependence of the tracker alignment is monitored with laser beams and tracks. The tracker geometry is found to be very stable with time. The most important movements are observed between the half-shells of the barrel pixel detector, whose longitudinal separation varies by up to 40 µm. The alignment procedure corrects for these movements such that the residual variation after alignment is kept below 10 µm.  Figure 19. Impact of intentional application of a twist (top row), sagitta (middle row) and skew systematic misalignment (bottom row). In the left columns, the red line shows the size of the applied misalignment, and the coloured dots show the difference of selected alignment parameters, module by module after realignment, to the initial values prior to misalignment. The plots in the right column show the distributions of goodnessof-fit for loosely selected isolated muons from an independent data sample, with transverse momentum p T > 5 GeV/c.
-34 - The overall tilt angles of the tracker with respect to the magnetic field are determined to be at the sub-mrad level. The statistical accuracy of the alignment is found to be generally -often significantly -better than 10 µm, with the exception of some rings in the tracker endcap disks. Sensor-and module-shape parameters are determined at the module level simultaneously with other alignment parameters. Curvatures of individual sensors and kink angles of adjacent sensors in modules are observed and measured; sensor curvature amplitudes vary according to subsystem, and their averages per layer and ring range up to about 80 µm in the endcap systems. Kink angles of up to several mrad are observed.
Besides cosmic ray tracks, reconstructed Z → µ + µ − decays play an essential role in constraining systematic deformations of the aligned geometry with small leverage to the track χ 2 , also known as weak modes. The remaining variation of the Z-boson mass peak is less than 0.5% and thus small compared to other resolution effects in the corresponding momentum range. The successful control of weak modes is confirmed by studies involving the energy measured in the hadronic calorimeter.
The stability of the alignment with respect to weak modes is further investigated by the study of the effect of deliberately added distortions and subsequent re-alignment. The procedure is found to have very good control over twist modes, while strong sagitta and skew misalignments are at least partially recovered.
In summary, this article describes the comprehensive alignment procedure for the largest and most complex silicon detector ever built. The achieved alignment accuracy enables the tracking to take full benefit of the high intrinsic resolution of the silicon modules. The quality of the alignment is thus an essential building block for the excellent physics performance of the CMS detector.