]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDSharingFilter.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / 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 /**
10  * @file   AliFMDSharingFilter.h
11  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
12  * @date   Wed Mar 23 14:03:57 2011
13  * 
14  * @brief  
15  * 
16  * 
17  * @ingroup pwglf_forward_aod
18  */
19 #include <TNamed.h>
20 #include <TH2.h>
21 #include <TList.h>
22 #include "AliForwardUtil.h"
23 #include "AliFMDMultCuts.h"
24 class AliESDFMD;
25 class TAxis;
26 class TList;
27 class TH2;
28 class AliFMDFloatMap;
29
30 /**
31  * Class to do the sharing correction.  That is, a filter that merges 
32  * adjacent strip signals presumably originating from a single particle 
33  * that impinges on the detector in such a way that it deposite energy 
34  * into two or more strips. 
35  *
36  * @image html alice-int-2012-040-share_fraction.png "Energy loss sharing"
37  *
38  * @par Input: 
39  *    - AliESDFMD object  - from reconstruction
40  *
41  * @par Output: 
42  *    - AliESDFMD object  - copy of input, but with signals merged 
43  *
44  * @par Corrections used: 
45  *    - AliFMDCorrELossFit
46  *
47  * @par Histograms: 
48  *    - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of 
49  *      signals before and after the filter.  
50  *    - For each ring (see above), an array of distributions of number of 
51  *      hit strips for each vertex bin (if enabled - see SetupForData method)
52  * 
53  *
54  * @ingroup pwglf_forward_algo 
55  * @ingroup pwglf_forward_aod
56  */
57 class AliFMDSharingFilter : public TNamed
58 {
59 public: 
60   /** 
61    * Status of a strip 
62    * @deprecated Not used
63    */
64   enum Status { 
65     /** Nothing yet */
66     kNone             = 1, 
67     /** Candidate for merging */
68     kCandidate        = 2, 
69     /** This was merged into other strip */
70     kMergedWithOther  = 3, 
71     /** Other strips was merged into this */
72     kMergedInto       = 4
73   };
74   /** 
75    * Destructor
76    */
77   virtual ~AliFMDSharingFilter();
78   /** 
79    * Default Constructor - do not use 
80    */
81   AliFMDSharingFilter();
82   /** 
83    * Constructor 
84    * 
85    * @param title Title of object  - not significant 
86    */
87   AliFMDSharingFilter(const char* title);
88
89   /** 
90    * @{ 
91    * @name Parameters etc.
92    */
93   /** 
94    * If called with a true argument, then merging is wholy disabled 
95    * 
96    * @param disable If true, disable merging altogether 
97    */
98   virtual void SetMergingDisabled(Bool_t disable) {fMergingDisabled = disable; }
99   /** 
100    * Set the debug level.  The higher the value the more output 
101    * 
102    * @param dbg Debug level 
103    */
104   virtual void SetDebug(Int_t dbg=1) { fDebug = dbg; }
105   /** 
106    * Enable use of angle corrected signals in the algorithm 
107    * 
108    * @param use If true, use angle corrected signals, 
109    * otherwise use de-corrected signals.  In the final output, the 
110    * signals are always angle corrected. 
111    */
112   void SetUseAngleCorrectedSignals(Bool_t use) { fCorrectAngles = use; }
113    /** 
114    * Enable zeroing of signals if below high cut
115    * 
116    * @param use zero the signals if below sharing cut
117    * 
118    */
119   void SetZeroSharedHitsBelowThreshold(Bool_t use) { fZeroSharedHitsBelowThreshold = use; }
120  /** 
121    * Enable a simpler merging algorithm
122    * 
123    * @param use use the simpler algorithm
124    * 
125    */
126   void SetUseSimpleSharing(Bool_t use) { fUseSimpleMerging = use; }
127   /** 
128    * In case of a simpler merging algorithm allow 3 strips to be 
129    * merged
130    * 
131    * @param use allow three strips
132    * 
133    */
134   void SetAllow3Strips(Bool_t use) { fThreeStripSharing = use; }  
135   /**
136    * Set whether to ignore the ESD info when angle correcting, this
137    * is to counter a known issue where the info in the ESD is incorrect
138    * 
139    * @param use ignore the ESD info
140    */
141   void SetIgnoreESDWhenAngleCorrecting(Bool_t use) { fIgnoreESDForAngleCorrection = use; }
142   /* @} */
143
144   /** 
145    * @{ 
146    * @name Processing 
147    */
148   /** 
149    * Initialize 
150    * 
151    * @param axis Default eta axis from parent task 
152    */
153   void SetupForData(const TAxis& axis);
154   /** 
155    * Filter the input AliESDFMD object
156    * 
157    * @param input     Input 
158    * @param lowFlux   If this is a low-flux event 
159    * @param output    Output AliESDFMD object 
160    * @param zvtx      Vertex position 
161    * 
162    * @return True on success, false otherwise 
163    */
164   Bool_t Filter(const AliESDFMD& input, 
165                 Bool_t           lowFlux, 
166                 AliESDFMD&       output, 
167                 Double_t         zvtx);
168   /** 
169    * Scale the histograms to the total number of events 
170    * 
171    * @param dir     Where the output is 
172    * @param output  Output list
173    * @param nEvents Number of events 
174    */
175   virtual void Terminate(const TList* dir, TList* output, Int_t nEvents);  
176   /** 
177    * Define the output histograms.  These are put in a sub list of the
178    * passed list.   The histograms are merged before the parent task calls 
179    * AliAnalysisTaskSE::Terminate 
180    * 
181    * @param dir Directory to add to 
182    */
183   virtual void CreateOutputObjects(TList* dir);
184   /* @} */
185   /** 
186    * Print information
187    * 
188    * @param option Not used 
189    */
190   virtual void Print(Option_t* option="") const;
191
192   /** 
193    * @{ 
194    * @name Cuts
195    */
196   /** 
197    * Get the low cuts 
198    * 
199    * @return Reference to low cuts
200    */
201   AliFMDMultCuts& GetLCuts() { return fLCuts; }
202   /** 
203    * Get the high cuts 
204    * 
205    * @return Reference to high cuts
206    */
207   AliFMDMultCuts& GetHCuts() { return fHCuts; }
208   /** 
209    * Get the low cuts 
210    * 
211    * @return Reference to low cuts
212    */
213   const AliFMDMultCuts& GetLCuts() const { return fLCuts; }
214   /** 
215    * Get the high cuts 
216    * 
217    * @return Reference to high cuts
218    */
219   const AliFMDMultCuts& GetHCuts() const { return fHCuts; }
220   /** 
221    * Set the low cuts 
222    * 
223    * @param c Cuts object
224    */  
225   void SetLCuts(const AliFMDMultCuts& c) { fLCuts = c; }
226   /** 
227    * Set the high cuts 
228    * 
229    * @param c Cuts object
230    */  
231   void SetHCuts(const AliFMDMultCuts& c) { fHCuts = c; }
232   /* @} */
233 protected:
234   /** 
235    * Copy constructor - not implemented
236    */
237   AliFMDSharingFilter(const AliFMDSharingFilter& o){;}
238   /** 
239    * Assignment operator  - not implemented
240    * 
241    * @return Reference to this 
242    */
243   AliFMDSharingFilter& operator=(const AliFMDSharingFilter& o){return *this;}
244   /** 
245    * Internal data structure to keep track of the histograms
246    */
247   struct RingHistos : public AliForwardUtil::RingHistos
248   { 
249     /** 
250      * Default CTOR
251      */
252     RingHistos();
253     /** 
254      * Constructor
255      * 
256      * @param d detector
257      * @param r ring 
258      */
259     RingHistos(UShort_t d, Char_t r);
260     /** 
261      * Copy constructor 
262      * 
263      * @param o Object to copy from 
264      */
265     RingHistos(const RingHistos& o);
266     /** 
267      * Assignment operator 
268      * 
269      * @param o Object to assign from 
270      * 
271      * @return Reference to this 
272      */
273     RingHistos& operator=(const RingHistos& o);
274     /** 
275      * Destructor 
276      */
277     ~RingHistos();
278     /** 
279      * Clear this object
280      */
281     // void Clear(const Option_t* ="") { fNHits = 0; } 
282     /** 
283      * Increase number of hits 
284      * 
285      */
286     // void Incr() { fNHits++; } 
287     /** 
288      * Finish off 
289      * 
290      */
291     // void Finish(); 
292     /** 
293      * Make output 
294      * 
295      * @param dir where to store 
296      */
297     void CreateOutputObjects(TList* dir);
298     /** 
299      * Scale the histograms to the total number of events 
300      * 
301      * @param nEvents Number of events 
302      * @param dir     Where the output is 
303      */
304     void Terminate(const TList* dir, Int_t nEvents);
305     TH1D*     fBefore;          // Distribution of signals before filter
306     TH1D*     fAfter;           // Distribution of signals after filter
307     TH1D*     fSingle;          // Distribution of 1 signal after filter
308     TH1D*     fDouble;          // Distribution of 2 signals after filter
309     TH1D*     fTriple;          // Distribution of 3 signals after filter
310     TH2D*     fSinglePerStrip;  // Distribution of 1 signal per strip
311     TH2D*     fBeforeAfter;     // Correlation of before and after 
312     TH2D*     fNeighborsBefore; // Correlation of neighbors 
313     TH2D*     fNeighborsAfter;  // Correlation of neighbors 
314     TH2D*     fSumESD;          // Summed ESD signal 
315     TH2D*     fSum;             // Summed cluster signal 
316     TH1D*     fNConsecutive;    // # consecutive strips with signal > low cut
317     ClassDef(RingHistos,4);
318   };
319   /** 
320    * Get the ring histogram container 
321    * 
322    * @param d Detector
323    * @param r Ring 
324    * 
325    * @return Ring histogram container 
326    */
327   RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
328   /** 
329    * Get the signal in a strip 
330    * 
331    * @param fmd   ESD object
332    * @param d     Detector
333    * @param r     Ring 
334    * @param s     Sector 
335    * @param t     Strip
336    * 
337    * @return The energy signal 
338    */
339   Double_t SignalInStrip(const AliESDFMD& fmd, 
340                          UShort_t d,
341                          Char_t   r,
342                          UShort_t s,
343                          UShort_t t) const;
344   /** 
345    * Angle correct the signal 
346    * 
347    * @param mult Angle Un-corrected Signal 
348    * @param eta  Pseudo-rapidity 
349    * 
350    * @return Angle corrected signal 
351    */
352   Double_t AngleCorrect(Double_t mult, Double_t eta) const;
353   /** 
354    * Angle de-correct the signal 
355    * 
356    * @param mult Angle corrected Signal 
357    * @param eta  Pseudo-rapidity 
358    * 
359    * @return Angle un-corrected signal 
360    */
361   Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
362   /** 
363    * Get the high cut.  The high cut is defined as the 
364    * most-probably-value peak found from the energy distributions, minus 
365    * 2 times the width of the corresponding Landau.
366    * 
367    * @param d      Detector 
368    * @param r      Ring 
369    * @param eta    Eta value 
370    * @param errors If false, do not show errors 
371    * 
372    * @return 0 or less on failure, otherwise @f$\Delta_{mp}-n\xi@f$ 
373    */
374   virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta,
375                               Bool_t errors=true) const;
376   /**
377    * Get the low cut.  Normally, the low cut is taken to be the lower
378    * value of the fit range used when generating the energy loss fits.
379    * However, if fLowCut is set (using SetLowCit) to a value greater
380    * than 0, then that value is used.
381    *
382    * @param d    Detector
383    * @param r    Ring 
384    * @param eta  Eta value 
385    * 
386    * @return 
387    */
388   virtual Double_t GetLowCut(UShort_t d, Char_t r, Double_t eta) const;
389   TList    fRingHistos;      // List of histogram containers
390   Bool_t   fCorrectAngles;   // Whether to work on angle corrected signals
391   TH2*     fHighCuts;        // High cuts used
392   TH2*     fLowCuts;         // High cuts used
393   Int_t    fDebug;           // Debug level 
394   Bool_t   fZeroSharedHitsBelowThreshold; // Zero shared strip below cut?
395   AliFMDMultCuts fLCuts;     // Cuts object for low cuts
396   AliFMDMultCuts fHCuts;     // Cuts object for high cuts
397   Bool_t   fUseSimpleMerging;// enable simple sharing by HHD
398   Bool_t   fThreeStripSharing; //In case of simple sharing allow 3 strips
399   Bool_t   fMergingDisabled; // If true, do not merge
400   Bool_t   fIgnoreESDForAngleCorrection; // Ignore ESD information when angle correcting
401   ClassDef(AliFMDSharingFilter,11); //
402 };
403
404 #endif
405 // Local Variables:
406 //  mode: C++ 
407 // End: