]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/doc/analysis.tex
Charged jets (pPb): Updated deltaPt calculation
[u/mrichter/AliRoot.git] / EMCAL / doc / analysis.tex
index 39a868a1fae2ff4dddb0c9085ff3bf3d43aa0029..55f7947a819aef26eb56d85c76ebe647af369812 100644 (file)
@@ -1,25 +1,16 @@
 \section{Analysis format and code}
 
-All the reconstructed particles of all the detectors will be kept
+All the reconstructed particles of all the detectors are kept
 in a file called \textbf{AliESDs.root}. The detectors must store there
 the most relevant information which will be used in the analysis. 
-Together with the AliESDs.root file, another
-file is created with some reference tags of the simulated events,
-containing for example the number of events per run. This file is
+Together with the AliESDs.root file, another file is created with some reference tags of the simulated events, containing for example the number of events per run. This file is
 named \textbf{Run0.Event0\_1.ESD.tag.root} (1 means that only 1 event
 was simulated). 
 
-In order to do the analysis with the data contained in the ESDs, you
-only need the file \textbf{AliESDs.root} in your local directories or a grid collection. It is
-not necessary that in your working directory you keep other files
-like galice.root or EMCAL.{*}.root or any other. Anyway, we may want
-to access to the primary particles generated during the simulation,
-in that case we must have also the \textbf{galice.root} and \textbf{Kinematics.root}
-file.  Also, if you want to access to some information of the detector geometry, you need
-to keep the \textbf{geometry.root} file. 
+In order to do the analysis with the data contained in the ESDs, the only file needed is \textbf{AliESDs.root} in the local directories or a grid collection. No other files are needed in the working directory (such as galice.root nor EMCAL.{*}.root) unless one needs to access the primary particles generated during the simulation. In that case, the files \textbf{galice.root} and \textbf{Kinematics.root} are needed locally.  Also, if one want to access to some information of the detector geometry, the \textbf{geometry.root} file is needed.
 
-There are other data analysis container file created from the ESD, the
-AOD (Analysis Object Data) with smaller quantity of data for most of the subsystems but for the calorimeters, where we copy all the information\footnote{until half 2012 everything but the time of the cells was not stored}.
+There are other data analysis containers created from the ESD, the
+AOD (Analysis Object Data) with smaller quantity of data for most of the subsystems but for the calorimeters, where we copy all the information\footnote{until half 2012 everything but the time of the cells was stored}.
 
 
 \subsection{Calorimeter information in ESDs/AODs}
@@ -29,7 +20,7 @@ The basic calorimeter information needed for analysis is stored in the ESDs or A
 
 \subsubsection{AliVEvent (AliESDEvent, AliAODEvent)}
 
-Those are manager classes for the event information retrieval. Regarding the calorimeters they have the following access information (getter) methods (there are the equivalent setters just have a look to the header file of the class):
+Those are manager classes for the event information retrieval. Regarding the calorimeters they have the following access information (getters) methods\footnote{There are the equivalent setters just have a look to the header file of the class}:
 \begin{itemize}
 
 \item AliVCaloCluster *GetCaloCluster(Int\_t i) : Returns a CaloCluster listed in position "i" in the array of CaloClusters. It can be either PHOS or EMCal (PHOS list of clusters is before the EMCal list).
@@ -174,30 +165,36 @@ They   contain an array with  the amplitude or time of all the cells that fired
 
 \subsection{Macros}
 You can find example macros to run on ESDs or AODs in 
-
-\$ALICE\_ROOT/EMCAL/macros/TestESD.C or TestAOD.C
+\begin{lstlisting}
+$ALICE_ROOT/EMCAL/macros/TestESD.C or TestAOD.C
+\end{lstlisting}
 
  All the ESDs information is filled via the AliEMCALReconstructor/AliPHOSReconstructor class, in the method FillESD(). The AODs are created via the analysis class 
 
-\$ALICE\_ROOT/ANALYSIS/AliAnalysisTaskESDfilter.cxx,.h
+\begin{lstlisting}
+$ALICE_ROOT/ANALYSIS/AliAnalysisTaskESDfilter.cxx,.h
+\end{lstlisting}
 
-and as already mentioned, for the calorimeters it basically just copies all the information from ESD format to AOD format. In the lines below I will try to explain what is the information stored and how to retrieve it. The location of the classes that I am going to describe below is 
+and as already mentioned, for the calorimeters it basically just copies all the information from ESD format to AOD format. 
 
-\$ALICE\_ROOT/STEER
+Below is a description of what information is stored and how to retrieve it. The location of the corresponding classes is
+\begin{lstlisting}
+$ALICE_ROOT/STEER
+\end{lstlisting}
 
 
 
-\subsection{Example code}
+\subsection{Code example}
 
-The analysis is done using the data stored in the ESD. The macro\\
- \textbf{\$ALICE\_ROOT/EMCAL/macros/TestESD.C}\\
+The analysis is done using the data stored in the ESD. The macro
+\begin{lstlisting}
+$ALICE_ROOT/EMCAL/macros/TestESD.C
+\end{lstlisting}
 is an example of how to read the data for the calorimeters PHOS and
 EMCal (just replace where it says EMCAL by PHOS in the macro to obtain
-PHOS data). For these detectors we have to use the ESD class AliESDCaloCluster or AliESDCaloCells
-to retrieve all the calorimeters information. For the tracking detectors,
+PHOS data). For these detectors we have to use the ESD class AliESDCaloCluster or AliESDCaloCells to retrieve all the calorimeters information. For the tracking detectors,
 the class is called AliESDtrack, but the way to use it is very similar
-(see {}``\$ALICE\_ROOT/STEER/AliESDtrack.{*} '' and {}``\$ALICE\_ROOT/STEER/AliESDCaloCluster{*}
-'' for more details). In AliESDCaloCluster we keep the following
+(see ``\$ALICE\_ROOT/STEER/AliESDtrack.*''\\ and ``\$ALICE\_ROOT/STEER/AliESDCaloCluster*'' for more details). In AliESDCaloCluster we keep the following
 cluster information: energy, position, number of Digits that belong
 to the cluster, list of the cluster Digits indeces, shower dispersion, shower lateral axis and a few more parameters. In AliESDCaloCells we keep the following
 tower information: amplitude (GeV), time (seconds), absolute cell number.
@@ -206,8 +203,7 @@ The structure of the ESD testing macro (TestESD.C) is the
 following:
 
 \begin{itemize}
-\item Lines 0-29: This macro is prepared to be compiled so it has \texttt{{}``includes''}
-to all the Root and AliRoot classes used.
+\item Lines 0-29: This macro is prepared to be compiled so it has ``includes'' to all the Root and AliRoot classes used.
 
 \item Lines 30-36: This macro prints some information on screen, the kind of information is set here. We  print by default clusters information and optionally, the cells information, the matches information, the cells in the clusters information or the MonteCarlo original particle kinematics.
 
@@ -234,3 +230,124 @@ We get the different information from the CaloCluster.
 \subsubsection{AliEMCALRecoUtils}
 \subsubsection{Tender : AliEMCALTenderSupply}
 
+\subsubsection{Particle Identification with the EMCal}
+
+In the EMCal we have two different ways to obtain the PID of a given particle:
+\begin{enumerate}
+\item Shower shape of the cluster: Distinguish electrons/photons and $\pi^{0}$ from other particles. This is done without any track information in the class \texttt{AliEMCALPID}.
+\item Ratio between energy of the cluster and the momentum of a matched track: Distinguish electrons from other particles. This is done in the combined PID framework by the class \texttt{AliEMCalPIDResponse}.
+\end{enumerate}
+
+\paragraph{AliEMCALPID (AliEMCALPIDutils)}
+
+The idea for particle identification with EMCal clusters is that the shower shapes produced in the EMCal are different for different particle species. The long axis of the cluster ($\lambda_{0}$) is used for this purpose and parametrized for electrons/photons (should have the same electromagnetic shower), for $\pi^{0}$ (two photons merging in one cluster give a different shape than one photon), and hadrons (MIP signal).
+
+The main method in this class is \texttt{RunPID()}, which calls \texttt{AliEMCALPIDutils::ComputePID(Double\_t energy, Double\_t lambda0)} for each cluster with cluster energy \texttt{energy} and long axis of the cluster \texttt{lambda0} in the event. Inside this method first the \texttt{energy} dependent parametrizations for the three cases (photons, $\pi^{0}$, and hadrons) are retrieved. The parametrization is done here with a combination of a Gaussian and a Landau (at the moment there are two parameter sets available: low and high flux, which can be set by \texttt{AliEMCALPID::SetLowFluxParam()} and  \texttt{AliEMCALPID::SetHighFluxParam()}). Then a conditional probability is assigned to the cluster for each of these three species depending on \texttt{lambda0}. Finally a probability for a cluster being of a certain particle species is calculated with the Bayesian approach that can be retrieved by \texttt{AliVCluster::GetPID()}.\\
+\begin{DDbox}{\linewidth}
+\begin{lstlisting}
+  // compute PID weights
+  if( (fProbGamma + fProbPiZero + fProbHadron)>0.){
+    fPIDWeight[0] = fProbGamma / (fProbGamma + fProbPiZero + fProbHadron);    // gamma
+    fPIDWeight[1] = fProbPiZero / (fProbGamma+fProbPiZero+fProbHadron);          // pi0
+    fPIDWeight[2] = fProbHadron / (fProbGamma+fProbPiZero+fProbHadron);        // hadron
+  }
+...
+  //default particles
+  fPIDFinal[AliPID::kElectron]  = fPIDWeight[0]/2; // electron
+  fPIDFinal[AliPID::kMuon]      = fPIDWeight[2]/8;
+  fPIDFinal[AliPID::kPion]      = fPIDWeight[2]/8;
+  fPIDFinal[AliPID::kKaon]      = fPIDWeight[2]/8;
+  fPIDFinal[AliPID::kProton]    = fPIDWeight[2]/8;
+  //light nuclei
+  fPIDFinal[AliPID::kDeuteron]  = 0;
+  fPIDFinal[AliPID::kTriton]    = 0;
+  fPIDFinal[AliPID::kHe3]       = 0;
+  fPIDFinal[AliPID::kAlpha]     = 0;
+  //neutral particles
+  fPIDFinal[AliPID::kPhoton]    = fPIDWeight[0]/2; // photon
+  fPIDFinal[AliPID::kPi0]       = fPIDWeight[1]  ; // pi0
+  fPIDFinal[AliPID::kNeutron]   = fPIDWeight[2]/8;
+  fPIDFinal[AliPID::kKaon0]     = fPIDWeight[2]/8;
+  fPIDFinal[AliPID::kEleCon]    = fPIDWeight[2]/8;
+  //
+  fPIDFinal[AliPID::kUnknown]   = fPIDWeight[2]/8;
+\end{lstlisting}
+\end{DDbox}
+
+
+
+
+
+\paragraph{AliEMCalPIDResponse}
+
+The idea for particle identification with EMCal clusters AND the track information is that electrons are loosing their total energy in an electromagnetic shower inside the EMCal whereas all other charged particles only part of it. The main observable is $E/p$ with the energy of the EMCal cluster ($E$) and the momentum of a matched track ($p$). This ratio is $E/p\sim1$ for electrons and $E/p< 1$ for other charged particles. 
+
+The decision about a particle species is done within the PID framework provided by ALICE. The main classes are: \texttt{STEER/STEERBase/AliPIDCombined} and \texttt{STEER/STEERBase/AliPIDResponse}. There are two methods of usage:
+\begin{enumerate}
+\item $n\sigma$ method: For each detector the multiples of $\sigma$ values are given for the deviation from the expected mean value at a given $p_{\mathrm{T}}$ (assuming a Gaussian distribution). This can be done via: \texttt{AliPIDResponse::GetNumberOfSigmas(EDetector detCode, const AliVParticle *track, AliPID::EParticleType type)}
+\item Bayesian approach: In \texttt{AliPIDCombined::ComputeProbabilities(const AliVTrack *track, const AliPIDResponse *response, Double\_t* bayesProbabilities)} for each detector (included in the analysis via\\ \texttt{AliPIDCombined::SetDetectorMask(AliPIDResponse::EDetector)}) the conditional probability for the respective detector observable is calculated for each particle species (selected via\\ \texttt{AliPIDCombined::SetSelectedSpecies(AliPID::EParticleType)}). Then the probability for a track being of a certain particle type is calculated with the Bayesian approach. The initial particle abundances (priors) can be activated via\\ \texttt{AliPIDCombined::SetEnablePriors(kTRUE)} and either own priors can be loaded\\ (\texttt{AliPIDCombined::SetPriorDistribution(AliPID::EParticleType type,TH1F *prior)}) or default ones can be chosen (\texttt{AliPIDCombined::SetDefaultTPCPriors()}).
+\end{enumerate}
+
+For the case of the EMCal the $n\sigma$ as well as the conditional probability are calculated in\\ \texttt{AliEMCALPIDResponse::GetNumberOfSigmas( Float\_t pt,  Float\_t eop, AliPID::EParticleType n,  Int\_t charge)} and\\
+\texttt{AliEMCALPIDResponse::ComputeEMCALProbability(Int\_t nSpecies, Float\_t pt, Float\_t eop, Int\_t charge, Double\_t *pEMCAL)}, respectively. These methods are called from \texttt{AliPIDCombined} and \texttt{AliPIDResponse} internally, so usually the user does not use them. 
+
+To calculate $n\sigma$ and the conditional probability a parametrization of $E/p$ for the different particle species at different momenta is needed. This was retrieved from data in a clean PID sample with the help of $V0$ decays for electrons, pions and protons ($\gamma\rightarrow e^+e^-$, $K^0\rightarrow \pi^+\pi^-$, and $\Lambda\rightarrow p+\pi^-/\bar{p}+\pi^+$ ) for different periods. Electrons are parametrized with a Gaussian distribution (mean value and $\sigma$), all other particles are parametrized with a Gaussian for $0.5 < E/p < 1.5$ and the probabilty to have a value in this $E/p$ interval (this is small, since the maximum of the distribution lies around $0.1$). Here we distinguish between protons, antiprotons (higher probabilty for higher $E/p$ values due to annihilation) and other particles (pions are used for these). At the moment this parametrization is not done for all periods so far, as default LHC11d is taken. There might be especially some centrality dependence on the $E/p$ parametrization (because of the different multiplicities of track--cluster matches).
+
+In addition to that the purity of the electron identification can be enhanced by using shower shape cuts in addition. At the moment this can be done by getting them together with $n\sigma$:\\
+\texttt{AliEMCALPIDResponse::NumberOfSigmasEMCAL(const AliVParticle *track,\\ 
+AliPID::EParticleType type, Double\_t \&eop, Double\_t showershape[4])} In future, a full treatmeant inside the PID framework is planned (by combining with \texttt{AliEMCALPID}).
+
+Some more information can be found on following TWiki pages:
+\begin{itemize}
+\item \href{https://twiki.cern.ch/twiki/bin/view/ALICE/AlicePIDTaskForce}{https://twiki.cern.ch/twiki/bin/view/ALICE/AlicePIDTaskForce}
+\item
+\href{https://twiki.cern.ch/twiki/bin/view/ALICE/PIDInAnalysis}{https://twiki.cern.ch/twiki/bin/view/ALICE/PIDInAnalysis}
+\item \href{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/EMCalPIDResponse}{https://twiki.cern.ch/twiki/bin/viewauth/ALICE/EMCalPIDResponse}
+\end{itemize}
+
+Here follows an example how to include the EMCal PID in an analysis task:
+
+\begin{DDbox}{\linewidth}
+\begin{lstlisting}
+   // in analysis header: 
+
+   AliPIDCombined fPIDCombined;                                                        
+   AliPIDResponse fPIDResponse;   
+
+
+   // in Constructor: 
+
+   fPIDCombined(0),                                                       
+   fPIDResponse(0), 
+
+
+   // in UserCreateOutputObjects 
+
+   // Set up combined PID
+   AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+   AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+   fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
+
+   fPIDCombined = new AliPIDCombined;
+   fPIDCombined->SetSelectedSpecies(AliPID::kSPECIES);
+   fPIDCombined->SetDetectorMask(AliPIDResponse::kDetEMCAL);
+   fPIDCombined->SetEnablePriors(kFALSE);
+
+
+   // in UserExec: 
+
+   Double_t pEMCAL[AliPID::kSPECIES];
+   Double_t pBAYES[AliPID::kSPECIES];
+   Double_t eop;
+   Double_t ss[4];        //shower shape parameters (number of cells, M02, M20, Dispersion)
+
+   // NSigma value for electrons
+   nSigma = fPIDResponse->NumberOfSigmas(kEMCAL,track,AliPID::kElectron);
+   // or with getting also the E/p and shower shape values
+   nSigma = fPIDResponse->NumberOfSigmasEMCAL(track,AliPID::kElectron,eop,ss);
+
+   // Bayes probability
+   fPIDCombined->ComputeProbabilities(track, fPIDResponse, pBAYES);  
+\end{lstlisting}
+\end{DDbox}
+