Make sure that histograms are obtained from output list in
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliFMDSharingFilter.h
CommitLineData
7e4038b5 1#ifndef ALIROOT_PWG2_FORWARD_ALIFMDSHARINGFILTER_H
2#define ALIROOT_PWG2_FORWARD_ALIFMDSHARINGFILTER_H
3#include <TNamed.h>
4#include <TH2.h>
5#include <TList.h>
9d99b0dd 6#include "AliForwardUtil.h"
7e4038b5 7class AliESDFMD;
8class TAxis;
9class TList;
10class TH2;
11
12/**
13 * Class to do the sharing correction. That is, a filter that merges
14 * adjacent strip signals presumably originating from a single particle
15 * that impinges on the detector in such a way that it deposite energy
16 * into two or more strips.
17 *
18 * @par Input:
19 * - AliESDFMD object - from reconstruction
20 *
21 * @par Output:
22 * - AliESDFMD object - copy of input, but with signals merged
23 *
24 * @par Corrections used:
25 * - AliFMDAnaCalibEnergyDistribution objects
26 *
27 * @par Histograms:
28 * - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of
29 * signals before and after the filter.
30 * - For each ring (see above), an array of distributions of number of
31 * hit strips for each vertex bin (if enabled - see Init method)
32 *
33 *
34 * @ingroup pwg2_forward_analysis
35 */
36class AliFMDSharingFilter : public TNamed
37{
38public:
39 /**
40 * Destructor
41 */
42 virtual ~AliFMDSharingFilter();
43 /**
44 * Default Constructor - do not use
45 */
46 AliFMDSharingFilter();
47 /**
48 * Constructor
49 *
50 * @param title Title of object - not significant
51 */
52 AliFMDSharingFilter(const char* title);
53 /**
54 * Copy constructor
55 *
56 * @param o Object to copy from
57 */
58 AliFMDSharingFilter(const AliFMDSharingFilter& o);
59 /**
60 * Assignment operator
61 *
62 * @param o Object to assign from
63 *
64 * @return Reference to this
65 */
66 AliFMDSharingFilter& operator=(const AliFMDSharingFilter& o);
67
7e4038b5 68 /**
69 * Set the low cut used for sharing
70 *
71 * @param lowCut Low cut
72 */
73 void SetLowCut(Double_t lowCut=0.3) { fLowCut = lowCut; }
74
75 /**
76 * Enable use of angle corrected signals in the algorithm
77 *
78 * @param use If true, use angle corrected signals,
79 * otherwise use de-corrected signals. In the final output, the
80 * signals are always angle corrected.
81 */
82 void UseAngleCorrectedSignals(Bool_t use) { fCorrectAngles = use; }
83 /**
84 * Filter the input AliESDFMD object
85 *
86 * @param input Input
87 * @param lowFlux If this is a low-flux event
88 * @param output Output AliESDFMD object
89 * @param vz Current vertex position
90 *
91 * @return True on success, false otherwise
92 */
93 Bool_t Filter(const AliESDFMD& input,
94 Bool_t lowFlux,
95 AliESDFMD& output,
96 Double_t vz);
97 /**
98 * Scale the histograms to the total number of events
99 *
100 * @param nEvents Number of events
101 */
9d99b0dd 102 void ScaleHistograms(TList* dir, Int_t nEvents);
7e4038b5 103
9d99b0dd 104 /**
105 * Define the output histograms. These are put in a sub list of the
106 * passed list. The histograms are merged before the parent task calls
107 * AliAnalysisTaskSE::Terminate
108 *
109 * @param dir Directory to add to
110 */
111 void DefineOutput(TList* dir);
7e4038b5 112protected:
113 /**
114 * Internal data structure to keep track of the histograms
115 */
9d99b0dd 116 struct RingHistos : public AliForwardUtil::RingHistos
7e4038b5 117 {
118 /**
119 * Default CTOR
120 */
121 RingHistos();
122 /**
123 * Constructor
124 *
125 * @param d detector
126 * @param r ring
127 */
128 RingHistos(UShort_t d, Char_t r);
129 /**
130 * Copy constructor
131 *
132 * @param o Object to copy from
133 */
134 RingHistos(const RingHistos& o);
135 /**
136 * Assignment operator
137 *
138 * @param o Object to assign from
139 *
140 * @return Reference to this
141 */
142 RingHistos& operator=(const RingHistos& o);
143 /**
144 * Destructor
145 */
146 ~RingHistos();
147 /**
148 * Initialise this object
149 */
7e4038b5 150 void Clear(const Option_t* ="") { fNHits = 0; }
151 void Incr() { fNHits++; }
152 void Finish();
153 void Output(TList* dir);
9d99b0dd 154 /**
155 * Scale the histograms to the total number of events
156 *
157 * @param nEvents Number of events
158 */
159 void ScaleHistograms(TList* dir, Int_t nEvents);
7e4038b5 160 TH1D* fBefore; // Distribution of signals before filter
161 TH1D* fAfter; // Distribution of signals after filter
162 TH1D* fHits; // Distribution of hit strips.
163 Int_t fNHits; // Number of hit strips per event
9d99b0dd 164 ClassDef(RingHistos,1);
7e4038b5 165 };
166 /**
167 * Get the ring histogram container
168 *
169 * @param d Detector
170 * @param r Ring
171 *
172 * @return Ring histogram container
173 */
174 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
175 /**
176 * Get the signal in a strip
177 *
178 * @param fmd ESD object
179 * @param d Detector
180 * @param r Ring
181 * @param s Sector
182 * @param t Strip
183 *
184 * @return The energy signal
185 */
186 Double_t SignalInStrip(const AliESDFMD& fmd,
187 UShort_t d,
188 Char_t r,
189 UShort_t s,
190 UShort_t t) const;
191 /**
192 * The actual algorithm
193 *
194 * @param mult The unfiltered signal in the strip
195 * @param eta Psuedo rapidity
196 * @param prevE Previous strip signal (or 0)
197 * @param nextE Next strip signal (or 0)
198 * @param lowFlux Whether this is a low flux event
199 * @param d Detector
200 * @param r Ring
201 * @param s Sector
202 * @param t Strip
203 * @param usedPrev Whether the previous strip was used in sharing or not
204 * @param usedThis Wether this strip was used in sharing or not.
205 *
206 * @return The filtered signal in the strip
207 */
208 Double_t MultiplicityOfStrip(Double_t mult,
209 Double_t eta,
210 Double_t prevE,
211 Double_t nextE,
212 Bool_t lowFlux,
213 UShort_t d,
214 Char_t r,
215 UShort_t s,
216 UShort_t t,
217 Bool_t& usedPrev,
218 Bool_t& usedThis);
219 /**
220 * Angle correct the signal
221 *
222 * @param mult Angle Un-corrected Signal
223 * @param eta Pseudo-rapidity
224 *
225 * @return Angle corrected signal
226 */
227 Double_t AngleCorrect(Double_t mult, Double_t eta) const;
228 /**
229 * Angle de-correct the signal
230 *
231 * @param mult Angle corrected Signal
232 * @param eta Pseudo-rapidity
233 *
234 * @return Angle un-corrected signal
235 */
236 Double_t DeAngleCorrect(Double_t mult, Double_t eta) const;
237 /**
238 * Get the high cut. The high cut is defined as the
239 * most-probably-value peak found from the energy distributions, minus
240 * 2 times the width of the corresponding Landau.
241 */
242 virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta) const;
243
244 TList fRingHistos; // List of histogram containers
245 Double_t fLowCut; // Low cut on sharing
246 Bool_t fCorrectAngles; // Whether to work on angle corrected signals
247 TH2* fEtaCorr;
248
249 ClassDef(AliFMDSharingFilter,1); //
250};
251
252#endif
253// Local Variables:
254// mode: C++
255// End: