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