]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDReconstructor.h
Updated requires SVN revision number from last commit
[u/mrichter/AliRoot.git] / FMD / AliFMDReconstructor.h
1 #ifndef ALIFMDRECONSTRUCTOR_H
2 #define ALIFMDRECONSTRUCTOR_H
3 //
4 //  Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
5 //  reserved. 
6 //
7 //  See cxx source for full Copyright notice                               
8 //
9 //  AliFMDReconstructor.h 
10 //  Task Class for making TreeR for FMD                        
11 //
12 //-- Authors: Evgeny Karpechev (INR) and Alla Maevskaia (INR)
13 //   Latest changes by Christian Holm Christensen <cholm@nbi.dk>
14 /* $Id$ */
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 */
20
21 //____________________________________________________________________
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
27 #include "AliLog.h"
28 #include <AliFMDBoolMap.h>
29
30 //____________________________________________________________________
31 class TTree;
32 class TClonesArray;
33 class AliFMDDigit;
34 class AliRawReader;
35 class AliFMDRawReader;
36 class AliESDEvent;
37 class AliESDFMD;
38 class AliFMDRecoParam;
39 class TH1;
40
41
42 /** @defgroup FMD_rec Reconstruction */
43 //____________________________________________________________________
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
53  */
54 class AliFMDReconstructor: public AliReconstructor 
55 {
56 public:
57   /** 
58    * CTOR 
59    */
60   AliFMDReconstructor();
61   /** 
62    * DTOR 
63    */
64   virtual ~AliFMDReconstructor();
65
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    */
73   virtual void   Init();
74   /** 
75    * Flag that we can convert raw data into digits. 
76    *
77    * @return always @c true 
78    */
79   virtual Bool_t HasDigitConversion() const { return kTRUE; }
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    */
89   virtual void   ConvertDigits(AliRawReader* reader, TTree* digitsTree) const;
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    */
99   virtual void   Reconstruct(TTree* digitsTree, TTree* clusterTree) const;
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    */
106   virtual void   Reconstruct(AliRawReader *, TTree*) const;
107   virtual void Reconstruct(AliFMDRawReader& reader) const;
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    */
117   virtual void   FillESD(TTree* digitsTree, TTree* clusterTree, 
118                          AliESDEvent* esd) const;
119   /** 
120    * Forwards to above member function 
121    */
122   virtual void   FillESD(AliRawReader*, TTree* clusterTree, 
123                          AliESDEvent* esd) const;
124   /** 
125    * Return the filled FMD ESD object
126    * 
127    * @return FMD ESD object
128    */
129   AliESDFMD* GetESDObject() const { return fESDObj; }
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   
139   /** 
140    * Not used 
141    */
142   virtual void   SetESD(AliESDEvent* esd) { fESD = esd; }
143   /** 
144    * Set the noise factor 
145    *
146    * @param f Factor to use 
147    */
148   virtual void SetNoiseFactor(Float_t f=3) { fNoiseFactor = f; }
149   /** 
150    * Set whether we should do angle correction or nor 
151    *
152    * @param use If true, do angle correction 
153    */
154   virtual void SetAngleCorrect(Bool_t use=kTRUE) { fAngleCorrect = use; }
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    */
170   void SetDiagnose(Bool_t use=kTRUE) { fDiagnostics = use; }
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;
182     
183 protected:
184   /** 
185    * Copy CTOR 
186    *
187    * @param other Object to copy from. 
188    */
189   AliFMDReconstructor(const AliFMDReconstructor&); //Not implemented
190   /** 
191    * Assignment operator 
192    *
193    * @param other Object to assign from
194    *
195    * @return reference to this object 
196    */
197   AliFMDReconstructor& operator=(const AliFMDReconstructor&); //Not implemented
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 
202    *
203    * @param esd ESD structure to get Vz from
204    */
205   virtual void GetVertex(AliESDEvent* esd) const;
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;
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    */
222   virtual void ProcessDigits(TClonesArray* digits) const;
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;
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;
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    */
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    */
343   virtual Float_t  Adc2Energy(UShort_t det, 
344                               Char_t   rng, 
345                               UShort_t sec, 
346                               UShort_t str, 
347                               Float_t  eta, 
348                               UShort_t count) const;
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, 
393                                        Float_t& phi) const;
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
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;
416   enum Vertex_t {
417     kNoVertex,   // Got no vertex
418     kGenVertex,  // Got generator vertex 
419     kESDVertex   // Got ESD vertex 
420   };
421   mutable TClonesArray* fMult;          // Cache of RecPoints
422   mutable Int_t         fNMult;         // Number of entries in fMult 
423   mutable TTree*        fTreeR;         // Output tree 
424   mutable Float_t       fCurrentVertex; // Z-coordinate of primary vertex
425   mutable AliESDFMD*    fESDObj;        // ESD output object
426   mutable Float_t       fNoiseFactor;   // Factor of noise to check
427   mutable Bool_t        fAngleCorrect;  // Whether to angle correct
428   mutable Vertex_t      fVertexType;    // What kind of vertex we got
429   AliESDEvent*          fESD;           // ESD object(?)
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
436   mutable Bool_t        fZS[3];         // Zero-suppredded?
437   mutable UShort_t      fZSFactor[3];   // Noise factor for Zero-suppression
438   mutable AliFMDBoolMap fBad;           // Strip marked bad
439   Bool_t                fZombie;        // Are we a zombie?
440 private:
441    
442   ClassDef(AliFMDReconstructor, 3)  // class for the FMD reconstruction
443 }; 
444 #endif
445 //____________________________________________________________________
446 //
447 // Local Variables:
448 //   mode: C++
449 // End:
450 //
451 // EOF
452 //