TPC PID update:
[u/mrichter/AliRoot.git] / EMCAL / doc / simulation.tex
CommitLineData
02582a78 1\section{Simulation code}
2
3The class AliSimulation manages this part.
4Have a look to the macro ``\$ALICE\_ROOT/EMCAL/
5macros/TestEMCALSimulation.C''. The simulation
6consists of different steps: geometry and event definition, particle
7generation, transport of the particle in the material (GEANT) and
8finally digitization. Note that the final output from the digitization
9process is not the same as the experimental Raw Data. The process
10of converting the digitized data to Raw Data is discussed in Sec.~1.4.
11In Sec.~1.5, I give the recipe to do all the steps.
12
13
14\subsection{Event Generation and particle transport: Hits}
15
16
17Once the generator is executed, the generated particles are transported
18in the detector material with the Monte Carlo code, GEANT3 by default. Other options are
19GEANT4 or FLUKA (some license problems with FLUKA right now so not in use?).
20All the generated particles are kept in a file called \textbf{Kinematics.root}.
21After the particle transport is executed, the objects \textbf{Hits}
22are created. They contain the energy deposited in the sensitive material
23of the detector by the generated particle, their position, impact
24time (after collision) and the identity of the original particle.
25Hits are stored in a file called \textbf{DETECTOR.Hits.root}, in the
26calorimeter case: \textbf{EMCAL.Hits.root.}
27
28
29\subsection{Digitization: SDigits and Digits - Evi}
30
31We want to generate events which look like the real data collected
32by the experiment. In the end, we want to have an amplitude in ADC
33counts and a time (when particle traverse a cell) per each cell (tower)
34of the calorimeter. In the code for calorimeters, it is done in the
35following steps: 1st) \textbf{SDigit} objects are created, they consist
36of the sum of deposited energy by all Hits in a cell (a particle can
37create Hits in different cells but only one in a single cell), so
38there is only one SDigit per fired cell; 2nd) \textbf{Digit} objects
39are created, they are like the SDigits but the energy in the cell
40is transformed into the ADC amplitude units, the electronic noise
41is added and Digits whose energy does not pass an energy threshold
42(3 ADC counts) are eliminated. SDigits and Digits are stored in the files
43\textbf{EMCAL.SDigits.root} and \textbf{EMCAL.Digits.root}, respectively.
44
45\subsection{Raw data - David}
46
47What we will get directly from the experiment are not Digits but a
48time samples of ADC counts per each cell. These samples are called
49\textbf{Raw Data}. The samples have a shape, more complicated than
50a Gaussian distribution, which is fitted offline. With real data,
51Digits amplitude is just the maximum of the distribution obtained
52with the fit to the sample. The Digit time (defined by a time the
53particle hit the active volume of the detector) is the time bin when
54the signal begins to rise. There is a method to pass from Digits to
55Raw and vice versa in the class AliEMCALRawUtils: Raw2Digits and Digits2Raw,
56respectively. For the reconstruction step we need the Digits. The
57generation of Raw Data is optional during simulations, we can reconstruct
58data generating directly Digits, but Raw data will be the initial
59step when reconstructing real data.
60
61
62\subsection{How to make a simulation}
63
64TestEMCALSimulation.C is a very simple macro where we specify all the simulation parameters
65and execute the simulation, here I put a similar but a bit more elaborated macro:
66
67\begin{singlespace}
68\texttt{void TestEMCALSimulation() \{ }
69
70\texttt{TString detector=\char`\"{}EMCAL TPC\char`\"{}; // Define
71in this variable the detectors }
72
73\texttt{//that you want to be included in the simulation for the digitization. }
74
75\texttt{//They can be less detectors than the detectors defined in
76the Config.C }
77
78\texttt{//file, imagine that you want all the detectors in front of
79EMCal present}
80
81\texttt{//to consider the conversion of particles but you are not
82really }
83
84\texttt{//interested in the output from these detectors. Option detector=\char`\"{}ALL\char`\"{} }
85
86\texttt{//makes all detectors. }
87
88\texttt{AliSimulation sim ; //Create simulation object }
89
90\texttt{// Generation and simulation }
91
92\texttt{sim.SetRunGeneration(kTRUE) ; //Default value is kTRUE, make
93generation }
94
95\texttt{//For some reason we may want to redo the Digitization, without
96redoing }
97
98\texttt{//the generation, in this case it must set to kFALSE }
99
100\texttt{// Making SDigits }
101
102\texttt{sim.SetMakeSDigits(detector) ; //We want to make SDigits}
103
104\texttt{// set no detectors if SDigits are already made}
105
106\texttt{// Making Digits }
107
108\texttt{sim.SetMakeDigits(detector) ; //We want to make Digits }
109
110\texttt{// set no detectors if SDigits are already made}
111
112\texttt{//Merging }
113
114\texttt{//sim.MergeWith(\char`\"{}bgrd/galice.root\char`\"{}) ; //If
115we want to merge a signal }
116
117\texttt{//and a background, the merging is done at the SDigit level. The }
118
119\texttt{//background must be located in the repertory defined in the
120method. }
121
122\texttt{//Write Raw Data, make Raw data from digits }
123
124\texttt{//sim.SetWriteRawData(detector) ;}
125
126\texttt{//sim.SetConfigFile(\char`\"{}somewhere/ConfigXXX.C\char`\"{});//Default
127is Config.C}
128
129\texttt{//Make the simulation }
130
131\texttt{sim.Run(3) ; // Run the simulation and make 3 events }
132
133\texttt{\} }
134\end{singlespace}