]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/doc/geometry.tex
c++11 fix
[u/mrichter/AliRoot.git] / EMCAL / doc / geometry.tex
1 \section{EMCAL geometry software}
2 (Marco Bregant, Alexandre Shabetai, Gustavo Conesa Balbastre)\\
3
4 This page is intended for a description of the EMCAL geometry and the methods to access it.  
5 {\it This is a very preliminary version that needs work.}
6
7  \subsection {Classes description}
8
9 The EMCAL geometry is implemented in several classes : {\color{red} (right now very brief description, it should be completed) }
10 \begin{itemize}
11 \item AliEMCALGeometry: Steering geometry class.  No dependencies on STEER or EMCAL non geometry classes. Can be called during the analysis without loading all AliRoot classes.
12 \item AliEMCALEMCGeometry: Does the geometry initialization. Does all the definitions of the geometry (towers composition, size, Super Modules number ...)
13 \item AliEMCALGeoParams:  Class container of some of the geometry parameters so that it can be accessed everywhere in the EMCAL code, to avoid "magic numbers". Its use has to be propagated to all the code.
14 \item AliEMCALShishKebabTrd1Module: Here the modules are defined and the position of the modules in the local super module reference system is calculated
15 \end{itemize}
16
17 \subsection{Accessing the geometry}
18 One can get the geometry pointer in the following way:
19
20 %\begin{DDbox}{\linewidth}
21 \begin{lstlisting}
22 AliEMCALGeometry * geom =  AliEMCALGeometry::GetInstance(GeoName) ;
23 \end{lstlisting}
24 %\end{DDbox}
25
26 where "GeoName" is a string, the different options are specified in the next section. If you have a already generated simulation file and want to access the geometry used there, if the file {\it galice.root} is available:
27
28 \begin{DDbox}{\linewidth}
29 \begin{lstlisting}
30 AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read"); 
31 rl->LoadgAlice();//Needed to get geometry
32 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
33 AliRun * alirun = rl->GetAliRun();
34 AliEMCAL * emcal = (AliEMCAL*)alirun->GetDetector("EMCAL"); AliEMCALGeometry * geom = emcal->GetGeometry();
35 \end{lstlisting}
36 \end{DDbox}
37
38 In this case you might need the file {\it geometry.root} if you want to access to certain methods that require local to global position transformations. This file can be generated doing a simple simulation, it just contains the transformation matrix to go from global to local.
39
40 The way to load this file is:
41 %\begin{DDbox}{\linewidth}
42 \begin{lstlisting}
43 TGeoManager::Import("geometry.root");
44 \end{lstlisting}
45 %\end{DDbox}
46
47 The transformation matrices are also stored in the ESDs so if you do not load this file, you can have to load these matrices from the ESDs. They are also stored in the OADB.
48
49  If you want to see different parameters used in the geometry printed (cells centers, distance to IP, etc), one just has to execute the method {\it PrintGeometry()}.
50  
51 \subsection{Geometry configuration options}
52 Right now the following geometry options are implemented:
53 \begin{itemize}
54 \item EMCAL\_FIRSTYEARV1: 4 Super Modules, geometry  configuration for year 2010.
55 \item EMCAL\_COMPLETEV1: 10 Super Modules, geometry configuration for year 2011.
56 \item EMCAL\_COMPLETE12SMV1: 12 Super Modules (10+2$\times$1/3) full EMCal. Configuration for year 2012, although the 1/3 super-modules where not active.
57 \item EMCAL\_COMPLETE12SMV1\_DCAL: Full EMCal plus 6 DCal super-modules.
58 \item EMCAL\_COMPLETE12SMV1\_DCAL\_8SM: Full EMCal plus 6 DCal super-modules plus 2$\times$1/3 EMCal, geometry configuration for Run2 (years 2015-18).
59 \item EMCAL\_COMPLETE12SMV1\_DCAL\_DEV: Full EMCal plus  10 DCal super-modules (possible future configuration).
60 \end{itemize}
61
62 Other options exists but need to be removed as they {\bf should not be used} or that should be avoided:
63 \begin{itemize}
64 \item EMCAL\_PDC06: Old geometry, for reading old data (which do not exist anymore).
65 \item EMCAL\_WSU: Prototype geometry. 
66 \item EMCAL\_COMPLETE: 12 Super Modules (2 half Super Modules). Not correct geometry, use "V1" in name
67 \item EMCAL\_FIRSTYEAR: 4 Super Modules (year 2010). Not correct geometry, use "V1" in name.
68 \end{itemize}
69
70 By default, the geometry is loaded with the EMCAL\_COMPLETE12SMV1 configuration. For details on the implementation of the DCal geometry have a look here~\cite{DCalGeoOff}
71  
72  \subsection{Setting the geometry in simulations}
73
74 When configuring a simulation, a typical file {\it Config.C} is used. Inside this file, the detectors to be used in the generation are specified, and particularly EMCal is initialized in this way:
75
76 \begin{lstlisting}
77 AliEMCAL *EMCAL =  = new AliEMCALv2("EMCAL", TString GeoName, Bool_t checkGeoRun);
78 \end{lstlisting}
79
80 Where:
81 \begin{itemize}
82   \item {\it AliEMCAL} is the main steering class for the simulation. The derived classes {\t AliEMCALvX}:
83     \begin{itemize}
84     \item {\it AliEMCALv0} does the geometry initialization, materials creation etc.
85     \item {\it AliEMCALv1} derives from {\it v0}, DO NOT USE for simulation, originally it was meant for fast simulations, it does not generate hits.
86     \item {\it AliEMCALv2} derives from {\it v1}, USE for simulation. It does all the particle propagation in the EMCal material
87 \end{itemize}
88   \item {\it TString GeoName}: Geometry names listed in the previous section
89   \item {\it Bool\_t checkGeoRun}: Bool that activates the geometry initialization depending on the run number. Since EMCal geometry changed over time, to avoid mistakes in the configuration files of simulations anchored to particular run numbers,  by default this is set to TRUE and the name set in the initialization of AliEMCAL is not taken into account but the one corresponding to this run.
90 \end{itemize}
91
92  
93  \subsection{Mapping}
94 The tower row/column mapping online and offline follows the alice numbering convention. Figures~\ref{fig:Map1} to \ref{fig:Map2} display the position of the super modules from different points of view and the position of the tower index in them.
95
96 \begin{figure}[ht]
97 \begin{center}
98 \includegraphics[width=1.0\textwidth]{figures/EMCALMap0_0.pdf}
99 \end{center}
100 \caption{\label{fig:Map1}Position of the super modules}
101 \end{figure}
102
103 \begin{figure}[ht]
104 \begin{center}
105 \includegraphics[width=1.0\textwidth]{figures/EMCALMap1.pdf}
106 \end{center}
107 \caption{\label{fig:Map0}EMCal seen from the magnet side with 4 SMs.}
108 \end{figure}
109
110
111 \begin{figure}[ht]
112 \begin{center}
113 \includegraphics[width=1.0\textwidth]{figures/EMCALMap2.pdf}
114 \end{center}
115 \caption{\label{fig:Map2}EMCal geometrical numbering.}
116 \end{figure}
117
118
119 \subsection{Tower index transformation methods}
120 \subsubsection{Absolute tower ID to Row/Column index}
121
122 Each EMCAL supermodule is composed of 24x48 towers (phi,eta), grouped in 4x4 modules. Each tower (even each module) has a unique number assigned, called in the code "absolute ID" number (absId). This number can be transformed into a row (phi direction) or column (eta direction) index. The procedure to go from the absId to the (row, col) formulation or viceversa is as follow:
123
124 \begin{itemize}
125 \item From absId to col-row: 
126
127 \begin{DDbox}{\linewidth}
128 \begin{lstlisting}
129 Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
130 //Check if this absId exists
131 if(!CheckAbsCellId(absId)) return kFALSE;
132 // Get from the absId the super module number, the module number and the eta-phi index (0 or 1) in the module
133 GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
134 // Get from the  the super module number, the module number and the eta-phi index (0 or 1) in the module the tower row (iphi) and column (ieta) 
135 GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta); 
136 \end{lstlisting}
137 \end{DDbox}
138
139 \item From col-row to absId, following the same notation as above: 
140
141 \begin{DDbox}{\linewidth}
142 \begin{lstlisting}
143
144 absid = GetAbsCellIdFromCellIndexes(nSupMode, iphi, ieta);
145 \end{lstlisting}
146 \end{DDbox}
147
148 or
149
150 \begin{DDbox}{\linewidth}
151 \begin{lstlisting}
152
153 absid = GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
154 \end{lstlisting}
155 \end{DDbox}
156
157 \item Other interesting method is
158
159 \begin{DDbox}{\linewidth}
160 \begin{lstlisting}
161
162 Int_t   GetSuperModuleNumber(Int_t absId)  
163 \end{lstlisting}
164 \end{DDbox}
165 \end{itemize}
166
167 \subsection{Tower index to local / global reference system position}
168 \subsubsection{Local coordinates}
169
170 To correlate the tower index and its position in local coordinates, the following methods are available:
171
172 \begin{DDbox}{\linewidth}
173 \begin{lstlisting}
174   Bool_t  AliEMCALGeoUtils::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const;
175
176   Bool_t  AliEMCALGeoUtils::RelPosCellInSModule(Int_t absId, Double_t loc[3]) const;
177
178   Bool_t  AliEMCALGeoUtils::RelPosCellInSModule(Int_t absId, TVector3 &vloc) const;
179 \end{lstlisting}
180 \end{DDbox}
181
182 To which the input is the absId and the output are the coordinates of the center of towers in the local coordinates of the Super Module. This method gets the column and row index of the cell from the absId, independently of the Super Module (like above), and gets the center of the cell from 3 arrays (x,y,z) filled with such quantities. Such central positions are calculated during the initialization of the geometry, where the arrys are filled, in the method :
183
184 \begin{DDbox}{\linewidth}
185 \begin{lstlisting}
186
187   AliEMCALGeoUtils::CreateListOfTrd1Modules()
188 \end{lstlisting}
189 \end{DDbox}
190
191 {\color{red}<<<<<Someone else should explain how it works>>>>>}
192
193  
194
195 In case we calculate the cluster position, things are a bit different.
196
197  
198
199 {\color{red}<<<<< This explanation should go to the clusterization section>>>>}
200
201  
202
203 This is done in 
204
205 \begin{DDbox}{\linewidth}
206 \begin{lstlisting}
207 void AliEMCALRecPoint::EvalLocalPosition()
208 \end{lstlisting}
209 \end{DDbox}
210
211 First we calculate the cell position with the  method 
212
213 \begin{DDbox}{\linewidth}
214 \begin{lstlisting}
215 AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Int_t maxAbsId, Double_t tmax, Double_t &xr, Double_t &yr, Double_t &zr)
216 \end{lstlisting}
217 \end{DDbox}
218
219 The calculation of the cell position done here is different in the "x-z" but the same in "y". 
220
221  
222
223 {\color{red}<<<<< <<<<<Someone else should explain how it works>>>>>}
224
225  
226  
227
228 In this particular case the position calculation per tower depends on the position of the maximum cell, and the sum of the energy of the cells of the cluster. The maximum depth (tmax) is calculated with the method
229
230 \begin{DDbox}{\linewidth}
231 \begin{lstlisting}
232   Double\t AliEMCALRecPoint::TmaxInCm(const Double_t e){
233
234       //e: energy sum of cells
235
236 static Double_t ca = 4.82;// shower max parameter - first guess; ca=TMath::Log(1000./8.07)
237
238       static Double_t x0 = 1.23; // radiation lenght (cm)
239
240       static Double_t tmax = 0.; // position of electromagnetic shower max in cm
241
242       tmax = TMath::Log(e) + ca+0.5;
243
244       tmax *= x0; // convert to cm
245
246   }
247 \end{lstlisting}
248 \end{DDbox}
249
250 After the cells position of the cluster is accessed, the position of the cluster is calculated averaging the cell positions with a logarithmic weight:
251
252 \begin{DDbox}{\linewidth}
253 \begin{lstlisting}
254   w(cell i) = TMath::Max( 0., logWeight + TMath::Log( energy[cell i] / summed_cluster_cell_energy ));
255 \end{lstlisting}
256 \end{DDbox}
257
258 where the logWeight was chosen to be 4.5 (this value was taken from PHOS, never optimized as far as I know)
259
260 So in the end the position,  is 
261
262 \begin{DDbox}{\linewidth}
263 \begin{lstlisting}
264 f = Sum(f(i) * w(i))/Sum(w(i))
265 \end{lstlisting}
266 \end{DDbox}
267
268 where f=x,y,z.
269
270  
271
272  \subsubsection{Global coordinates}
273  
274
275 To transform from local to global we have the methods
276
277 \begin{DDbox}{\linewidth}
278 \begin{lstlisting}
279
280   void GetGlobal(const Double_t *loc, Double_t *glob, int ind) const;
281
282   void GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const;
283
284   void GetGlobal(Int_t absId, Double_t glob[3]) const;
285
286   void GetGlobal(Int_t absId, TVector3 &vglob) const;
287 \end{lstlisting}
288 \end{DDbox}
289
290  
291
292  These methods take the local coordinates and transform them into global coordinates using the transformation matrix of the Super Module.
293
294 \begin{DDbox}{\linewidth}
295 \begin{lstlisting}
296  
297
298 TGeoHMatrix* m = GetMatrixForSuperModule(nSupMod);
299
300 if(m) m->LocalToMaster(loc, glob);
301
302 \end{lstlisting}
303 \end{DDbox}
304  
305
306  GetGlobal is called in the following useful methods in the geometry class:
307
308  
309 \begin{itemize}
310 \item Return the eta and phi angular position of the cell from the AbsId
311
312 \begin{DDbox}{\linewidth}
313 \begin{lstlisting}
314 void    EtaPhiFromIndex(Int_t absId, Double_t &eta, Double_t &phi) const;
315 void    EtaPhiFromIndex(Int_t absId, Float_t &eta, Float_t &phi) const;
316 \end{lstlisting}
317 \end{DDbox}
318 \item Print information of the cells. For "pri>0" returns more information. "tit" has not much use, this value is printed.
319
320 \begin{DDbox}{\linewidth}
321 \begin{lstlisting}
322 void PrintCellIndexes(Int_t absId, int pri, const char *tit)
323 \end{lstlisting}
324 \end{DDbox}
325 \end{itemize} 
326
327 \subsection{Geometry Alignment}
328 AliRoot contains a frame for the correction of the misplacement of geometry objects with respect to the ideal positions which are kept in the STEER/ directory of the following classes:
329
330 \begin{DDbox}{\linewidth}
331 \begin{lstlisting}
332 AliAlignObj  
333 AliAlignObjMatrix  
334 AliAlignObjParams  
335 AliAlignmentTracks
336 \end{lstlisting}
337 \end{DDbox}
338
339 The class AliEMCALSurvey creates the corrections to the alignable objects.  The class AliEMCALSurvey was established to take the survey parameters from OCDB, calculate the shift in position of the center of the end faces of the supermodules from the nominal position, and convert this to a transformation matrix for each supermodule which is applied to correct the global position of the supermodules.  All calculations of global positions would then use these corrected supermodule positions to determine their locations within the ALICE global coordinate system.