]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/doc/simulation.tex
Time scale fix for EMCAL fitters
[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 \input{StepManagerParticleTransport}
26 \clearpage
27
28
29 \subsection{Digitization: SDigits and Digits - Evi \label{sec:digi}}
30
31 We want to generate events which look like the real data collected
32 by the experiment. In the end, we want to have an amplitude in ADC
33 counts and a time (when particle traverse a cell) per each cell (tower)
34 of the calorimeter. In the code for calorimeters, it is done in the
35 following steps: 
36 \begin{enumerate}
37 \item \textbf{SDigit} objects are created, they consist
38 of the sum of deposited energy by all Hits in a cell (a particle can
39 create Hits in different cells but only one in a single cell), so
40 there is only one SDigit per fired cell.
41 \item \textbf{Digit} objects are created, they are like the SDigits but the energy in the cell
42 is transformed into the ADC amplitude units, the electronic noise
43 is added and Digits whose energy does not pass an energy threshold
44 (3 ADC counts) are eliminated. SDigits and Digits are stored in the files
45 \textbf{EMCAL.SDigits.root} and \textbf{EMCAL.Digits.root}, respectively.
46 \end{enumerate}
47
48 \subsection{Raw data - David \label{sec:simu_raw}}
49
50 The experiment does not record Digits directly, but instead a series of so-called
51 time samples with 10-bit ADC counts per channel. Each time bin is 100 ns
52 wide, corresponding to a 10 MHz readout.
53 These samples are referred to as
54 \textbf{Raw Data}. The samples follow a certain signal shape, more complicated than
55 a Gaussian distribution, which is fitted offline. 
56 The simulated signal (Gamma-2) shape is described in the AliEMCALRawResponse class,
57 in the RawResponseFunction method.
58 With real data, which is zero-suppressed, i.e. has the pedestal subtracted online, the
59 Digits amplitude is just the maximum of the distribution obtained
60 with the fit to the sample. The Digit time (defined by the time the
61 particle hits the active volume of the detector) is the time value at
62 the maximum signal fit. There are methods to go from Digits to
63 Raw and vice versa in the AliEMCALRawUtils class: Raw2Digits and Digits2Raw,
64 respectively. For the reconstruction step Digits are needed. The
65 generation of Raw Data is optional during simulations and the generated 
66 data can be reconstructed directly from Digits, but Raw data is the initial
67 step when reconstructing real data.
68
69
70 \subsection{How to make a simulation\label{sec:simu_steps}}
71
72 TestEMCALSimulation.C is a very simple macro where we specify all the simulation parameters
73 and proccess the simulation. Below is a similar but a bit more elaborated macro:
74
75
76
77 \begin{DDbox}{\linewidth}
78 \begin{lstlisting}
79 void TestEMCALSimulation() {
80
81 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. 
82 // Option detector=``ALL''  makes all detectors. 
83
84 AliSimulation sim ; //Create simulation object 
85
86 // Generation and simulation 
87
88 sim.SetRunGeneration(kTRUE) ; //Default value is kTRUE, make generation  
89 // For some reason we may want to redo the Digitization, without redoing the generation, in this case it must set to kFALSE 
90
91 // Making SDigits 
92 sim.SetMakeSDigits(detector) ; //We want to make SDigits
93 // set no detectors if SDigits are already made
94
95 // Making Digits 
96 sim.SetMakeDigits(detector) ; //We want to make Digits 
97 // set no detectors if SDigits are already made
98
99 //Merging 
100 //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. 
101
102 //Write Raw Data, make Raw data from digits 
103 //sim.SetWriteRawData(detector) ;
104 //sim.SetConfigFile(``somewhere/ConfigXXX.C'');//Default is Config.C
105
106 //Make the simulation 
107 sim.Run(3) ; // Run the simulation and make 3 events 
108
109
110
111 \end{lstlisting}
112 \end{DDbox}