]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDReconstructor.h
New class AliESDEvent, backward compatibility with the old AliESD (Christian)
[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
28 //____________________________________________________________________
29 class TTree;
30 class TClonesArray;
31 class AliFMDDigit;
32 class AliRawReader;
33 class AliRunLoader;
34 class AliESDEvent;
35 class AliESDFMD;
36 class TH1;
37
38
39 /** @defgroup FMD_rec Reconstruction */
40 //____________________________________________________________________
41 /** @brief This is a class that reconstructs AliFMDRecPoint objects from of
42     Digits.  
43     This class reads either digits from a TClonesArray or raw data
44     from a DDL file (or similar), and applies calibrations to get
45     psuedo-inclusive multiplicities per strip.
46
47     @ingroup FMD_rec
48  */
49 class AliFMDReconstructor: public AliReconstructor 
50 {
51 public:
52   /** CTOR */
53   AliFMDReconstructor();
54   /** DTOR */
55   virtual ~AliFMDReconstructor();
56
57   /** Initialize the reconstructor.  Here, we initialize the geometry
58       manager, and finds the local to global transformations from the
59       geometry.   The calibration parameter manager is also
60       initialized (meaning that the calibration parameters is read
61       from CDB).   Next, we try to get some information about the run
62       from the run loader passed. 
63       @param runLoader Run loader to use to load and store data. 
64   */
65   virtual void   Init(AliRunLoader* runLoader);
66   /** Flag that we can convert raw data into digits. 
67       @return always @c true */
68   virtual Bool_t HasDigitConversion() const { return kTRUE; }
69   /** Convert raw data read from the AliRawReader @a reader into
70       digits.  This is done using AliFMDRawReader and
71       AliFMDAltroReader.  The digits are put in the passed TTree @a
72       digitsTree. 
73       @param reader     Raw reader. 
74       @param digitsTree Tree to store read digits in. */
75   virtual void   ConvertDigits(AliRawReader* reader, TTree* digitsTree) const;
76   /** Flag that we can do one-event reconstruction. 
77       @return always @c true  */
78   virtual Bool_t HasLocalReconstruction() const { return kTRUE; }
79   /** Reconstruct one event from the digits passed in @a digitsTree.
80       The member function creates AliFMDRecPoint objects and stores
81       them on the output tree @a clusterTree.  An FMD ESD object is
82       created in parallel. 
83       @todo Make sure we get a vertex. 
84       @param digitsTree  Tree holding the digits of this event
85       @param clusterTree Tree to store AliFMDRecPoint objects in. */
86   virtual void   Reconstruct(TTree* digitsTree, TTree* clusterTree) const;
87   /** Put in the ESD data, the FMD ESD data.  The object created by
88       the Reconstruct member function is copied to the ESD object. 
89       @param digitsTree   Tree of digits for this event - not used
90       @param clusterTree  Tree of reconstructed points for this event
91       - not used. 
92       @param esd ESD object to store data in. 
93   */
94   virtual void   FillESD(TTree* digitsTree, TTree* clusterTree, 
95                          AliESDEvent* esd) const;
96   /** Not used */
97   virtual void   SetESD(AliESDEvent* esd) { fESD = esd; }
98   /** Set the noise factor 
99       @param f Factor to use */
100   virtual void SetNoiseFactor(Float_t f=3) { fNoiseFactor = f; }
101   /** Set whether we should do angle correction or nor 
102       @param use If true, do angle correction */
103   virtual void SetAngleCorrect(Bool_t use=kTRUE) { fAngleCorrect = use; }
104   /** Set whether we want to do diagnostics.  If this is enabled, a
105       file named @c FMD.Diag.root will be made.  It contains a set of
106       histograms for each event, filed in separate directories in the
107       file.  The histograms are 
108       @verbatim 
109       diagStep1   Read ADC vs. Noise surpressed ADC 
110       diagStep2   Noise surpressed ADC vs. calculated Energy dep.
111       diagStep3   Energy deposition vs. angle corrected Energy dep.
112       diagStep4   Energy deposition vs. calculated multiplicity
113       diagAll     Read ADC vs. calculated multiplicity
114       @endverbatim 
115       @param use If true, make the diagnostics file */
116   void SetDiagnose(Bool_t use=kTRUE) { fDiagnostics = use; }
117 protected:
118   /** Copy CTOR 
119       @param other Object to copy from. */
120   AliFMDReconstructor(const AliFMDReconstructor& other);
121   /** Assignment operator 
122       @param other Object to assign from
123       @return reference to this object */
124   AliFMDReconstructor& operator=(const AliFMDReconstructor& other);
125   /** Try to get the vertex from either ESD or generator header.  Sets
126       @c fCurrentVertex to the found Z posistion of the vertex (if 
127       found), and sets the flag @c fVertexType accordingly */
128   virtual void GetVertex() const;
129   /** Process AliFMDDigit objects in @a digits.  For each digit, find
130       the psuedo-rapidity @f$ \eta@f$, azimuthal angle @f$ \varphi@f$,
131       energy deposited @f$ E@f$, and psuedo-inclusive multiplicity @f$
132       M@f$.
133       @param digits Array of digits. */
134   virtual void     ProcessDigits(TClonesArray* digits) const;
135   /** Substract pedestals from raw ADC in @a digit
136       @param digit Digit data
137       @return Pedestal subtracted ADC count. */
138   virtual UShort_t SubtractPedestal(AliFMDDigit* digit) const;
139   /** Converts number of ADC counts to energy deposited.   This is
140       done by 
141       @f[
142       E_i = A_i g_i
143       @f]
144       where @f$ A_i@f$ is the pedestal subtracted ADC counts, and @f$
145       g_i@f$ is the gain for the @f$ i^{\mbox{th}}@f$ strip. 
146       @param digit Raw data
147       @param eta   Psuedo-rapidity of digit.
148       @param count Pedestal subtracted ADC counts
149       @return Energy deposited @f$ E_i@f$ */
150   virtual Float_t  Adc2Energy(AliFMDDigit* digit, Float_t eta, 
151                               UShort_t count) const;
152   /** Converts an energy signal to number of particles. In this
153       implementation, it's done by 
154       @f[
155       M_i = E_i / E_{\mbox{MIP}}
156       @f]
157       where @f$ E_i@f$ is the energy deposited, and @f$
158       E_{\mbox{MIP}}@f$ is the average energy deposited by a minimum
159       ionizing particle
160       @param digit Raw data
161       @param edep Energy deposited @f$ E_i@f$
162       @return Psuedo-inclusive multiplicity @f$ M@f$ */
163   virtual Float_t  Energy2Multiplicity(AliFMDDigit* digit, Float_t edep) const;
164   /** Calculate the physical coordinates psuedo-rapidity @f$ \eta@f$,
165       azimuthal angle @f$ \varphi@f$ of the strip corresponding to
166       the digit @a digit.   This is done by using the information
167       obtained, and previously cached by AliFMDGeometry, from the
168       TGeoManager. 
169       @param digit Digit.
170       @param eta   On return, psuedo-rapidity @f$ \eta@f$
171       @param phi   On return, azimuthal angle @f$ \varphi@f$ */
172   virtual void     PhysicalCoordinates(AliFMDDigit* digit, Float_t& eta, 
173                                        Float_t& phi) const;
174   
175   enum Vertex_t {
176     kNoVertex,   // Got no vertex
177     kGenVertex,  // Got generator vertex 
178     kESDVertex   // Got ESD vertex 
179   };
180   mutable TClonesArray* fMult;          // Cache of RecPoints
181   mutable Int_t         fNMult;         // Number of entries in fMult 
182   mutable TTree*        fTreeR;         // Output tree 
183   mutable Float_t       fCurrentVertex; // Z-coordinate of primary vertex
184   mutable AliESDFMD*    fESDObj;        // ESD output object
185   Float_t               fNoiseFactor;   // Factor of noise to check
186   Bool_t                fAngleCorrect;  // Whether to angle correct
187   mutable Vertex_t      fVertexType;    // What kind of vertex we got
188   AliRunLoader*         fRunLoader;     // Run loader passed to Init  
189   AliESDEvent*          fESD;           // ESD object(?)
190   Bool_t                fDiagnostics;   // Wheter to do diagnostics
191   TH1*                  fDiagStep1;     // Diagnostics histogram
192   TH1*                  fDiagStep2;     // Diagnostics histogram
193   TH1*                  fDiagStep3;     // Diagnostics histogram
194   TH1*                  fDiagStep4;     // Diagnostics histogram
195   TH1*                  fDiagAll;       // Diagnostics histogram
196 private:
197   /** Hide base classes unused function */
198   void Reconstruct(AliRawReader*, TTree*) const;
199   /** Hide base classes unused function */
200   void Reconstruct(AliRunLoader*) const;
201   /** Hide base classes unused function */
202   void Reconstruct(AliRunLoader*, AliRawReader*) const;
203   /** Hide base classes unused function */
204   void FillESD(AliRawReader*, TTree*, AliESDEvent*) const;
205   /** Hide base classes unused function */
206   void FillESD(AliRunLoader*, AliESDEvent*) const;
207   /** Hide base classes unused function */
208   void FillESD(AliRunLoader*, AliRawReader*, AliESDEvent*) const;
209   
210   ClassDef(AliFMDReconstructor, 1)  // class for the FMD reconstruction
211 }; 
212 #endif
213 //____________________________________________________________________
214 //
215 // Local Variables:
216 //   mode: C++
217 // End:
218 //
219 // EOF
220 //