]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDReconstructor.h
next50 trigger mask in AliHLTGlobalEsdConverterComponent
[u/mrichter/AliRoot.git] / FMD / AliFMDReconstructor.h
CommitLineData
8f1cfb0c 1#ifndef ALIFMDRECONSTRUCTOR_H
2#define ALIFMDRECONSTRUCTOR_H
4347b38f 3//
4// Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
5// reserved.
6//
121a60bd 7// See cxx source for full Copyright notice
4347b38f 8//
121a60bd 9// AliFMDReconstructor.h
4347b38f 10// Task Class for making TreeR for FMD
11//
121a60bd 12//-- Authors: Evgeny Karpechev (INR) and Alla Maevskaia (INR)
4347b38f 13// Latest changes by Christian Holm Christensen <cholm@nbi.dk>
121a60bd 14/* $Id$ */
c2fc1258 15/** @file AliFMDReconstructor.h
16 @author Christian Holm Christensen <cholm@nbi.dk>
17 @date Mon Mar 27 12:47:09 2006
18 @brief FMD reconstruction
19*/
8f1cfb0c 20
42403906 21//____________________________________________________________________
0d0e6995 22// Header guards in the header files speeds up the compilation
23// considerably. Please leave them in.
24#ifndef ALIRECONSTRUCTOR_H
25# include <AliReconstructor.h>
26#endif
d76c31f4 27#include "AliLog.h"
f9ae77c6 28#include <AliFMDBoolMap.h>
d76c31f4 29
4347b38f 30//____________________________________________________________________
1a1fdef7 31class TTree;
4347b38f 32class TClonesArray;
4347b38f 33class AliFMDDigit;
34class AliRawReader;
1306ba55 35class AliFMDRawReader;
af885e0f 36class AliESDEvent;
8f6ee336 37class AliESDFMD;
818fff8d 38class AliFMDRecoParam;
9684be2f 39class TH1;
40
e802be3e 41
9f662337 42/** @defgroup FMD_rec Reconstruction */
4347b38f 43//____________________________________________________________________
50b9d194 44/**
45 * @brief This is a class that reconstructs AliFMDRecPoint objects
46 * from of Digits.
47 *
48 * This class reads either digits from a TClonesArray or raw data
49 * from a DDL file (or similar), and applies calibrations to get
50 * psuedo-inclusive multiplicities per strip.
51 *
52 * @ingroup FMD_rec
9f662337 53 */
121a60bd 54class AliFMDReconstructor: public AliReconstructor
55{
4347b38f 56public:
50b9d194 57 /**
58 * CTOR
59 */
4347b38f 60 AliFMDReconstructor();
50b9d194 61 /**
62 * DTOR
63 */
56b1929b 64 virtual ~AliFMDReconstructor();
4347b38f 65
50b9d194 66 /**
67 * Initialize the reconstructor. Here, we initialize the geometry
68 * manager, and finds the local to global transformations from the
69 * geometry. The calibration parameter manager is also
70 * initialized (meaning that the calibration parameters is read
71 * from CDB).
72 */
d76c31f4 73 virtual void Init();
50b9d194 74 /**
75 * Flag that we can convert raw data into digits.
76 *
77 * @return always @c true
78 */
1a1fdef7 79 virtual Bool_t HasDigitConversion() const { return kTRUE; }
50b9d194 80 /**
81 * Convert raw data read from the AliRawReader @a reader into
82 * digits. This is done using AliFMDRawReader and
83 * AliFMDAltroReader. The digits are put in the passed TTree @a
84 * digitsTree.
85 *
89a7f732 86 * @note This is the first part of the reconstruction as done by the
87 * offical steering class AliReconstruction.
88 *
89 * @param reader Raw reader. @param digitsTree Tree to store read
90 * digits in.
50b9d194 91 */
1a1fdef7 92 virtual void ConvertDigits(AliRawReader* reader, TTree* digitsTree) const;
50b9d194 93 /**
94 * Reconstruct one event from the digits passed in @a digitsTree.
95 * The member function creates AliFMDRecPoint objects and stores
96 * them on the output tree @a clusterTree. An FMD ESD object is
97 * created in parallel.
98 *
89a7f732 99 * @note This is the second part of the reconstruction as done by
100 * the offical steering class AliReconstruction.
101 *
50b9d194 102 * @param digitsTree Tree holding the digits of this event
103 * @param clusterTree Tree to store AliFMDRecPoint objects in.
104 */
1a1fdef7 105 virtual void Reconstruct(TTree* digitsTree, TTree* clusterTree) const;
50b9d194 106 /**
107 * Not used
108 * @todo Implement this, such that we'll reconstruct directly from
109 * the read ADC values rather than going via an intermedant
110 * TClonesArray of AliFMDDigits
111 */
ddaa8027 112 virtual void Reconstruct(AliRawReader *, TTree*) const;
89a7f732 113 /**
114 * Not used.
115 *
116 * @todo This is called by the above same member function but with a
117 * pointer to a AliRawReader object and a pointer to a TTree object.
118 *
119 * @param reader Reader object
120 */
1306ba55 121 virtual void Reconstruct(AliFMDRawReader& reader) const;
50b9d194 122 /**
123 * Put in the ESD data, the FMD ESD data. The object created by
124 * the Reconstruct member function is copied to the ESD object.
125 *
89a7f732 126 * @note This is the third part of the reconstruction as done by
127 * the offical steering class AliReconstruction.
128 *
50b9d194 129 * @param digitsTree Tree of digits for this event - not used
130 * @param clusterTree Tree of reconstructed points for this event -
131 * not used.
132 * @param esd ESD object to store data in.
133 */
1a1fdef7 134 virtual void FillESD(TTree* digitsTree, TTree* clusterTree,
af885e0f 135 AliESDEvent* esd) const;
50b9d194 136 /**
137 * Forwards to above member function
138 */
ddaa8027 139 virtual void FillESD(AliRawReader*, TTree* clusterTree,
140 AliESDEvent* esd) const;
1306ba55 141 /**
142 * Return the filled FMD ESD object
143 *
144 * @return FMD ESD object
145 */
146 AliESDFMD* GetESDObject() const { return fESDObj; }
faf80567 147 /**
148 * Create SDigits from raw data
149 *
150 * @param reader The raw reader
151 * @param sdigits Array to fill with AliFMDSDigit objects.
152 */
153 virtual void Digitize(AliRawReader* reader,
154 TClonesArray* sdigits) const;
155
50b9d194 156 /**
157 * Not used
158 */
af885e0f 159 virtual void SetESD(AliESDEvent* esd) { fESD = esd; }
50b9d194 160 /**
161 * Set the noise factor
162 *
163 * @param f Factor to use
164 */
a9579262 165 virtual void SetNoiseFactor(Float_t f=3) { fNoiseFactor = f; }
50b9d194 166 /**
167 * Set whether we should do angle correction or nor
168 *
169 * @param use If true, do angle correction
170 */
a9579262 171 virtual void SetAngleCorrect(Bool_t use=kTRUE) { fAngleCorrect = use; }
50b9d194 172 /**
173 * Set whether we want to do diagnostics. If this is enabled, a
174 * file named @c FMD.Diag.root will be made. It contains a set of
175 * histograms for each event, filed in separate directories in the
176 * file. The histograms are
177 * @verbatim
178 * diagStep1 Read ADC vs. Noise surpressed ADC
179 * diagStep2 Noise surpressed ADC vs. calculated Energy dep.
180 * diagStep3 Energy deposition vs. angle corrected Energy dep.
181 * diagStep4 Energy deposition vs. calculated multiplicity
182 * diagAll Read ADC vs. calculated multiplicity
183 * @endverbatim
184 *
185 * @param use If true, make the diagnostics file
186 */
9684be2f 187 void SetDiagnose(Bool_t use=kTRUE) { fDiagnostics = use; }
1306ba55 188 /**
189 * Process AliFMDDigit objects in @a digits. For each digit, find
190 * the psuedo-rapidity @f$ \eta@f$, azimuthal angle @f$ \varphi@f$,
191 * energy deposited @f$ E@f$, and psuedo-inclusive multiplicity @f$
192 * M@f$.
193 *
194 * @param digits Array of digits.
195 * @param rawRead Raw reader used
196 */
197 virtual void ProcessDigits(TClonesArray* digits,
198 const AliFMDRawReader& rawRead) const;
3d7ed4ed 199
4347b38f 200protected:
50b9d194 201 /**
202 * Copy CTOR
203 *
204 * @param other Object to copy from.
205 */
3abc001d 206 AliFMDReconstructor(const AliFMDReconstructor&); //Not implemented
50b9d194 207 /**
208 * Assignment operator
209 *
210 * @param other Object to assign from
211 *
212 * @return reference to this object
213 */
3abc001d 214 AliFMDReconstructor& operator=(const AliFMDReconstructor&); //Not implemented
89a7f732 215 /**
216 * Run some checks before reconstruction, clear internal arrays, etc.
217 *
218 * @return true on success
219 */
220 Bool_t PreReconstruct() const;
50b9d194 221 /**
222 * Try to get the vertex from either ESD or generator header. Sets
223 * @c fCurrentVertex to the found Z posistion of the vertex (if
224 * found), and sets the flag @c fVertexType accordingly
8983e5ae 225 *
226 * @param esd ESD structure to get Vz from
50b9d194 227 */
8983e5ae 228 virtual void GetVertex(AliESDEvent* esd) const;
1306ba55 229 /**
230 * Set-up reconstructor to use values from reconstruction
231 * parameters, if present, for this event. If the argument @a set
232 * is @c false, then restore preset values.
233 *
234 * @param set
235 */
236 virtual void UseRecoParam(Bool_t set=kTRUE) const;
50b9d194 237 /**
238 * Process AliFMDDigit objects in @a digits. For each digit, find
239 * the psuedo-rapidity @f$ \eta@f$, azimuthal angle @f$ \varphi@f$,
240 * energy deposited @f$ E@f$, and psuedo-inclusive multiplicity @f$
241 * M@f$.
242 *
243 * @param digits Array of digits.
244 */
1306ba55 245 virtual void ProcessDigits(TClonesArray* digits) const;
50b9d194 246 /**
247 * Process a single digit
248 *
249 * @param digit Digiti to process
250 */
251 virtual void ProcessDigit(AliFMDDigit* digit) const;
252 /**
253 * Process the signal from a single strip.
254 *
255 * @param det Detector number
256 * @param rng Ring identifier
257 * @param sec Sector number
258 * @param str Strip number
259 * @param adc Number of ADC counts for this strip
260 */
261 virtual void ProcessSignal(UShort_t det,
262 Char_t rng,
263 UShort_t sec,
264 UShort_t str,
265 Short_t adc) const;
faf80567 266 /**
267 * Process the signal from a single strip.
268 *
269 * @param sdigits Array to fill
270 * @param det Detector number
271 * @param rng Ring identifier
272 * @param sec Sector number
273 * @param str Strip number
274 * @param sam Sample number
275 * @param adc Number of ADC counts for this strip
276 */
277 virtual void DigitizeSignal(TClonesArray* sdigits,
278 UShort_t det,
279 Char_t rng,
280 UShort_t sec,
281 UShort_t str,
282 UShort_t sam,
283 Short_t adc) const;
284 /**
285 * Subtract the pedestal off the ADC counts.
286 *
287 * @param det Detector number
288 * @param rng Ring identifier
289 * @param sec Sector number
290 * @param str Strip number
291 * @param adc ADC counts
292 * @param noiseFactor If pedestal substracted pedestal is less then
293 * this times the noise, then consider this to be 0.
294 * @param zsEnabled Whether zero-suppression is on.
295 * @param zsNoiseFactor Noise factor used in on-line pedestal
296 * subtraction.
297 *
298 * @return The pedestal subtracted ADC counts (possibly 0), or @c
299 * USHRT_MAX in case of problems.
300 */
301 virtual UShort_t SubtractPedestal(UShort_t det,
302 Char_t rng,
303 UShort_t sec,
304 UShort_t str,
305 UShort_t adc,
306 Float_t noiseFactor,
307 Bool_t zsEnabled,
308 UShort_t zsNoiseFactor) const;
50b9d194 309 /**
310 * Substract pedestals from raw ADC in @a digit
311 *
312 * @param det Detector number
313 * @param rng Ring identifier
314 * @param sec Sector number
315 * @param str Strip number
316 * @param adc Number of ADC counts
317 *
318 * @return Pedestal subtracted ADC count.
319 */
320 virtual UShort_t SubtractPedestal(UShort_t det,
321 Char_t rng,
322 UShort_t sec,
323 UShort_t str,
324 Short_t adc) const;
325 /**
326 * Converts number of ADC counts to energy deposited. This is
327 * done by
328 * @f[
329 * E_i = A_i g_i
330 * @f]
331 * where @f$ A_i@f$ is the pedestal subtracted ADC counts, and @f$
332 * g_i@f$ is the gain for the @f$ i^{\mbox{th}}@f$ strip.
333 *
334 * @param det Detector number
335 * @param rng Ring identifier
336 * @param sec Sector number
337 * @param str Strip number
338 * @param eta Psuedo-rapidity of digit.
339 * @param count Pedestal subtracted ADC counts
340 *
341 * @return Energy deposited @f$ E_i@f$
342 */
faf80567 343 virtual Float_t Adc2Energy(UShort_t det,
344 Char_t rng,
345 UShort_t sec,
346 UShort_t str,
347 UShort_t count) const;
348 /**
349 * Converts number of ADC counts to energy deposited. This is
350 * done by
351 * @f[
352 * E_i = A_i g_i
353 * @f]
354 * where @f$ A_i@f$ is the pedestal subtracted ADC counts, and @f$
355 * g_i@f$ is the gain for the @f$ i^{\mbox{th}}@f$ strip.
356 *
357 * @param det Detector number
358 * @param rng Ring identifier
359 * @param sec Sector number
360 * @param str Strip number
361 * @param eta Psuedo-rapidity of digit.
362 * @param count Pedestal subtracted ADC counts
363 *
364 * @return Energy deposited @f$ E_i@f$
365 */
50b9d194 366 virtual Float_t Adc2Energy(UShort_t det,
367 Char_t rng,
368 UShort_t sec,
369 UShort_t str,
370 Float_t eta,
8f6ee336 371 UShort_t count) const;
50b9d194 372 /**
373 * Converts an energy signal to number of particles. In this
374 * implementation, it's done by
375 * @f[
376 * M_i = E_i / E_{\mbox{MIP}}
377 * @f]
378 * where @f$ E_i@f$ is the energy deposited, and
379 * @f$ E_{\mbox{MIP}}@f$ is the average energy deposited by a
380 * minimum ionizing particle
381 *
382 * @param det Detector number
383 * @param rng Ring identifier
384 * @param sec Sector number
385 * @param str Strip number
386 * @param eta On return, psuedo-rapidity @f$ \eta@f$
387 * @param phi On return, azimuthal angle @f$ \varphi@f$
388 * @param edep Energy deposited @f$ E_i@f$
389 *
390 * @return Psuedo-inclusive multiplicity @f$ M@f$
391 */
392 virtual Float_t Energy2Multiplicity(UShort_t det,
393 Char_t rng,
394 UShort_t sec,
395 UShort_t str,
396 Float_t edep) const;
397 /**
398 * Calculate the physical coordinates psuedo-rapidity @f$ \eta@f$,
399 * azimuthal angle @f$ \varphi@f$ of the strip corresponding to
400 * the digit @a digit. This is done by using the information
401 * obtained, and previously cached by AliFMDGeometry, from the
402 * TGeoManager.
403 *
404 * @param det Detector number
405 * @param rng Ring identifier
406 * @param sec Sector number
407 * @param str Strip number
408 * @param eta On return, psuedo-rapidity @f$ \eta@f$
409 * @param phi On return, azimuthal angle @f$ \varphi@f$
410 */
411 virtual void PhysicalCoordinates(UShort_t det,
412 Char_t rng,
413 UShort_t sec,
414 UShort_t str,
415 Float_t& eta,
8f6ee336 416 Float_t& phi) const;
75609cab 417 /**
418 * Mark dead channels as invalid, and those that are marked as invalid
419 * but are not dead, get the zero signal.
420 *
421 * @param esd ESD object to modify.
422 */
423 void MarkDeadChannels(AliESDFMD* esd) const;
424
818fff8d 425 /**
426 * Utility member function to get the reconstruction parameters for
427 * this event
428 *
429 * @return Pointer to AliFMDRecoParam object or null if not
430 * available.
431 */
432 const AliFMDRecoParam* GetParameters() const;
433 /**
434 * Get the numeric identifier of this detector
435 *
436 * @return Should be 12
437 */
438 Int_t GetIdentifier() const;
9684be2f 439 enum Vertex_t {
440 kNoVertex, // Got no vertex
441 kGenVertex, // Got generator vertex
442 kESDVertex // Got ESD vertex
443 };
8f6ee336 444 mutable TClonesArray* fMult; // Cache of RecPoints
445 mutable Int_t fNMult; // Number of entries in fMult
446 mutable TTree* fTreeR; // Output tree
e802be3e 447 mutable Float_t fCurrentVertex; // Z-coordinate of primary vertex
8f6ee336 448 mutable AliESDFMD* fESDObj; // ESD output object
818fff8d 449 mutable Float_t fNoiseFactor; // Factor of noise to check
450 mutable Bool_t fAngleCorrect; // Whether to angle correct
9684be2f 451 mutable Vertex_t fVertexType; // What kind of vertex we got
af885e0f 452 AliESDEvent* fESD; // ESD object(?)
9684be2f 453 Bool_t fDiagnostics; // Wheter to do diagnostics
454 TH1* fDiagStep1; // Diagnostics histogram
455 TH1* fDiagStep2; // Diagnostics histogram
456 TH1* fDiagStep3; // Diagnostics histogram
457 TH1* fDiagStep4; // Diagnostics histogram
458 TH1* fDiagAll; // Diagnostics histogram
5cf05dbb 459 mutable Bool_t fZS[3]; // Zero-suppredded?
460 mutable UShort_t fZSFactor[3]; // Noise factor for Zero-suppression
f9ae77c6 461 mutable AliFMDBoolMap fBad; // Strip marked bad
c57d63ee 462 Bool_t fZombie; // Are we a zombie?
02a27b50 463private:
d76c31f4 464
465 ClassDef(AliFMDReconstructor, 3) // class for the FMD reconstruction
121a60bd 466};
467#endif
4347b38f 468//____________________________________________________________________
469//
0d0e6995 470// Local Variables:
471// mode: C++
472// End:
473//
4347b38f 474// EOF
475//