]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AliFMDSharingFilter.h
Added method mgr->AddStatisticsTask(offlineMask) that allows to configure the statist...
[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 #include "AliForwardUtil.h"
7 class AliESDFMD;
8 class TAxis;
9 class TList;
10 class TH2;
11
12 /**
13  * Class to do the sharing correction.  That is, a filter that merges 
14  * adjacent strip signals presumably originating from a single particle 
15  * that impinges on the detector in such a way that it deposite energy 
16  * into two or more strips. 
17  *
18  * @par Input: 
19  *    - AliESDFMD object  - from reconstruction
20  *
21  * @par Output: 
22  *    - AliESDFMD object  - copy of input, but with signals merged 
23  *
24  * @par Corrections used: 
25  *    - AliFMDCorrELossFit
26  *
27  * @par Histograms: 
28  *    - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of 
29  *      signals before and after the filter.  
30  *    - For each ring (see above), an array of distributions of number of 
31  *      hit strips for each vertex bin (if enabled - see Init method)
32  * 
33  *
34  * @ingroup pwg2_forward_algo 
35  */
36 class AliFMDSharingFilter : public TNamed
37 {
38 public: 
39   /** 
40    * Destructor
41    */
42   virtual ~AliFMDSharingFilter();
43   /** 
44    * Default Constructor - do not use 
45    */
46   AliFMDSharingFilter();
47   /** 
48    * Constructor 
49    * 
50    * @param title Title of object  - not significant 
51    */
52   AliFMDSharingFilter(const char* title);
53   /** 
54    * Copy constructor 
55    * 
56    * @param o Object to copy from 
57    */
58   AliFMDSharingFilter(const AliFMDSharingFilter& o);
59   /** 
60    * Assignment operator 
61    * 
62    * @param o Object to assign from 
63    * 
64    * @return Reference to this 
65    */
66   AliFMDSharingFilter& operator=(const AliFMDSharingFilter& o);
67
68   /** 
69    * Set the low cut used for sharing 
70    * 
71    * @param lowCut Low cut
72    */
73   void SetLowCut(Double_t lowCut=0) { fLowCut = lowCut; }
74   /** 
75    * Reset the low cut for sharing to use the fit range lower cut 
76    * 
77    */
78   void UnsetLowCut() { fLowCut = 0; }
79   /** 
80    * Set the debug level.  The higher the value the more output 
81    * 
82    * @param dbg Debug level 
83    */
84   void SetDebug(Int_t dbg=1) { fDebug = dbg; }
85
86   /** 
87    * Enable use of angle corrected signals in the algorithm 
88    * 
89    * @param use If true, use angle corrected signals, 
90    * otherwise use de-corrected signals.  In the final output, the 
91    * signals are always angle corrected. 
92    */
93   void UseAngleCorrectedSignals(Bool_t use) { fCorrectAngles = use; }
94   /** 
95    * Set the number of landau width to subtract from the most probably
96    * value to get the high cut for the merging algorithm.
97    * 
98    * @param n Number of @f$ \xi@f$ 
99    */
100   void SetNXi(Short_t n) { fNXi = n; }
101   /** 
102    * Filter the input AliESDFMD object
103    * 
104    * @param input     Input 
105    * @param lowFlux   If this is a low-flux event 
106    * @param output    Output AliESDFMD object 
107    * 
108    * @return True on success, false otherwise 
109    */
110   Bool_t Filter(const AliESDFMD& input, 
111                 Bool_t           lowFlux, 
112                 AliESDFMD&       output);
113   /** 
114    * Scale the histograms to the total number of events 
115    * 
116    * @param dir     Where the output is 
117    * @param nEvents Number of events 
118    */
119   virtual void ScaleHistograms(TList* dir, Int_t nEvents);
120   
121   /** 
122    * Define the output histograms.  These are put in a sub list of the
123    * passed list.   The histograms are merged before the parent task calls 
124    * AliAnalysisTaskSE::Terminate 
125    * 
126    * @param dir Directory to add to 
127    */
128   virtual void DefineOutput(TList* dir);
129   /** 
130    * Print information
131    * 
132    * @param option Not used 
133    */
134   virtual void Print(Option_t* option="") const;
135 protected:
136   /** 
137    * Internal data structure to keep track of the histograms
138    */
139   struct RingHistos : public AliForwardUtil::RingHistos
140   { 
141     /** 
142      * Default CTOR
143      */
144     RingHistos();
145     /** 
146      * Constructor
147      * 
148      * @param d detector
149      * @param r ring 
150      */
151     RingHistos(UShort_t d, Char_t r);
152     /** 
153      * Copy constructor 
154      * 
155      * @param o Object to copy from 
156      */
157     RingHistos(const RingHistos& o);
158     /** 
159      * Assignment operator 
160      * 
161      * @param o Object to assign from 
162      * 
163      * @return Reference to this 
164      */
165     RingHistos& operator=(const RingHistos& o);
166     /** 
167      * Destructor 
168      */
169     ~RingHistos();
170     /** 
171      * Clear this object
172      */
173     void Clear(const Option_t* ="") { fNHits = 0; } 
174     /** 
175      * Increase number of hits 
176      * 
177      */
178     void Incr() { fNHits++; } 
179     /** 
180      * Finish off 
181      * 
182      */
183     void Finish(); 
184     /** 
185      * Make output 
186      * 
187      * @param dir where to store 
188      */
189     void Output(TList* dir);
190     /** 
191      * Scale the histograms to the total number of events 
192      * 
193      * @param nEvents Number of events 
194      * @param dir     Where the output is 
195      */
196     void ScaleHistograms(TList* dir, Int_t nEvents);
197     TH1D*     fBefore;       // Distribution of signals before filter
198     TH1D*     fAfter;        // Distribution of signals after filter
199     TH1D*     fHits;         // Distribution of hit strips. 
200     Int_t     fNHits;        // Number of hit strips per event
201     ClassDef(RingHistos,1);
202   };
203   /** 
204    * Get the ring histogram container 
205    * 
206    * @param d Detector
207    * @param r Ring 
208    * 
209    * @return Ring histogram container 
210    */
211   RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
212   /** 
213    * Get the signal in a strip 
214    * 
215    * @param fmd   ESD object
216    * @param d     Detector
217    * @param r     Ring 
218    * @param s     Sector 
219    * @param t     Strip
220    * 
221    * @return The energy signal 
222    */
223   Double_t SignalInStrip(const AliESDFMD& fmd, 
224                          UShort_t d,
225                          Char_t   r,
226                          UShort_t s,
227                          UShort_t t) const;
228   /** 
229    * The actual algorithm 
230    * 
231    * @param mult      The unfiltered signal in the strip
232    * @param eta       Psuedo rapidity 
233    * @param prevE     Previous strip signal (or 0)
234    * @param nextE     Next strip signal (or 0) 
235    * @param lowFlux   Whether this is a low flux event 
236    * @param d         Detector
237    * @param r         Ring 
238    * @param s         Sector 
239    * @param t         Strip
240    * @param usedPrev  Whether the previous strip was used in sharing or not
241    * @param usedThis  Wether this strip was used in sharing or not. 
242    * 
243    * @return The filtered signal in the strip
244    */
245   Double_t MultiplicityOfStrip(Double_t mult,
246                                Double_t eta,
247                                Double_t prevE,
248                                Double_t nextE,
249                                Bool_t   lowFlux,
250                                UShort_t d,
251                                Char_t   r,
252                                UShort_t s,
253                                UShort_t t,
254                                Bool_t&  usedPrev, 
255                                Bool_t&  usedThis);
256   /** 
257    * Angle correct the signal 
258    * 
259    * @param mult Angle Un-corrected Signal 
260    * @param eta  Pseudo-rapidity 
261    * 
262    * @return Angle corrected signal 
263    */
264   Double_t AngleCorrect(Double_t mult, Double_t eta) const;
265   /** 
266    * Angle de-correct the signal 
267    * 
268    * @param mult Angle corrected Signal 
269    * @param eta  Pseudo-rapidity 
270    * 
271    * @return Angle un-corrected signal 
272    */
273   Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
274   /**
275    * Get the high cut.  The high cut is defined as the 
276    * most-probably-value peak found from the energy distributions, minus 
277    * 2 times the width of the corresponding Landau.
278    */
279   virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta) const;
280   /**
281    * Get the low cut.  Normally, the low cut is taken to be the lower
282    * value of the fit range used when generating the energy loss fits.
283    * However, if fLowCut is set (using SetLowCit) to a value greater
284    * than 0, then that value is used.
285    */
286   virtual Double_t GetLowCut() const;
287
288   TList    fRingHistos;    // List of histogram containers
289   Double_t fLowCut;        // Low cut on sharing
290   Bool_t   fCorrectAngles; // Whether to work on angle corrected signals
291   Short_t  fNXi;           // Number of xi's from Delta to stop merging
292   Int_t    fDebug;         // Debug level 
293
294   ClassDef(AliFMDSharingFilter,1); //
295 };
296
297 #endif
298 // Local Variables:
299 //  mode: C++ 
300 // End: