]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/doc/trd_software_writeup.tex
Adding run types for TOF.
[u/mrichter/AliRoot.git] / TRD / doc / trd_software_writeup.tex
CommitLineData
883031eb 1% ---------------------------------------------------------------------
2%
3% TRD Software Writeup
4%
5% ---------------------------------------------------------------------
6%
7\documentclass{alicetdr}
8%\documentclass[draft]{alicetdr}
9%
10% For figures
11\usepackage{graphicx}
12%
13% Helvetica
14\usepackage{helvet}
15\renewcommand{\rmdefault}{phv}
16\renewcommand{\sfdefault}{phv}
17%
18\let\Otemize =\itemize
19\let\Onumerate =\enumerate
20\let\Oescription =\description
21% Zero the vertical spacing parameters
22\def\Nospacing{\itemsep=0pt\topsep=0pt\partopsep=0pt\parskip=0pt\parsep=0pt}
23\def\Topspac{\vspace{-0.5\baselineskip}}
24\def\Botspac{\vspace{-0.2\baselineskip}}
25% Redefine the environments in terms of the original values
26\newenvironment{Itemize}{\Topspac\Otemize\Nospacing}{\endlist\Botspac}
27\newenvironment{Enumerate}{\Topspac\Onumerate\Nospacing}{\endlist\Botspac}
28\newenvironment{Description}{\Topspac\Oescription\Nospacing}{\endlist\Botspac}
29%
30\include{alicedefs}
31%
32\begin{document}
33%
34\pagenumbering{roman}
35%
36%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37%
38% Title page
39%
40\font\HUGEA=phvr at 36mm % declare very big font
41\font\HUGEB=phvr at 14mm % declare very big font
42%
43\begin{titlepage}
44%
45\vspace{10.0cm}
46%
47\begin{center}
48{\HUGEA T\hspace{5.mm}R\hspace{5.mm}D} \\
49%
50\vspace{3.5cm}
51{\HUGEB Offline Software Writeup} \\
52%
53\vspace{2.0cm}
54{\Large Version 1.0, \today}\\
55%
56\vfill
57%
58\vspace{5.5cm}
59%
60\end{center}
61%
62\end{titlepage}
63%
64%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65%
66% Empty page to adjust page numbering
67%
68\onecolumn
69\thispagestyle{empty}
70\mbox{ }
71%
72\setcounter{page}{0}
73\onecolumn
74%
75%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76%
77\pagenumbering{arabic}
78%
79%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80%
757c05c1 81% List of content
82%
83%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84%
85\thispagestyle{empty}
86\tableofcontents
87%
88%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89%
883031eb 90% Text
91%
92%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93%
94%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95\setcounter{chapter}{0}
96\setcounter{section}{0}
97\Chapter{Introduction}
98\thispagestyle{empty}
99%
100This document is supposed to provide a description of the offline
101software components that are specific to the TRD. It is an attempt
102to collect useful informations on the design and usage of the TRD
103software, in order to facilitate newcomers the introduction to the
104code. The most important classes and procedures are described and
0fa1a8ee 105several examples and use cases are given.
883031eb 106However, this writeup is not meant to be a basic AliRoot introduction.
107For this purpose the reader is referred to the general AliRoot users
108guide \cite{ALIROOT}.
109%
110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
111\newpage
112\setcounter{chapter}{1}
113\setcounter{section}{0}
114\Chapter{Simulation}
115\thispagestyle{empty}
116%
117\section{Geometry}
118\label{GEO:intro}
119%
120{\it Author: C.~Blume (blume@ikf.uni-frankfurt.de)}
121\smallskip
122\\
123%
124The TRD geometry, as implemented in {\tt AliTRDgeometry}, consists of
125several components: The readout chambers (ROC), the services, and the
126supermodule frame. All these parts are placed inside the TRD mother
127volumes, which in turn are part of the space frame geometry
128({\tt AliFRAMEv2}). Therefore, the space frame geometry has to be
129present to build the TRD geometry. For each of the 18 supermodules
130one single mothervolume is provided (BTRDxx). This allows to configure
131the TRD geometry in {\tt Config.C} such that it only contains a subset
132of supermodules in the total ALICE geometry via
133{\tt AliTRDgeometry::SetSMstatus()}. An incomplete detector setup, as
134it exists for first data taking, can thus be modelled. The class
135{\tt AliTRDgeometry} also serves as the central place to collect all
136geometry relevant numbers and the definitions of various numbering
137schemes of detector components (e.g. sector numbers). However, all
138geometric parameters that refer to the pad planes are compiled in
139{\tt AliTRDpadPlane}.
140%
141\subsection{Readout Chambers}
142\label{GEO:rocs}
143%
144\begin{figure}[htb]
145\begin{center}
146\includegraphics[width=0.85\textwidth]{plots/geo_roc.eps}
147\end{center}
148\caption{
149A TRD read out chamber as implemented in the AliRoot geometry. The
150various material layers are visible. Also, the MCMs on top of the
151chamber, as well as the cooling pipes are shown.
152}
153\label{FIG_GEO:roc_geom}
154\end{figure}
155%
156All ROCs are modelled in the same way, only their dimensions vary.
157They consist of an aluminum frame, which contains the material for
158the radiator and the gas of the drift region, a Wacosit frame (whose
159material is represented by carbon), that surrounds the amplification
160region, and the support structure, consisting of its aluminum frame,
161material for the read out pads, back panel, and readout boards). The
162material inside the active parts of the chambers (radiator, gas, wire
163planes, pad planes, glue, read out boards, etc.) is introduced by
164uniform layers of the corresponding material, whose thicknesses were
165chosen such to result in the correct radiation length. On top of the
166individual ROCs the multi chip modules (MCM) as well as the cooling
167pipes and cables are placed. One obvious simplification, already visible
168in Fig.~\ref{FIG_GEO:roc_geom}, is that in the AliRoot geometry the pipes
169run straight across the chambers instead of following the meandering path
170as in reality.
171%
172\subsection{Supermodules}
173\label{GEO:smframes}
174%
175\begin{figure}[htb]
176\begin{center}
177\begin{minipage}[b]{0.49\textwidth}
178\begin{center}
179\includegraphics[width=0.65\textwidth,angle=270]{plots/geo_smframe.eps}
180\end{center}
181\end{minipage}
182\begin{minipage}[b]{0.49\textwidth}
183\begin{center}
184\includegraphics[width=0.70\textwidth,angle=270]{plots/geo_sm.eps}
185\end{center}
186\end{minipage}
187\end{center}
188\caption{
189A TRD supermodule, as implemented in the AliRoot geometry. The left
190panel shows only the support structures of the aluminum frame, together
191with some service elements. The right panel shows a complete
192supermodule including some surrounding parts of the space frame.
193}
194\label{FIG_GEO:sm_geom}
195\end{figure}
196%
197The supermodule frames consist of the aluminum sheets on the sides, top,
198and bottom of a supermodule together with the traversing support structures.
199The left panel of Fig.~\ref{FIG_GEO:sm_geom} shows the structures that are
200implemented in the TRD geometry. Also, parts of the services like the LV
0fa1a8ee 201power bus bars and cooling arteries can be seen. Additional electronics
883031eb 202equipment (e.g. ``Sch\"utten-Box``) is represented by aluminum boxes that
203contain corresponding copper layers to mimic the present material. The
204services also include e.g. gas distribution boxes, cooling pipes, power and
205readout cables, and power connection panels. Part of the services extend
206into the baby and the back frame. Therefore, additional mother volumes
0fa1a8ee 207have been introduced in order to accommodate this material. All supermodules
883031eb 208have inserts of carbon fiber sheets in the bottom part of the aluminum
209casing, for the ones in front of the PHOS detector (sectors 11--15) also
210the top part includes carbon fiber inserts. The supermodules in the sectors
21113--15 do not contain any ROCs in the middle stack in order to provide the
212holes for the PHOS detector. Instead, gas tubes of stainless steel have
213been built in.
214%
215Generally, the TRD volumina start with the letter ``{\bf U}''. The geometry
216is defined by the function {\tt AliTRDgeometry::CreateGeometry()}, which
217generates the TRD mother volumes ({\bf UTI1}, {\bf UTI2}, {\bf UTI3}) and the
218volumes that constitute a single ROC. This function in turn also calls
219{\tt AliTRDgeometry::CreateFrame()} to create the TRD support frame,
220{\tt AliTRDgeometry::CreateServices()} to create the services, and
221{\tt AliTRDgeometry::GroupChambers()} which assembles the alignable
222volumes for a single ROC ({\bf UTxx}, where {\bf xx} is the detector
223number {\bf DET-SEC}, defined inside a single super module, see below). The
224materials, together with their tracking parameters, that are assigned to
225the volumina, are defined in {\tt AliTRD::CreateMaterials()}.
226In the following table the most important TRD volumina are described
227({\bf xx} = {\bf DET-SEC} number):
228%
229\begin{center}
230\begin{tabular}{l|l}
231Name & Description \\ \hline
232{\bf UTR1} & TRD mothervolume for default supermodules \\
233{\bf UTR2} & TRD mothervolume for supermodules in front of PHOS \\
234{\bf UTR3} & As {\bf UTR2}, but w/o middle stack \\ \hline
235{\bf UTxx} & Top volume of a single ROC \\
236 & Defines the alignable volume for a single ROC \\ \hline
237{\bf UAxx} & Lower part of the ROCs, including drift volume and radiator \\
238{\bf UDxx} & Amplification region \\
239{\bf UFxx} & Back panel, including pad planes and PCB boards of readout electronics \\
240{\bf UUxx} & Contains services on chambers (cooling, cables, DCS boards) and MCM chips \\
241\end{tabular}
242\end{center}
243%
244\subsection{Material Budget and Weight}
245%
246\begin{figure}[htb]
247\begin{center}
248\includegraphics[width=0.75\textwidth]{plots/geo_material_budget.eps}
249\end{center}
250\caption{
251The radiation length map in units of $X/X_{0}$ in part of the active
252detector area of super module 0 as a function of the pseudorapidity
253$\eta$ and the azimuth angle $\phi$, calculated from the geometry in
254AliRoot. Visible are the positions of the MCMs and the cooling pipes
255as hot spots.
256}
257\label{FIG_GEO:mat_budget}
258\end{figure}
259%
260The volumina defining a ROC contain several layers that represent the
261different materials present inside a chamber and which therefore define
262the material budget inside the sensitive areas:
263\begin{center}
264\begin{tabular}{l|l|l|l|c|c|c}
265Name & Mother & Material & Description & Thickness & Density & $X/X_{0}$ \\
266 & & & & [cm] & [g/cm$^{3}$] & [\%] \\ \hline
267{\bf URMYxx} & UAxx & Mylar & Mylar layer on radiator (x2) & 0.0015 & 1.39 & 0.005 \\
268{\bf URCBxx} & UAxx & Carbon & Carbon fiber mats (x2) & 0.0055 & 1.75 & 0.023 \\
269{\bf URGLxx} & UAxx & Araldite & Glue on the fiber mats (x2) & 0.0065 & 1.12 & 0.018 \\
270{\bf URRHxx} & UAxx & Rohacell & Sandwich structure (x2) & 0.8 & 0.075 & 0.149 \\
271{\bf URFBxx} & UAxx & PP & Fiber mats inside radiator & 3.186 & 0.068 & 0.490 \\ \hline
272{\bf UJxx} & UAxx & Xe/CO$_{2}$ & The drift region & 3.0 & 0.00495 & 0.167 \\
273{\bf UKxx} & UDxx & Xe/CO$_{2}$ & The amplification region & 0.7 & 0.00495 & 0.039 \\
274{\bf UWxx} & UKxx & Copper & Wire planes (x2) & 0.00011 & 8.96 & 0.008 \\ \hline
275{\bf UPPDxx} & UFxx & Copper & Copper of pad plane & 0.0025 & 8.96 & 0.174 \\
276{\bf UPPPxx} & UFxx & G10 & PCB of pad plane & 0.0356 & 2.0 & 0.239 \\
277{\bf UPGLxx} & UFxx & Araldite & Glue on pad plane & 0.0923 & 1.12 & 0.249 \\
278 & & Araldite & + additional glue (leaks) & 0.0505 & 1.12 & 0.107 \\
279{\bf UPCBxx} & UFxx & Carbon & Carbon fiber mats (x2) & 0.019 & 1.75 & 0.078 \\
280{\bf UPHCxx} & UFxx & Aramide & Honeycomb structure & 2.0299 & 0.032 & 0.169 \\
281{\bf UPPCxx} & UFxx & G10 & PCB of readout boards & 0.0486 & 2.0 & 0.326 \\
282{\bf UPRDxx} & UFxx & Copper & Copper of readout boards & 0.0057 & 8.96 & 0.404 \\
283{\bf UPELxx} & UFxx & Copper & Electronics and cables & 0.0029 & 8.96 & 0.202 \\
284\end{tabular}
285\end{center}
286This material budget has been adjusted to match the estimate given
287in~\cite{CLEMENS}, with the exception of the glue layer in the back panel
288({\bf UPGLxx}), which has been made thicker to include all the additional
289glue that has been applied to fix the gas leaks. Figure~\ref{FIG_GEO:mat_budget}
290shows the resulting radiation length map in the active detector area for
291super module 0, which has only carbon fiber inserts at the bottom and is
292thus one of the super modules with the largest material budget. It is
0fa1a8ee 293clearly visible that the MCMs and the cooling pipes introduce hot spots
883031eb 294in $X/X_{0}$. However, after averaging over the shown area, the mean
295value is found to be $\langle X/X_{0}\rangle =$~24.7~\%. For a supermodule
296with carbon fiber inserts at the top and the bottom one finds
297$\langle X/X_{0}\rangle =$~23.8~\% and in the regions of the PHOS holes (i.e.
298in the middle stack of supermodules 13--15) it is only
299$\langle X/X_{0}\rangle =$~1.9~\%.
300
301The total weight of a single TRD super module in the AliRoot geometry,
302including all services, is currently 1595kg, which is ca. 5\% short of its
303real weight. A single ROC of the type L0C1 with electronics and cooling
304pipes weighs 21.82kg.
305%
306\subsection{Naming Conventions and Numbering Schemes}
307%
308\begin{figure}[htb]
309\begin{minipage}[b]{0.49\textwidth}
310\begin{center}
311\includegraphics[width=\textwidth]{plots/sector_numbering.eps}
312\end{center}
313\end{minipage}
314\begin{minipage}[b]{0.49\textwidth}
315\begin{center}
316\includegraphics[width=\textwidth]{plots/layer_numbering.eps}
317\vspace{1.4cm}
318\end{center}
319\end{minipage}
320\begin{center}
321\includegraphics[width=0.60\textwidth]{plots/stack_numbering.eps}
322\end{center}
323\caption{
324Illustration of the TRD numbering scheme for super modules, defined in
325the global ALICE coordinate system: a) {\bf SECTOR} number, b)
326{\bf LAYER} number, c) {\bf STACK} number.
327}
328\label{FIG_GEO:sm_numbering}
329\end{figure}
330%
331The numbering schemes and the orientations of coordinate systems generally
332follow the official ALICE-TRD definition \cite{DAVID}. Therefore, the
333whole geometry is defined in the global ALICE coordinate system.
334%
335Inside the code we use the following nomenclature (see
336Fig.~\ref{FIG_GEO:sm_numbering}), which should be used consistently
337throughout the TRD code:
338%
339\begin{center}
340\begin{tabular}{l|l|l}
341Name & Definition & Range \\ \hline
342{\bf SECTOR} & TRD sector in azimuth (i.e. one supermodule) & 0--17 \\
343{\bf LAYER} & Layer inside a supermodule & 0--5 \\
344{\bf STACK} & Division of a supermodule along z-direction & 0--4 \\
345{\bf DET} & Single ROC in whole TRD & 0--539 \\
346{\bf DET-SEC} & Single ROC in one super module & 0--29
347\end{tabular}
348\end{center}
349%
350Due to the holes in front of the PHOS detector, naturally not all {\bf DET}
351numbers correspond to existing ROCs. A single ROC can thus be uniquely
352addressed by either using the three numbers
353({\bf LAYER}, {\bf STACK}, {\bf SECTOR}) or the single {\bf DET} number.
354The correspondence between the two possibilities is defined as:
355\begin{center}
356\mbox{{\bf DET} = {\bf LAYER} + {\bf STACK}$\times$5 + {\bf SECTOR}$\times$5$\times$4}
357\end{center}
358Additionally, there is a number that is unique inside a given super module (i.e.
359sector) and therefore has a range of 0~--~29:
360\begin{center}
361\mbox{{\bf DET-SEC} = {\bf LAYER} + {\bf STACK}$\times$5}
362\end{center}
363The class {\tt AliTRDgeometry} provides a set of functions that could/should
364be used to convert the one into the other:\\
365\hspace*{1.5cm}{\tt AliTRDgeometry::GetDetector(layer,stack,sector)} \\
366\hspace*{1.5cm}{\tt AliTRDgeometry::GetDetectorSec(layer,stack)} \\
367\hspace*{1.5cm}{\tt AliTRDgeometry::GetLayer(det)} \\
368\hspace*{1.5cm}{\tt AliTRDgeometry::GetStack(det)} \\
369\hspace*{1.5cm}{\tt AliTRDgeometry::GetSector(det)} \\
370%
371\subsection{Pad Planes}
372%
373All geometric parameters relevant to the pad planes are handled via the
374class {\tt AliTRDpadPlane}. This comprises the dimensions of the pad planes
375and the pad themselves, the number of padrows, padcolumns, and their tilting angle.
376The initialization of the needed {\tt AliTRDpadPlane} objects is done in
377{\tt AliTRDgeometry::CreatePadPlaneArray()}. The number of padrows can be 12
378(C0-type) or 16 (C1-type), the number of padcolumns is 144 in any case. Again,
379the numbering convention follows the definition given in \cite{DAVID}. Thus,
380the padrow numbers in a given pad plane increase from 0 to 11(15) with decreasing
381$z$-position, while the padcolumn numbers increase from 0 to 144 with increasing
382$\phi$ angle (i.e. counter clockwise). The tilting angle of the pads is 2~degrees,
383with alternating signs at different layers, beginning with +2~degrees for layer~0.
384The class {\tt AliTRDpadPlane} provides a variety of functions that allow to assign
385a pad number (row/column) to signals generated at a given hit position and which
386are used during the digitization process.
387%
388\section{Hit Generation}
389%
390{\it Author: C.~Blume (blume@ikf.uni-frankfurt.de)}
391\smallskip
392\\
393%
394In the case of the TRD a single hit corresponds to a cluster of electrons
395resulting from the ionization of the detector gas. This ionization can be due
396to the normal energy loss process of a charged particle or due to the
397absorption of a transition radiation (TR) photon. A single TRD hit, as
398defined in {\tt AliTRDhit} therefore contains the following data members:
399%
400\begin{center}
401\begin{tabular}{ll}
402{\tt fTrack} & Index of MC particle in kine tree \\
403{\tt fX} & X-position of the hit in global coordinates \\
404{\tt fY} & Y-position of the hit in global coordinates \\
405{\tt fZ} & Z-position of the hit in global coordinates \\
406{\tt fDetector} & Number of the ROC ({\bf DET} number) \\
407{\tt fQ} & Number of electrons created in the ionization step. Negative for TR hits \\
408{\tt fTime} & Absolute time of the hit in $\mu$s. Needed for pile-up events \\
409\end{tabular}
410\end{center}
411%
412On top of this, it is also stored in the {\tt TObject} bit field status word
413whether a hit is inside the drift or the amplification region
414(see {\tt AliTRDhit::FromDrift()} and {\tt AliTRDhit::FromAmplification()}).
415The creation of hits is steered by {\tt AliTRDv1::StepManager()}.
416%
417\subsection{Energy loss}
418%
419A charged particle, traversing the gas volume of the TRD chambers, will release
420charge proportional to its specific energy loss. In the TRD code this process
421is implemented in \\{\tt AliTRDv1::StepManager()}. This implementation used a
422fixed step size. The standard value here is 0.1~cm, but other values can be
423set via {\tt AliTRDv1::SetStepSize()}. The energy deposited in a given step is
424then calculated by the chosen MC program (typically Geant3.21), which after
425division by the ionization energy gives the number of electrons of the new hit.
426The version 2) will also work for an Ar/CO$_{2}$ mixture, which can be selected
427by \\{\tt AliTRDSimParam::SetArgon()}.
428%
429\subsection{Photons from transition radiation}
430%
0fa1a8ee 431Additionally to the hits from energy loss, also hits from the absorption of
883031eb 432TR photons are generated. This is done in {\tt AliTRDv1::CreateTRhit()}, which
433in turn is called by the chosen step manager for electrons and positrons
434entering the entering the drift volume. The process consists of two steps:
435first the number and energies of the TR photons have to be determined and then
0fa1a8ee 436their absorption position inside the gas volume has to be calculated. The
883031eb 437corresponding procedures, used by {\tt AliTRDv1::CreateTRhit()}, are
438implemented in {\tt AliTRDsimTR()}. This class contains a parametrization
439of TR photons generated by a regular foil stack radiator \cite{TRPHOT}. This
440parametrization has been tuned such that the resulting spectrum matches the
441one of the fiber radiator that used in reality. Since the TR production
442depends also on the momentum of the electron, the parameters have been
443adjusted in several momentum bins. After a TR photon has been generated and put
444on the particle stack, it is assumed that it follows a straight trajectory
445whose direction is determined by the momentum vector of the generating electron.
446Since the emission angle for TR photons is very small ($\sim 1/\gamma$) this
0fa1a8ee 447is a valid approximation. The absorption length, which thus determines the
448TR hit position, is randomly chosen according to the absorption cross sections
883031eb 449in the gas mixture. These energy dependent cross sections are also included
450in {\tt AliTRDsimTR}.
451%
452\subsection{Track references}
453%
454The TRD simulation produces track references ({\tt AliTrackReference}) each time
455a charged particle is entering the drift region and exiting the amplification
456region. These track references thus provide information on the position where
457the MC particle was entering and existing the sensitive region of a ROC, as well
458as on its momentum components at this positions. Also, the index to the MC particle
459in the kinematic tree is stored so that the full MC history can be retrieved.
460%
461\section{Digitization}
462%
463{\it Author: C.~Blume (blume@ikf.uni-frankfurt.de)}
464\smallskip
465\\
466%
467The second step in the simulation chain is the translation of the hit information,
468i.e. position and amount of deposited charge, into the final detector response
469that can be stored in digits objects ({\tt AliTRDdigits}):
470%
471\begin{center}
472\begin{tabular}{ll}
473{\tt fAmp} & Signal amplitude \\
474{\tt fId} & Number of the ROC ({\bf DET} number) \\
475{\tt fIndexInList} & Track index \\
476{\tt fRow} & Pad row number \\
477{\tt fColumn} & Pad column number \\
478{\tt fTime} & Time bin number \\
479\end{tabular}
480\end{center}
481%
0fa1a8ee 482However, in practice {\tt AliTRDdigits} is not used to store the digits
883031eb 483information. Instead the data containers described in \ref{DIGITS:containers}
484are used for this purpose. The digitization process includes as an
485intermediate step between hit and digits the so-called summable digits, or
486sdigits:
487\begin{center}
488\mbox{{\bf HITS} $\Longrightarrow$ {\bf SDIGITS} $\Longrightarrow$ {\bf DIGITS}}
489\end{center}
490They sdigits contain the detector signals before discretization and the addition
491of noise and are used to merge several events into a single one.
492%
493\subsection{Digitizer}
494%
495The class {\tt AliTRDdigitizer} contains all the necessary procedures to convert
496hits into sdigits and subsequently sdigits into digits. The standard sequence to
497produce sdigits, as would be initiated by {\tt AliSimulation}, is shown here:
498%
499\begin{center}
500\unitlength1.0cm
501\begin{picture}(10,9)
502\put(2.5,8.0){\framebox(5.0,0.8){{\tt MakeDigits()}}}
503\put(2.5,6.4){\framebox(5.0,0.8){{\tt SortHits()}}}
504\put(2.5,4.8){\framebox(5.0,0.8){{\tt ConvertHits(det)}}}
505\put(2.5,3.2){\framebox(5.0,0.8){{\tt ConvertSignals(det)}}}
506\put(2.5,1.6){\framebox(5.0,0.8){{\tt Signal2SDigits(det)}}}
507\put(2.5,0.0){\framebox(5.0,0.8){{\tt TRD.SDigits.root}}}
508\put(5.0,8.0){\vector(0,-1){0.8}}
509\put(5.0,6.4){\vector(0,-1){0.8}}
510\put(5.0,4.8){\vector(0,-1){0.8}}
511\put(5.0,3.2){\vector(0,-1){0.8}}
512\put(5.0,1.6){\vector(0,-1){0.8}}
513\put(5.0,1.2){\line(-1,0){4.0}}
514\put(1.0,1.2){\line(0,1){4.8}}
515\put(1.0,6.0){\vector(1,0){4.0}}
516\put(0.2,6.1){{\tt det=0-539}}
517\end{picture}
518\end{center}
519%
520The first function {\tt SortHits()} sorts the simulated hits according to
521their {\bf DET} number, so that the digitization procedures can be called
522for a single ROCs in the following loop. The function {\tt ConvertHits()}
523does the conversion of the hit information into a detector signal. In this
524procedure each electron of a given hit is in principle followed along its
525path from the position of the primary ionization towards the anode wire.
526The position of this electron can be modified by diffusion in the gas
527({\tt AliTRDdigitizer::Diffusion()}), ExB effect ({\tt AliTRDdigitizer::ExB()}),
0fa1a8ee 528and absorption ({\tt AliTRDdigitizer::Absorbtion()}, off per default).
883031eb 529The drift time of the electrons is also modified according to their distance
530to the corresponding anode wire position ({\tt AliTRDdigitizer::TimeStruct()}),
531since the electric field lines are not uniform inside the amplification region.
532This results in a non-isochronity of the drift time, which has been
533simulated with the GARFIELD program and the tabulated results of this
534simulation are used in the digitizing process to adjust the drift times
535accordingly. Once the position and the drift time of the electron at the
536anode wire plane are know, the signal induced on the pads can be calculated.
537This involves three effects: the pad response, which distributes the charge
0fa1a8ee 538on several pads ({\tt AliTRDdigitizer::PadResponse()}), the time response due
883031eb 539to the slow ion drift and the PASA response function, which distributes the
540charge onto the following time bins, ({\tt AliTRDdigitizer::TimeResponse()}),
0fa1a8ee 541and the cross talk between neighboring pads ({\tt AliTRDdigitizer::CrossTalk()}).
883031eb 542At the end of this procedure, the charge seen by each pad in each time bin
543is available. Also, the indices of maximally three MC particles in the kine
544tree contributing to a given pad signal are stored, so that in a later
545analysis it can be tested which particle generated what signal.
546As a next step the signals could either directly be converted into {\bf DIGITS},
547or, which is the default procedure, they are stored as {\bf SDIGITIS}.
0fa1a8ee 548The corresponding functions ({\tt AliTRDdigitizer::Signal2SDigits()} and
883031eb 549{\tt AliTRDdigitizer::Signal2ADC()}) are called from
0fa1a8ee 550{\tt AliTRDdigitizer::ConvertSignals()}, depending on the configuration.
883031eb 551The function {\tt AliTRDdigitizer::Signal2SDigits()} stores the signals as
552{\bf SDIGITS} in data structures of the type {\tt AliTRDarraySignal} (see
553section \ref{DIGITS:containers}).
554
555If desired, the {\bf SDIGITS} can now be added to the {\bf SDIGITS} from other
556simulated events, e.g. in order to embed a specific signal into a background
557event ({\tt AliTRDdigitizer::MergeSDigits()}). After this optional step, the
558{\bf SDIGITS} are finally being converted into {\bf DIGITS}. This process is
559steered by the function ({\tt AliTRDdigitizer::ConvertSDigits()}).
560%
561\begin{center}
562\unitlength1.0cm
563\begin{picture}(10,9)
564\put(2.5,8.0){\framebox(5.0,0.8){{\tt Exec()}}}
565\put(2.5,6.4){\framebox(5.0,0.8){{\tt SDigits2Digits()}}}
566\put(2.5,4.8){\framebox(5.0,0.8){{\tt MergeSDigits()}}}
567\put(2.5,3.2){\framebox(5.0,0.8){{\tt ConvertSDigits()}}}
568\put(2.5,1.6){\framebox(5.0,0.8){{\tt Signal2ADC(det)}}}
569\put(2.5,0.0){\framebox(5.0,0.8){{\tt TRD.Digits.root}}}
570\put(5.0,8.0){\vector(0,-1){0.8}}
571\put(5.0,6.4){\vector(0,-1){0.8}}
572\put(5.0,4.8){\vector(0,-1){0.8}}
573\put(5.0,3.2){\vector(0,-1){0.8}}
574\put(5.0,1.6){\vector(0,-1){0.8}}
575\put(5.0,1.2){\line(-1,0){4.0}}
576\put(1.0,1.2){\line(0,1){1.6}}
577\put(1.0,2.8){\vector(1,0){4.0}}
578\put(0.2,2.9){{\tt det=0-539}}
579\end{picture}
580\end{center}
581%
582The essential step in the final {\bf SDIGITS} $\Longrightarrow$ {\bf DIGITS}
583conversion is performed by the function {\tt AliTRDdigitizer::Signal2ADC()}.
584Here pad signals, that are stored as floats, are finally translated into
585integer ADC values. This conversion involves a number of parameters: the pad
586coupling and time coupling factors, the gain of the PASA and of the
587amplification at the anode wire, and the input range and baseline of the ADCs.
588The coupling factors take into account that only a fraction of the incoming
589signal is sampled in the digitization process. At this point also the relative
590gain factors derived from the calibration procedures for a given dataset will
591be used to distort the simulated data correspondingly. The noise is generated
592according to a Gaussian distribution of a given width and added to the output.
0fa1a8ee 593Finally, the converted signals are discretize into the ADC values of the
883031eb 594defined resolution. At this stage also the zero suppression mechanism is applied
595to the simulated ADC values ({\tt AliTRDdigitizer::ZS()}), in order to reduce
596the output volume (see section \ref{DIGITS:zs}). These {\bf DIGITS} can then
597serve as input to the raw data simulation (see section \ref{RAWSIM}).
598%
599\subsection{Simulation parameter}
600%
601The parameters that are needed to configure the digitization, are either
602read from the OCDB (e.g. calibration gain factors) or are taken from the
603parameter class {\tt AliTRDSimParam}. This class contains the default values
604of these parameters, but it can be configured in order to test different
605scenarios. The following table lists the available parameters:
606%
607\begin{center}
608\begin{tabular}{lll}
609Parameter & Description & Default value \\ \hline
610{\tt fGasGain} & Gas gain at the anode wire & 4000 \\
611{\tt fNoise} & Noise of the chamber readout & 1250 \\
612{\tt fChipGain} & Gain of the PASA & 12.4 \\
613{\tt fADCoutRange} & ADC output range (number of ADC channels) & 1023 (10bit) \\
614{\tt fADCinRange} & ADC input range (input charge) & 2000 (2V) \\
615{\tt fADCbaseline} & ADC intrinsic baseline in ADC channels & 0 \\
616{\tt fElAttachProb} & Probability for electron attachment per meter & 0 \\
617{\tt fPadCoupling} & Pad coupling factor & 0.46 \\
618{\tt fTimeCoupling} & Time coupling factor & 0.4 \\ \hline
619{\tt fDiffusionOn} & Switch for diffusion & kTRUE \\
620{\tt fElAttachOn} & Switch for electron attachment & kFALSE \\
621{\tt fTRFOn} & Switch for time response & kTRUE \\
622{\tt fCTOn} & Switch for cross talk & kTRUE \\
623{\tt fTimeStructOn} & Switch for time structure & kTRUE \\
624{\tt fPRFOn} & Switch for pad response & kTRUE \\
625{\tt fGasMixture} & Switch for gas mixture (0: Xe/CO2, 1: Ar/CO2) & 0 \\
626\end{tabular}
627\end{center}
628%
629\subsection{Digits manager}
630\label{DIGITS:manager}
631%
632{\it Author: H.~Leon~Vargas (hleon@ikf.uni-frankfurt.de)}
633\smallskip
634\\
635%
636The class {\tt AliTRDdigitsManager} handles arrays of data container
637objects in the form of ROOT's {\tt TObjArray}. Its main functionality
638is that it provides setters and getters for the information of each chamber.
639%
640\begin{figure}[htb]
641\begin{center}
642\includegraphics[width=0.85\textwidth]{plots/digitsmanager_containers.eps}
643\end{center}
644\caption{
645Data containers used in the class {\tt AliTRDdigitsManager}.
646}
647\label{FIG_DIG:manager}
648\end{figure}
649%
650\subsection{Data containers}
651\label{DIGITS:containers}
652%
653During simulation different kinds of information are created and stored
654in various data containers depending on their characteristics.
655These containers were designed with the idea of keeping the code as
656simple as possible and to ease its maintenance.
657The simulated signals or sdigits for a given row, column and time bin
658of each detector, as generated by \\ {\tt AliTRDdigitizer::ConvertHits()},
659are stored in an object of the class {\tt AliTRDarraySignal}. This
660class stores the data in an array of floating point values. In this
661case, the compression method takes as an argument a threshold. All the
662values equal or below that threshold will be set to zero during
663compression. The threshold can take any value greater or equal to zero.
664The sdigits data is used during event merging.
665
666In the simulation the information about the particles that generated the
667hits (index in kine tree) is stored for each detector in an object
668of the class {\tt AliTRDarrayDictionary}. In this case the information
669is stored in an array of integer values, which is initialized to -1.
670
671In the digitizer, the signals stored in the sdigits are converted
672afterwards into ADC values and kept in objects of the class
673{\tt AliTRDarrayADC}. This class saves the ADC values in an array of
674short values. The ADC range uses only the first 9 bits, bits 10 to 12
675are used to set the pad status. An uncompressed object of the class
676{\tt AliTRDarrayADC} should only contain values that are equal or
677greater than -1, because the compression algorithm of this class uses
678all the other negative values in the range of the short data type. The
679value -1 in the data array is used in the simulation to indicate where
680an ADC value was ``zero suppressed''. This is done in this way so we
681are be able to discriminate between real zeroes and suppressed zeroes.
682For the details of the use of pad status refer to the method
683{\tt AliTRDarrayADC::SetPadStatus()} in the implementation file of this class.
684%
685\subsection{Zero suppression}
686\label{DIGITS:zs}
687%
688{\it Author: H.~Leon~Vargas (hleon@ikf.uni-frankfurt.de)}
689\smallskip
690\\
691%
692The zero suppression algorithm was applied at the end of digitization
693in order to decrease the size of the digits file. The code is implemented
694in the class {\tt AliTRDmcmSim}. This algorithm is based on testing
695three conditions on the ADC values of three neighboring pads as seen
696in Fig.~\ref{FIG_DIG:zs} (for more information see the Data Indication
697subsection in the TRAP User Manual). The conditions are the following:\\
698
6991) Peak center detection:\\
700
701ADC-1(t) $\leq$ ADC(t) $\geq$ ADC+1(t)\\
702
7032) Cluster:\\
704
705ADC-1(t)+ADC(t)+ADC+1(t) $>$ Threshold\\
706
7073) Absolute Large Peak:\\
708
709ADC(t) $>$ Threshold\\
710
711If a given combination of these conditions is not fulfilled, the value ADC(t)
712is suppressed. The algorithm runs over all ADC values.
713%
714\begin{figure}[htb]
715\begin{center}
716\includegraphics[width=0.60\textwidth]{plots/zsuppression.eps}
717\end{center}
718\caption{
719Zero suppression code.
720}
721\label{FIG_DIG:zs}
722\end{figure}
723%
724\section{Raw Data Simulation}
725\label{RAWSIM}
726%
757c05c1 727\section{Trigger Simulation}
728\label{TRGSIM}
729{\it Author: J.~Klein (jklein@physi.uni-heidelberg.de)}
730\vspace{.3cm}
731
732The trigger generation chain of the TRD can be simulated within
733AliRoot as well. It contains several stages as in the real
734hardware (s. Fig.~\ref{fig:trgsim}).
735
736For each event the hits in the active volume are converted to
737digitized signals in the AliTRDdigitizer. The digital processing as
738done in the TRAP is simulated in its method \\
739{\tt RunDigitalProcessing()} calling the MCM simulation (in {\tt
740 AliTRDmcmSim}) which implements the filters, zero-suppression and
741tracklet calculation. Here the same integer arithmetics is used as in
742the real TRAP. The trigger-relevant preprocessed data, i.e. the
743tracklets, are stored using a dedicated loader. From there they are
744accessed by the GTU simulation which runs the stackwise tracking. The
745individual stages are discussed in more detail in the following
746sections.
747\begin{figure}
748\begin{center}
749\includegraphics[angle=0,width=0.9\textwidth]{plots/trgsim_ov}
750\end{center}
751\caption[Trigger simulation overview]{Overview of the trigger
752 simulation}
753\label{fig:trgsim}
754\end{figure}
755
756\subsection{MCM simulation}
757The MCM simulation is contained in {\tt AliTRDmcmSim}. This class
0fa1a8ee 758mimics the digital part of an MCM. It can be used for the simulation
757c05c1 759after digitization has been performed.
760
761Internally, an object of {\tt AliTRDmcmSim} can hold the data of
76221~ADC channels both raw and filtered. After the instantiation {\tt
763 Init()} has to be called to define the position of the MCM. Then,
764the data can be fed using either of the following methods:
765\begin{description}
766\item[{\tt SetData(Int\_t iadc, Int\_t *adc)}] ~\\ Set the data for the
767 given ADC channel {\it iadc} from an array {\it adc} containing the
768 data for all timebins.
769\item[{\tt SetData(Int\_t iadc, Int\_t it, Int\_t adc)}] ~\\ Set the data for the
770 given ADC channel {\it iadc} and timebin {\it it} to the value {\it adc}.
771\item[{\tt SetData(AliTRDarrayADC *adcArray)}] ~\\ Set the data for the
772 whole MCM from the digits array pointed to by {\it adcArray}.
773\item[{\tt LoadMCM(AliRunLoader *rl, Int\_t det, Int\_t rob, Int\_t mcm)}]
774 ~\\ This method automatically initializes the MCM for the specified
775 location and loads the relevant data via the runloader pointed by
776 {\it rl}.
777\end{description}
778
779After loading of the data the processing stages can be run
780individually:
781\begin{description}
782\item[{\tt Filter()}] ~\\ The pedestal, gain and tail cancellation filters
783 are run on the currently loaded raw data. The filter settings
784 (including bypasses) are used as configured in the TRAP
785 (s.~\ref{sec:trapcfg}). The unfiltered raw data is kept such that it
786 is possible to rerun Filter(), e.g. with different settings.
787\item[{\tt Tracklet()}] ~\\ The tracklet calculation operates on the
788 filtered data (which is identical to the unfiltered data if Filter()
789 was not called). First, the hits are calculated and the fit
790 registers filled. Subsequently, the straight line fits for the four
791 most promising tracklets are calculated.
792\item[{\tt ZSMapping()}] ~\\ This methods performs the zero-suppression
793 which can be based on different criteria (to be configured in the
794 TRAP).
795\end{description}
796
797The results of the MCM simulation can be accessed in different ways:
798\begin{description}
799\item[{\tt WriteData(AliTRDarrayADC *digits)}] ~\\ Hereby, the data are
800 written to the pointed digits array. It is part of the TRAP
801 configuration whether raw or filtered data is written (EBSF).
802\item[{\tt ProduceRawStream(UInt\_t *buf, Int\_t bufsize, UInt\_t
803 iEv)}] ~\\ Produce the raw data stream for this MCM as it will
804 appear in the raw data of the half-chamber.
805\item[{\tt ProduceTrackletStream(UInt\_t *buf, Int\_t bufsize)}] ~\\
806 Produce the raw stream of tracklets as they appear in raw data.
807\item[{\tt StoreTracklets()}] ~\\ The tracklets are stored via the
808 runloader. This has to be called explicitly, otherwise the tracklets
809 will not be written.
810\end{description}
811
812\subsection{TRAP configuration}
813\label{sec:trapcfg}
814The TRAP configuration is kept in {\tt AliTRDtrapConfig} which is
815implemented as singleton. After obtaining a pointer to the class by a
816call to {\tt AliTRDtrapConfig::Instance()} values can be changed and read by:
817\begin{description}
818\item[{\tt SetTrapReg(TrapReg\_t reg, Int\_t value, Int\_t det, Int\_t rob,
819 Int\_t mcm)}] ~\\ This sets the given TRAP register given as the
820 abbreviation from the TRAP manual with preceding 'k' (enum) to the
821 given value. If you specify {\it det}, {\it rob} or {\it mcm} the
822 values are changed for individual MCMs. Not specified the setting is
823 applied globally.
824\item[{\tt GetTrapReg(TrapReg\_t reg, Int\_t det, Int\_t rob, Int\_t mcm)}]
825 ~\\ This method gets the current value of the given TRAP
826 registers. If the values are set individually for different MCMs you
827 have to pass {\it det}, {\it rob} and {\it mcm}. Otherwise, these
828 parameters can be omitted.
829\item[{\tt PrintTrapReg(TrapReg\_t reg, Int\_t det, Int\_t rob, Int\_t mcm)}]
830 ~\\ It is similar to the preceding method but prints the information
831 to stdout.
832\end{description}
833
834The calculated tracklets can be stored by a call to {\tt AliTRDmcmSim::StoreTracklets()}.
835
836\subsection{Tracklet classes}
837In order to unify the different sources of tracklets, e.g. real data
838or simulation, all implementations of tracklets derive from the
839abstract base class {\tt AliTRDtrackletBase}. The following
840implementations are currently in use:
841\begin{description}
842\item[{\tt AliTRDtrackletWord}] ~\\ This class is meant to represent the
843 information as really available from the FEE, i.e. only a 32-bit
844 word and the information on the detector it was produced on.
845\item[{\tt AliTRDtrackletMCM}] ~\\ Tracklets of this type are produced in
846 the MCM simulation and contain additional MC information.
847\item[{\tt AliTRDtrackletGTU}] This class is used during the GTU tracking
848 and contains a pointer to a tracklet and information assigned to it
849 during the global tracking.
850\end{description}
851
852\subsection{GTU simulation}
853
854The simulation of the TRD global tracking on tracklets is steered by
855AliTRDgtuSim. This class provides all the interface. The following
856classes are involved:
857\begin{description}
858\item[{\tt AliTRDgtuParam}] ~\\ This class contains or generates the relevant
859 parameters used for the GTU tracking.
860\item[{\tt AliTRDgtuTMU}] ~\\ This class holds the actual tracking algorithm
861 as it runs in one Track Matching Unit (TMU) which corresponds to one
862 stack.
863\end{description}
864
865The GTU simulation can be run by calling {\tt
866 AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd)} where
867{\it loader} points to the TRD loader and {\it esd} to an ESD
868event. The latter can be omitted in which case the output is not
869written to the ESD. The tracklets are automatically retrieved via the
870loader and the found tracks of type {\tt AliTRDtrackGTU} are
871internally stored in a tree for which a getter exists to access. If a
872pointer to an {\tt AliESDEvent} is given, the tracks are also written
873to the ESD (as {\tt AliESDTrdTrack}). For this the method {\tt
874 AliTRDtrackGTU::CreateTrdTrack()} is used which creates the {\tt
875 AliESDTrdTrack} (with reduced information compared to {\tt
876 AliTRDtrackGTU}).
877
878\subsection{CTP interface}
879
880The interface to the central trigger is defined in {\tt
881 AliTRDTrigger}. This class is called automatically during simulation
882and produces the trigger inputs for TRD (in {\tt
883 CreateInputs()}). They are only considered if they are part of the
884used trigger configuration (e.g. GRP/CTP/p-p.cfg).
885
886The actual trigger generation has to be contained in {\tt
887 Trigger()}. Currently, the GTU simulation is run from here using the
888previously calculated tracklets. The generated tracks are stored and
889the trigger inputs are propagated to CTP. Which trigger classes make
890use of the TRD inputs has to be defined in the trigger configuration.
891%
883031eb 892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
893\newpage
894\setcounter{chapter}{2}
895\setcounter{section}{0}
757c05c1 896\Chapter{Reconstruction}\label{REC:}
897{\it Author: A.~Bercuci (A.Bercuci@gsi.de)}
883031eb 898\thispagestyle{empty}
899%
900\section{Raw Data Reading}
901%
757c05c1 902\section{Cluster Finding}\label{REC:CL:}
903%
bb774328 904\subsection[Cluster position reconstruction]{Cluster position reconstruction\footnote{The procedures described in this section are implemented in the functions
905{\tt AliTRDcluster::GetXloc()}, {\tt AliTRDcluster::GetYloc()},
906{\tt AliTRDcluster::GetSX()} and {\tt AliTRDcluster::GetSY()}.}}\label{REC:CL:rphi}
757c05c1 907{\it Author: A.~Bercuci (A.Bercuci@gsi.de)}
bb774328 908
909{\bf Calculation of cluster position in the radial direction} in local chamber coordinates (with respect to the anode wire
910position) is using the following parameters:\\
911 $t_0$ - calibration aware trigger delay $[\mu s]$\\
912 $v_d$ - drift velocity in the detector region of the cluster $[cm/\mu s]$\\
913 z - distance to the anode wire [cm]. By default average over the drift cell width\\
914 q \& $x_q$ - array of charges and cluster positions from previous clusters in the tracklet [a.u.]
915
916The estimation of the radial position is based on calculating the drift time and the drift velocity at the point of
917estimation. The drift time can be estimated according to the expression:
918\begin{equation}
919t_{drift} = t_{bin} - t_{0} - t_{cause}(x) - t_{TC}(q_{i-1}, q_{i-2}, ...)
920\end{equation}
0fa1a8ee 921where $t_0$ is the delay of the trigger signal. $t_{cause}$ is the causality delay between ionization electrons hitting
bb774328 922the anode and the registration of mean signal by the electronics - due to the rising time of the TRF
923A second order correction here comes from the fact that the time spreading of charge at anode is the convolution of
924TRF with the diffusion and thus cross-talk between clusters before and after local clusters changes with drift length.
925$t_{TC}$ is the residual charge from previous (in time) clusters due to residual tails after tail cancellation.
926This tends to push cluster forward and depends on the magnitude of their charge.
927
928The drift velocity varies with the drift length (and distance to anode wire) as described by cell structure simulation.
929Thus one, in principle, can calculate iteratively the drift length from the expression:
930\begin{equation}
931x = t_{drift}(x)*v_{drift}(x)
932\end{equation}
933In practice we use a numerical approach (see AliTRDcluster::GetXcorr() and Figure \ref{FIG_CLUSTER:Xcorr} left) to correct for anisochronity obtained from MC
934comparison (see AliTRDclusterResolution::ProcessSigma() for the implementation). Also the calibration of the 0 approximation (no x dependence)
935for $t_{cause}$ is obtained from MC comparisons and impossible to disentangle in real life from trigger delay.
936\begin{figure}[htb]
937\begin{center}
938\includegraphics[width=0.48\textwidth]{plots/clusterXcorr.eps}
939\includegraphics[width=0.48\textwidth]{plots/clusterYcorr.eps}
940\end{center}
941\caption{
942Correction of the radial and $r-\phi$ position of the TRD cluster.}
943\label{FIG_CLUSTER:Xcorr}
944\end{figure}
945
946For {\bf the calculation of the $r-\phi$ offset} of the cluster from the middle of the center pad three methods are implemented:
947 - Center of Gravity (COG) see AliTRDcluster::GetDYcog()
948 - Look-up Table (LUT) see AliTRDcluster::GetDYlut()
949 - Gauss shape (GAUS) see AliTRDcluster::GetDYgauss()
950In addition for the case of LUT method position corrections are also applied (see AliTRDcluster::GetYcorr() and Figure \ref{FIG_CLUSTER:Xcorr} right).
951
952One may calculate the $r-\phi$ offset, based on the gaussian approximation of the PRF, from the signals $q_{i-1}$, $q_i$ and $q_{i+1}$ in the 3 adiacent pads by:
953\begin{equation}
954y = \frac{1}{w_{1}+w_{2}} [{w_{1}({y_{0}-\frac{W}{2}+\frac{s^{2}}{W}ln\frac{q_{i}}{q_{i-1}}})+w_{2}({y_{0}+ \frac{W}{2}+\frac{s^{2}}{W}ln\frac{q_{i+1}}{q_{i}}}})]
955\end{equation}
956where W is the pad width, $y_0$ is the position of the middle of the center pad and $s^2$ is given by
957\begin{equation}
958s^{2} = s^{2}_{0} + s^{2}_{diff} (x,B) + \frac{tg^{2}(\phi-\alpha_{L})*l^{2}}{12}
959\end{equation}
960with $s_0$ being the PRF for 0 drift and track incidence phi equal to the lorentz angle $\alpha_L$ and the diffusion term being described by:
961\begin{equation}
962s_{diff} (x,B) = \frac{D_{L}\sqrt{x}}{1+({\omega\tau}^{2}})
963\end{equation}
964with x being the drift length. The weights $w_1$ and $w_2$ are taken to be $q_{i-1}^2$ and $q_{i+1}^2$ respectively.
965
966{\bf Determination of shifts by comparing with MC}\\
967
968The resolution of the cluster corrected for pad tilt with respect to MC in the $r-\phi$ (measuring) plane can be
969expressed by:
970\begin{eqnarray}
971\Delta y&=&w - y_{MC}(x_{cl})\\
972w &=& y_{cl}^{'} + h*(z_{MC}(x_{cl})-z_{cl})\\
973y_{MC}(x_{cl}) &=& y_{0} - dy/dx*x_{cl}\\
974z_{MC}(x_{cl}) &=& z_{0} - dz/dx*x_{cl}\\
975y_{cl}^{'} &=& y_{cl}-x_{cl}*tg(\alpha_{L})
976\end{eqnarray}
977where $x_{cl}$ is the drift length attached to a cluster, $y_{cl}$ is the $r-\phi$ coordinate of the cluster measured by
978charge sharing on adjacent pads and $y_0$ and $z_0$ are MC reference points (as example the track references at
979entrance/exit of a chamber). If we suppose that both $r-\phi$ (y) and radial (x) coordinate of the clusters are
980affected by errors we can write
981\begin{eqnarray}
982x_{cl} &=& x_{cl}^{*} + \delta x\\
983y_{cl} &=& y_{cl}^{*} + \delta y
984\end{eqnarray}
985where the starred components are the corrected values. Thus by definition the following quantity
986\begin{equation}
987\Delta y^{*}= w^{*} - y_{MC}(x_{cl}^{*})
988\end{equation}
989has 0 average over all dependency. Using this decomposition we can write:
500851ab 990\begin{equation}\label{EQ_CLUSTER:shift}
bb774328 991<\Delta y>=<\Delta y^{*}> + <\delta x * (dy/dx-h*dz/dx) + \delta y - \delta x * tg(\alpha_{L})>
992\end{equation}
993which can be transformed to the following linear dependence:
994\begin{equation}
995<\Delta y>= <\delta x> * (dy/dx-h*dz/dx) + <\delta y - \delta x * tg(\alpha_{L})>
996\end{equation}
997if expressed as function of dy/dx-h*dz/dx. Furtheremore this expression can be plotted for various clusters
998i.e. we can explicitely introduce the diffusion ($x_{cl}$) and drift cell - anisochronity ($z_{cl}$) dependences. From
999plotting this dependence and linear fitting it with:
1000\begin{equation}
1001<\Delta y>= a(x_{cl}, z_{cl}) * (dy/dx-h*dz/dx) + b(x_{cl}, z_{cl})
1002\end{equation}
1003the systematic shifts will be given by:
1004\begin{eqnarray}
1005\delta x (x_{cl}, z_{cl}) &=& a(x_{cl}, z_{cl})\\
1006\delta y (x_{cl}, z_{cl}) &=& b(x_{cl}, z_{cl}) + a(x_{cl}, z_{cl}) * tg(\alpha_{L})
1007\end{eqnarray}
1008In Figure \ref{FIG_CLUSTER:shift} left there is an example of such dependency.
1009\begin{figure}[htb]
1010\begin{center}
1011\includegraphics[width=0.48\textwidth]{plots/clusterShiftMethod.eps}
1012\includegraphics[width=0.48\textwidth]{plots/clusterSigmaMethod.eps}
1013\end{center}
1014\caption{
1015Linear relation to estimate radial and $r-\phi$ cluster shifts and error.}
1016\label{FIG_CLUSTER:shift}
1017\end{figure}
1018
1019The occurance of the radial shift is due to the following conditions \\
1020- the approximation of a constant drift velocity over the drift length (larger drift velocities close to
1021 cathode wire plane)\\
1022- the superposition of charge tails in the amplification region (first clusters appear to be located at the
1023 anode wire)\\
1024- the superposition of charge tails in the drift region (shift towards anode wire)\\
1025- diffusion effects which convolute with the TRF thus enlarging it\\
1026- approximate knowledge of the TRF (approximate measuring in test beam conditions) \\
1027The numerical results for ideal simulations for the radial are displayed in Figure \ref{FIG_CLUSTER:Xcorr}.
1028
500851ab 1029The representation of $dy=f(y_cen, x_drift| layer, \phi=tg(\alpha_L))$ can be also used to estimate the systematic shift in the $r-\phi$
1030coordinate resulting from imperfection in the cluster shape parameterization. From Eq. \ref{EQ_CLUSTER:shift} with $\phi=tg(\alpha_L)$ one gets:
1031\begin{eqnarray}
1032<\Delta y>&=& <\delta x> * (tg(\alpha_{L})-h*dz/dx) + <\delta y - \delta x * tg(\alpha_{L})>\\
1033<\Delta y>(y_{cen})&=& -h*<\delta x>(x_{drift}, q_{cl}) * dz/dx + \delta y(y_{cen}, ...)
1034\end{eqnarray}
1035where all dependences are made explicit. This last expression can be used in two ways:
1036 - by average on the dz/dx we can determine directly dy (the method implemented here - see Figure \ref{FIG_CLUSTER:Xcorr} right)
1037 - by plotting as a function of dzdx one can determine both dx and dy components in an independent method.
bb774328 1038The occurance of the $r-\phi$ shift is due to the following conditions:\\
1039 - approximate model for cluster shape (LUT)\\
1040 - rounding-up problems
1041
1042
1043\subsection[Cluster error parameterization]{Cluster error parametrization\footnote{The procedures described in this section are implemented in the functions
1044{\tt AliTRDcluster::SetSigmaY2()}, {\tt AliTRDclusterResolution::ProcessCharge()}, {\tt AliTRDclusterResolution::ProcessCenterPad()}, {\tt AliTRDclusterResolution::ProcessSigma()} and {\tt AliTRDclusterResolution::ProcessMean()}.}}\label{REC:CL:error}
1045{\it Author: A.~Bercuci (A.Bercuci@gsi.de)}
1046
1047The error of TRD cluster is represented by the variance in the $r-\phi$ and radial direction. For the z direction the error is simply given by:
1048\begin{equation}
1049\sigma^2_z=L^2_{pad}/12
1050\end{equation}
1051
1052The parameters on which the {\bf $r-\phi$ error parameterization} depends are:\\
1053 - $s^2$ - variance due to PRF width for the case of Gauss model. Replaced by parameterization in case of LUT.\\
0fa1a8ee 1054 - dt - transversal diffusion coefficient\\
bb774328 1055 - exb - tg of lorentz angle\\
1056 - x - drift length - with respect to the anode wire\\
1057 - z - offset from the anode wire\\
1058 - tgp - local tangent of the track momentum azimuthal angle\\
1059
1060The ingredients from which the error is computed are:\\
1061 - PRF (charge sharing on adjacent pads) - see AliTRDcluster::GetSYprf()
1062 - diffusion (dependence with drift length and [2nd order] distance to anode wire) - see AliTRDcluster::GetSYdrift()\\
1063 - charge of the cluster (complex dependence on gain and tail cancellation) - see AliTRDcluster::GetSYcharge()\\
1064 - lorentz angle (dependence on the drift length and [2nd order] distance to anode wire) - see AliTRDcluster::GetSX()\\
1065 - track angle (superposition of charges on the anode wire) - see AliTRDseedV1::Fit()\\
1066 - projection of radial(x) error on $r-\phi$ due to fixed value assumed in tracking for x - see AliTRDseedV1::Fit()\\
1067
1068The last 2 contributions to cluster error can be estimated only during tracking when the track angle
1069is known (tgp). For this reason the errors (and optional position) of TRD clusters are recalculated during
1070tracking and thus clusters attached to tracks might differ from bare clusters.
1071
1072Taking into account all contributions one can write the the TRD cluster error parameterization as:
1073\begin{equation}\label{EQ_CLUSTER:error}
1074\sigma_{y}^{2} = (\sigma_{diff}*Gauss(0, s_{ly}) + \delta_{\sigma}(q))^{2} + tg^{2}(\alpha_{L})*\sigma_{x}^{2} + tg^{2}(\phi-\alpha_{L})*\sigma_{x}^{2}+[tg(\phi-\alpha_{L})*tg(\alpha_{L})*x]^{2}/12
1075\end{equation}
1076From this formula one can deduce that the simplest calibration method for PRF and diffusion contributions is
1077by measuring resolution at B=0T and phi=0. To disentangle further the two remaining contributions one has
1078to represent $s^2$ as a function of drift length.
1079
1080In the gaussian model the diffusion contribution can be expressed as:
1081\begin{equation}
1082\sigma^{2}_{y} = \sigma^{2}_{PRF} + \frac{x\delta_{t}^{2}}{(1+tg(\alpha_{L}))^{2}}
1083\end{equation}
1084thus resulting the PRF contribution. For the case of the LUT model both contributions have to be determined from
500851ab 1085the fit (see AliTRDclusterResolution::ProcessCenterPad() for details).\\
bb774328 1086
1087{\bf Parameterization with respect to the distance to the middle of the center pad}\\
1088
1089If $\phi = \alpha_L$ in Eq. \ref{EQ_CLUSTER:error} one gets the following expression:
1090\begin{equation}\label{EQ_CLUSTER:errorPhiAlpha}
1091\sigma_{y}^{2} = \sigma_{y}^{2}|_{B=0} + tg^{2}(\alpha_{L})*\sigma_{x}^{2}
1092\end{equation}
1093where we have explicitely marked the remaining term in case of absence of magnetic field. Thus one can use the
1094previous equation to estimate $s_y$ for B=0 and than by comparing in magnetic field conditions one can get the $s_x$.
1095This is a simplified method to determine the error parameterization for $s_x$ and $s_y$ as compared to the one
1096implemented in ProcessSigma(). For more details on cluster error parameterization please see also
500851ab 1097AliTRDcluster::SetSigmaY2().\\
bb774328 1098
1099{\bf Parameterization with respect to drift length and distance to the anode wire}\\
1100
500851ab 1101As the $r-\phi$ coordinate is the only one which is measured by the TRD detector we have to rely on it to
1102estimate both the radial (x) and $r-\phi$ (y) errors. This method is based on the following assumptions.
1103The measured error in the y direction is the sum of the intrinsic contribution of the $r-\phi$ measurement
1104with the contribution of the radial measurement - because x is not a parameter of Alice track model (Kalman).
1105\begin{equation}
1106\sigma^{2}|_{y} = \sigma^{2}_{y*} + \sigma^{2}_{x*}
1107\end{equation}
1108In the general case
1109\begin{eqnarray}
1110\sigma^{2}_{y*}& =& \sigma^{2}_{y} + tg^{2}(\alpha_{L})\sigma^{2}_{x_{drift}}\\
1111\sigma^{2}_{x*} &=& tg^{2}(\phi - \alpha_{L})*(\sigma^{2}_{x_{drift}} + \sigma^{2}_{x_{0}} + tg^{2}(\alpha_{L})*x^{2}/12)
1112\end{eqnarray}
1113where we have explicitely show the lorentz angle correction on y and the projection of radial component on the y
1114direction through the track angle in the bending plane ($\phi$). Also we have shown that the radial component in the
1115last equation has two terms, the drift and the misalignment ($x_0$). For ideal geometry or known misalignment one
1116can solve the equation
1117\begin{equation}
1118\sigma^{2}|_{y} = tg^{2}(\phi - \alpha_{L})*(\sigma^{2}_{x} + tg^{2}(\alpha_{L})*x^{2}/12)+ [\sigma^{2}_{y} + tg^{2}(\alpha_{L})\sigma^{2}_{x}]
1119\end{equation}
1120by fitting a straight line:
1121\begin{equation}
1122\sigma^{2}|_{y} = a(x_{cl}, z_{cl}) * tg^{2}(\phi - \alpha_{L}) + b(x_{cl}, z_{cl})
1123\end{equation}
1124the error parameterization will be given by:
1125\begin{eqnarray}
1126\sigma_{x} (x_{cl}, z_{cl}) &=& \sqrt{a(x_{cl}, z_{cl}) - tg^{2}(\alpha_{L})*x^{2}/12}\\
1127\sigma_{y} (x_{cl}, z_{cl}) &=& \sqrt{b(x_{cl}, z_{cl}) - \sigma^{2}_{x} (x_{cl}, z_{cl}) * tg^{2}(\alpha_{L})}
1128\end{eqnarray}
1129In Figure \ref{FIG_CLUSTER:shift} left, there is an example of such dependency.
1130
1131The error parameterization obtained by this method are implemented in the functions AliTRDcluster::GetSX() and
1132AliTRDcluster::GetSYdrift().
1133
1134An independent method to determine $s_y$ as a function of drift length (see AliTRDclusterResolution::ProcessCenterPad()) is to plot cluster resolution as a function of drift length at $\phi = \alpha_L$ as seen in Eq. \ref{EQ_CLUSTER:errorPhiAlpha}. Thus one can use directly the
1135previous equation to estimate $s_y$ for $B=0$ and than by comparing in magnetic field conditions one can get the $s_x$.
1136
1137One has to keep in mind that while the first method returns the mean $s_y$ over the distance
1138to the middle of center pad ($y_{center}$) distribution the second method returns the *STANDARD* value at $y_{center}=0$ (maximum). To recover the
1139standard value one has to solve the obvious equation:
1140\begin{equation}
1141\sigma_{y}^{STANDARD} = \frac{<\sigma_{y}>}{\int{s exp(s^{2}/\sigma) ds}}
1142\end{equation}
1143with "$<s_y>$" being the value calculated in first method and "sigma" the width of the $s_y$ distribution calculated in the second.\\
1144
bb774328 1145{\bf Parameterization with respect to cluster charge}\\
1146
1147In Eq. \ref{EQ_CLUSTER:errorPhiAlpha} one can explicitely write:
1148\begin{equation}
1149\sigma_{y}|_{B=0} = \sigma_{diff}*Gauss(0, s_{ly}) + \delta_{\sigma}(q)
1150\end{equation}
1151which further can be simplified to:
1152\begin{eqnarray}
1153<\sigma_{y}|_{B=0}>(q) &=& <\sigma_{y}> + \delta_{\sigma}(q)\\
1154<\sigma_{y}> &=& \int{f(q)\sigma_{y}dq}
1155\end{eqnarray}
1156The results for $s_y$ and $f(q)$ are displayed in Figure \ref{FIG_CLUSTER:errorCharge}:
1157\begin{figure}[htb]
1158\begin{center}
1159\includegraphics[width=0.48\textwidth]{plots/clusterQerror.eps}
500851ab 1160\includegraphics[width=0.48\textwidth]{plots/clusterSX.eps}
1161\includegraphics[width=0.48\textwidth]{plots/clusterSY.eps}
bb774328 1162\end{center}
1163\caption{
1164Cluster error parameterization for different components.}
1165\label{FIG_CLUSTER:errorCharge}
1166\end{figure}
0fa1a8ee 1167The function has to extended to accommodate gain calibration scaling and errors.
bb774328 1168
757c05c1 1169%
1170\setcounter{footnote}{0}
500851ab 1171\section{The TRD tracklet}\label{REC:Tracklet:}
1172{\it Author: A.~Bercuci (A.Bercuci@gsi.de)}\\
757c05c1 1173
1174\noindent
1175The tracking in TRD can be done in two major ways:
1176\begin{itemize}
1177\item Track prolongation from TPC.
1178\item Stand alone track finding.
1179\end{itemize}
1180The first mode is the main tracking mode for all barrel tracks while the second
1181is used to peak-up track segments fully contained in the TRD fiducial volume
1182like conversions. Another feature of the TRD tracking besides the relative high
1183thickness (conversions) is the spatial correlation of the signals in the radial
1184direction due to residual tails in the cluster signals. This feature asked for
1185an intermediate step between clusters and tracks, the tracklets. The TRD
1186tracklets are linear fits of the clusters from one chamber. They are implemented
1187in the class {\tt AliTRDseedV1} and they represent the core of the TRD offline
1188reconstruction. In the following the tracklets will be described independently
1189of the framework in which they are living (tracking) in the sections
1190\ref{REC:Tracking:TrackletAttach}, \ref{REC:Tracking:TrackletFit} and
1191\ref{REC:Tracking:TrackletErrors} and than their usage will be outlined in the
1192barrel (section \ref{REC:Tracking:Propagate}) and stand alone tracking (section
1193\ref{REC:Tracking:Clusters2TracksStack}).
1194
bb774328 1195\subsection[Tracklet building]{Tracklet building - Attaching clusters to tracklet\footnote{The
757c05c1 1196procedures described in this section are implemented in the function
1197{\tt AliTRDseedV1::AttachClusters()}.}}\label{REC:Tracking:TrackletAttach}
1198
bb774328 1199Projective algorithm to attach clusters to seeding tracks. The following steps are performed :\\
12001. Collapse x coordinate for the full detector along track direction dydx.\\
12012. truncated mean on y (r-phi) direction\\
12023. purge clusters\\
12034. truncated mean on z direction\\
12045. purge clusters\\
0fa1a8ee 1205Optionally one can use the z, dz/dx information from the seeding track to correct for tilting.
bb774328 1206
1207We start up by defining the track direction in the xy plane and roads. The roads are calculated based
1208on tracking information (variance in the $r-\phi$ direction) and estimated variance of the standard
1209clusters (see AliTRDcluster::SetSigmaY2()) corrected for tilt (see GetCovAt()). From this the road is.
1210\begin{eqnarray}
1211r_{y} &=& 3*\sqrt{12*(\sigma^{2}_{Trk}(y) + \frac{\sigma^{2}_{cl}(y) + tg^{2}(\alpha_{L})\sigma^{2}_{cl}(z)}{1+tg^{2}(\alpha_{L})})}\\
1212r_{z} &= &1.5*L_{pad}
1213\end{eqnarray}
1214
1215\subsection[Tracklet fitting]{Tracklet fitting\footnote{The procedures described in this
757c05c1 1216section are implemented in the function {\tt AliTRDseedV1::Fit()}.}}\label{REC:Tracking:TrackletFit}
1217
1218{\bf Fit in the xy plane}\\
1219
1220The fit is performed to estimate the y position of the tracklet and the track
1221angle in the bending plane. The clusters are represented in the chamber coordinate
1222system (with respect to the anode wire - see {\tt AliTRDtrackerV1::FollowBackProlongation()}
1223on how this is set). The $x$ and $y$ position of the cluster and also their variances
1224are known from clusterizer level (see {\tt AliTRDcluster::GetXloc()},
1225{\tt AliTRDcluster::GetYloc()}, {\tt AliTRDcluster::GetSX()} and \\
1226{\tt AliTRDcluster::GetSY()}). If a Gaussian approximation is used to calculate
1227$y$ coordinate of the cluster the position is recalculated taking into account the
1228track angle.
1229
1230Since errors are calculated only in the $y$ directions, radial errors ($x$ direction)
1231are mapped to $y$ by projection i.e.
1232\begin{equation}
1233\sigma_{x|y} = tg(\phi) \sigma_{x}
1234\end{equation}
1235and also by the Lorentz angle correction.\\
1236
1237{\bf Fit in the xz plane}\\
1238
1239The "fit" is performed to estimate the radial position ($x$ direction) where pad
1240row cross happens. If no pad row crossing the $z$ position is taken from geometry
1241and radial position is taken from the xy fit (see below).
1242
1243There are two methods to estimate the radial position of the pad row cross:\\
12441. leading cluster radial position : Here the lower part of the tracklet is
1245considered and the last cluster registered (at radial $x_{0}$) on this segment
1246is chosen to mark the pad row crossing. The error of the $z$ estimate is given by :
1247\begin{equation}
500851ab 1248\sigma_{z} = tg(\theta) \Delta x_{x_{0}}/\sqrt{12}
757c05c1 1249\end{equation}
1250The systematic errors for this estimation are generated by the following sources:
1251 - no charge sharing between pad rows is considered (sharp cross)
1252 - missing cluster at row cross (noise peak-up, under-threshold signal etc.).
1253\\
12542. charge fit over the crossing point : Here the full energy deposit along
1255the tracklet is considered to estimate the position of the crossing by a fit
1256in the qx plane. The errors in the q directions are parameterized as
1257$\sigma_q = q^2$. The systematic errors for this estimation are generated by the
1258following sources:
1259 - no general model for the qx dependence
1260 - physical fluctuations of the charge deposit
1261 - gain calibration dependence.\\
1262
1263{\bf Estimation of the radial position of the tracklet}\\
1264
1265For pad row cross the radial position is taken from the xz fit (see above).
1266Otherwise it is taken as the interpolation point of the tracklet i.e. the
1267point where the error in $y$ of the fit is minimum. The error in the $y$
1268direction of the tracklet is (see {\tt AliTRDseedV1::GetCovAt()}):
1269\begin{equation}
1270\sigma_{y} = \sigma^{2}_{y_{0}} + 2x\:cov(y_{0}, dy/dx) + \sigma^{2}_{dy/dx}
1271\end{equation}
1272and thus the radial position is:
1273\begin{equation}
1274x = - cov(y_{0}, dy/dx)/\sigma^{2}_{dy/dx}
1275\end{equation}
1276
1277{\bf Estimation of tracklet position error}\\
1278
1279The error in $y$ direction is the error of the linear fit at the radial
1280position of the tracklet while in the $z$ direction is given by the cluster
1281error or pad row cross error. In case of no pad row cross this is given by:
1282\begin{eqnarray}
500851ab 1283\sigma_{y} &=& \sigma^{2}_{y_{0}} - 2cov^{2}(y_{0}, dy/dx)/\sigma^{2}_{dy/dx} + \sigma^{2}_{dy/dx}\\
1284\sigma_{z} &=& L_{pad}/\sqrt{12}
757c05c1 1285\end{eqnarray}
1286For pad row cross the full error is calculated at the radial position of the
1287crossing (see above) and the error in $z$ by the width of the crossing region -
1288being a matter of parameterization.
1289\begin{equation}
500851ab 1290\sigma_{z} = tg(\theta) \Delta x_{x_{0}}/\sqrt{12}
757c05c1 1291\end{equation}
1292In case of no tilt correction (default in the barrel tracking) the tilt is
1293taken into account by the rotation of the covariance matrix. See
1294{\tt AliTRDseedV1::GetCovAt()} or \ref{REC:Tracking:TrackletErrors} for details.
1295
bb774328 1296\subsection[Tracklet errors]{Tracklet errors\footnote{The procedures described in this
757c05c1 1297section are implemented in the function {\tt AliTRDseedV1::GetCovAt()}.}}\label{REC:Tracking:TrackletErrors}
1298
500851ab 1299In general, for the linear transformation
757c05c1 1300\begin{equation}
1301Y = T_{x} X^{T}
1302\end{equation}
500851ab 1303the error propagation has the general form
757c05c1 1304\begin{equation}
1305C_{Y} = T_{x} C_{X} T_{x}^{T}
1306\end{equation}
1307We apply this formula 2 times. First to calculate the covariance of the tracklet
1308at point $x$ we consider:
1309\begin{eqnarray}
1310T_{x} &=& (1\; x)\\
1311X&=&(y0\; dy/dx)\\
1312C_{X}&=&
1313 \left( \begin{array}{cc}
1314 Var(y0) & Cov(y0, dy/dx)\\
1315 Cov(y0, dy/dx) & Var(dy/dx)
1316 \end{array} \right)
1317\end{eqnarray}
1318and secondly to take into account the tilt angle
1319\begin{eqnarray}
1320T_{\alpha}& = &
1321 \left( \begin{array}{cc}
1322 cos(\alpha)&sin(\alpha)\\
1323 -sin(\alpha)& cos(\alpha)
1324 \end{array} \right)\\
1325X&=&(y\; z)\\
1326C_{X}&=&
1327 \left( \begin{array}{cc}
1328 Var(y) &0\\
1329 0 &Var(z)
1330 \end{array} \right)
1331\end{eqnarray}
0fa1a8ee 1332using simple trigonometric one can write for this last case
757c05c1 1333\begin{equation}
1334C_{Y}=\frac{1}{1+tg^{2}\alpha}
1335 \left( \begin{array}{cc}
1336 \sigma_{y}^{2}+tg^{2}(\alpha)\sigma_{z}^{2} & tg(\alpha)(\sigma_{z}^{2}-\sigma_{y}^{2})\\
1337 tg(\alpha)(\sigma_{z}^{2}-\sigma_{y}^{2}) & \sigma_{z}^{2}+tg^{2}(\alpha)\sigma_{y}^{2}
1338 \end{array} \right)
1339\end{equation}
0fa1a8ee 1340which can be approximated for small alphas (2 deg) with
757c05c1 1341\begin{equation}
1342C_{Y}=
1343 \left( \begin{array}{cc}
1344 \sigma_{y}^{2} & (\sigma_{z}^{2}-\sigma_{y}^{2})tg(\alpha)\\
1345 ((\sigma_{z}^{2}-\sigma_{y}^{2})tg(\alpha) & \sigma_{z}^{2}
1346 \end{array} \right)
1347\end{equation}
1348before applying the tilt rotation we also apply systematic uncertainties
1349to the tracklet position which can be tuned from outside via the
1350{\tt AliTRDrecoParam::SetSysCovMatrix()}. They might account for extra
1351misalignment/miscalibration uncertainties.
1352
500851ab 1353\subsection[Tracklet dE/dx]{Energy loss calculations\footnote{The procedures described in this
1354section are implemented in the function {\tt AliTRDseedV1::CookdEdx()} and {\tt AliTRDseedV1::GetdQdl()}.}}\label{REC:Tracking:TrackletdEdx}
1355
1356Using the linear approximation of the track inside one TRD chamber (TRD tracklet)
1357the charge per unit length can be written as:
1358\begin{equation}
1359\frac{dq}{dl}(x) = \frac{q_{c}}{dx(x) * \sqrt{1 + (\frac{dy}{dx})^{2}_{fit} + (\frac{dz}{dx})^{2}_{ref}}}
1360\end{equation}
1361where $q_c$ is the total charge collected in the current time bin and dx is the length
0fa1a8ee 1362of the time bin (see Figure \ref{FIG_TRACKLET:dEdx} right). The representation of charge deposit used for PID differs thus in principle from the measured dQ/dt distribution (see Figure \ref{FIG_TRACKLET:dEdx} left)
500851ab 1363\begin{figure}[htb]
1364\begin{center}
6ec1bbe7 1365\includegraphics[width=0.88\textwidth, height=0.45\textwidth]{plots/trackletDQDT.eps}
500851ab 1366\end{center}
1367\caption{
0fa1a8ee 1368Energy loss measurement on the tracklet as a function of drift time [left] and respectively drift length [right] for different particle species.}
500851ab 1369\label{FIG_TRACKLET:dEdx}
6ec1bbe7 1370\end{figure}
500851ab 1371The following correction are applied :
1372 - charge : pad row cross corrections
0fa1a8ee 1373 [diffusion and TRF asymmetry] TODO
500851ab 1374 - dx : anisochronity.
1375Due to anisochronity of the TRD detector drift velocity varies as function of drift length and distance to the anode wire. Thus
1376\begin{eqnarray}
1377dx(x) &=& dx(\inf) + \delta_x(x,z)\\
1378 &=& dt*v_d^{\inf} + \delta_x(x,z)
1379\end{eqnarray}
1380the dependence of $\delta_x$ can be found in Figure \ref{FIG_CLUSTER:Xcorr}.
1381
6ec1bbe7 1382\subsection[Tracklet PID]{Particle identification\footnote{The procedures described in this
1383section are implemented in the function {\tt AliTRDtrackV1::CookPID()} and {\tt AliTRDseedV1::CookPID()}.}}\label{REC:Tracking:TrackletPID}
1384
1385Retrieve PID probabilities for $e^\pm$, $\mu^\pm$, $K^\pm$, $\pi^\pm$ and $p^\pm$ from the DB according to tracklet information:
1386\begin{itemize}
1387\item[-] estimated momentum at tracklet reference point
1388\item[-] dE/dx measurements
1389\item[-] tracklet length
1390\item[-] TRD layer
1391\end{itemize}
1392According to the steering settings specified in the reconstruction one of the following methods are used.\\
1393- Neural Network [default] - option "nn"\\
1394- 2D Likelihood - option "!nn"\\
1395\begin{figure}[htb]
1396\begin{center}
1397\includegraphics[width=0.88\textwidth, height=0.45\textwidth]{plots/trackPID.eps}
1398\end{center}
1399\caption{
1400Pion efficiency capability of TRD for tracks with 6 tracklets as a function of momentum [left] and the corresponding threshold value for selecting $90\%$ of electrons [right] for the two methods used defined in TRD.}
1401\label{FIG_TRACK:PID}
1402\end{figure}
1403
1404At track level the PID information is calculated by delegating the omonim function of the tracklets.
1405The number of tracklets used is also computed. The tracklet information are considered independent.
1406For the moment no global track measurement of PID is performed as for example to estimate
1407bremsstrahlung probability based on global $\chi^2$ of the track. The status bit AliESDtrack::kTRDpid is set during the call of AliTRDtrackV1::UpdateESDtrack().The PID performance of the TRD for tracks with 6 tacklets is displayed in Figure \ref{FIG_TRACK:PID}. \\
1408
1409
500851ab 1410\setcounter{footnote}{0}
1411\section{Tracking}\label{REC:Tracking:}
1412{\it Author: A.~Bercuci (A.Bercuci@gsi.de)}\\
1413
1414The tracking procedures in TRD are responsible to attach clusters to tracks
1415and to estimate/update the track parameters accordingly. The main class involved
1416in this procedure is {\tt AliTRDtrackerV1} and the helper classes {\tt AliTRDcluster},
1417{\tt AliTRDseedV1} and {\tt AliTRDtrackV1}. Additionally, information from
1418{\tt AliTRDrecoParam} is mandatory to select the proper setup of the reconstruction.
1419\\
1420
bb774328 1421\subsection[Track propagation barrel]{Track propagation in barrel tracking\footnote{The
757c05c1 1422procedures described in this section are implemented in the function
1423{\tt AliTRDtrackerV1::PropagateBack()}.}}\label{REC:Tracking:Propagate}
1424
6ec1bbe7 1425Propagate the ESD tracks from TPC to TOF detectors and building of the TRD track. For building
1426a TRD track an ESD track is used as seed. The informations obtained on the TRD track (measured points,
1427covariance, PID, etc.) are than used to update the corresponding ESD track.
1428Each track seed is first propagated to the geometrical limit of the TRD detector.
1429Its prolongation is searched in the TRD and if corresponding clusters are found tracklets are
1430constructed out of them (see AliTRDseedV1::AttachClusters()) and the track is updated.
1431Otherwise the ESD track is left unchanged.
1432
1433The following steps are performed:
1434\begin{itemize}
1435\item[1.] Selection of tracks based on the variance in the y-z plane.
1436\item[2.] Propagation to the geometrical limit of the TRD volume. If track propagation fails the AliESDtrack::kTRDStop is set.
1437\item[3.] Prolongation inside the fiducial volume (see AliTRDtrackerV1::FollowBackProlongation()) and marking
1438the following status bits:
1439 \begin{itemize}
1440 \item[a.] AliESDtrack::kTRDin - if the tracks enters the TRD fiducial volume
1441 \item[b.] AliESDtrack::kTRDStop - if the tracks fails propagation
1442 \item[c.] AliESDtrack::kTRDbackup - if the tracks fulfills chi2 conditions and qualify for refitting
1443 \end{itemize}
1444\item[4.] Writting to friends, PID, MC label, quality etc. Setting status bit AliESDtrack::kTRDout.
1445\item[5.] Propagation to TOF. If track propagation fails the AliESDtrack::kTRDStop is set.
1446\end{itemize}
1447
757c05c1 1448{\bf TRD Tracklet initialization and Kalman fit}\footnote{The procedures
1449described in this section are implemented in the function
1450{\tt AliTRDtrackerV1::FollowBackProlongation()}.}\\
1451
6ec1bbe7 1452Starting from the arbitrary radial position of the track this is
1453extrapolated through the 6 TRD layers. The following steps
1454are being performed for each layer:
1455\begin{itemize}
1456\item[1.] Propagate track to the entrance of the next chamber:\\
1457 - get chamber limits in the radial direction\\
1458 - check crossing sectors \\
1459 - check track inclination\\
1460 - check track prolongation against boundary conditions (see exclusion boundaries on AliTRDgeometry::IsOnBoundary())
1461\item[2.] Build tracklet (see AliTRDseed::AttachClusters() for details) for this layer if needed. If only
1462 Kalman filter is needed and tracklets are already linked to the track this step is skipped.
1463\item[3.] Fit tracklet using the information from the Kalman filter.
1464\item[4.] Propagate and update track at reference radial position of the tracklet.
1465\item[5.] Register tracklet with the tracker and track; update pulls monitoring.
1466\end{itemize}
1467
1468During the propagation a bit map is filled detailing the status of the track in each TRD chamber.\\
1469- AliTRDtrackV1::kProlongation : track prolongation failed\\
1470- AliTRDtrackV1::kPropagation : track prolongation failed\\
1471- AliTRDtrackV1::kAdjustSector : failed during sector crossing\\
1472- AliTRDtrackV1::kSnp : too large bending\\
1473- AliTRDtrackV1::kTrackletInit : fail to initialize tracklet\\
1474- AliTRDtrackV1::kUpdate : fail to attach clusters or fit the tracklet\\
1475- AliTRDtrackV1::kUnknown : anything which is not covered before\\
1476By default the status of the track before first TRD update is saved.
1477
bb774328 1478\subsection[Stand alone track finding]{Stand alone track finding\footnote{The procedures
757c05c1 1479described in this section are implemented in the function
1480{\tt AliTRDtrackerV1::Clusters2TracksStack()}.}}\label{REC:Tracking:Clusters2TracksStack}
1481
6ec1bbe7 1482Seeding tracklets and build candidate TRD tracks. The procedure is used during barrel tracking to account for tracks which are
1483either missed by TPC prolongation or are conversions inside the TRD volume.
1484For stand alone tracking the procedure is used to estimate all tracks measured by TRD.
1485
757c05c1 1486{\bf TRD track finding}\footnote{The procedures described in this section
1487are implemented in the function {\tt AliTRDtrackerV1::MakeSeeds()}.}
6ec1bbe7 1488
1489The following steps are performed:
1490\begin{itemize}
1491\item[1.] Build seeding layers by collapsing all time bins from each of the four seeding chambers along the
1492radial coordinate. See AliTRDtrackingChamber::GetSeedingLayer() for details. The chambers selection for seeding
1493is described in AliTRDtrackerV1::Clusters2TracksStack().
1494\item[2.] Using the seeding clusters from the seeding layer (step 1) build combinatorics using the following algorithm:\\
1495- for each seeding cluster in the lower seeding layer find\\
1496- all seeding clusters in the upper seeding layer inside a road defined by a given phi angle. The angle
1497 is calculated on the minimum pt of tracks from vertex accesible to the stand alone tracker.\\
1498- for each pair of two extreme seeding clusters select middle upper cluster using roads defined externally by the
1499 reco params\\
1500- select last seeding cluster as the nearest to the linear approximation of the track described by the first three
1501 seeding clusters.
1502 The implementation of road calculation and cluster selection can be found in the functions AliTRDchamberTimeBin::BuildCond()
1503 and AliTRDchamberTimeBin::GetClusters().
1504\item[3.] Helix fit of the seeding clusters set. (see AliTRDtrackerFitter::FitRieman(AliTRDcluster**)). No tilt correction is
1505 performed at this level
1506\item[4.] Initialize seeding tracklets in the seeding chambers.
1507\item[5.] {\bf Filter 0} Chi2 cut on the Y and Z directions. The threshold is set externally by the reco params.
1508\item[6.] Attach (true) clusters to seeding tracklets (see AliTRDseedV1::AttachClusters()) and fit tracklet (see
1509 AliTRDseedV1::Fit()). The number of used clusters used by current seeds should not exceed ... (25).
1510\item[7.] {\bf Filter 1} Check if all 4 seeding tracklets are correctly constructed.
1511\item[8.] Helix fit of the clusters from the seeding tracklets with tilt correction. Refit tracklets using the new
1512 approximation of the track. The model of the Riemann tilt fit is based on solving simultaneously the equations:
1513\begin{eqnarray}
1514R^{2} &=& (x-x_{0})^{2} + (y^{*}-y_{0})^{2}\\
1515y^{*} &=& y - tg(h)(z - z_{t})\\
1516z_{t} &=& z_{0}+dzdx*(x-x_{r})
1517\end{eqnarray}
1518with $(x, y, z)$ the coordinate of the cluster, $(x_0, y_0, z_0)$ the coordinate of the center of the Riemann circle,
1519R its radius, $x_r$ a constant reference radial position in the middle of the TRD stack and dzdx the slope of the
1520track in the x-z plane. Using the following transformations
1521\begin{eqnarray}
1522t &=& 1 / (x^{2} + y^{2})\\
1523u &=& 2 * x * t\\
1524v &=& 2 * tg(h) * t\\
1525w &=& 2 * tg(h) * (x - x_{r}) * t
1526\end{eqnarray}
1527One gets the following linear equation
1528\begin{equation}
1529a + b * u + c * t + d * v + e * w = 2 * (y + tg(h) * z) * t
1530\end{equation}
1531where the coefficients have the following meaning
1532\begin{eqnarray}
1533a &=& -1/y_{0}\\
1534b &=& x_{0}/y_{0}\\
1535c &=& (R^{2} -x_{0}^{2} - y_{0}^{2})/y_{0}\\
1536d &=& z_{0}\\
1537e &=& dz/dx
1538\end{eqnarray}
1539The error calculation for the free term is thus
1540\begin{equation}
1541\sigma = 2 * \sqrt{\sigma^{2}_{y}(tilt\ corr ...) + tg^{2}(h) * \sigma^{2}_{z}} * t
1542\end{equation}
1543
1544From this simple model one can compute $\chi^2$ estimates and a rough approximation of $1/p_t$ from the
1545curvature according to the formula:
1546\begin{equation}
1547C = 1/R = a/(1 + b^{2} + c*a)
1548\end{equation}
1549
1550\item[9.] {\bf Filter 2} Calculate likelihood of the track. (See AliTRDtrackerV1::CookLikelihood()). The following quantities are checked against the Riemann fit:\\
1551 - position resolution in y\\
1552 - angular resolution in the bending plane\\
1553 - likelihood of the number of clusters attached to the tracklet
1554\item[10.] Extrapolation of the helix fit to the other 2 chambers *non seeding* chambers:\\
1555 - Initialization of extrapolation tracklets with the fit parameters\\
1556 - Attach clusters to extrapolated tracklets\\
1557 - Helix fit of tracklets
1558\item[11.] Improve seeding tracklets quality by reassigning clusters based on the last parameters of the track
1559 See AliTRDtrackerV1::ImproveSeedQuality() for details.
1560\item[12.] Helix fit of all 6 seeding tracklets and chi2 calculation
1561\item[13.] Hyperplane fit and track quality calculation. See AliTRDtrackerFitter::FitHyperplane() for details.
1562\item[14.] Cooking labels for tracklets. Should be done only for MC
1563\item[15.] Register seeds.
1564\end{itemize}
1565
883031eb 1566%
1567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1568\newpage
1569\setcounter{chapter}{3}
1570\setcounter{section}{0}
1571\Chapter{Calibration}
1572%
1573{\it Author: R.~Bailhache (rbailhache@ikf.uni-frankfurt.de)}
1574\smallskip
1575\\
1576%
1577\section{Database Entries}
1578A local database with default parameters can be found in the AliRoot
1579installation directory. The official database is in Alien under the
1580directory
1581{\tt /alice/data/$\langle$year$\rangle$/$\langle$LHCPeriod$\rangle$/OCDB}.
1582The calibration objects are stored in root files named according to their
1583run validity range, their version and subversion number. For the TRD they
1584are in the subdirectory {\tt \$AliRoot/OCDB/TRD/Calib} and correspond to
1585a perfect TRD detector. The parameters are listed in Tab.\ref{entriesdatabase}.\\
1586\begin{table} [h]
1587 \begin{center}
1588 \begin{tabular}{|c|c|c|c|c|c|}
1589 \hline Parameter & Description & Number of & Data type & Unit & Default value \\
1590 & & channels & & & \\ \hline
1591 ChamberGainFactor & Mean gas gain & 540 & Float & $-$ & 1.0 \\
1592 $ $ & per chamber & & & & \\ \hline
1593 LocalGainFactor & Gas gain & 1181952 & UShort & $-$ & 1.0 \\
1594 & per pad & 1181952 & UShort & $-$ & 1.0 \\ \hline
1595 ChamberVdrift & Mean drift velocity & 540 & Float & cm$/$$\mu$s & 1.5 \\
1596 & per chamber & 540 & Float & cm$/$$\mu$s & 1.5 \\ \hline
1597 LocalVdrift & Drift velocity & 1181952 & UShort & $-$ & 1.0 \\
1598 & per pad & 1181952 & UShort & $-$ & 1.0 \\ \hline
1599 ChamberT0 & Minimum timeoffset & 540 & Float & timebin & 0.0 \\
1600 & in the chamber & 540 & Float & timebin & 0.0 \\ \hline
1601 LocalT0 & Timeoffset & 1181952 & UShort & timebin & 0.0 \\
1602 & per pad & & & & \\ \hline
1603 PRFWidth & Width of the PRF & 1181952 & UShort & pad width & 0.515 ( layer 0) \\
1604 $ $ & per pad & $ $ & $ $ & $ $ & 0.502 ( layer 1) \\
1605 $ $ & $ $ & $ $ & $ $ & $ $ & 0.491 ( layer 2) \\
1606 $ $ & $ $ & $ $ & $ $ & $ $ & 0.481 ( layer 3) \\
1607 $ $ & $ $ & $ $ & $ $ & $ $ & 0.471 ( layer 4) \\
1608 $ $ & $ $ & $ $ & $ $ & $ $ & 0.463 ( layer 5) \\ \hline
1609 DetNoise & Scale factor & 540 & Float & $-$ & 0.1 \\ \hline
1610 PadNoise & Noise & 1181952 & UShort & ADC & 12 \\
1611 & per pad & & & counts & \\ \hline
1612 PadStatus & Status & 1181952 & char & $-$ & $-$ \\
1613 & per pad & & & & \\ \hline
1614 \end{tabular}
1615 \end{center}
1616\caption{\label{entriesdatabase}Entries in the database}
1617\end{table}
1618%
1619They are related to the calibration of:
1620\begin{itemize}
1621\item the gas gain: {\tt ChamberGainFactor} and {\tt LocalGainFactor}
1622\item the electron drift velocity: {\tt ChamberVdrift} and {\tt LocalVdrift}
1623\item the timeoffset: {\tt ChamberT0} and {\tt LocalT0}
1624\item the width of the Pad Response Function: {\tt PRFWidth}
1625\item the noise per channel: {\tt DetNoise}, {\tt PadNoise} and {\tt PadStatus}.
1626\end{itemize}
1627To save disk space the values per pad are stored in UShort (2 Bytes)
1628format in AliTRDCalROC objects, one per chamber, that are members of
1629a general {\tt AliTRDCalPad} object. The final constants have a
1630numerical precision of 10$^{-4}$. They are computed by
1631multiplication (gain, drift velocity and noise) or addition (timeoffset)
1632of the detector and pad coefficients. From the pad noise level a status
1633is determined for each pad ( masked, bridgedleft, bridgedright, read by
1634the second MCM, not connected). One example macro ({\tt AliTRDCreate.C})
1635to produce a local database is given in the {\tt \$AliRoot/TRD/Macros}
1636directory.\\
1637During the simulation of the detector response and the reconstruction
1638of the events the parameters are used to compute the amplitude of the
1639signal and its position inside the detector. The database has to be
1640first choosen with the help of the {\tt AliCDBManager}. The parameters
1641are then called by an {\tt AliTRDcalibDB} instance. The macro
1642{\tt \$AliRoot/TRD/Macros/ReadCDD.C} shows how to read a local database
1643and plot the gas gain or drift velocity as function of the detector
1644number or pad number.
1645%
1646\section{DAQ Calibration}
1647Calibration procedures are performed online during data-taking on
1648different systems. The principal role of the Data AcQuisition System is
1649to build the events and archive the data to permanent storage tapes. In
1650addition it also provides an efficient access to the data. Nevertheless
1651the complete reconstruction of the events with tracks is not available.
1652Two algorithms are executed on DAQ for the TRD: a pedestal algorithm and
1653an algorithm for the drift velocity and timeoffset. They are implemented
1654as rpm packages, that can be easily built inside AliRoot compiled with
1655the DATE software \cite{DATE}. The outputs of the algorithms are stored
1656in root files and put on the DAQ File Exchange Server (FXS). At the end
1657of the run they are picked up by the so called SHUTTLE and further
1658processed in the Preprocessor to fill finally the OCDB.
1659\begin{figure}[h]
1660 \centering\mbox{\epsfig{file=plots/baselinenoisedet0run34510ex.eps,width=0.45\textwidth}}
1661 \caption{\label{baselinenoisedet0run34510ex}2D histogram of the
1662detector 0 (SM 0, S0, L0) with the ADC value distributions around
1663the baseline (10 ADC counts) for each pad (PEDESTAL run 34510).}
1664\end{figure}
1665\subsection{Pedestal algorithm}
1666During a pedestal run empty events without zero suppression are taken
1667with the TRD alone and a random trigger. They are used to determine
1668the noise in ADC counts of each pad. The algorithm can be found in the
1669{\tt TRDPEDESTALda.cxx} file of the AliRoot TRD directory. It is
1670executed on the Local Data Concentrators (LDCs), which are part of the
1671dataflow and gives access to sub-events. The TRD has three LDCs
1672corresponding to the following blocks of supermodules (SMs):
1673\begin{itemize}
1674\item 0-1-2-9-10-11
1675\item 3-4-5-12-13-14
1676\item 6-7-8-15-16-17
1677\end{itemize}
1678Three algorithms are therefore executed in parallel during a PEDESTAL
1679run for a full installed TRD. After about 100 events, the data-taking
1680stops automatically and a 2D histogram is filled for each chamber with
1681the ADC amplitude distributions around the baseline for each pad. Such
1682a histogram is shown in Fig.\ref{baselinenoisedet0run34510ex} for
1683chamber 0 (SM 0 Stack 0 Layer 0).
1684\begin{figure}[h]
1685 \centering\mbox{\epsfig{file=plots/run38125sm0nounfold.eps,width=0.88\textwidth,height=0.55\textwidth}}
1686 \caption{\label{run38125sm0nounfold}Noise in the six planes of
1687SM 0 (PEDESTAL run 38125). The five stacks in each layer are in
1688the {\it{z}} direction.}
1689\end{figure}
1690The chambers should be so configured that the data is without zero
1691suppression otherwise an error message appears on the DAQ online
1692Logbook. The container class is called {\tt AliTRDCalibPadStatus}
1693and allows to further fit the distributions with a Gaussian to
1694determine the baseline and noise of each pad. The function is called
1695{\tt AliTRDCalibPadStatus::AnalyseHisto()}. In
1696Fig.\ref{run38125sm0nounfold} the noise in SM 0 is plotted for the
1697PEDESTAL run 38125. It shows stripe patterns of higher noise in the
1698$z$-direction (beam direction) correlated to the static pad capacitance
1699of the pad plane. The noise distributions has to be first corrected
1700for the expected noise variations induced by the pad capacitance
1701before a status can be given to each pad. This is not done on the DAQ
1702but just before storing the parameters inside the Offline Condition
1703Database (OCDB) in the Preprocessor.
1704
1705\subsection{Drift velocity and timeoffset algorithm}
1706The drift velocity and timeoffset are calibrated with physics events,
1707$pp$ or $PbPb$ collisions. The algorithm is called
1708{\tt TRDVDRIFTda.cxx} and can be found in the AliRoot TRD directory.
1709It is executed on a dedicated monitoring server, which is not part
1710of the dataflow and gives access to full events of the TRD. The
1711physics events are used to fill continuously during data-taking an
1712average pulse height for each detector. They are stored in a
1713{\tt TProfile2D}, which is a member of a { \tt AliTRDCalibraFillHisto}
1714object. The {\tt TProfile2D} is written at the end of the run in a
1715root file put on the DAQ FXS.\\
1716\begin{figure}[h]
1717 \centering\mbox{\epsfig{file=plots/referenceph2d.eps,width=0.6\textwidth,,height=0.5\textwidth}}
1718 \caption{\label{referenceph2d}2D histogram containing the average
1719pulse height distributions of each calibration group (here detector),
1720produced with decalibrated simulated $pp$ events.}
1721\end{figure}
1722
1723Fig.\ref{referenceph2d} shows an output {\tt TProfile2D} obtained
1724from simulated decalibrated $pp$ collisions at 14\,TeV. The first
1725peak in time corresponds to the amplification region, where the
1726contributions of ionization electrons, which come from both sides
1727of the anode wire plane, are overlapping. The flat plateau results
1728from the electrons in the drift region. The tail is caused by the
1729Time Response Function. From this average signal as function of time
1730the drift velocity and timeoffset can be extracted by fit procedures.
1731This last step is performed in the Preprocessor.\\
1732Since no tracking is available on DAQ, a simple tracklet finder is
1733used. It was optimized for a low charged particle multiplicity
1734environment. The algorithm looks for a maximum of the signal
1735amplitudes in the chamber after integration over all timebins. The
1736average pulse height is then filled for a spot of two pad rows
1737($z$ direction) and four pad columns ($r\phi$ direction) around the
1738maximum. Further details can be found in the function
1739{\tt AliTRDCalibraFillHisto::ProcessEventDAQ}.
1740%
1741\section{HLT Calibration}
1742The High Level Trigger has the big advantage to provide an online
1743reconstruction of the events. The idea is then to run the calibration
1744procedures in a transparent way, independent whether online or
1745offline. The same function
1746\\{\tt AliTRDCalibraFillHisto::UpdateHistogramsV1(AliTRDtrackV1 *t)}
1747is used to fill the $dE/dx$ distributions (gain), the average pulse
1748height (drift velocity and timeoffset) and the Pad Response Function
1749for each detector in respectively one {\tt TH2I} and two
1750{\tt TProfile2Ds}. The calibration is nevertheless done per chamber,
1751whereas by integrating statistics it will be possible to get the gain,
1752drift velocity and timeoffset distributions inside the chambers offline.
1753Therefore the class {\tt AliTRDCalibraFillHisto} contains a flag
1754({\tt fIsHLT}) to avoid extra calculations not needed at the detector
1755level.\\
1756\begin{figure}[hbt]
1757 \centering\mbox{\epsfig{file=plots/referencech2d.eps,width=0.55\textwidth,,height=0.45\textwidth}}
1758 \caption{\label{referencech2d}A 2D histogram containing the
1759$dE$$/$$dx$ distributions of each detector. These were produced
1760with decalibrated simulated $pp$ events.}
1761\end{figure}
1762
1763Fig.\ref{referencech2d} shows one example of a {\tt TH2I} histogram,
1764where the $dE/dx$ distributions of each detector is stored for $pp$
1765collisions at 14\,TeV. No minimal $p_{T}$ cut was applied on the
1766TRD tracks. Assuming that the charged particles are uniformy
1767distributed over the TRD chambers, the position of the Most Probable
1768Value of the $dE/dx$ distribution is used to calibrate the gain.\\
1769At the beginning of each run, a local copy of the OCDB is updated
1770on the HLT cluster: the HCDB (HLT Condition Database). The last set
1771of calibration objects are used to reconstruct the events. The gain
1772correction preformed during the tracking has to be taken into account
1773when filling the $dE/dx$ distributions. That is why the calibration
1774algorithm has to know which database was used during the
1775reconstruction. The TRD HLT code can be found in the {\tt HLT/TRD}
1776subdirectory of the AliRoot installation. The calibration is
1777implemented as an {\tt AliHLTTRDCalibrationComponent}, whose members
1778are an {\tt AliCDBManager} together with the path for the current
1779database used, and an {\tt AliTRDCalibraFillHisto} object. The main
1780functions are:
1781\begin{itemize}
1782\item {\tt AliHLTCalibrationComponent::InitCalibration}, where the
1783{\tt TH2I} and {\tt TProfile2Ds} are created.
1784\item {\tt AliHLTCalibrationComponent::ProcessCalibration}, where
1785the function\\
1786{\tt AliTRDCalibraFillHisto::UpdateHistogramsV1(AliTRDtrackV1 *t)}
1787is called to fill the histograms.
1788\item {\tt AliHLTCalibrationComponent::FormOutput}, which returns
1789a {\tt TObjArray} with the histograms.
1790\end{itemize}
1791The histograms are shipped at the end of each run to the HLT File
1792Exchange Server to be picked up by the SHUTTLE and further processed
1793by the Preprocessor, exactly as the data from the calibration on DAQ.
1794%
1795\section{Preprocessor}
1796%
1797The online systems, like the Detector Control System (DCS), the DAQ
1798and the HLT, are protected from outside by a firewall. A special
1799framework, called the SHUTTLE, has been developped to retrieve offline
1800data in the online systems or store relevant information from the
1801online systems in the OCDB. The SHUTTLE has access to the DCS, DAQ
1802and HLT FXS. At the end of each run the reference data, outputs of
1803the calibration algorithms on DAQ and HLT, are retrieved and further
1804processed to determine the calibration constants (gain, drift velocity,
1805timeoffset and width of the Pad Response Function). The reference
1806data are finally stored in the Grid reference Data Base, whereas the
1807results of the fit procedures are stored in the OCDB.\\
1808The code is contained in the {\tt AliTRDPreprocessor} class. The
1809Process function is executed for the run types: PEDESTAL, STANDALONE,
1810DAQ and PHYSICS.
1811\begin{itemize}
1812\item The PEDESTAL run are dedicated to the calibration of the noise
1813on DAQ. Only the output of the DAQ pedestal algorithm is retrieved at
1814the SHUTTLE. From the noise and baseline of each pad, a pad status is
1815determined. Disconnected pads are recognizable by a small noise.
1816Bridged pads have the same noise and baseline. The noise and
1817padstatus of the previous pedestal run in the OCDB are taken for half
1818chambers, which were not On. Finally the database entries
1819{\tt DetNoise}, {\tt PadNoise} and {\tt PadStatus} are populated in
1820the OCDB. More informations can be found in the function
1821\\{\tt AliTRDPreprocessor::ExtractPedestals}.
1822\item The STANDALONE runs are used to check the data integrity or the
1823correlated noise. The data are taken with the TRD alone and a random
1824trigger. Only the DCS data are retrieved.
1825\item The DAQ run are test runs for the DAQ people. Only the DCS data
1826are retrieved.
1827\item The PHYSICS run are global runs including more than one detector
1828and different trigger clusters. They are used for the calibration of
1829the gain, driftvelocity and timeoffset, and width of the PRF. Therefore
1830the output of the calibration algorihms running on HLT are retrieved.
1831If the procedure is not successful the output of the
1832driftvelocity$/$timeoffset algorithm on DAQ is also retrieved. The
1833reference data, the histograms, are fitted using an
1834{\tt ALiTRDCalibraFit} instance:
1835\begin{itemize}
1836\item {\tt AliTRDCalibraFit::AnalyseCH(const TH2I *ch)} determines
1837the MPVs of the $dE/dx$ distributions and compares them to a reference
1838value.
1839\item {\tt AliTRDCalibraFit::AnalysePH(const TProfile2D *ph)} fits
1840the average pulse height and determines the position of the amplification
1841region peak and the end of the drift region for each chamber. Knowing
1842the length of the drift region one can deduce the drift velocity. The
1843amplification peak gives also information on the timeoffset.
1844\item {\tt AliTRDCalibraFit::AnalysePRFMarianFit(const TProfile2D *prf)}
1845determines the spread of the clusters as function of azimuthal angle of
1846the track. The minimum gives the width of the PRF.
1847\end{itemize}
1848The results of each fit procedure are stored in a {\tt TObjArray} of
1849\\{\tt AliTRDCalibraFit::AliTRDFitInfo} objects, one per chamber, which
1850is a member of the {\tt AliTRDCalibraFit} instance. The functions
1851{\tt AliTRDCalibratFit::CreateDetObject*} and {\tt ::CreatePadObject*}
1852allow to create from the {\tt TObjArray} the final calibration objects,
1853that have to be put in the OCDB.
1854\end{itemize}
1855Tab.\ref{taskruntype} summarizes the tasks executed by the prepocessor
1856for each run type.
1857\begin{table}[h]
1858\begin{center}
1859\begin{tabular} {|c|c|c|c|c|}
1860\hline run type & DCS data points & DCS FXS & DAQ FXS & HLT FXS \\
1861 & temperatures & electronic & calibration DA & calibration DA \\
1862 & voltages, etc $\cdots$ & configuration & noise/($v_{dE}$$/$$t_{0}$)
1863& $g$/($v_{dE}$$/$$t_{0}$)/$\sigma_{PRF}$ \\
1864\hline DAQ & yes & yes & no & no \\\hline
1865\hline PEDESTAL & no & no & yes (noise) & no \\\hline
1866\hline STANDALONE & yes & yes & no & no \\\hline
1867\hline PHYSICS & yes & yes & yes ($v_{dE}$$/$$t_{0}$) & yes \\\hline
1868\end{tabular}
1869\caption{\label{taskruntype} Tasks performed by the TRD preprocessor
1870for every run type.}
1871\end{center}
1872\end{table}
1873The DCS data points are measurements of the currents, voltages,
1874temperatures and other variables of the chambers as function of time.
1875They are saved in the DCS Archive DB during the run and made available
1876at the SHUTTLE by AMANDA.
1877%
1878\section{Offline Calibration}
1879The offline calibration of the gain, driftvelocity$/$timeoffset and
1880width of the PRF is meant to improve the first calibration online.
1881It follows the following steps:
1882\begin{itemize}
1883\item Fill reference data (the $dE/dx$ distributions, the average
1884pulse heights $\cdots$) during the reconstruction of the events offline.
1885\item Store the reference data in root files in AliEn.
1886\item Merge the reference data of different runs and$/$or calibration groups.
1887\item Fit the reference data to extract the calibration constants and
1888create the calibration objects.
1889\item Store the calibration objects according to their run validity in
1890the OCDB.
1891\end{itemize}
1892The calibration procedure is not performed per detector anymore but per
1893pad, at least for the first step, the filling of the reference data.
1894Depending on the available statics the reference data of different pads
1895(calibration groups) can be merged together to determine a mean
1896calibration coefficient over these pads.
1897\subsection{AliTRDCalibraVector container}
1898The high granularity of the calibration, with a total number of 1181952
1899pads, implies that the size of the reference data has to be reduced to
1900the strict minimum needed.
1901\begin{table}[h]
1902\begin{center}
1903\begin{tabular} {|c|c|c|}
1904\hline reference data & Number of & size \\
1905 for & calibration groups & in MB \\\hline
1906 gain & 1181952 & 225 \\\hline
1907 driftvelocity$/$timeoffset & 1181952 & 271 \\\hline
1908 PRF & 131328 & 200 \\\hline
1909 All together & & 696 \\\hline
1910\end{tabular}
1911\caption{\label{sizeofAliTRDCalibraVector} Size of the
1912{\tt AliTRDCalibraVector} object for a given granularity.}
1913\end{center}
1914\end{table}
1915
1916The {\tt TH2I} and {\tt TProfile2D} objects are not a good option
1917anymore. Therefore a container class, {\tt AliTRDCalibraVector}, was
1918developped. The {\tt TH2I} corresponds to an array of UShort (2 Bytes)
1919for the number of entries in each bin, the {\tt TProfile2D} to an array
1920of UShort for the number of entries in each bin and two arrays of Float
1921for the sum of the weights and the sum of the squared weights in each
1922bin. The mean value and its error are computed per hand in the functions
1923{\tt AliTRDCalibraVector::UpdateVector*}, where the object is filled
1924with new data. The size of the {\tt AliTRDCalibraVector} object is
1925summarized in Tab.\ref{sizeofAliTRDCalibraVector}.\\
1926%
1927\subsection{Additional method to calibrate the drift velocity}
1928In addition an other method is available for the calibration of the
1929drift velocity. It is based on the comparison of the slope of the TRD
1930tracklet in the azimuthal plane $xy$ with the $\phi$ angle of the
1931global track. It can be shown that the slope $dy/dt$ of a TRD tracklet
1932depends linearly on its global track parameters,
1933$\tan(\phi)+(dz/dx)\tan(\beta_{tilt})$ \cite{THESISR}. The slope
1934parameter is the drift velocity in the electric field direction,
1935whereas the constant gives the tangent of the Lorentz angle. If the
1936TRD tracklet crosses two different pads in the $z$ direction (the
1937beam direction), the relation is not true anymore. Therefore such
1938tracklets are rejected in the calibration procedure. The reference
1939data are a {\tt TObjArray} of one {\tt TH2F} histogram for each
1940detector.\\
1941\begin{figure}[hbt]
1942 \centering\mbox{\epsfig{file=plots/crossrow.eps,width=0.5\textwidth,height=0.45\textwidth}}
1943 \caption{\label{crossrow}The correlation between $dy/dt$ and
1944$\tan(\phi)+(dz/dx)\tan(\beta_{tilt})$ for the reconstructed track
1945in one chamber. The tracks crossing at least two pad rows are in
1946red crosses and those crossing one pad row in blue points.}
1947\end{figure}
1948
1949Fig.\ref{crossrow} shows one example of such a histogram. They are
1950filled in the function
1951\\{\tt AliTRDCalibraFillHisto: :UpdateHistogramsV1(AliTRDtrackV1 *t)},
1952like the reference data for other calibration constants, if the
1953flag {\tt fLinearFitterDebugOn} is true.\\
1954The histograms are stored in the container class,
1955\\{\tt AliTRDCalibraVdriftLinearFit}, for which a {\tt Merge} and
1956{\tt Add} function have been implemented. In a second step, the
1957{\tt AliTRDCalibraVdriftLinearFit} objects can be merged together
1958for different runs. In a third step, the {\tt TH2F} histograms are
1959fitted in the function \\{\tt AliTRDCalibraVdriftLinearFit::FillPEArray}.
1960The result parameters are members of the
1961{\tt AliTRDCalibraVdriftLinearFit} object, as well as their error
1962coming from the fit procedures. Finally the
1963{\tt AliTRDCalibraVdriftLinearFit} object is passed to an
1964{\tt AliTRDCalibraFit} instance through the function
1965{\tt AliTRDCalibraFit::AnalyseLinearFitters}, in which the Lorentz
1966angle is computed from the fit parameters and stored together with
1967the drift velocity in a {\tt TObjArray}, member of the
1968{\tt AliTRDCalibraFit} instance. As for the other calibration
1969constants the functions {\tt AliTRDCalibratFit::CreateDetObject*}
1970and {\tt ::CreatePadObject*} allows to create the final calibration
1971objects, that have to be put in the OCDB. Since the Lorentz angle
1972is not a OCDB entries, it is only used for debugging.
1973%
1974\subsection{The calibration AliAnalysisTask}
1975The reference data of the calibration are filled in an AliAnalysisTask
1976during the reconstruction or after the reconstruction. Since it needs
1977some informations only stored in the AliESDfriends, they have to be
1978written if one wants to run the calibration. This will be the case
1979only for TRD track above a given $p_{T}$ since the size of the events
1980is otherwise to big.
1981%
1982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1983\newpage
1984\setcounter{chapter}{4}
1985\setcounter{section}{0}
1986\Chapter{Alignment}
1987\thispagestyle{empty}
1988%
1989\section{???}
1990%
1991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1992\newpage
1993\setcounter{chapter}{5}
1994\setcounter{section}{0}
1995\Chapter{Quality Assurance (QA)}
1996\thispagestyle{empty}
1997%
1998\section{???}
1999%
2000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2001\newpage
2002\setcounter{chapter}{6}
2003\setcounter{section}{0}
2004\Chapter{High Level Trigger (HLT)}
2005\thispagestyle{empty}
2006%
2007\section{???}
2008%
2009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010\newpage
2011\setcounter{chapter}{7}
2012\setcounter{section}{0}
2013\Chapter{References}
2014\thispagestyle{empty}
2015%
2016\begin{thebibliography}{99}
2017%
2018\bibitem{ALIROOT} {\it The ALICE Offline Bible}\\
2019 http://aliceinfo.cern.ch/export/sites/AlicePortal/Offline/galleries/Download/OfflineDownload/ \\
2020 OfflineBible.pdf.
2021%
2022\bibitem{CLEMENS} C.~Adler,
2023 {\it Radiation length of the ALICE TRD}
2024%
2025\bibitem{DAVID} D.~Emschermann,
2026 {\it Numbering Convention for the ALICE TRD Detector.},
2027 http://www.physi.uni-heidelberg.de/\~demscher/alice/numbering/more/TRD\_numbering\_v04.pdf.
2028%
2029\bibitem{TRPHOT} M.~Castellano et al.,
2030 Comp. Phys. Comm. {\bf 55}, 431 (1988),
2031 Comp. Phys. Comm. {\bf 61}, 395 (1990),
2032%
2033\bibitem{DATE} K.~Schossmaier et al.,
2034 {\it The Alice Data Acquisition and Test Environment DATE V5},
2035 CHEP06.
2036%
2037\bibitem{THESISR} R.~Bailhache,
2038 {\it Calibration of the ALICE Transition Radiation Detector
2039 and a study of $Z^{0}$ and heavy quark production in $pp$
2040 collisions at the LHC},
2041 PhD thesis, University of Darmstadt (Germany), 2009.
2042%
2043\end{thebibliography}
2044%
2045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2046%
2047\end{document}
2048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%