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