]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/doc/simulation.tex
dsilverm doc additions - mainly regarding raw data
[u/mrichter/AliRoot.git] / EMCAL / doc / simulation.tex
1 \section{Simulation code}
2
3 The class AliSimulation manages this part. An example is here : ``\$ALICE\_ROOT/EMCAL/
4 macros/TestEMCALSimulation.C''. The simulation
5 consists of different steps: geometry and event definition, particle
6 generation, transport of the particle in the material (GEANT) and
7 finally digitization. Note that the final output from the digitization
8 process is different from the processing of real experimental Raw Data. The process
9 of converting the digitized data to Raw Data is discussed in Sec.~\ref{sec:digi}.
10 Sec.~\ref{sec:simu_steps} gives the recipe to do all the steps of the simulation.
11
12
13 \subsection{Event generation and particle transport: Hits}
14
15
16 Once the generator is executed, the generated particles are transported
17 in the detector material with the Monte Carlo code, GEANT3 by default. Other options are 
18 GEANT4 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}
19 are created. They contain the energy deposited in the sensitive material
20 of the detector by the generated particle, their position, impact
21 time (after collision) and the identity of the original particle.
22 Hits are stored in a file called \textbf{DETECTOR.Hits.root}, in the
23 calorimeter case: \textbf{EMCAL.Hits.root.}
24
25
26 \subsection{Digitization: SDigits and Digits - Evi \label{sec:digi}}
27
28 We want to generate events which look like the real data collected
29 by the experiment. In the end, we want to have an amplitude in ADC
30 counts and a time (when particle traverse a cell) per each cell (tower)
31 of the calorimeter. In the code for calorimeters, it is done in the
32 following steps: 
33 \begin{enumerate}
34 \item \textbf{SDigit} objects are created, they consist
35 of the sum of deposited energy by all Hits in a cell (a particle can
36 create Hits in different cells but only one in a single cell), so
37 there 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
39 is transformed into the ADC amplitude units, the electronic noise
40 is 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.
43 \end{enumerate}
44
45 \subsection{Raw data - David \label{sec:simu_raw}}
46
47 The experiment does not record Digits directly, but instead a series of so-called
48 time samples with 10-bit ADC counts per channel. Each time bin is 100 ns
49 wide, corresponding to a 10 MHz readout.
50 These samples are referred to as
51 \textbf{Raw Data}. The samples follow a certain signal shape, more complicated than
52 a Gaussian distribution, which is fitted offline. 
53 The simulated signal (Gamma-2) shape is described in the AliEMCALRawResponse class,
54 in the RawResponseFunction method.
55 With real data, which is zero-suppressed, i.e. has the pedestal subtracted online, the
56 Digits amplitude is just the maximum of the distribution obtained
57 with the fit to the sample. The Digit time (defined by the time the
58 particle hits the active volume of the detector) is the time value at
59 the maximum signal fit. There are methods to go from Digits to
60 Raw and vice versa in the AliEMCALRawUtils class: Raw2Digits and Digits2Raw,
61 respectively. For the reconstruction step Digits are needed. The
62 generation of Raw Data is optional during simulations and the generated 
63 data can be reconstructed directly from Digits, but Raw data is the initial
64 step when reconstructing real data.
65
66
67 \subsection{How to make a simulation\label{sec:simu_steps}}
68
69 TestEMCALSimulation.C is a very simple macro where we specify all the simulation parameters
70 and proccess the simulation. Below is a similar but a bit more elaborated macro:
71
72
73
74 \begin{DDbox}{\linewidth}
75 \begin{lstlisting}
76 void TestEMCALSimulation() {
77
78 TString 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. 
80
81 AliSimulation sim ; //Create simulation object 
82
83 // Generation and simulation 
84
85 sim.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 
87
88 // Making SDigits 
89 sim.SetMakeSDigits(detector) ; //We want to make SDigits
90 // set no detectors if SDigits are already made
91
92 // Making Digits 
93 sim.SetMakeDigits(detector) ; //We want to make Digits 
94 // set no detectors if SDigits are already made
95
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. 
98
99 //Write Raw Data, make Raw data from digits 
100 //sim.SetWriteRawData(detector) ;
101 //sim.SetConfigFile(``somewhere/ConfigXXX.C'');//Default is Config.C
102
103 //Make the simulation 
104 sim.Run(3) ; // Run the simulation and make 3 events 
105
106
107
108 \end{lstlisting}
109 \end{DDbox}