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 pwg2_forward_aod
22 #include "AliForwardUtil.h"
23 #include "AliFMDMultCuts.h"
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.
37 * - AliESDFMD object - from reconstruction
40 * - AliESDFMD object - copy of input, but with signals merged
42 * @par Corrections used:
43 * - AliFMDCorrELossFit
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)
52 * @ingroup pwg2_forward_algo
53 * @ingroup pwg2_forward_aod
55 class AliFMDSharingFilter : public TNamed
67 virtual ~AliFMDSharingFilter();
69 * Default Constructor - do not use
71 AliFMDSharingFilter();
75 * @param title Title of object - not significant
77 AliFMDSharingFilter(const char* title);
81 * @param o Object to copy from
83 AliFMDSharingFilter(const AliFMDSharingFilter& o);
87 * @param o Object to assign from
89 * @return Reference to this
91 AliFMDSharingFilter& operator=(const AliFMDSharingFilter& o);
99 * Set the low cut used for sharing
101 * @param lowCut Low cut
103 void SetLowCut(Double_t lowCut=0) { fLCuts.SetMultCuts(lowCut); }
105 * Reset the low cut for sharing to use the fit range lower cut
108 void UnsetLowCut() { fLCuts.SetMultCuts(0); }
110 * Set the debug level. The higher the value the more output
112 * @param dbg Debug level
114 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
117 * Enable use of angle corrected signals in the algorithm
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.
123 void SetUseAngleCorrectedSignals(Bool_t use) { fCorrectAngles = use; }
125 * Enable zeroing of signals if below high cut
127 * @param use zero the signals if below sharing cut
130 void SetZeroSharedHitsBelowThreshold(Bool_t use) { fZeroSharedHitsBelowThreshold = use; }
132 * Enable a simpler merging algorithm
134 * @param use use the simpler algorithm
137 void SetUseSimpleSharing(Bool_t use) { fUseSimpleMerging = use; }
139 * Set the number of landau width to subtract from the most probably
140 * value to get the high cut for the merging algorithm.
142 * @param n Number of @f$ \xi@f$
144 void SetNXi(Double_t n) { fHCuts.SetNXi(n); /* fNXi = n; */ }
146 * Whether to include sigma in the number subtracted from the MPV to
149 * @param u If true, then high cut is @f$ \Delta_{mp} - n(\xi+\sigma)@f$
151 void SetIncludeSigma(Bool_t u) { fHCuts.SetIncludeSigma(u); /*fIncludeSigma = u;*/ }
153 * Filter the input AliESDFMD object
156 * @param lowFlux If this is a low-flux event
157 * @param output Output AliESDFMD object
159 * @return True on success, false otherwise
161 Bool_t Filter(const AliESDFMD& input,
166 * Set the fraction of MPV
168 * @param cut Fraction of MPV
170 void SetFractionOfMPV(Double_t cut) { fHCuts.SetMPVFraction(cut); }
172 * Scale the histograms to the total number of events
174 * @param dir Where the output is
175 * @param nEvents Number of events
177 virtual void ScaleHistograms(const TList* dir, Int_t nEvents);
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
184 * @param dir Directory to add to
186 virtual void DefineOutput(TList* dir);
190 * @param option Not used
192 virtual void Print(Option_t* option="") const;
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; }
202 * Internal data structure to keep track of the histograms
204 struct RingHistos : public AliForwardUtil::RingHistos
216 RingHistos(UShort_t d, Char_t r);
220 * @param o Object to copy from
222 RingHistos(const RingHistos& o);
224 * Assignment operator
226 * @param o Object to assign from
228 * @return Reference to this
230 RingHistos& operator=(const RingHistos& o);
238 void Clear(const Option_t* ="") { fNHits = 0; }
240 * Increase number of hits
243 void Incr() { fNHits++; }
252 * @param dir where to store
254 void Output(TList* dir);
256 * Scale the histograms to the total number of events
258 * @param nEvents Number of events
259 * @param dir Where the output is
261 void ScaleHistograms(const TList* dir, Int_t nEvents);
262 TH1D* fBefore; // Distribution of signals before filter
263 TH1D* fAfter; // Distribution of signals after filter
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
268 TH2D* fBeforeAfter; // Correlation of before and after
269 TH2D* fNeighborsBefore; // Correlation of neighbors
270 TH2D* fNeighborsAfter; // Correlation of neighbors
271 TH2D* fSum; // Summed signal
272 TH1D* fHits; // Distribution of hit strips.
273 Int_t fNHits; // Number of hit strips per event
274 ClassDef(RingHistos,1);
277 * Get the ring histogram container
282 * @return Ring histogram container
284 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
286 * Get the signal in a strip
288 * @param fmd ESD object
294 * @return The energy signal
296 Double_t SignalInStrip(const AliESDFMD& fmd,
302 * The actual algorithm
304 * @param mult The unfiltered signal in the strip
305 * @param eta Psuedo rapidity
306 * @param prevE Previous strip signal (or 0)
307 * @param nextE Next strip signal (or 0)
308 * @param lowFlux Whether this is a low flux event
313 * @param usedPrev Whether the previous strip was used in sharing or not
314 * @param usedThis Wether this strip was used in sharing or not.
316 * @return The filtered signal in the strip
318 Double_t MultiplicityOfStrip(Double_t mult,
328 Bool_t& usedThis) const;
329 Double_t MultiplicityOfStrip(Double_t thisE,
340 Status& nextStatus) const;
342 * Angle correct the signal
344 * @param mult Angle Un-corrected Signal
345 * @param eta Pseudo-rapidity
347 * @return Angle corrected signal
349 Double_t AngleCorrect(Double_t mult, Double_t eta) const;
351 * Angle de-correct the signal
353 * @param mult Angle corrected Signal
354 * @param eta Pseudo-rapidity
356 * @return Angle un-corrected signal
358 Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
360 * Get the high cut. The high cut is defined as the
361 * most-probably-value peak found from the energy distributions, minus
362 * 2 times the width of the corresponding Landau.
366 * @param eta Eta value
367 * @param errors If false, do not show errors
369 * @return 0 or less on failure, otherwise @f$\Delta_{mp}-n\xi@f$
371 virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta,
372 Bool_t errors=true) const;
374 * Get the low cut. Normally, the low cut is taken to be the lower
375 * value of the fit range used when generating the energy loss fits.
376 * However, if fLowCut is set (using SetLowCit) to a value greater
377 * than 0, then that value is used.
381 * @param eta Eta value
385 virtual Double_t GetLowCut(UShort_t d, Char_t r, Double_t eta) const;
387 TList fRingHistos; // List of histogram containers
388 // Double_t fLowCut; // Low cut on sharing
389 Bool_t fCorrectAngles; // Whether to work on angle corrected signals
390 Double_t fNXi; // Number of xi's from Delta to stop merging
391 Bool_t fIncludeSigma; // Whether to include sigma in cut
392 TH2* fSummed; // Operations histogram
393 TH2* fHighCuts; // High cuts used
394 TH2* fLowCuts; // High cuts used
395 AliFMDFloatMap* fOper; // Operation done per strip
396 Int_t fDebug; // Debug level
397 Bool_t fZeroSharedHitsBelowThreshold; //Whether to zero shared strip below cut
398 AliFMDMultCuts fLCuts;
399 AliFMDMultCuts fHCuts;
400 Bool_t fUseSimpleMerging;
401 ClassDef(AliFMDSharingFilter,3); //