# PyHealth: A Python Library for Health Predictive Models

Yue Zhao<EMAIL_ADDRESS>
Carnegie Mellon University
Zhi Qiao*<EMAIL_ADDRESS>
Analytics Center of Excellence, IQVIA
Cao Xiao<EMAIL_ADDRESS>
Analytics Center of Excellence, IQVIA
Lucas M. Glass<EMAIL_ADDRESS>
Analytics Center of Excellence, IQVIA
Jimeng Sun<EMAIL_ADDRESS>
University of Illinois Urbana-Champaign
Y. Zhao & Z. Qiao contributed equally to this work.Work initialized while at
IQVIA.

###### Abstract

Despite the explosion of interest in healthcare AI research, the
reproducibility and benchmarking of those research works are often limited due
to the lack of standard benchmark datasets and diverse evaluation metrics. To
address this reproducibility challenge, we develop PyHealth , an open-source
Python toolbox for developing various predictive models on healthcare data.

PyHealth consists of data preprocessing module, predictive modeling module,
and evaluation module. The target users of PyHealth are both computer science
researchers and healthcare data scientists. With PyHealth , they can conduct
complex machine learning pipelines on healthcare datasets with fewer than ten
lines of code. The data preprocessing module enables the transformation of
complex healthcare datasets such as longitudinal electronic health records,
medical images, continuous signals (e.g., electrocardiogram), and clinical
notes into machine learning friendly formats. The predictive modeling module
provides more than 30 machine learning models, including established ensemble
trees and deep neural network-based approaches, via a unified but extendable
API designed for both researchers and practitioners. The evaluation module
provides various evaluation strategies (e.g., cross-validation and train-
validation-test split) and predictive model metrics.

With robustness and scalability in mind, best practices such as unit testing,
continuous integration, code coverage, and interactive examples are introduced
in the library’s development. PyHealth can be installed through the Python
Package Index (PyPI) or https://github.com/yzhao062/PyHealth.

Keywords: healthcare, deep learning, neural networks, machine learning, Python

##  1 Introduction

With the advances of machine learning technologies and the tremendous
improvements in digital healthcare systems, digitized healthcare data have
demonstrated initial success in enhancing health decision making and
healthcare delivery (Xiao et al., 2018). However, health data are usually
noisy, complex, and have heterogeneous forms, yielding a wide range of
healthcare modeling tasks. For example, health risk prediction based on
sequential patient data (Gao et al., 2020a), medical image-based disease
diagnosis (Qiao et al., 2020), risk detection based on continuous
physiological signals. e.g., electroencephalogram (EEG) or electrocardiogram
(ECG) and multimodal clinical notes (e.g., text and images). The complexity
and heterogeneity of health data and tasks lead to the long overdue of a
dedicated ML system for benchmarking predictive health models despite their
high value in healthcare research and clinical decision making.

Several efforts have been made to help approach these problems, including
releasing benchmark urgent care datasets MIMIC-III (Harutyunyan et al., 2019),
streamlining the analytic pipeline (Miller et al., 2017). However, a dedicated
toolkit for predictive health is absent. To fill the gap, we design and
implement PyHealth —a comprehensive Python library that provides a full-stack
machine learning toolkit for predictive health tasks, including data
preprocessing training and prediction, and result evaluation.

PyHealth has five distinct advantages. First, it encapsulates more than 30
state-of-the-art predictive health algorithms, including both classical
techniques such as XGBoost (Chen and Guestrin, 2016) and recent deep learning
architectures such as autoencoders, convolution based, and adversarial based
models (see Table 1). Second, PyHealth has a wide coverage and contains models
for different data types, e.g., sequence data, image data, physiological
signal data, and unstructured text data. Third, PyHealth includes a unified
API, detailed documentation, and interactive examples across all algorithms
for clarity and ease of use—executing complex deep learning models needs fewer
than ten lines of code. Fourth, most models in PyHealth are covered by unit
testing with cross-platform, continuous integration, code coverage, and code
maintainability checks. Last, parallelization is enabled in select modules
(data preprocessing) for efficiency and scalability, along with fast GPU
computation for deel learning models through PyTorch.

Table 1: More than 30 Healthcare AI Models are implemented in PyHealth 0.0.6

Method | Sequence | Image | Signal | Text | Deep Learning
---|---|---|---|---|---
RandomForest (Breiman, 2001) | ✓ | ✓ | ✓ | ✓ | ✗
XGBoost (Chen and Guestrin, 2016) | ✓ | ✓ | ✓ | ✓ | ✗
BasicCNN (Lawrence et al., 1997) | ✗ | ✓ | ✓ | ✓ | ✓
LSTM (Hochreiter and Schmidhuber, 1997) | ✓ | ✗ | ✗ | ✗ | ✓
GRU (Cho et al., 2014) | ✓ | ✗ | ✗ | ✗ | ✓
RETAIN (Choi et al., 2016) | ✓ | ✗ | ✗ | ✗ | ✓
Dipole (Ma et al., 2017) | ✓ | ✗ | ✗ | ✗ | ✓
tLSTM (Baytas et al., 2017) | ✓ | ✗ | ✗ | ✗ | ✓
RAIM (Xu et al., 2018) | ✓ | ✗ | ✗ | ✗ | ✓
StageNet (Gao et al., 2020b) | ✓ | ✗ | ✗ | ✗ | ✓
Vggnet (Simonyan and Zisserman, 2014) | ✗ | ✓ | ✗ | ✗ | ✓
Inception (Szegedy et al., 2016) | ✗ | ✓ | ✗ | ✗ | ✓
Resnet (He et al., 2016) | ✗ | ✓ | ✗ | ✗ | ✓
Resnext(Xie et al., 2016) | ✗ | ✓ | ✗ | ✗ | ✓
Densenet (Huang et al., 2017) | ✗ | ✓ | ✗ | ✗ | ✓
Mobilenet (Howard et al., 2017) | ✗ | ✓ | ✗ | ✗ | ✓
DBLSTM-WS (Özal Yildirim, 2018) | ✗ | ✗ | ✓ | ✗ | ✓
DenseConv (Parvaneh et al., 2018) | ✗ | ✗ | ✓ | ✗ | ✓
DeepRes1D (Li et al., 2020) | ✗ | ✗ | ✓ | ✗ | ✓
Autoencoder+BiLSTM (Wang et al., 2019) | ✗ | ✗ | ✓ | ✗ | ✓
KRCRnet (Zhou et al., 2019) | ✗ | ✗ | ✓ | ✗ | ✓
MINA (Hong et al., 2019) | ✗ | ✗ | ✓ | ✗ | ✓
Bidirectional-GRU (Cho et al., 2014) | ✗ | ✗ | ✗ | ✓ | ✓
DR-CAML (Mullenbach et al., 2018) | ✗ | ✗ | ✗ | ✓ | ✓
DCAN (Ji et al., 2020) | ✗ | ✗ | ✗ | ✓ | ✓
JointLAAT (Vu et al., 2020) | ✗ | ✗ | ✗ | ✓ | ✓
MultiResCNN (Li and Yu, 2020) | ✗ | ✗ | ✗ | ✓ | ✓

##  2 Library Design and Implementation

PyHealth is designed for Python 3 and relies on numpy, scipy, scikit-learn and
PyTorch. As shown in Fig. 1, PyHealth comes with three major modules: (i) data
preprocessing module can take user input and validate and convert the input
data into the format that learning models can easily handle; (ii) predictive
modeling module comprises a suite of models that are grouped by input data
type into sequences, image, EEG, and text. For each data type, a group of
dedicated learning models are implemented to be easily used, and (iii)
evaluation module can infer the task type automatically, e.g., multi-
classification, and conduct the comprehensive evaluation by task type.

Inspired by scikit-learn’s API design and general deep learning design, most
learning models inherit from the corresponding base class with the same
interface: (i) fit processes the train data and validation data to learn the
weights and save necessary statistics; (ii) load_model selects the model with
the highest validation accuracy and (iii) inference takes in incoming test
data and make a prediction on it. A short demo of using these APIs is
presented below. Other tasks follow a similar API.

⬇

>>> from pyhealth.models.sequence.lstm import LSTM

>>> from pyhealth.evaluation.evaluator import func

>>> current_data = expdata_generator(exp_id=exp_id) # initialize dataset

>>> current_data.get_exp_data(sel_task="mortality")

>>> current_data.load_exp_data()

>>> model = LSTM(expmodel_id=expmodel_id, n_batchsize=20, use_gpu=True,
n_epoch=100) # initialize LSTM model and set hyperparameters

>>> model.fit(current_data.train, current_data.valid)

>>> model.inference(current_data.test) # inference on test data

>>> prediction_results = model.get_results() # retrieve the test results

>>> evaluation = func(prediction_results["hat_y"], prediction_results["y"])

Code Snippet 1: Demo of PyHealth API with Mortality Prediction

Within the framework, a set of helper and utility functions (check_parameter,
label_check, and partition_estimators) are included in the library for quick
data and model exploration. For instance, label_check can automatically check
the data label and infer the task type, e.g., binary classification and multi-
classification.

Figure 1: PyHealth contains three modules to support various healthcare
Predictive tasks

##  3 Project Focus

Build robustness. We leverage continuous integration (e.g., Travis CI, and
CircleCI) to conduct automated testing under various operating systems and
Python versions.
Community-based development and project relevance. PyHealth ’s code repository
is hosted on GitHub111https://github.com/yzhao062/PyHealth to facilitate
collaboration. By the submission time, more than five people have contributed
to the development and bug fix. PyHealth has been used in various commercial
projects at IQVIA, a leading healthcare research institute; researchers at the
University of Illinois Urbana-Champaign and Carnegie Mellon University are
actively using the library for algorithm design and benchmark.
Documentation and examples. Comprehensive documentation is developed using
sphinx and numpydoc and rendered using Read the
Docs222https://pyhealth.readthedocs.io/. It includes detailed API references,
an installation guide, code examples, and algorithm benchmarks.

##  4 Conclusion and Future Plans

This paper presents PyHealth , a comprehensive toolbox built-in Python for
healthcare AI, with more than 30 classical and emerging learning models. A few
future directions have been designed. First, we will enhance the library with
specialized models for multimodal data. Second, the support of more different
types of standard healthcare data formats will be provided. Additionally, we
also plan to use PyHealth to generate a large-scale benchmark for healthcare
predictive tasks.

## References

  * Baytas et al. (2017) Inci M Baytas, Cao Xiao, Xi Zhang, Fei Wang, Anil K Jain, and Jiayu Zhou.  Patient subtyping via time-aware lstm networks.  In _Proceedings of the 23rd ACM SIGKDD international conference on knowledge discovery and data mining_ , pages 65–74, 2017.
  * Breiman (2001) Leo Breiman.  Random forests.  _Machine learning_ , 45(1):5–32, 2001.
  * Chen and Guestrin (2016) Tianqi Chen and Carlos Guestrin.  Xgboost: A scalable tree boosting system.  In _Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining_ , pages 785–794, 2016.
  * Cho et al. (2014) Kyunghyun Cho, Bart Van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio.  Learning phrase representations using rnn encoder-decoder for statistical machine translation.  _arXiv preprint arXiv:1406.1078_ , 2014.
  * Choi et al. (2016) Edward Choi, Mohammad Taha Bahadori, Jimeng Sun, Joshua Kulas, Andy Schuetz, and Walter Stewart.  Retain: An interpretable predictive model for healthcare using reverse time attention mechanism.  In _Advances in Neural Information Processing Systems_ , pages 3504–3512, 2016.
  * Gao et al. (2020a) Junyi Gao, Cao Xiao, Lucas M Glass, and Jimeng Sun.  Dr. Agent: Clinical predictive model via mimicked second opinions.  _Journal of the American Medical Informatics Association_ , 27(7):1084–1091, 06 2020a.  ISSN 1527-974X.  doi: 10.1093/jamia/ocaa074.
  * Gao et al. (2020b) Junyi Gao, Cao Xiao, Yasha Wang, Wen Tang, Lucas M Glass, and Jimeng Sun.  Stagenet: Stage-aware neural networks for health risk prediction.  In _Proceedings of The Web Conference 2020_ , pages 530–540, 2020b.
  * Harutyunyan et al. (2019) Hrayr Harutyunyan, Hrant Khachatrian, David C Kale, Greg Ver Steeg, and Aram Galstyan.  Multitask learning and benchmarking with clinical time series data.  _Scientific data_ , 6(1):1–18, 2019.
  * He et al. (2016) K. He, X. Zhang, S. Ren, and J. Sun.  Deep residual learning for image recognition.  In _2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)_ , pages 770–778, 2016.  doi: 10.1109/CVPR.2016.90.
  * Hochreiter and Schmidhuber (1997) Sepp Hochreiter and Jürgen Schmidhuber.  Long short-term memory.  _Neural computation_ , 9(8):1735–1780, 1997.
  * Hong et al. (2019) Shenda Hong, Cao Xiao, Tengfei Ma, Hongyan Li, and Jimeng Sun.  MINA: multilevel knowledge-guided attention for modeling electrocardiography signals.  In _IJCAI_ , pages 5888–5894, 2019.
  * Howard et al. (2017) Andrew Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam.  Mobilenets: Efficient convolutional neural networks for mobile vision applications.  04 2017.
  * Huang et al. (2017) G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger.  Densely connected convolutional networks.  In _2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)_ , pages 2261–2269, 2017.  doi: 10.1109/CVPR.2017.243.
  * Ji et al. (2020) Shaoxiong Ji, Erik Cambria, and Pekka Marttinen.  Dilated convolutional attention network for medical code assignment from clinical text.  In _3rd Clinical Natural Language Processing Workshop at EMNLP_ , 2020\.
  * Lawrence et al. (1997) S. Lawrence, C. L. Giles, Ah Chung Tsoi, and A. D. Back.  Face recognition: a convolutional neural-network approach.  _IEEE Transactions on Neural Networks_ , 8(1):98–113, 1997.  doi: 10.1109/72.554195.
  * Li and Yu (2020) Fei Li and Hong Yu.  Icd coding from clinical text using multi-filter residual convolutional neural network.  In _Proceedings of the Thirty-Fourth AAAI Conference on Artificial Intelligence_ , 2020.
  * Li et al. (2020) Zhi Li, Dengshi Zhou, Li Wan, Jian Li, and Wenfeng Mou.  Heartbeat classification using deep residual convolutional neural network from 2-lead electrocardiogram.  _Journal of Electrocardiology_ , 58, 11 2020.  doi: 10.1016/j.jelectrocard.2019.11.046.
  * Ma et al. (2017) Fenglong Ma, Radha Chitta, Jing Zhou, Quanzeng You, Tong Sun, and Jing Gao.  Dipole: Diagnosis prediction in healthcare via attention-based bidirectional recurrent neural networks.  In _Proceedings of the 23rd ACM SIGKDD international conference on knowledge discovery and data mining_ , pages 1903–1911, 2017.
  * Miller et al. (2017) Taylor Miller, Michael Mastanduno, Levi Thatcher, and Taylor Larsen.  healthcareai-py v1.0, August 2017.  URL https://doi.org/10.5281/zenodo.999013.  https://github.com/HealthCatalyst/healthcareai- py/releases/tag/v1.0.
  * Mullenbach et al. (2018) James Mullenbach, Sarah Wiegreffe, Jon Duke, Jimeng Sun, and Jacob Eisenstein.  Explainable prediction of medical codes from clinical text.  pages 1101–1111. Association for Computational Linguistics, June 2018\.  doi: 10.18653/v1/N18-1100.
  * Parvaneh et al. (2018) Saman Parvaneh, Jonathan Rubin, Asif Rahman, Bryan Conroy, and Saeed Babaeizadeh.  Analyzing single-lead short ECG recordings using dense convolutional neural networks and feature-based post-processing to detect atrial fibrillation.  volume 39, page 084003, aug 2018.
  * Qiao et al. (2020) Zhi Qiao, Austin Bae, Lucas M Glass, Cao Xiao, and Jimeng Sun.  FLANNEL: Focal Loss Based Neural Network Ensemble for COVID-19 Detection.  _Journal of the American Medical Informatics Association_ , 10 2020\.  ISSN 1527-974X.  doi: 10.1093/jamia/ocaa280.  URL https://doi.org/10.1093/jamia/ocaa280.  ocaa280.
  * Simonyan and Zisserman (2014) Karen Simonyan and Andrew Zisserman.  Very deep convolutional networks for large-scale image recognition.  _arXiv 1409.1556_ , 09 2014.
  * Szegedy et al. (2016) Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and ZB Wojna.  Rethinking the inception architecture for computer vision.  06 2016.  doi: 10.1109/CVPR.2016.308.
  * Vu et al. (2020) Thanh Vu, Dat Quoc Nguyen, and Anthony Nguyen.  A label attention model for icd coding from clinical text.  In Christian Bessiere, editor, _Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI-20_ , pages 3335–3341, 7 2020.  doi: 10.24963/ijcai.2020/461.
  * Wang et al. (2019) E. K. Wang, X. Zhang, and L. Pan.  Automatic classification of cad ecg signals with sdae and bidirectional long short-term network.  _IEEE Access_ , 7:182873–182880, 2019.  doi: 10.1109/ACCESS.2019.2936525.
  * Xiao et al. (2018) Cao Xiao, Edward Choi, and Jimeng Sun.  Opportunities and challenges in developing deep learning models using electronic health records data: a systematic review.  _Journal of the American Medical Informatics_ , 2018.
  * Xie et al. (2016) Saining Xie, Ross B. Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He.  Aggregated residual transformations for deep neural networks.  _CoRR_ , abs/1611.05431, 2016.  URL http://arxiv.org/abs/1611.05431.
  * Xu et al. (2018) Yanbo Xu, Siddharth Biswal, Shriprasad R Deshpande, Kevin O Maher, and Jimeng Sun.  Raim: Recurrent attentive and intensive model of multimodal patient monitoring data.  In _Proceedings of the 24th ACM SIGKDD international conference on Knowledge Discovery & Data Mining_, pages 2565–2573, 2018.
  * Zhou et al. (2019) Yuxi Zhou, Shenda Hong, Junyuan Shang, Meng Wu, Qingyun Wang, Hongyan Li, and Junqing Xie.  K-margin-based residual-convolution-recurrent neural network for atrial fibrillation detection.  pages 6057–6063, 08 2019.  doi: 10.24963/ijcai.2019/839.
  * Özal Yildirim (2018) Özal Yildirim.  A novel wavelet sequence based on deep bidirectional lstm network model for ecg signal classification.  _Computers in Biology and Medicine_ , 96:189 – 202, 2018\.  ISSN 0010-4825.  doi: https://doi.org/10.1016/j.compbiomed.2018.03.016.


EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH (CERN)

 CERN-LHCb-DP-2017-001

Improved performance

of the LHCb Outer Tracker

in LHC Run 2

The LHCb Outer Tracker group

Ph. d’Argent1, L. Dufour2, L. Grillo7, J.A. de Vries2, A. Ukleja6, R. Aaij8,
F. Archilli2, S. Bachmann1, D. Berninghoff1, A. Birnkraut3, J.
Blouw922footnotemark: 2, M. De Cian1, G. Ciezarek2, Ch. Färber1, M. Demmer3,
F. Dettori4, E. Gersabeck1, J. Grabowski1, W.D. Hulsbergen2, B. Khanji1, M.
Kolpin1, M. Kucharczyk5, B.P. Malecki5, M. Merk2, M. Mulder2, J. Müller3, V.
Mueller3, A. Pellegrino2, M. Pikies5, B. Rachwal11, T. Schmelzer3, B. Spaan3,
M. Szczekowski6, J. van Tilburg2, S. Tolk10, N. Tuning2, U. Uwer1, J.
Wishahi3, M. Witek5,

1Physikalisches Institut, Heidelberg, Germany
2Nikhef, Amsterdam, The Netherlands
3Technische Universität Dortmund, Germany
4Oliver Lodge Laboratory, University of Liverpool, Liverpool, United Kingdom
5H. Niewodniczanski Institute of Nuclear Physics, Cracow, Poland
6National Center for Nuclear Research (NCBJ), Warsaw, Poland
7Bicocca University, Milano, Italy
8European Organization for Nuclear Research (CERN), Geneva, Switzerland
9Max Planck-Institut Für Kernphysik (MPIK), Heidelberg, Germany
10Cavendish Laboratory, University of Cambridge, Cambridge, United Kingdom
11AGH - University of Science and Technology, Faculty of Physics and Applied
Computer Science, Krakow, Poland
22footnotemark: 2 Deceased

The LHCb Outer Tracker is a gaseous detector covering an area of $5\times
6\mathrm{\,m}^{2}$ with 12 double layers of straw tubes. The performance of
the detector is presented based on data of the LHC Run 2 running period from
2015 and 2016. Occupancies and operational experience for data collected in
$pp$, $p{\rm Pb}$ and ${\rm PbPb}$ collisions are described. An updated study
of the ageing effects is presented showing no signs of gain deterioration or
other radiation damage effects. In addition several improvements with respect
to LHC Run 1 data taking are introduced. A novel real-time calibration of the
time-alignment of the detector and the alignment of the single monolayers
composing detector modules are presented, improving the drift-time and
position resolution of the detector by 20%. Finally, a potential use of the
improved resolution for the timing of charged tracks is described, showing the
possibility to identify low-momentum hadrons with their time-of-flight.

Published in JINST 12 (2017) no.11, P11016

© CERN on behalf of the LHCb collaboration, licence CC-BY-4.0.

###### Contents

  1. 1 Introduction
  2. I Operational experience
    1. 2 Event occupancies in proton and lead collisions
      1. 2.1 Performance in Run 2 $pp$ collisions
      2. 2.2 Occupancies and hits from previous bunch crossings
      3. 2.3 Hit asymmetries for both magnet polarities
      4. 2.4 Hit multiplicities in lead-lead and proton-lead collisions
    2. 3 Mechanical stability
      1. 3.1 Long term stability of C-frames positions
      2. 3.2 Effects of opening and closing C-frames
      3. 3.3 Monitoring of the bridge position
    3. 4 Radiation resistance
  3. II Improved calibration and results
    1. 5 Real-time global drift time calibration
      1. 5.1 Method
      2. 5.2 Performance and monitoring
    2. 6 Offline per-module calibration
      1. 6.1 Module and monolayer spatial alignment
      2. 6.2 FE-module $t_{0}$ calibration
    3. 7 Updated drift-time distance relation and improved resolution
      1. 7.1 TR-relation
      2. 7.2 Resolution
    4. 8 Use of time information
      1. 8.1 Time-stamp for single tracks
      2. 8.2 Time-of-flight for pions and protons
      3. 8.3 Time-stamp of primary vertices
    5. 9 Conclusions
    6. Acknowledgements

###  1 Introduction

The LHCb experiment is dedicated to the study of $C\\!P$ violation and rare
decays of hadrons with $b$ and $c$ quarks at the Large Hadron Collider. The
LHCb detector [1] is a single arm forward spectrometer, with an acceptance in
the pseudorapidity range $2<\eta<5$. The tracking system of the detector is
composed of a silicon-strip vertex detector, close to the proton-proton
interaction region, and five tracking stations: two upstream and three
downstream of a dipole magnet with bending power of around 4 Tm. The upstream
tracking stations and the inner part of the downstream ones are composed of
silicon-strip detectors. The outer part of the downstream stations is covered
by the Outer Tracker (OT) [2], a straw-tube gaseous detector. The single hit
resolution in the OT leads to a momentum resolution of $\delta p/p\approx
0.4\%$, providing a superior mass resolution of reconstructed charm and bottom
decays.

The OT covers an area of about $5\times 6\mathrm{\,m}^{2}$ starting from a
minimum distance of about 10 cm from the beam direction. The cross-shaped
inner region not covered by the OT, $|y|<10\mathrm{\,cm}$ for
$|x|<59.7\mathrm{\,cm}$, and $|y|<20\mathrm{\,cm}$ for
$|x|<25.6\mathrm{\,cm}$, is instrumented with silicon strip detectors
[1].111The LHCb coordinate system is a right-handed coordinate system, with
the z axis pointing along the beam axis, y the vertical direction, and x the
horizontal direction. The (x, z) plane is the bending plane of the dipole
magnet. Each straw tube measures the drift time of charges created by the
ionising particles, and collected on the anode wire. The straw tubes are
$2.4\mathrm{\,m}$ long with $4.9\mathrm{\,mm}$ inner diameter. The anode wire
at the straw centre is set to +1550 V and is made of $25{\,\upmu\mathrm{m}}$
thick gold plated tungsten. The cathode consists of a $40{\,\upmu\mathrm{m}}$
thick inner foil of electrically conducting carbon doped Kapton-XC 222Kapton®
is a polyimide film developed by DuPont. and a $25{\,\upmu\mathrm{m}}$ thick
outer foil, consisting of Kapton-XC laminated together with a
$12.5{\,\upmu\mathrm{m}}$ thick layer of aluminium. The straws are arranged in
modules in two staggered layers glued to sandwich panels, using Araldite
AY103-1.333Araldite® is a two component epoxy resin developed by Huntsman. Two
panels are sealed with $400{\,\upmu\mathrm{m}}$ thick carbon fibre sidewalls,
resulting in a gas-tight box enclosing a stand-alone detector module. The
straws are filled with a gas mixture of Ar/CO2/O2 (70/28.5/1.5) which
guarantees a fast drift time below $50{\mathrm{\,ns}}$. The gas in input to
the modules has an overpressure of 2.5 mbar. The modules are composed of two
staggered layers (monolayers) of 64 drift tubes each. A cross-section of the
module layout is shown in figure 1(a).

(a)(b) Figure 1: (a) OT module cross section, with distances in mm. (b)
Arrangement of OT straw-tube modules in layers and stations.

Two types of modules are used: type $F$ modules, which have an active length
of 4850 mm, have monolayers split in the middle into two independent readout
sections read out from the outer ends; type $S$ modules have about half the
length of $F$-type modules, they are mounted above and below the beampipe, and
are read out from the outer module end. One detector layer is built from 14
long and 8 short modules, see figure 1(b). The complete OT detector consists
of 168 long and 96 short modules and comprises 53,760 single straw-tube
channels.

The detector modules are arranged in three stations. Each station consists of
four module layers, arranged in an x-u-v-x geometry: the modules in the
$x$-layers are oriented vertically, whereas those in the $u$ and $v$ layers
are tilted by $+5^{o}$ and $-5^{o}$ with respect to the vertical,
respectively. This leads to a total of 24 straw layers positioned along the
$z$-axis.

Each station is split into two halves, retractable on both sides of the beam
line. Each half consists of two independently movable units, known as
C-frames, see figure 1(b). The modules are positioned on the C-frames by means
of precision dowel pins. The C-frames also provide routing for all detector
services (gas, low and high voltage, cooling water, data fibres, slow and fast
control). The C-frames are sustained by a stainless steel structure (called
“bridge”), equipped with rails allowing the independent movement of all twelve
C-frames. The bridge is mounted on a concrete structure (called “table”).

The front-end (FE) electronics measures the arrival times of the ionization
clusters produced by charged particles traversing the straw-tubes with respect
to the beam crossing (BX) signal [3]. The signals are amplified and
subsequently discriminated against a threshold value. This value is set as low
as possible to minimize the effect of time-walk on the drift time resolution,
and at the same time to keep the number of noise hits at an acceptable level.
The measured arrival times are then digitized for each 25 ns (the LHC design
value for the minimum bunch crossing interval) and stored in a digital
pipeline to await the lowest-level trigger (L0) decision. This TDC value is
given in units of 0.4 ns, as the 25 ns window is encoded with 6 bits. On a
positive L0 decision, the digitized data of the triggered bunch crossing and
of the following two bunch crossings (for a total window of 75 ns) are
transmitted via optical links to TELL1 boards in the LHCb DAQ system [4].

The performance of the OT as studied in detail during Run 1 of LHC (data-
taking years 2009-2012) can be found in Ref. [5], together with additional
details of the apparatus.

Thanks to improvements on the LHC magnets during the Long Shutdown 1 (LS1)
period in 2013 and 2014, the LHC provided collisions at a higher centre-of-
mass energy of $13\mathrm{\,Te\kern-1.00006ptV}$ in Run 2 (versus 7 and
$8\mathrm{\,Te\kern-1.00006ptV}$ in Run 1) and proton bunches with a time
spacing of $25{\mathrm{\,ns}}$ instead of $50{\mathrm{\,ns}}$. While these
conditions are closer to the design values, they are novel, challenging
circumstances, motivating the documentation of the performance of the detector
in this paper.

This paper describes the detector performance and improvements in the LHC Run
2 period with data collected in 2015 and 2016. In the first part, the
performance with proton-proton ($pp$) and lead-lead (${\rm PbPb}$) collisions
are discussed in section 2. In section 3 a study is presented of the
mechanical stability of the OT obtained through a hardware alignment system
(called “RASNIK”). In section 4 an updated study of the ageing of the detector
is reported.

Furthermore several improvements to the OT were carried out during LS1 and are
presented in the second part. Owing to an improved online event filter farm,
the two levels of the LHCb High Level Trigger (HLT) were split in two stages,
allowing for a full real-time alignment and calibration of the whole detector
used by the second stage of the online event selection [6]. In section 5 a
novel real-time calibration of the global time alignment of the OT with
respect to the LHC clock is presented, while in section 6 the single front-end
alignment and calibration is discussed. An updated calibration of the distance
drift-time relation is reported in section 7. The drift-time measurement
capabilities of the OT have been used to measure the time of flight of tracks,
which can be exploited for particle identification and for primary interaction
vertex assignment and distinction. This method was developed and used for the
first time in Run 2, and is presented in section 8 together with its
performance.

##  Part I Operational experience

The monitoring and evaluation of the detector performance is crucial to
maintain the same quality data needed for the physics measurements as in Run
1. In this first part of the paper, the performance and stability of the
detector operation is presented, together with studies on possible radiation
damage due to the received dose.

###  2 Event occupancies in proton and lead collisions

####  2.1 Performance in Run 2 $pp$ collisions

The performance of the Outer Tracker in Run 1 exceeded expectations in terms
of low number of dead and noisy channels, single hit resolution, and tracking
performance, and has been extensively described elsewhere [5].

\begin{overpic}[width=212.47617pt,trim=42.67912pt 28.45274pt 42.67912pt
28.45274pt,clip]{figs/occupancy-run1-vs-run2.pdf}
\put(70.0,52.0){\scalebox{0.8}{ LHCb OT }} \put(70.0,47.0){\scalebox{0.8}{ (a)
}}
\put(72.0,41.0){\line(1,0){0.2}}\put(72.5,41.0){\line(1,0){0.2}}\put(73.0,41.0){\line(1,0){0.2}}\put(73.5,41.0){\line(1,0){0.2}}\put(74.0,41.0){\line(1,0){0.2}}\put(74.5,41.0){\line(1,0){0.2}}
\put(76.0,40.0){\scalebox{0.7}{Run 1}}
\put(72.0,37.0){\line(1,0){0.5}}\put(72.5,37.0){\line(1,0){0.5}}\put(73.0,37.0){\line(1,0){0.5}}\put(73.5,37.0){\line(1,0){0.5}}\put(74.0,37.0){\line(1,0){0.5}}\put(74.5,37.0){\line(1,0){0.5}}
\put(76.0,36.0){\scalebox{0.7}{Run 2}}
\end{overpic}\begin{overpic}[width=212.47617pt]{figs/noise.pdf}
\put(62.0,48.0){\scalebox{0.8}{ (b) }} \end{overpic}

Figure 2: (a) Event occupancy for the OT in Run 1 (dottet line) and Run 2
(solid line). The event occupancy in the OT is on average 13% in Run 2. (b)
Occupancy of noise hits as a function of the discriminator threshold.

The larger center-of-mass energy and the increased spill-over due to the 25 ns
bunch spacing lead to a larger OT occupancy. In order to keep the OT event
multiplicity at a similar level with respect to Run 1, to maintain the same
performance of the track reconstruction, the average number of overlapping
events per bunch crossing was reduced from $\mu=1.7$ in Run 1, to $\mu=1.1$ in
Run 2. The resulting distributions of the OT event occupancies are compared in
figure 2(a). Due to the fact that the event occupancy in Run 2 is the result
of adding the occupancies of multiple bunch crossings, the final event
occupancy has a smaller spread. In 2017 the OT hit occupancy was further
reduced by limiting the number of spill-over hits from the previous bunch
crossing (see section 2.2).

The fraction of noise hits that contribute to the event occupancy is
negligible. With the nominal discriminator threshold of 800 mV, about 30 noise
hits are expected every event, as shown in figure 2(b). As far as dead
channels are concerned, only 8 out of a total of 53760 straws do not give any
signal, as they had to be disconnected to avoid large currents due to short-
circuits.

####  2.2 Occupancies and hits from previous bunch crossings

The OT readout window contains three consecutive bunch crossings of 25 ns upon
each L0 trigger, to ensure that late hits with long drift-times are also
recorded. Similarly, late hits from the previous bunch crossing will be
recorded in the OT as early hits from the triggered bunch crossing. These so-
called spill-over hits hamper the track reconstruction, enlarging the fraction
of fake tracks. In addition, these hits from the previous spill consume
bandwidth in the data transmission.

\begin{overpic}[width=212.47617pt]{figs/prevET/occupancy_vs_prevet_profile.pdf}
\put(26.0,45.0){(a)}
\end{overpic}\begin{overpic}[width=212.47617pt]{figs/prevET/sumetprevspectrum.pdf}
\put(68.0,47.0){(b)} \end{overpic}

Figure 3:  (a) The average number of recorded hits as a function of the
activity in the previous bunch crossing, expressed as the scalar sum of
transverse energy in all calorimeter clusters, $\Sigma E_{T}$. (b) The
distribution of $\Sigma E_{T}$ for unbiased events, where one unit corresponds
to 24 MeV.

The scalar sum of the transverse energy of all hadronic calorimeter clusters
of the previous bunch crossing, $\Sigma E_{T}^{\rm{Prev}}$, is available in
the L0 trigger decision unit. To quantify the influence of spill-over on the
tracker’s performance, the occupancy and drift times of no-bias events are
analysed in bins of the scalar sum of transverse energy of all hadronic
calorimeter clusters in the previous bunch crossing. The average number of
hits recorded as a function of $\Sigma E_{T}^{\rm{Prev}}$ is shown in figure
3(a). It can be seen that the occupancy in the OT is double for events with a
very busy previous event, $\Sigma E_{T}^{\rm{Prev}}\approx
2000(=48\mathrm{\,Ge\kern-1.00006ptV})$.

This feature will be used in 2017 by selecting events with $\Sigma
E_{T}^{\rm{Prev}}<1000(=24\mathrm{\,Ge\kern-1.00006ptV})$, which rejects 7.2%
of the events (figure 3(b)). This does not bias the topology of the physical
event because the event multiplicity in the calorimeter is not correlated
between consecutive bunch crossings. The effect on the drift time spectrum is
illustrated in figure 4(a). As expected the largest effect of this cut is on
the number of (fake) early hits, which contain a large fraction of spill-over
hits from the previous bunch crossing. This is shown in figure 4(b) where the
difference in TDC spectra before and after the cut is shown, normalized to the
spectrum at TDC=150.

In addition to the early spill-over hits, also late hits from the current
event are rejected, because the whole event is vetoed. These events can
statistically be recovered with a looser threshold on the transverse energy of
L0 hadron clusters. Effectively, the cut of events with a busy previous event
will reduce the average OT event occupancy, less affected by spill-over
contamination, allowing to increase the data-taking rate and speeding up the
reconstruction processing time.

(a)(b)

Figure 4:  The recorded drift time spectrum for all hits in the Outer Tracker
for no-bias events with $25{\mathrm{\,ns}}$ bunch spacing. (a) in blue, the
same spectrum recorded while keeping only events with $\Sigma E_{T}(Prev)\leq
1000$. (b) the difference of the two TDC spectra, scaled such the difference
is 0 at the $TDC=150$ bin.

####  2.3 Hit asymmetries for both magnet polarities

The LHCb experiment is specialised in the study of $C\\!P$ asymmetries, and a
crucial ingredient in these analyses are asymmetries in the detection of
charged particles. To limit the impact from possible detector biases, the
magnet polarity is regularly flipped during data taking.

From simulations it is known that more electrons than positrons are produced
in secondary interactions with the detector material. The electrons are
deflected in the so-called “down” polarity towards the negative $x$-direction
(which corresponds to the so-called C-side in LHCb), and vice-versa for “up”
polarity. This explains the asymmetric hit distribution in figure 5.

Figure 5:  The hit distribution is shown for both magnet polarities, using
30,000 random events for both samples, without any trigger requirement. The
vertical dashed line indicates the mechanical split between the two detector
halves, at $x=-8$ cm.

The two detector halves are not of equal width, and the split between the two
halves is at $x=-8$ cm. As a result, the smaller width of the C-side registers
less hits, which is compensated by the hits from the deflected negatively
charged particles in the “down” polarity, leading to only 1.6% less hits in
the C-side than in the A-side. For the “up” polarity, the A-side registers
14.7% more hits than the C-side. The total number of hits, averaged for the
two polarities, is equal for $x<0$ compared to $x>0$ within $0.4\%$.

####  2.4 Hit multiplicities in lead-lead and proton-lead collisions

The LHCb experiment has expanded its heavy-ion physics programme in Run 2, by
recording ${\rm PbPb}$ collisions data in December 2015, and $p{\rm Pb}$ and
${\rm Pb}p$ collisions data in November 2016. The relatively large OT straw
diameter of $4.9\mathrm{\,mm}$ leads to a very large straw occupancy in ${\rm
PbPb}$ collisions, preventing to reconstruct tracks of ${\rm PbPb}$ collisions
at the largest centrality. The offline analysis is limited by the high
occupancy in the whole LHCb detector to an event centrality smaller than
$60\%$.

The OT occupancy for ${\rm PbPb}$ events is shown in figure 6, compared to the
occupancy in nominal $pp$ collisions, with an average pile-up of $\mu=1.1$.
The occupancy in $p$Pb and Pb$p$ collisions is also given, showing a slightly
larger occupancy for the situation where the lead-ions are circulating in
beam-1, i.e. in the direction of the LHCb spectrometer.

(a)(b)

Figure 6:  The average number of recorded hits (a) in minimum bias proton-
proton and ${\rm PbPb}$ collisions and (b) $p{\rm Pb}$ and ${\rm Pb}p$
collisions.

###  3 Mechanical stability

An alignment system was constructed to monitor the relative movements of the
OT detector frames. The main purpose of the system is to confirm the
mechanical stability of the detector. Any unforeseen movements of the detector
components are monitored and can be used to confirm, or used as constraint
for, the alignment procedure with reconstructed charged particle tracks [7,
8].

The system used for this purpose is called the Relative Alignment System of
NIKHEF (RASNIK) [9, *Rasnik-2001-004, *Rasnik-2002-016]. A finely detailed
image is projected through a lens onto a CCD camera. The light source is a
$3\times 3$ grid of infrared-emitting LEDs. These LEDs illuminate a coded
mask. The mask consists of black-and-white squares in a chessboard-like
pattern. The coded non-repeating pattern is used to obtain a unique position.
The movement of the lens by a distance $d$ in a direction perpendicular to the
axis defined by the mask and the CCD camera causes a displacement of the image
of the mask by a distance $2d$. The transverse position of the lens is then
calculated from the image position by means of image processing of a CCD pixel
frame. The image recorded by the CCD camera is then used to reconstruct
positions of the chessboard pattern. The resolution of the CCD-RASNIK system
is better than $\rm 1{\,\upmu\mathrm{m}}$ for a system with a mask-to-CCD
distance up to about $8\mathrm{\,m}$ [12].

Elements of 48 RASNIK lines are mounted on the four corners of each of the 12
C-frames of the OT detector. They measure precisely the $x$ and $y$
displacements of the four points on the C-frame with respect to corresponding
fixed reference points, mounted on the bridge, the pillars or on the table
fixed to the support structure. In addition to these 48 short horizontal
lines, there are two longer vertical lines measuring displacements of the $x$
and $z$ coordinates of two positions on the top of the support bridge, with
respect to the supporting table.

Below, the measured displacements are discussed regarding the long term
stability, the reproducibility of the position after opening and closing a
C-frame and the movements due changes of the magnet field of the LHCb dipole.
All the misalignments here presented are automatically taken into account and
corrected for via the LHCb software alignment [6].

####  3.1 Long term stability of C-frames positions

The horizontal lines measure the horizontal $x$ and vertical $y$ variations of
positions of the points close to C-frames’ corners. In figure 7(a) the
movements along the $x$ coordinate are shown, which is the coordinate relevant
for the momentum measurement of charged particles. The RASNIK results show
that the top parts of the C-frames are more stable in time than the bottom
ones in both $x$ and $y$ coordinates. This is consistent with the mechanical
constraints of the C-frames, which are fixed in $x$ from the top of the bridge
by means of a hook, clamped to the C-frames. The bottom of the C-frames are
hanging freely in the $x$ and $y$ coordinates, while constrained in the $z$
coordinate. The positions of the bottom C-frames vary within $\sim
200{\,\upmu\mathrm{m}}$ in both $x$ and $y$ values in 2016. At the beginning
of the data taking, in May and June 2016, the changes are relatively large, in
the range $100-200{\,\upmu\mathrm{m}}$. After an intervention at the end of
June when parts of the detector were opened and closed, the OT slowly attained
the equilibrium state. After a second intervention in September the OT reached
its equilibrium in a shorter time. In October and November, the changes start
to evolve with the opposite trend to the ones observed in May.

\begin{overpic}[width=212.47617pt]{figs/RasnikFigs/RasnikFigures_2016_April-
November_T2XU_Q1inner_x.pdf} \put(77.0,50.0){\small(a) }
\end{overpic}\begin{overpic}[width=212.47617pt]{figs/RasnikFigs/RasnikFigures_2016_14-16Sep_T3VX_Cframe_x.pdf}
\put(77.0,50.0){\small(b) } \end{overpic}

Figure 7: (a) Movements in $x$ of one bottom corner of a C-frame (T2-XU) are
shown during the data taking period in 2016. (b) Movement in $x$ of a point at
the top corner of an opened and closed C-frame (T3-VX, C-side) in September
2016. (The absolute value of the $x$-coordinate is arbitrary.)

####  3.2 Effects of opening and closing C-frames

Two C-frames ($x$-$u$ and $v$-$x$ of the 3rd station – T3-XU and T3-VX – on
the C-side) were opened and closed on $15^{\rm th}$ September 2016. The data
from one day before and one day after the movement are presented in figure
7(b). The horizontal shift of about $70{\,\upmu\mathrm{m}}$ in the $x$ is
observed due to the intervention. The vertical $y$ coordinate changed by only
$20{\,\upmu\mathrm{m}}$. It was also checked that the intervention on station
T3 resulted in significantly smaller movements, within $\pm
20{\,\upmu\mathrm{m}}$, of the other two stations that were not moved during
the intervention. Changes in the weight distributions on the bridge during
opening and closing C-frames, slightly affect all C-frames due to changing
weight distributions of the bridge.

####  3.3 Monitoring of the bridge position

There are two lines which allow to measure the $x$ and $z$ LHCb coordinates of
the points close to the top and on either side of the supporting bridge. The
long term movement in $z$ is shown in figure 8(a), whereas a zoom is shown in
figure 8(b) in the period when the magnet was switched on and off several
times. In May and June 2016, the bridge moves towards the magnet by about
$100{\,\upmu\mathrm{m}}$ and stabilizes in August and September. There is a
hint that the trend reverses towards the end of the year and the $z$ starts to
increase. The sudden movements observed correspond to periods where the LHCb
dipole magnet was switched off and on. The long term movement of the order
$100{\,\upmu\mathrm{m}}$ in the $z$ direction is small, and is presumably due
to the combination of temperature variation and magnetic forces.

\begin{overpic}[width=212.47617pt]{figs/RasnikFigs/RasnikFigures_2016_April-
November_Bridge_Q13_z.pdf} \put(77.0,50.0){\small(a) }
\end{overpic}\begin{overpic}[width=208.13574pt]{figs/RasnikFigs/RasnikFigures_2016_27April-20June_Bridge_Q13_z.pdf}
\put(77.0,50.0){\small(b) } \end{overpic}

Figure 8: The $z$–coordinate of the bridge positions as a function of time (a)
for the data acquired in 2016 and (b) the more detailed view of the data from
27th of April till 20th of June. The two visible dips correspond to the two
occasions where the magnet was switched off and on.

The switching off of the magnet causes the movements of the bridge. After
switching on the magnet, the bridge moves back to the previous position. The
bridge position does not depend on the direction of magnet polarity.

In conclusion, the RASNIK system works well and provides high accuracy data
which allows to monitor deformations of the OT detector geometry. The
movements of the C-frames in the $x$ and $y$ coordinates are smaller than
$200{\,\upmu\mathrm{m}}$. The movements of the bridge in the $z$ direction
with respect to the supporting table are within $100{\,\upmu\mathrm{m}}$. The
results show small movements of the OT due to changes of magnetic field
configurations and mechanical interventions, like opening and closing of
C-frames. The RASNIK lines confirm the software alignment with precision data
and show the real movements of the detector.

###  4 Radiation resistance

During the production of the OT detector modules, significant gain losses were
measured after irradiation with 90Sr or 55Fe sources. This effect was studied
extensively, and the origin was traced to the plastifier di-isopropyl-
naphthalene used in the glue, which forms an insulating layer on the anode
wire [13, 14]. After local irradiation, surprisingly the most affected region
is upstream of the source with respect to the gas flow. Downstream the source,
the deposition of the insulating layer is prevented by the presence of ozone,
produced under the source. The irradiation profile on the OT surface during
LHC operation is very different from the one of a small source in the
laboratory, resulting in the fact that the entire OT benefits from the ozone
production, and thus does not suffer from malicious depositions of an
insulating layer of hydro-carbons on the anode wire. Nevertheless the gain is
monitored regularly during operation, to detect possible irradiation damage at
the earliest stage.

To determine any change of the gain, dedicated data are recorded during LHC
operation in which the amplifier threshold is varied per layer. To limit the
impact on physics data taking, typically the low intensity fills from the LHC
are used. However, the LHC conditions during these OT threshold scans can
vary. These varying beam conditions lead to different event occupancies in the
Outer Tracker. This was traced to be the origin of the small reported increase
of the gain in the Outer Tracker in 2012, which was falsely attributed to a
change in the gas mixture [15].

\begin{overpic}[width=223.0721pt]{figs/Ageing/Scurve.pdf} \put(26.0,45.0){(a)}
\end{overpic}\begin{overpic}[width=223.0721pt]{figs/Ageing/trendplot_lumi_all.pdf}
\put(65.0,50.0){(b)} \end{overpic}

Figure 9:  (a) Example hit efficiency plot as a function of amplifier
threshold for the first layer. (b) Average gain variation as a function of the
delivered luminosity.

The measured average gas gain with the nominal operational conditions is 55
000 and the charge deposited per single hit is of 350 fC. The typical hit
density corresponds to about $2.8\times 10^{-3}$ per event per $\mathrm{\,cm}$
per straw in the innermost part, which is the one with highest multiplicity.
For the considered time period a delivered luminosity of 5.2$\mbox{\,fb}^{-1}$
was integrated for an equivalent charge of $0.18~{}\rm{C}/\mathrm{\,cm}$ per
straw.

Data from all the threshold scans have been re-analysed. To equalise the
occupancy for each scan, an upper limit on the number of OT hits per event is
placed offline. The single hit efficiency is computed in bins of the threshold
value, which gives rise to the characteristic S-shape as shown in figure 9(a).
The relative gain is then computed from the change in the half-efficiency
point [15]. The relative gain throughout the years averaged over the full
detector is shown in figure 9(b) as a function of the integrated luminosity.
The results are consistent with no gain loss. The inner, outer and bottom
parts of the detector are analysed separately as well, motivated by the
originally observed ageing pattern upstream of the irradiated area. No
differences are observed for the different regions of the detector. Within the
resolution of the method (approximately $34\times 34\mathrm{\,cm}^{2}$) no
large gain variations are seen in localized parts of the detector or in single
straws.

##  Part II Improved calibration and results

In this second part the improvements implemented during the long-shutdown are
presented and evaluated. Prospects for future use of the added information are
discussed.

###  5 Real-time global drift time calibration

The monitoring of the precise time alignment of the LHCb detector with respect
to the LHC clock partially relies on the OT detector. The calibration of the
time-alignment was performed in Run 1 only at given time intervals, typically
after periods of shutdown with hardware interventions (technical stops). In
order to increase the precision and automation of the OT time-alignment a
procedure has been devised to perform this task online during data-taking
time, and is described in the following.

Figure 10:  Sketch of the contributions to the measured $t_{TDC}$.

####  5.1 Method

The OT measures the arrival time of the signals with respect to the LHC clock,
$T_{\rm clk}$, and is referred to as the TDC time, $t_{\rm TDC}$. From the
measurement of the distance $r$ of a track traversing the straw to the wire at
the centre of the straw, the expected time, $t(r)$ can be calculated using the
distance to drift-time relation (TR-relation, see also section 7).

Different contributions can be distinguished in the TDC timing: the time-of-
flight of the particle, $t_{\rm tof}$, the drift-time $t_{\rm drift}$ of the
electrons in the straw, the propagation time of the signal along the wire to
the readout electronics, $t_{\rm prop}$, and the delay induced by the FE
electronics, $t_{\rm FE}$, as shown in figure 10.

$t_{\rm TDC}=(T_{\rm collision}-T_{\rm clk}^{\rm FE})+t_{\rm tof}+t_{\rm
drift}+t_{\rm prop}+t_{\rm FE}$ (1)

The bunch crossing time of the $pp$ collision, $T_{\rm collision}$, can be
shifted with respect to the LHC clock, $T_{\rm clk}$, but the difference is
kept below $0.5{\mathrm{\,ns}}$. The phase of the clock used by the OT
electronics at the TDC input ($T_{\rm clk}^{FE}$) can be adjusted. The sum
$(T_{\rm collision}-T_{\rm clk}^{\rm FE})+t_{\rm FE}$ can be written as
${(T_{\rm collision}-T_{\rm clk})+t_{0}}$, where the first difference accounts
for variations of the phase of the LHC clock received at the LHCb experiment,
and the $t_{0}=t_{\rm FE}-t^{\rm FE}_{\rm clk}$ offset accounts for the drift
of the global LHCb clock and the drift of FE electronic delays.

The TR-relation is calibrated on data (see section 7) and the time $t(r)$
obtained includes the effects of $t_{\rm tof}$, $t_{\rm drift}$ and $t_{\rm
prop}$. The measured difference between $t(r)$ and $t_{\rm TDC}$ is fitted
with a Gaussian distributions, which mean value determines the offset $t_{0}$.

Figure 11:  Example distribution of the differences between the $t_{0}$ values
before and after the first iteration of the calibration (black), and between
the first and the second iteration (red).

During Run 1, the $t_{0}$ calibration was executed after every LHCb Technical
Stop and the $t_{0}$ offset for each OT module was determined from the drift
time residual distributions [5]. One iteration of the calibration procedure
was sufficient to obtain the new $t_{0}$ values with a precision better than
$0.1{\mathrm{\,ns}}$. The distributions of the differences between the $t_{0}$
values before calibration and after the first iteration, and between the first
and the second iteration are shown in figure 11. The largest contribution is
due to a global $t_{0}$ shift that affects the $t_{0}$ constants of all FE
modules by the same amount. This is caused by the drift of the global LHCb
clock with respect to the bunch arrival time.

During Run 2, the $t_{0}$ calibration procedure is therefore split in two
algorithms. The real-time algorithm performs a gaussian fit to the global
drift time residual distribution considering the tracks in the whole Outer
Tracker, estimating the impact of the drift of the LHCb clock. In addition, an
offline algorithm is set up to evaluate the time offsets per OT module due to
the single FE electronic delays. These latter offsets are not expected to
change during the data-taking period, excluding cases of hardware
interventions on the OT modules. This second algorithm has been used to
calculate the offsets at the beginning of Run 2 and is then only used to
confirm the stability of the $t_{0}$ constants (see section 6.2).

####  5.2 Performance and monitoring

Figure 12:  Calculated global drift-time offset differences ($\Delta t_{0}$)
for Run 2 data taking period 3 July 2015 - 14 Sept 2015. Red triangles show
calibrations above threshold which are applied to data, while blue dots show
calibrations which are within tolerance and are not applied. The threshold
values used are represented with the shaded region: the periods with lower
threshold were during commissioning of this algorithm.

The real-time global $t_{0}$ calibration strategy allows for a time alignment
of the OT time and LHCb clock better than $0.1{\mathrm{\,ns}}$, compared to
global shifts of $\pm 0.5{\mathrm{\,ns}}$ which were allowed in Run 1. This
leads to an increase of the track reconstruction efficiency by 0.25% with
respect to the previous calibration strategy. The track reconstruction
efficiency has been estimated from a sample of simulated
$B^{+}\rightarrow{{J\mskip-3.0mu/\mskip-2.0mu\psi\mskip 2.0mu}}K^{+}$ decays
reconstructed in the LHCb detector. The efficiency of tracks reconstructed in
the whole LHCb tracking system, using the $t_{0}$ values included in the LHCb
detector simulation, is compared to the tracking efficiency measured when
varying the simulation $t_{0}$ offset by a global shift.

The real-time calibration algorithm uses the drift time residuals
distributions obtained for the tracks reconstructed in the three OT stations
to measure the current drift time offset ($t_{0}$ value) with respect to the
$t_{0}$ value calculated from the previous calibration. This calibration is
used in the online database during data taking. This calibration algorithm
produces a fit to the global drift time residuals distribution every 15
minutes during physics data taking. The new $t_{0}$ value is applied if the
following conditions are met: sufficient tracks were used in the new
calibration; no $t_{0}$ calibration had been performed yet on the current run;
the new $t_{0}$ value change exceeds 0.1 ns but is smaller than 2 ns.

The difference between the new $t_{0}$ value with respect to the previous
$t_{0}$ value is reported in figure 12. The shadowed regions correspond to the
minimum size of this difference necessary to trigger an update of the $t_{0}$
constants in the databases used for the data taking. The threshold value of
$0.1{\mathrm{\,ns}}$ is considered optimal. It is the typical spread of the
$t_{0}$ values per module after one or more calibration iterations, and thus
implies a natural choice for the intrinsic resolution. Typically a few updates
of the global $t_{0}$ constant are applied in one week of data taking.

The absolute $t_{0}$ as a function of time is shown in figure 13, together
with the absolute value of the phase of beam-1. Any change in the LHC clock
affects both measurements. The difference of the two measurements is shown in
the lower figure of figure 13, and is stable within $\pm 0.2{\mathrm{\,ns}}$,
showing the stability of the average OT time measurement. The large scatter in
the initial points is due to the phase of commissioning of the algorithm. The
larger differences $>0.2$ ns in the last data taking period correspond to the
data recorded during Pb running period at the end of 2015. Due to the larger
number of low momentum tracks, the average time-of-flight difference is
reflected in a different global $t_{0}$.

Figure 13:  Absolute stability of the value of the global time offset $t_{0}$
obtained comparing the $t_{0}$ absolute value with the beam-1 phase. The large
scatter in the initial points is due to the phase of commissioning of the
algorithm. The $t_{0}$ measurements towards the end of the 2015 data taking
period correspond to the LHC operation with Pb ions.

###  6 Offline per-module calibration

Time offsets due to small differences in the delays in single Front-End
modules need to be accounted for, in addition to the global $t_{0}$ offset.
These FE-offsets are not expected to change as function of time, unless in
cases of hardware modifications of the system. Every FE module of the OT
contains two layers of 64 straws, read out in groups of 32 channels,
corresponding to one TDC chip per group. Two changes in Run 2 improve the time
calibration of the OT module.

First, the calibration procedure assumes that the spatial position and
alignment of the OT is correct. Since the calibration exploits the tracks and
compares the measured time $t_{\rm TDC}$ to the time calculated from the
measured distance from the track to the wire, $t(r)$, an imperfect spatial
alignment of the detector will result in a systematic overestimation or
underestimation of $t(r)$. The relative position of the two monolayers of
straws inside a single module has been determined and accounted for in Run 2.

Secondly, the four different TDC chips within the same module measure
different $t_{\rm TDC}$ values, due to the slightly different characteristics.
The $t_{\rm TDC}$ value measured can vary up to 1 ns within the same module.
In Run 2 the granularity of the $t_{0}$ constants has been increased by a
factor four, by determining the constant per TDC-chip, rather than per FE-
module.

####  6.1 Module and monolayer spatial alignment

A major improvement of the alignment of the detector modules in Run 2 is
provided by the real-time spatial alignment strategy [6]. At the beginning of
each fill, a full tracker alignment is performed, and when the constants
describing the position of the module differ from the last constants by more
than a given threshold, the constants are updated. This ensures to have the OT
modules aligned to better than 100${\,\upmu\mathrm{m}}$ at all times.

Not only the alignment constants are updated more frequently, also the
detector geometry description is improved. More parameters are introduced to
describe the shape of a detector module. The OT half-module geometry is now
modelled as a collection of 3 straight segments with equal length [5]. The
numbers that parametrize the misalignment of the two monolayers are stored in
the condition database. There are at most six numbers for each module. These
six numbers represent the displacement in the $x$-coordinate between the two
monolayers at the beginning and end of each of the three trajectory segments.
In order to perform this special alignment, data from Run-I has been used.
This new description of the detector elements leads to a reduction of the
width of the drift time residuals distributions by up to 20% (See section 7)
and a marginal increase of the number of reconstructed tracks and OT hits. The
monolayer alignment is shown to be stable and is not updated online, but is
monitored offline during Run 2.

####  6.2 FE-module $t_{0}$ calibration

The $t_{0}$ offsets for single TDC chips are calculated with respect to the
global $t_{0}$ offset. This calibration is only run periodically as no
relative movements of the modules are expected. For each module the drift time
residual distributions are drawn for each TDC chip separately for tracks
traversing the straws from the left and right side. A gaussian fit excluding
the tails of the distributions is performed to determine the position of the
drift time residuals peak. An arithmetic average between the $t_{0}$ obtained
from left and right tracks is considered, and a $t_{0}$ value for each
constant is determined and reported in the databases.

Different selection studies have been performed, including different
requirements on the minimum numbers of OT hits and different lower limits on
the momentum of the tracks. A tighter selection ensures a better quality of
the track sample, but reduces the statistics. A compromise between the
acceptable statistical uncertainty and track quality requirements is reached
when using tracks traversing the whole LHCb tracking system, requiring an
unbiased track-fit $\chi^{2}/\text{ndf}<2$ and a minimum momentum of the
particle of $3.2{\mathrm{\,Ge\kern-1.00006ptV\\!/}c}$, which are standard
requirements in typical LHCb physics analyses.

The gain in tracking efficiency obtained using per-TDC-chip $t_{0}$ constants
rather than per-module constants has been estimated with simulated
$B^{+}\rightarrow J/\psi K^{+}$ decays reconstructed in the LHCb detector. The
tracking efficiency improved marginally by about 0.5 per mille per track. The
improvement in drift-time resolution and the corresponding possible new use of
the time information are discussed below.

###  7 Updated drift-time distance relation and improved resolution

####  7.1 TR-relation

The drift-time measured by the detector needs to be converted to a distance
from the wire to be used in the tracking. Drift-time and position information
are related by means of the drift-time-distance relation, or TR-relation. The
TR-relation is calibrated on data using good quality tracks, selected by
requiring a momentum larger than $10{\mathrm{\,Ge\kern-1.00006ptV\\!/}c}$ and
a track-fit $\chi^{2}/\text{ndf}<2$; the track-fit is unbiased by excluding
the hit under study. The parametrization of the TR-relation is extracted from
the fit to the distribution of the measured drift-time versus the distance of
the reconstructed track from the wire, and is shown in figure 14. The TR-
relation is parametrised with a second order polynomial as a function of the
unbiased distance. The TR-relation with parameter values obtained with Run 2
data is

$t(r)=\left(21.3\frac{|r|}{R}+14.4\frac{|r|^{2}}{R^{2}}\right){\mathrm{\,ns}},$
(2)

where $r$ is the distance and $R$ is the radius of the straw-tube. The
parameter values are consistent with the values observed in Run 1 [5].

Figure 14: The drift time versus the unbiased distance distribution with the
overlaid TR-relation curve, obtained from the fit (black line).

####  7.2 Resolution

The time resolution dependence on the distance from the wire is extracted from
the 2-dimensional fit to the distribution in figure 14 to be

$\sigma_{t}(r)=\left(2.25+0.3\frac{|r|}{R}\right){\mathrm{\,ns}}\quad.$ (3)

The average drift-time resolution is obtained from equation 3 to be
$2.40{\mathrm{\,ns}}$, which is an improvement of about $20\%$ with respect to
during Run 1. Similarly, the spatial resolution is reduced from
$205{\,\upmu\mathrm{m}}$ to $171{\,\upmu\mathrm{m}}$ due to the combination of
monolayer alignment, global drift time calibration and single FE-module
calibration, discussed in the previous sections.

(a)(b)

Figure 15:  (a) Drift-time residual distribution and (b) hit distance residual
distribution.

The time and spatial distribution comparing the measured drift-time and hit
position of Run 1 and Run 2 are shown in figure 15 for illustration only,
corrected for the finite precision of the track parameters.

###  8 Use of time information

The more precise time and space alignment, has led to an improved drift-time
hit resolution of the OT, beyond its design specifications. This opens the
possibility that timing information is assigned to physics objects, like
reconstructed tracks and vertices. A sample of $100\,000$ selected events
containing a semileptonic $B$ meson decay has been used for this study.

####  8.1 Time-stamp for single tracks

A single track that traverses the entire OT typically contains 22 OT hits. For
each hit the drift time residuals can be calculated, as described in section
5. The track time is defined as the sum of all individual drift time
residuals, weighted by their errors. This track time is the difference in the
arrival time of the particle at the OT with respect to the expected arrival
time for a particle travelling at the speed of light. The number of OT hits
per track used for the track time calculation is shown in figure 16(a). The
mean number of hits is about 18, with a long tail to the left. The actual
number of OT hits on a track is slightly larger, due to the addition of OT
hits where the drift time is not used (for example for straws that are hit
twice, and for which the drift time does not agree with the track position).
Tracks with a number of hits less than three are not considered in these
studies, and neither are tracks with a momentum below
$2~{}{\mathrm{\,Ge\kern-1.00006ptV\\!/}c}$. The uncertainty of the track time
is obtained from the drift time residual, $\sigma_{t}$, and is thus expected
to scale as $\sigma_{t}/\sqrt{N}$, where $N$ is the number of hits for the
given track. The distribution is shown in figure 16(b), and has a mean value
of $0.57~{}{\mathrm{\,ns}}$.

(a)(b)

Figure 16:  (a) The number of OT hits per track $N$, where the drift-time is
used. (b) The uncertainty on the time per track, as estimated from time
resolution per hit, $\sigma_{t}/\sqrt{N}$.

A track reconstructed with random OT hits (e.g. from noise or spill-over) is
called a ghost track. The track time of ghost tracks is expected to be large,
and could thus be of added value in their rejection. Studies on data show that
the track time of ghost tracks has indeed discriminating power, however it was
also found that it is largely correlated with other ghost-reducing parameters,
such as the $\chi^{2}$ of the track fit, and thus adds little value.

####  8.2 Time-of-flight for pions and protons

The velocity of particles created in $pp$ collision can mostly be approximated
by the speed of light. However, heavy, low momentum particles have a lower
velocity, which can lead to a significant later arrival time. For protons,
this is about $0.5{\mathrm{\,ns}}$ at $5{\mathrm{\,Ge\kern-1.00006ptV\\!/}c}$
at the centre of the OT - about $8.5\mathrm{\,m}$ from the interaction point -
as shown in figure 17. This is similar to the expected track time resolution.

Figure 17:  The difference in time-of-flight between protons and pions as a
function of their momentum.

The distribution of track times of pions and protons with momenta below
$7~{}{\mathrm{\,Ge\kern-1.00006ptV\\!/}c}$ in LHCb simulation is shown in
figure 18(a). In data, a sample of ${D}^{*}$ tagged
${{D}^{0}}\rightarrow{{K}^{+}}{{\pi}^{-}}$ decays is used as a source of
unbiased identified pions. This sample is regularly used to calibrate the LHCb
particle identification response, since pions can be identified using only
their charge. In a similar fashion, events with a semileptonic ${\mathchar
28931\relax}^{0}_{b}$ decay are used as a control sample of protons, albeit
that the initial selection discards a large fraction of low-momentum protons.
The track time distribution in data is shown for both pions and protons in
figure 18(b). In both simulation and data the difference in the track time
distributions between low momentum pions and protons is clearly visible. The
discriminating power of the track time to distinguish protons from pions is
shown in figure 19. The performance in data and simulation are found to be in
good agreement. As an example, for a proton identification efficiency around
75%, half of the pions are rejected.

(a)(b)

Figure 18:  The distribution of track times for protons and pions with
$p<7{\mathrm{\,Ge\kern-0.90005ptV\\!/}c}$ in (a) simulation and (b) in data.

(a)(b)

Figure 19:  The pion rejection rate as a function of the proton efficiency for
(a) simulation and (b) data.

Most of the particle identification performance of LHCb is due to the ring
imaging Cherenkov detectors (RICH), with radiators $\mathrm{CF_{4}}$ and
$\mathrm{C_{4}F_{10}}$. The particle identification for momenta between $1.5$
and $10{\mathrm{\,Ge\kern-1.00006ptV\\!/}c}$ was done with the use of the
aerogel radiator, but it has been removed after Run 1 fitting the design for
higher luminosities. The OT track time can assist in this momentum range in
Run 2, especially for analyses involving protons, $\Sigma$ hyperons,
deuterons, and new long-lived heavy particle searches. In LHCb, particle
identification is done by creating a neural network using inputs from the
RICH, calorimeters and muon detector systems [16]. In the near future the OT
track time will be added as an input variable. The addition of the OT track-
time will improve also the performance of particle identification of low-
momentum particles used to identify the flavour of $B$-mesons (flavour
tagging). Finally, the particle identification performance of the OT track
time serves as a test case for a possible future time-of-flight detectors for
LHC, such as for example TORCH [17].

####  8.3 Time-stamp of primary vertices

One of the experimental limitations to increase the luminosity at LHCb is the
number of $pp$ collisions per bunch crossing, which hampers the association of
a $B$-decay to the correct primary vertex. Two primary vertices (PVs)
separated far enough in space can be resolved by the excellent spatial
resolution of the vertex reconstruction. A time stamp per PV would aid in the
separation of these vertices. The PV time is calculated as the weighted
average of the track times of all tracks associated with that PV. For events
with two PVs, the PV time difference is shown in figure 20(a). The expected
error for this spread is $\sigma_{t,track}/\sqrt{N_{tracks}}$, where
$N_{tracks}$ is the number of tracks per PV, which is 25 on average. The
significance of this spread when comparing to the expected error is found to
be larger than one, indicating some discriminating power. However, it is also
larger than the combined expected PV time uncertainty
($0.57{\mathrm{\,ns}}/\sqrt{25}$) with the PV spread of $0.18{\mathrm{\,ns}}$
that is expected from the LHC [18].

(a)(b)

Figure 20:  (a) The difference between the average time per primary vertex,
for events with two reconstructed primary vertices. (b) The difference between
the time of two tracks belonging to the same primary vertex.

In figure 20(b) the difference in track time between two tracks from the same
PV is shown. The RMS is larger than the expected value of
$0.57\times\sqrt{2}{\mathrm{\,ns}}$. This indicates that the track time errors
are underestimated by about 20%.

###  9 Conclusions

In this article the performance of the LHCb Outer Tracker detector has been
summarized as obtained from LHC Run 2 data.

The OT has reached and in some cases superseded the design performances, being
able to acquire data in $pp$ collisions at luminosities twice higher than
anticipated and to be run in the high multiplicity environment of heavy ion
collisions.

Efficiencies and availability of the detector components have been kept at
maximal level for the entire data taking period, and no signs of ageing or
damages due to radiation have been observed.

Novel methods have been implemented for the time and space alignment, which
have improved the resolution of the detector. This allowed the study to apply
the time information beyond the tracking purposes. A time-of-flight
measurement has been developed providing discrimination for particle
identification of low momentum charged hadrons, and that will be helpful in
physics analyses with Run 2 data. This offers also benchmarking possibilities
for future time-sensitive detectors for particle identification or multiple-
interactions event tagging.

### Acknowledgements

We express our gratitude to our colleagues in the CERN accelerator departments
for the excellent performance of the LHC. We thank the technical and
administrative staff at the LHCb institutes. We acknowledge support from CERN
and from the national agencies: CAPES, CNPq, FAPERJ and FINEP (Brazil); NSFC
(China); CNRS/IN2P3 (France); BMBF, DFG and MPG (Germany); INFN (Italy); FOM
and NWO (The Netherlands); MNiSW and NCN (Poland); MEN/IFA (Romania); MinES
and FANO (Russia); MinECo (Spain); SNSF and SER (Switzerland); NASU (Ukraine);
STFC (United Kingdom); NSF (USA). We acknowledge the computing resources that
are provided by CERN, IN2P3 (France), KIT and DESY (Germany), INFN (Italy),
SURF (The Netherlands), PIC (Spain), GridPP (United Kingdom), RRCKI (Russia),
CSCS (Switzerland), IFIN-HH (Romania), CBPF (Brazil), PL-GRID (Poland) and OSC
(USA). We are indebted to the communities behind the multiple open source
software packages on which we depend. We are also thankful for the computing
resources and the access to software R&D tools provided by Yandex LLC
(Russia). Individual groups or members have received support from AvH
Foundation (Germany), EPLANET, Marie Skłodowska-Curie Actions and ERC
(European Union), Conseil Général de Haute-Savoie, Labex ENIGMASS and OCEVU,
Région Auvergne (France), RFBR (Russia), XuntaGal and GENCAT (Spain), The
Royal Society and Royal Commission for the Exhibition of 1851 (United
Kingdom).

### References

  * [1] LHCb collaboration, A. A. Alves Jr. et al., _The LHCb detector at the LHC_, JINST 3 (2008) S08005
  * [2] LHCb collaboration, P. R. Barbosa et al., _Outer Tracker technical design report_ ,  CERN-LHCC-2001-024
  * [3] A. Berkien et al., _The LHCb Outer Tracker front end electronics_ , CERN-LHCB-2005-025
  * [4] G. Haefeli et al., _The LHCb DAQ interface board TELL1_ , Nucl. Instrum. Meth. A560 (2006) 494
  * [5] LHCb Outer Tracker group, Arink et al., _Performance of the LHCb Outer Tracker_ , J. Instrum. 9 (2013) P01002. 30 p, arXiv:1311.3893
  * [6] S. Borghi, _Novel real-time alignment and calibration of the lhcb detector and its performance_ , Nucl. Instrum. Meth. A845 (2017) 560 , Proceedings of the Vienna Conference on Instrumentation 2016
  * [7] W. Hulsbergen, _The global covariance matrix of tracks fitted with a Kalman filter and an application in detector alignment_ , Nucl. Instrum. Meth. A600 (2009) 471, arXiv:0810.2241
  * [8] J. Amoraal et al., _Application of vertex and mass constraints in track-based alignment_ , Nucl. Instrum. Meth. A712 (2013) 48, arXiv:1207.4756
  * [9] P. Duinker et al., _Some Methods and Tools for Testing and Optimizing Proportional Wire Chambers_ , Nucl. Instrum. Meth. A273 (1988) 814
  * [10] M. Adamus et al., _Test results of the RASNIK optical alignment monitoring system for the LHCb Outer Tracker Detector_ , LHCb-Note-2001-004
  * [11] M. Adamus et al., _First Results from a prototype of the RASNIK alignment system for the Outer Tracker detector in LHCb experiment_ , LHCb-Note-2002-016
  * [12] H. Dekker et al., _The RASNIK/CCD 3-dimensional alignment system_ , eConf C930928 (1993) 017, ATL-MUON-94-063
  * [13] S. Bachmann et al., _Ageing in the LHCb Outer Tracker: phenomenon, culprit and effect of oxygen_ , Nucl. Instrum. Meth. A617 (2010) 202
  * [14] N. Tuning et al., _Ageing in the LHCb outer tracker: aromatic hydrocarbons and wire cleaning_ , Nucl. Instrum. Meth. A656 (2011) 45
  * [15] D. van Eijk et al., _Radiation hardness of the LHCb Outer Tracker_ , Nucl. Instrum. Meth. A685 (2012) 62
  * [16] L. Anderlini et al., _The PIDCalib package_ , Tech. Rep. LHCb-PUB-2016-021. CERN-LHCb-PUB-2016-021, CERN, Geneva, Jul, 2016
  * [17] M. J. Charles and R. Forty, _TORCH: Time of Flight Identification with Cherenkov Radiation_ , Nucl. Instrum. Meth. A639 (2011) 173, arXiv:1009.3793
  * [18] G. Arduini, _private communication_ , 2016