1 \documentclass[a4paper]{book}
2 \usepackage[nottoc,numbib]{tocbibind}
3 \usepackage[english]{babel}
4 \usepackage[pdftex]{graphics} %enable pdfgraphics support necessary for pdflatex
7 \usepackage[small,bf]{caption}
14 \setlength{\@fptop}{0pt}
15 \setlength{\@fpsep}{5pt}
17 \renewcommand{\dotfill}{\leaders\hbox to 5pt{\hss.\hss}\hfill}
18 \usepackage[hmargin=1.2cm,vmargin=1.5cm]{geometry} %set custom margins
19 \usepackage{fancyhdr} %enable hyperlinking, highlight page numbers
22 \numberwithin{equation}{subsection}
27 \usepackage{subfigure}
35 \usepackage[usenames,dvipsnames]{xcolor}
36 \definecolor{listinggray}{gray}{0.9}
37 \definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
41 \definecolor{mygreen}{rgb}{0,0.6,0}
42 \definecolor{mygray}{rgb}{0.5,0.5,0.5}
43 \definecolor{mymauve}{rgb}{0.58,0,0.82}
46 backgroundcolor=\color{white}, % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}
47 basicstyle=\footnotesize, % the size of the fonts that are used for the code
48 breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
49 breaklines=true, % sets automatic line breaking
50 % captionpos=b, % sets the caption-position to bottom
51 commentstyle=\color{mygreen}, % comment style
52 deletekeywords={...}, % if you want to delete keywords from the given language
53 escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
54 extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
55 frame=single, % adds a frame around the code
56 keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
57 keywordstyle=\color{blue}, % keyword style
58 language=C, % the language of the code
59 morekeywords={*,...}, % if you want to add more keywords to the set
60 numbers=left, % where to put the line-numbers; possible values are (none, left, right)
61 numbersep=5pt, % how far the line-numbers are from the code
62 numberstyle=\tiny\color{mygray}, % the style that is used for the line-numbers
63 rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
64 showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
65 showstringspaces=false, % underline spaces within strings only
66 showtabs=false, % show tabs within strings adding particular underscores
67 stepnumber=1, % the step between two line-numbers. If it's 1, each line will be numbered
68 stringstyle=\color{mymauve}, % string literal style
69 tabsize=2, % sets default tabsize to 2 spaces
70 % title=\lstname % show the filename of files included with \lstinputlisting; also try caption instead of title
71 % in the end language and linenumbres will be called for each block, otherwise html conversion doesn't pick up on the proper markup ...
73 % tweak the the style a little bit
74 \lstdefinestyle{customc}{
75 % belowcaptionskip=1\baselineskip,
78 xleftmargin=\parindent,
80 % showstringspaces=false,
81 basicstyle=\footnotesize\ttfamily,
82 keywordstyle=\bfseries\color{green!40!black},
83 commentstyle=\itshape\color{mygray},
84 identifierstyle=\color{blue},
85 stringstyle=\color{orange},
89 \lstset{escapechar=@,style=customc}
90 \usepackage[sort&compress,numbers]{natbib}
92 \pagestyle{fancy} %enable custom headeres
94 \fancyfoot{} %clear predefined headers, then create your own:
95 \lhead{\footnotesize AliROOT Flow Package manual and documentation}
96 \rhead{\footnotesize The FLOW team}
97 \rfoot{\footnotesize Page \thepage\ of \pageref{LastPage}}
98 \lfoot{\footnotesize \rightmark}
99 \usepackage[bookmarks=true,
101 bookmarksnumbered=true, pdftex,
102 hyperindex=true,linktocpage]{hyperref}
104 bookmarks=true, % show bookmarks bar?
105 unicode=false, % non-Latin characters in Acrobat’s bookmarks
106 pdftoolbar=true, % show Acrobat’s toolbar?
107 pdfmenubar=true, % show Acrobat’s menu?
108 pdffitwindow=false, % window fit to page when opened
109 pdfstartview={FitH}, % fits the width of the page to the window
110 pdftitle={AliROOT Flow Package manual and documentation}, % title
111 pdfauthor={Redmer Alexander Bertens}, % author
112 pdfsubject={AliROOT Flow Package manual and documentation}, % subject of the document
113 pdfcreator={Redmer Alexander Bertens}, % creator of the document
114 pdfproducer={Redmer Alexander Bertens}, % producer of the document
115 pdfkeywords={ALICE} {AliROOT} {ROOT} {manual} {flow} {package} {software}, % list of keywords
116 pdfnewwindow=true, % links in new window
117 colorlinks=true, % false: boxed links; true: colored links
118 linkcolor=blue, % color of internal links
119 citecolor=green, % color of links to bibliography
120 filecolor=blue, % color of file links
121 urlcolor=blue % color of external links
128 \fancypagestyle{plain}
132 } % clear header and footer of plain page because of ToC
134 % tikxstyle for integration of tikz graphics
135 % for if in the future i'll find time for making a flowchart ...
136 \tikzstyle{every node}=[font=\tiny]
137 \tikzstyle{decision} = [rectangle, draw, fill=yellow!20,
138 rounded corners, minimum height=1.5em, minimum width=2.5em, inner sep=3pt]
139 \tikzstyle{decision2} = [rectangle, draw, fill=red!20,
140 rounded corners, minimum height=1.5em, minimum width=2.5em, inner sep=3pt]
141 \tikzstyle{decision3} = [rectangle, draw, fill=green!20,
142 rounded corners, minimum height=1.5em, minimum width=2.5em, inner sep=3pt]
143 \tikzstyle{block} = [rectangle, draw, fill=blue!20,
144 rounded corners, minimum height=1.5em, minimum width=2.5em, inner sep=3pt]
145 \tikzstyle{line} = [draw, -latex']
146 \tikzstyle{cloud} = [draw, ellipse,fill=red!20,
148 \tikzstyle{sdecision} = [rectangle, draw, fill=yellow!20,
149 rounded corners, minimum height=1.5em, minimum width=2.5em, inner sep=3pt]
150 \tikzstyle{sblock} = [rectangle, draw, fill=blue!20,
151 rounded corners, minimum height=1.5em, minimum width=2.5em, inner sep=3pt]
152 \tikzstyle{scloud} = [draw, ellipse,fill=red!20,
154 \tikzstyle{ycloud} = [draw, ellipse,fill=yellow!20,
157 \renewcommand{\thefootnote}{\fnsymbol{footnote}}
166 {\LARGE \bf The FLOW Analysis Package}\\
170 \includegraphics[width=1.\textwidth]{figs/daVinci.png}
175 {\large \bf a short writeup}\\
179 Redmer Alexander Bertens \\ (\texttt{rbertens@cern.ch})
183 \thispagestyle{empty}
184 \pagenumbering{roman}
186 \renewcommand{\thefootnote}{\alph{footnote}}
188 \chapter{Introduction}
189 The intro to everything.
190 %-----------------------------------------------------------------------
191 \chapter{A Quick Start}
192 \section{The flow package}
194 The \texttt{ALICE flow package}\index{flow package}\index{ALICE flow package|see{flow package}}\footnote{The \texttt{ALICE} flow package is part of \texttt{AliROOT}\index{AliROOT}, the ALICE extension of the \texttt{ROOT} framework, which can be obtained from \href{http://git.cern.ch/pub/AliRoot}{http://git.cern.ch/pub/AliRoot}. The flow package itself is located in the folder \texttt{\$ALICE\_ROOT/PWG/FLOW/}, where \texttt{\$ALICE\_ROOT} refers to the source directory of \texttt{AliROOT}.}
195 contains most known flow analysis methods. In this chapter we give a few examples how to setup an
196 analysis for the most common cases. The chapters that follow provide more detailed information on the structure of the code
197 and settings of the various flow methods.
198 This write-up is however not a complete listing of the methods, for this the reader is referred to the header files.
200 \section{On the fly - getting started on a Toy MC}
201 To get started with the \texttt{flow package} we begin by generating a few simple Toy Monte Carlo events and performing a flow analysis on these simulated events, a so called `flow analysis on-the-fly'\footnote{The original on-the-fly manual is reprinted in the appendix (see \ref{sec:ante}) of this document.}. The steps which will be followed will be the same as when performing an analysis on data:
203 \item Prepare your \texttt{(Ali)ROOT} session by loaded the necessary libraries
204 \item Create the analysis method objects
205 \item Initialize the methods (which creates their histograms)
206 \item Define track cuts
207 \item Create flow events, which is a container class holding all necessary information (e.g. tracks) for the flow analysis of an event (collision) and actually do the analysis
208 \item Finish the analysis, which will calculate the final $v_n$ values
209 \item Write the results to an output file
211 In this Monte Carlo exercise, the flow event class will not receive data from a detector (e.g. an \texttt{NTuple}) , but instead generate toy events itself.
213 The macro \texttt{runFlowOnTheFlyExample.C}\index{On the fly}\index{runFlowOnTheFlyExample.C}\footnote{In aliroot, this macro can be found at \\ \texttt{\$ALICE\_ROOT/PWGCF/FLOW/Documentation/examples/runFlowOnTheFlyExample}} is a basic example of how the flow package works.
214 In this section we explain the main pieces of that macro.
216 \item To use the flow code the flow library needs to be loaded. In\index{libraries, AliROOT} \texttt{AliROOT}:
217 \begin{lstlisting}[language=C, numbers=left]
218 gSystem->Load("libPWGflowBase");\end{lstlisting}
219 In \texttt{root} additional libraries need to be loaded\index{libraries, ROOT}:
220 \begin{lstlisting}[language=C, numbers=left]
221 gSystem->Load("libGeom");
222 gSystem->Load("libVMC");
223 gSystem->Load("libXMLIO");
224 gSystem->Load("libPhysics");
225 gSystem->Load("libPWGflowBase");\end{lstlisting}
226 \item We need to instantiate the flow analysis methods which we want to use. In this example we will
227 instantiate two methods: the first which calculates the flow versus the reaction plane of the Monte Carlo, which is our reference value\index{reference value}\index{Monte Carlo Event Plane} (see section \ref{MC}), and second the so called Q-cumulant method (see section \ref{qvc}).
228 \begin{lstlisting}[language=C, numbers=left]
229 AliFlowAnalysisWithMCEventPlane *mcep = new AliFlowAnalysisWithMCEventPlane();
230 AliFlowAnalysisWithQCumulants *qc = new AliFlowAnalysisWithQCumulants();\end{lstlisting}
231 \item Each of the methods needs to initialize\index{initialize methods} (e.g. to define the histograms):
232 \begin{lstlisting}[language=C, numbers=left]
234 qc->Init();\end{lstlisting}
235 \item To define the particles we are going to use as Reference Particles\index{reference particles} \index{RP|see{reference particles}} (RP's, particles
236 used for the {\bf Q} vector) and the Particles Of Interest\index{particles of interest} \index{POI|see{particles of interest}} (POI's, the particles of which
237 we calculate the differential flow) we have to define two track cut objects\index{track cut object, simple}:
238 \begin{lstlisting}[language=C, numbers=left]
239 AliFlowTrackSimpleCuts *cutsRP = new AliFlowTrackSimpleCuts();
240 AliFlowTrackSimpleCuts *cutsPOI = new AliFlowTrackSimpleCuts();
241 cutsPOI->SetPtMin(0.2);
242 cutsPOI->SetPtMax(2.0); \end{lstlisting}
243 \item Now we are ready to start the analysis. For a quick start we make an event on the fly, tag the reference particles and particles of interest and pass it to the two flow methods.
245 We do this in an event loop. First define the number of events that need to be created, their multiplicity, and a value $v_2$ value, which can either be supplied as a fixed number (no $p_t$ dependence) of a function (to generate $p_t$ differential flow\footnote{The on the fly event generator is not limited to the generation of the second harmonic $v_2$, but to get started, this is a nice example.}
247 \begin{lstlisting}[language=C, numbers=left]
248 Int_t nEvents = 1000; // generate 1000 events
249 Int_t mult = 2000; // use track multiplicity of 2000
250 Double_t v2 = .05; // 5 pct integrated flow
251 // or sample differential flow
252 TF1* diffv2 = new TF1("diffv2", "((x<1.)*(0.1/1.)*x+(x>=1.)*0.1)", 0., 20.); \end{lstlisting}
254 Now we have all the ingredients to our first flow analysis
256 \begin{lstlisting}[language=C, numbers=left]
257 for(Int_t i=0; i<nEvents; i++) {
258 // make an event with mult particles
259 AliFlowEventSimple* flowevent = AliFlowEventSimple(mult,AliFlowEventSimple::kGenerate);
260 // modify the tracks adding the flow value v2
261 flowevent->AddV2(diffv2);
262 // select the particles for the reference flow
263 flowevent->TagRP(cutsRP);
264 // select the particles for differential flow
265 flowevent->TagPOI(cutsPOI);
266 // do flow analysis with various methods:
267 mcep->Make(flowevent);
269 // delete the event from memory
272 \item To fill the histograms which contain the final results we have to call Finish for each method:
273 \begin{lstlisting}[language=C, numbers=left]
275 qc->Finish(); \end{lstlisting}
276 \item This concludes the analysis and now we can write the results into a file. Two options for writing the input to a file are available:
278 \item Create a new output file and write the output to this file
279 \begin{lstlisting}[language=C, numbers=left]
280 TFile *outputFile = new TFile("outputMCEPanalysis.root","RECREATE");
281 mcep->WriteHistograms();
282 TFile *outputFile = new TFile("outputQCanalysis.root","RECREATE");
283 qc->WriteHistograms();\end{lstlisting}
285 Please note that this will create a new output file, and overwrite any existing filse called \texttt{AnalysisResults.root}.
287 \item To write the output of multiple analyses into subdirectories of one file, one can do the following:
288 \begin{lstlisting}[language=C, numbers=left]
289 TFile *outputFile = new TFile("AnalysisResults.root","RECREATE");
290 TDirectoryFile* dirQC = new TDiretoryFile("outputQCanalysis", "outputQCanalysis");
291 qc->WriteHistograms(dirQC);
292 TDirectoryFile* dirMCEP = new TDiretoryFile("outputMCEPanalysis", "outputMCEPanalysis");
293 mcep->WriteHistograms(dirMCEP);
297 Note that \texttt{AnalysisResults.root} \index{AnalysisResults.root} is the default name given to analyses in \texttt{AliROOT}. Many macros in \texttt{AliROOT} will expect a file \texttt{AnalyisResults.root} as input, so for most users it will be convenient to follow this convention.
299 When done with running the analysis, do not forget to write the file to disk by calling
300 \begin{lstlisting}[language=C, numbers=left]
301 TFile::Close(); // write the buffered file to disk \end{lstlisting}
304 \section{What is in the output file ?}
305 \index{output file} Now we have written the results into a file, but what is in there?
307 Although the output of different flow analysis techniques might differ slightly as a result of their different approaches at estimating $v_2$, the output files containers are always built in a similar way.
309 \subsection{AliFlowCommonHists - Output objects}\label{sec:commonhists}
310 Objects of two types are stored in the output of the flow analysis\footnote{Make sure that \texttt{libPWGflowBase.so} is loaded in your \texttt{(Ali)ROOT} session, otherwise these objects will be unknown.}
312 \item \texttt{AliFlowCommonHist}\index{AliFlowCommonHist}, which is a class that contains common histograms for the flow analysis (e.g. QA histograms and histograms that contain the analysis flags which were used). Depending on the type of flow analysis that was used, this object contains histograms from the following list:
313 \begin{lstlisting}[language=C, numbers=left]
314 Bool_t fBookOnlyBasic; // book and fill only control histos needed for all methods
315 TH1F* fHistMultRP; // multiplicity for RP selection
316 TH1F* fHistMultPOI; // multiplicity for POI selection
317 TH2F* fHistMultPOIvsRP; // multiplicity for POI versus RP
318 TH1F* fHistPtRP; // pt distribution for RP selection
319 TH1F* fHistPtPOI; // pt distribution for POI selection
320 TH1F* fHistPtSub0; // pt distribution for subevent 0
321 TH1F* fHistPtSub1; // pt distribution for subevent 1
322 TH1F* fHistPhiRP; // phi distribution for RP selection
323 TH1F* fHistPhiPOI; // phi distribution for POI selection
324 TH1F* fHistPhiSub0; // phi distribution for subevent 0
325 TH1F* fHistPhiSub1; // phi distribution for subevent 1
326 TH1F* fHistEtaRP; // eta distribution for RP selection
327 TH1F* fHistEtaPOI; // eta distribution for POI selection
328 TH1F* fHistEtaSub0; // eta distribution for subevent 0
329 TH1F* fHistEtaSub1; // eta distribution for subevent 1
330 TH2F* fHistPhiEtaRP; // eta vs phi for RP selection
331 TH2F* fHistPhiEtaPOI; // eta vs phi for POI selection
332 TProfile* fHistProMeanPtperBin; // mean pt for each pt bin (for POI selection)
333 TH2F* fHistWeightvsPhi; // particle weight vs particle phi
334 TH1F* fHistQ; // Qvector distribution
335 TH1F* fHistAngleQ; // distribution of angle of Q vector
336 TH1F* fHistAngleQSub0; // distribution of angle of subevent 0 Q vector
337 TH1F* fHistAngleQSub1; // distribution of angle of subevent 1 Q vector
338 TProfile* fHarmonic; // harmonic
339 TProfile* fRefMultVsNoOfRPs; // <reference multiplicity> versus # of RPs
340 TH1F* fHistRefMult; // reference multiplicity distribution
341 TH2F* fHistMassPOI; // mass distribution for POI selection \end{lstlisting}
342 This information is from the header file of the AliFlowCommonHist object\footnote{The headers of both output objects can be found in \texttt{\$ALICE\_ROOT/PWG/FLOW/Base/}.}
343 \item \texttt{AliFlowCommonHistResults}\index{AliFlowCommonHistResults} is an object designed to hold the common results of the flow analysis\footnote{The word common here is used to indicate histograms that hold observables which are evaluated in all flow analysis methods. Specific analysis methods may however store additional histograms which are not covered in this list!}. The possible common histograms stored in this object are
344 \begin{lstlisting}[language=C, numbers=left]
345 TH1D* fHistIntFlow; // reference flow
346 TH1D* fHistChi; // resolution
347 // RP = Reference Particles:
348 TH1D* fHistIntFlowRP; // integrated flow of RPs
349 TH1D* fHistDiffFlowPtRP; // differential flow (Pt) of RPs
350 TH1D* fHistDiffFlowEtaRP; // differential flow (Eta) of RPs
351 // POI = Particles Of Interest:
352 TH1D* fHistIntFlowPOI; // integrated flow of POIs
353 TH1D* fHistDiffFlowPtPOI; // differential flow (Pt) of POIs
354 TH1D* fHistDiffFlowEtaPOI; // differential flow (Eta) of POIs \end{lstlisting}
357 The titles of the histograms in the output object differ from the names of the pointers given in the two lists printed above, but the lists give an overview of what is available; the easiest way however of getting acquainted with where to find histograms in the output is browsing them in \texttt{ROOT's TBrowser}\index{TBrowser} (see figure \ref{fig:browserExample}).
358 \begin{lstlisting}[language=C, numbers=left]
359 new TBrowser(); \end{lstlisting}
361 \includegraphics[width=0.70\textwidth]{figs/browserExample.png}
362 \caption[TBrowser with output file]{Example of output file opened in a TBrowser, results of differential $v_2$ analysis with second order Q-cumulant analysis are shown.}
363 \label{fig:browserExample}
366 The \texttt{AliFlowCommonHist} and \texttt{AliFlowCommonHistResults} classes are derived from the generic \texttt{TNamed}\index{TNamed} \texttt{ROOT} object and can be written to a \texttt{ROOT} file. The flow analysis tasks will, as output, write the complete \texttt{AliFlowCommonHist} and \texttt{AliFlowCommonHistResults} objects to file at the end of an analysis. To read the content of these objects, the \texttt{libPWGflowBase} library must be loaded in your \texttt{ROOT} session.
368 \subsubsection{Comparing flow results}
369 A convenient way of comparing the results of the different flow analysis strategies that have been used is invoking the macro \texttt{compareFlowResults.C}\footnote{\texttt{\$ALICE\_ROOT/PWGCF/FLOW/macros/compareFlowResults.C}}\index{compareFlowResults}. This macro will read the analysis output file \texttt{AnalysisResults.root}, extract the requested results from it and plot them. For a full overview of what can be done with the macro, the reader is referred to the macro itself and its ample documentation. To run the macro on the dataset that we have just generated, simply do
370 \begin{lstlisting}[language=C, numbers=left]
371 .L compareFlowResults.C
372 compareFlowResults(TSring("")) // the empty suffix indicates on the fly events \end{lstlisting}
375 \includegraphics[width=0.70\textwidth]{figs/compareFlowResults.png}
376 \caption[Comparing on the fly flow results]{Example of inspecting the output file of the on the fly analysis with the \texttt{compareFlowResults.C macro}.}
377 \label{fig:browserExample}
380 \subsection{redoFinish.C}
381 \index{redoFinish.C} When analysis is run in parallel, resulting in large, merged files (e.g. when running on \texttt{GRID}\index{GRID}) the output of the flow analysis tasks in \texttt{AnalysisResults.root} is typically wrong, as merging files via \texttt{ROOT's} \texttt{TFileMerger}\index{TFileMerger} will trivially sum up results in all histograms.
383 The \texttt{redoFinish.C}\footnote{\texttt{\$ALICE\_ROOT/PWGCF/FLOW/macros/refoFinish.C}} macro re-evaluates all output that cannot trivially be merged. To use \texttt{redoFinish.C}, make sure your analysis output file is called \texttt{mergedAnalysisResults.root} and simply run the macro
384 \begin{lstlisting}[language=C, numbers=left]
386 redoFinish(); \end{lstlisting}
387 \texttt{redoFinish.C} will produce a new \texttt{AnalysisResults.root} file with the corrected results by calling the \texttt{::Finish()}\index{Finish()} function on all known output structures in the \texttt{mergedAnalysisResults.root}\index{mergedAnalysisResults} file. Additionally \texttt{redoFinish.C} can be used to repeat the call to \texttt{::Finish()} with different settings, which might alter the outcome of the flow analysis (e.g. use a different strategy to correct for non-uniform acceptance). This will be explained in more detail in the following sections.
389 \chapter{The Program}
390 The basic idea behind the flow package is that from whatever input you have, a \emph{flow event}\index{flow event} is constructed, which is then passed to one or more flow analysis methods\index{flow analysis method} (e.g. the scalar product method\index{scalar product} or Q-cumulant\index{Q-cumulant} method). The flow event is a collection of \emph{flow tracks}\index{flow track}, which are simple objects carrying only the kinematic information that is necessary to do flow analysis. By setting up the flow package in this way, the flow analysis methods can analyze input from various sources, be it ALICE data, Monte Carlo events, STAR data, etc, etc, as long as the flow event is properly filled\index{STAR input} \index{Monte Carlo input}. This might all sound a bit abstract at this point; this chapter however will explain all details and relevant classes in detail. For those who are impatient and prefer seeing the flow package in action, section \ref{sec:example} gives a step-by-step example of doing a $\pi^{\pm}$ $v_2$ analysis in the \texttt{AliROOT} analysis framework.
395 \includegraphics[width=.75\textwidth]{figs/flowChart.png}
396 \caption{Schematic presentation of the organization of the flow package. Input, which can come from any kind of source, is converted to a generic \texttt{AliFlowEventSimple} object, which in turn is passed to the analysis methods.}
397 \label{fig:flowchart}
400 Figure \ref{fig:flowchart} gives a simple schematic representation\index{flowchart} of the flow package. Input events (in the case of the figure this is either ESDs or AODs) pass a set of event cuts (the common cuts) and are then converted to a flow event (stored as an \texttt{AliFlowEventSimple}\index{AliFlowEventSimple} object). This flow event holds a collection of flow tracks (\texttt{AliFlowTrackSimple}\index{AliFlowTrackSimple} objects) which are passed to flow analysis methods. The only steps of this flow chart which depend on \texttt{AliROOT} libraries are the ones handling \texttt{ALICE} data types (the ESDs or AODs). The rest of the analysis chain (the \texttt{AliFlowEventSimle} and the analysis methods) have no specific \texttt{AliROOT} dependence and are just simple \texttt{c++} objects. Therefore, the flow package is split into two libraries
402 \item [libPWGflowBase] \index{libPWGflowBase}The base library, which has no specific \texttt{AliROOT} dependencies. This library holds objects such as the \texttt{AliFlowEventSimple} and \texttt{AliFlowTrackSimple}, and analysis methods classes. The analysis methods classes follow the naming scheme: \texttt{AliFlowAnalysisWith$\ast$} where $\ast$ denotes a specific analysis method. All classes which end up in the \text{libPWGflowBase.so} shared object can be found in \texttt{\$ALICE\_ROOT/PWG/FLOW/Base};
403 \item [libPWGflowTasks] \index{libPWGflowTasks} The tasks library, which has specific \texttt{AliROOT} dependencies. Contrary to what the name suggests, this library does not just hold tasks, but actually comprises all classes of the flow package which need to include \texttt{AliROOT} specific classes. This ranges from classes to read the AOD or ESD input data (important examples are the \texttt{AliFlowEvent}\index{AliFlowEvent} and \texttt{AliFlowTrackCuts}\index{AliFlowTrackCuts}, which will be discussed later on in this chapter) and the \texttt{AliAnalysisTask$\ast$} classes, which are analysis tasks, derived from \texttt{AliAnalysisTaskSE} which can be used in the \texttt{AliROOT} analysis framework and are actually just interface classes to the underlying flow analysis methods of libPWGflowBase. The \text{libPWGflowTasks.so} shared object can be found in \texttt{\$ALICE\_ROOT/PWG/FLOW/Tasks};
407 \section{Flow Event}\index{flow event}
408 Every flow analysis in the flow package starts with the flow event. As mentioned earlier, the flow event is a simple container class which holds a collection of flow tracks, which are in turn fed to the flow analysis methods.
409 \subsection{Input data}\index{input data}
410 Before passing the flow event to the flow analysis methods, it needs to be filled with a set of flow tracks. In general, a distinction is made between \emph{reference particles} (or \emph{RP's}), which are particles that are used to build the \textbf{Q} vector(s), and \emph{particles of interest} (or \emph{POI's}), which are the particles of which you'll calculate the differential flow. The flow event and the flow analysis methods are designed to keep track of which flow tracks are POI's, RP's (or even both at the same time), which is important to avoid auto-correlation effects which can distort the $v_n$ measurement. The user of the flow package however is responsible for properly setting up the analysis!
412 The flow event can be filled with input from many sources. In the second chapter of this manual, a simple method has been shown where the flow event (the \texttt{AliFlowEventSimple} object) fills itself by generating a set of Monte Carlo tracks by sampling kinematic variables from supplied p.d.f.'s. Using this method is a very effective tool for testing and developing new flow analysis methods (if you generate events with a certain $v_2(p_t)$ and then retrieve the same $v_2(p_t)$ from your flow analysis method, you can use that as a tool to proof the validation of your analysis method) but if you want to do a data analysis, a somewhat more advanced - but not difficult - approach is necessary.
414 Filling a flow event from data can be performed either `by-hand' (which is covered in section \ref{sec:exotic} on more exotic analyses), but the most commonly used method of filling a flow event in the \texttt{AliROOT} analysis framework is using the dedicated task \texttt{AliAnalysisTaskFlowEvent}\index{AliAnalysisTaskFlowEvent}.
416 The idea behind this is the following:
418 \item Setup the \texttt{AliAnalysisTaskFlowEvent} task to receive input events (e.g. \texttt{AODs}, \texttt{ESDs}, \texttt{MC}, $\ldots$;
419 \item Define two sets of track selection criteria (colloquially referred to as \emph{track cuts}), one for POI's and one for RP's;
420 \item Pass these two sets of track cuts to the \texttt{AliAnalysisTaskFlowEvent};
421 \item The \texttt{AliAnalysisTaskFlowEvent} will convert the tracks of each input event to a set of \texttt{AliFlowSimpleTracks}. Depending on whether or not a track passes the track selection for POI's or RP's, the \texttt{AliFlowSimpleTrack} is labeled as a POI or RP (or both. In the case where a track does not meet any of the track selection criteria, it is omitted from the \texttt{AliFlowSimpleTrack} collection and not added to the flow event);
422 \item All the \texttt{AliFlowSimpleTracks} are added to the flow event which is passed to the flow analysis methods.
425 \subsection{Event selection}\index{event selection}
426 When using the \texttt{AliAnalysisTaskFlowEvent} task to create your flow event, the \texttt{AliAnalysisTaskFlowEvent} task is responsible for ensuring that only good quality tracks enter into your analysis by making sensible track selections. The first step however at safeguarding track quality is making sure that the events that are accepted by \texttt{AliAnalysisTaskFlowEvent} pass sane event selection criteria.
428 \subsubsection{Trigger selection}\index{event selection!trigger selection}
429 A certain combination a of detector signals (a \emph{trigger}) is required for an event to be written to storage. Different types of analyses might require different types of events, and hence, different types of triggers.
431 You can set a trigger by calling
432 \begin{lstlisting}[language=C, numbers=left]
433 AliAnalysisTaskFlowEvent::SelectCollisionCandidates(UInt_t offlineTriggerMask);\end{lstlisting}
434 where \texttt{offlineTriggerMask} is the trigger mask corresponding to the desired trigger. A list of all available triggers, with a short descrption, can be found in the header file of the \texttt{AliVEvent} class\footnote{\texttt{\$ALICE\_ROOT/...}}. This function, however, is not implement in the \texttt{AliAnalysisTaskFlowEvent} itself, but rather in the base class of which most of the analysis task classes within \texttt{AliROOT} are derived: the \texttt{AliAnalysisTaskSE} class (which is designed to handle a single event, hence the suffix `SE'). For each event that is written from a file, but function \texttt{AliAnalysisTaskSE::Exec()} is called, which - among other things - checks if an event passes the requested trigger selection, and if so, calls the \texttt{UserExec()} function of your analysis task. In the case of the \texttt{AliAnalysisTaskFlowEvent} this is the \texttt{AliAnalysisTaskFlowEvent::UserExec()}, which creates \texttt{AliFlowSimpleTracks} and fills the flow event.
436 A general remark about trigger selection in flow analyses is that the non-uniform acceptance correction methods that are implemented in the flow package assume a flat \textbf{Q} vector distribution. Specific triggers (e.g. EMCal triggers) result in a \textbf{Q} vector bias which should \emph{not} be corrected as they invalidate that assumption. A safe approach is therefore using a minimum bias trigger for your analysis (such as \texttt{AliVEvent::kMB}), other triggers selections will not a-priori lead to problems, but use them with caution!
438 \subsubsection{Event cuts}\index{event selection!event cuts}
439 In addition to trigger selection, generally one wants to perform additional event (quality) selection. The flow package contains an event cuts class which can be used to perform event selection, the \texttt{AliFlowEventCuts} object\footnote{\texttt{\$ALICE\_ROOT/PWG/FLOW/Tasks/AliFlowEventCuts.cxx}}. \index{AliFlowEventCuts}
441 To use the event cuts object in combination with the \texttt{AliAnalysisTaskFlowEvent} task, simply create the event cuts object, configure it and pass it to the \texttt{AliAnalysisTaskFlowEvent}:
442 \begin{lstlisting}[language=C, numbers=left]
443 AliFlowEventCuts* cutsEvent = new AliFlowEventCuts("EventCuts");
444 // configure some event cuts, e.g. centrality
445 cutsEvent->SetCentralityPercentileRange(20., 30.);
446 // pass it to the flow event task via the setter
447 AliAnalysisTaskFlowEvent::SetCutsEvent(cutsEvent);\end{lstlisting}
449 The available cut parameters in the flow event cuts object are\index{event selection!parameters}
450 \begin{lstlisting}[language=C, numbers=left]
451 Bool_t fCutNumberOfTracks;//cut on # of tracks
452 Int_t fNumberOfTracksMax; //limits
453 Int_t fNumberOfTracksMin; //limits
454 Bool_t fCutRefMult; //cut on refmult
455 refMultMethod fRefMultMethod; //how do we calculate refmult?
456 Bool_t fUseAliESDtrackCutsRefMult; //use AliESDtrackCuts for refmult calculation
457 AliESDtrackCuts::MultEstTrackType fRefMultMethodAliESDtrackCuts;
458 Int_t fRefMultMax; //max refmult
459 Int_t fRefMultMin; //min refmult
460 AliFlowTrackCuts* fRefMultCuts; //cuts
461 AliFlowTrackCuts* fMeanPtCuts; //mean pt cuts
462 AliFlowTrackCuts* fStandardTPCcuts; //Standard TPC cuts
463 AliFlowTrackCuts* fStandardGlobalCuts; //StandardGlobalCuts
464 Bool_t fCutPrimaryVertexX; //cut on x of prim vtx
465 Double_t fPrimaryVertexXmax; //max x prim vtx
466 Double_t fPrimaryVertexXmin; //min x prim vtx
467 Bool_t fCutPrimaryVertexY; //cut on y of prim vtx
468 Double_t fPrimaryVertexYmax; //max y prim vtx
469 Double_t fPrimaryVertexYmin; //min y prim vtx
470 Bool_t fCutPrimaryVertexZ; //cut on z of prim vtx
471 Double_t fPrimaryVertexZmax; //max z prim vtx
472 Double_t fPrimaryVertexZmin; //min z prim vtx
473 Bool_t fCutNContributors; //cut on number of contributors
474 Int_t fNContributorsMax; //maximal number of contrib
475 Int_t fNContributorsMin; //minimal number of contrib
476 Bool_t fCutMeanPt; //cut on mean pt
477 Double_t fMeanPtMax; //max mean pt
478 Double_t fMeanPtMin; //min mean pt
479 Bool_t fCutSPDvertexerAnomaly; //cut on the spd vertexer anomaly
480 Bool_t fCutSPDTRKVtxZ; //require compatibility between SPDvertexz TRKvertexz
481 Bool_t fCutTPCmultiplicityOutliers; //cut TPC multiplicity outliers
482 Bool_t fCutTPCmultiplicityOutliersAOD; // cut TPC outliers in 10h or 11h aod
483 Bool_t fUseCentralityUnchecked; //use the unchecked method
484 refMultMethod fCentralityPercentileMethod; //where to get the percentile from
485 Bool_t fCutZDCtiming; //cut on ZDC timing
486 AliTriggerAnalysis fTrigAna; //trigger analysis object
487 Bool_t fCutImpactParameter; //cut on impact parameter (MC header)
488 Double_t fImpactParameterMin; // min impact parameter
489 Double_t fImpactParameterMax; // max impact parameter
490 TH2F *fhistTPCvsGlobalMult; //!correlation between TPCMult and GlobalMult
491 Bool_t fData2011; //2011 data is used\end{lstlisting}
492 all of which are accessible via dedicated setters\index{event selection!setters},
493 \begin{lstlisting}[language=C, numbers=left]
494 void SetNumberOfTracksMax(Int_t value) {fNumberOfTracksMax=value;fCutNumberOfTracks=kTRUE;}
495 void SetNumberOfTracksMin(Int_t value) {fNumberOfTracksMin=value;fCutNumberOfTracks=kTRUE;}
496 void SetNumberOfTracksRange(Int_t min, Int_t max) {fNumberOfTracksMin=min;fNumberOfTracksMax=max;fCutNumberOfTracks=kTRUE;}
497 void SetRefMultMax(Int_t value) {fRefMultMax=value;fCutRefMult=kTRUE;}
498 void SetRefMultMin(Int_t value) {fRefMultMin=value;fCutRefMult=kTRUE;}
499 void SetRefMultRange(Int_t min, Int_t max) {fRefMultMin=min;fRefMultMax=max;fCutRefMult=kTRUE;}
500 void SetImpactParameterMax(Double_t value) {fImpactParameterMax=value;fCutImpactParameter=kTRUE;}
501 void SetImpactParameterMin(Double_t value) {fImpactParameterMin=value;fCutImpactParameter=kTRUE;}
502 void SetImpactParameterRange(Double_t min, Double_t max) {fImpactParameterMin=min;fImpactParameterMax=max;fCutImpactParameter=kTRUE;}
503 void SetPrimaryVertexXrange(Double_t min, Double_t max)
504 void SetPrimaryVertexYrange(Double_t min, Double_t max)
505 void SetPrimaryVertexZrange(Double_t min, Double_t max)
506 void SetNContributorsRange(Int_t min, Int_t max=INT_MAX)
507 void SetMeanPtRange(Double_t min, Double_t max) {fCutMeanPt=kTRUE; fMeanPtMax=max; fMeanPtMin=min;}
508 void SetCutSPDvertexerAnomaly(Bool_t b=kTRUE) {fCutSPDvertexerAnomaly=b;}
509 void SetCutZDCtiming(Bool_t c=kTRUE) {fCutZDCtiming=c;}
510 void SetCutSPDTRKVtxZ(Bool_t b=kTRUE) {fCutSPDTRKVtxZ=b;}
511 void SetCutTPCmultiplicityOutliers(Bool_t b=kTRUE) {fCutTPCmultiplicityOutliers=b;}
512 void SetCutTPCmultiplicityOutliersAOD(Bool_t b=kTRUE) {fCutTPCmultiplicityOutliersAOD=b;}
513 void SetRefMultMethod(refMultMethod m) {fRefMultMethod=m;}
514 void SetRefMultMethod(AliESDtrackCuts::MultEstTrackType m) { fRefMultMethodAliESDtrackCuts=m;
515 void SetRefMultCuts( AliFlowTrackCuts* cuts ) {fRefMultCuts=static_cast<AliFlowTrackCuts*>(cuts->Clone());}
516 void SetMeanPtCuts( AliFlowTrackCuts* cuts ) {fMeanPtCuts=static_cast<AliFlowTrackCuts*>(cuts->Clone());}
517 void SetQA(Bool_t b=kTRUE) {if (b) DefineHistograms();}
518 void SetCentralityPercentileMethod( refMultMethod m) {fCentralityPercentileMethod=m;}
519 void SetUseCentralityUnchecked(Bool_t b=kTRUE) {fUseCentralityUnchecked=b;}
520 void SetUsedDataset(Bool_t b=kTRUE) {fData2011=b;} // confusing name, better use different interface
521 void SetLHC10h(Bool_t b=kTRUE) {fData2011=(!b);} // TODO let cut object determine runnumber and period
522 void SetLHC11h(Bool_t b=kTRUE) {fData2011=b;} // use this only as 'manual override'\end{lstlisting}
524 \subsubsection{Caveats and remarks}
525 Some caveats\index{event selection!caveats} and remarks about using the event cuts object
527 \item[Default behavior] By default, the event cuts object accepts all events. All desired cuts have to be set by the user. This is also reflected in the design of the setters: most of the setters will, when called, set a \texttt{Bool\_t} to true which enables a cut on a certain parameter;
528 \item[Applicability of cuts to different datatypes] \index{event selection!data types}Not all the cuts can be applied to all input data types. In e.g. the process of filtering \texttt{AODs} from \texttt{ESDs}, `technical' event cuts are made and not all events are stored in the \texttt{AOD} format. Because of this, information that can be rqeuired from \texttt{ESDs} might not be available (as it is not necessary) in \texttt{AODs}. To see whether or not a cut you set is actually applied to the datatype you're using, take a look at
529 \begin{lstlisting}[language=C, numbers=left]
530 Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event, ALIMCEvent *mcevent)\end{lstlisting}
531 This function determines whether or not an event is accepted: it starts by converting the virtual event type that is passed as argument to either an \texttt{ESD} or \texttt{AOD} event, and goes through selection criteria accordingly.
532 \item[Event cuts outside of the \texttt{AliAnalysisTaskFlowEvent} class]
533 When you perform a flow analysis without using the \texttt{AliAnalysisTaskFlowEvent} class (which is done e.g. in the analyses explained in section \ref{sec:exotic}), you can still use the event cuts class by creating an instance of the object, passing it to your analsyis class and `manually' checking the return value of the function
534 \begin{lstlisting}[language=C, numbers=left]
535 Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event, ALIMCEvent *mcevent)\end{lstlisting}
537 for e.g. each event that is passed to your \texttt{::UserExec()} function.
539 \section{Track cuts and the track cuts object}\index{track selection}
540 As explained in the previous subsection, flow events are filled with tracks which fulfill certain track selection criteria. These criteria are checked using the \texttt{AliFlowTrackCuts} class. The \texttt{AliFlowTrackCuts} class can handle different types of input from diffferent data-types (e.g. \texttt{ESD} or \texttt{AOD}) and information from different sub-detector systems. All input is in the end converted to \texttt{AliFlowSimpleTracks} which are added to the flow event. To understand how the \texttt{AliFlowTrackCuts}\index{AliFlowTrackCuts} object works and how it should be configured, it is good to make a few distinctions and remarks.
542 The term `track' is generally used for reconstructed particle trajectories which are constructed from information coming from the tracking detectors in central barrel of the \texttt{ALICE} detector (more specifically from information from the \texttt{ITS} and \texttt{TPC} detectors). Tracks are the most commonly used data source, and the translation from `track' to \texttt{AliFlowTrackSimple} is trivial, as it merely comprises copying kinematic information ($p_t$, $\varphi$, $\eta$) from the barrel track to the \texttt{AliFlowTrackSimple} object.
544 When using information that is not coming from tracking detectors, e.g. information from the \texttt{VZERO}\index{VZERO} system, this procedure of simply copying variables is not suitable as the \texttt{VZERO} system does not measure $p_t$, $\varphi$, $\eta$ of particles, but is an array of scintillators with limited spatial resolution. Nevertheless, the \texttt{AliFlowTrackCuts} class converts the \texttt{VZERO} signal to \texttt{AliFlowTrackSimples} which are, to the flow event, indistinguishable from barrel tracks. As the procedure of accepting these tracks is very different from the procedure of accepting barrel tracks, they will be treated separately in the following subsections.
546 \subsection{ESD tracks as data source}\index{track selection!ESD tracks}
547 The safest and most convenient way of using \texttt{ESD} tracks as a data source is by using one of the pre-defined track cuts sets that are available in the \texttt{AliFlowTrackCuts} class. These sets of track cuts mimic the cuts that are defined in the \texttt{AliESDtrackCuts} class\footnote{\texttt{\$ALICE\_ROOT/ANALYSIS/AliESDtrackCuts.cxx}}. The following default track cuts sets are available:
548 \begin{lstlisting}[language=C, numbers=left]
549 static AliFlowTrackCuts* GetStandardTPCStandaloneTrackCuts();
550 static AliFlowTrackCuts* GetStandardTPCStandaloneTrackCuts2010();
551 static AliFlowTrackCuts* GetStandardGlobalTrackCuts2010();
552 static AliFlowTrackCuts* GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries=kTRUE);
553 static AliFlowTrackCuts* GetStandardMuonTrackCuts(Bool_t isMC=kFALSE, Int_t passN=2);
555 All these are static methods which create a new track cuts object and configure it properly, so to use these track cuts it suffices to type e.g.
556 \begin{lstlisting}[language=C, numbers=left]
557 AliFlowTrackCuts* myCuts = AliFlowTrackCuts::GetStandardGlobalTrackCuts2010();\end{lstlisting}
558 To get a better understanding of what the \texttt{AliFlowTrackCuts} class actually does, let's take a look at what how the cut object is configured in this case:
559 \begin{lstlisting}[language=C, numbers=left]
560 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardGlobalTrackCuts2010()
563 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard Global tracks");
564 cuts->SetParamType(kGlobal);
565 cuts->SetPtRange(0.2,5.);
566 cuts->SetEtaRange(-0.8,0.8);
567 cuts->SetMinNClustersTPC(70);
568 cuts->SetMinChi2PerClusterTPC(0.1);
569 cuts->SetMaxChi2PerClusterTPC(4.0);
570 cuts->SetMinNClustersITS(2);
571 cuts->SetRequireITSRefit(kTRUE);
572 cuts->SetRequireTPCRefit(kTRUE);
573 cuts->SetMaxDCAToVertexXY(0.3);
574 cuts->SetMaxDCAToVertexZ(0.3);
575 cuts->SetAcceptKinkDaughters(kFALSE);
576 cuts->SetMinimalTPCdedx(10.);
579 The configuration falls into three categories:
581 \item A number of track quality cuts is set;
582 \item Some kinematic cuts are set;
583 \item The parameter type\index{track selection!parameter type} is set by calling \texttt{AliFlowTrackCuts::SetParamType()} (in this case to \texttt{AliFlowTrackCuts::kGlobal}). This last step is of particular importance as it takes care disentangling the POI and RP selection and removing a $v_n$ bias due to auto-correlations. When the flow event is filled (the relevant piece of code is printed under sectino \ref{sec:fill}), a check is done to see if the POI's and RP's are of the same type. If not, a track cannot be a POI and RP at the same time (as they are from different sources). However, if POI's and RP's originate from the same source, an \texttt{AliFlowTrackSimple} can be both a POI and RP at the same time if it satisfies both the POI and RP track selection criteria. By specifying the parameter type by calling \texttt{AliFlowTrackCuts::SetParamType()} the flow event is configured to properly deal with overlapping or exclusive POI and RP selections. A wrongly configured parameter type can lead to double counting of tracks and nonsensical analysis results! The following list of track parameter types is available as an \texttt{enum} in \texttt{AliFlowTrackCuts.h}
584 \begin{lstlisting}[language=C, numbers=left]
585 enum trackParameterType { kMC,
590 kV0, //neutral reconstructed v0 particle
591 kVZERO, //forward VZERO detector
596 Note that \texttt{kV0} is reserved to denote a decay vertex of a neutral particle, and \texttt{kVZERO} is used to indicate the VZERO detector system.
599 \subsection{AOD tracks as data source}\index{track selection!AOD tracks}
600 \texttt{AOD} tracks are derived from \texttt{ESD} tracks via process called `fitlering'. If an \texttt{ESD} track meets a pre-defined set of track cuts, it is converted to an \texttt{AOD} track which is stored in an \texttt{AOD} event. The \texttt{AOD} track carries a specific flag (called \texttt{filterbit}) which corresponds to the specific set of cuts that was applied to create accept the track. A full list of track selection criteria corresponding to distinct filterbits can be found \href{}{here}. Note that different \texttt{AOD} productions might have different filterbit definitions!
602 In \texttt{AOD} analysis it generally suffices to select tracks of a certain filterbit, instead of checking quality criteria `by-hand' as is done in \texttt{ESD} analyses (some variables which one would cut on in \texttt{ESD} tracks might not even be available in the \texttt{AOD} tracks as the \texttt{AOD} is designed to be a light-weight `end-user' data format). To get an instance of the \texttt{AliFlowTrackCuts} object which only selects tracks based on a specific filterbit\index{track selection!AOD filterbit}\index{filterbit}, one can call
603 \begin{lstlisting}[language=C, numbers=left]
604 static AliFlowTrackCuts* GetAODTrackCutsForFilterBit(UInt_t bit = 1);\end{lstlisting}
606 \begin{lstlisting}[language=C, numbers=left]
607 AliFlowTrackCuts* AliFlowTrackCuts::GetAODTrackCutsForFilterBit(UInt_t bit)
609 // object which in its default form only cuts on filterbit (for AOD analysis)
610 AliFlowTrackCuts* cuts = new AliFlowTrackCuts(Form("AOD fitlerbit %i", (int)bit));
611 cuts->SetMinimalTPCdedx(-999999999);
612 cuts->SetAODfilterBit(bit);
613 cuts->SetParamType(AliFlowTrackCuts::kAODFilterBit);
616 The \texttt{SetMinimalTPCdedx(-999999999);} is kept here for backward-compatibility.
618 Note that also in the case of \text{AOD} analyses the parameter type is set to (if necessary) decouple POI and RP selections.
620 \subsection{Additional options}
621 As stated, input data needn't necessarily come in the form of barrel tracks - we can use other detector systems as well. When dealing with barrel tracks, quality criteria might not be the only thing you want to select your tracks on: perhaps you want to do analysis on identified particles. The following sub-sections explain how the \texttt{AliFlowTrackCuts} object can be used to achieve this.
623 \subsubsection{Identified particles}\index{track selection!particle identification}\index{particle identification}
624 The \texttt{AliFlowTrackCuts} object can do particle selection for a number of particles that are defined in the AliPID\footnote{\texttt{\$ALICE\_ROOT/STEER/STEERBas/AliPID.h}}. To enable
625 particle identification as a selection criterion, call the function
626 \begin{lstlisting}[language=C, numbers=left]
627 void AliFlowTrackCuts::SetPID(
628 AliPID::EParticleType pid,
631 {fParticleID=pid; fPIDsource=s; fParticleProbability=prob; fCutPID=kTRUE; InitPIDcuts();
633 The first argument specifies the particle species that will be selected via the \texttt{EParticleType} enum. The total list of particles as defined in the \texttt{AliPID} class reads
634 \begin{lstlisting}[language=C, numbers=left]
655 Note that not all these particles may be available for selection via \texttt{AliFlowTrackCuts}!
657 The second argument tells the \texttt{AliFlowTrackCuts} class which particle identification method\index{particle identification!methods} should be used. The available methods are
658 \begin{lstlisting}[language=C, numbers=left]
660 kTPCpid, // default TPC pid (via GetTPCpid)
661 kTOFpid, // default TOF pid (via GetTOFpid)
662 kTOFbayesian, // TOF bayesian pid (F.Noferini)
663 kTOFbeta, // asymmetric cuts of TOF beta signal
664 kTPCdedx, // asymmetric cuts of TPC dedx signal
665 kTOFbetaSimple, //simple TOF only cut
666 kTPCbayesian, //bayesian cutTPC
667 kTPCNuclei, // added by Natasha for Nuclei
668 kTPCTOFNsigma // simple cut on combined tpc tof nsigma
671 The third argument (with a default value of 0.9) gives the analyzer control over the purity of the particle sample by setting a lower bound on the probability that a particle is of a certain species (where 0 would mean no selection and 1 -theoretically - means a 100\% pure sample). To see how - and if - this parameter is used in a certain identification routine, take a look at the source code.
673 The best way of understanding how particles are identified is by just browsing the relevant pieces of the code in the \texttt{AliFlowTrackCuts.cxx} file (look at the list of \texttt{Passes$\ast$Cuts()}, but to give a very short overview:
675 \item[kTPCpid] Return particle identity as stored in the \texttt{AliESDtrack}, TPC information only;
676 \item[kTOFpid] Return particle identify as stored in the \texttt{AliESDtrack}, TOF information only;
677 \item[kTOFbayesian] Combined TPC and TOF Bayesian PID method;
678 \item[kTOFbeta] PID based on asymmetric TOF $\beta$ cut;
679 \item[kTPCdedx] PID cut using TPC $\frac{dE}{dx}$ measurements stored in the \texttt{AliESDtrack},
680 \item[kTOFbetaSimple] PID cut based on TOF time stored in the \texttt{AliESDtrack};
681 \item[kTPCbayesian] Bayesian cut based on TPC or TOF signal;
682 \item[kTPCNuclei] PID selection for heavy nuclei;
683 \item[kTPCTOFNsigma] Cut based in a simple combined cut on the $n$-$\sigma$ signal from TPC and TOF, requires PID response object. The PID response object is created by the PID response task, and thus requires that the PID response task runs in an analysis train \emph{before} the \texttt{AliFlowTrackCuts} class does its selection. To enable the PID response task, add the following lines to your run macro:
684 \begin{lstlisting}[language=C, numbers=left]
685 gROOT->LoadMacro("ANALYSIS/macros/AddTaskPIDResponse.C");
686 AddTaskPIDResponse();\end{lstlisting}
687 The default value for $n$-$\sigma$ is 3, but it can be set to a different
689 \begin{lstlisting}[language=C, numbers=left]
690 void AliFlowTrackCuts::SetNumberOfSigmas(Float_t val);\end{lstlisting}
693 \subsubsection{Caveats and notes}
694 \index{particle identification!caveats}
696 \item[Applicability of cuts to different data types] Just as not all event and track cuts that are available for all data types. For the track quality cuts this has been explained in the previous subsections, but one has to reqlize that in addition, not all particle identification methods are available for all types of data. At the time of writing, the \texttt{ESD} particle identification is more elaborate than the \texttt{AOD} counterpart. To see which PID methods exist for the different data types, check the \texttt{AliFlowTrackCuts::Passes$\ast$pidCut()} functions, printed below for your convenience.
698 \begin{lstlisting}[language=C, numbers=left]
699 Bool_t AliFlowTrackCuts::PassesAODpidCut(const AliAODTrack* track )
701 if(!track->GetAODEvent()->GetTOFHeader()){
702 AliAODPid *pidObj = track->GetDetPid();
703 if (!pidObj) fESDpid.GetTOFResponse().SetTimeResolution(84.);
705 Double_t sigmaTOFPidInAOD[10];
706 pidObj->GetTOFpidResolution(sigmaTOFPidInAOD);
707 if(sigmaTOFPidInAOD[0] > 84.){
708 fESDpid.GetTOFResponse().SetTimeResolution(sigmaTOFPidInAOD[0]); // use the electron TOF PID sigma as time resolution (including the T0 used)
713 //check if passes the selected pid cut for ESDs
718 if (!PassesTOFbetaCut(track)) pass=kFALSE;
721 if (!PassesTOFbayesianCut(track)) pass=kFALSE;
724 if (!PassesTPCbayesianCut(track)) pass=kFALSE;
727 if (!PassesTPCTOFNsigmaCut(track)) pass = kFALSE;
736 //-----------------------------------------------------------------------
737 Bool_t AliFlowTrackCuts::PassesESDpidCut(const AliESDtrack* track )
739 //check if passes the selected pid cut for ESDs
744 if (!PassesTPCpidCut(track)) pass=kFALSE;
747 if (!PassesTPCdedxCut(track)) pass=kFALSE;
750 if (!PassesTOFpidCut(track)) pass=kFALSE;
753 if (!PassesTOFbetaCut(track)) pass=kFALSE;
756 if (!PassesTOFbetaSimpleCut(track)) pass=kFALSE;
759 if (!PassesTPCbayesianCut(track)) pass=kFALSE;
762 if (!PassesTOFbayesianCut(track)) pass=kFALSE;
765 if (!PassesNucleiSelection(track)) pass=kFALSE;
768 if (!PassesTPCTOFNsigmaCut(track)) pass = kFALSE;
771 printf("AliFlowTrackCuts::PassesCuts() this should never be called!\n");
777 In general, particle identification is not a trivial procedure, and one needs to find a balance between purity and efficiency. Which particle identification to choose depends heavily on the desired outcome of the analysis. In case of e.g. a high-precision measurement of $\pi$ $v_2$, a method which has a very high purity but low efficiency can be chosen: $\pi$'s are an abundant particle species and high precision requires high purity. On the other hand, if one does selection for kaons to reconstruct $\varphi$-mesons, loose cuts with high efficiency can be chosen, as the $\varphi$-meson is a rare probe and invariant mass requirements on the kaon pairs will take care of mis-identifications.
779 To get access to QA information on track selection \emph{before} and \emph{after} PID cuts, the QA mode of the \texttt{AliFlowTrackCuts} can be selected.
781 \item[Track cuts outside of the \texttt{AliAnalysisTaskFlowEvent} class] Just as the flow event cuts can be used outside of the \texttt{AliAnalysisTaskFlowEvent} class, one can use the \texttt{AliFlowTrackCuts} class in a similar way, by calling, for each track,
782 \begin{lstlisting}[language=C, numbers=left]
783 Bool_t AliFlowTrackCuts::IsSelected(TObject* obj, Int_t id)\end{lstlisting}
784 or directly one of the \texttt{PassesCuts($\ast$)} functions which \texttt{IsSelected()} calls.
787 \subsubsection{VZERO}\index{track selection!VZERO}\index{VZERO}
788 Now that the barrel tracks have been explained, let's continue to the treatment of VZERO information. The VZERO detector consists of two scintillator arrays at opposite sides of the interaction point (VZEROA and VZEROC) each containing 32 readout channels. To convert the VZERO information to \texttt{AliFlowTrackCuts}, two steps are taken:
790 \item A `track' is built from a VZERO tile by taking the geometric mean of the tile as the track direction (from which $\eta$ and $\varphi$ can be constructed);
791 \item The VZERO analogue signal strength within a VZERO tile (which is proportional to charge deposition) is taken as a weight when evaluating the total \textbf{Q} vector.
793 As there is no straightforward way to convert VZERO multiplicity to $p_t$, the VZERO signal can in principle not be used as POI in the flow analysis, neither can a $p_t$ range be selected when using the VZERO as RP selection. In addition to this, the `raw' VZERO signal itself cannot be used directly for flow analysis but needs to be calibrated tile-by-tile. To understand how this calibration is performed in the flow package, we need to go into a little bit of detail on how to build a \textbf{Q} vector.
795 In general, a \textbf{Q} vector is defined as
796 \begin{equation}\label{qvzero}
797 \mbox{\textbf{Q}} = \sum_{\mbox{tracks}} w_i \exp \left( i n \varphi \right)
799 where $w_i$ is a track weight, $n$ is the harmonic, and $\varphi$ is the azimuthal angle of a track. As explained, in the case of VZERO tiles, $\varphi$ is derived from the position of the VZERO tile and $w_i$ is the VZERO signal which is proportional to multiplicity. However, not all VZERO tiles are equally sensitive, and the sensitivity (can have) a runnumber dependence, which results in a non-flat VZERO \textbf{Q} vector distribution. As this effect might be different run-by-run, it cannot be corrected by applying a non-uniform acceptance correction at the end of your analysis, as an analysis generally comprises running over multiple runnumers and the non-uniform acceptance correction corrects only for non-uniformity which is equal for all runs. Hence, the VZERO non-uniformity needs to be corrected\index{VZERO!calibration} at the time of the construction of the \textbf{Q} vectors.
801 The functions in the flow package which are responsible for building the \textbf{Q} vectors (or sub-event \textbf{Q} vectors, the use of which will be described in subsection \ref{sec:scalar_product}) are
802 \begin{lstlisting}[language=C, numbers=left]
803 // Q-vector calculation
804 AliFlowVector AliFlowEventSimple::GetQ(
806 TList *weightsList, // weight list
807 Bool_t usePhiWeights, // use phi weights?
808 Bool_t usePtWeights, // use pt weights?
809 Bool_t useEtaWeights // use eta weights?
812 // Q-vectors of sub-events
813 void AliFlowEventSimple::Get2Qsub(
814 AliFlowVector* Qarray, // array with q-vectors
817 Bool_t usePhiWeights,
822 // overloaded implementation of Q-vectors of sub-events for VZERO information
823 void AliFlowEvent::Get2Qsub(
824 AliFlowVector* Qarray,
827 Bool_t usePhiWeights,
831 These functions are called by the flow analysis tasks and generally not by the user directly, but it is good to know where they can be found. The first two functions merely loop over all tracks in a flow event and fill the \textbf{Q} vector. The last function is designed for building a \textbf{Q} vector from VZERO information, applying a calibration step to the VZERO signal. To make life complicated, the calibration of the VZERO \textbf{Q} vector in LHC10h is not the same as the calibration of the VZERO \textbf{Q} vector LHC11h data. Let's start by taking a look at the LHC10h case.
833 \item [LHC10h]\index{VZERO!calibration!LHC10h}
834 The calibration of LHC10h data is a two-step procedure.
836 \item The first step is evaluating the \textbf{Q} vector using equation \ref{qvzero}. However, the VZERO signal of each tile is \emph{re-weighted} before it is used as a weigth in equation \ref{qvzero}. The re-weighting comprises
838 \item Taking a \texttt{TProfile} with average multiplicity per cell (these profiles are stored in a \texttt{OADB} file for each run-number)
839 \item Fitting a constant line per disc (or ring) $y = a$ (see next slide for example)
840 \item Evaluating the track weight for each VZERO cell is now calculated in a second iteration as
842 \mbox{track weight} = \frac{\mbox{cell multiplicity} * a}{\mbox{average multiplicity in a cell}} \nonumber
844 This process is illustrated in figure \ref{fig:calibration}.
846 \item After the \textbf{Q} vectors have been built, they are recentered. Re-centering is basically a small adjustment of the components of the \textbf{Q} vector, changing its angle event-by-event so that on average a flat \textbf{Q} vector distribution is obtained. The steps that are taken for re-centering are the following:
848 \item Retrieve the average mean and spread of the \textbf{Q} vector distribution from a database file;
849 \item The corrected \textbf{Q} vectors can now be obtained by doing
851 Q_n \longrightarrow \frac{Q_n - \langle Q_n \rangle }{\sigma_{Q_n}} \nonumber
853 where brackets denote the one-run average, and $\sigma_{Q_n}$ the standard deviation of $Q_n$ in the sample
856 Note that the calibration is only available for $n=2$ and $n=3$. For higher harmonics, the flow package will use the equalized VZERO multiplicity
857 \begin{lstlisting}[language=C, numbers=left]
858 AliVEvent::GetVZEROEqMultiplicity(Int_t i);\end{lstlisting}
859 to build the \textbf{Q} vectors, whether this is satisfactory for an analysis, or if non-uniform acceptance effects can be reverted by performing a correction on a run-by-run basis is up to the analyzer. The \textbf{Q} vector distributions of total \textbf{Q} vectors and subevent vectors can always be checked via the \texttt{AliFlowCommonHists} classes (see section \ref{sec:commonhists}) via
860 \begin{lstlisting}[language=C, numbers=left]
861 TH1F* GetHistQ() {return fHistQ; } ;
862 TH1F* GetHistAngleQ() {return fHistAngleQ; }
863 TH1F* GetHistAngleQSub0() {return fHistAngleQSub0; }
864 TH1F* GetHistAngleQSub1() {return fHistAngleQSub1; }\end{lstlisting}
865 \item [LHC11h]\index{VZERO!calibration!LHC11h} The calibration of the LHC11h VZERO information is not performed by the flow package, but by an external class, name the VZEROEPselection task, which will store the corrected \textbf{Q} vectors in the AliVEvent header, from which they are retrieved by the \textbf{AliFlowTrackCuts} class. To use this method, make sure that you run this VZEROEPselection task \emph{before} your flow analysis tasks in an analysis train. To enable this task, add the following lines to your analysis macro
866 \begin{lstlisting}[language=C, numbers=left]
867 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
868 AddTaskVZEROEPSelection();\end{lstlisting}
870 Note that for LHC11h data, calibration is performed only for the second harmonic ($n=2$). For higher harmonics, the flow package uses equalized VZERO multiplicity to build \textbf{Q} vectors (as indicated for the LHC10h data).
872 After describing how and why calibration is performed, it is now time to indicate how to set up this calibration routine. Just as selecting barrel tracks, this can be done by creating an \texttt{AliFlowTrackCuts} object via a \texttt{static} access method,
873 \begin{lstlisting}[language=C, numbers=left]
874 AliFlowTrackCuts* cutsVZERO = GetStandardVZEROOnlyTrackCuts();\end{lstlisting}
875 At run-time, the flow package will detector whether LHC10h or LHC11h data is used by reading the analyzed events' runnumber. This can be convenient when having these cuts defined in a script which is designed to run on multiple types of input data. However, one can also call the LHC10h or LHC11h specific cuts directly via dedicated functions, which are reprinted here as the comments are important
877 \begin{lstlisting}[language=C, numbers=left]
878 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts2010()
880 //get standard VZERO cuts
881 //DISCLAIMER: LHC10h VZERO calibration consists (by default) of two steps
882 //1) re-weigting of signal
883 //2) re-centering of q-vectors
884 //step 2 is available only for n==2 and n==3, for the higher harmonics the user
885 //is repsonsible for making sure the q-sub distributions are (sufficiently) flat
886 //or a sensible NUA procedure is applied !
887 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard vzero flow cuts");
888 cuts->SetParamType(AliFlowTrackCuts::kVZERO);
889 cuts->SetEtaRange( -10, +10 );
890 cuts->SetEtaGap(-1., 1.);
891 cuts->SetPhiMin( 0 );
892 cuts->SetPhiMax( TMath::TwoPi() );
893 // options for the reweighting
894 cuts->SetVZEROgainEqualizationPerRing(kFALSE);
895 cuts->SetApplyRecentering(kTRUE);
896 // to exclude a ring , do e.g.
897 // cuts->SetUseVZERORing(7, kFALSE);
898 // excluding a ring will break the re-centering as re-centering relies on a
899 // database file which tuned to receiving info from all rings
902 //-----------------------------------------------------------------------
903 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts2011()
905 //get standard VZERO cuts for 2011 data
906 //in this case, the vzero segments will be weighted by
907 //VZEROEqMultiplicity,
908 //if recentering is enableded, the sub-q vectors
909 //will be taken from the event header, so make sure to run
910 //the VZERO event plane selection task before this task !
911 //DISCLAIMER: recentering is only available for n==2
912 //for the higher harmonics the user
913 //is repsonsible for making sure the q-sub distributions are (sufficiently) flat
914 //or a sensible NUA procedure is applied !
915 //recentering replaces the already evaluated q-vectors, so
916 //when chosen, additional settings (e.g. excluding rings)
917 //have no effect. recentering is true by default
919 //NOTE user is responsible for running the vzero event plane
920 //selection task in advance, e.g. add to your launcher macro
922 // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
923 // AddTaskVZEROEPSelection();
925 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard vzero flow cuts 2011");
926 cuts->SetParamType(kVZERO);
927 cuts->SetEtaRange( -10, +10 );
928 cuts->SetEtaGap(-1., 1.);
929 cuts->SetPhiMin( 0 );
930 cuts->SetPhiMax( TMath::TwoPi() );
931 cuts->SetApplyRecentering(kTRUE);
932 cuts->SetVZEROgainEqualizationPerRing(kFALSE);
936 \subsubsection{Caveats and remarks}\index{VZERO!caveats}
937 Using the VZERO as reference detector in a flow analysis certainly has its benefits (such as suppressing the non-flow contribution to the $v_n$ signal) but a few remarks have to be made
939 \item[Applicability to flow analysis methods] As the calibration affects the information that is returned by the function
940 \begin{lstlisting}[language=C, numbers=left]
941 void AliFlowEvent::Get2Qsub()\end{lstlisting}
942 only flow analysis methods which call this function (and thus use sub-events) can use the calibrated VZERO signal. Most notably, this is the scalar product method. In combination with this, one should keep in mind that the two VZERO detectors have different $\eta$ coverage. For the recent \texttt{ALICE} paper on the flow of identified particles, the scalar product method with VZERO subevents was used, where the two VZERO detectors comprised the two sub-events. For more information on this, take a look at the description of the scalar product method in subsection \ref{sec:scalar_product}.
943 \item[VZERO as RP source] The VZERO signal should only be used as source for reference flow. Although technically there is no objection to using the VZERO signal as POI's (you will probably get output) there is no guarantee that this makes sense from a `physics' viewpoint;
944 \item[Tuning of the calibration] The calibration in the LHC11h data is taken from an external class and therefore, as far as the flow package is considered, as-is (although the calibration can be disabeled). The LHC10h calibration however is done within the package, and can be tuned quite a bit.
946 Tuning the calibration is done by functions of the \texttt{AliFlowTrackCuts} class. Some of these functions apply to both LHC10h and LHC11h data but can have slightly different effects:
947 \begin{lstlisting}[language=C, numbers=left]
948 // to either enable or disable the recentering
949 // (for 11h this will mean that no calibration is performed,
950 // for 10h it will result in only doing a re-weighting)
951 void SetApplyRecentering(Bool_t r)
952 // to enable a per-ring instead of per-disc gain equalization (=re-weighting)
953 // (for 11h this has no effect)
954 void SetVZEROgainEqualizationPerRing(Bool_t s)
955 // exclude vzero rings: 0 through 7 can be excluded by calling this setter multiple times
956 // 0 corresponds to segment ID 0 through 7, etc
957 // disabled vzero rings get weight 0
958 // with this function you can omit information from entire vzero rings
959 // might be useful for runs where there is a bad signal in one of the tiles
960 // (sometimes referred to as 'clipping')
961 void SetUseVZERORing(Int_t i, Bool_t u)\end{lstlisting}
962 Be warned however: the databases which are read during the calibration however are tuned to the combination of re-weighting of all rings with re-centering. Changing this combination might lead to biases in the \textbf{Q} vector distribution, so: playing with the calibration settings might be interesting for e.g. evaluating systematic uncertainties, but keep an eye on the control histograms!
965 \subsubsection{Track weights}\index{track weights}
966 When it is a-priori know that a track sample needs to be weighted in $\varphi$, $\eta$ or $p_t$ (e.g. to correct for a non-uniform acceptance bias in azimuth by using weight which are inversely proportional to the azimuthal track distribution) histograms with weight distributions can be supplied to the flow package. The weights are supplied to flow analysis tasks, which then apply these weights by passing them to the \texttt{Q} vector calculation functions which are printed in the previous subsection.
968 The weights have to be supplied as \texttt{TH1F} objects (or objects which can be dynamically cast to a \texttt{TH1F} encapsulated in \texttt{TList}. The histograms have to have specific names: \texttt{"phi\_weights"} for $\varphi$ weights, \texttt{"pt\_weights"} for $p_t$ weights and \texttt{"eta\_weights"} for $\eta$ weights. The binning of the histograms is not important, as long as bins are of equal width. The weights are disabled by default and have to be passed to specific flow analysis tasks (as not all tasks support weights) via
969 \begin{lstlisting}[language=C, numbers=left]
971 AliFlowAnalysisWith*::SetWeightsList(TList* const)
972 // toggle phi weights on / off
973 AliFlowAnalysisWith*::SetUsePhiWeights(Bool_t const)
974 // toggle eta weighs on / off
975 AliFlowAnalysisWith*::SetUseEtaWeights(Bool_t const)
976 // toggle pt weights on / off
977 AliFlowAnalysisWith*::SetUsePtWeights(Bool_t const)\end{lstlisting}
978 and are applied to total \texttt{Q} vectors and sub-event \texttt{Q} vectors.
980 The tasks which support weights are
982 \item AliFlowAnalysisWithNestedLoops
983 \item AliFlowAnalysisWithScalarProduct
984 \item AliFlowAnalysisWithQCumulants
985 \item AliFlowAnalysisTemplate
986 \item AliFlowAnalysisWithFittingQDistribution
987 \item AliFlowAnalysisWithCumulants
988 \item AliFlowAnalysisWithMixedHarmonics
990 For details on how the weighting is implemented (and defined) the user is referred to the specific \texttt{Q} vector evaluation functions given in the previous subsection.
992 \subsubsection{AliFlowCommonConstants - The Common Constants class}\index{AliFlowCommonConstants}
993 All flow analysis use a common output container to store their histograms. To set the configuration for the histograms in these containers - e.g. the $p_t$ ranges of histograms, the number of bins, etc, etc - all flow analysis methods initialize their output containers using variables from a static (global) instance of the \texttt{AliFlowCommonConstants}\index{AliFlowCommonConstants} class. This object, which can be obtained via the a static function
994 \begin{lstlisting}[language=C, numbers=left]
995 static AliFlowCommonConstants* GetMaster(); \end{lstlisting}
996 can be tuned to the user's liking by requesting a pointer to it via the static access method, and using the available setter functions, e.g. the following
997 \begin{lstlisting}[language=C, numbers=left]
998 AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
1001 cc->SetPtMax(10); \end{lstlisting}
1002 will result in an analysis which is performed in 100 $p_t$ bins of 0.1 GeV/$c$ width. The full set of histogram sizes and limits that can be set is
1004 \begin{lstlisting}[language=C, numbers=left]
1006 Int_t fNbinsMult; // histogram size
1007 Int_t fNbinsPt; // histogram size
1008 Int_t fNbinsPhi; // histogram size
1009 Int_t fNbinsEta; // histogram size
1010 Int_t fNbinsQ; // histogram size
1011 Int_t fNbinsMass; // histogram size
1013 // Histograms limits
1014 Double_t fMultMin; // histogram limit
1015 Double_t fMultMax; // histogram limit
1016 Double_t fPtMin; // histogram limit
1017 Double_t fPtMax; // histogram limit
1018 Double_t fPhiMin; // histogram limit
1019 Double_t fPhiMax; // histogram limit
1020 Double_t fEtaMin; // histogram limit
1021 Double_t fEtaMax; // histogram limit
1022 Double_t fQMin; // histogram limit
1023 Double_t fQMax; // histogram limit
1024 Double_t fMassMin; // histogram limit
1025 Double_t fMassMax; // histogram limit
1026 Double_t fHistWeightvsPhiMin; // histogram limit
1027 Double_t fHistWeightvsPhiMax; // histogram limit\end{lstlisting}
1031 \begin{lstlisting}[language=C, numbers=left]
1032 void SetNbinsMult( Int_t i ) { fNbinsMult = i; }
1033 void SetNbinsPt( Int_t i ) { fNbinsPt = i; }
1034 void SetNbinsPhi( Int_t i ) { fNbinsPhi = i; }
1035 void SetNbinsEta( Int_t i ) { fNbinsEta = i; }
1036 void SetNbinsQ( Int_t i ) { fNbinsQ = i; }
1037 void SetNbinsMass( Int_t i ) { fNbinsMass = i; }
1038 void SetMultMin( Double_t i ) { fMultMin = i; }
1039 void SetMultMax( Double_t i ) { fMultMax = i; }
1040 void SetPtMin( Double_t i ) { fPtMin = i; }
1041 void SetPtMax( Double_t i ) { fPtMax = i; }
1042 void SetPhiMin( Double_t i ) { fPhiMin = i; }
1043 void SetPhiMax( Double_t i ) { fPhiMax = i; }
1044 void SetEtaMin( Double_t i ) { fEtaMin = i; }
1045 void SetEtaMax( Double_t i ) { fEtaMax = i; }
1046 void SetQMin( Double_t i ) { fQMin = i; }
1047 void SetQMax( Double_t i ) { fQMax = i; }
1048 void SetMassMin( Double_t i ) { fMassMin = i; }
1049 void SetMassMax( Double_t i ) { fMassMax = i; }
1050 void SetHistWeightvsPhiMax( Double_t d ) {fHistWeightvsPhiMax=d;}
1051 void SetHistWeightvsPhiMin( Double_t d ) {fHistWeightvsPhiMin=d;}\end{lstlisting}
1053 Note that the common constants object is \texttt{static}, meaning that, within a process (e.g. an analysis train) just \emph{one} instance of the object is created. The histogram limits and sizes that are set via the common constants object therefore affect \emph{all} histograms within an analysis chain.
1055 \subsubsection{AliFlowCommonHist and AliFlowCommonHistResults - details}\index{AliFlowCommonHist!details}\index{AliFlowCommonHistResults!details}
1056 Both the \texttt{AliFlowCommonHist} and \texttt{AliFlowCommonHistResults} classes do not only contain (pointers to) histograms and profiles, but also have a collection of `getters'\footnote{A `getter' in this manual will be used to describe a function of the form \texttt{Get$\ast$()} which returns a (pointer to) a member of a class and is used to interface with the class.} which you can use to retrieve histograms of profiles using the \texttt{ROOT} command line in stead of the \texttt{TBrowser}, which may come in handy when one needs to read the output of the flow analysis tasks in a macro.
1058 Using the output file that was generated in the example given in the previous sections of this chapter, reading the objects of the common histogram classes is done in the following way. First, start an \texttt{(Ali)ROOT} session, and load the prerequisite libraries,
1059 \begin{lstlisting}[language=C, numbers=left]
1060 gSystem->Load("libPWGflowBase");\end{lstlisting}
1061 Then, open the analysis file and grab the common histogram objects
1062 \begin{lstlisting}[language=C, numbers=left]
1064 TFile f("AnalysisResults.root");
1065 // get the qc analysis output directory
1066 TDirectoryFile* dir = (TDirectoryFile*)f.Get("outputQCanalysis");
1067 // and retrieve the output list of the analysis
1068 TList* outputList = (TList*)dir->Get("cobjQC")\end{lstlisting}
1069 The \texttt{TList} that you have just obtained holds not only the common histogram objects, but can also hold additional information that has been added to the analysis output by a specific flow analysis task. To read the entire content of the \texttt{TList}, you can type
1070 \begin{lstlisting}[language=C, numbers=left]
1071 outputList->ls();\end{lstlisting}
1072 However, in this example we want to retrieve the common histogram objects. To do so, type
1073 \begin{lstlisting}[language=C, numbers=left]
1074 // get common histogram object from the TList
1075 AliFlowCommonHist* commonHist = (AliFlowCommonHist*)outputList->FindObject("AliFlowCommonHistQC");
1076 // get the results for the 2 particle cumulant from the TList
1077 AliFlowCommonHistResults* commonHistResults2 = (AliFlowCommonHistResults*)outputList->FindObject("AliFlowCommonHistResults2ndOrderQC");\end{lstlisting}
1078 Once you have retrieved the pointers to the \texttt{AliFlowCommonHist} or \texttt{AliFlowCommonHistResults} objects, you can use the getters to retrieve a histogram. To e.g. draw the $\eta$ distribution of POI's, type
1079 \begin{lstlisting}[language=C, numbers=left]
1080 commonHist->GetHistEtaPOI()->Draw();\end{lstlisting}
1082 The following getters are available in \texttt{AliFlowCommonHist}
1083 \begin{lstlisting}[language=C, numbers=left]
1084 Double_t GetEntriesInPtBinRP(Int_t iBin); //gets entries from fHistPtRP
1085 Double_t GetEntriesInPtBinPOI(Int_t iBin); //gets entries from fHistPtPOI
1086 Double_t GetEntriesInEtaBinRP(Int_t iBin); //gets entries from fHistEtaRP
1087 Double_t GetEntriesInEtaBinPOI(Int_t iBin); //gets entries from fHistEtaPOI
1088 Double_t GetMeanPt(Int_t iBin); //gets the mean pt for this bin from fHistProMeanPtperBin
1089 TH1F* GetHistMultRP() {return fHistMultRP; } ;
1090 TH1F* GetHistMultPOI() {return fHistMultPOI; } ;
1091 TH2F* GetHistMultPOIvsRP() {return fHistMultPOIvsRP; } ;
1092 TH1F* GetHistPtRP() {return fHistPtRP; } ;
1093 TH1F* GetHistPtPOI() {return fHistPtPOI; } ;
1094 TH1F* GetHistPtSub0() {return fHistPtSub0; } ;
1095 TH1F* GetHistPtSub1() {return fHistPtSub1; } ;
1096 TH1F* GetHistPhiRP() {return fHistPhiRP; } ;
1097 TH1F* GetHistPhiPOI() {return fHistPhiPOI; } ;
1098 TH1F* GetHistPhiSub0() {return fHistPhiSub0; } ;
1099 TH1F* GetHistPhiSub1() {return fHistPhiSub1; } ;
1100 TH1F* GetHistEtaRP() {return fHistEtaRP; } ;
1101 TH1F* GetHistEtaPOI() {return fHistEtaPOI; } ;
1102 TH1F* GetHistEtaSub0() {return fHistEtaSub0; } ;
1103 TH1F* GetHistEtaSub1() {return fHistEtaSub1; } ;
1104 TH2F* GetHistPhiEtaRP() {return fHistPhiEtaRP; } ;
1105 TH2F* GetHistPhiEtaPOI() {return fHistPhiEtaPOI; } ;
1106 TProfile* GetHistProMeanPtperBin() {return fHistProMeanPtperBin; } ;
1107 TH2F* GetHistWeightvsPhi() {return fHistWeightvsPhi; } ;
1108 TH1F* GetHistQ() {return fHistQ; } ;
1109 TH1F* GetHistAngleQ() {return fHistAngleQ; }
1110 TH1F* GetHistAngleQSub0() {return fHistAngleQSub0; }
1111 TH1F* GetHistAngleQSub1() {return fHistAngleQSub1; }
1112 TProfile* GetHarmonic() {return fHarmonic; } ;
1113 TProfile* GetRefMultVsNoOfRPs() {return fRefMultVsNoOfRPs; } ;
1114 TH1F* GetHistRefMult() {return fHistRefMult; } ;
1115 TH2F* GetHistMassPOI() {return fHistMassPOI; }
1116 TList* GetHistList() {return fHistList;} ; \end{lstlisting}
1117 and in \texttt{AliFlowCommonHistResults}
1118 \begin{lstlisting}[language=C, numbers=left]
1119 TH1D* GetHistChi(){return fHistChi;};
1120 TH1D* GetHistIntFlow(){return fHistIntFlow;};
1121 TH1D* GetHistIntFlowRP(){return fHistIntFlowRP;};
1122 TH1D* GetHistDiffFlowPtRP(){return fHistDiffFlowPtRP;};
1123 TH1D* GetHistDiffFlowEtaRP(){return fHistDiffFlowEtaRP;};
1124 TH1D* GetHistIntFlowPOI(){return fHistIntFlowPOI;};
1125 TH1D* GetHistDiffFlowPtPOI(){return fHistDiffFlowPtPOI;};
1126 TH1D* GetHistDiffFlowEtaPOI(){return fHistDiffFlowEtaPOI;};
1127 TList* GetHistList(){return fHistList;}; \end{lstlisting}
1129 \subsubsection{Afterburner}\index{afterburner}
1130 To e.g. test your analysis setup, an `afterburner' can be called which adds user-defined flow to (isotropic) events. Two afterburner techniques are implemented.
1132 \item[Differential $v_2$] The first technique injects differential $v_2$ into events, using the following steps: As a starting point, an isotropic distribution of tracks is used
1134 \frac{dN}{d\varphi_0} = \frac{1}{2 \pi}.
1136 Adding a periodic azimuthal modulation, this is translated to
1138 \frac{dN}{d\varphi} = \frac{1}{2\pi}\left( 1 + v_2 \cos \left[ 2 \left( \varphi - \Psi \right) \right] \right)
1140 which can be re-written as
1142 \frac{dN}{d\varphi} = \frac{dN}{d\varphi_0}\frac{d\varphi_0}{d\varphi} = \frac{1}{2\pi}\frac{d\varphi_0}{d\varphi}
1144 so that for each track the following equation can be solved by Newton-Raphson iteration
1146 \varphi = \varphi_0 - v_2 \sin \left[ 2 \left( \varphi - \Psi \right) \right].
1148 \item[Integrated $v_n$] The second option is adding integrated $v_n$ by sampling the azimuthal distribution of an event from a Fourier series
1150 \frac{dN}{d\varphi} \propto 1 + \frac{1}{2} \sum_n v_n \left( n \Delta \varphi \right).
1153 In the `quick start' of this manual you have already see how you can generate flow events with a certain $v_n$ value by generating flow events by hand. The afterburner routine can also be called from the \texttt{AliAnalysisTaskFlowEvent} via the functions
1154 \begin{lstlisting}[language=C, numbers=left]
1155 // setters for adding by hand flow values (afterburner)
1157 // toggle the afterburner on / off
1158 void SetAfterburnerOn(Bool_t b=kTRUE) {fAfterburnerOn=b;}
1159 // set differential v2 via a TF1
1160 void SetPtDifferentialV2( TF1 *gPtV2) {fDifferentialV2 = gPtV2;}
1161 // set integrated flow (used when the gPtV2 = NULL)
1162 void SetFlow( Double_t v1, Double_t v2, Double_t v3=0.0, Double_t v4=0.0, Double_t v5=0.0)
1163 {fV1=v1;fV2=v2;fV3=v3;fV4=v4;fV5=v5;}\end{lstlisting}
1164 To introduce non-flow effects to using the afterburner, tacks can be cloned. To clone, for each event, a given number $n$ of tracks, enable the afterburner and call
1165 \begin{lstlisting}[language=C, numbers=left]
1166 void SetNonFlowNumberOfTrackClones(Int_t n) {fNonFlowNumberOfTrackClones=n;}\end{lstlisting}
1167 Effectively this will result in $n$ tracks appearing twice in the track sample, mimicking the effects of e.g. resonance decays of track splitting on $v_n$.
1169 \subsection{Relevant pieces of code}
1170 The best way of getting familiar with the flwo package is perhaps browsing the source code, but it can be difficult to find a good starting point for this. Two relevant pieces of code have been selected here which are at the heart of the flow package:
1171 \begin{enumerate}\index{AliAnalysisTaskFlowEvent::UserExec()}
1172 \item The AliAnalysisTaskFlowEvent::UserExec() function, which is called for each event that enters an analysis train;
1173 \item AliFlowEvent::Fill(), which selects POI's and RP's following the track selection criteria and fills the flow event which is passed to the analysis methods. The functions are shortened and simplified and provided with additional lines of comments.
1175 \subsubsection{AliAnalysisTaskFlowEvent::UserExec()}
1176 This function is called for each event.
1177 \begin{lstlisting}[language=C, numbers=left]
1178 void AliAnalysisTaskFlowEvent::UserExec(Option_t *)
1181 // Called for each event
1182 //delete fFlowEvent;
1183 AliMCEvent* mcEvent = MCEvent(); // from TaskSE
1184 AliESDEvent* myESD = dynamic_cast<AliESDEvent*>(InputEvent()); // from TaskSE
1185 AliAODEvent* myAOD = dynamic_cast<AliAODEvent*>(InputEvent()); // from TaskSE
1187 // the rp and poi cuts will be used to fill the flow event
1188 // so they have to be defined here
1189 if (!(fCutsRP&&fCutsPOI&&fCutsEvent))
1191 AliError("cuts not set");
1195 //DEFAULT - automatically takes care of everything
1196 // the flow package will determine the datatype that you are using
1197 if (fAnalysisType == "AUTOMATIC")
1200 if (InputEvent() && !fCutsEvent->IsSelected(InputEvent(),MCEvent()))
1203 //first attach all possible information to the cuts
1204 // the track cuts will make the track selection, so they
1205 // have to be supplied with the current event
1206 // the mc event is NULL unless it is retrieved by AliAnalysisTaskSE
1207 fCutsRP->SetEvent( InputEvent(), MCEvent() ); //attach event
1208 fCutsPOI->SetEvent( InputEvent(), MCEvent() );
1210 //then make the event
1211 // this function will fill the flow event with selected poi's and rp's
1212 // the implementation is printed below
1213 fFlowEvent->Fill( fCutsRP, fCutsPOI );
1215 // pass some event info to the flow event
1216 fFlowEvent->SetReferenceMultiplicity(fCutsEvent->GetReferenceMultiplicity(InputEvent(),mcEvent));
1217 fFlowEvent->SetCentrality(fCutsEvent->GetCentrality(InputEvent(),mcEvent));
1218 if (mcEvent && mcEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(mcEvent);
1221 // a lot of code is omitted here //
1223 //////////////////////////////////////////////////////////////////////////////
1224 ///////////////////////////AFTERBURNER
1227 //if reaction plane not set from elsewhere randomize it before adding flow
1228 if (!fFlowEvent->IsSetMCReactionPlaneAngle())
1229 fFlowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi()));
1232 fFlowEvent->AddV2(fDifferentialV2);
1234 fFlowEvent->AddFlow(fV1,fV2,fV3,fV4,fV5); //add flow
1235 fFlowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks
1237 //////////////////////////////////////////////////////////////////////////////
1240 // some flow analysis methods (such as the scalar product)
1241 // use sub-events. by calling this function, all tracks in the
1242 // flow event are tagged as belonging to either sub-event a or b
1243 fFlowEvent->TagSubeventsInEta(fMinA,fMaxA,fMinB,fMaxB);\end{lstlisting}
1245 \subsubsection{AliFlowEvent::Fill()}\label{ref:fill}\index{AliFlowEvent::Fill()}
1246 This function fills the flow event with \texttt{AliFlowSimpleTracks}.
1247 \begin{lstlisting}[language=C, numbers=left]
1248 //-----------------------------------------------------------------------
1249 void AliFlowEvent::Fill( AliFlowTrackCuts* rpCuts,
1250 AliFlowTrackCuts* poiCuts )
1252 //Fills the event from a vevent: AliESDEvent,AliAODEvent,AliMCEvent
1253 //the input data needs to be attached to the cuts
1254 //we have two cases, if we're cutting the same collection of tracks
1255 //(same param type) then we can have tracks that are both rp and poi
1256 //in the other case we want to have two exclusive sets of rps and pois
1257 //e.g. one tracklets, the other PMD or global - USER IS RESPOSIBLE
1258 //FOR MAKING SURE THEY DONT OVERLAP OR ELSE THE SAME PARTICLE WILL BE
1261 // remove the previous event
1263 if (!rpCuts || !poiCuts) return;
1264 // check the source of rp's
1265 AliFlowTrackCuts::trackParameterType sourceRP = rpCuts->GetParamType();
1266 // and ditto for the poi's
1267 AliFlowTrackCuts::trackParameterType sourcePOI = poiCuts->GetParamType();
1269 AliFlowTrack* pTrack=NULL;
1271 // if the source for rp's or poi's is the VZERO detector, get the calibration
1272 // and set the calibration parameters
1273 if (sourceRP == AliFlowTrackCuts::kVZERO) {
1274 SetVZEROCalibrationForTrackCuts(rpCuts);
1275 if(!rpCuts->GetApplyRecentering()) {
1276 // if the user does not want to recenter, switch the flag
1277 fApplyRecentering = -1;
1279 // note: this flag is used in the overloaded implementation of Get2Qsub()
1280 // and tells the function to use as Qsub vectors the recentered Q-vectors
1281 // from the VZERO oadb file or from the event header
1283 if (sourcePOI == AliFlowTrackCuts::kVZERO) {
1284 // probably no-one will choose vzero tracks as poi's ...
1285 SetVZEROCalibrationForTrackCuts(poiCuts);
1289 if (sourceRP==sourcePOI)
1292 Int_t numberOfInputObjects = rpCuts->GetNumberOfInputObjects();
1293 for (Int_t i=0; i<numberOfInputObjects; i++)
1295 //get input object (particle)
1296 TObject* particle = rpCuts->GetInputObject(i);
1298 Bool_t rp = rpCuts->IsSelected(particle,i);
1299 Bool_t poi = poiCuts->IsSelected(particle,i);
1301 if (!(rp||poi)) continue;
1303 //make new AliFlowTrack
1306 pTrack = rpCuts->FillFlowTrack(fTrackCollection,fNumberOfTracks);
1307 if (!pTrack) continue;
1308 pTrack->Tag(0); IncrementNumberOfPOIs(0);
1309 if (poi) {pTrack->Tag(1); IncrementNumberOfPOIs(1);}
1310 if (pTrack->GetNDaughters()>0) fMothersCollection->Add(pTrack);
1314 pTrack = poiCuts->FillFlowTrack(fTrackCollection,fNumberOfTracks);
1315 if (!pTrack) continue;
1316 pTrack->Tag(1); IncrementNumberOfPOIs(1);
1317 if (pTrack->GetNDaughters()>0) fMothersCollection->Add(pTrack);
1320 }//end of while (i < numberOfTracks)
1322 else if (sourceRP!=sourcePOI)
1324 //here we have two different sources of particles, so we fill
1325 //them independently
1327 for (Int_t i=0; i<poiCuts->GetNumberOfInputObjects(); i++)
1329 TObject* particle = poiCuts->GetInputObject(i);
1330 Bool_t poi = poiCuts->IsSelected(particle,i);
1332 pTrack = poiCuts->FillFlowTrack(fTrackCollection,fNumberOfTracks);
1333 if (!pTrack) continue;
1335 IncrementNumberOfPOIs(1);
1337 if (pTrack->GetNDaughters()>0) fMothersCollection->Add(pTrack);
1340 Int_t numberOfInputObjects = rpCuts->GetNumberOfInputObjects();
1341 for (Int_t i=0; i<numberOfInputObjects; i++)
1343 TObject* particle = rpCuts->GetInputObject(i);
1344 Bool_t rp = rpCuts->IsSelected(particle,i);
1346 pTrack = rpCuts->FillFlowTrack(fTrackCollection,fNumberOfTracks);
1347 if (!pTrack) continue;
1349 IncrementNumberOfPOIs(0);
1351 if (pTrack->GetNDaughters()>0) fMothersCollection->Add(pTrack);
1356 \section{The flow package in the ALICE analysis framework}
1357 \subsection{AliAnalysisTaskSE}
1358 \subsection{Analysis methods}
1361 \item AliFlowAnalysisWithCumulants.h
1362 \item AliFlowAnalysisWithMixedHarmonics.h
1363 \item AliFlowAnalysisWithFittingQDistribution.h \item AliFlowAnalysisWithMultiparticleCorrelations.h
1364 \item AliFlowAnalysisWithLeeYangZeros.h
1365 \item AliFlowAnalysisWithNestedLoops.h
1366 \item AliFlowAnalysisWithLYZEventPlane.h
1367 \item AliFlowAnalysisWithQCumulants.h
1368 \item AliFlowAnalysisWithMCEventPlane.h
1369 \item AliFlowAnalysisWithScalarProduct.h
1373 \subsection{Example: $\pi^{\pm}$ $v_n$}\label{sec:example}\index{example}
1374 As an example of how to do a flow analysis using the flow package within the \texttt{AliROOT} analysis framework\index{analysis framework}, this section will guide you through the process of measuring $\pi^{\pm}$ $v_2$, $v_3$ and $v_4$ step-by-step, using the Q-vector cumulant flow analysis method.
1376 Generally, doing an analysis in the \texttt{AliROOT} is a `two-file process', where one runs a run.C\index{run.C}\index{steering macro} script in \texttt{AliROOT} (coloquially referred to as `steering macro'), which sets up the analysis framework and takes care of the interface to the analysis \texttt{GRID}, and calls an \texttt{AddTask$\ast$.C}\index{AddTask macro} macro which in turn creates and configures instances of the relevant analysis tasks. In this example, the distinction will not be so clear, but mentioned in the text. In practice of course, you would copy these steps into macros and launch the macros from the \texttt{AliROOT} command line when doing analysis. We will not run this test on \texttt{GRID}, but assume that you have some \texttt{AliAOD.root} files available on your local system. Note that this example is a guideline, there are many ways leading to Rome, and many ways of setting up an analysis. Some of the variables that are set in the code examples below are actually also set by default. This may seem a little bit redundant, but it is done to make the reader aware of the fact that they exist.
1378 A script which contains all the steps described below and should work `out-of-the-box' can be found at \texttt{\$ALICE\_ROOT/PWGCF/FLOW/Documentation/examples/manual/runFlowOnDataExample.C}.
1380 \item [Preparing the session] First, we need to prepare the framework and root session (these steps would go into your run.C macro). Launch \texttt{AliROOT} and load the necessary libraries
1381 \begin{lstlisting}[language=C, numbers=left]
1383 gSystem->Load("libCore.so");
1384 gSystem->Load("libGeom.so");
1385 gSystem->Load("libVMC.so");
1386 gSystem->Load("libPhysics.so");
1387 gSystem->Load("libTree.so");
1388 gSystem->Load("libSTEERBase.so");
1389 gSystem->Load("libESD.so");
1390 gSystem->Load("libAOD.so");
1391 gSystem->Load("libANALYSIS.so");
1392 gSystem->Load("libANALYSISalice.so");
1393 gSystem->Load("libEventMixing.so");
1394 gSystem->Load("libCORRFW.so");
1395 gSystem->Load("libPWGTools.so");
1396 gSystem->Load("libPWGCFebye.so");
1397 gSystem->Load("libPWGflowBase.so");
1398 gSystem->Load("libPWGflowTasks.so"); \end{lstlisting}
1399 \item [Creating the manager and connecting input data]
1400 Create an analysis manager\index{analysis manager}\index{AliAnalysisManager} and create a \texttt{TChain}\index{TChain} which we will point to the data you have stored locally on your machine
1401 \begin{lstlisting}[language=C, numbers=left]
1402 // create the analysis manager
1403 AliAnalysisManager* mgr = new AliAnalysisManager("MyManager");
1404 // create a tchain which will point to an aod tree
1405 TChain* chain = new TChain("aodTree");
1406 // add a few files to the chain
1407 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0003/AliAOD.root");
1408 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0003/AliAOD.root");
1409 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0004/AliAOD.root");
1410 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0005/AliAOD.root");
1411 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0006/AliAOD.root");
1412 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0007/AliAOD.root");
1413 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0008/AliAOD.root");
1414 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0009/AliAOD.root");
1415 chain->Add("/home/rbertens/Documents/CERN/ALICE_DATA/data/2010/LHC10h/000139510/ESDs/pass2/AOD086/0010/AliAOD.root");
1416 // create an input handler
1417 AliVEventHandler* inputH = new AliAODInputHandler();
1418 // and connect it to the manager
1419 mgr->SetInputEventHandler(inputH);\end{lstlisting}
1420 Great, at this point we have created an analysis manager, which will read events from a chain of AliAOD.root files. \index{AliVEventHandler}\index{AliVEventHandler!AliAODInputHandler}
1422 The next step will be adding specific analyses to the analysis manager. This is usually done by calling an \texttt{AddTask$\ast$.C} macro, which creates instances of analysis tasks, connects input (events from the analysis manager) to these tasks, and then connects output from the task back to the analysis manager (which will take care of writing the analysis to a common output file). These next steps show what would be in your \texttt{AddTask$\ast$.C} macro.
1424 The heart of our flow analysis will be the flow event. To fill a flow event from the input AOD events, we will use the \texttt{AliAnalysisTaskFlowEvent}\index{example!AliAnalysisTaskFlowEvent} class. The AOD input events have to be supplied by the analysis manager, so first things first, retrieve the manager to which you will connect your flow analysis tasks\footnote{In the example macro this is a not necessary as you already have a pointer to the manager in your macro. However, if you split the macro into a steering macro and AddTask macro, the AddTask macro needs to retrieve a pointer to the manager which is craeted in the steering macro.}:
1426 \begin{lstlisting}[language=C, numbers=left]
1427 // the manager is static, so get the existing manager via the static method
1428 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1430 printf("No analysis manager to connect to!\n");
1434 // just to see if all went well, check if the input event handler has been connected
1435 if (!mgr->GetInputEventHandler()) {
1436 printf("This task requires an input event handler!\n");
1439 \item [Setting up the flow event task]
1440 The manager and input data are present, so we can create the flow event task and do some basic configuration
1441 \begin{lstlisting}[language=C, numbers=left]
1442 // create instance of the class. because possible qa plots are added in a second ouptut slot,
1443 // the flow analysis task must know if you want to save qa plots at the time of class construction
1444 Bool_t doQA = kTRUE;
1445 // craete instance of the class
1446 AliAnalysisTaskFlowEvent* taskFE = new AliAnalysisTaskFlowEvent("FlowEventTask", "", doQA);
1447 // add the task to the manager
1448 mgr->AddTask(taskFE);
1449 // enable QA plots (will give you more insight into what you're doing)
1450 taskFE->SetQAOn(kTRUE);
1451 // set the trigger selection
1452 taskFE->SelectCollisionCandidates(AliVEvent::kMB);\end{lstlisting}
1453 Note that in the last step you have set the trigger configuration\index{example!trigger selection}. Always make sure that you run on a trigger that makes sense for your analysis. A general remark is that the non-uniform acceptance correction methods that are implemented in the flow package, assume a flat \textbf{Q} vector distribution. Specific triggers (e.g. EMCal triggers) result in a \textbf{Q} vector bias which should \emph{not} be corrected as they invalidate that assumption\footnote{The actual event selection based on triggers is done in the \texttt{AliAnalysisTaskSE} class (to be specific, the trigger is checked in \texttt{AliAnalysisTaskSE::Exec()}) from which the \texttt{AliAnalysisTaskFlowEvent} is derived. The full set of available triggers can be found in the virtual event header \texttt{AliVEvent.h}. }.
1455 In addition to the trigger selection, one might want to do some more event selection\index{example!event selection}. The flow package has a common event selection class, which we will add to your flow event
1457 \begin{lstlisting}[language=C, numbers=left]
1458 // define the event cuts object
1459 AliFlowEventCuts* cutsEvent = new AliFlowEventCuts("EventCuts");
1460 // configure some event cuts, starting with centrality
1461 cutsEvent->SetCentralityPercentileRange(20., 30.);
1462 // method used for centrality determination
1463 cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);
1465 cutsEvent->SetPrimaryVertexZrange(-10.,10.);
1466 // enable the qa plots
1467 cutsEvent->SetQA(doQA);
1468 // explicit multiplicity outlier cut
1469 cutsEvent->SetCutTPCmultiplicityOutliersAOD(kTRUE);
1470 cutsEvent->SetLHC10h(kTRUE);
1473 // and, last but not least, pass these cuts to your flow event task
1474 taskFE->SetCutsEvent(cutsEvent);\end{lstlisting}
1476 \item [Track selection]\index{example!track selection}
1477 Now that the flow event task has been created and some basic configuration has been done, it's time to specify the POI and RP selection. This is done by defining sets of track selection criteria for both POI's and RP's: tracks in an event that pass the track selection criteria are used as POI or RP. The track selection is defined in \texttt{AliFlowTrackCuts} objects which are passed to the \texttt{AliAnalysisTaskFlowEvent} task which does the actual selection based on the passed criteria. So, let's create some track selection objects!
1479 Starting with the RP's, for which we'll just use a uniform selection of charged tracks,
1480 \begin{lstlisting}[language=C, numbers=left]
1481 //create the track cuts object using a static function of AliFlowTrackCuts
1482 AliFlowTrackCuts* cutsRP = AliFlowTrackCuts::GetAODTrackCutsForFilterBit(1, "RP cuts");
1483 // specify the pt range
1484 cutsRP->SetPtRange(0.2, 5.);
1485 // specify eta range
1486 cutsRP->SetEtaRange(-0.8, 0.8);
1487 // specify track type
1488 cutsRP->SetParamType(AliFlowTrackCuts::kAODFilterBit);
1489 // enable saving qa histograms
1490 cutsRP->SetQA(kTRUE);\end{lstlisting}
1492 The particles in this example of which we want to measure the differential $v_2$ (the POI's) are the charged pions. To measure the $v_2$ of charged pions, one must of course identify tracks are pions: for this we will use the \texttt{AliFlowTrackCuts} class. First, we do the basic setup, creating the cut object and setting some kinematic variables:
1494 \begin{lstlisting}[language=C, numbers=left]
1495 //create the track cuts object using a static function of AliFlowTrackCuts
1496 AliFlowTrackCuts* cutsPOI = AliFlowTrackCuts::GetAODTrackCutsForFilterBit(1, "pion selection");
1497 // specify the pt range
1498 cutsPOI->SetPtRange(0.2, 5.);
1499 // specify eta range
1500 cutsPOI->SetEtaRange(-0.8, 0.8);
1501 // specify the track type
1502 cutsRP->SetParamType(AliFlowTrackCuts::kAODFilterBit);
1503 // enable saving qa histograms
1504 cutsPOI->SetQA(kTRUE);\end{lstlisting}
1506 Once this is done, the particle identification routine is defined. In this example, the particle identification will be done using a Bayesian approach, combining the signals from the TPC and TOF detectors.
1507 \begin{lstlisting}[language=C, numbers=left]
1508 // which particle do we want to identify ?
1509 AliPID::EParticleType particleType=AliPID::kPion;
1510 // specify the pid method that we want to use
1511 AliFlowTrackCuts::PIDsource sourcePID=AliFlowTrackCuts::kTOFbayesian;
1512 // define the probability (between 0 and 1)
1513 Double_t probability = .9;
1514 // pass these variables to the track cut object
1515 cutsPOI->SetPID(particleType, sourcePID, probability);
1516 // the bayesian pid routine uses priors tuned to an average centrality
1517 cutsPOI->SetPriors(35.);\end{lstlisting}
1519 Now that the track cuts for both POI's and RP's are defined, we can connect them to the flow event task,
1520 \begin{lstlisting}[language=C, numbers=left]
1521 // connect the RP's to the flow event task
1522 taskFE->SetCutsRP(cutsRP);
1523 // connect the POI's to the flow event task
1524 taskFE->SEtCutsPOI(cutsPOI);\end{lstlisting}
1526 \item [Connecting input and output]\index{InputContainer}\index{OutputContainer}\index{ExchangeContainer}\index{example!connecting containers}\index{connecting containers}
1527 At this point, the event and track cuts have been set and connected to the flow event task. The next step will be connecting the flow event task to the analysis manager (so that it can receive input events) and subsequently connecting the flow event task to flow analysis tasks, so that the flow events can be analyzed by our favorite flow analysis methods.
1529 \begin{lstlisting}[language=C, numbers=left]
1530 // get the default name of the output file ("AnalysisResults.root")
1531 TString file = GetCommonFileName();
1532 // get the common input container from the analysis manager
1533 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
1534 // create a data container for the output of the flow event task
1535 // the output of the task is the AliFlowEventSimle class which will
1536 // be passed to the flow analysis tasks. note that we use a kExchangeContainer here,
1537 // which exchanges data between classes of the analysis chain, but is not
1538 // written to the output file
1539 AliAnalysisDataContainer *coutputFE = mgr->CreateContainer(
1540 "FlowEventContainer",
1541 AliFlowEventSimple::Class(),
1542 AliAnalysisManager::kExchangeContainer);
1543 // connect the input data to the flow event task
1544 mgr->ConnectInput(taskFE,0,cinput);
1545 // and connect the output to the flow event task
1546 mgr->ConnectOutput(taskFE,1,coutputFE);
1547 // create an additional container for the QA output of the flow event task
1548 // the QA histograms will be stored in a sub-folder of the output file called 'QA'
1549 TString taskFEQAname = file;
1550 taskFEQAname += ":QA";
1551 AliAnalysisDataContainer* coutputFEQA = mgr->CreateContainer(
1552 "FlowEventContainerQA",
1554 AliAnalysisManager::kOutputContainer,
1557 // and connect the qa output container to the flow event.
1558 // this container will be written to the output file
1559 mgr->ConnectOutput(taskFE,2,coutputFEQA);\end{lstlisting}
1560 \item [Flow analysis tasks]
1561 Now that the flow event task is connected to input data, the flow analysis tasks can be set up:
1562 \begin{lstlisting}[language=C, numbers=left]
1563 // declare necessary pointers
1564 AliAnalysisDataContainer *coutputQC[3];
1565 AliAnalysisTaskQCumulants *taskQC[3];
1567 // the tasks will be creaated and added to the manager in a loop
1568 for(Int_t i = 0; i < 3; i++) {
1569 // create the flow analysis tasks
1570 taskQC[i] = new AliAnalysisTaskQCumulants(Form("TaskQCumulants_n=%i", i+2));
1571 // set thei triggers
1572 taskQC[i]->SelectCollisionCandidates(AliVEvent::kMB);
1573 // and set the correct harmonic n
1574 taskQC[i]->SetHarmonic(i+2);
1576 // connect the task to the analysis manager
1577 mgr->AddTask(taskQC[i]);
1579 // create and connect the output containers
1580 TString outputQC = file;
1581 // create a sub-folder in the output file for each flow analysis task's output
1582 outputQC += Form(":QC_output_for_n=%i", i+2);
1583 /// create the output containers
1584 coutputQC[i] = mgr->CreateContainer(
1587 AliAnalysisManager::kOutputContainer,
1589 // connect the output of the flow event task to the flow analysis task
1590 mgr->ConnectInput(taskQC[i], 0, coutputFE);
1591 // and connect the output of the flow analysis task to the output container
1592 // which will be written to the output file
1593 mgr->ConnectOutput(taskQC[i], 1, coutputQC[i]);
1595 \item[Launching the analysis]
1596 With this, the \texttt{AddTask$\ast$.C} is concluded. The only thing that is left to do, is (from the \texttt{run.C} macro) see if all tasks and containers are properly connected and initialized and launch the analysis locally\index{example!launch analysis}:
1597 \begin{lstlisting}[language=C, numbers=left]
1598 // check if we can initialize the manager
1599 if(!mgr->InitAnalysis()) return;
1600 // print the status of the manager to screen
1602 // print to screen how the analysis is progressing
1603 mgr->SetUseProgressBar(1, 25);
1604 // start the analysis locally, reading the events from the tchain
1605 mgr->StartAnalysis("local", chain);\end{lstlisting}
1608 \chapter{Methods}\index{flow analysis methods}\index{methods}
1610 The flow package aims at providing the user with most of the known flow analysis methods. Detailed theoretical overview of the methods can be found in the following papers, which are included in the folder \texttt{\$ALICE\_ROOT/PWGCF/FLOW/Documentation/otherdocs/}
1612 \item The Monte-Carlo Truth
1613 \item Scalar Product Method \\ \hspace*{1cm} \texttt{EventPlaneMethod/FlowMethodsPV.pdf}
1614 \item Generating Function Cumulants \\ \hspace*{1cm} \texttt{GFCumulants/Borghini\_GFCumulants\_PracticalGuide.pdf}
1615 \item Q-vector Cumulant method \\ \hspace*{1cm} \texttt{QCumulants/QCpaperdraft.pdf}
1616 \item Lee-Yang Zero Method \\ \hspace*{1cm} \texttt{LeeYangZeroes/Borghini\_LYZ\_PracticalGuide.pdf}
1617 \item Lee-Yang Zero Method \\ \hspace*{1cm} \texttt{LeeYangZeroesEP/LYZ\_RP.pdf}
1619 The structure of this chapter is as follows: of each of the available methods a short description is given in the \texttt{theory} subsection (for more detailed information, see the papers listed above) followed by details which are specific to the implementation in the subsection \texttt{implementation}. Caveats, possible issues, etc, are listed in the \texttt{caveats} subsections.
1620 %-----------------------------------------------------------------------
1622 \section{AliFlowAnalysisWithCumulants}\index{AliFlowAnalysisWithCumulants}\index{methods!AliFlowAnalysisWithCumulants}
1624 \begin{lstlisting}[language=C, numbers=left]
1625 /*************************************************
1626 * Flow analysis with cumulants. In this class *
1627 * cumulants are calculated by making use of the *
1628 * formalism of generating functions proposed by *
1629 * Ollitrault et al. *
1631 * Author: Ante Bilandzic *
1632 *************************************************/ \end{lstlisting}
1634 \subsection{Implementation}
1635 \begin{lstlisting}[language=C, numbers=left]
1639 \section{AliFlowAnalysisWithMixedHarmonics}\index{AliFlowAnalysisWithMixedHarmonics}\index{methods!AliFlowAnalysisWithMixedHarmonics}
1641 \subsection{Implementation}
1642 \begin{lstlisting}[language=C, numbers=left]
1646 \section{AliFlowAnalysisWithFittingQDistribution}\index{AliFlowAnalysisWithFittingQDistribution}\index{methods!AliFlowAnalysisWithFittingQDistribution}
1648 \begin{lstlisting}[language=C, numbers=left]
1649 /********************************
1650 * estimating reference flow by *
1651 * fitting q-distribution *
1653 * author: Ante Bilandzic *
1655 * based on the macro written *
1656 * by Sergei Voloshin *
1657 *******************************/ \end{lstlisting}
1658 \subsection{Implementation}
1659 \begin{lstlisting}[language=C, numbers=left]
1664 \section{AliFlowAnalysisWithMultiparticleCorrelations}\index{AliFlowAnalysisWithMultiparticleCorrelations}\index{methods!AliFlowAnalysisWithMultiparticleCorrelations}
1666 \begin{lstlisting}[language=C, numbers=left]
1667 /**********************************************************
1668 * In this class azimuthal correlators in mixed harmonics *
1669 * are implemented in terms of Q-vectors. This approach *
1670 * doesn't require evaluation of nested loops. This class *
1673 * a) Extract subdominant harmonics (like v1 and v4); *
1674 * b) Study flow of two-particle resonances; *
1675 * c) Study strong parity violation. *
1677 * Author: Ante Bilandzic *
1678 *********************************************************/ \end{lstlisting}
1679 \subsection{Implementation}
1680 \begin{lstlisting}[language=C, numbers=left]
1685 \section{AliFlowAnalysisWithLeeYangZeros}\index{AliFlowAnalysisWithLeeYangZeros}\index{methods!AliFlowAnalysisWithLeeYangZeros}
1687 \begin{lstlisting}[language=C, numbers=left]
1688 ////////////////////////////////////////////////////////////////////
1689 // Description: Maker to analyze Flow by the LeeYangZeros method
1690 // One needs to do two runs over the data;
1691 // First to calculate the integrated flow
1692 // and in the second to calculate the differential flow
1693 // Author: Naomi van der Kolk
1694 //////////////////////////////////////////////////////////////////// \end{lstlisting}
1695 \subsection{Implementation}
1696 \begin{lstlisting}[language=C, numbers=left]
1697 Int_t fEventNumber; // event counter
1699 Bool_t fFirstRun ; // flag for lyz analysis: true=first run over data, false=second run
1700 Bool_t fUseSum ; // flag for lyz analysis: true=use sum gen.function, false=use product gen.function
1701 Bool_t fDoubleLoop ; // flag for studying non flow effects
1702 Bool_t fDebug ; // flag for lyz analysis: more print statements
1704 TList* fHistList; //list to hold all output histograms
1705 TList* fFirstRunList; //list from first run output
1708 \begin{lstlisting}[language=C, numbers=left]
1709 void SetFirstRun(Bool_t kt) { this->fFirstRun = kt ; }
1710 Bool_t GetFirstRun() const { return this->fFirstRun ; }
1711 void SetUseSum(Bool_t kt) { this->fUseSum = kt ; }
1712 Bool_t GetUseSum() const { return this->fUseSum ; }
1713 void SetDoubleLoop(Bool_t kt) { this->fDoubleLoop = kt ; }
1714 Bool_t GetDoubleLoop() const { return this->fDoubleLoop ; }
1715 void SetDebug(Bool_t kt) { this->fDebug = kt ; }
1716 Bool_t GetDebug() const { return this->fDebug ; }
1718 void SetEventNumber(Int_t n) { this->fEventNumber = n; }
1719 Int_t GetEventNumber() const { return this->fEventNumber; }
1720 void SetQ2sum(Double_t d) { this->fQ2sum = d; }
1721 Double_t GetQ2sum() const { return this->fQ2sum; }\end{lstlisting}
1724 \section{AliFlowAnalysisWithNestedLoops}\index{AliFlowAnalysisWithNestedLoops}\index{methods!AliFlowAnalysisWithNestedLoops}
1726 \begin{lstlisting}[language=C, numbers=left]
1727 /***************************************************************
1728 * Only in this class nested loops are used for flow analysis. *
1729 * Nested loops are used to evaluate: *
1731 * a) Distribution of relative angle difference (phi1-phi2); *
1732 * b) Cross-check the results for mixed harmonics. *
1734 * Author: Ante Bilandzic *
1735 ***************************************************************/ \end{lstlisting}
1736 \subsection{Implementation}
1737 \begin{lstlisting}[language=C, numbers=left]
1742 \section{AliFlowAnalysisWithLYZEventPlane}\index{AliFlowAnalysisWithLYZEventPlane}\index{methods!AliFlowAnalysisWithLYZEventPlane}
1744 \begin{lstlisting}[language=C, numbers=left]
1745 // AliFlowAnalysisWithLYZEventPlane:
1746 // Class to do flow analysis with the event plane
1747 // from the LYZ method
1749 \subsection{Implementation}
1750 \begin{lstlisting}[language=C, numbers=left]
1755 \section{AliFlowAnalysisWithQCumulants}\index{AliFlowAnalysisWithQCumulants}\index{methods!AliFlowAnalysisWithQCumulants}
1759 The Q-cumulant (QC) method\footnote{The overview given in this section is inspired by \cite{bilandzic-2011-83}, for further reading the reader is referred there. A full derivation of results that are relevant in this study is given in appendix \ref{qcapp}.} uses multi-particle correlations to estimate $v_n$ estimates for RP's and POI's, but does not limit itself to two-particle correlations. Although higher-order Q-cumulant calculations are available, this section will discuss the method using two- and four-particle correlations.
1761 %\paragraph{Multiparticle correlations and anisotropic flow}
1762 Multi-particle correlations in the QC method are expressed in terms of cumulants, which are the the expectation values of correlation terms in joint probability density functions. Consider the following: if two observables $f$ for particles $x_i$ and $x_j$ are correlated, the joint probability $f(x_i, x_j)$ is the sum of the factorization of the constituent probabilities and a covariance term:
1764 f(x_i, x_j) = f(x_i)f(x_j) + f_c (x_i, x_j)
1766 When taking as an observable azimuthal dependence,
1768 x_i \equiv e^{i n \phi_i}, \hspace{.5in} x_j \equiv e^{i n \phi_j}
1770 the two-particle cumulant is expressed as the covariance of the expectation value:
1772 E_C(e^{i n[\phi_i - \phi_j]}) = E(e^{[i n(\phi_i - \phi_j]}) - E(e^{in[\phi_i]})E(e^{in[- \phi_j]}).
1774 Symmetry arguments (along the lines of those given in appendix \ref{sec:harmonic_derivation}) dictate that the product of separate expectation values is equals zero, from which a familiar expression for the two-particle correlation is obtained:
1776 E_C(e^{i n[\phi_i - \phi_j]}) & = E(e^{in[\phi_i]})E(e^{in[- \phi_j]}) \\
1777 & = \left< e^{in[\phi_i]}\right> \left< e^{in[- \phi_j]} \right> \nonumber \\
1778 & = \left< e^{in[\phi_i - \phi_j]} \right> \nonumber \\
1779 & = \left< 2 \right>, \nonumber
1781 the all-event average of which is denoted by
1782 \begin{equation}\label{twocul}
1783 c_n\{2\} = \left< \left< 2 \right> \right>
1785 where $c_n\{2\}$ is called the two-particle cumulant. For the four-particle case, one proceeds likewise:
1787 E_c(e^{in[\phi_i + \phi_j - \phi_k -\phi_l]}) & = E(e^{in[\phi_i + \phi_j - \phi_k -\phi_l]}) \\
1788 & - E(e^{in[\phi_i - \phi_k]})E(e^{in[\phi_j - \phi_l]})\nonumber \\
1789 & - E(e^{in[\phi_i - \phi_l]})E(e^{in[\phi_j - \phi_k]}). \nonumber
1791 The four-particle cumulant can be expressed in terms of two- and four-particle correlations as well,
1792 \begin{equation}\label{fourcul}
1793 c_n\{4\} = \left< \left< 4 \right> \right> - 2 \left< \left< 2 \right> \right>^2.
1795 From \ref{twocul} and \ref{fourcul} it follows that $v_n$ harmonics are related to cumulants following
1796 \begin{align}\label{refFlowFromCumulants2nd}
1797 v_n\{2\} & = \sqrt{c_n\{2\}} \\
1798 v_n\{4\} & = \sqrt[4]{-c_n\{4\}} \nonumber.
1800 where $v_n\{2\}$, $v_n\{4\}$ denote flow estimates obtained from two- and four-particle correlations.
1802 In a fashion similar to that explained in the previous subsection, the Q-cumulant method uses reference flow to obtain a statistically stable estimate of the differential flow of POI's. Differential POI flow, for the two- and four-particle case, can be expressed as
1804 d_n\{2\} & = \left< \left< 2^{\prime} \right> \right> \\
1805 d_n\{4\} & = \left< \left< 4^{\prime} \right> \right> - 2\cdotp \left< \left< 2^{\prime} \right> \right>\left< \left< 2 \right> \right>\nonumber
1807 where $d_n\{2\}, d_n\{4\}$ denotes the two-, four-particle differential flow and the $^{\prime}$ is used as an indicator for differential (p$_t$ dependent) results. Disentangling from this the reference flow contributions, one is left with the final expression for the estimate of differential $v_n$ for POI's:
1809 v_n^{\prime}\{2\} & = \frac{d_n\{2\}}{\sqrt{c_n\{2\}}} \\
1810 v_n^{\prime}\{4\} & = - \frac{d_n\{4\}}{(-c_n\{2\})^{3/4}}.\nonumber
1813 \subsection{Implementation}
1814 A how-to of the QC method in the flow-package is written by the author of the analysis software and is available on the FLOW-PAG twiki page (\href{https://twiki.cern.ch/twiki/bin/view/ALICE/FlowPackageHowto}{https://twiki.cern.ch/twiki/bin/view/ALICE/FlowPackageHowto}). This section is copied from the twiki page.
1816 To get the first feeling how the FLOW package and QC output are organized, perhaps you can just trivially execute one 'on-the-fly' example
1818 Essentially, you have to do two things:
1819 \begin{lstlisting}[language=C, numbers=left]
1820 cp $ALICE_ROOT/PWGCF/FLOW/macros/runFlowAnalysisOnTheFly.C
1821 aliroot runFlowAnalysisOnTheFly.C \end{lstlisting}
1823 In the analysis on-the-fly particles are sampled from hardwired Fourier-like p.d.f, so input vn harmonics are completely under control. Please have a look at the steering macro runFlowAnalysisOnTheFly.C and corresponding class AliFlowEventSimpleMakerOnTheFly.cxx in the FLOW package, which are easily written (no fancy C++ features in my code!), and well documented.
1825 If you have landed successfully, you will get an output AnalysisResults.root, where the results from each method are structured in directories.
1827 To make a size of the file lighter (which matters a lot during merging!), you may want not to use all the methods. You can make your selection of the methods via:
1828 \begin{lstlisting}[language=C, numbers=left]
1829 Bool_t MCEP = kTRUE; // Monte Carlo Event Plane
1830 Bool_t SP = kTRUE; // Scalar Product (a.k.a 'flow analysis with eta gaps')
1831 Bool_t GFC = kTRUE; // Generating Function Cumulants
1832 Bool_t QC = kTRUE; // Q-cumulants
1833 Bool_t FQD = kTRUE; // Fitted q-distribution
1834 Bool_t LYZ1SUM = kTRUE; // Lee-Yang Zero (sum generating function), first pass over the data
1835 Bool_t LYZ1PROD = kTRUE; // Lee-Yang Zero (product generating function), first pass over the data
1836 Bool_t LYZ2SUM = kFALSE; // Lee-Yang Zero (sum generating function), second pass over the data
1837 Bool_t LYZ2PROD = kFALSE; // Lee-Yang Zero (product generating function), second pass over the data
1838 Bool_t LYZEP = kFALSE; // Lee-Yang Zero Event Plane
1839 Bool_t MH = kFALSE; // Mixed Harmonics (used for strong parity violation studies)
1840 Bool_t NL = kFALSE; // Nested Loops (neeed for debugging, only for developers) \end{lstlisting}
1841 Next important remark, if you want to browse through AnalysisResults.root, make sure that in AliROOT prompt you have loaded the FLOW library:
1842 \begin{lstlisting}[language=C, numbers=left]
1843 root [0] gSystem->Load("libPWGflowBase"); \end{lstlisting}
1844 In the AnalysisResults.root, the QC output is stored in "outputQCanalysis". Just browse there, browse in "cobjQC", and you will see the directory structure.
1845 "Integrated Flow" => contains all results needed for reference flow. Browse in, and explore the directory (in fact, TList) "Results". The names of the histos should be self-explanatory;
1846 "Differential Flow" => browse further into "Results", and you will find a bunch of things that you can explore. For instance, in the directory "Differential Q-cumulants (POI,p$_{T}$)" you will find histos holding differential QC\{2\} vs pt, QC\{4\} vs p$_{T}$, etc. On the other hand, the flow estimates themselves, namely differential vn\{2\} vs pt, vn\{4\} vs pt you can fetch from TList "Differential Flow (POI,p$_{T}$)"
1847 I hope that the names for all other things you might need are self-explanatory.
1848 You configure QC method in the steering macro via setters:
1849 \begin{lstlisting}[language=C, numbers=left]
1851 qc->SetCalculateDiffFlow(kTRUE);
1852 qc->SetCalculate2DDiffFlow(kFALSE); // vs (pt,eta)
1853 qc->SetApplyCorrectionForNUA(kFALSE);
1854 qc->SetFillMultipleControlHistograms(kFALSE);
1855 qc->SetMultiplicityWeight("combinations"); // default (other supported options are "unit" and "multiplicity")
1856 qc->SetCalculateCumulantsVsM(kFALSE);
1857 qc->SetCalculateAllCorrelationsVsM(kFALSE); // calculate all correlations in mixed harmonics "vs M"
1858 qc->SetnBinsMult(10000);
1860 qc->SetMaxMult(10000);
1861 qc->SetBookOnlyBasicCCH(kFALSE); // book only basic common control histograms
1862 qc->SetCalculateDiffFlowVsEta(kTRUE); // if you set kFALSE only differential flow vs pt is calculated
1863 qc->SetCalculateMixedHarmonics(kFALSE); // calculate all multi-partice mixed-harmonics correlators \end{lstlisting}
1864 You can make QC output lighter by setting
1865 \begin{lstlisting}[language=C, numbers=left]
1866 qc->SetBookOnlyBasicCCH(kTRUE); \end{lstlisting}
1867 (to book only basic control histograms, and disabling lot of 2D beasts), and
1868 \begin{lstlisting}[language=C, numbers=left]
1869 qc->SetCalculateDiffFlowVsEta(kFALSE); \end{lstlisting}
1870 (if not interested in differential flow vs eta => this will make the final output smaller)
1871 In the "cobjQC" you might also consider "AliFlowCommonHistQC" to be useful thing, which contains a lot of trivial but still important control histograms (eg multiplicity distribution of RPs, POIs, etc).
1872 I think this is the best and fastest way for you to get familiar with the FLOW package => once you send the QC code over the real data, you get the output organized in the very same way. I will send you shortly an example set of macros which get be used for the analysis on Grid over the real data.
1873 Differential QC\{2\} and QC\{4\} implementation is generic. You can tag as RP and POI whatever you want, and it will give you results automatically decoupled from any autocorrelation effects. For this reason, it is important that if you have certain particles which is classified both as RP and POI, to be explicitly tagged also as RPs and POI once you are building the "flow event".
1874 The basic feature in the FLOW package is that from whichever input you start, we have to build the same intermediate step called "flow event", with which than we feed all methods (SP, QC, etc) in the very same way.
1875 To see what "flow event" does, and what does it need as an input, you may want to consult task AliAnalysisTaskFlowEvent.cxx and classes needed there-in.
1879 \section{AliFlowAnalysisWithMCEventPlane}\index{AliFlowAnalysisWithMCEventPlane}\index{methods!AliFlowAnalysisWithLYZEventPlane}
1882 \begin{lstlisting}[language=C, numbers=left]
1883 // Description: Maker to analyze Flow from the generated MC reaction plane.
1884 // This class is used to get the real value of the flow
1885 // to compare the other methods to when analysing simulated events.\end{lstlisting}
1886 \subsection{Implementation}
1887 \begin{lstlisting}[language=C, numbers=left]
1893 \section{AliFlowAnalysisWithScalarProduct}\index{AliFlowAnalysisWithScalarProduct}\index{methods!AliFlowAnalysisWithScalarProduct}
1896 \begin{lstlisting}[language=C, numbers=left]
1897 /////////////////////////////////////////////////////////////////////////////
1898 // Description: Maker to analyze Flow from the Event Plane method.
1899 // Adaptation based on Scalar Product
1900 // authors: Naomi van del Kolk
1902 // mods: Carlos Perez
1903 /////////////////////////////////////////////////////////////////////////////
1905 \subsubsection{The scalar product method}
1906 The scalar product method - as well as the Q-cumulant method which will be described later - does not depend on explicit construction of an (sub)event plane, but estimates $v_n$ directly from multi-particle correlations.
1908 To do so, firstly all particles in an event are labeled either as \emph{reference particles} (RP's) or \emph{particles of interest} (POI's). The RP and POI selections are in turn divided into sub-events, which are again taken from different $\eta$ ranges, in analogy to the approach taken for the event plane method. Each POI is correlated with a sub-event Q-vector from the RP selection, which allows for the calculation of $v_n$ without any explicit reconstruction of an event plane\cite{sp}.
1910 The reason for the division into RP's and POI's is the fact that the two particle correlator of POI's,
1911 \begin{equation}\label{unstable}
1912 v_n^{POI} = \sqrt{ \left< e^{i n (\phi^{POI}_i - \phi^{POI}_j)} \right> }
1914 is generally not stable statistically. Introducing reference flow, \ref{unstable} can be rewritten as
1915 \begin{equation}\label{stable}
1916 v_n^{POI} = \frac{ \left< e^{i n (\phi^{POI}_i - \phi^{RP}_j)} \right>}{\left< e^{i n (\phi^{RP}_i - \phi^{RP}_j)} \right>} = \frac{v_n^{POI} v_n^{RP} }{\sqrt{v_n^{RP} v_n^{RP}}}.
1918 By taking an abundant particle source as RP's - in the case of this study the RP selection comprises all charged particles - both correlators in \ref{stable} are statistically stable.
1920 \paragraph{The scalar product method}
1921 In the scalar product method, POI's $u_k$,
1922 \begin{equation}\label{spderiv}
1923 u_k = e^{i n \phi_k},
1925 are correlated with $Q^*_a$, the complex-conjugate Q-vector built from RP's in a given sub-event $a$. First, the scalar product of $u_k$ and $Q^*_a$ is taken,
1927 u_k \cdotp \sum_{\substack{ j=1,\\j \neq k}}^{M_{RP, a}} u^*_j
1929 where $M_{RP, a}$ denotes RP multiplicity for a given sub-event $a$ and the inequality $j \neq k$ removes auto-correlations. From this, differential $v_n$ of POI's ($v_n^{\prime}$) and $v_n$ of RP's ($v_n^a$) in sub-event $a$ can be obtained in a straightforward way from the correlation of POI's and RP's:
1930 \begin{equation}\label{rppoisp}
1931 \left< u \cdotp Q^*_a \right> = \frac{1}{M_{RP, a}-k}\sum_{i=k}^{M_{RP, a}} \left( u_k \sum_{\substack{ j=1,\\j \neq k}}^{M_{RP, a}} u^*_j \right)
1933 where POI multiplicity is expressed in terms of $M_{RP, a}$; $M_{POI} = M_{RP, a} - k$. Since for any function $f(x)$ and constant $a$
1935 \sum a f(x) = a \sum f(x)
1937 \ref{rppoisp} can be rewritten as
1938 \begin{align}\label{sp_part2}
1939 \left< u \cdotp Q^*_a \right> & = \frac{1}{M_{RP, a}-k}\sum_{i=k}^{M_{RP, a}} e^{i n [\phi_k - \Psi_n]} \sum_{j=1}^{M_{RP, a}} e^{- i n [\phi_j - \Psi_n]} \\
1940 & = M_{RP, a} v^{\prime}_n v_n^a \nonumber
1942 where in the last step of \ref{sp_part2} it has been used that
1944 v_n = \frac{\ds \sum_i^M e^{in[\phi_i - \Psi_n]} }{M}.
1947 To obtain the estimate of $v_n$, one must still disentangle the reference flow contribution from the event averaged correlation given in \ref{rppoisp}.
1948 Proceeding in a fashion similar to that presented in equation \ref{rppoisp}, it can be shown that
1950 \left< \frac{Q_a}{M_a}\cdotp\frac{Q^*_b}{M_b} \right> = \left< v_n^{a}v_n^{b} \right>
1952 where $Q_a, Q_b$ are the Q-vectors of RP's in sub-event $a, b$. Under the assumption that
1953 \begin{equation}\label{zerononflow}
1954 \left< v_n^2 \right> = \left< v_n \right>^2,
1956 - an assumption which will be spoiled in the case of flow fluctuations - and requiring that the $v_n$ estimates in both sub-events are equal, one simply evaluates
1957 \begin{equation}\label{sp}
1958 v_n^{\prime} = \frac{\left< \left< u \cdotp \frac{Q^*_a}{M_a} \right>\right>}{\sqrt{ \left< \frac{Q_a}{M_a}\cdotp\frac{Q^*_b}{M_b} \right>}}
1960 to obtain $v_n^{a}$. For equal multiplicity sub-events $M_a = M_b$, \ref{sp} is simplified to
1961 \begin{equation}\label{spa}
1962 v_n^{\prime} = \frac{\left< \left< u \cdotp Q^*_a \right>_t \right>}{ \sqrt{ \left< Q_a\cdotp Q^*_b \right>}}.
1964 $v_n^b$ can be obtained by switching indices $a$ and $b$ in expressions \ref{sp} and \ref{spa}, and should equal $v_n^a$.
1965 This principle can be generalized straightforwardly to allow for a selection of RP's which has been divided into three subevents.
1967 v_n^a & = \frac{ \left< \left< u \cdotp \frac{Q^*_a}{M_a} \right> \right>}{\sqrt{\left< v_n^{\prime a} v_n^{\prime b} \right> \left< v_n^{\prime a}v_n^{\prime c} \right> / \left< v_n^{\prime b} v_n^{\prime c} \right>}} \\
1968 & = \frac{\left< \left< u \cdotp \frac{Q^*_a}{M_a} \right> \right>}{\sqrt{\left< \frac{Q_a}{M_a} \cdotp \frac{Q_{b}^{*}}{M_b} \right> \left< \frac{Q_a}{M_a} \cdotp \frac{Q_{c}^{*}}{M_c} \right> / \left< \frac{Q_b}{M_b} \cdotp \frac{Q_c^*}{M_c}} \right>} \nonumber
1970 where cyclic permutation of $a, b, c$ (in analogy to the switching of indices in \ref{3evsp} gives the estimates of $v_n^b$ and $v_n^c$.\textcolor{red}{[insert some discussion here: is this result actually true, and some light on va, vb, (vc)]}
1972 \subsubsection{Extension to Event Plane method}
1973 As explained earlier, the event plane analysis results in this study are actually obtained by normalizing the Q-vectors in the scalar product by their length $\vert Q_n \vert$. Consider the following:
1974 \begin{equation}\label{phase}
1975 \frac{Q_n^*}{\vert Q_n^* \vert} = \frac{\vert Q_n^* \vert e^{- i n \Psi_{Q_n}}}{\vert Q_n^* \vert} = e^{- i n \Psi_{Q_n}}.
1977 For a full event, the enumerator of \ref{sp} can be expressed as
1978 \begin{equation}\label{epsp1}
1979 \left< \left< u \cdotp e^{- i n \Psi_{Q_n}} \right> \right> = \left< \left< e^{i n \phi_i} \cdotp e^{- i n \Psi_{Q_n}} \right> \right> \nonumber = \left< \left< e^{i n (\phi_i - \Psi_{Q_n})} \right> \right> = \left< \left< \cos(n [\phi_i - \Psi_{Q_n}]) \right> \right>
1981 which corresponds to the all-event average of \ref{ep_first}. As shown in the previous subsection this expression equals $v_n^{obs}$.
1983 For normalized Q-vectors, the denominator of \ref{sp} reads (using \ref{phase}):
1984 \begin{equation}\label{epsp2}
1985 \sqrt{\left< \frac{Q_a}{\vert Q_a\vert} \cdotp \frac{Q_b^*}{\vert Q_b^* \vert \right>}} = \sqrt{\left< e^{in[\Psi_{Q_{n_a}} - \Psi_{Q_{n_b}}}\right>} = \sqrt{\left< \cos(n[\Psi_{Q_{n_a}} - \Psi_{Q_{n_b}}]\right>)}
1987 from which the event plane resolution can be calculated using \ref{emeancos} or \ref{halfeventresolution}.
1989 \subsection{Implementation}
1990 \begin{lstlisting}[language=C, numbers=left]
1991 Int_t fDebug ; // flag for analysis: more print statements
1992 Bool_t fMinimalBook; // flag to turn off QA and minimize FlowCommonHist
1993 Int_t fUsePhiWeights; // use phi weights
1994 Int_t fApplyCorrectionForNUA; // apply correction for non-uniform acceptance
1995 Int_t fHarmonic; // harmonic
1996 Int_t fNormalizationType; // 0: EP mode || 1: SP mode
1997 Int_t fTotalQvector; // 1:Qa 2:Qb 3:QaQb
2001 \begin{lstlisting}[language=C, numbers=left]
2002 void SetHarmonic(Int_t iHarmonic) { fHarmonic = iHarmonic; }
2003 void SetApplyCorrectionForNUA(Bool_t iVal) { fApplyCorrectionForNUA = iVal?1:0; }
2004 void SetNormalizationType(Int_t iVal) { fNormalizationType = iVal; }
2005 void SetDebug(Bool_t bVal) { fDebug = bVal; }
2006 void SetBookOnlyBasicCCH(Bool_t bVal) { fMinimalBook = bVal; }
2007 void SetTotalQvector(Int_t iVal) { fTotalQvector = iVal; }
2008 void SetUsePhiWeights(Bool_t bVal) { fUsePhiWeights = bVal; }
2009 void SetWeightsList(TList* const aWeightsList) { fWeightsList = (TList*)aWeightsList->Clone(); }\end{lstlisting}
2012 \subsubsection{VZERO scalar product}
2014 The VZEROA and VZEROC detectors have different $\eta$ coverage w.r.t the TPC, so to evaluate $v_2$ from VZERO-SP, do
2016 v_n = \sqrt{\frac{\langle u_i \cdotp Q_A \rangle }{\sqrt{\langle Q_A \cdotp Q_B \rangle}} \cdotp \frac{\langle u_j \cdotp Q_B \rangle }{\sqrt{\langle Q_A \cdotp Q_B \rangle}}}
2020 \item $Q_A$ and $Q_B$ are the VZEROC and VZEROA RP's
2022 There has been some disscussion ...
2024 \item Take $u$ = full TPC = $u_j$ = $u_i$, or do $u_j$ = $\eta < 0$, $u_i$ = $\eta > 0$ ?
2026 We should have a common approach to ensure uniform analyses and physics message!
2027 Majority vote has yielded the following:
2029 \item $u$ = full TPC = $u_j$ = $u_i$
2032 v_n = \sqrt{\frac{\langle u \cdotp Q_A \rangle }{\sqrt{\langle Q_A \cdotp Q_B \rangle}} \cdotp \frac{\langle u \cdotp Q_B \rangle }{\sqrt{\langle Q_A \cdotp Q_B \rangle}}}
2035 This means we should think about the \alert{correlation} between terms in this equation!
2036 \subsubsection{Caveats}
2039 \chapter{More exotic uses}\label{sec:exotic}
2040 \section{Flow analysis of resonances}
2043 Reconstructing decayed particles
2044 %\item Invariant mass reconstruction, e.g.
2046 \boxed{ \mbox{\Lambda} \longrightarrow \pi + \mbox{p} } \nonumber
2049 \item Take all the $\pi + \mbox{p}$ pairs in an event and plot their invariant mass
2050 \item Extract the signal yield \alert{$N^S$} and total yield \alert{$N^T$} from this distribution
2051 \item Measure $v_2$ of all $\pi + \mbox{p}$ pairs
2053 Under the assumption that signal and background flow are additive, we can disentangle the two
2055 v_2^{T}(m_{inv}) = & \alert{v_2^{S}} \frac{N^{S} }{N^{S} + N^{B}}(m_{inv}) \nonumber \\
2056 & + v_2^{B}(m_{inv}) \frac{ N^{B}}{N^{S} + N^{B}}(m_{inv})\nonumber
2058 \includegraphics[width=.45\textwidth]{figs/2012-Jul-25-oneOFtwo_16_18.pdf}\\
2059 \includegraphics[width=.45\textwidth]{figs/2012-Jul-25-twoOFtwo_16_18.pdf}
2061 \section{Flow analysis in the LEGO framework: re-tagging your POI and RP selections}\index{LEGO framework}\index{AliAnalysisTaskFilterFE}
2062 \subsection{The problem at hand}
2063 \subsection{Re-tagging POI and RP selections}
2067 This sums it all up.
2068 %-----------------------------------------------------------------------
2070 \begin{thebibliography}{99}
2071 \bibliographystyle{apsrev}
2074 \bibitem{Ollitrault:1992bk}
2076 %``Anisotropy as a signature of transverse collective flow,''
2077 Phys.\ Rev.\ D {\bf 46} (1992) 229.
2078 %%CITATION = PHRVA,D46,229;%%
2080 \bibitem{Danielewicz:1999vh}
2082 %``Flow and equation of state in heavy-ion collisions,''
2083 Nucl.\ Phys.\ A {\bf 661} (1999) 82.
2084 % [arXiv:nucl-th/9907098].
2085 %%CITATION = NUCL-TH 9907098;%%
2087 \bibitem{Rischke:1996nq}
2089 %``Hydrodynamics and collective behavior in relativistic nuclear
2091 Nucl.\ Phys.\ A {\bf 610} (1996) 88C.
2092 % [arXiv:nucl-th/9608024].
2093 %%CITATION = NUCL-TH 9608024;%%
2095 \bibitem{Ollitrault:1997vz}
2097 %``Flow systematics from SIS to SPS energies,''
2098 Nucl.\ Phys.\ A {\bf 638} (1998) 195.
2099 % [arXiv:nucl-ex/9802005].
2100 %%CITATION = NUCL-EX 9802005;%%
2102 \bibitem{Voloshin:1994mz}
2103 S.~Voloshin and Y.~Zhang,
2104 %``Flow study in relativistic nuclear collisions by Fourier expansion of
2105 %Azimuthal particle distributions,''
2106 Z.\ Phys.\ C {\bf 70} (1996) 665.
2107 % [arXiv:hep-ph/9407282].
2108 %%CITATION = HEP-PH 9407282;%%
2110 %\cite{Ackermann:2000tr}
2111 \bibitem{Ackermann:2000tr}
2112 K.~H.~Ackermann {\it et al.} [STAR Collaboration],
2113 %``Elliptic flow in Au + Au collisions at s(N N)**(1/2) = 130-GeV,''
2114 Phys.\ Rev.\ Lett.\ {\bf 86} (2001) 402
2115 %[arXiv:nucl-ex/0009011].
2116 %%CITATION = NUCL-EX 0009011;%%
2118 %\cite{Adler:2001nb}
2119 \bibitem{Adler:2001nb}
2120 C.~Adler {\it et al.} [STAR Collaboration],
2121 % ``Identified particle elliptic flow in Au + Au collisions at
2122 %s(NN)**(1/2) = 130-GeV,''
2123 Phys.\ Rev.\ Lett.\ {\bf 87} (2001) 182301
2124 %[arXiv:nucl-ex/0107003].
2125 %%CITATION = NUCL-EX 0107003;%%
2127 %%% theory RHIC discoveries %%%
2128 %\cite{Gyulassy:2004zy}
2129 \bibitem{RHIC_Discoveries}
2130 T.D.~Lee {\it et al.},
2131 New Discoveries at RHIC: Case for the Strongly Interacting
2133 Contributions from the RBRC Workshop held May 14-15, 2004.
2134 Nucl.\ Phys.\ A {\bf 750} (2005) 1-171
2135 %%% end theory white-papers
2138 \end{thebibliography}
2141 \chapter{About this document}
2142 \section{Specifics and webpage}
2143 Typeset using \LaTeX, converted to HTML using \texttt{pandoc} via \texttt{pandoc -r latex -w html -S -s -m -N --toc --highlight-style tango --indented-code-classes numberLines --self-contained -o outfile.html FLOW.tex}
2145 \chapter{Flow analysis `on-the-fly'}\label{sec:ante}
2146 The original `on-the-fly' manual by Ante Biland\zic is reprinted here in this appendix
2148 \section{Introduction}
2149 Flow analysis `on the fly' is a feature in the \textit{ALICE flow package}\footnote{\texttt{http://alisoft.cern.ch/viewvc/trunk/PWG2/FLOW/?root=AliRoot .}} which can serve both as a demo for the potential users of the package and as an important debugging tool for the core flow code developers. Underlying idea is very simple: To simulate events of interest for flow analysis (in what follows we shall refer to such events as \textit{flow events}) in the computers memory and than pass them `on the fly' to the implemented methods for flow analysis. Benefits of this approach include:
2152 \item No need to store data on disk (storing only the output files with the final results and not the simulated events themselves);
2153 \item Enormous gain in statistics;
2154 \item Speed (no need to open the files from disk to read the events);
2155 \item Random generators initialized with the same and random seed (if the same seed is used simulations are reproducible)\,.
2158 In Section~\ref{kickStart} we indicate how the user can immediately in a few simple steps start flow analysis `on the fly' with the default settings both within AliRoot and Root. In Section~\ref{makingYourOwnFlowEvents} we explain how the user can modify the default settings and create `on the fly' different flow events by following the guidance of his own taste.
2162 We divide the potential users of ALICE flow package into two groups, namely the users which are using AliRoot (default) and the users which are using only Root.
2164 \subsection{AliRoot users}
2165 To run flow analysis `on the fly' with the default settings within AliRoot and to see the final results obtained from various implemented methods for flow analysis, the user should execute the following steps:
2168 \item \textbf{Step 1:} Turn off the lights ...
2169 \item \textbf{Step 2:} ... take a deep breath ...
2170 \item \textbf{Step 3:} ... start to copy macros
2171 \texttt{runFlowAnalysisOnTheFly.C} and \\ \texttt{compareFlowResults.C} from
2172 \texttt{AliRoot/PWG2/FLOW/macros} to your favorite directory slowly.
2173 \item \textbf{Step 4:} Once you have copied those macros in your favorite directory simply go to that directory and type
2176 \texttt{aliroot runFlowAnalysisOnTheFly.C}
2179 \item \textbf{Step 5:} If you have a healthy AliRoot version the flow analysis `on the fly' will start. Once it is finished in your directory you should have the following files:
2182 \begin{tabular}[t]{l}
2183 \texttt{runFlowAnalysisOnTheFly.C} \\
2184 \texttt{compareFlowResults.C} \\
2185 \texttt{outputLYZ1PRODanalysis.root} \\
2186 \texttt{outputQCanalysis.root} \\
2187 \texttt{outputFQDanalysis.root} \\
2188 \texttt{outputLYZ1SUManalysis.root} \\
2189 \texttt{outputSPanalysis.root} \\
2190 \texttt{outputGFCanalysis.root} \\
2191 \texttt{outputMCEPanalysis.root}
2195 Each implemented method for flow analysis produced its own output file holding various output histograms. The final flow results are stored in the common histogram structure implemented in the class \texttt{AliFlowCommonHistResults}.
2196 \item \textbf{Step 6:} To access and compare those final flow results automatically there is a dedicated macro available, so execute
2199 \begin{tabular}[t]{l}
2200 \texttt{> aliroot} \\
2201 \texttt{root [0] .x compareFlowResults.C("")}
2205 \item \textbf{Step 7:} If you want to rerun and get larger statistics modify
2208 \begin{tabular}[t]{l}
2209 \texttt{Int\_t nEvts=440}
2213 in the macro \texttt{runFlowAnalysisOnTheFly.C}\,.
2214 \item \textbf{Step 8:} Have fun!
2216 In the next section we outline the steps for the Root users.
2218 \subsection{Root users}
2219 To be written at Nikhef...
2220 \section{Making your own flow events}
2221 \label{makingYourOwnFlowEvents}
2222 This section is common both for AliRoot and Roor users. In this section we outline the procedure the user should follow in order to simulate `on the fly' the events with his own settings by making use of the available setters. Those setters are implemented in the class \texttt{AliFlowEventSimpleMakerOnTheFly} and user shall use them in the macro \texttt{runFlowAnalysisOnTheFly.C}.
2224 \subsection{$p_T$ spectra}
2225 Transverse momentum of particles is sampled from the predefined Boltzmann distribution
2228 \frac{dN}{dp_T} = Mp_T\exp\left(-\frac{\sqrt{m^2+p_T^2}}{T}\right)\,,
2232 where $M$ is the multiplicity of the event, $T$ is ``temperature'' and $m$ is the mass of the particle. By increasing the parameter $T$ one is increasing the number of high $p_T$ particles and this parameter is the same for all events. On the other hand, multiplicity $M$ will in general vary from event to event. In the macro \texttt{runFlowAnalysisOnTheFly.C} one can modify distribution (\ref{Boltzmann}) by using setter for ``temperature'' $T$ and various setters for multiplicity $M$.
2235 \noindent\textbf{Example:} \textit{If one wants to increase/decrease the number of high $p_T$ particles, one should modify the line}
2238 \texttt{Double\_t dTemperatureOfRP = 0.44;}
2241 \textit{Examples of $p_T$ spectra for two different values of $T$ are shown in Figures~\ref{temperature020} and \ref{temperature050}}.
2245 \begin{minipage}[t]{0.5\linewidth} % A minipage that covers half the page
2247 \includegraphics[width=7.5cm]{figures/temperature020.pdf}
2248 \caption{$T=0.2$ GeV/$c$\,.}
2249 \label{temperature020}
2251 \hspace{0.5cm} % To get a little bit of space between the figures
2252 \begin{minipage}[t]{0.5\linewidth}
2254 \includegraphics[width=7.5cm]{figures/temperature050.pdf}
2255 \caption{$T=0.5$ GeV/$c$\,.}
2256 \label{temperature050}
2260 \noindent What is shown in Figures~\ref{temperature020} and \ref{temperature050} is only one example of the so called \textit{common control histograms}. They are the histograms organized in the same structure and implemented in the class \texttt{AliFlowCommonHist}. In output file of each method one can access those histograms with \texttt{TBrowser}.
2262 When it comes to multiplicity $M$, one has a choice to sample it event-by-event from two different distributions before plugging its value into Eq. (\ref{Boltzmann}) which than will be used to sample transverse momenta of $M$ particles in that event.
2265 \noindent\textbf{Example:} \textit{If one wants to sample multiplicity event-by-event from Gaussian distribution with mean 500 and spread 10, one should have the following relevant settings}
2268 \begin{tabular}[t]{l}
2269 \texttt{Bool\_t bMultDistrOfRPsIsGauss = kTRUE;} \\
2270 \texttt{Int\_t iMultiplicityOfRP = 500;} \\
2271 \texttt{Double\_t dMultiplicitySpreadOfRP = 10;}
2275 \textit{Example plot for multiplicity distribution with these settings is shown in Figure~\ref{multiplicityGauss}}.
2278 \noindent Another way to sample multiplicity event-by-event is by using uniform distribution.
2281 \noindent\textbf{Example:} \textit{If one wants to sample multiplicity event-by-event from uniform distribution in the interval [400,600], one must have the following relevant settings}
2284 \begin{tabular}[t]{l}
2285 \texttt{Bool\_t bMultDistrOfRPsIsGauss = kFALSE;} \\
2286 \texttt{Int\_t iMinMultOfRP = 400;} \\
2287 \texttt{Int\_t iMaxMultOfRP = 600;}
2291 \textit{Example plot for multiplicity distribution with these settings is shown in Figure~\ref{multiplicityUniform}}.
2295 \begin{minipage}[t]{0.5\linewidth} % A minipage that covers half the page
2297 \includegraphics[width=7.5cm]{figures/multiplicityGauss.pdf}
2298 \caption{Gaussian multiplicity distribution.}
2299 \label{multiplicityGauss}
2301 \hspace{0.5cm} % To get a little bit of space between the figures
2302 \begin{minipage}[t]{0.5\linewidth}
2304 \includegraphics[width=7.5cm]{figures/multiplicityUniform.pdf}
2305 \caption{Uniform multiplicity distribution.}
2306 \label{multiplicityUniform}
2310 \noindent One can also fix multiplicity to be the same for each event.
2313 \noindent\textbf{Example:} \textit{If one wants to have the same fixed multiplicity of 500 for each event one can use the following settings:}
2316 \begin{tabular}[t]{l}
2317 \texttt{Bool\_t bMultDistrOfRPsIsGauss = kTRUE;} \\
2318 \texttt{Int\_t iMultiplicityOfRP = 500;} \\
2319 \texttt{Double\_t dMultiplicitySpreadOfRP = 0;}
2325 \noindent These are all manipulations available at the moment with $p_T$ spectra given in Eq. (\ref{Boltzmann}).
2327 \subsection{Azimuthal distribution}
2328 If the anisotropic flow exists, it will manifest itself in the anisotropic azimuthal distribution of outgoing particles measured with respect to the reaction plane:
2331 E\frac{d^3 N}{d^3 \vec{p}} = \frac{1}{2\pi} \frac{d^2 N}{p_T dp_T d\eta} \left( 1+\sum_{n=1}^{\infty}2v_n(p_T, \eta) \cos\left( n\left( \phi-\Psi_{\rm RP}\right) \right) \right)\,.
2332 \label{azimuthalDistributionGeneral}
2335 Flow harmonics $v_n$ quantify anisotropic flow and are in general function of transverse momentum $p_T$ and pseudorapidity $\eta$. Orientation of reaction plane $\Psi_{\rm RP}$ fluctuates randomly event-by-event and cannot be measured directly. In the implementation `on the fly' reaction plane is sampled uniformly event-by-event from the interval $[0^{\rm o},360^{\rm o}]$. When it comes to flow harmonics, there are two modes which we outline next.
2337 \subsubsection{Constant flow harmonics}
2338 In this mode all flow harmonics are treated as a constant, event-wise quantities, meaning that for a particular event azimuthal angles of all particles will be sampled from the same azimuthal distribution in which flow harmonics appear just as fixed parameters. The implemented most general azimuthal distribution for this mode reads
2341 \frac{dN}{d\phi} = 1+2v_1\cos(\phi-\Psi_{\rm RP})+2v_2\cos(2(\phi-\Psi_{\rm RP}))+2v_4\cos(4(\phi-\Psi_{\rm RP}))\,.
2342 \label{azimuthalDistributionOnlyPhi}
2345 In the macro \texttt{runFlowAnalysisOnTheFly.C} one can use the dedicated setters and have handle on the flow harmonics $v_1$, $v_2$ and $v_4$. The most important harmonic is $v_2$, the so called \textit{elliptic flow}, so we start with it first.
2348 \noindent\textbf{Example:} \textit{If one wants to sample particle azimuthal angles from azimuthal distribution parameterized only with constant elliptic flow of 5\%, namely}
2351 \frac{dN}{d\phi} = 1+2\cdot 0.05\cdot\cos(2(\phi-\Psi_{\rm RP}))\,,
2354 \textit{then one should use the following settings}
2357 \begin{tabular}[t]{l}
2358 \texttt{Bool\_t bConstantHarmonics = kTRUE;} \\
2359 \texttt{Bool\_t bV2DistrOfRPsIsGauss = kTRUE;} \\
2360 \texttt{Double\_t dV2RP = 0.05;} \\
2361 \texttt{Double\_t dV2SpreadRP = 0.0;} \\
2362 \texttt{Double\_t dV1RP = 0.0;} \\
2363 \texttt{Double\_t dV1SpreadRP = 0.0;} \\
2364 \texttt{Double\_t dV4RP = 0.0;} \\
2365 \texttt{Double\_t dV4SpreadRP = 0.0;}
2371 \noindent In this mode the flow coefficients are constant for all particles within particular event, but still the flow coefficients can fluctuate event-by-event.
2374 \noindent\textbf{Example:} \textit{If one wants to sample particle azimuthal angles from azimuthal distribution parameterized only with elliptic flow which fluctuates event-by-event according to Gaussian distribution with mean 5\% and spread 1\%, than one should use the following settings}
2377 \begin{tabular}[t]{l}
2378 \texttt{Bool\_t bConstantHarmonics = kTRUE;} \\
2379 \texttt{Bool\_t bV2DistrOfRPsIsGauss = kTRUE;} \\
2380 \texttt{Double\_t dV2RP = 0.05;} \\
2381 \texttt{Double\_t dV2SpreadRP = 0.01;} \\
2382 \texttt{Double\_t dV1RP = 0.0;} \\
2383 \texttt{Double\_t dV1SpreadRP = 0.0;} \\
2384 \texttt{Double\_t dV4RP = 0.0;} \\
2385 \texttt{Double\_t dV4SpreadRP = 0.0;}
2391 \noindent On can also study uniform flow fluctuations.
2394 \noindent\textbf{Example:} \textit{If one wants to sample particle azimuthal angles from azimuthal distribution parameterized only with elliptic flow which fluctuates event-by-event according to uniform distribution in interval [4\%,6\%], than one should use the following settings}
2397 \begin{tabular}[t]{l}
2398 \texttt{Bool\_t bConstantHarmonics = kTRUE;} \\
2399 \texttt{Bool\_t bV2DistrOfRPsIsGauss = kFALSE;} \\
2400 \texttt{Double\_t dMinV2RP = 0.04;} \\
2401 \texttt{Double\_t dMinV2RP = 0.06;} \\
2402 \texttt{Double\_t dV1RP = 0.0;} \\
2403 \texttt{Double\_t dV1SpreadRP = 0.0;} \\
2404 \texttt{Double\_t dV4RP = 0.0;} \\
2405 \texttt{Double\_t dV4SpreadRP = 0.0;}
2411 \noindent It is of course possible to simulate simultanously nonvanishing $v_1$, $v_2$ and $v_4$.
2415 \noindent\textbf{Example:} \textit{If one wants to sample particle azimuthal angles from azimuthal distribution parameterized by harmonics $v_1=2\%$, $v_2=5\%$ and $v_4=1\%$, namely}
2418 \frac{dN}{d\phi} &=& 1+2\cdot 0.02\cdot\cos(\phi-\Psi_{\rm RP})+2\cdot 0.05\cdot\cos(2(\phi-\Psi_{\rm RP}))\nonumber\\
2419 &+&2\cdot 0.01\cdot\cos(4(\phi-\Psi_{\rm RP}))
2422 \textit{then one should use the following settings}
2425 \begin{tabular}[t]{l}
2426 \texttt{Bool\_t bConstantHarmonics = kTRUE;} \\
2427 \texttt{Bool\_t bV2DistrOfRPsIsGauss = kTRUE;} \\
2428 \texttt{Double\_t dV2RP = 0.05;} \\
2429 \texttt{Double\_t dV2SpreadRP = 0.0;} \\
2430 \texttt{Double\_t dV1RP = 0.02;} \\
2431 \texttt{Double\_t dV1SpreadRP = 0.0;} \\
2432 \texttt{Double\_t dV4RP = 0.01;} \\
2433 \texttt{Double\_t dV4SpreadRP = 0.0;}
2439 \noindent In the next section we outline the procedure for simulating flow events with $p_T$ dependent flow harmonics.
2441 \subsubsection{$p_T$ dependent flow harmonics}
2442 In this mode the functional dependence of flow harmonics on transverse momentum is treated as an event-wise quantity, while within the particular event the flow harmonics will change from particle to particle depending on its transverse momentum. The implemented azimuthal distribution for this case reads
2445 \frac{dN}{d\phi} = 1+2v_2(p_T)\cos(2(\phi-\Psi_{\rm RP}))\,,
2446 \label{azimuthalDistributionOnlyPtDependent}
2449 and the functional dependence $v_2(p_T)$ is implemented as follows:
2454 v_{\rm max}(p_T/p_{\rm cutoff}) & p_T < p_{\rm cutoff}\,, \\
2455 v_{\rm max} & p_T \geq p_{\rm cutoff}\,. \\
2458 \label{v(pt)parametrization}
2461 In the macro \texttt{runFlowAnalysisOnTheFly.C} one can have the handle on the parameters $v_{\rm max}$ and $p_{\rm cutoff}$.
2464 \noindent\textbf{Example:} \textit{If one wants to set $v_{\rm max} = 0.2$ and $p_{\rm cutoff} = 2$ GeV/$c$, than one should use the following settings:}
2467 \begin{tabular}[t]{l}
2468 \texttt{Bool\_t bConstantHarmonics = kFALSE;} \\
2469 \texttt{Double\_t dV2RPMax = 0.20;} \\
2470 \texttt{Double\_t dPtCutOff = 2.0;}
2474 \textit{Example plot is given in Figure~\ref{vVsPt}}.
2480 \includegraphics[width=7.5cm,angle=0]{figures/vVsPt.pdf}
2481 \caption{$p_T$ dependent elliptic flow.}
2487 (Remark: Add further explanation here.)
2489 \subsection{Nonflow}
2490 One can simply simulate strong 2-particle nonflow correlations by taking each particle twice.
2493 \noindent\textbf{Example:} \textit{If one wants to simulate strong 2-particle nonflow correlations one should simply set}
2496 \texttt{Int\_t iLoops = 2;}
2501 \subsection{Detector inefficiencies}
2502 In reality we never deal with a detector with uniform azimuthal coverage, hence a need for a thorough studies of the systematic bias originating from the non-uniform acceptance.
2505 \noindent\textbf{Example:} \textit{One wants to simulate a detector whose acceptance is uniform except for the sector which spans the azimuthal interval $[60^{\rm o},120^{\rm o}]$. In this sector there are some issues, so only half of the particles are reconstructed. To simulate this acceptance one should use the following settings:}
2508 \begin{tabular}[t]{l}
2509 \texttt{Bool\_t uniformAcceptance = kFALSE;} \\
2510 \texttt{Double\_t phimin1 = 60;} \\
2511 \texttt{Double\_t phimax1 = 120;} \\
2512 \texttt{Double\_t p1 = 1/2.;} \\
2513 \texttt{Double\_t phimin2 = 0.0;} \\
2514 \texttt{Double\_t phimax2 = 0.0;} \\
2515 \texttt{Double\_t p2 = 0.0;}
2519 \textit{The resulting azimuthal profile is shown in Figure~(\ref{azimuthalAcceptanceOneSector})}.
2522 \noindent One can also simulate two problematic sectors.
2525 \noindent\textbf{Example:} \textit{One wants to simulate a detector whose acceptance is uniform except for the two sectors which span azimuth $[60^{\rm o}, 120^{\rm o}]$ and $[270^{\rm o}, 330^{\rm o}]$, respectively. In the first sector only 1/2 of the particles are reconstructed and only 1/3 of the particles are reconstructed in the second. To simulate this acceptance one should use the following settings:}
2528 \begin{tabular}[t]{l}
2529 \texttt{Bool\_t uniformAcceptance = kFALSE;} \\
2530 \texttt{Double\_t phimin1 = 60;} \\
2531 \texttt{Double\_t phimax1 = 120;} \\
2532 \texttt{Double\_t p1 = 1/2.;} \\
2533 \texttt{Double\_t phimin2 = 270.0;} \\
2534 \texttt{Double\_t phimax2 = 330.0;} \\
2535 \texttt{Double\_t p2 = 1/3.;}
2539 \textit{The resulting azimuthal profile is shown in Figure~(\ref{azimuthalAcceptanceTwoSectors})}.
2543 \begin{minipage}[t]{0.5\linewidth} % A minipage that covers half the page
2545 \includegraphics[width=7.5cm]{figures/azimuthalAcceptanceOneSector.pdf}
2546 \caption{Non-uniform acceptance.}
2547 \label{azimuthalAcceptanceOneSector}
2549 \hspace{0.5cm} % To get a little bit of space between the figures
2550 \begin{minipage}[t]{0.5\linewidth}
2552 \includegraphics[width=7.5cm]{figures/azimuthalAcceptanceTwoSectors.pdf}
2553 \caption{Non-uniform acceptance.}
2554 \label{azimuthalAcceptanceTwoSectors}