]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FEMTOSCOPY/Documentation/AliFemto.tex
Herwig event header.
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / Documentation / AliFemto.tex
CommitLineData
76776e09 1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3% AliFemto Documentation - User Guide and Reference Manual -- LaTeX source
4% ALICE Experiment Femtoscopic Analysis framework
5% Mike Lisa 17 May 2006
6% [Based on similar document for StHbt (STAR framework), Mike Lisa 22 May 2006]
7%
8%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9\documentclass[twoside]{article}
10
11\newcommand {\DocumentVersionNumber} {1.1} %%% this is the Version Number
12
13
14\usepackage{natbib}
15
16
17%\usepackage[T1]{fontenc}
18%\renewcommand*\ttdefault{txtt}
19%\renewcommand*\familydefault{\ttdefault}
20
21
22
23\parindent 0pt
24\parskip 6pt
25\advance\textwidth by 80pt%
26\advance\evensidemargin by -80pt%
27
28%\renewcommand{\familydefault}{cmss}
29
30\usepackage{epsfig}
31%%%%%%\usepackage{pdffig}
32
33
34\usepackage{graphicx}
35\usepackage{psboxit}
36\usepackage{color}
37\usepackage{amsmath}
38\usepackage{amssymb}
39\usepackage{fancyhdr}
40\usepackage{times}
41\usepackage{verbatim}
42\usepackage{makeidx}
43\usepackage{subfigure}
44%%%\usepackage[dvips=true,hyperindex=true,colorlinks=true,linkcolor=blue,bookmarks=true]{hyperref}
45\usepackage[hyperindex=true,colorlinks=true,linkcolor=blue,bookmarks=true]{hyperref}
46
47\PScommands % init boxit
48\makeindex
49
50%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51%
52% Define header and footer style
53%
54%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55\pagestyle{fancyplain}
56\rhead[\fancyplain{}{\bfseries\leftmark}]
57 {\fancyplain{}{\bfseries\rightmark}}
58\lhead[\fancyplain{}{\bfseries\rightmark}]
59 {\fancyplain{}{\bfseries\leftmark}}
60\rfoot[{}]{\fancyplain{}{\bfseries\thepage}}
61\lfoot[\fancyplain{}{\bfseries\thepage}]{}
62\cfoot{}
63
64%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65%
66% Typographic Conventions
67%
68%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69\newcommand{\name}[1]{\textsf{#1}}% or class-, function-, package names
70\newcommand{\comp}[1]{\texttt{#1}}% computer font
71\newcommand{\args}[1]{\textit{#1}}% command arguments
72\newcommand{\meth}[1]{\textsf{#1}}% class methods
73%%%
74%%% font for package names
75%%%
76\newcommand{\AliEn}{{\tt AliEn }}
77\newcommand{\AliFemto}{{\tt AliFemto }}
78\newcommand{\AliRoot}{{\tt AliRoot }}
79\newcommand{\ROOT}{{\tt ROOT }}
80\newcommand{\StHbt}{{\tt StHbt }}
81\newcommand{\cvs}{{\tt StHbt }}
82
83
84%% removed a bunch of unused (?) \newcommand statements
85
86
87%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88%
89% Define multiline labels for class reference
90%
91%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92\newcommand{\entrylabel}[1]{\mbox{\textbf{{#1}}}\hfil}%
93\newenvironment{entry}
94{\begin{list}{}%
95 {\renewcommand{\makelabel}{\entrylabel}%
96 \setlength{\labelwidth}{90pt}%
97 \setlength{\leftmargin}{\labelwidth}
98 \advance\leftmargin by \labelsep%
99 }%
100 }%
101 {\end{list}}
102
103\newcommand{\Entrylabel}[1]%
104{\raisebox{0pt}[1ex][0pt]{\makebox[\labelwidth][l]%
105 {\parbox[t]{\labelwidth}{\hspace{0pt}\textbf{{#1}}}}}}
106\newenvironment{Entry}%
107{\renewcommand{\entrylabel}{\Entrylabel}\begin{entry}}%
108 {\end{entry}}
109
110
111
112%%%
113%%% font for AliFemto class/method/attribute names
114%%% ---- at some point, let's find some nice font...
115%%%
116\newcommand{\acf}[1]{{\tt \bf #1}}
117
118\begin{document}
119
120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121%
122% Title page
123%
124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125\begin{titlepage}
126\pagestyle{empty}
127\vspace*{-35mm}
128\begin{center}
129 {\Large\bf AliFemto - A Femtoscopic Analysis Framework for ALICE}
130 \hfill\mbox{}\\[4.5cm]
131\mbox{\includegraphics[width=\textwidth]{AliFemtoTitle.pdf}}
132 \hfill\mbox{}\\[8cm]
133 {\LARGE User Guide and Reference Manual}\\[2cm]
134 {\LARGE Revision \DocumentVersionNumber} \\[5mm]
135 {\LARGE \today} % replaced by cvs with current revision
136 \vfill
137\end{center}
138\cleardoublepage
139\end{titlepage}
140\pagenumbering{roman}
141
142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
143%
144% Table of contents
145%
146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147\tableofcontents
148%\cleardoublepage
149\clearpage
150
151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152%
153% User Guide
154%
155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156\pagenumbering{arabic}
157
158
159\setcounter{section}{-1}
160\section{About this document}
161
162This is the Users' Guide and Reference Manual for the \AliFemto software package,
163for use in the ALICE experiment at the Large Hadron Collider.
164The femtoscopy analysis effort in ALICE is in the Physics Working Group 2. Thus,
165the software described here may be found in the {\tt PWG2/FEMTOSCOPY } area when
166\AliRoot is checked out.
167
168The files (.tex, .pdf, etc.) for this documentation are cvs-controlled along with
169the \AliFemto code in the ALICE repository under the {\tt PWG2/FEMTOSCOPY/Documentation } area.
170While earth-moving changes in the framework are not anticipated, this manuscript will be to some
171extent a ``living document.'' The reposisory version of the documentation
172should be considered the ``official'' source of information on the package at any given time.
173
174This document consists of two parts. The Users' Guide introduces the package and, perhaps most
175interestingly to the reader, provides a blow-by-blow example of its use. The Reference Manual
176is essentially a listing and short description of the classes and the limited inheritance
177scheme.
178
179\AliFemto will often be run in a larger framework than a simple \ROOT or \AliRoot session, e.g.
180\AliEn and the Task-Train framework in ALICE. This manual focusses only on \AliFemto itself.
181For tutorials on how to run \AliFemto within these contexts, see
182the ALICE femtoscopy web pages\\
183 {\tt http://aliceinfo.cern.ch/Collaboration/PhysicsWorkingGroups/PWG2/Femtoscopy/}.
184
185
186
187
188\clearpage
189
190\part{Users' Guide}
191\clearpage
192
193
194\section{Introduction - Basics and Motivation}
195
196
197Femtoscopy-- the measurement of the space-time structure of dynamic systems at the fermi scale--
198is an integral tool in studies in high-energy particle (e.g. p+p) and heavy ion (e.g. Pb+Pb)
199collisions. It can also be a non-trivial, somewhat subtle tool, with nonobvious experimental
200``traps'' which are periodically redisovered as expertise evaporates and algorithms are lost.
201
202Especially in large modern high energy experimental collaborations, complex experimental
203issues impact on this already-delicate tool. Furthermore, by the nature of such collaborations,
204``Physics Working Groups'' (PWGs) are commonly formed, in which several collaborators work on
205similar physics topics (e.g. femtoscopy) which share common techniques and problems. Sharing
206of experience and
207solutions among PWG members is invaluable to work through problems quickly and to assure quality
208and consistency in physics results. In addition to regular discussions by phone/vrvs/email, sharing
209a common software analysis infrastructure allows for rapid and collaborative development, testing
210and sharing of solutions. Production of quality physics results in a timely manner demands the
211use of all available collaborative tools; while cross-checks are always crucial to an analysis,
212re-creating the many aspects of a wheel is sometimes a (all-too-common) waste of valuable manpower.
213
214Just as code-sharing {\it within} a collaboration or PWG is desirable when analysis techniques
215are similar, code-sharing {\it between} collaborations or PWGs may be equally beneficial, if the
216similarities are sufficiently great. Code reusability is often claimed as one of the most important
217benefits of well-designed object-oriented programming. Through the development of standardized tools
218and inheritance schemes, high-energy physics has largely moved away from perpetual re-implementation
219of established algorithms.
220Previously, the student who needed a particular ``twist'' to, say a resonance-finding technique,
221would often find it easiest to start from scratch in a self-contained Fortran code. This was due
222to the fact that the {\it previous} student's Fortran code lacked extensibility; e.g. interfaces
223and common blocks were specialized for a particular, narrow purpose. With care, languages such as
224C++ provide a natural solution. The student can focus on {\it new} aspects of her problem (the purpose,
225after all, of research) and the science behind it. The {\it same} objects and elements of the {\it same}
226code, developed and refined by others, are at her disposal; likewise, she will make her own contributions
227and everybody benefits.
228Likewise, so long as the detector and reconstruction configurations of two experiments
229are sufficiently similar, both collaborations may benefit by sharing some code.
230
231This document discusses a two-particle correlation software package for use in the ALICE experiment
232at the LHC. It is based largely on the framework (StHbt) used since 1999 in the STAR experiment at
233RHIC, an experiment remarkably similar to ALICE in all respects. StHbt, itself, was developed by
234femtoscopy experts from earlier heavy ion experiments at the AGS and SPS; as such, it distills the
235generic features of any heavy ion femtoscopic analysis. The femtoscopy group in ALICE is arguably
236the most complete collection of the world's experts in this sub-field ever assembled. It is hoped
237that this common analysis software will enable a maximum positive superposition of the experience
238of these experts.
239
240
241\subsection{Femtoscopy, HBT, and heavy ions}
242
243The feature distinguishing heavy ion from particle physics is the dominance of space-time
244geometry.
245This is manifest in the fact that we seek the geometrically-largest systems in order to approximate
246the infinite system in which thermodynamic variables and phases of matter become meaningful.
247At all stages of the the dynamic system's evolution, geometry rules.
248The geometric overlap anisotropy of the entrance channel is known to dominate the subsequent
249evolution of the bulk, and focusing systematics of geometric entrance-channel quantities
250(e.g. reaction-plane, impact parameter) yields much more information than geometric averages
251over these quantities. In the intermediate stage of the collision, path-lengh considerations
252are crucial to determine the physics of so-called ``jet quenching'' at the highest energies.
253Further, we seek a system in which coloured degrees of freedom
254are relevant over ``large'' length scales. Much of the dynamic bulk physics is reflected in the
255end freeze-out stage in collective observables (e.g. flow) which are usually defined in terms
256of space-momentum correlations.
257Clearly, geometry is a key defining feature of our field; momentum space alone is less than
258half the story.
259
260However, particle momentum is precisely what we measure. Geometrical information must be
261inferred. The most direct and common method of doing so is through femtoscopy, the use of
262two-particle momentum-space correlations to probe fermi-scale emission zones. Experimental
263and theoretical aspects of femtoscopy are discussed at length
264elsewhere~\citep[][and references within]{Lisa:2005dd}. Without becoming mathematical, the
265main point is to measure the increase (or decrease) of the likelihood of measuring a particle
266with a particular momentum, given the presence of another particle; in other words, the effect
267on the conditional probability. The effect to be measured is driven by the two-particle wavefunction, which
268depends on relative momentum (measured) and relative position (inferred). The probability $A$
269as a function of a measured relative quantity (typically relative momentum
270${\bf q}$, so $A \sim dN/d{\bf q}$) is usually dominated by detector acceptance and single-particle
271phasespace; the modification due to two-particle effects represent only a small perturbation.
272Thus, some sort of comparison to a reference distribution $B({\bf q})$ is usually performed.
273Ideally, $B$ contains all single- and two-particle acceptance and efficiency effects and lacks
274only the sought-for correlation. The distribution $B$ is often generated by so-called ``mixed-event''
275techniques, and the correlation function $C$, ideally containing only 2-particle
276correlations due to the relative wavefunction, given by
277\begin{equation}
278\label{eq:usualC}
279C({\bf q})=\frac{A({\bf q})}{B({\bf q})}
280\end{equation}
281It should be stressed, however, that neither using ${\bf q}={\bf p_1}-{\bf p_2}$ as a two-particle
282variable, generating histrograms/distributions $A$ or $B$, nor taking any ratio $C$ must be associated
283with a correlation analysis, in general. See Section~\ref{sec:bones} below.
284
285Briefly, some terminology which the reader may encounter. Two-particle femtoscopic measurements
286are related to the pioneering work of Hanbury-Brown and Twiss over half a century ago, to measure
287the angular size of stars~\cite{HanburyBrown:1954}. (The relationship, however, is somewhat more
288oblique than often realized.) Thus, similar analyses in high-energy physics
289are often referred to as ``HBT'' studies. For reference,
290the first actual application to high-energy physics was performed by Goldhaber, Goldhaber,
291Lee and Pais~\cite{Goldhaber:1960sf} shortly thereafter; thus correlations for pions reflect
292the ``GGLP effect.'' The rubrik of femtoscopy~\cite{Lednicky:2002fq} is nowadays
293used in general.
294
295
296
297
298\subsection{The bones of a femtoscopic analysis}
299\label{sec:bones}
300Similar algorithmic requirements and characteristics appear in a wide range of femtoscopic (and non-femtoscopic)
301analyses. AliFemto was designed as a common analysis framework for collaborators conducting diverse
302analyses sharing nevertheless a large overlap of techniques.
303
304The design was driven by asking two questions: ``What {\it is} a femtoscopy-style analysis, in general?'' and
305``What sorts of actions will be common to most analyses and what sorts will be person-specific?''
306
307The first question may be answered with the following rough procedure. Names of class types inside square brackets []
308are discussed in Sections~\ref{sec:AliFemtoDiagramEtc} and~\ref{sec:coreUser}.
309
310\begin{enumerate}
311\item\label{it:read} Obtain an event (usually, data associated with one collision) from somewhere. [\name{AliFemtoEventReader}]
312\item\label{it:write} (Optional) Write the event (or portions thereof) to a file, [\name{AliFemtoEventReader}]\\
313 The output file does not neccessarily use the same format as the input.
314\item\label{it:EvCut} Decide to use or discard (``cut on'') the event in the analysis. [\name{AliFemtoEventCut}]
315\item\label{it:TrCut} Select (``cut on'') the particles of interest. [\name{AliFemtoParticleCut}]
316\item\label{it:Reals} Form pairs of particles coming from the present event. [\name{AliFemtoAnalysis}]
317\item\label{it:PrCut} Cut on these pairs. [\name{AliFemtoPairCut}]
318\item\label{it:Num} Do ``something'' with these pairs. [\name{AliFemtoCorrFctn}]\\
319 {\it Usually}, but not neccessarily, this involves calculation of some relative
320 variable (e.g. a relative momentum) and incrementing a histogram.
321%%\item\label{it:Num} Send pairs passing the PairCut to the several CorrFctns for further processing.
322\item\label{it:Mix} {\it Usually,} form other pairs of particles to construct a reference pair
323 distribution. [\name{AliFemtoAnalysis}]\\
324 {\it Usually} this is related to generating pairs (``mixed'' pairs) of
325 particles between the present event and similar events which are sitting in
326 the EventBuffer.
327\item\label{it:PrCut2} Cut on these pairs. [\name{AliFemtoPairCut}]\\
328 {\it Almost always}, it is an identical cut as used in step~\ref{it:PrCut}.
329\item\label{it:Den} Do ``something'' with these pairs. [\name{AliFemtoCorrFctn}]\\
330 {\it Usually}, but not neccessarily, this involves calculation of some relative
331 variable (usually the same one as in step~\ref{it:Num}) and incrementing a histogram.
332\item\label{it:Store} Store the present event into the EventBuffer. [\name{AliFemtoAnalysis}]
333\item\label{it:loop} Return to step~\ref{it:read} for the next event. [\name{AliFemtoManager}]
334\end{enumerate}
335
336The first question is thus addressed by implementing the above basic functionality in methods of common classes.
337Considerations about the second question are reflected in the class inheritance structure and division of classes
338into ``central'' and User classes. We discuss this below.
339
340\section{The Structure and use of \AliFemto}
341\label{sec:AliFemtoDiagramEtc}
342
343\AliFemto is a flexible and extendable software package in the \ROOT framework for performing two-particle
344femtoscopic studies. The basic design and structure of the package is essentially unchanged since its
345original deployment in the STAR Experiment at RHIC in 1999. However, its functionality and features
346have been developed considerably by continuous use in experimental and model analyses by the STAR-HBT
347group since then. The package was designed from the beginning to be independent of the STAR analysis framework
348(root4star). Thus, it is easily used for ALICE-specific analyses (either in \AliRoot or ``vanilla'' \ROOT)
349or for model studies in any root flavor.
350
351{\bf Important note:}
352In this Section, we discuss the structure of the code, and a specific example of how to use it in ``vanilla'' or pure \AliRoot
353mode. In other words, here we run with a simple \ROOT macro. If we run instead in the ALICE {\tt task} framework, then the
354operations described here are performed by the {\tt AliFemtoTask}, rather than the user directly. Translation between these
355modes of operation is transparent. For tutorials on how to run \AliFemto within the {\tt task} framework, \AliEn, etc, see
356the ALICE femtoscopy web pages\\
357 {\tt http://aliceinfo.cern.ch/Collaboration/PhysicsWorkingGroups/PWG2/Femtoscopy/}.
358
359
360\subsection{Top level}
361\label{sec:topLevel}
362The top-level structure of AliFemto is shown in Figure~\ref{fig:TopLevelUML} in simplified Unified Modeling Language (UML)~\cite{UMLreference} format.
363Here, we describe generally the classes shown, and their interaction. See the Reference Manual for details.
364
365\begin{figure}[t]
366\includegraphics[width=\textwidth]{TopLevelUML.pdf}
367\caption{The large-view structure of the code.
368Yellow classes at the periphery are bases for user-written
369classes.\label{fig:TopLevelUML}
370}
371\end{figure}
372
373
374\subsubsection{AliFemtoManager}
375
376There is a single \name{AliFemtoManager} object for any \AliFemto session.
377\name{AliFemtoManager} controls all \AliFemto actions; it is this (through
378the four methods \meth{Init()}, \meth{ProcessEvent()}, \meth{Report()}, and \meth{Finish()}) with which the user
379interfaces.
380There is only one AliFemtoManager, instantiated by the user (or the {\tt AliFemtoTask}-- see beginning of
381Section~\ref{sec:AliFemtoDiagramEtc}), and objects are ``plugged into'' it by the user at runtime;
382see Section~\ref{sec:example} for an example.
383
384In order to proceed with an \AliFemto study, the \name{AliFemtoManager} must have an \name{AliFemtoEventReader}, which passes event information
385to it. Optionally, the \name{AliFemtoManager} may also have one or more {\it other} \name{AliFemtoEventReader}
386objects, which are in ``Write'' mode and
387which takes the event data and writes it to a fiile. This is useful in order to change data format or to write out only a selection
388of the events or information within events. Also optionally (but usually the case), the \name{AliFemtoManager} will have one or more
389\name{AliFemtoAnalysis}
390objects; it is these which perform correlation studies. In principle, the \name{AliFemtoManager} may have neither Writers or Analyses, but
391in this case nothing gets done with the data.
392
393\subsubsection{AliFemtoEventReader}
394\label{sec:AliFemtoEventReader}
395
396Typical users will not need to write \name{AliFemtoEventReader}s, but will instead use a standard one. We discuss its basics here
397just for reference.
398
399
400The job of the \name{AliFemtoEventReader} is to pass events, upon request, to the \name{AliFemtoManager}.
401How the events are obtained (reading from
402a data or simulation file, reading from some location in memory filled by someone else, random generation within the \name{AliFemtoReader} itself...) is
403immaterial. Regardless
404of the data format read in by the \name{AliFemtoReader}, the data is passed to the \name{AliFemtoManager} in the form of an \name{AliFemtoEvent}.
405(See the Reference Manual for full details on the content and structure of \name{AliFemtoEvent}.)
406In this way, all
407of \AliFemto code is unaware of external data sources or formats; all such dependency is confined to the \name{AliFemtoEventReader}-derived classes.
408
409
410\name{AliFemtoEventReader} is, itself, a base class, with a pure virtual method \meth{ReturnHbtEvent()}. For any given application/datasource (e.g.
411ALICE ESDs, Geant kine banks, RQMD files), a class must be written which inherits from AliFemtoEventReader.
412In the simillar STAR package, of order 10 specific Reader classes
413are available for use now; they will be developed for ALICE as needed.
414It is expected that the typical user will not need to write his own \name{AliFemtoEventReader} class, but simply select one already written.
415It is one of these derived classes which is ``plugged into'' the \name{AliFemtoManager}. Once the user instantiates and configures
416the Reader, she typically does not interact with it anymore. A specific example is given in Section~\ref{sec:example}
417
418
419
420\subsubsection{AliFemtoAnalysis}
421\label{sec:AliFemtoAnalysis}
422
423Typical users will not need to write \name{AliFemtoAnalysis} objects, but will instead select among standard ones. We discuss the basics here
424just for reference.
425
426
427The most important element of an \AliFemto study is the Analysis. All Analysis classes derive from the interface class
428\name{AliFemtoAnalysis}, which has three important pure virtual methods.
429They must implement (even if it is a ``do-nothing'' method) a \meth{Finish()} method, which will be invoked by
430the \name{AliFemtoManager} just before the session ends. Also, each \{name{AliFemtoAnalysis} class must generate
431a \meth{Report()} (c.f. Section~\ref{sec:reports}).
432
433
434Finally and most importantly, an \name{AliFemtoAnalysis} class must be able to \meth{Process()}
435an \name{AliFemtoEvent}. What it does with the \name{AliFemtoEvent}, even if it simply ignores it, is
436of course not important to the \name{AliFemtoManager}.
437In practice, naturally, an Analysis {\it does} process the data, making cuts and extracting correlations.
438The simplest \name{AliFemtoAnalysis}-derived class, \name{AliFemtoSimpleAnalysis}, is a good example of this. We discuss this in
439Section~\ref{sec:analysisLevel}.
440
441\subsubsection{Action flow}
442Briefly, each time \name{AliFemtoManager}::\meth{ProcessEvent()} is invoked by the user (or Task, or whatever),
443it obtains an \name{AliFemtoEvent} from its \name{AliFemtoEventReader}.
444It then passes this \name{AliFemtoEvent} to each of its Writers through the \meth{WriteHbtEvent()} method.
445Finally, it passes the \name{AliFemtoEvent} to each of its {\name AliFemtoAnalysis::}{\meth ProcessEvent({\args AliFemtoEvent*})}.
446
447
448
449\subsection{Analysis level}
450\label{sec:analysisLevel}
451
452The \name{AliFemtoAnalysis} is usually the focus of any \AliFemto session. As discussed in Section~\ref{sec:AliFemtoAnalysis},
453the only requirement of such an object in principle is that it must accept an \name{AliFemtoEvent} object via its \meth{ProcessEvent} method.
454However, in practice, \name{AliFemtoAnalysis}-derived classes almost always contain Cuts, CorrFctns, etc. We describe these
455here.
456
457A UML representation of the class structure of an Analysis is shown in Figure~\ref{fig:analysisUML}.
458
459\begin{figure}[t]
460\includegraphics[width=\textwidth]{Analysis.pdf}
461\caption{The basics of an Analysis configuration in UML representation. Most classes shown are base classes.
462Appending ``= 0'' to a method name denotes pure virtuality-- the method is not defined in the base class, but must
463be defined in any instantiated class which derives from it. Yellow classes at the periphery are bases for user-written
464classes.\label{fig:analysisUML}
465}
466\end{figure}
467
468\subsubsection{AliFemtoEventCut}
469
470The first action of an \name{AliFemtoAnalysis} is usually to invoke the method \name{AliFemtoEventCut::{\meth Pass(\args{AliFemtoEvent*})}}.
471This returns
472a boolean value (and may, internally, store information about the \name{AliFemtoEvent} passed to it). If the event does not
473Pass, no further processing is done by the AliFemtoAnalysis-- control returns to the \name{AliFemtoManager}.
474
475The Reference Manual gives the full implementation of a simple \name{AliFemtoEventCut}.
476
477
478\subsubsection{AliFemtoParticleCuts}
479\label{sec:AliFemtoParticleCuts}
480
481Depending on the topological nature of the particles being selected,
482one uses the class \name{AliFemtoTrackCut}, \name{AliFemtoV0Cut}, \name{AliFemtoKinkCut}, or \name{AliFemtoXiCut}.
483All of these inherit from \name{AliFemtoParticleCut};
484see Figure~\ref{fig:analysisUML}. As with all cuts, these classes have pure virtural \meth{Pass()} methods.
485An Analysis has two \name{AliFemtoParticle} cuts, corresponding to the two particles used in the correlation analysis.
486
487There is ``special'' behaviour when the \name{AliFemtoParticle} cuts are applied. For each AliFemtoTrack/V0/Kink/Xi which Passes the cuts,
488an \name{AliFemtoParticle} is created. (The \name{AliFemtoParticle} objects themselves
489are created and used within the Analysis-- the user is not concerned with them.)
490It is the \name{AliFemtoParticle} objects (not \name{AliFemtoTracks} etc) which are used at further steps in the Analysis
491for the current event. {\bf Important:} all \name{AliFemtoParticleCut}-derived objects set the mass of the particle it selects. Based on
492kinematic and PID information, the user, through the \name{AliFemtoParticleCut}, decides e.g. that the Track is a proton; the user needs to
493tell the \name{AliFemtoParticleCut} the mass of the proton; c.f. Section~\ref{sec:example}. When the \name{AliFemtoParticle} corresponding to this
494\name{AliFemtoTrack} is created, it is at this point that the mass of the proton is assigned to the particle.
495
496\subsubsection{AliFemtoPairCut}
497
498As the name suggests, user-written classes which derive from \name{AliFemtoPairCut} must have a \meth{Pass()} method selecting
499\name{AliFemtoPairs} for further processing. (\name{AliFemtoPair}s are created and used internally; the user does not interact with them.)
500These cuts may, for example, try to discriminate ``fake'' pairs caused by splitting or (for the reference pair distribution)
501those tracks which would merge.
502
503Importantly, the Analysis will automatically apply the {\it same} \name{AliFemtoPair} cut to pairs generated from ``real'' and from ``mixed''
504events. Almost always, this is very important for femtoscopic analyses. However, if neccessary, one may circumvent this behaviour
505by attaching \name{AliFemtoPairCut} objects to the correlation function object itself. In this case, different PairCuts may be applied to ``real'' and
506reference distributions.
507
508\subsubsection{AliFemtoCorrFctn}
509
510The ``end result'' of most femtoscopic studies is the correlation function. These compare somehow (often via a ratio of
511distributions, c.f. Equation~\ref{eq:usualC}) ``real'' and reference pairs. In general, then, a user-written class which
512derives from \name{AliFemtoCorrFctn} should implement \meth{AddRealPair(\args{AliFemtoPair})} and \meth{AddMixedPair(\args{AliFemtoPair})}
513methods. These methods may do whatever the user
514wishes, of course.
515
516Most CorrFctn classes are rather simple. See the Reference Manual for a full listing of an example.
517
518Often, one wishes to construct several correlation functions simultaneously (e.g. one in $Q_{inv}$, $\vec{q}_{3D}$, $\Theta_{opening}$ etc).
519For this reason, every \name{AliFemtoAnalysis} may have several \name{AliFemtoCorrFctn} objects.
520The same \name{AliFemtoPair}s are sent to each \name{AliFemtoCorrFctn}.
521
522
523\subsubsection{Action flow}
524
525The most important action of each \name{AliFemtoAnalysis} is in its \meth{ProcessEvent(\args{AliFemtoEvent*})} method.
526corresponds approximately to steps~\ref{it:EvCut}-\ref{it:Store} of the list in Section~\ref{sec:bones}.
527Upon being given an Event by the Manager, it first sends it to its EventCut. If \name{AliFemtoEventCut::\meth{Pass(\args{AliFemtoEvent*})}}
528returns false, the method returns with no further action.
529
530Otherwise, an \name{AliFemtoPicoEvent} (essentially two lists of \name{AliFemtoParticle}s, c.f. Section~\ref{sec:AliFemtoParticleCuts}) is formed from
531the particles which Pass the \name{AliFemtoParticleCuts}. All possible pairs of these Particles are tested by the
532\name{AliFemtoPairCut::\meth{Pass()}} method,
533and those which Pass are sent to each of the \name{AliFemtoCorrFctn}'s \meth{AddRealPair(\args{AliFemtoPair*})} methods.
534
535Then, ``mixed'' \name{AliFemtoPair}s are formed by combining all \name{AliFemtoParticles} from the present event with those of previously-processed
536events, which have been stored in a collection of \name{AliFemtoPicoEvents}. (C.f. Figure~\ref{fig:analysisUML}; the user need not interact
537with this aspect of the code.) All such Pairs are formed. These are evaluated by the \name{AliFemtoPairCut} and those which Pass are sent to
538each of the \name{AliFemtoCorrFctn::\meth{AddMixedPair(\args{AliFemtoPair*})}} methods.
539
540Finally, the AliFemtoPicoEvent is put into the list (c.f. Figure~\ref{fig:analysisUML}) of such objects for mixing with future events,
541and control returns to the AliFemtoManager.
542
543As mentioned previously, the above procedure is just one typical of Analyses. In principle, one's specific Analysis class might
544email the user each pair, or each particle at random.
545
546
547\subsection{Reports}
548\label{sec:reports}
549
550Note that most classes above have \meth{Report()} methods. These are simple user-written methods returning strings which can tell something about
551what happened to that class during the study. E.g. a \name{AliFemtoEventCut} might Report on how many events passed/failed the
552cut. The content of the Report is up to the user; it might be even an empty string or your spouse's name.
553
554
555At the end of the session, the Reports of the various objects are concatenated in the following way.
556
557Each AliFemtoAnalysis
558collects Reports from its AliFemtoEventCut, AliFemtoParticleCut (for both the first and second particle), AliFemtoPairCut, and all
559of its AliFemtoCorrFctn objects. These are concatenated with any other information coming from the AliFemtoAnalysis itself.
560This constitutes the Report of the AliFemtoAnalysis.
561
562The AliFemtoManager collects Reports from each of its AliFemtoEventReader objects (both those in read and write mode)
563and from each of its AliFemtoAnalysis objects. These are concatenated and constitute the final Report
564printed to the screen (or log file).
565
566%==========================================================
567%==================== Example =============================
568%==========================================================
569
570
571\subsection{Example macro}
572\label{sec:example}
573
574Here, we show a specific macro which may be used to perform two Analyses which produce several CorrFctns. The example
575shown is for use in ``pure'' root. It may also be used as a simple macro in AliRoot or, as been previously mentioned,
576it is straightforward to wrap it in a Task or Train (or, in STAR, the BFC Chain).
577
578Figures~\ref{fig:exampleMacroGload}-\ref{fig:exampleEventLoop} in this Section are only cartoons suggesting what the
579code in the macro does-- they are not UML. All classes in this specific example are user-written
580classes, with the exception of AliFemtoManager. (Several of them such as the \name{AliFemtoEventReaderESD} class,
581have already been written and are provided in the \cvs checkout.)
582 For details, see Sections~\ref{sec:topLevel} and~\ref{sec:analysisLevel}.
583
584
585\subsubsection{Initialization and plugging in the Reader}
586%--------------------- Example Step 1 ----------------------
587
588\begin{figure}[t]
589\includegraphics[width=\textwidth]{ExampleMacro1.pdf}
590\caption{The preliminaries in a \AliFemto macro: loading of the libraries, instantiation of top-level structure, and
591instantiating and plugging in a Reader.
592The cartoon is meant so suggest the action of the macro commands; it is not a UML diagram.
593\label{fig:exampleMacroGload}
594}
595\end{figure}
596
597\begin{figure}[t]
598\includegraphics[width=\textwidth]{ExampleMacro2.pdf}
599\caption{The construction of a specific \name{AliFemtoAnalysis}, including its cuts and collection of three CorrFctn
600objects. The dark shaded region in the cartoon denotes a collection.
601\label{fig:exampleFirstAnalysisStart}
602}
603\end{figure}
604
605\begin{figure}[t]
606\includegraphics[width=\textwidth]{ExampleMacro3.pdf}
607\caption{The final step in configuring the first Analysis is to set the number of events to mix when constructing
608the ``background'' distribution. This finished Analysis (dark grey box) is then added to the collection of Analyses
609for the \name{AliFemtoManager} (large light grey box), thus making the connection between these objects.
610\label{fig:exampleFirstAnalysisFinish}
611}
612\end{figure}
613
614\begin{figure}[t]
615\includegraphics[width=\textwidth]{ExampleMacro4.pdf}
616\caption{A second Analysis is instantiated, configured, and added to the collection. The same
617proceedure is followed as for the fist Analysis (Figures~\ref{fig:exampleFirstAnalysisStart}
618and~\ref{fig:exampleFirstAnalysisFinish}), though the two Analyses know nothing about each other.
619\label{fig:exampleSecondAnalysis}
620}
621\end{figure}
622
623\begin{figure}[t]
624\includegraphics[width=\textwidth]{ExampleMacro5.pdf}
625\caption{Construction of the AliFemto study complete, event looping is trivial. Note that all
626interaction with the code is through only a few methods of the AliFemtoManager object.
627\label{fig:exampleEventLoop}
628}
629\end{figure}
630
631Figure~\ref{fig:exampleMacroGload} shows the beginning of the macro.
632As usual in a root macro, libraries are loaded first. For the femtoscopic analysis itself, only the AliFemto and AliFemtoUser
633libraries need be loaded. All internal \AliFemto classes such as \name{AliFemtoPair} are found in the AliFemto directory.
634That directory also has a few simple CorrFcn, Reader, and Cut classes. The user will probably want to start with these and
635elaborate upon them; in this case, her new classes should go into the AliFemtoUser area.
636
637In this example
638we use the specific \name{AliFemtoEventReader}-derived class \name{AliFemtoEventReaderESD}; not surprisingly, this Reader needs
639the ESD library loaded as well.
640
641
642
643Since all Readers are user-written, their configuration
644methods will be specific to the class used. This is as it should be, since attempts to ``foresee'' all possible
645uses of the Reader classes will ultimately result in limitations later on, and sloppy work-arounds.
646
647The \name{AliFemtoManager} is instantiated; note that its pointer is declared outside the scope of the macro, at the top.
648Finally, the \name{AliFemtoEventReaderESD} object is ``plugged in'' to the \name{AliFemtoManager}. This is indicated by the arrow
649in the cartoon; recall that this is not a UML diagram.
650
651\subsubsection{Adding Analyses}
652%--------------------- Example Step 2 ----------------------
653
654
655In Figure~\ref{fig:exampleFirstAnalysisStart} we see construction of a specific Analysis (c.f.
656Section~\ref{sec:analysisLevel}).
657An \name{AliFemtoAnalysis}-derived class, \name{AliFemtoVertexAnalysis}, is
658instantiated. (For reference, this class takes care to ``mix'' only those events close to each other in
659primary vertex position; it is very commonly used.) All configuration (vertex range, number of bins) takes
660place in the constructor, in this specific class.
661
662The Cuts are (i) instantiated, (ii) configured, and (iii) ``plugged into'' this Analysis.
663Finally, three correlation functions are instantiated, configured, and added to the collection
664of CorrFctns for this analysis. (The collection is suggested by the dark-shaded box in the cartoon.)
665We note that one of the CorrFctn classes there is \name{OpeningAngleCorrFctn}. The fact that its name
666does not begin with ``AliFemto'' is a clue that this class is user-written, for her own purposes; it would
667not be included in ALICE nightly builds and would sit in the AliFemtoUser area.
668
669Two notes: Firstly, we see that the same AliFemtoTrackCut is used for both the first and second particle-- this
670is an analysis of identical pions. Secondly, as mentioned in Section~\ref{sec:AliFemtoParticleCuts}, all AliFemtoParticleCuts
671{\it must} define a particle mass. This is not special to this specific example.
672
673%--------------------- Example Step 3 ----------------------
674
675
676In Figure~\ref{fig:exampleFirstAnalysisStart}, the conglomeration of Analysis-related objects is not related to
677the AliFemtoManager instantiated in the previous Figure. In Figure~\ref{fig:exampleFirstAnalysisFinish}, the connection
678is made. Firstly, the ``final detail'' for the Analysis is completed-- the number of events to mix for the reference
679distribution is set, and the now-fully-configured Analysis is added to the collection of Analyses (denoted by the large
680grey box).
681
682%--------------------- Example Step 4 ----------------------
683
684
685The structure is now complete in principle-- a useful correlation study may proceed.
686We may add one or more completely seperate Analyses, if we wish. This is shown in
687Figure~\ref{fig:exampleSecondAnalysis}. The only points here are that the second
688(and any subsequent) Analyses are set up similarly to the first one discussed above, and
689there is no connection the Analyses in the AliFemtoManager's collection of Analyses.
690
691
692\subsubsection{Processing data}
693\label{sec:ProcessingData}
694%--------------------- Example Step 5 ----------------------
695
696
697Finally, Figure~\ref{fig:exampleEventLoop} moves beyond construction of the collection
698of objects, and commands a processing of the data. We note that all ``external'' interaction
699is with the AliFemtoManager class. If the Reader needs to interact with the ``outside world''
700(e.g. by opening a file or pointing to a location in memory), then it is up to that specific
701class, using its own specific methods, to take care of that.
702
703In Figure~\ref{fig:exampleEventLoop}, the processing is ordered within a ``pure root'' macro
704directly. This can be different in other frameworks. For example, in the STAR Maker schema~\cite{StarMaker},
705the AliFemtoManager Init(), ProcessEvent(), Report() and Finish() methods will be invoked by the AliFemtoMaker
706Init(), Make(), and Finish() methods. Indeed, the AliFemtoMaker does almost nothing else than perform these
707simple invocations.
708
709
710\section{Code Organization}
711
712
713\subsection{Directory structure: core and user classes}
714\label{sec:coreUser}
715
716The femtoscopy analysis effort in ALICE falls in the soft physics working group (PWG2).
717Thus, when checking out the full \AliRoot from \cvs, it will be found in the {\tt PWG2/FEMTOSCOPY/}
718area. (One may also check out only PWG2 files using\\
719{\tt cvs -qz2 -d :pserver:cvs@alisoft.cern.ch:/soft/cvsroot co PWG2}.\\ This is useful if running
720\AliFemto in ``standalone'' mode.)
721
722In this directory are found two subdirectories. The first is {\tt AliFemto/},
723which holds about 80 classes (as of \today), such as \name{AliFemtoManager}, \name{AliFemtoPair}, etc.
724It also holds all of the base classes for user-derived code (e.g. \name{AliFemtoCorrFctn}) and one
725or two simple examples of classes which derive from these (e.g. \name{AliFemtoQinvCorrFctn}). These
726last might be useful templates for users writing more sophisticated Cuts, CorrFctns, Readers, Analyses, etc.
727The {\tt AliFemto/} subdirectory is included in the official nightly build. Files there must obey
728ALICE coding standards, and limited \cvs access is anticipated.
729
730The second directory is {\tt AliFemtoUser/}. Files in this subdirectory are not included in the nightly
731build. This area is meant to be a repository for user code, typically Cuts, CorrFctns, etc, which might
732be of interest to others working on some analysis. It is \cvs archived, and widespread read/write \cvs access
733is anticipated.
734
735Seperate shared object (.so) libraries are built for the {\tt AliFemto/} and {\tt AliFemtoUser/}
736area; c.f. the macro snip in Figure~\ref{fig:exampleMacroGload}.
737
738
739\section{Known problems}
740
741As of \today, there are no known problems with \AliFemto. However, this Users' Guide is incomplete, in that
742it does not discuss so-called ``theoretical'' correlation studies covered in the \name{AliFemtoModel*} classes.
743This will be remedied in the next version of the Users' Guide. In the meantime, see an excellent tutorial
744on the subject on the ALICE femtoscopy webpage\\
745 {\tt http://aliceinfo.cern.ch/Collaboration/PhysicsWorkingGroups/PWG2/Femtoscopy/}.
746
747
748
749\clearpage
750
751\part{Reference Manual}
752\label{part:RefMan}
753
754The Reference Manual is being finalized.
755
756\clearpage
757
758
759
760%%%%%%%%\section{References}
761\begin{thebibliography}{99}
762
763 \bibitem{UMLreference}
764 The Unified Modeling Language (UML),
765 http://www.omg.org/technology/documents/formal/uml.htm ;
766 http://en.wikipedia.org/wiki/Unified\_Modeling\_Language
767
768\bibitem{Lisa:2005dd}
769 M.~A.~Lisa, S.~Pratt, R.~Soltz and U.~Wiedemann,
770 %``Femtoscopy in relativistic heavy ion collisions,''
771 Ann.\ Rev.\ Nucl.\ Part.\ Sci.\ {\bf 55}, 357 (2005)
772 [arXiv:nucl-ex/0505014].
773 %%CITATION = NUCL-EX 0505014;%%
774
775\bibitem{HanburyBrown:1954}
776 Hanbury-Brown, R., and Twiss, R.Q.
777 %''A new type of interferometer for use in radio-astronomy'',
778 Phil. Mag. {\bf 45}, 663 (1954).
779
780\bibitem{Goldhaber:1960sf}
781 Goldhaber, Gerson and Goldhaber, Sulamith and Lee, Won-Yong
782 and Pais, Abraham,
783 %''Influence of Bose-Einstein statistics on the antiproton
784 proton annihilation process''
785 Phys. Rev. {\bf 120} 300 (1960).
786
787\bibitem{Lednicky:2002fq}
788 Lednicky, R.,
789 %''Progress in correlation femtoscopy,''
790 nucl-th/0212089
791
792
793\bibitem{StarMaker}
794%Unfortunately, the best (!?!?) documentation of the basic STAR Maker analysis framework is
795%a brief presentation by Victor Perevoztchikov which may be found on the STAR computing
796%tutorial website:
797Tutorial by Victor Perevoztchikov
798http://www.star.bnl.gov/STAR/comp/train/tut/Maker-in-STAR/Victor-Makers.html
799
800\end{thebibliography}
801
802
803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
804%
805% The End
806%
807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
808
809\printindex
810
811\end{document}