]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDReconstructor.h
Added calculation of a strip in a FMD ring
[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    * Not used 
122    */
123   virtual void   SetESD(AliESDEvent* esd) { fESD = esd; }
124   /** 
125    * Set the noise factor 
126    *
127    * @param f Factor to use 
128    */
129   virtual void SetNoiseFactor(Float_t f=3) { fNoiseFactor = f; }
130   /** 
131    * Set whether we should do angle correction or nor 
132    *
133    * @param use If true, do angle correction 
134    */
135   virtual void SetAngleCorrect(Bool_t use=kTRUE) { fAngleCorrect = use; }
136   /** 
137    * Set whether we want to do diagnostics.  If this is enabled, a
138    * file named @c FMD.Diag.root will be made.  It contains a set of
139    * histograms for each event, filed in separate directories in the
140    * file.  The histograms are 
141    * @verbatim 
142    * diagStep1   Read ADC vs. Noise surpressed ADC 
143    * diagStep2   Noise surpressed ADC vs. calculated Energy dep.
144    * diagStep3   Energy deposition vs. angle corrected Energy dep.
145    * diagStep4   Energy deposition vs. calculated multiplicity
146    * diagAll     Read ADC vs. calculated multiplicity
147    * @endverbatim 
148    *
149    * @param use If true, make the diagnostics file 
150    */
151   void SetDiagnose(Bool_t use=kTRUE) { fDiagnostics = use; }
152 protected:
153   /** 
154    * Copy CTOR 
155    *
156    * @param other Object to copy from. 
157    */
158   AliFMDReconstructor(const AliFMDReconstructor& other);
159   /** 
160    * Assignment operator 
161    *
162    * @param other Object to assign from
163    *
164    * @return reference to this object 
165    */
166   AliFMDReconstructor& operator=(const AliFMDReconstructor& other);
167   /** 
168    * Try to get the vertex from either ESD or generator header.  Sets
169    * @c fCurrentVertex to the found Z posistion of the vertex (if 
170    * found), and sets the flag @c fVertexType accordingly 
171    */
172   virtual void GetVertex() const;
173   /** 
174    * Process AliFMDDigit objects in @a digits.  For each digit, find
175    * the psuedo-rapidity @f$ \eta@f$, azimuthal angle @f$ \varphi@f$,
176    * energy deposited @f$ E@f$, and psuedo-inclusive multiplicity @f$
177    * M@f$.
178    * 
179    * @param digits Array of digits. 
180    */
181   virtual void     ProcessDigits(TClonesArray* digits) const;
182   /** 
183    * Process a single digit 
184    * 
185    * @param digit Digiti to process
186    */ 
187   virtual void ProcessDigit(AliFMDDigit* digit) const;
188   /** 
189    * Process the signal from a single strip. 
190    * 
191    * @param det Detector number 
192    * @param rng Ring identifier 
193    * @param sec Sector number
194    * @param str Strip number 
195    * @param adc Number of ADC counts for this strip
196    */  
197   virtual void ProcessSignal(UShort_t det, 
198                              Char_t   rng, 
199                              UShort_t sec, 
200                              UShort_t str, 
201                              Short_t  adc) const;
202   /** 
203    * Substract pedestals from raw ADC in @a digit
204    * 
205    * @param det   Detector number  
206    * @param rng   Ring identifier 
207    * @param sec   Sector number
208    * @param str   Strip number 
209    * @param adc   Number of ADC counts
210    *
211    * @return Pedestal subtracted ADC count. 
212    */
213   virtual UShort_t SubtractPedestal(UShort_t det, 
214                                     Char_t   rng, 
215                                     UShort_t sec, 
216                                     UShort_t str, 
217                                     Short_t  adc) const;
218   /** 
219    * Converts number of ADC counts to energy deposited.   This is
220    * done by 
221    * @f[
222    * E_i = A_i g_i
223    * @f]
224    * where @f$ A_i@f$ is the pedestal subtracted ADC counts, and @f$
225    * g_i@f$ is the gain for the @f$ i^{\mbox{th}}@f$ strip. 
226    * 
227    * @param det   Detector number  
228    * @param rng   Ring identifier 
229    * @param sec   Sector number
230    * @param str   Strip number 
231    * @param eta   Psuedo-rapidity of digit.
232    * @param count Pedestal subtracted ADC counts
233    *
234    * @return Energy deposited @f$ E_i@f$ 
235    */
236   virtual Float_t  Adc2Energy(UShort_t det, 
237                               Char_t   rng, 
238                               UShort_t sec, 
239                               UShort_t str, 
240                               Float_t  eta, 
241                               UShort_t count) const;
242   /** 
243    * Converts an energy signal to number of particles. In this
244    * implementation, it's done by 
245    * @f[
246    * M_i = E_i / E_{\mbox{MIP}}
247    * @f]
248    * where @f$ E_i@f$ is the energy deposited, and 
249    * @f$ E_{\mbox{MIP}}@f$ is the average energy deposited by a
250    * minimum ionizing particle
251    * 
252    * @param det   Detector number  
253    * @param rng   Ring identifier 
254    * @param sec   Sector number
255    * @param str   Strip number 
256    * @param eta   On return, psuedo-rapidity @f$ \eta@f$
257    * @param phi   On return, azimuthal angle @f$ \varphi@f$ 
258    * @param edep Energy deposited @f$ E_i@f$
259    *
260    * @return Psuedo-inclusive multiplicity @f$ M@f$ 
261    */
262   virtual Float_t  Energy2Multiplicity(UShort_t det, 
263                                        Char_t   rng, 
264                                        UShort_t sec, 
265                                        UShort_t str, 
266                                        Float_t  edep) const;
267   /** 
268    * Calculate the physical coordinates psuedo-rapidity @f$ \eta@f$,
269    * azimuthal angle @f$ \varphi@f$ of the strip corresponding to
270    * the digit @a digit.   This is done by using the information
271    * obtained, and previously cached by AliFMDGeometry, from the
272    * TGeoManager. 
273    * 
274    * @param det   Detector number  
275    * @param rng   Ring identifier 
276    * @param sec   Sector number
277    * @param str   Strip number 
278    * @param eta   On return, psuedo-rapidity @f$ \eta@f$
279    * @param phi   On return, azimuthal angle @f$ \varphi@f$ 
280    */
281   virtual void     PhysicalCoordinates(UShort_t det, 
282                                        Char_t   rng, 
283                                        UShort_t sec, 
284                                        UShort_t str, 
285                                        Float_t& eta, 
286                                        Float_t& phi) const;
287   
288   enum Vertex_t {
289     kNoVertex,   // Got no vertex
290     kGenVertex,  // Got generator vertex 
291     kESDVertex   // Got ESD vertex 
292   };
293   mutable TClonesArray* fMult;          // Cache of RecPoints
294   mutable Int_t         fNMult;         // Number of entries in fMult 
295   mutable TTree*        fTreeR;         // Output tree 
296   mutable Float_t       fCurrentVertex; // Z-coordinate of primary vertex
297   mutable AliESDFMD*    fESDObj;        // ESD output object
298   Float_t               fNoiseFactor;   // Factor of noise to check
299   Bool_t                fAngleCorrect;  // Whether to angle correct
300   mutable Vertex_t      fVertexType;    // What kind of vertex we got
301   AliESDEvent*          fESD;           // ESD object(?)
302   Bool_t                fDiagnostics;   // Wheter to do diagnostics
303   TH1*                  fDiagStep1;     // Diagnostics histogram
304   TH1*                  fDiagStep2;     // Diagnostics histogram
305   TH1*                  fDiagStep3;     // Diagnostics histogram
306   TH1*                  fDiagStep4;     // Diagnostics histogram
307   TH1*                  fDiagAll;       // Diagnostics histogram
308   mutable Bool_t        fZS[3];         // Zero-suppredded?
309   mutable UShort_t      fZSFactor[3];   // Noise factor for Zero-suppression
310 private:
311    
312   ClassDef(AliFMDReconstructor, 3)  // class for the FMD reconstruction
313 }; 
314 #endif
315 //____________________________________________________________________
316 //
317 // Local Variables:
318 //   mode: C++
319 // End:
320 //
321 // EOF
322 //