]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/AliFMDSharingFilter.h
New AliPoissonCalculator class
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliFMDSharingFilter.h
CommitLineData
7984e5f7 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
ffca499d 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 pwg2_forward_aod
18 */
7e4038b5 19#include <TNamed.h>
20#include <TH2.h>
21#include <TList.h>
9d99b0dd 22#include "AliForwardUtil.h"
d2638bb7 23#include "AliFMDMultCuts.h"
7e4038b5 24class AliESDFMD;
25class TAxis;
26class TList;
27class TH2;
5bb5d1f6 28class AliFMDFloatMap;
7e4038b5 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 * @par Input:
37 * - AliESDFMD object - from reconstruction
38 *
39 * @par Output:
40 * - AliESDFMD object - copy of input, but with signals merged
41 *
42 * @par Corrections used:
e8bf1690 43 * - AliFMDCorrELossFit
7e4038b5 44 *
45 * @par Histograms:
46 * - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of
47 * signals before and after the filter.
48 * - For each ring (see above), an array of distributions of number of
49 * hit strips for each vertex bin (if enabled - see Init method)
50 *
51 *
e8bf1690 52 * @ingroup pwg2_forward_algo
ffca499d 53 * @ingroup pwg2_forward_aod
7e4038b5 54 */
55class AliFMDSharingFilter : public TNamed
56{
57public:
5bb5d1f6 58 enum Status {
59 kNone = 1,
60 kCandidate = 2,
61 kMergedWithOther = 3,
62 kMergedInto = 4
63 };
7e4038b5 64 /**
65 * Destructor
66 */
67 virtual ~AliFMDSharingFilter();
68 /**
69 * Default Constructor - do not use
70 */
71 AliFMDSharingFilter();
72 /**
73 * Constructor
74 *
75 * @param title Title of object - not significant
76 */
77 AliFMDSharingFilter(const char* title);
78 /**
79 * Copy constructor
80 *
81 * @param o Object to copy from
82 */
83 AliFMDSharingFilter(const AliFMDSharingFilter& o);
84 /**
85 * Assignment operator
86 *
87 * @param o Object to assign from
88 *
89 * @return Reference to this
90 */
91 AliFMDSharingFilter& operator=(const AliFMDSharingFilter& o);
92
5bb5d1f6 93 /**
94 * Initialize
95 *
96 */
97 void Init();
7e4038b5 98 /**
99 * Set the low cut used for sharing
100 *
101 * @param lowCut Low cut
102 */
d2638bb7 103 void SetLowCut(Double_t lowCut=0) { fLCuts.SetMultCuts(lowCut); }
0bd4b00f 104 /**
105 * Reset the low cut for sharing to use the fit range lower cut
106 *
107 */
d2638bb7 108 void UnsetLowCut() { fLCuts.SetMultCuts(0); }
ea3e5d95 109 /**
110 * Set the debug level. The higher the value the more output
111 *
112 * @param dbg Debug level
113 */
114 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
7e4038b5 115
116 /**
117 * Enable use of angle corrected signals in the algorithm
118 *
119 * @param use If true, use angle corrected signals,
120 * otherwise use de-corrected signals. In the final output, the
121 * signals are always angle corrected.
122 */
5bb5d1f6 123 void SetUseAngleCorrectedSignals(Bool_t use) { fCorrectAngles = use; }
40196108 124 /**
125 * Enable zeroing of signals if below high cut
126 *
127 * @param use zero the signals if below sharing cut
128 *
129 */
130 void SetZeroSharedHitsBelowThreshold(Bool_t use) { fZeroSharedHitsBelowThreshold = use; }
7b212e49 131 /**
132 * Enable a simpler merging algorithm
133 *
134 * @param use use the simpler algorithm
135 *
136 */
137 void SetUseSimpleSharing(Bool_t use) { fUseSimpleMerging = use; }
0bd4b00f 138 /**
139 * Set the number of landau width to subtract from the most probably
140 * value to get the high cut for the merging algorithm.
141 *
142 * @param n Number of @f$ \xi@f$
143 */
d2638bb7 144 void SetNXi(Double_t n) { fHCuts.SetNXi(n); /* fNXi = n; */ }
5bb5d1f6 145 /**
146 * Whether to include sigma in the number subtracted from the MPV to
147 * get the high cut
148 *
149 * @param u If true, then high cut is @f$ \Delta_{mp} - n(\xi+\sigma)@f$
150 */
d2638bb7 151 void SetIncludeSigma(Bool_t u) { fHCuts.SetIncludeSigma(u); /*fIncludeSigma = u;*/ }
7e4038b5 152 /**
153 * Filter the input AliESDFMD object
154 *
155 * @param input Input
156 * @param lowFlux If this is a low-flux event
157 * @param output Output AliESDFMD object
7e4038b5 158 *
159 * @return True on success, false otherwise
160 */
161 Bool_t Filter(const AliESDFMD& input,
162 Bool_t lowFlux,
ea3e5d95 163 AliESDFMD& output);
d2638bb7 164 /**
165 *
166 * Set the fraction of MPV
167 *
168 * @param u if true cut at fraction of MPV
169 */
170 void SetFractionOfMPV(Double_t cut) { fHCuts.SetMPVFraction(cut); /* fFractionOfMPV = cut;*/ }
7e4038b5 171 /**
172 * Scale the histograms to the total number of events
173 *
c389303e 174 * @param dir Where the output is
7e4038b5 175 * @param nEvents Number of events
176 */
fb3430ac 177 virtual void ScaleHistograms(const TList* dir, Int_t nEvents);
7e4038b5 178
9d99b0dd 179 /**
180 * Define the output histograms. These are put in a sub list of the
181 * passed list. The histograms are merged before the parent task calls
182 * AliAnalysisTaskSE::Terminate
183 *
184 * @param dir Directory to add to
185 */
e8bf1690 186 virtual void DefineOutput(TList* dir);
0bd4b00f 187 /**
188 * Print information
189 *
190 * @param option Not used
191 */
e8bf1690 192 virtual void Print(Option_t* option="") const;
d2638bb7 193
194 AliFMDMultCuts& GetLCuts() { return fLCuts; }
195 AliFMDMultCuts& GetHCuts() { return fHCuts; }
196 const AliFMDMultCuts& GetLCuts() const { return fLCuts; }
197 const AliFMDMultCuts& GetHCuts() const { return fHCuts; }
198 void SetLCuts(const AliFMDMultCuts& c) { fLCuts = c; }
199 void SetHCuts(const AliFMDMultCuts& c) { fHCuts = c; }
7e4038b5 200protected:
201 /**
202 * Internal data structure to keep track of the histograms
203 */
9d99b0dd 204 struct RingHistos : public AliForwardUtil::RingHistos
7e4038b5 205 {
206 /**
207 * Default CTOR
208 */
209 RingHistos();
210 /**
211 * Constructor
212 *
213 * @param d detector
214 * @param r ring
215 */
216 RingHistos(UShort_t d, Char_t r);
217 /**
218 * Copy constructor
219 *
220 * @param o Object to copy from
221 */
222 RingHistos(const RingHistos& o);
223 /**
224 * Assignment operator
225 *
226 * @param o Object to assign from
227 *
228 * @return Reference to this
229 */
230 RingHistos& operator=(const RingHistos& o);
231 /**
232 * Destructor
233 */
234 ~RingHistos();
235 /**
c389303e 236 * Clear this object
7e4038b5 237 */
7e4038b5 238 void Clear(const Option_t* ="") { fNHits = 0; }
c389303e 239 /**
240 * Increase number of hits
241 *
242 */
7e4038b5 243 void Incr() { fNHits++; }
c389303e 244 /**
245 * Finish off
246 *
247 */
7e4038b5 248 void Finish();
c389303e 249 /**
250 * Make output
251 *
252 * @param dir where to store
253 */
7e4038b5 254 void Output(TList* dir);
9d99b0dd 255 /**
256 * Scale the histograms to the total number of events
257 *
258 * @param nEvents Number of events
c389303e 259 * @param dir Where the output is
9d99b0dd 260 */
fb3430ac 261 void ScaleHistograms(const TList* dir, Int_t nEvents);
7e4038b5 262 TH1D* fBefore; // Distribution of signals before filter
263 TH1D* fAfter; // Distribution of signals after filter
5bb5d1f6 264 TH2D* fBeforeAfter; // Correlation of before and after
265 TH2D* fNeighborsBefore; // Correlation of neighbors
266 TH2D* fNeighborsAfter; // Correlation of neighbors
267 TH2D* fSum; // Summed signal
7e4038b5 268 TH1D* fHits; // Distribution of hit strips.
269 Int_t fNHits; // Number of hit strips per event
9d99b0dd 270 ClassDef(RingHistos,1);
7e4038b5 271 };
272 /**
273 * Get the ring histogram container
274 *
275 * @param d Detector
276 * @param r Ring
277 *
278 * @return Ring histogram container
279 */
280 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
281 /**
282 * Get the signal in a strip
283 *
284 * @param fmd ESD object
285 * @param d Detector
286 * @param r Ring
287 * @param s Sector
288 * @param t Strip
289 *
290 * @return The energy signal
291 */
292 Double_t SignalInStrip(const AliESDFMD& fmd,
293 UShort_t d,
294 Char_t r,
295 UShort_t s,
296 UShort_t t) const;
297 /**
298 * The actual algorithm
299 *
300 * @param mult The unfiltered signal in the strip
301 * @param eta Psuedo rapidity
302 * @param prevE Previous strip signal (or 0)
303 * @param nextE Next strip signal (or 0)
304 * @param lowFlux Whether this is a low flux event
305 * @param d Detector
306 * @param r Ring
307 * @param s Sector
308 * @param t Strip
309 * @param usedPrev Whether the previous strip was used in sharing or not
310 * @param usedThis Wether this strip was used in sharing or not.
311 *
312 * @return The filtered signal in the strip
313 */
314 Double_t MultiplicityOfStrip(Double_t mult,
315 Double_t eta,
316 Double_t prevE,
317 Double_t nextE,
318 Bool_t lowFlux,
319 UShort_t d,
320 Char_t r,
321 UShort_t s,
322 UShort_t t,
323 Bool_t& usedPrev,
fb3430ac 324 Bool_t& usedThis) const;
5bb5d1f6 325 Double_t MultiplicityOfStrip(Double_t thisE,
326 Double_t prevE,
327 Double_t nextE,
328 Double_t eta,
329 Bool_t lowFlux,
330 UShort_t d,
331 Char_t r,
332 UShort_t s,
333 UShort_t t,
334 Status& prevStatus,
335 Status& thisStatus,
336 Status& nextStatus) const;
7e4038b5 337 /**
338 * Angle correct the signal
339 *
340 * @param mult Angle Un-corrected Signal
341 * @param eta Pseudo-rapidity
342 *
343 * @return Angle corrected signal
344 */
345 Double_t AngleCorrect(Double_t mult, Double_t eta) const;
346 /**
347 * Angle de-correct the signal
348 *
349 * @param mult Angle corrected Signal
350 * @param eta Pseudo-rapidity
351 *
352 * @return Angle un-corrected signal
353 */
354 Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
5bb5d1f6 355 /**
7e4038b5 356 * Get the high cut. The high cut is defined as the
357 * most-probably-value peak found from the energy distributions, minus
358 * 2 times the width of the corresponding Landau.
5bb5d1f6 359 *
360 * @param d Detector
361 * @param r Ring
362 * @param eta Eta value
363 * @param errors If false, do not show errors
364 *
365 * @return 0 or less on failure, otherwise @f$\Delta_{mp}-n\xi@f$
7e4038b5 366 */
5bb5d1f6 367 virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta,
368 Bool_t errors=true) const;
0bd4b00f 369 /**
370 * Get the low cut. Normally, the low cut is taken to be the lower
371 * value of the fit range used when generating the energy loss fits.
372 * However, if fLowCut is set (using SetLowCit) to a value greater
373 * than 0, then that value is used.
5bb5d1f6 374 *
375 * @param d Detector
376 * @param r Ring
377 * @param eta Eta value
378 *
379 * @return
0bd4b00f 380 */
5bb5d1f6 381 virtual Double_t GetLowCut(UShort_t d, Char_t r, Double_t eta) const;
7e4038b5 382
383 TList fRingHistos; // List of histogram containers
d2638bb7 384 // Double_t fLowCut; // Low cut on sharing
7e4038b5 385 Bool_t fCorrectAngles; // Whether to work on angle corrected signals
5bb5d1f6 386 Double_t fNXi; // Number of xi's from Delta to stop merging
387 Bool_t fIncludeSigma; // Whether to include sigma in cut
388 TH2* fSummed; // Operations histogram
389 TH2* fHighCuts; // High cuts used
d2638bb7 390 TH2* fLowCuts; // High cuts used
5bb5d1f6 391 AliFMDFloatMap* fOper; // Operation done per strip
ea3e5d95 392 Int_t fDebug; // Debug level
40196108 393 Bool_t fZeroSharedHitsBelowThreshold; //Whether to zero shared strip below cut
d2638bb7 394 AliFMDMultCuts fLCuts;
395 AliFMDMultCuts fHCuts;
7b212e49 396 Bool_t fUseSimpleMerging;
d2638bb7 397 ClassDef(AliFMDSharingFilter,3); //
7e4038b5 398};
399
400#endif
401// Local Variables:
402// mode: C++
403// End: