CommitLineData
02582a78 1\section{Simulation code}
2
017e0494 3The class AliSimulation manages this part. An example is here : \\$ALICE\_ROOT/EMCAL/
02582a78 4macros/TestEMCALSimulation.C''. The simulation
5consists of different steps: geometry and event definition, particle
6generation, transport of the particle in the material (GEANT) and
7finally digitization. Note that the final output from the digitization
017e0494 8process is different from the processing of real experimental Raw Data. The process
9of converting the digitized data to Raw Data is discussed in Sec.~\ref{sec:digi}.
10Sec.~\ref{sec:simu_steps} gives the recipe to do all the steps of the simulation.
02582a78 11
12
017e0494 13\subsection{Event generation and particle transport: Hits}
02582a78 14
15
16Once the generator is executed, the generated particles are transported
17in the detector material with the Monte Carlo code, GEANT3 by default. Other options are
017e0494 18GEANT4 or FLUKA\footnote{There may be some license problems with FLUKA right now which could explain why it cannot be used at the moment}. All the generated particles are kept in a file called \textbf{Kinematics.root}. After the particle transport is executed, the objects \textbf{Hits}
02582a78 19are created. They contain the energy deposited in the sensitive material
20of the detector by the generated particle, their position, impact
21time (after collision) and the identity of the original particle.
22Hits are stored in a file called \textbf{DETECTOR.Hits.root}, in the
23calorimeter case: \textbf{EMCAL.Hits.root.}
24
25
017e0494 26\subsection{Digitization: SDigits and Digits - Evi \label{sec:digi}}
02582a78 27
28We want to generate events which look like the real data collected
29by the experiment. In the end, we want to have an amplitude in ADC
30counts and a time (when particle traverse a cell) per each cell (tower)
31of the calorimeter. In the code for calorimeters, it is done in the
017e0494 32following steps:
33\begin{enumerate}
34\item \textbf{SDigit} objects are created, they consist
02582a78 35of the sum of deposited energy by all Hits in a cell (a particle can
36create Hits in different cells but only one in a single cell), so
017e0494 37there is only one SDigit per fired cell.
38\item \textbf{Digit} objects are created, they are like the SDigits but the energy in the cell
02582a78 39is transformed into the ADC amplitude units, the electronic noise
40is added and Digits whose energy does not pass an energy threshold
41(3 ADC counts) are eliminated. SDigits and Digits are stored in the files
42\textbf{EMCAL.SDigits.root} and \textbf{EMCAL.Digits.root}, respectively.
017e0494 43\end{enumerate}
02582a78 44
43ac0b81 45\subsection{Raw data - David \label{sec:simu_raw}}
46
47The experiment does not record Digits directly, but instead a series of so-called
48time samples with 10-bit ADC counts per channel. Each time bin is 100 ns
49wide, corresponding to a 10 MHz readout.
50These samples are referred to as
51\textbf{Raw Data}. The samples follow a certain signal shape, more complicated than
52a Gaussian distribution, which is fitted offline.
53The simulated signal (Gamma-2) shape is described in the AliEMCALRawResponse class,
54in the RawResponseFunction method.
55With real data, which is zero-suppressed, i.e. has the pedestal subtracted online, the
02582a78 56Digits amplitude is just the maximum of the distribution obtained
017e0494 57with the fit to the sample. The Digit time (defined by the time the
43ac0b81 58particle hits the active volume of the detector) is the time value at
59the maximum signal fit. There are methods to go from Digits to
60Raw and vice versa in the AliEMCALRawUtils class: Raw2Digits and Digits2Raw,
017e0494 61respectively. For the reconstruction step Digits are needed. The
43ac0b81 62generation of Raw Data is optional during simulations and the generated
63data can be reconstructed directly from Digits, but Raw data is the initial
02582a78 64step when reconstructing real data.
65
66
017e0494 67\subsection{How to make a simulation\label{sec:simu_steps}}
02582a78 68
69TestEMCALSimulation.C is a very simple macro where we specify all the simulation parameters
017e0494 70and proccess the simulation. Below is a similar but a bit more elaborated macro:
02582a78 71
02582a78 72
02582a78 73
017e0494 74\begin{DDbox}{\linewidth}
75\begin{lstlisting}
76void TestEMCALSimulation() {
02582a78 77
017e0494 78TString detector=EMCAL TPC''; // Define in this variable the detectors that you want to be included in the simulation for the digitization. They can be less detectors than the detectors defined in the Config.C file, imagine that you want all the detectors in front of EMCal present to consider the conversion of particles but you are not really interested in the output from these detectors.
79// Option detector=ALL'' makes all detectors.
02582a78 80
017e0494 81AliSimulation sim ; //Create simulation object
02582a78 82
017e0494 83// Generation and simulation
02582a78 84
017e0494 85sim.SetRunGeneration(kTRUE) ; //Default value is kTRUE, make generation
86// For some reason we may want to redo the Digitization, without redoing the generation, in this case it must set to kFALSE
02582a78 87
017e0494 88// Making SDigits
89sim.SetMakeSDigits(detector) ; //We want to make SDigits
02582a78 91
017e0494 92// Making Digits
93sim.SetMakeDigits(detector) ; //We want to make Digits
02582a78 95
017e0494 96//Merging
97//sim.MergeWith(bgrd/galice.root'') ; //If we want to merge a signal and a background, the merging is done at the SDigit level. The background must be located in the repertory defined in the method.
02582a78 98
017e0494 99//Write Raw Data, make Raw data from digits
100//sim.SetWriteRawData(detector) ;
101//sim.SetConfigFile(somewhere/ConfigXXX.C'');//Default is Config.C
02582a78 102
017e0494 103//Make the simulation
104sim.Run(3) ; // Run the simulation and make 3 events
02582a78 105
02582a78 106
02582a78 107
017e0494 108\end{lstlisting}
109\end{DDbox}