]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/AliFMDSharingFilter.h
Change to raw OCDB in case not yet set
[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 *
c6115ede 168 * @param cut Fraction of MPV
d2638bb7 169 */
c6115ede 170 void SetFractionOfMPV(Double_t cut) { fHCuts.SetMPVFraction(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
f26a8959 264 TH1D* fSingle; // Distribution of 1 signal after filter
265 TH1D* fDouble; // Distribution of 2 signals after filter
266 TH1D* fTriple; // Distribution of 3 signals after filter
267 TH2D* fSinglePerStrip; // Distribution of 1 signal per strip
7f1cfdfd 268 TH1D* fDistanceBefore; //Distance between signals before sharing
269 TH1D* fDistanceAfter; //Distance between signals after sharing
5bb5d1f6 270 TH2D* fBeforeAfter; // Correlation of before and after
271 TH2D* fNeighborsBefore; // Correlation of neighbors
272 TH2D* fNeighborsAfter; // Correlation of neighbors
273 TH2D* fSum; // Summed signal
7e4038b5 274 TH1D* fHits; // Distribution of hit strips.
275 Int_t fNHits; // Number of hit strips per event
9d99b0dd 276 ClassDef(RingHistos,1);
7e4038b5 277 };
278 /**
279 * Get the ring histogram container
280 *
281 * @param d Detector
282 * @param r Ring
283 *
284 * @return Ring histogram container
285 */
286 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
287 /**
288 * Get the signal in a strip
289 *
290 * @param fmd ESD object
291 * @param d Detector
292 * @param r Ring
293 * @param s Sector
294 * @param t Strip
295 *
296 * @return The energy signal
297 */
298 Double_t SignalInStrip(const AliESDFMD& fmd,
299 UShort_t d,
300 Char_t r,
301 UShort_t s,
302 UShort_t t) const;
303 /**
304 * The actual algorithm
305 *
306 * @param mult The unfiltered signal in the strip
307 * @param eta Psuedo rapidity
308 * @param prevE Previous strip signal (or 0)
309 * @param nextE Next strip signal (or 0)
310 * @param lowFlux Whether this is a low flux event
311 * @param d Detector
312 * @param r Ring
313 * @param s Sector
314 * @param t Strip
315 * @param usedPrev Whether the previous strip was used in sharing or not
316 * @param usedThis Wether this strip was used in sharing or not.
317 *
318 * @return The filtered signal in the strip
319 */
320 Double_t MultiplicityOfStrip(Double_t mult,
321 Double_t eta,
322 Double_t prevE,
323 Double_t nextE,
324 Bool_t lowFlux,
325 UShort_t d,
326 Char_t r,
327 UShort_t s,
328 UShort_t t,
329 Bool_t& usedPrev,
fb3430ac 330 Bool_t& usedThis) const;
5bb5d1f6 331 Double_t MultiplicityOfStrip(Double_t thisE,
332 Double_t prevE,
333 Double_t nextE,
334 Double_t eta,
335 Bool_t lowFlux,
336 UShort_t d,
337 Char_t r,
338 UShort_t s,
339 UShort_t t,
340 Status& prevStatus,
341 Status& thisStatus,
342 Status& nextStatus) const;
7e4038b5 343 /**
344 * Angle correct the signal
345 *
346 * @param mult Angle Un-corrected Signal
347 * @param eta Pseudo-rapidity
348 *
349 * @return Angle corrected signal
350 */
351 Double_t AngleCorrect(Double_t mult, Double_t eta) const;
352 /**
353 * Angle de-correct the signal
354 *
355 * @param mult Angle corrected Signal
356 * @param eta Pseudo-rapidity
357 *
358 * @return Angle un-corrected signal
359 */
360 Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
5bb5d1f6 361 /**
7e4038b5 362 * Get the high cut. The high cut is defined as the
363 * most-probably-value peak found from the energy distributions, minus
364 * 2 times the width of the corresponding Landau.
5bb5d1f6 365 *
366 * @param d Detector
367 * @param r Ring
368 * @param eta Eta value
369 * @param errors If false, do not show errors
370 *
371 * @return 0 or less on failure, otherwise @f$\Delta_{mp}-n\xi@f$
7e4038b5 372 */
5bb5d1f6 373 virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta,
374 Bool_t errors=true) const;
0bd4b00f 375 /**
376 * Get the low cut. Normally, the low cut is taken to be the lower
377 * value of the fit range used when generating the energy loss fits.
378 * However, if fLowCut is set (using SetLowCit) to a value greater
379 * than 0, then that value is used.
5bb5d1f6 380 *
381 * @param d Detector
382 * @param r Ring
383 * @param eta Eta value
384 *
385 * @return
0bd4b00f 386 */
5bb5d1f6 387 virtual Double_t GetLowCut(UShort_t d, Char_t r, Double_t eta) const;
7e4038b5 388
389 TList fRingHistos; // List of histogram containers
d2638bb7 390 // Double_t fLowCut; // Low cut on sharing
7e4038b5 391 Bool_t fCorrectAngles; // Whether to work on angle corrected signals
5bb5d1f6 392 Double_t fNXi; // Number of xi's from Delta to stop merging
393 Bool_t fIncludeSigma; // Whether to include sigma in cut
394 TH2* fSummed; // Operations histogram
395 TH2* fHighCuts; // High cuts used
d2638bb7 396 TH2* fLowCuts; // High cuts used
5bb5d1f6 397 AliFMDFloatMap* fOper; // Operation done per strip
ea3e5d95 398 Int_t fDebug; // Debug level
40196108 399 Bool_t fZeroSharedHitsBelowThreshold; //Whether to zero shared strip below cut
d2638bb7 400 AliFMDMultCuts fLCuts;
401 AliFMDMultCuts fHCuts;
7b212e49 402 Bool_t fUseSimpleMerging;
d2638bb7 403 ClassDef(AliFMDSharingFilter,3); //
7e4038b5 404};
405
406#endif
407// Local Variables:
408// mode: C++
409// End: