]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AliFMDSharingFilter.h
Changes for Root6: removing obsolete TH1 functions, corrected EINCLUDE, additional...
[u/mrichter/AliRoot.git] / PWGLF / 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 *
bd6f5206 17 * @ingroup pwglf_forward_aod
ffca499d 18 */
7e4038b5 19#include <TNamed.h>
20#include <TH2.h>
21#include <TList.h>
9d99b0dd 22#include "AliForwardUtil.h"
d2638bb7 23#include "AliFMDMultCuts.h"
1f7aa5c7 24#include <TBits.h>
7e4038b5 25class AliESDFMD;
26class TAxis;
27class TList;
28class TH2;
5bb5d1f6 29class AliFMDFloatMap;
7e4038b5 30
31/**
32 * Class to do the sharing correction. That is, a filter that merges
33 * adjacent strip signals presumably originating from a single particle
34 * that impinges on the detector in such a way that it deposite energy
35 * into two or more strips.
36 *
37 * @par Input:
38 * - AliESDFMD object - from reconstruction
39 *
40 * @par Output:
41 * - AliESDFMD object - copy of input, but with signals merged
42 *
43 * @par Corrections used:
e8bf1690 44 * - AliFMDCorrELossFit
7e4038b5 45 *
46 * @par Histograms:
47 * - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of
48 * signals before and after the filter.
49 * - For each ring (see above), an array of distributions of number of
5934a3e3 50 * hit strips for each vertex bin (if enabled - see SetupForData method)
7e4038b5 51 *
52 *
bd6f5206 53 * @ingroup pwglf_forward_algo
54 * @ingroup pwglf_forward_aod
7e4038b5 55 */
56class AliFMDSharingFilter : public TNamed
57{
58public:
8449e3e0 59 /**
60 * Status of a strip
61 * @deprecated Not used
62 */
5bb5d1f6 63 enum Status {
290052e7 64 /** Nothing yet */
5bb5d1f6 65 kNone = 1,
290052e7 66 /** Candidate for merging */
5bb5d1f6 67 kCandidate = 2,
290052e7 68 /** This was merged into other strip */
5bb5d1f6 69 kMergedWithOther = 3,
290052e7 70 /** Other strips was merged into this */
5bb5d1f6 71 kMergedInto = 4
72 };
7e4038b5 73 /**
74 * Destructor
75 */
76 virtual ~AliFMDSharingFilter();
77 /**
78 * Default Constructor - do not use
79 */
80 AliFMDSharingFilter();
81 /**
82 * Constructor
83 *
84 * @param title Title of object - not significant
85 */
86 AliFMDSharingFilter(const char* title);
87 /**
88 * Copy constructor
89 *
90 * @param o Object to copy from
91 */
92 AliFMDSharingFilter(const AliFMDSharingFilter& o);
93 /**
94 * Assignment operator
95 *
96 * @param o Object to assign from
97 *
98 * @return Reference to this
99 */
100 AliFMDSharingFilter& operator=(const AliFMDSharingFilter& o);
101
5bb5d1f6 102 /**
103 * Initialize
104 *
66cf95f2 105 * @param axis Default eta axis from parent task
5bb5d1f6 106 */
5934a3e3 107 void SetupForData(const TAxis& axis);
ea3e5d95 108 /**
109 * Set the debug level. The higher the value the more output
110 *
111 * @param dbg Debug level
112 */
4bcdcbc1 113 virtual void SetDebug(Int_t dbg=1) { fDebug = dbg; }
7e4038b5 114
115 /**
116 * Enable use of angle corrected signals in the algorithm
117 *
118 * @param use If true, use angle corrected signals,
119 * otherwise use de-corrected signals. In the final output, the
120 * signals are always angle corrected.
121 */
5bb5d1f6 122 void SetUseAngleCorrectedSignals(Bool_t use) { fCorrectAngles = use; }
40196108 123 /**
124 * Enable zeroing of signals if below high cut
125 *
126 * @param use zero the signals if below sharing cut
127 *
128 */
129 void SetZeroSharedHitsBelowThreshold(Bool_t use) { fZeroSharedHitsBelowThreshold = use; }
7b212e49 130 /**
131 * Enable a simpler merging algorithm
132 *
133 * @param use use the simpler algorithm
134 *
135 */
136 void SetUseSimpleSharing(Bool_t use) { fUseSimpleMerging = use; }
d1013ccf 137 /**
138 * In case of a simpler merging algorithm allow 3 strips to be
139 * merged
140 *
141 * @param use allow three strips
142 *
143 */
144 void SetAllow3Strips(Bool_t use) { fThreeStripSharing = use; }
6f4a5c0d 145
146 /**
147 * In case of a displaced vertices recalculate eta and angle correction
148 *
149 * @param use recalculate or not
150 *
151 */
152 void SetRecalculateEta(Bool_t use) { fRecalculateEta = use; }
8449e3e0 153 /**
154 * Set whether to consider invalid multiplicities as null (or empty)
155 * signal.
156 *
157 * @param flag If true, count invalids as empty
158 */
159 void SetInvalidIsEmpty(Bool_t flag) { fInvalidIsEmpty = flag; }
6f4a5c0d 160
7e4038b5 161 /**
162 * Filter the input AliESDFMD object
163 *
164 * @param input Input
165 * @param lowFlux If this is a low-flux event
166 * @param output Output AliESDFMD object
290052e7 167 * @param zvtx Vertex position
7e4038b5 168 *
169 * @return True on success, false otherwise
170 */
171 Bool_t Filter(const AliESDFMD& input,
172 Bool_t lowFlux,
6f4a5c0d 173 AliESDFMD& output,
174 Double_t zvtx);
7e4038b5 175 /**
176 * Scale the histograms to the total number of events
177 *
c389303e 178 * @param dir Where the output is
33438b4c 179 * @param output Output list
7e4038b5 180 * @param nEvents Number of events
181 */
5934a3e3 182 virtual void Terminate(const TList* dir, TList* output, Int_t nEvents);
7e4038b5 183
9d99b0dd 184 /**
185 * Define the output histograms. These are put in a sub list of the
186 * passed list. The histograms are merged before the parent task calls
187 * AliAnalysisTaskSE::Terminate
188 *
189 * @param dir Directory to add to
190 */
5934a3e3 191 virtual void CreateOutputObjects(TList* dir);
0bd4b00f 192 /**
193 * Print information
194 *
195 * @param option Not used
196 */
e8bf1690 197 virtual void Print(Option_t* option="") const;
d2638bb7 198
290052e7 199 /**
200 * Get the low cuts
201 *
202 * @return Reference to low cuts
203 */
d2638bb7 204 AliFMDMultCuts& GetLCuts() { return fLCuts; }
290052e7 205 /**
206 * Get the high cuts
207 *
208 * @return Reference to high cuts
209 */
d2638bb7 210 AliFMDMultCuts& GetHCuts() { return fHCuts; }
290052e7 211 /**
212 * Get the low cuts
213 *
214 * @return Reference to low cuts
215 */
d2638bb7 216 const AliFMDMultCuts& GetLCuts() const { return fLCuts; }
290052e7 217 /**
218 * Get the high cuts
219 *
220 * @return Reference to high cuts
221 */
d2638bb7 222 const AliFMDMultCuts& GetHCuts() const { return fHCuts; }
290052e7 223 /**
224 * Set the low cuts
225 *
226 * @param c Cuts object
227 */
d2638bb7 228 void SetLCuts(const AliFMDMultCuts& c) { fLCuts = c; }
290052e7 229 /**
230 * Set the high cuts
231 *
232 * @param c Cuts object
233 */
d2638bb7 234 void SetHCuts(const AliFMDMultCuts& c) { fHCuts = c; }
8449e3e0 235 /**
236 * Add a dead strip
237 *
238 * @param d Detector
239 * @param r Ring
240 * @param s Sector
241 * @param t Strip
242 */
5ca83fee 243 void AddDead(UShort_t d, Char_t r, UShort_t s, UShort_t t);
8449e3e0 244 /**
245 * Add a dead region in a detector ring
246 *
247 * @param d Detector
248 * @param r Ring
249 * @param s1 First sector (inclusive)
250 * @param s2 Last sector (inclusive)
251 * @param t1 First strip (inclusive)
252 * @param t2 Last strip (inclusive)
253 */
5ca83fee 254 void AddDeadRegion(UShort_t d, Char_t r, UShort_t s1, UShort_t s2,
255 UShort_t t1, UShort_t t2);
bfab35d9 256 /**
257 * Add dead strips from a script. The script is supposed to accept
258 * a pointer to this object (AliFMDSharingFilter) and then call
259 * AddDead or AddDeadRegion as needed.
260 *
261 * @code
262 * void deadstrips(AliFMDSharingFilter* filter)
263 * {
264 * filter->AddDead(...);
265 * // ... and so on
266 * }
267 * @endcode
268 *
269 * @param script The script to read dead strips from.
270 */
271 void AddDead(const Char_t* script);
7e4038b5 272protected:
273 /**
274 * Internal data structure to keep track of the histograms
275 */
9d99b0dd 276 struct RingHistos : public AliForwardUtil::RingHistos
7e4038b5 277 {
278 /**
279 * Default CTOR
280 */
281 RingHistos();
282 /**
283 * Constructor
284 *
285 * @param d detector
286 * @param r ring
287 */
288 RingHistos(UShort_t d, Char_t r);
289 /**
290 * Copy constructor
291 *
292 * @param o Object to copy from
293 */
294 RingHistos(const RingHistos& o);
295 /**
296 * Assignment operator
297 *
298 * @param o Object to assign from
299 *
300 * @return Reference to this
301 */
302 RingHistos& operator=(const RingHistos& o);
303 /**
304 * Destructor
305 */
306 ~RingHistos();
307 /**
c389303e 308 * Clear this object
7e4038b5 309 */
8449e3e0 310 // void Clear(const Option_t* ="") { fNHits = 0; }
c389303e 311 /**
312 * Increase number of hits
313 *
314 */
8449e3e0 315 // void Incr() { fNHits++; }
c389303e 316 /**
317 * Finish off
318 *
319 */
8449e3e0 320 // void Finish();
c389303e 321 /**
322 * Make output
323 *
324 * @param dir where to store
325 */
5934a3e3 326 void CreateOutputObjects(TList* dir);
9d99b0dd 327 /**
328 * Scale the histograms to the total number of events
329 *
330 * @param nEvents Number of events
c389303e 331 * @param dir Where the output is
9d99b0dd 332 */
5934a3e3 333 void Terminate(const TList* dir, Int_t nEvents);
7e4038b5 334 TH1D* fBefore; // Distribution of signals before filter
335 TH1D* fAfter; // Distribution of signals after filter
f26a8959 336 TH1D* fSingle; // Distribution of 1 signal after filter
337 TH1D* fDouble; // Distribution of 2 signals after filter
338 TH1D* fTriple; // Distribution of 3 signals after filter
339 TH2D* fSinglePerStrip; // Distribution of 1 signal per strip
8449e3e0 340 // TH1D* fDistanceBefore; //Distance between signals before sharing
341 // TH1D* fDistanceAfter; //Distance between signals after sharing
5bb5d1f6 342 TH2D* fBeforeAfter; // Correlation of before and after
343 TH2D* fNeighborsBefore; // Correlation of neighbors
344 TH2D* fNeighborsAfter; // Correlation of neighbors
345 TH2D* fSum; // Summed signal
8449e3e0 346 // TH1D* fHits; // Distribution of hit strips.
347 // Int_t fNHits; // Number of hit strips per event
348 ClassDef(RingHistos,3);
7e4038b5 349 };
350 /**
351 * Get the ring histogram container
352 *
353 * @param d Detector
354 * @param r Ring
355 *
356 * @return Ring histogram container
357 */
358 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
359 /**
360 * Get the signal in a strip
361 *
362 * @param fmd ESD object
363 * @param d Detector
364 * @param r Ring
365 * @param s Sector
366 * @param t Strip
367 *
368 * @return The energy signal
369 */
370 Double_t SignalInStrip(const AliESDFMD& fmd,
371 UShort_t d,
372 Char_t r,
373 UShort_t s,
374 UShort_t t) const;
7e4038b5 375 /**
376 * Angle correct the signal
377 *
378 * @param mult Angle Un-corrected Signal
379 * @param eta Pseudo-rapidity
380 *
381 * @return Angle corrected signal
382 */
383 Double_t AngleCorrect(Double_t mult, Double_t eta) const;
384 /**
385 * Angle de-correct the signal
386 *
387 * @param mult Angle corrected Signal
388 * @param eta Pseudo-rapidity
389 *
390 * @return Angle un-corrected signal
391 */
392 Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
5bb5d1f6 393 /**
7e4038b5 394 * Get the high cut. The high cut is defined as the
395 * most-probably-value peak found from the energy distributions, minus
396 * 2 times the width of the corresponding Landau.
5bb5d1f6 397 *
398 * @param d Detector
399 * @param r Ring
400 * @param eta Eta value
401 * @param errors If false, do not show errors
402 *
403 * @return 0 or less on failure, otherwise @f$\Delta_{mp}-n\xi@f$
7e4038b5 404 */
5bb5d1f6 405 virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta,
406 Bool_t errors=true) const;
0bd4b00f 407 /**
408 * Get the low cut. Normally, the low cut is taken to be the lower
409 * value of the fit range used when generating the energy loss fits.
410 * However, if fLowCut is set (using SetLowCit) to a value greater
411 * than 0, then that value is used.
5bb5d1f6 412 *
413 * @param d Detector
414 * @param r Ring
415 * @param eta Eta value
416 *
417 * @return
0bd4b00f 418 */
5bb5d1f6 419 virtual Double_t GetLowCut(UShort_t d, Char_t r, Double_t eta) const;
7e4038b5 420
5ca83fee 421 virtual Bool_t IsDead(UShort_t d, Char_t r, UShort_t s, UShort_t t) const;
7e4038b5 422 TList fRingHistos; // List of histogram containers
d2638bb7 423 // Double_t fLowCut; // Low cut on sharing
7e4038b5 424 Bool_t fCorrectAngles; // Whether to work on angle corrected signals
8449e3e0 425 // TH2* fSummed; // Operations histogram
5bb5d1f6 426 TH2* fHighCuts; // High cuts used
d2638bb7 427 TH2* fLowCuts; // High cuts used
8449e3e0 428 // AliFMDFloatMap* fOper; // Operation done per strip
ea3e5d95 429 Int_t fDebug; // Debug level
40196108 430 Bool_t fZeroSharedHitsBelowThreshold; //Whether to zero shared strip below cut
d1013ccf 431 AliFMDMultCuts fLCuts; //Cuts object for low cuts
432 AliFMDMultCuts fHCuts; //Cuts object for high cuts
433 Bool_t fUseSimpleMerging; //enable simple sharing by HHD
434 Bool_t fThreeStripSharing; //In case of simple sharing allow 3 strips
6f4a5c0d 435 Bool_t fRecalculateEta; //Whether to recalculate eta and angle correction (disp vtx)
1f7aa5c7 436 // TArrayI fExtraDead; // List of extra dead channels
437 TBits fXtraDead;
8449e3e0 438 Bool_t fInvalidIsEmpty; // Consider kInvalidMult as zero
439
440 ClassDef(AliFMDSharingFilter,8); //
7e4038b5 441};
442
443#endif
444// Local Variables:
445// mode: C++
446// End: