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