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