]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDReconstructor.h
- correct initialization of AliTPCcalibTimeGain
[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
29 //____________________________________________________________________
30 class TTree;
31 class TClonesArray;
32 class AliFMDDigit;
33 class AliRawReader;
34 class AliESDEvent;
35 class AliESDFMD;
36 class AliFMDRecoParam;
37 class TH1;
38
39
40 /** @defgroup FMD_rec Reconstruction */
41 //____________________________________________________________________
42 /** 
43  * @brief This is a class that reconstructs AliFMDRecPoint objects
44  *        from of Digits.  
45  *
46  * This class reads either digits from a TClonesArray or raw data
47  * from a DDL file (or similar), and applies calibrations to get
48  * psuedo-inclusive multiplicities per strip.
49  * 
50  * @ingroup FMD_rec
51  */
52 class AliFMDReconstructor: public AliReconstructor 
53 {
54 public:
55   /** 
56    * CTOR 
57    */
58   AliFMDReconstructor();
59   /** 
60    * DTOR 
61    */
62   virtual ~AliFMDReconstructor();
63
64   /** 
65    * Initialize the reconstructor.  Here, we initialize the geometry
66    * manager, and finds the local to global transformations from the
67    * geometry.   The calibration parameter manager is also
68    * initialized (meaning that the calibration parameters is read
69    * from CDB).
70    */
71   virtual void   Init();
72   /** 
73    * Flag that we can convert raw data into digits. 
74    *
75    * @return always @c true 
76    */
77   virtual Bool_t HasDigitConversion() const { return kTRUE; }
78   /** 
79    * Convert raw data read from the AliRawReader @a reader into
80    * digits.  This is done using AliFMDRawReader and
81    * AliFMDAltroReader.  The digits are put in the passed TTree @a
82    * digitsTree. 
83    *
84    * @param reader     Raw reader. 
85    * @param digitsTree Tree to store read digits in. 
86    */
87   virtual void   ConvertDigits(AliRawReader* reader, TTree* digitsTree) const;
88   /** 
89    * Reconstruct one event from the digits passed in @a digitsTree.
90    * The member function creates AliFMDRecPoint objects and stores
91    * them on the output tree @a clusterTree.  An FMD ESD object is
92    * created in parallel. 
93    *
94    * @param digitsTree  Tree holding the digits of this event
95    * @param clusterTree Tree to store AliFMDRecPoint objects in. 
96    */
97   virtual void   Reconstruct(TTree* digitsTree, TTree* clusterTree) const;
98   /** 
99    * Not used 
100    * @todo Implement this, such that we'll reconstruct directly from
101    *       the read ADC values rather than going via an intermedant
102    *       TClonesArray of AliFMDDigits
103    */
104   virtual void   Reconstruct(AliRawReader *, TTree*) const;
105   /** 
106    * Put in the ESD data, the FMD ESD data.  The object created by
107    * the Reconstruct member function is copied to the ESD object. 
108    *
109    * @param digitsTree   Tree of digits for this event - not used
110    * @param clusterTree  Tree of reconstructed points for this event -
111    *        not used.
112    * @param esd ESD object to store data in. 
113    */
114   virtual void   FillESD(TTree* digitsTree, TTree* clusterTree, 
115                          AliESDEvent* esd) const;
116   /** 
117    * Forwards to above member function 
118    */
119   virtual void   FillESD(AliRawReader*, TTree* clusterTree, 
120                          AliESDEvent* esd) const;
121
122   /** 
123    * Create SDigits from raw data
124    * 
125    * @param reader  The raw reader
126    * @param sdigits Array to fill with AliFMDSDigit objects. 
127    */  
128   virtual void Digitize(AliRawReader* reader, 
129                         TClonesArray* sdigits) const;
130   
131   /** 
132    * Not used 
133    */
134   virtual void   SetESD(AliESDEvent* esd) { fESD = esd; }
135   /** 
136    * Set the noise factor 
137    *
138    * @param f Factor to use 
139    */
140   virtual void SetNoiseFactor(Float_t f=3) { fNoiseFactor = f; }
141   /** 
142    * Set whether we should do angle correction or nor 
143    *
144    * @param use If true, do angle correction 
145    */
146   virtual void SetAngleCorrect(Bool_t use=kTRUE) { fAngleCorrect = use; }
147   /** 
148    * Set whether we want to do diagnostics.  If this is enabled, a
149    * file named @c FMD.Diag.root will be made.  It contains a set of
150    * histograms for each event, filed in separate directories in the
151    * file.  The histograms are 
152    * @verbatim 
153    * diagStep1   Read ADC vs. Noise surpressed ADC 
154    * diagStep2   Noise surpressed ADC vs. calculated Energy dep.
155    * diagStep3   Energy deposition vs. angle corrected Energy dep.
156    * diagStep4   Energy deposition vs. calculated multiplicity
157    * diagAll     Read ADC vs. calculated multiplicity
158    * @endverbatim 
159    *
160    * @param use If true, make the diagnostics file 
161    */
162   void SetDiagnose(Bool_t use=kTRUE) { fDiagnostics = use; }
163 protected:
164   /** 
165    * Copy CTOR 
166    *
167    * @param other Object to copy from. 
168    */
169   AliFMDReconstructor(const AliFMDReconstructor& other);
170   /** 
171    * Assignment operator 
172    *
173    * @param other Object to assign from
174    *
175    * @return reference to this object 
176    */
177   AliFMDReconstructor& operator=(const AliFMDReconstructor& other);
178   /** 
179    * Try to get the vertex from either ESD or generator header.  Sets
180    * @c fCurrentVertex to the found Z posistion of the vertex (if 
181    * found), and sets the flag @c fVertexType accordingly 
182    *
183    * @param esd ESD structure to get Vz from
184    */
185   virtual void GetVertex(AliESDEvent* esd) const;
186   /** 
187    * Process AliFMDDigit objects in @a digits.  For each digit, find
188    * the psuedo-rapidity @f$ \eta@f$, azimuthal angle @f$ \varphi@f$,
189    * energy deposited @f$ E@f$, and psuedo-inclusive multiplicity @f$
190    * M@f$.
191    * 
192    * @param digits Array of digits. 
193    */
194   virtual void     ProcessDigits(TClonesArray* digits) const;
195   /** 
196    * Process a single digit 
197    * 
198    * @param digit Digiti to process
199    */ 
200   virtual void ProcessDigit(AliFMDDigit* digit) const;
201   /** 
202    * Process the signal from a single strip. 
203    * 
204    * @param det Detector number 
205    * @param rng Ring identifier 
206    * @param sec Sector number
207    * @param str Strip number 
208    * @param adc Number of ADC counts for this strip
209    */  
210   virtual void ProcessSignal(UShort_t det, 
211                              Char_t   rng, 
212                              UShort_t sec, 
213                              UShort_t str, 
214                              Short_t  adc) const;
215   /** 
216    * Process the signal from a single strip. 
217    * 
218    * @param sdigits Array to fill
219    * @param det     Detector number 
220    * @param rng     Ring identifier 
221    * @param sec     Sector number
222    * @param str     Strip number 
223    * @param sam     Sample number 
224    * @param adc     Number of ADC counts for this strip
225    */  
226   virtual void DigitizeSignal(TClonesArray* sdigits, 
227                               UShort_t      det, 
228                               Char_t         rng, 
229                               UShort_t       sec, 
230                               UShort_t       str, 
231                               UShort_t       sam,
232                               Short_t        adc) const;
233   /** 
234    * Subtract the pedestal off the ADC counts. 
235    * 
236    * @param det           Detector number
237    * @param rng           Ring identifier
238    * @param sec           Sector number
239    * @param str           Strip number
240    * @param adc           ADC counts
241    * @param noiseFactor   If pedestal substracted pedestal is less then
242    *        this times the noise, then consider this to be 0. 
243    * @param zsEnabled     Whether zero-suppression is on.
244    * @param zsNoiseFactor Noise factor used in on-line pedestal
245    *        subtraction. 
246    * 
247    * @return The pedestal subtracted ADC counts (possibly 0), or @c
248    *         USHRT_MAX in case of problems.
249    */  
250   virtual UShort_t SubtractPedestal(UShort_t det, 
251                                     Char_t   rng, 
252                                     UShort_t sec, 
253                                     UShort_t str, 
254                                     UShort_t adc, 
255                                     Float_t  noiseFactor,
256                                     Bool_t   zsEnabled, 
257                                     UShort_t zsNoiseFactor) const;
258   /** 
259    * Substract pedestals from raw ADC in @a digit
260    * 
261    * @param det   Detector number  
262    * @param rng   Ring identifier 
263    * @param sec   Sector number
264    * @param str   Strip number 
265    * @param adc   Number of ADC counts
266    *
267    * @return Pedestal subtracted ADC count. 
268    */
269   virtual UShort_t SubtractPedestal(UShort_t det, 
270                                     Char_t   rng, 
271                                     UShort_t sec, 
272                                     UShort_t str, 
273                                     Short_t  adc) const;
274   /** 
275    * Converts number of ADC counts to energy deposited.   This is
276    * done by 
277    * @f[
278    * E_i = A_i g_i
279    * @f]
280    * where @f$ A_i@f$ is the pedestal subtracted ADC counts, and @f$
281    * g_i@f$ is the gain for the @f$ i^{\mbox{th}}@f$ strip. 
282    * 
283    * @param det   Detector number  
284    * @param rng   Ring identifier 
285    * @param sec   Sector number
286    * @param str   Strip number 
287    * @param eta   Psuedo-rapidity of digit.
288    * @param count Pedestal subtracted ADC counts
289    *
290    * @return Energy deposited @f$ E_i@f$ 
291    */
292   virtual Float_t  Adc2Energy(UShort_t det, 
293                               Char_t   rng, 
294                               UShort_t sec, 
295                               UShort_t str, 
296                               UShort_t count) const;
297   /** 
298    * Converts number of ADC counts to energy deposited.   This is
299    * done by 
300    * @f[
301    * E_i = A_i g_i
302    * @f]
303    * where @f$ A_i@f$ is the pedestal subtracted ADC counts, and @f$
304    * g_i@f$ is the gain for the @f$ i^{\mbox{th}}@f$ strip. 
305    * 
306    * @param det   Detector number  
307    * @param rng   Ring identifier 
308    * @param sec   Sector number
309    * @param str   Strip number 
310    * @param eta   Psuedo-rapidity of digit.
311    * @param count Pedestal subtracted ADC counts
312    *
313    * @return Energy deposited @f$ E_i@f$ 
314    */
315   virtual Float_t  Adc2Energy(UShort_t det, 
316                               Char_t   rng, 
317                               UShort_t sec, 
318                               UShort_t str, 
319                               Float_t  eta, 
320                               UShort_t count) const;
321   /** 
322    * Converts an energy signal to number of particles. In this
323    * implementation, it's done by 
324    * @f[
325    * M_i = E_i / E_{\mbox{MIP}}
326    * @f]
327    * where @f$ E_i@f$ is the energy deposited, and 
328    * @f$ E_{\mbox{MIP}}@f$ is the average energy deposited by a
329    * minimum ionizing particle
330    * 
331    * @param det   Detector number  
332    * @param rng   Ring identifier 
333    * @param sec   Sector number
334    * @param str   Strip number 
335    * @param eta   On return, psuedo-rapidity @f$ \eta@f$
336    * @param phi   On return, azimuthal angle @f$ \varphi@f$ 
337    * @param edep Energy deposited @f$ E_i@f$
338    *
339    * @return Psuedo-inclusive multiplicity @f$ M@f$ 
340    */
341   virtual Float_t  Energy2Multiplicity(UShort_t det, 
342                                        Char_t   rng, 
343                                        UShort_t sec, 
344                                        UShort_t str, 
345                                        Float_t  edep) const;
346   /** 
347    * Calculate the physical coordinates psuedo-rapidity @f$ \eta@f$,
348    * azimuthal angle @f$ \varphi@f$ of the strip corresponding to
349    * the digit @a digit.   This is done by using the information
350    * obtained, and previously cached by AliFMDGeometry, from the
351    * TGeoManager. 
352    * 
353    * @param det   Detector number  
354    * @param rng   Ring identifier 
355    * @param sec   Sector number
356    * @param str   Strip number 
357    * @param eta   On return, psuedo-rapidity @f$ \eta@f$
358    * @param phi   On return, azimuthal angle @f$ \varphi@f$ 
359    */
360   virtual void     PhysicalCoordinates(UShort_t det, 
361                                        Char_t   rng, 
362                                        UShort_t sec, 
363                                        UShort_t str, 
364                                        Float_t& eta, 
365                                        Float_t& phi) const;
366   /** 
367    * Set-up reconstructor to use values from reconstruction
368    * parameters, if present, for this event.   If the argument @a set
369    * is @c false, then restore preset values. 
370    * 
371    * @param set 
372    */  
373   virtual void UseRecoParam(Bool_t set=kTRUE) const;
374   /** 
375    * Utility member function to get the reconstruction parameters for 
376    * this event
377    * 
378    * @return Pointer to AliFMDRecoParam object or null if not
379    * available. 
380    */
381   const AliFMDRecoParam* GetParameters() const;
382   /** 
383    * Get the numeric identifier of this detector
384    * 
385    * @return Should be 12
386    */  
387   Int_t GetIdentifier() const;
388   enum Vertex_t {
389     kNoVertex,   // Got no vertex
390     kGenVertex,  // Got generator vertex 
391     kESDVertex   // Got ESD vertex 
392   };
393   mutable TClonesArray* fMult;          // Cache of RecPoints
394   mutable Int_t         fNMult;         // Number of entries in fMult 
395   mutable TTree*        fTreeR;         // Output tree 
396   mutable Float_t       fCurrentVertex; // Z-coordinate of primary vertex
397   mutable AliESDFMD*    fESDObj;        // ESD output object
398   mutable Float_t       fNoiseFactor;   // Factor of noise to check
399   mutable Bool_t        fAngleCorrect;  // Whether to angle correct
400   mutable Vertex_t      fVertexType;    // What kind of vertex we got
401   AliESDEvent*          fESD;           // ESD object(?)
402   Bool_t                fDiagnostics;   // Wheter to do diagnostics
403   TH1*                  fDiagStep1;     // Diagnostics histogram
404   TH1*                  fDiagStep2;     // Diagnostics histogram
405   TH1*                  fDiagStep3;     // Diagnostics histogram
406   TH1*                  fDiagStep4;     // Diagnostics histogram
407   TH1*                  fDiagAll;       // Diagnostics histogram
408   mutable Bool_t        fZS[3];         // Zero-suppredded?
409   mutable UShort_t      fZSFactor[3];   // Noise factor for Zero-suppression
410 private:
411    
412   ClassDef(AliFMDReconstructor, 3)  // class for the FMD reconstruction
413 }; 
414 #endif
415 //____________________________________________________________________
416 //
417 // Local Variables:
418 //   mode: C++
419 // End:
420 //
421 // EOF
422 //