text:
% vim: set tw=78 sts=2 sw=2 ts=8 aw et ai:
\subsection{File}

File \cite{file} is a standard Unix command which identifies the file type by looking for
the magic number in a file header. Depending on the file type and environment
other significant information might be displayed. This command is available on
most Unix, and Unix-like operating systems.

\subsection{Otool}

Otool \cite{otool} is a static analysis tool which identifies file headers and sections
displaying them in a readable manner. Support for universal headers is
included in this tool. Universal headers (also called fat binaries), are found
in files that encapsulate machine code for more than one architecture. Otool
is available only on MacOS

\subsection{Objdump}

Objdump \cite{objdump} is similar to Otool, but it lacks support for fat binaries. This
command is available on most Unix, and Unix-like operating systems.

\subsection{Jtool}

Jtool \cite{jtool} builds on the functionality of Otool and extends it even further by
adding static binary analysis specific functionalities such as symbol
injection and a better disassembler. This command is available on Linux,
and OSX64 and iOS32/64 operating systems.

\subsection{Joker}

Joker \cite{joker} is an iOS kernelcache analysis tool used for reverse engineering various
components. This tool is primarily designed for iOS, but it also works well
with the XNU kernel, thanks to the fact that most of the data structures are
identical. This command is available on Linux, and OSX64 and iOS32/64
operating systems.

\subsection{Machlib}

Machlib is the basis of both Jtool and Joker. The fact that it is closed
source has driven us to design our own library with a more complete API.This
command is available on Linux, and OSX64 and iOS32/64 operating systems.

\subsection{Mach-O View}

Mach-O View \cite{mach-o-view} is a GUI tool that parses the file header, groups its sections,
and graphically displays a hexdump of each of them. This tool is only
available on MacOS.

\subsection{Sandbox_toolkit}

Sandbox_toolkit \cite{sandbox-toolkit} is a collection of tools that deal with OS X and iOS sandbox
profiles. It can extract sandbox operations, sandbox profiles, and manage the
binary sandbox profiles. This is an open source toolkit that has become
deprecated as of iOS 10.0. This tool is only available on MacOS, as it uses
MacOS specific library calls.

\subsection{SandBlaster}

SandBlaster \cite{sandblaster} is a reversing tool that extract the Apple sandbox profiles from
the raw output of the Sandbox_toolkit, by parsing these files. This tool is
cross-platform, because it is written in Python, but it uses Sandbox_toolkit,
which can be run only on MacOS. If you can provide the sandbox binary
profiles, you can run this tool on other operating systems too.

\subsection{iExtractor}

iExtractor \cite{iextractor} is a bundle of tools and scripts that automate data extraction from
iOS firmware files. It decripts, unpacks and structures the files in an
onganized fashion. Seeing as this tool uses other MacOS specific tools, we
can consider it to be a MacOS tool, but you can provide the necessary input
data to the scripts, you could run it on other platform too.

\subsection{Open-source-machlib}

Our work is based on previous work \cite{open-source-machlib} done by Liviu
Gheorghe and Alexandros Dimos, both of which started the Open-source-machlib
project. This is an open source cross-platform API that parses both the
header and the code of the file. It extracts the code signature and
information about symbols, segments and sections.

ext: tex

max_stars_repo_name: raresvis/open-source-machlib

max_issues_repo_name: raresvis/open-source-machlib

max_forks_repo_name: raresvis/open-source-machlib


text:
\section{Lection 2. Point extimates and their properties}

Let \(X_1, X_2, \ldots X_n\) is a sample from parametric
family \(\mathcal{F} = \{ F(x, \theta), \theta \in \Theta \}\)
where \(\theta\) is unknown parameter.

Problem: find statistics $T_n = T\left( \vec{X} \right) $, values
of which, by defined realization of a sample, are taken as
approximated value of $\theta$(значення якої при заданій реалізації
$\vec{x}$ вибірки $\vec{X}$ приймається за наближене значення $\theta$).
Then $T_n$ is called a point estimate of evaluation (точкова оцінка) $\theta$.

\begin{definition}
    Statistics \[
    T_n = T(X_1,X_2, \ldots, X_n)
    .\]
    is called meaningful evaluation (змістовна оцінка) of $\theta$ if \[
    T_n \; \overset{p}{\rightarrow} \; \theta, \quad n \to \infty
    .\]
    \[
    \forall \varepsilon > 0 \quad
    P_{\theta} \left( \left| T_n - \theta \right| > \varepsilon \right) \to 0, \quad
    n \to \infty
    .\]
\end{definition}

\begin{remark}
    $P_{\theta}, M_{\theta}, D_{\theta}$ means that respective values
    are evaluated with an assumption that $X_i \sim F(x, \theta)$.
\end{remark}

\begin{definition}
    Statistics $T_n$ is called unbiased evaluation of $\theta$ if \[
    M_{\theta}T_{n} = \theta \;\;\;\; \forall \theta \in \Theta
    .\]
\end{definition}

\begin{definition}
    Statistics $T_n$ is called asymptotically unbiased evaluations if \[
    M_{\theta} T_n \to \theta, \;\; n\to \infty \;\; \forall \theta \in \Theta
    .\]
\end{definition}

\begin{example}
    $\overline{X} = \frac{1}{n} \sum_{i=1}^{n} X_i$ - meaningful
    unbiased statistics for $\theta = MX_1$.
\end{example}

\begin{example}
    \[ S^2 = \frac{1}{n} \sum_{i=1}^{n} \left( X_i - \overline{X} \right) ^2
    = \overline{X^2} - \left( \overline{X} \right) ^2 \]

    Using Law of Large Numbers:
    \[
    S^2 \overset{p}{\to} MX_1^2 - \left( MX_1 \right) ^2 = \mathcal{D}X_1
    \]
    \[
    MS^2 = M \left(\frac{n-1}{n} MS_0^2\right) \quad
    S_0^2 = \frac{1}{n-1} \sum_{i=1}^{n} \left( X_i - \overline{X} \right) ^2
    \]

    That's why \[
    MS^2 = \frac{n-1}{n} MS_0^2 = \frac{n-1}{n} \cdot \mathcal{D} X_1 \to \mathcal{D}X_1
    \]
    $S^2$ - meaningful asymptotic unbiased for $\theta = \mathcal{D}X_1$
\end{example}

\begin{corollary}[About meaningfullness and unbias of sampling moments]
    Let $g$ - borel function that $Mg(X_1) < \infty$.
    Then the evaluation \[
    \overline{g(X)} = \frac{1}{n}\sum_{i=1}^{n} g(X_i)
    .\] is meaningful unbiased evaluation for $\Theta = Mg(X_1)$.
\end{corollary}

\begin{example}[Unbiased evaluation does not exist]
    \[
    X_1 \sim \operatorname{Poiss} (\theta), \quad
    g(\theta) = \frac{1}{\theta}
    .\]
    Assume that $\exists T(X)$ unbiased estimate for $\frac{1}{\theta}$ :
    \[
    M_{\theta} T(X) = \frac{1}{\theta} \quad \forall \theta > 0
    .\]
    this means
    \[
    \sum_{k=0}^{\infty} T(k) \cdot \frac{\theta^{k}}{k!} e^{-\theta} =
    \frac{1}{\theta} \quad \forall \theta > 0
    .\]
    \[
    \sum_{k=0}^{\infty} T(k) \cdot \frac{\theta^{k+1}}{k!} =
    e^{\theta} \quad \forall \theta > 0
    .\]
    \[
    \sum_{k=0}^{\infty} T(k) \cdot \frac{\theta^{k+1}}{k!} =
    \sum_{m=0}^{\infty} \frac{\theta^{m}}{m!} \;\;\;\; \forall \theta > 0
    .\]
    The last equality is unpossible: theres no such function $T$
    that does not depend on $\theta$ in such way that the last
    equality is true.
\end{example}
\begin{remark}
    If $T_1$ and $T_2$ are unbiased evaluations for $\theta$ then \[
    T = C_1 T_1 + C_2 T_2 , \quad C_1 + C_2 = 1
    \] is unbiased too.
\end{remark}

\begin{example}
    \[
    x_1, \ldots, x_{2n} \sim B(p), \text{ $p$ is unknown }
    .\]
    \[
        \hat{p_1} = \frac{1}{2n} \sum_{i=1}^{2n} x_i
    .\]  is unbiased and measningful evaluations for $p$.
    \[
    \hat{p_2} = \frac{1}{n} \sum_{i=1}^{n} X_{2i}
    .\] is unbiased and measningful too.

    Which one is better?
\end{example}

\subsection{Root mean square approach to comparing estimates}

\begin{definition}[RMS]
    Value \[
        M_{\theta} (T(\vec{X}) - \theta) ^2
    \] is called a root
    \textbf{mean square evaluation} of $T$.
\end{definition}

\begin{definition}
    The evaluation $T_1$ is better in root mean
    square than evaluation $T_2$ if \[
    \forall \theta \in \Theta : M_{\theta} (T_1 - \theta)^2 \leq
    M_{\theta} \left( T_2 - \theta \right) ^2
    .\]  and at least for one $\theta$: \[
    M_{\theta}\left( T_1 - \theta \right) ^2 <
    M_{\theta} \left(T_2 - \theta  \right) ^2
    .\]
\end{definition}

\begin{example}[continuation]
    \[
    \hat{p_1} = \frac{1}{2n} \sum_{i=1}^{2n} X_i \quad
    \hat{p_2} = \frac{1}{n} \sum_{i=1}^{n} X_{2i}
    .\]
    \[
     M_{\theta}\left( \hat{p_1} - p \right) ^2 =
     M_{\theta} \left( \hat{p_1} - M\hat{p_1} \right) ^2 =
     \mathcal{D} \hat{p_1} = \frac{1}{2n} \mathcal{D}X_1
    .\]
    \[
    M_{\theta} \left( \hat{p_2} - p \right) ^2 =
    \mathcal{D} \hat{p_2} = \frac{1}{n} \mathcal{D} X_1
    .\]
    \[
    \frac{1}{2n} < \frac{1}{n} \Rightarrow \text{ $\hat{p_1}$ is better in rms }
    .\]
\end{example}

\begin{example}
    \[
    X_1, \ldots, X_n \sim  U(0, \theta), \quad
    \text{$\theta$ unknown }
    .\]
    \[
    T_1 = 2 \cdot \overline{X} ; \quad
    T_2 = X_{\left( n \right) }
    .\]
    for $T_1$:
    \[
    MT_1 = 2 \cdot \frac{\theta}{2} = \theta
    \]  is unbiased.
    \[
    M_{\theta} (T_1 - \theta)^2 = \mathcal{D} T_1 =
    4 \cdot \mathcal{D} (\overline{X})
    = \frac{4}{n} \cdot \mathcal{D} X_1 =
    \frac{4}{n} \cdot \frac{\theta^2}{12} = \frac{\theta^2}{3n}
    .\]
    For $T_2$:
    \[
    F_{X_{(n)}} (y) = \left[ F_{X_i}(y) \right] ^{n} =
    \begin{cases}
        1 & y \geq 0 \\
        \left( \frac{y}{\theta} \right) ^{n} & y \in [0, \theta] \\
        0 & y < 0
    \end{cases}
    .\]
    \[
    f_{X_{(n)}} (y) = n \cdot \frac{y^{n-1}}{\theta^n}
    \cdot \mathds{1}(y \in [0, \theta])
    .\]
    Herewith
    \[
    MX_{(n)} = \frac{n}{\theta^{n}} \int_{0}^{\theta} y^n dy =
    \frac{n}{n+1} \cdot \theta \underset{n\to\infty}{\to} \theta
    .\]
    $X_{(n)}$ is asymptotically unbiased
    \[
    MX_{(n)}^2 = \frac{n}{\theta^{n}} \int_{0}^{\theta} y^{n+1} dy =
    \frac{n}{n+2} \theta^2
    .\]
    Hence
    \[
    M_{\theta} \left( X_{\left( n \right) } - \theta \right) ^2 =
    \frac{n}{n+2}\theta^2 - \frac{2n}{n+1}\theta^2 + \theta ^2 =
    \frac{2}{(n+1)(n+2)}\theta^2
    .\]
    Within $n=1, n=2$ then RMS are equal.
    It follows that no is better.
    Within $n \geq 3$:
    \[
    \frac{2}{(n+1)(n+2)} < \frac{1}{3n}
    \] and $X_{(n)}$ is better in RMS.
\end{example}

\begin{definition}
    Value $b(\theta) = M_{\theta} T(\vec{X}) - \theta $
    is called biased evaluation $T\left( \vec{X} \right) $.
\end{definition}
Suppose $K_b$ is a class of biased evaluations $b = b(\theta)$.
$K_0$ is a class of unbiased evaluations.

\begin{remark}
    If $ \; \forall T \in K_b$:
    \[
    M_{\theta} \left( T(X) - \theta \right) ^2 =
    \mathcal{D}_{\theta} T(X) + \left( b(\theta) \right) ^2
    .\]
\end{remark}

\begin{definition}
    Evaluation $T^* \in K_b$ is called an optimal in this class
    if it is not worse (better) than any other evaluation
    from this class.
    \[
    \forall T \in K_b, \forall \theta \in \Theta  \;\; \mathcal{D}_{\theta} T^* \leq \mathcal{D}_{\theta} T
    .\]
\end{definition}

\begin{theorem}[about unity of optimal evaluation]
    Let $T_1$ and $T_2$ are two optimal evaluations. Then \[
    T_1 = T_2 \text{ almost certainly }
    .\]
\end{theorem}
\begin{proof}
    We got:
    \[
        M_{\theta}T_1 = \theta, \quad M_{\theta}T_2 = \theta
    .\]
    \[
        \mathcal{D_{\theta}} T_1 = \mathcal{D}_{\theta} T_2 = \sigma^2 \\
    .\]
    \begin{gather*}
        \text{Consider } T = \frac{1}{2} \left( T_1 + T_2 \right) \\
        T \in K_0 : M_{\theta} T = \theta \text{ besides } \\
        \mathcal{D}_{\theta} T \geq \sigma^2 \\
        \mathcal{D}_{\theta} T = \mathcal{D}_{\theta}
        \left( \frac{1}{2} T_1 + \frac{1}{2} T_2 \right) =
        \frac{1}{4} \mathcal{D} T_1 + \frac{1}{4} \mathcal{D}T_2 +
        \frac{1}{2} \operatorname{cov}(T_1, T_2) = \\
        = \frac{1}{2} \sigma^2 + \frac{1}{2} \operatorname{cov}(T_1, T_2) \\
        \text{ Causy-Bunyakovskiy: }
        \left| \operatorname{cov}(T_1, T_2) \right| =
        \left| \operatorname{cov}(T_1 - \theta, T_2 - \theta) \right|  \leq \\
        \leq \sqrt{\mathcal{D}_{\theta} T_1 \cdot
        \mathcal{D}_{\theta}T_2}  = \sigma^2 \\
        \mathcal{D}_{\theta}T \leq \sigma^2
    \end{gather*}
    This means that in Causy-Bnyakovskiy inequality turn into equality, and this means that \[
    T_1 \overset{\text{a.s.}}{=} k T_2 + a
    .\]
    Using conditions:
    \[
    a = 0, k = 1
    .\]
    So
    \[
    T_1 \underset{\text{a.c.}}{=} T_2
    .\]
\end{proof}

\subsection{Sample contribution and Fisher information quantity}

\[
X_{1}, \ldots, X_{n} \sim \mathcal{F}_{\theta} =
\{ F(x, \theta), \theta \in \Theta \}
.\]
$f(x, \theta)$ - corresponding distribution densit  $X_{i}$ ;
$f(x, \theta) = P\left( X_{i} = x \right) $ - in discrete case.

\begin{definition}
    \[
    \mathcal{L} (\vec{x}, \theta) = f(x_1, \theta) \cdot
    \ldots \cdot f(x_n, \theta)
    \] that is considered as function $\theta$ within fixed $\vec{x}$,
    is called a likelihood function.
\end{definition}

Consider further that
\[
\mathcal{L} (x, \vec{\theta}) > 0 \;\;\;\; \forall \vec{x} \in X \;\;\;\;
\forall \theta \in \Theta
.\]
\[
\mathcal{L}(\vec{x}, \theta) \text{ differentiable by $\theta$ }
.\]
The model is regular: the order of differential by $\theta$ and integration by $\vec{X}$ may be swapped.

\begin{example}[not regular model]
    \[
    X_1, X_2, \ldots , X_n \sim  U(0, \theta)
    .\]
    \[
    f(x, \theta) = \frac{1}{\theta} \mathds{1}(x \in (0, \theta))
    .\]
    \[
    \int_{0}^{\theta} f(x, \theta) dx = 1
    .\]
    Then \[
    \frac{\partial}{\partial \theta} \int_{0}^{\theta} \frac{1}{\theta} dx = 0
    .\]
    But \[
    \int_{0}^{\theta} \frac{\partial }{\partial \theta} \left( \frac{1}{\theta} \right) dx = \int_{0}^{\theta} - \frac{1}{\theta^2}dx = - \frac{1}{\theta} \not= 0
    .\]
\end{example}

\begin{definition}
    Random value
    \[
    U(\vec{X}, \theta) =
    \frac{\partial}{\partial \theta} \ln \mathcal{L}(\vec{X}, \theta) =
    \sum_{i=1}^{n} \frac{\partial }{\partial \theta} \ln f(X_i, \theta)
    .\] is called sample contribution. And addition
    \[
    \frac{\partial }{\partial \theta} \ln f(X_i, \theta)
    .\] is called a contribution of $i$-th observation.
\end{definition}

\begin{corollary}[about expectation of $U$]
    For regular model \[
    M_{\theta} U(\vec{X}, \theta) = 0 \;\;\;\; \forall \theta \in \Theta
    .\]
\end{corollary}
\begin{proof}
    \[
    L(\vec{X}, \theta) = f(x_1, \theta) \ldots f(x_n, \theta)
    .\]
    $L$ is compatible (сумісна) density function $\vec{X}$.
    \[
    \int_{\mathbb{R}}^{} L(\vec{X}, \theta) dx = 1
    .\]
    Differentiate by $\theta$
    \[
    0 = \frac{\partial }{\partial \theta}
    \int_{\mathbb{R}^{n}} L(\vec{X}, \theta) d \vec{x} =
    \int_{\mathbb{R}^{n}}^{} \frac{\partial}{\partial \theta}  L(\vec{X}, \theta) d\vec{x} =
    \]
    \[
    = \int_{\mathbb{R}^{n}}^{} \left[ \frac{\partial }{\partial \theta}
    \ln L(\vec{x}, \theta)  \right] \cdot L(\vec{x}, \theta) d\vec{x} =
    M_{\theta} \left[ \frac{\partial}{\partial \theta} \ln
    L(\vec{x}, \theta) \right] =
    M_{\theta} U(\vec{X}, \theta)
    .\]
\end{proof}

\begin{definition}
    Value \[
    I_n (\theta) = M_{\theta} U^2(X, \theta) =
    \mathcal{D}_{\theta} U(X, \theta)
    \] is called a number of Fisher information in sample $\vec{X}$.
    Value
    \[
    i(\theta) = M_{\theta} \left( \frac{\partial }{\partial \theta}
    \ln f(X_1, \theta) \right) ^2
    .\] is a number of information in one observation.
\end{definition}

As long as $X_1, \ldots X_n $ are independent equaly distributed values:
\[
I_n(\theta) = n \cdot i(\theta)
.\]

This means that number of information is increasing proprtionally
to the grows of sample volume.

\begin{corollary}
    If $f(x, \theta)$ is differentiable twice by $\theta$ then
     \[
         i(\theta) = - M_{\theta} \left[ \frac{\partial^2}{\partial \theta^2} \ln f(X_1, \theta) \right]
    .\]
\end{corollary}

\begin{proof}
    By the latest proof:
    \[
        0 = M_{\theta} U(\vec{X}, \theta) = \int_{\mathbb{R}^{n}}^{}
        \left[ \frac{\partial }{\partial \theta} \ln
        \mathcal{L}(\vec{x}, \theta) \right] \mathcal{L}(\vec{x}, \theta) d\vec{x}
    .\]
    Within $n = 1$ :
    \[
    0 = \int_{\mathbb{R}}^{} \left[ \frac{\partial }{\partial \theta} \ln
    f(x, \theta) \right] f(x, \theta) dx
    .\]
    Differentiate by $\theta$:
    \begin{gather*}
        0 = \int_{\mathbb{R}}^{} \left[
        \frac{\partial^2}{\partial \theta^2} \ln f(x, \theta) \right]
        f(x, \theta) dx + \int_{\mathbb{R}}^{} \left[
        \frac{\partial }{\partial \theta} \ln f(x, \theta) \right] \cdot
        \frac{\partial}{\partial \theta} f(x, \theta) dx = \\
        = M_{\theta} \left[ \frac{\partial ^2}{\partial \theta^2} \ln
        f(x, \theta) \right] \cdot \left[
        \frac{\partial }{\partial \theta} \ln f(x, \theta) \right] \cdot
        f(x, \theta) dx = \\
        = M_{\theta} \left[ \frac{\partial ^2}{\partial \theta^2}
        \ln f(x, \theta) \right] + M_{\theta} \left(
        \frac{\partial }{\partial \theta} \ln f(x, \theta) \right) ^2 = \\
        = M_{\theta} \left[ \frac{\partial^2}{\partial \theta^2}
        \ln f(x, \theta) \right] + i(\theta).
    \end{gather*}
    Herewith:
    \[
    i(\theta) = -M_{\theta} \left[ \frac{\partial ^2}{\partial \theta^2}
    \ln f(x, \theta) \right]
    .\]
\end{proof}

\begin{example}[Calculation of information quantity]
    \[
    X_{1}, \ldots, X_{n} \sim \operatorname{Poiss}(\theta)
    .\]
    \begin{gather*}
        f(x, \theta) = \frac{\theta^{x}}{x!} e^{-\theta} \quad x = 0,1,2,\ldots \\
        \ln f(x, \theta) = -\theta + x \ln \theta - \ln x! \\
        \frac{\partial ^2}{\partial \theta^2} \ln f(x, \theta) =
        \frac{\partial }{\partial \theta} (-1 + \frac{x}{\theta}) =
        -\frac{x}{\theta^2} \\
        i(\theta) = - M_{\theta} \left( -\frac{x}{\theta^2} \right) =
        \frac{M_{\theta}X}{\theta^2} = \frac{\theta}{\theta^2} =
        \frac{1}{\theta}
    \end{gather*}
\end{example}

\begin{example}
    \begin{gather*}
        X_i \sim \mathcal{N}(\theta, \sigma^2) \quad \sigma^2 \text{ known}\\
        f(x, \theta) = \frac{1}{\sqrt{2\pi} \sigma} e^{-\frac{\left(
        x - \theta \right) ^2}{2\sigma^2}} \\
        \ln f(x, \theta) = C - \frac{\left( x-\theta \right) ^2}{2\sigma^2}\\
        \frac{\partial ^2}{\partial \theta^2} \ln f(x, \theta) =
        \frac{\partial}{\partial \theta} \left(
        \frac{1}{\sigma^2}\left( x - \theta \right) \right) =
        - \frac{1}{\sigma^2} \\
        i(\theta) = - M_{\theta} \left( -\frac{1}{\sigma^2} \right)
        = \frac{1}{\sigma^2}
    \end{gather*}
\end{example}

\begin{example}
    \begin{gather*}
        X_i \sim \mathcal{N}(a, \theta^2); \quad a - \text{ known} \\
        f(x, \theta) = \frac{1}{\sqrt{2\pi} \cdot \theta} e^{-\frac{\left(
        x - a \right) ^2}{2 \theta^2} } \\
        \ln f(x, \theta) = C - \ln \theta - \frac{\left( x-a \right) ^2}{
        2\theta^2}; \\
        \frac{\partial ^2}{\partial \theta^2} \ln f(x, \theta) =
        \frac{\partial}{\partial \theta} \left(
        -\frac{1}{\theta} + \frac{\left( x-a \right) ^2}{\theta^{3}}\right) = \\
        \frac{1}{\theta^2} - \frac{3\left( x-a \right) ^2}{\theta^4} \\
        i(\theta) = - M_{\theta} \left( \frac{1}{theta^2} -
        \frac{3\left( x-a \right) ^2}{\theta^4}\right) =
        -\frac{1}{\theta^2} + \frac{3\theta^2}{\theta^4} =
        \frac{2}{\theta^2}.
    \end{gather*}
\end{example}

\subsection{Cramér–Rao bound}

\begin{theorem}
    Let $X_1, \ldots, X_n \in \mathcal{F}_{\theta} = \{ F(x, \theta),
    \theta \in \Theta\}$ a sample from regular parametrized
    model;

    Let $g(\theta)$ - differentiable function; $K_{0}^{g}$ -
    a class of unbiased evaluations for $g(\theta)$.
    Then
    \begin{equation}
    \forall T \in K_{0}^{g} \quad \mathcal{D}_{\theta} T
    \geq \frac{\left[ g'(\theta) \right] ^2}{n i (\theta)}
    \end{equation}
    moreover the equation is true only if
    \[
    T(\vec{X}) - g(\theta) = a(\theta) U(X, \theta)
    \]
    for some function $a(\theta )$; $U$ - sample contribution.

    Notice, that within  $g(\theta) = \theta$ :
    \[
    \mathcal{D}_{\theta}T \geq \frac{1}{n i(\theta)} \quad
    \forall T \in K_{0}
    .\]
\end{theorem}

\begin{proof}
   As far as $T \in K_{0}^{g}$ then
   \begin{align*}
        M_{\theta}T &= g(\theta) \quad \forall \theta \in \Theta \\
        & \Updownarrow \\
        \int_{\mathbb{R}^{n}}^{} T(\vec{x}) L(\vec{x}, \theta) d\vec{x} &=
        g(\theta), \quad \forall \theta \in \Theta
   .\end{align*}
   Differentiate by $\theta$:
   \begin{gather*}
       g'(\theta) = \int_{\mathbb{R}^{n}}^{} T(\vec{x})\cdot
       \frac{\partial}{\partial \theta} \mathcal{L}(\vec{x}, \theta) d\vec{x} = \\
       = \int_{\mathbb{R}^{n}}^{} T(\vec{x}) \left[
       \frac{\partial}{\partial \theta} \ln \mathcal{L}(\vec{x}, \theta) \right]
       \cdot \mathcal{L}(\vec{x}, \theta) d\vec{x} = \\
       = M_{\theta}\left[ T(\vec{x}) \cdot \frac{\partial}{\partial \theta} \ln
       \mathcal{L}(\vec{x}, \theta) \right] = \\
       = M_{\theta}\left[ T(\vec{x}) \cdot U(\vec{x}, \theta) \right] = \\
       = \left< M_{\theta}U(\vec{x}, \theta) = 0 \right> = \\
       = M_{\theta}\left[ \left( T(\vec{x}) - g(\theta) \right) \cdot
       U(\vec{x}, \theta) \right] \leq \left<
       \text{ Causy-Bunyakovskiy inequality } \right> \leq \\
       \leq \sqrt{\mathcal{D}_{\theta}T(\vec{x}) \cdot
       \mathcal{D}_{\theta}U(\vec{x}, \theta)} =
       \sqrt{\mathcal{D}_{\theta} T(\vec{x}) \cdot \left( n i(\theta) \right) }
   \end{gather*}
   Herewith:
   \begin{align*}
       \left[ g'(\theta) \right] ^2 &\leq \mathcal{D}_{\theta} T(\vec{x}) \cdot
       I_{n} (\theta) \\
        & \Downarrow \\
       \mathcal{D}_{\theta}T(\vec{x}) &\geq \frac{\left[
       g'(\theta) \right] ^2}{I_{n}(\theta)}
   .\end{align*}
   Equality in inequality of Causy-Bunyakovskiy is true if and only if:
   \[
   T(\vec{x}) - g(\theta) = a(\theta) \cdot U(\vec{x}), \theta)
   .\]
\end{proof}

\begin{definition}
    Evaluation $T^{*} \in K_{0}^{g}$ is called \textbf{effective} (by Cramér–Rao) if
    \[
    \mathcal{D}_{\theta}T^{*} = \frac{\left[ g'(\theta) \right] ^2}{ni(\theta)}
    .\]
    Criterion of effectiveness:
    \[
    T^{*} = g(\theta) + a(\theta) U(\vec{x}, \theta)
    .\]
    Effective evaluation is optimal and therefore the only one.
\end{definition}

\begin{example}
    \begin{gather*}
        X_1, \ldots, X_n \sim \operatorname{Poiss}(\theta); \quad
        \theta = MX_1 \\
        T(\vec{X}) = \overline{X}. \\
        i(\theta) = \frac{1}{\theta} \\
        \mathcal{D}_{\theta} T = \frac{1}{n} \mathcal{D}X_1 =
        \frac{\theta}{n} = \frac{1}{ni(\theta)}
        \Rightarrow T = \overline{X} \quad \text{ --- effective for }
        \theta = MX_1
    \end{gather*}
\end{example}

\begin{example}
    \begin{gather*}
        X_i \sim \mathcal{N}(\theta, \sigma^2) \quad \theta = MX_1 \\
        T(\vec{X}) = \overline{X} \quad i(\theta) = \frac{1}{\sigma^2} \\
        \mathcal{D}(\overline{X}) = \frac{1}{n} \mathcal{D}X_1 =
        \frac{\sigma^2}{n} = \frac{1}{ni(\theta)} \Rightarrow
        \overline{X} \text{ --- effective }.
    \end{gather*}
\end{example}

\begin{example}
    \begin{gather*}
        X_i \sim \mathcal{N}(a, \theta^2) \quad \theta^2 = \mathcal{D}X_{1} \\
        S^2 = \frac{1}{n} \sum_{i=1}^{n} \left( X_i - a \right) ^2 \\
        MS^2 = \mathcal{D}X_{1} = \theta^2 \\
        g(\theta) = \theta^2; \quad g'(\theta) = 2 \theta \\
    i(\theta) = \frac{2}{\theta^2}; \quad
    \frac{\left( g'(\theta) \right) ^2}{ni(\theta)} =
    \frac{2 \theta^{4}}{n};
\end{gather*}
\begin{gather*}
    \mathcal{D}S^2 = \frac{1}{n} \mathcal{D}\left( X_1 - a \right) ^2 =
    \frac{1}{n}\left( M\left( X_1 - a \right) ^4 -
    \left( M(X_1 - a)^2 \right) ^2\right) = \\
    = \frac{1}{n} \left( \left( 4-1 \right) !!
    \left( \mathcal{D}X_1 \right) ^2 -
    \left( \mathcal{D}X_1 \right)^2 \right) = \\
    = \frac{1}{n}\left( 3 \theta^4 - \theta^4 \right)  =
    \frac{1}{n} 2 \theta^{4}; \\
    \frac{\left[ g'(\theta) \right] ^2}{ni(\theta)} =
    \frac{4 \theta^{4}}{2n} = \frac{2 \theta^{4}}{n}; \\
    \mathcal{D}S^2 = \frac{\left[ g'(\theta) \right] ^2}{ni(\theta)}
    \Rightarrow S^2 \text{ --- effective}.
    \end{gather*}
\end{example}

max_stars_repo_name: aipyth/notes

max_issues_repo_name: aipyth/notes

max_forks_repo_name: aipyth/notes


text:
\documentclass[11pt,a4paper,onecolumn]{IEEEtran}
%\usepackage{ragged2e}
\usepackage[]{natbib}
\usepackage{tocloft}
\usepackage{fancyheadings}% for header footer and page style
\usepackage{fancyhdr}
%\usepackage[tocflat]{tocstyle}
%\usetocstyle{standard}

%\usepackage{apacite}♠
\usepackage[a4paper, margin=1in]{geometry}
\usepackage{graphicx}
%opening
\title{}
\author{}
\pagestyle{fancy}
\newcommand{\tstamp}{\today}
%header and footer defnitions
%E:Even,O:odd,R,L,C direction and H: header, F: footer
\fancyhead[RO,RE]{\today}
\fancyhead[LO,LE]{Research proposal}
\fancyfoot[LO,LE]{Biruk Asmare}
\fancyfoot[RO,RE]{\thepage}
\fancyfoot[CO,CE]{}
\renewcommand{\footrulewidth}{0.4pt}%add line on the footer

%\usepackage[document]{ragged2e}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
%changing numbering styles
%\renewcommand\thesection{\Roman{section}}
%\renewcommand\thesubsection{\Alph{subsection}}
\setlength{\parindent}{0pt}% avoids paragraph indentation
\setlength{\parskip}{1em}%space between paragraphs
\begin{document}

\section{Background and Introduction}
\input{introduction}

\end{document}

max_stars_repo_name: Biruk-Asmare/tele

max_issues_repo_name: Biruk-Asmare/tele

max_forks_repo_name: Biruk-Asmare/tele


text:
\section{Run by run QA, how to and code}
\subsection{Online - Francesco, Michael}

\subsubsection{Creation and checking of online QA histograms (AMORE)}
The QA histograms for the EMCal are created and filled by the class:\\
\texttt{\$ALICE\_ROOT/EMCAL/AliEMCALQADataMakerRec}\\
It is run both during the offline reconstruction and by the online data quality monitoring framework. Its main methods are:\\

\texttt{InitRaws()}:
All the QA histograms are created here. Their titles should be self-explaining. Each of them has 2 important flags:\\
\texttt{expert} - if true, the histogram is shipped only to the AMORE expert agent (run in the EMCal station), otherwise it is also shipped to the AMORE shifter agent (at the moment we have 4 histograms monitored by the DQM shifter).\\
\texttt{image} - if true, the plots is saved to the loogbok (there should be 9 plots in the logbook).\\
Each of those histograms is replicated 4 times by the amore framework and filled according to the event species (Calib, Cosmic, LowMultiplicity, HighMultiplicity).\\

\texttt{MakeRaws(AliRawReader* rawReader)}:
Here we loop over the input raw data stream and we fill the histograms.\\

\texttt{MakeRawsSTU(AliRawReader* rawReader)}:
STU raw data decoding, provided EMCal trigger experts.\\

\texttt{GetCalibRefFromOCDB()}:
Get the reference histograms from the OCDB. The ratio between histograms from current run and the reference run is calculated in the \texttt{MakeRaws} method.\\

The QA histograms are then analyzed by the class:\\
\texttt{\$ALICE\_ROOT/EMCAL/AliEMCALQAChecker}\\
It checks the data contained in the 4 non-expert histograms. They are at the moment:
\begin{enumerate}
\item Ratio distribution of towers' amplitude in the current run w.r.t. the reference run.
\item Number of hits of L1 Gamma patch.
\item Number of hits of L1 Jet patch.
\item Number of links between TRU and STU.
\end{enumerate}
The main method is:
\texttt{CheckRaws()}: For the first histogram, we check how many
channels have the ratio in the region $0.8-1.2$. If there are more than
the threshold (default = 90\%), everything is ok, otherwise a red box with a ``call
expert'' message is displayed. For L1 Jet/Gamma patch, we check if the
rate of a single patch is higher than the average rate of all other
patches times a certain threshold value (default = 0.5):
\begin{equation}
Rate_{patch}/Rate_{Total} > Threshold /(1 + Threshold)
\end{equation}

 If so red box with a ``hot spot - call expert'' message is
 displayed. Finally, if there is a number (default = 1) of missing
 STU-TRU links, another red box with a warning message is shown.
If one wants to change the thresholds, this can be done by updating
them in the database (type \texttt{amoreConfigFileBrowser d emc} at
any machine at P2 and edit the file \texttt{QAThresholds.configfile} accordingly).

\subsubsection{How to's for EMCal AMORE experts}

\paragraph{How to run AMORE at point 2 (P2):}

Some useful scripts for running AMORE at P2 are located in the \texttt{\textasciitilde/amore} directory in the aldaqacr51 machine. \texttt{StartAmore.sh} is used to run the agent and the GUI (in the expert mode). It simply launches the \texttt{configMonitor.sh} and the \texttt{checkLogs.sh} (used to check the logs of the agents). \texttt{configMonitor.sh} setup the agent and the GUI using some kdialog commands and runs them.
Basically the agent is run by the following line in the script:\\
\texttt{sshdqm \$agentName nohup \$scriptsPATH/startAmoreAgent.sh \$onlineMode \&}\\
The agent is actually run on the EMCal DQM node via the sshdqm command, so this line basically is used to connect to our dqm node and run the agent there.\\
The GUI is launched in our machine by the command:\\
\texttt{amore -c EMC -m EMCUIQA(TRU) -g configFile.txt}\\
The \texttt{configFile.txt} file contains just one line, i.e. \texttt{runType i}, where \texttt {i} runs from 1 to 4 (1=LowMultiplicity, 2=HighMultiplicity, 3=Cosmic, 4=Calib) and it is used to select the event specie you want to display in the GUI (this file is automatically created each time you run \texttt{configMonitor.sh}).\\
Some other useful scripts (which are launched by \texttt{configMonitor.sh} using the sshdqm) are located in our DQM node. One can login to it by using:\\
\texttt{ssdqm EMCQA}\\
They are located in the \texttt{scripts} directory.\\
\texttt{startAmoreAgent.sh} basically runs the agent, it simply issues the command:\\
\texttt{amoreAgent -a EMCQA -s @\$1: -u}\\
The only parameter here is \$1, which is the gdc to monitor, defined in \texttt{configMonitor.sh}.
\texttt{killAgent.sh} kills any running agent. Be aware that there cannot be 2 running agents  of the same kind at the same time (i.e. just one EMCQA and one EMCQAshifter at a time). It can happen that some time the agent does not start when you try to run it. Most of the time this is because the dqm shifter is already running the EMCQA agent instead of just the EMCQAshifter one (they can run it from the dqm station even if they shouldn't). To check if the dqm shifter is running it, simply do \texttt{ps aux | grep EMCQA} in the dmq node, and see if there is an EMCQA process belonging to the user daq. If so, kindly ask the dqm shifter to please kill it.\\
The agent is always running using the same parameters, which are
stored in a database. In order to change them, you should run the
\texttt{amoreConfigFileBrowser} command in the aldaqacr51 machine. A
window will appear, there you can browse a lot of configuration
files. Our files are \texttt{EMCAL\_config.txt} (it contains just the
librares to be loaded by the agent, and the event species to monitor),
\texttt{QAdescriptions\-EMC.configfile} (it contains the descriptions
of the histograms shipped to the dqm shifter), and
\texttt{QAThresholds.configfile} (it contains the thresholds for the
QA checker - see above). You can edit them by pressing the edit button.

\paragraph{How to run AMORE in the test machine:}

The EMCal AMORE test machine can be reached via \texttt{ssh
  emcal@pcaldbl601}. The standard setup there is identical to the
setup at P2. In the home directory there are some symbolic links which
need to be changed in order to change the setup and test new
features. \texttt{alirootLink} usually links to
\texttt{/opt/aliroot-<some-ver>}, which is the version currently at P2
(daq team updates the software in the \texttt{/opt} directory when
needed). The same holds for \texttt{rootLink}, \texttt{amoreLink} and
\texttt{amoreSiteLink} (you should not need to change
\texttt{rootLink} and \texttt{amoreLink}). For testing some changes to
the EMCAL QA classes, one has to compile an own version of aliroot
with the new version of those classes, and then make a symbolic link
to the path of this aliroot version. There is an aliroot trunk version
which was used to be updated from time to time for tests in \texttt{fblanco/alisoft}. In the directory \texttt{myamoreStuff} there are 2 version of the AMORE modules: \texttt{current\_deploy} and \texttt{trunk} (of course you should do svn up from time to time). Let's suppose you want to make some modification to our AMORE GUI (the expert one) and test them. Remove the \texttt{amoreSiteLink} (it usually points to \texttt{/amoreSite}). Then do:\\
\texttt{ln -s myamoreStuff/amoreSite amoreSiteLink}\\
(or any other directory you would like to use). Then:\\
\texttt{cd trunk[current\_deploy]/amoreEMC}\\
At this point you can modify either the \texttt{src/ui/EMCUIQA} or \texttt{src/ui/EMCUIQATRU} class. This class contains just some manipulations of canvas/histograms to be shown in the expert panel and should be easy to understand. If there are some doubts, just ask. The first one also contains the hack we use in order to use our own reference file at P2 in used to calculate the ratio to reference (next section will explain how to create a new reference file). \texttt{make install} will install the modified libraries into \texttt{amoreSiteLink}. You can use some of the scripts in the \texttt{fblanco} directory to run the agent and the GUI.
In order to run the expert agent with the expert GUI you should do:\\
\texttt{amoreAgent -a EMCQA -s <some-raw-data>\footnote{If you want to create a raw data file, you should first download a chunk of raw data from alien. Then do:\\ \texttt{deroot file.root file.raw}.\\ Keep in mind that the test machine is shared with other detectors, so avoid to store a lot of raw data there and clean up the space from time to time.} -g emcal\_amore.cfg}\\
After doing ssh to the test machine in another terminal, you do \\
\texttt{amore -d EMC -m EMCUIQA(TRU) -g configGUI.txt}\\
If you want to test the shifter agent, you simply do:\\
\texttt{amoreAgent -a EMCQAshifter -s <some-raw-data>  -g emcal\_amore.cfg}\\
and type \texttt{amoreGui} in another terminal window.\\
You can commit changes to the trunk (and not to the current\_deploy) with the usual \texttt{svn commit}. Once you feel that your changes are ready to be deployed at P2, send an email with a request to date-support.

\paragraph{How to create a new reference file:}

In order to create a new reference file, you have to use the \texttt{doReco.sh} script. The only thing you should do there is the path to the raw data in alien and the number of chunks to analyze (check it in the alien path).
Remember to do \texttt{alien-token-init} and \texttt{source /tmp/gclient\_env\_\$UID} before running the script.
After the script is executed you will have some directories (chunck10, chunk11...). Each of them contains an \texttt{EMCAL.QA.<RunNumber>.root} file. You can do :\\
\texttt{hadd EMCAL.QA.0.root chunck10/EMCAL.QA.<RunNumber>.root \newline chunck11/EMCAL.QA.<RunNumber>.root}\\
to merge them (the output files should always be called \texttt{EMCAL.QA.0.root}).
At this point the output file can be already copied to the aldaqacr51 machine in the emcal station, in which we can change the QARef file whenever we want.
In order to do that, you should copy it to your lxplus area, then from the \texttt{\textasciitilde/amore/QARef} directory in the aldaqacr51 you can do:\\
\texttt{scp your-afs-account@aldaqgw01:/afs/cern.ch/<path-to-file>/<file> .}\\
Do:\\
\texttt{ln -s new-file QA.Ref.root}\\
and add a note to the notes file in the directory.
Then you have to create an OCDB file. In order to do that, you must do\\
\texttt{aliroot Save2OCDB.C}\\
Standard parameters of the macro are ``EMCAL'' (detector name), 0 (run number) and ``12'' (year). You may need to change only the last one. The macro will create a directory named \texttt{QARef/EMCAL/QA/Calib/}, and the file \texttt{Run0\_999999999\_v0\_s0.root} in it. This file has to be committed to the \texttt{QARef/EMCAL/QA/Calib/} directory of aliroot. You can check it with the \texttt{checkCDB.C} macro (it just displays a couple of histograms).
%\subsection{}

\subsubsection{Some more informations}
Further details about AMORE can be found here:\\
\href{https://ph-dep-aid.web.cern.ch/ph-dep-aid/amore/}{https://ph-dep-aid.web.cern.ch/ph-dep-aid/amore/}\\
The Twiki page with the general EMCal informations for the DQM shifter is:\\
\href{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/EVEEMC}{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/EVEEMC}
The Twiki page (DQM blackboard) with temporary informations for the DQM shifter is:\\
\href{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/DQMBlackboard}{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/DQMBlackboard}

\subsection{Offline - Marie}
\label{sec:QAOffline}

The aim of the offline QA is to check EMCAL data quality but also to get information of the global run quality with respect to EMCAL. The offline QA is automaticclly processed for each official data reconstruction pass, it can be calibration passes, validation passes, production passes or specific early dedicated production such as the ``muoncalo'' production for calorimeters and muon detectors. The user can then analyse the outputs created during official reconstruction passes which are stored on alien. The output are in that case stored in /alice/data/year/period/pass/QAresults.root files.
But each analyser can also add the QA task in its ianalysis in order to perform the QA of his dataset.

The following sections describes how to run the QA task then how to analyse the ouputs run by run and  how to look at EMCAL stability via some trending observables for whole periods/year.

\subsubsection{Creation of offline QA histograms }

The offline QA histograms for the EMCal are created and filled by the class:\\
\texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA}\\
This class takes the information on AliESD/AliAOD objects and fills histograms related to EMCAL cluster or cells but also on correlation between EMCAL and the other detectors in the run.
Its main methods are:
\begin{itemize}

\item \texttt{ MakeAnalysisFillHistograms()}: main loop where the histogram filling once the clusters and cells are loaded.
\item \texttt{ ClusterLoopHistograms(const TObjArray $\*$ clusters, AliVCaloCells $\*$ cells)}: fill of cluster related histograms.
\item \texttt{ CellHistograms(AliVCaloCells $\*$ cells)}: fill cells related histograms.
\item \texttt{ Correlate()}: this methods allows to correlate clusters observables to other detector observables: tracks, VO signal, PHOS clusters.
\item \texttt{ InvariantMassHistograms(const Int$\_$t iclus, const TLorentzVector mom, const Int$\_$t nModule,const TObjArray$\*$ caloClusters, AliVCaloCells $\*$ cells)}: fill Invariant mass histograms in cluster loop.
\end{itemize}

The way to initialize the macro is the following: \\
\texttt{AddTaskCalorimeterQA(Bool$\_t$ kSimulation = kFALSE,const char *suffix = default, TString outputFile='' ''  ,Int$\_t$  year = 2012, Bool$\_t$ kPrintSettings = kFALSE)}

where
\begin{itemize}

\item  kSimulation: TRUE if you want to run all the MC histograms.
\item suffix: suffix added to $CaloQA\_$ to the name of the TDirectory and TList where the output histograms will be stored. This is important in case you want to add the task for different \textbf{AliVEvent} offline trigger type set by  SelectCollisionCandidates(kTriggerMask).
\item outputFile: this will be let to the Analysis manager to define it;
\item year: by default to 2012 will set all the SuperModules histograms (12) even if data from previous years are analysed. (if sets to 2010 or 2011 the associated nb of SM (10 for 2011 to 2013 ; 4 for 2010)
\item kPrintSettings: to have lots of printings.

\end{itemize}

An example of configuration macro for this class can be found in \\
\texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA/macros/\\QA/AddTaskCalorimeterQA.C}\\

Lots of settings for this class can be configured via the macro
such as the filling of MonteCarlo info, the range of the histograms, the different histogram class filling.

The ingredient to be passed to the \texttt{AddTaskCalorimeterQA.C} macro are the ones of\\
\texttt{\$ALICE\_ROOT/PWG/CaloTrackCorrBase/AliAnalysisTaskCaloTrackCorrelation.cxx}.

An example of how to call it can be found in
\texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/\\AliAnaCalorimeterQA/macros/ana.C}\\

\subsubsection{Run by Run Quality Assurance}

 The Run by Run Quality assurance is made by analyzing different histograms.
A macro \\ \texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA/macros/QA/QAplots.C} is used systematically on all the runs.
This macro runs on the .root file generated by the\\ \texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA/macros/ \\ QA/AddTaskCalorimeterQA.C} and looks at several histograms generated by the \texttt{AliAnaCalorimeterQA} task.
To run this macro it is supposed that the output (.root files) of the QA task are in a directory named {\bf period/pass} where period is the period (e.g. LHC12h) and pass the reconstruction pass you are looking at. The .root files are supposed to be renamed {\bf runnumber.root} in case of production passes, validation passes or dedicated calo production passes and {\bf runnumber$\_$outer.root} or {\bf runnumber$\_$barrel.root} in case of cpass (calibration pass). In the calibration pass case, the Minimum Bias triggers are reconstructed within the $\_$barrel.root extansion and the specific triggers (muon, EMCAL, ...) are reconstructed with the $\_$outer.root extension. The QA task is called twice at the end of reconstruction to separate both kind of triggers.

To run the macro you must have in the period/pass repository a text file called ``runlist.txt containing the list of run you whant to plot, the runlist.txt beeing of the type:\\
1 ~~~~~run1\\
2 ~~~~~run2\\
.....\\
The output plots are saved automatically in repository period/pass/runnumber so that you should create those repository prior to running the macro.\\

The arguments to pass to the macro:
\texttt{ QAplots(TString fCalorimeter = "EMCAL", TString period = "LHC11h", TString pass = "pass", TString fTrigger= "default", TString system = "PbPb")} are the following:
\begin{itemize}
\item  TString fCalorimeter : name of the calorimeter: "EMCAL".
\item  TString period: path(name) of the repository  for  the period.
\item  TString pass: name of the repository where you saved the .root files (in the example period/pass).
\item  TString fTtrigger type: "default" for the minbias; "trigEMC" or "EMC7" for EMCAL triggers. This corresponds to the TString suffix of the AddTaskCalorimeterQA() when initializing the task.
\item  TString system: "PbPb" or "pp": a flag for setting/adjusting scales for some drawings to the multiplicities/energies reached in the system.
\end{itemize}

For typical automatic QA of official reconstruction passes the histograms we check automatically with runnning of the QAplots.C  macro are the following: but the user can add as much histograms verifications as he wants.
\begin{itemize}
\item Occupancy map: $\eta$ $\phi$ distributions of cells with signsl (in row/col units).
\item Summed energy map: $\eta$ $\phi$  distribution of mean energy/event (in row/col units).
\item Time vs E of custers: Time vs Energy of clusters.
\item EMCAL Cluster versus track correlation (multiplicities/energies).
\item EMCAL Clusters vs VO signal correlation.
\item EMCAL vs PHOS clusters correlations.
\end{itemize}

On top of those default settings and checks, the user can add as much histograms checks as he wants.

\subsubsection{Period Quality Assurance and stability of EMCAL}

The stability of EMCAL is checked also systematically at the end of each reconstruction passes (calibration pass, validation pass, production pass).
This step is done via a set of macros called ``trending'' macros which can be found in  \texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/\\ AliAnaCalorimeterQA/macros/QA/}. The goal of these two  macros (trendingClusters.C and trendingPi0.C) is to look at averages observables concerning clusters and $\pi^0$ respectively, as a function of runnumber.
Those macros uses the output of  .root file generated by the\\ \texttt{\$ALICE\_ROOT/PWGGA/CaloTrackCorrelations/AliAnaCalorimeterQA/macros/ \\ QA/AddTaskCalorimeterQA.C}.
It requires the same repository, naming conventions as in the previous section: period/pass/runnumber.root files and a runlist.txt file containing the list of runs to check. It can be run depending on the ``fTrigger" option  EMCAL triggered events and on the MinBias events.

{\bf Cluster Averages: (trendingCluster.C):}

This macro computes some averages over histograms and store them in a TGraph as a fuction of runnumber.
The folling histograms are used:
\begin{itemize}
\item EMCAL\_hE: cluster energy distribution in EMCAL.
\item EMCAL\_hNClusters\_Mod\_xx: 2D histogram with number of cluster per supermodule.
\item EMCAL\_hNCellsPerCluster\_Mod\_xx: 2D histogram with number of cells per supermodule.
\item EMCAL\_hE\_Mod\_xx: 2D histogram with Cluster Energy per supermodule.
\end{itemize}

and the following averages are computed and displayed as a funcion of runnumber:

\begin{itemize}
\item Mean number of clusters per event is computed  over EMCAL and also per supermodule. An example is displayed on figure \ref{fig:trendingCluster} for LHC12i period.
\item Average energy of clusters (with given threshold energies) per event is computed over EMCAL and also per supermodule.
\item Number of cells of clusters (with given threshold energies)per event is computed over EMCAL and also per supermodule.
\end{itemize}

\begin{figure}[ht]
\begin{center}
\includegraphics[width=0.9\textwidth]{figures/trendingClusterLHC12iMB.pdf}
\end{center}
\caption{\label{fig:trendingCluster}
Example of trending plot for period LHC12i: mean number of cluster per event as a function of runnumber for MinBias events.}
\end{figure}

{\bf $\pi^0$ Averages: (trendingPi0.C):}

This macro computes some fits over invariant mass histograms and store the fit parameters and $\pi^0$ computed values in a TGraph as a funcion of runnumber. The following histograms are used:
\begin{itemize}
\item EMCAL\_hIM: Invariant mass histogram filled over the whole cluster pairs.
\item EMCAL$\_$hIM$\_$Mod$\_$xx: Invariant mass histogram filled over the cluster pairs in the same supermodule.
\end{itemize}

The fit is  done by a gaussian plus  a 2$^{nd}$ order polinom for background. This is a very ``raw'' fitting wich may not be appropriate especially for the PbPb cases but allows to check the stabilities of averages (mass, width, number of $\pi^O$).

\begin{itemize}
\item Mean number of  $\pi^0$ per event is computed over EMCAL and also per supermodule.
\item Mass of the $\pi^0$ per event is computed over EMCAL and also per supermodule.
\item Witdh of the $\pi^0$ per event is computed over EMCAL and also per supermodule.
\end{itemize}

The use of these set of QA macros allows to identify problematic runs (subperiod with missing part of detectors) or more general features. Also it can be used to check global observables for different dataset used for analysis purpose.

\subsection{Event display}

\subsection{Logbook tips}

max_stars_repo_name: AllaMaevskaya/AliRoot

max_issues_repo_name: AllaMaevskaya/AliRoot

max_forks_repo_name: AllaMaevskaya/AliRoot