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.
7 #ifndef ALIFMDSHARINGFILTER_H
8 #define ALIFMDSHARINGFILTER_H
10 * @file AliFMDSharingFilter.h
11 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
12 * @date Wed Mar 23 14:03:57 2011
17 * @ingroup pwglf_forward_aod
22 #include "AliForwardUtil.h"
23 #include "AliFMDMultCuts.h"
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.
37 * @image html alice-int-2012-040-share_fraction.png "Energy loss sharing"
40 * - AliESDFMD object - from reconstruction
43 * - AliESDFMD object - copy of input, but with signals merged
45 * @par Corrections used:
46 * - AliFMDCorrELossFit
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
52 * hit strips for each vertex bin (if enabled - see SetupForData method)
55 * @ingroup pwglf_forward_algo
56 * @ingroup pwglf_forward_aod
58 class AliFMDSharingFilter : public TNamed
63 * @deprecated Not used
68 /** Candidate for merging */
70 /** This was merged into other strip */
72 /** Other strips was merged into this */
78 virtual ~AliFMDSharingFilter();
80 * Default Constructor - do not use
82 AliFMDSharingFilter();
86 * @param title Title of object - not significant
88 AliFMDSharingFilter(const char* title);
92 * @param o Object to copy from
94 AliFMDSharingFilter(const AliFMDSharingFilter& o);
98 * @param o Object to assign from
100 * @return Reference to this
102 AliFMDSharingFilter& operator=(const AliFMDSharingFilter& o);
107 * @param axis Default eta axis from parent task
109 void SetupForData(const TAxis& axis);
111 * Set the debug level. The higher the value the more output
113 * @param dbg Debug level
115 virtual void SetDebug(Int_t dbg=1) { fDebug = dbg; }
118 * Enable use of angle corrected signals in the algorithm
120 * @param use If true, use angle corrected signals,
121 * otherwise use de-corrected signals. In the final output, the
122 * signals are always angle corrected.
124 void SetUseAngleCorrectedSignals(Bool_t use) { fCorrectAngles = use; }
126 * Enable zeroing of signals if below high cut
128 * @param use zero the signals if below sharing cut
131 void SetZeroSharedHitsBelowThreshold(Bool_t use) { fZeroSharedHitsBelowThreshold = use; }
133 * Enable a simpler merging algorithm
135 * @param use use the simpler algorithm
138 void SetUseSimpleSharing(Bool_t use) { fUseSimpleMerging = use; }
140 * In case of a simpler merging algorithm allow 3 strips to be
143 * @param use allow three strips
146 void SetAllow3Strips(Bool_t use) { fThreeStripSharing = use; }
149 * In case of a displaced vertices recalculate eta and angle correction
151 * @param use recalculate or not
154 void SetRecalculateEta(Bool_t use) { fRecalculateEta = use; }
156 * Set whether to consider invalid multiplicities as null (or empty)
159 * @param flag If true, count invalids as empty
161 void SetInvalidIsEmpty(Bool_t flag) { fInvalidIsEmpty = flag; }
164 * Filter the input AliESDFMD object
167 * @param lowFlux If this is a low-flux event
168 * @param output Output AliESDFMD object
169 * @param zvtx Vertex position
171 * @return True on success, false otherwise
173 Bool_t Filter(const AliESDFMD& input,
178 * Scale the histograms to the total number of events
180 * @param dir Where the output is
181 * @param output Output list
182 * @param nEvents Number of events
184 virtual void Terminate(const TList* dir, TList* output, Int_t nEvents);
187 * Define the output histograms. These are put in a sub list of the
188 * passed list. The histograms are merged before the parent task calls
189 * AliAnalysisTaskSE::Terminate
191 * @param dir Directory to add to
193 virtual void CreateOutputObjects(TList* dir);
197 * @param option Not used
199 virtual void Print(Option_t* option="") const;
204 * @return Reference to low cuts
206 AliFMDMultCuts& GetLCuts() { return fLCuts; }
210 * @return Reference to high cuts
212 AliFMDMultCuts& GetHCuts() { return fHCuts; }
216 * @return Reference to low cuts
218 const AliFMDMultCuts& GetLCuts() const { return fLCuts; }
222 * @return Reference to high cuts
224 const AliFMDMultCuts& GetHCuts() const { return fHCuts; }
228 * @param c Cuts object
230 void SetLCuts(const AliFMDMultCuts& c) { fLCuts = c; }
234 * @param c Cuts object
236 void SetHCuts(const AliFMDMultCuts& c) { fHCuts = c; }
245 void AddDead(UShort_t d, Char_t r, UShort_t s, UShort_t t);
247 * Add a dead region in a detector ring
251 * @param s1 First sector (inclusive)
252 * @param s2 Last sector (inclusive)
253 * @param t1 First strip (inclusive)
254 * @param t2 Last strip (inclusive)
256 void AddDeadRegion(UShort_t d, Char_t r, UShort_t s1, UShort_t s2,
257 UShort_t t1, UShort_t t2);
259 * Add dead strips from a script. The script is supposed to accept
260 * a pointer to this object (AliFMDSharingFilter) and then call
261 * AddDead or AddDeadRegion as needed.
264 * void deadstrips(AliFMDSharingFilter* filter)
266 * filter->AddDead(...);
271 * @param script The script to read dead strips from.
273 void AddDead(const Char_t* script);
276 * Internal data structure to keep track of the histograms
278 struct RingHistos : public AliForwardUtil::RingHistos
290 RingHistos(UShort_t d, Char_t r);
294 * @param o Object to copy from
296 RingHistos(const RingHistos& o);
298 * Assignment operator
300 * @param o Object to assign from
302 * @return Reference to this
304 RingHistos& operator=(const RingHistos& o);
312 // void Clear(const Option_t* ="") { fNHits = 0; }
314 * Increase number of hits
317 // void Incr() { fNHits++; }
326 * @param dir where to store
328 void CreateOutputObjects(TList* dir);
330 * Scale the histograms to the total number of events
332 * @param nEvents Number of events
333 * @param dir Where the output is
335 void Terminate(const TList* dir, Int_t nEvents);
336 TH1D* fBefore; // Distribution of signals before filter
337 TH1D* fAfter; // Distribution of signals after filter
338 TH1D* fSingle; // Distribution of 1 signal after filter
339 TH1D* fDouble; // Distribution of 2 signals after filter
340 TH1D* fTriple; // Distribution of 3 signals after filter
341 TH2D* fSinglePerStrip; // Distribution of 1 signal per strip
342 // TH1D* fDistanceBefore; //Distance between signals before sharing
343 // TH1D* fDistanceAfter; //Distance between signals after sharing
344 TH2D* fBeforeAfter; // Correlation of before and after
345 TH2D* fNeighborsBefore; // Correlation of neighbors
346 TH2D* fNeighborsAfter; // Correlation of neighbors
347 TH2D* fSum; // Summed signal
348 // TH1D* fHits; // Distribution of hit strips.
349 // Int_t fNHits; // Number of hit strips per event
350 ClassDef(RingHistos,3);
353 * Get the ring histogram container
358 * @return Ring histogram container
360 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
362 * Get the signal in a strip
364 * @param fmd ESD object
370 * @return The energy signal
372 Double_t SignalInStrip(const AliESDFMD& fmd,
378 * Angle correct the signal
380 * @param mult Angle Un-corrected Signal
381 * @param eta Pseudo-rapidity
383 * @return Angle corrected signal
385 Double_t AngleCorrect(Double_t mult, Double_t eta) const;
387 * Angle de-correct the signal
389 * @param mult Angle corrected Signal
390 * @param eta Pseudo-rapidity
392 * @return Angle un-corrected signal
394 Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
396 * Get the high cut. The high cut is defined as the
397 * most-probably-value peak found from the energy distributions, minus
398 * 2 times the width of the corresponding Landau.
402 * @param eta Eta value
403 * @param errors If false, do not show errors
405 * @return 0 or less on failure, otherwise @f$\Delta_{mp}-n\xi@f$
407 virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta,
408 Bool_t errors=true) const;
410 * Get the low cut. Normally, the low cut is taken to be the lower
411 * value of the fit range used when generating the energy loss fits.
412 * However, if fLowCut is set (using SetLowCit) to a value greater
413 * than 0, then that value is used.
417 * @param eta Eta value
421 virtual Double_t GetLowCut(UShort_t d, Char_t r, Double_t eta) const;
423 virtual Bool_t IsDead(UShort_t d, Char_t r, UShort_t s, UShort_t t) const;
424 TList fRingHistos; // List of histogram containers
425 // Double_t fLowCut; // Low cut on sharing
426 Bool_t fCorrectAngles; // Whether to work on angle corrected signals
427 // TH2* fSummed; // Operations histogram
428 TH2* fHighCuts; // High cuts used
429 TH2* fLowCuts; // High cuts used
430 // AliFMDFloatMap* fOper; // Operation done per strip
431 Int_t fDebug; // Debug level
432 Bool_t fZeroSharedHitsBelowThreshold; //Whether to zero shared strip below cut
433 AliFMDMultCuts fLCuts; //Cuts object for low cuts
434 AliFMDMultCuts fHCuts; //Cuts object for high cuts
435 Bool_t fUseSimpleMerging; //enable simple sharing by HHD
436 Bool_t fThreeStripSharing; //In case of simple sharing allow 3 strips
437 Bool_t fRecalculateEta; //Whether to recalculate eta and angle correction (disp vtx)
438 // TArrayI fExtraDead; // List of extra dead channels
440 Bool_t fInvalidIsEmpty; // Consider kInvalidMult as zero
442 ClassDef(AliFMDSharingFilter,8); //