]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDReconstructor.h
Updates for better DQM.
[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 *
86 * @param reader Raw reader.
87 * @param digitsTree Tree to store read digits in.
88 */
1a1fdef7 89 virtual void ConvertDigits(AliRawReader* reader, TTree* digitsTree) const;
50b9d194 90 /**
91 * Reconstruct one event from the digits passed in @a digitsTree.
92 * The member function creates AliFMDRecPoint objects and stores
93 * them on the output tree @a clusterTree. An FMD ESD object is
94 * created in parallel.
95 *
96 * @param digitsTree Tree holding the digits of this event
97 * @param clusterTree Tree to store AliFMDRecPoint objects in.
98 */
1a1fdef7 99 virtual void Reconstruct(TTree* digitsTree, TTree* clusterTree) const;
50b9d194 100 /**
101 * Not used
102 * @todo Implement this, such that we'll reconstruct directly from
103 * the read ADC values rather than going via an intermedant
104 * TClonesArray of AliFMDDigits
105 */
ddaa8027 106 virtual void Reconstruct(AliRawReader *, TTree*) const;
1306ba55 107 virtual void Reconstruct(AliFMDRawReader& reader) const;
50b9d194 108 /**
109 * Put in the ESD data, the FMD ESD data. The object created by
110 * the Reconstruct member function is copied to the ESD object.
111 *
112 * @param digitsTree Tree of digits for this event - not used
113 * @param clusterTree Tree of reconstructed points for this event -
114 * not used.
115 * @param esd ESD object to store data in.
116 */
1a1fdef7 117 virtual void FillESD(TTree* digitsTree, TTree* clusterTree,
af885e0f 118 AliESDEvent* esd) const;
50b9d194 119 /**
120 * Forwards to above member function
121 */
ddaa8027 122 virtual void FillESD(AliRawReader*, TTree* clusterTree,
123 AliESDEvent* esd) const;
1306ba55 124 /**
125 * Return the filled FMD ESD object
126 *
127 * @return FMD ESD object
128 */
129 AliESDFMD* GetESDObject() const { return fESDObj; }
faf80567 130 /**
131 * Create SDigits from raw data
132 *
133 * @param reader The raw reader
134 * @param sdigits Array to fill with AliFMDSDigit objects.
135 */
136 virtual void Digitize(AliRawReader* reader,
137 TClonesArray* sdigits) const;
138
50b9d194 139 /**
140 * Not used
141 */
af885e0f 142 virtual void SetESD(AliESDEvent* esd) { fESD = esd; }
50b9d194 143 /**
144 * Set the noise factor
145 *
146 * @param f Factor to use
147 */
a9579262 148 virtual void SetNoiseFactor(Float_t f=3) { fNoiseFactor = f; }
50b9d194 149 /**
150 * Set whether we should do angle correction or nor
151 *
152 * @param use If true, do angle correction
153 */
a9579262 154 virtual void SetAngleCorrect(Bool_t use=kTRUE) { fAngleCorrect = use; }
50b9d194 155 /**
156 * Set whether we want to do diagnostics. If this is enabled, a
157 * file named @c FMD.Diag.root will be made. It contains a set of
158 * histograms for each event, filed in separate directories in the
159 * file. The histograms are
160 * @verbatim
161 * diagStep1 Read ADC vs. Noise surpressed ADC
162 * diagStep2 Noise surpressed ADC vs. calculated Energy dep.
163 * diagStep3 Energy deposition vs. angle corrected Energy dep.
164 * diagStep4 Energy deposition vs. calculated multiplicity
165 * diagAll Read ADC vs. calculated multiplicity
166 * @endverbatim
167 *
168 * @param use If true, make the diagnostics file
169 */
9684be2f 170 void SetDiagnose(Bool_t use=kTRUE) { fDiagnostics = use; }
1306ba55 171 /**
172 * Process AliFMDDigit objects in @a digits. For each digit, find
173 * the psuedo-rapidity @f$ \eta@f$, azimuthal angle @f$ \varphi@f$,
174 * energy deposited @f$ E@f$, and psuedo-inclusive multiplicity @f$
175 * M@f$.
176 *
177 * @param digits Array of digits.
178 * @param rawRead Raw reader used
179 */
180 virtual void ProcessDigits(TClonesArray* digits,
181 const AliFMDRawReader& rawRead) const;
3d7ed4ed 182
4347b38f 183protected:
50b9d194 184 /**
185 * Copy CTOR
186 *
187 * @param other Object to copy from.
188 */
3abc001d 189 AliFMDReconstructor(const AliFMDReconstructor&); //Not implemented
50b9d194 190 /**
191 * Assignment operator
192 *
193 * @param other Object to assign from
194 *
195 * @return reference to this object
196 */
3abc001d 197 AliFMDReconstructor& operator=(const AliFMDReconstructor&); //Not implemented
50b9d194 198 /**
199 * Try to get the vertex from either ESD or generator header. Sets
200 * @c fCurrentVertex to the found Z posistion of the vertex (if
201 * found), and sets the flag @c fVertexType accordingly
8983e5ae 202 *
203 * @param esd ESD structure to get Vz from
50b9d194 204 */
8983e5ae 205 virtual void GetVertex(AliESDEvent* esd) const;
1306ba55 206 /**
207 * Set-up reconstructor to use values from reconstruction
208 * parameters, if present, for this event. If the argument @a set
209 * is @c false, then restore preset values.
210 *
211 * @param set
212 */
213 virtual void UseRecoParam(Bool_t set=kTRUE) const;
50b9d194 214 /**
215 * Process AliFMDDigit objects in @a digits. For each digit, find
216 * the psuedo-rapidity @f$ \eta@f$, azimuthal angle @f$ \varphi@f$,
217 * energy deposited @f$ E@f$, and psuedo-inclusive multiplicity @f$
218 * M@f$.
219 *
220 * @param digits Array of digits.
221 */
1306ba55 222 virtual void ProcessDigits(TClonesArray* digits) const;
50b9d194 223 /**
224 * Process a single digit
225 *
226 * @param digit Digiti to process
227 */
228 virtual void ProcessDigit(AliFMDDigit* digit) const;
229 /**
230 * Process the signal from a single strip.
231 *
232 * @param det Detector number
233 * @param rng Ring identifier
234 * @param sec Sector number
235 * @param str Strip number
236 * @param adc Number of ADC counts for this strip
237 */
238 virtual void ProcessSignal(UShort_t det,
239 Char_t rng,
240 UShort_t sec,
241 UShort_t str,
242 Short_t adc) const;
faf80567 243 /**
244 * Process the signal from a single strip.
245 *
246 * @param sdigits Array to fill
247 * @param det Detector number
248 * @param rng Ring identifier
249 * @param sec Sector number
250 * @param str Strip number
251 * @param sam Sample number
252 * @param adc Number of ADC counts for this strip
253 */
254 virtual void DigitizeSignal(TClonesArray* sdigits,
255 UShort_t det,
256 Char_t rng,
257 UShort_t sec,
258 UShort_t str,
259 UShort_t sam,
260 Short_t adc) const;
261 /**
262 * Subtract the pedestal off the ADC counts.
263 *
264 * @param det Detector number
265 * @param rng Ring identifier
266 * @param sec Sector number
267 * @param str Strip number
268 * @param adc ADC counts
269 * @param noiseFactor If pedestal substracted pedestal is less then
270 * this times the noise, then consider this to be 0.
271 * @param zsEnabled Whether zero-suppression is on.
272 * @param zsNoiseFactor Noise factor used in on-line pedestal
273 * subtraction.
274 *
275 * @return The pedestal subtracted ADC counts (possibly 0), or @c
276 * USHRT_MAX in case of problems.
277 */
278 virtual UShort_t SubtractPedestal(UShort_t det,
279 Char_t rng,
280 UShort_t sec,
281 UShort_t str,
282 UShort_t adc,
283 Float_t noiseFactor,
284 Bool_t zsEnabled,
285 UShort_t zsNoiseFactor) const;
50b9d194 286 /**
287 * Substract pedestals from raw ADC in @a digit
288 *
289 * @param det Detector number
290 * @param rng Ring identifier
291 * @param sec Sector number
292 * @param str Strip number
293 * @param adc Number of ADC counts
294 *
295 * @return Pedestal subtracted ADC count.
296 */
297 virtual UShort_t SubtractPedestal(UShort_t det,
298 Char_t rng,
299 UShort_t sec,
300 UShort_t str,
301 Short_t adc) const;
302 /**
303 * Converts number of ADC counts to energy deposited. This is
304 * done by
305 * @f[
306 * E_i = A_i g_i
307 * @f]
308 * where @f$ A_i@f$ is the pedestal subtracted ADC counts, and @f$
309 * g_i@f$ is the gain for the @f$ i^{\mbox{th}}@f$ strip.
310 *
311 * @param det Detector number
312 * @param rng Ring identifier
313 * @param sec Sector number
314 * @param str Strip number
315 * @param eta Psuedo-rapidity of digit.
316 * @param count Pedestal subtracted ADC counts
317 *
318 * @return Energy deposited @f$ E_i@f$
319 */
faf80567 320 virtual Float_t Adc2Energy(UShort_t det,
321 Char_t rng,
322 UShort_t sec,
323 UShort_t str,
324 UShort_t count) 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 */
50b9d194 343 virtual Float_t Adc2Energy(UShort_t det,
344 Char_t rng,
345 UShort_t sec,
346 UShort_t str,
347 Float_t eta,
8f6ee336 348 UShort_t count) const;
50b9d194 349 /**
350 * Converts an energy signal to number of particles. In this
351 * implementation, it's done by
352 * @f[
353 * M_i = E_i / E_{\mbox{MIP}}
354 * @f]
355 * where @f$ E_i@f$ is the energy deposited, and
356 * @f$ E_{\mbox{MIP}}@f$ is the average energy deposited by a
357 * minimum ionizing particle
358 *
359 * @param det Detector number
360 * @param rng Ring identifier
361 * @param sec Sector number
362 * @param str Strip number
363 * @param eta On return, psuedo-rapidity @f$ \eta@f$
364 * @param phi On return, azimuthal angle @f$ \varphi@f$
365 * @param edep Energy deposited @f$ E_i@f$
366 *
367 * @return Psuedo-inclusive multiplicity @f$ M@f$
368 */
369 virtual Float_t Energy2Multiplicity(UShort_t det,
370 Char_t rng,
371 UShort_t sec,
372 UShort_t str,
373 Float_t edep) const;
374 /**
375 * Calculate the physical coordinates psuedo-rapidity @f$ \eta@f$,
376 * azimuthal angle @f$ \varphi@f$ of the strip corresponding to
377 * the digit @a digit. This is done by using the information
378 * obtained, and previously cached by AliFMDGeometry, from the
379 * TGeoManager.
380 *
381 * @param det Detector number
382 * @param rng Ring identifier
383 * @param sec Sector number
384 * @param str Strip number
385 * @param eta On return, psuedo-rapidity @f$ \eta@f$
386 * @param phi On return, azimuthal angle @f$ \varphi@f$
387 */
388 virtual void PhysicalCoordinates(UShort_t det,
389 Char_t rng,
390 UShort_t sec,
391 UShort_t str,
392 Float_t& eta,
8f6ee336 393 Float_t& phi) const;
75609cab 394 /**
395 * Mark dead channels as invalid, and those that are marked as invalid
396 * but are not dead, get the zero signal.
397 *
398 * @param esd ESD object to modify.
399 */
400 void MarkDeadChannels(AliESDFMD* esd) const;
401
818fff8d 402 /**
403 * Utility member function to get the reconstruction parameters for
404 * this event
405 *
406 * @return Pointer to AliFMDRecoParam object or null if not
407 * available.
408 */
409 const AliFMDRecoParam* GetParameters() const;
410 /**
411 * Get the numeric identifier of this detector
412 *
413 * @return Should be 12
414 */
415 Int_t GetIdentifier() const;
9684be2f 416 enum Vertex_t {
417 kNoVertex, // Got no vertex
418 kGenVertex, // Got generator vertex
419 kESDVertex // Got ESD vertex
420 };
8f6ee336 421 mutable TClonesArray* fMult; // Cache of RecPoints
422 mutable Int_t fNMult; // Number of entries in fMult
423 mutable TTree* fTreeR; // Output tree
e802be3e 424 mutable Float_t fCurrentVertex; // Z-coordinate of primary vertex
8f6ee336 425 mutable AliESDFMD* fESDObj; // ESD output object
818fff8d 426 mutable Float_t fNoiseFactor; // Factor of noise to check
427 mutable Bool_t fAngleCorrect; // Whether to angle correct
9684be2f 428 mutable Vertex_t fVertexType; // What kind of vertex we got
af885e0f 429 AliESDEvent* fESD; // ESD object(?)
9684be2f 430 Bool_t fDiagnostics; // Wheter to do diagnostics
431 TH1* fDiagStep1; // Diagnostics histogram
432 TH1* fDiagStep2; // Diagnostics histogram
433 TH1* fDiagStep3; // Diagnostics histogram
434 TH1* fDiagStep4; // Diagnostics histogram
435 TH1* fDiagAll; // Diagnostics histogram
5cf05dbb 436 mutable Bool_t fZS[3]; // Zero-suppredded?
437 mutable UShort_t fZSFactor[3]; // Noise factor for Zero-suppression
f9ae77c6 438 mutable AliFMDBoolMap fBad; // Strip marked bad
02a27b50 439private:
d76c31f4 440
441 ClassDef(AliFMDReconstructor, 3) // class for the FMD reconstruction
121a60bd 442};
443#endif
4347b38f 444//____________________________________________________________________
445//
0d0e6995 446// Local Variables:
447// mode: C++
448// End:
449//
4347b38f 450// EOF
451//