]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AliFMDSharingFilter.h
New implementation of the forward multiplicity analysis.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliFMDSharingFilter.h
1 #ifndef ALIROOT_PWG2_FORWARD_ALIFMDSHARINGFILTER_H
2 #define ALIROOT_PWG2_FORWARD_ALIFMDSHARINGFILTER_H
3 #include <TNamed.h>
4 #include <TH2.h>
5 #include <TList.h>
6 class AliESDFMD;
7 class TAxis;
8 class TList;
9 class TH2;
10
11 /**
12  * Class to do the sharing correction.  That is, a filter that merges 
13  * adjacent strip signals presumably originating from a single particle 
14  * that impinges on the detector in such a way that it deposite energy 
15  * into two or more strips. 
16  *
17  * @par Input: 
18  *    - AliESDFMD object  - from reconstruction
19  *
20  * @par Output: 
21  *    - AliESDFMD object  - copy of input, but with signals merged 
22  *
23  * @par Corrections used: 
24  *    - AliFMDAnaCalibEnergyDistribution objects 
25  *
26  * @par Histograms: 
27  *    - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of 
28  *      signals before and after the filter.  
29  *    - For each ring (see above), an array of distributions of number of 
30  *      hit strips for each vertex bin (if enabled - see Init method)
31  * 
32  *
33  * @ingroup pwg2_forward_analysis 
34  */
35 class AliFMDSharingFilter : public TNamed
36 {
37 public: 
38   /** 
39    * Destructor
40    */
41   virtual ~AliFMDSharingFilter();
42   /** 
43    * Default Constructor - do not use 
44    */
45   AliFMDSharingFilter();
46   /** 
47    * Constructor 
48    * 
49    * @param title Title of object  - not significant 
50    */
51   AliFMDSharingFilter(const char* title);
52   /** 
53    * Copy constructor 
54    * 
55    * @param o Object to copy from 
56    */
57   AliFMDSharingFilter(const AliFMDSharingFilter& o);
58   /** 
59    * Assignment operator 
60    * 
61    * @param o Object to assign from 
62    * 
63    * @return Reference to this 
64    */
65   AliFMDSharingFilter& operator=(const AliFMDSharingFilter& o);
66
67   /** 
68    * Initialise the filter 
69    * 
70    */
71   void   Init() {}
72   /** 
73    * Set the low cut used for sharing 
74    * 
75    * @param lowCut Low cut
76    */
77   void SetLowCut(Double_t lowCut=0.3) { fLowCut = lowCut; }
78
79   /** 
80    * Enable use of angle corrected signals in the algorithm 
81    * 
82    * @param use If true, use angle corrected signals, 
83    * otherwise use de-corrected signals.  In the final output, the 
84    * signals are always angle corrected. 
85    */
86   void UseAngleCorrectedSignals(Bool_t use) { fCorrectAngles = use; }
87   /** 
88    * Filter the input AliESDFMD object
89    * 
90    * @param input     Input 
91    * @param lowFlux   If this is a low-flux event 
92    * @param output    Output AliESDFMD object 
93    * @param vz        Current vertex position 
94    * 
95    * @return True on success, false otherwise 
96    */
97   Bool_t Filter(const AliESDFMD& input, 
98                 Bool_t           lowFlux, 
99                 AliESDFMD&       output,
100                 Double_t         vz);
101   /** 
102    * Scale the histograms to the total number of events 
103    * 
104    * @param nEvents Number of events 
105    */
106   void ScaleHistograms(Int_t nEvents);
107   
108   void Output(TList* dir);
109 protected:
110   /** 
111    * Internal data structure to keep track of the histograms
112    */
113   struct RingHistos : public TObject 
114   { 
115     /** 
116      * Default CTOR
117      */
118     RingHistos();
119     /** 
120      * Constructor
121      * 
122      * @param d detector
123      * @param r ring 
124      */
125     RingHistos(UShort_t d, Char_t r);
126     /** 
127      * Copy constructor 
128      * 
129      * @param o Object to copy from 
130      */
131     RingHistos(const RingHistos& o);
132     /** 
133      * Assignment operator 
134      * 
135      * @param o Object to assign from 
136      * 
137      * @return Reference to this 
138      */
139     RingHistos& operator=(const RingHistos& o);
140     /** 
141      * Destructor 
142      */
143     ~RingHistos();
144     /** 
145      * Initialise this object 
146      */
147     void Init() {} 
148     void Clear(const Option_t* ="") { fNHits = 0; } 
149     void Incr() { fNHits++; } 
150     void Finish(); 
151     void Output(TList* dir);
152     UShort_t  fDet;          // Detector
153     Char_t    fRing;         // Ring
154     TH1D*     fBefore;       // Distribution of signals before filter
155     TH1D*     fAfter;        // Distribution of signals after filter
156     TH1D*     fHits;         // Distribution of hit strips. 
157     Int_t     fNHits;        // Number of hit strips per event
158   };
159   /** 
160    * Get the ring histogram container 
161    * 
162    * @param d Detector
163    * @param r Ring 
164    * 
165    * @return Ring histogram container 
166    */
167   RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
168   /** 
169    * Get the signal in a strip 
170    * 
171    * @param fmd   ESD object
172    * @param d     Detector
173    * @param r     Ring 
174    * @param s     Sector 
175    * @param t     Strip
176    * 
177    * @return The energy signal 
178    */
179   Double_t SignalInStrip(const AliESDFMD& fmd, 
180                          UShort_t d,
181                          Char_t   r,
182                          UShort_t s,
183                          UShort_t t) const;
184   /** 
185    * The actual algorithm 
186    * 
187    * @param mult      The unfiltered signal in the strip
188    * @param eta       Psuedo rapidity 
189    * @param prevE     Previous strip signal (or 0)
190    * @param nextE     Next strip signal (or 0) 
191    * @param lowFlux   Whether this is a low flux event 
192    * @param d         Detector
193    * @param r         Ring 
194    * @param s         Sector 
195    * @param t         Strip
196    * @param usedPrev  Whether the previous strip was used in sharing or not
197    * @param usedThis  Wether this strip was used in sharing or not. 
198    * 
199    * @return The filtered signal in the strip
200    */
201   Double_t MultiplicityOfStrip(Double_t mult,
202                                Double_t eta,
203                                Double_t prevE,
204                                Double_t nextE,
205                                Bool_t   lowFlux,
206                                UShort_t d,
207                                Char_t   r,
208                                UShort_t s,
209                                UShort_t t,
210                                Bool_t&  usedPrev, 
211                                Bool_t&  usedThis);
212   /** 
213    * Angle correct the signal 
214    * 
215    * @param mult Angle Un-corrected Signal 
216    * @param eta  Pseudo-rapidity 
217    * 
218    * @return Angle corrected signal 
219    */
220   Double_t AngleCorrect(Double_t mult, Double_t eta) const;
221   /** 
222    * Angle de-correct the signal 
223    * 
224    * @param mult Angle corrected Signal 
225    * @param eta  Pseudo-rapidity 
226    * 
227    * @return Angle un-corrected signal 
228    */
229   Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
230   /**
231    * Get the high cut.  The high cut is defined as the 
232    * most-probably-value peak found from the energy distributions, minus 
233    * 2 times the width of the corresponding Landau.
234    */
235   virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta) const;
236
237   TList    fRingHistos;    // List of histogram containers
238   Double_t fLowCut;        // Low cut on sharing
239   Bool_t   fCorrectAngles; // Whether to work on angle corrected signals
240   TH2*     fEtaCorr;
241
242   ClassDef(AliFMDSharingFilter,1); //
243 };
244
245 #endif
246 // Local Variables:
247 //  mode: C++ 
248 // End: