More code clean up.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliFMDDensityCalculator.h
CommitLineData
7e4038b5 1#ifndef ALIROOT_PWG2_FORWARD_ANALYSIS2_ALIFMDDENSITYCALCULATOR_H
2#define ALIROOT_PWG2_FORWARD_ANALYSIS2_ALIFMDDENSITYCALCULATOR_H
3#include <TNamed.h>
4#include <TList.h>
5#include "AliForwardUtil.h"
6class AliESDFMD;
7class TH2D;
dd497217 8class TH1D;
0bd4b00f 9class TProfile;
7e4038b5 10
11/**
12 * This class calculates the inclusive charged particle density
13 * in each for the 5 FMD rings.
14 *
15 * @par Input:
16 * - AliESDFMD object possibly corrected for sharing
17 *
18 * @par Output:
19 * - 5 RingHistos objects - each with a number of vertex dependent
20 * 2D histograms of the inclusive charge particle density
21 *
22 * @par Corrections used:
23 * - AliFMDAnaCalibEnergyDistribution
24 * - AliFMDDoubleHitCorrection
25 * - AliFMDDeadCorrection
26 *
27 * @ingroup pwg2_forward_analysis
28 */
29class AliFMDDensityCalculator : public TNamed
30{
31public:
32 /**
33 * Constructor
34 */
35 AliFMDDensityCalculator();
36 /**
37 * Constructor
38 *
39 * @param name Name of object
40 */
41 AliFMDDensityCalculator(const char* name);
42 /**
43 * Copy constructor
44 *
45 * @param o Object to copy from
46 */
47 AliFMDDensityCalculator(const AliFMDDensityCalculator& o);
48 /**
49 * Destructor
50 */
51 virtual ~AliFMDDensityCalculator();
52 /**
53 * Assignement operator
54 *
55 * @param o Object to assign from
56 *
57 * @return Reference to this object
58 */
59 AliFMDDensityCalculator& operator=(const AliFMDDensityCalculator&);
60 /**
61 * Do the calculations
62 *
63 * @param fmd AliESDFMD object (possibly) corrected for sharing
64 * @param hists Histogram cache
65 * @param vtxBin Vertex bin
66 * @param lowFlux Low flux flag.
67 *
68 * @return true on successs
69 */
70 virtual Bool_t Calculate(const AliESDFMD& fmd,
71 AliForwardUtil::Histos& hists,
0bd4b00f 72 UShort_t vtxBin, Bool_t lowFlux);
7e4038b5 73 /**
74 * Scale the histograms to the total number of events
75 *
c389303e 76 * @param dir where to put the output
7e4038b5 77 * @param nEvents Number of events
78 */
9d99b0dd 79 void ScaleHistograms(TList* dir, Int_t nEvents);
7e4038b5 80 /**
81 * Output diagnostic histograms to directory
82 *
83 * @param dir List to write in
84 */
9d99b0dd 85 void DefineOutput(TList* dir);
ea3e5d95 86 /**
87 * Set the debug level. The higher the value the more output
88 *
89 * @param dbg Debug level
90 */
91 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
0bd4b00f 92 /**
93 * Maximum particle weight to use
94 *
95 * @param m
96 */
97 void SetMaxParticles(UShort_t m) { fMaxParticles = m; }
98 /**
99 * Set the lower multiplicity cut. This overrides the setting in
100 * the energy loss fits.
101 *
102 * @param cut Cut to use
103 */
104 void SetMultCut(Double_t cut) { fMultCut = cut; }
105 /**
106 * Get the multiplicity cut. If the user has set fMultCut (via
107 * SetMultCut) then that value is used. If not, then the lower
108 * value of the fit range for the enery loss fits is returned.
109 *
110 * @return Lower cut on multiplicity
111 */
112 Double_t GetMultCut() const;
113 /**
114 * Print information
115 *
116 * @param option Not used
117 */
118 void Print(Option_t* option="") const;
7e4038b5 119protected:
120 /**
121 * Get the number of particles corresponding to the signal mult
122 *
123 * @param mult Signal
124 * @param d Detector
125 * @param r Ring
126 * @param s Sector
127 * @param t Strip (not used)
128 * @param v Vertex bin
129 * @param eta Pseudo-rapidity
130 * @param lowFlux Low-flux flag
131 *
132 * @return The number of particles
133 */
134 virtual Float_t NParticles(Float_t mult,
135 UShort_t d, Char_t r, UShort_t s, UShort_t t,
0bd4b00f 136 UShort_t v, Float_t eta, Bool_t lowFlux) const;
7e4038b5 137 /**
138 * Get the inverse correction factor. This consist of
139 *
140 * - acceptance correction (corners of sensors)
141 * - double hit correction (for low-flux events)
142 * - dead strip correction
143 *
144 * @param d Detector
145 * @param r Ring
146 * @param s Sector
147 * @param t Strip (not used)
148 * @param v Vertex bin
149 * @param eta Pseudo-rapidity
150 * @param lowFlux Low-flux flag
151 *
152 * @return
153 */
154 virtual Float_t Correction(UShort_t d, Char_t r, UShort_t s, UShort_t t,
0bd4b00f 155 UShort_t v, Float_t eta, Bool_t lowFlux) const;
7e4038b5 156 /**
157 * Get the acceptance correction for strip @a t in an ring of type @a r
158 *
159 * @param r Ring type ('I' or 'O')
160 * @param t Strip number
161 *
162 * @return Inverse acceptance correction
163 */
164 virtual Float_t AcceptanceCorrection(Char_t r, UShort_t t) const;
0bd4b00f 165 /**
166 * Generate the acceptance corrections
167 *
168 * @param r Ring to generate for
169 *
170 * @return Newly allocated histogram of acceptance corrections
171 */
172 virtual TH1D* GenerateAcceptanceCorrection(Char_t r) const;
7e4038b5 173 /**
174 * Internal data structure to keep track of the histograms
175 */
9d99b0dd 176 struct RingHistos : public AliForwardUtil::RingHistos
7e4038b5 177 {
178 /**
179 * Default CTOR
180 */
181 RingHistos();
182 /**
183 * Constructor
184 *
185 * @param d detector
186 * @param r ring
187 */
188 RingHistos(UShort_t d, Char_t r);
189 /**
190 * Copy constructor
191 *
192 * @param o Object to copy from
193 */
194 RingHistos(const RingHistos& o);
195 /**
196 * Assignment operator
197 *
198 * @param o Object to assign from
199 *
200 * @return Reference to this
201 */
202 RingHistos& operator=(const RingHistos& o);
203 /**
204 * Destructor
205 */
206 ~RingHistos();
c389303e 207 /**
208 * Make output
209 *
210 * @param dir Where to put it
211 */
7e4038b5 212 void Output(TList* dir);
9d99b0dd 213 /**
214 * Scale the histograms to the total number of events
215 *
c389303e 216 * @param dir Where the output is
9d99b0dd 217 * @param nEvents Number of events
218 */
219 void ScaleHistograms(TList* dir, Int_t nEvents);
7e4038b5 220 TH2D* fEvsN; // Correlation of Eloss vs uncorrected Nch
221 TH2D* fEvsM; // Correlation of Eloss vs corrected Nch
0bd4b00f 222 TProfile* fEtaVsN; // Average uncorrected Nch vs eta
223 TProfile* fEtaVsM; // Average corrected Nch vs eta
224 TProfile* fCorr; // Average correction vs eta
7e4038b5 225 TH2D* fDensity; // Distribution inclusive Nch
9d99b0dd 226 ClassDef(RingHistos,1);
7e4038b5 227 };
228 /**
229 * Get the ring histogram container
230 *
231 * @param d Detector
232 * @param r Ring
233 *
234 * @return Ring histogram container
235 */
236 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
237
ea3e5d95 238 TList fRingHistos; // List of histogram containers
239 Double_t fMultCut; // Low cut on scaled energy loss
240 TH1D* fSumOfWeights; //! Histogram
241 TH1D* fWeightedSum; //! Histogram
242 TH1D* fCorrections; //! Histogram
0bd4b00f 243 UShort_t fMaxParticles; // Maximum particle weight to use
244 TH1D* fAccI; // Acceptance correction for inner rings
245 TH1D* fAccO; // Acceptance correction for outer rings
ea3e5d95 246 Int_t fDebug; // Debug level
7e4038b5 247
248 ClassDef(AliFMDDensityCalculator,1); // Calculate Nch density
249};
250
251#endif
252// Local Variables:
253// mode: C++
254// End:
255