]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/AliFMDDensityCalculator.h
adding planes
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliFMDDensityCalculator.h
CommitLineData
7984e5f7 1// This class calculates the inclusive charged particle density
2// in each for the 5 FMD rings.
3//
4#ifndef ALIFMDDENSITYCALCULATOR_H
5#define ALIFMDDENSITYCALCULATOR_H
ffca499d 6/**
7 * @file AliFMDDensityCalculator.h
8 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9 * @date Wed Mar 23 14:02:09 2011
10 *
11 * @brief
12 *
13 *
14 * @ingroup pwg2_forward_aod
15 */
7e4038b5 16#include <TNamed.h>
17#include <TList.h>
1174780f 18#include <TArrayI.h>
7e4038b5 19#include "AliForwardUtil.h"
20class AliESDFMD;
21class TH2D;
dd497217 22class TH1D;
0bd4b00f 23class TProfile;
1174780f 24class AliFMDCorrELossFit;
7e4038b5 25
26/**
27 * This class calculates the inclusive charged particle density
28 * in each for the 5 FMD rings.
29 *
30 * @par Input:
31 * - AliESDFMD object possibly corrected for sharing
32 *
33 * @par Output:
34 * - 5 RingHistos objects - each with a number of vertex dependent
35 * 2D histograms of the inclusive charge particle density
36 *
37 * @par Corrections used:
38 * - AliFMDAnaCalibEnergyDistribution
39 * - AliFMDDoubleHitCorrection
40 * - AliFMDDeadCorrection
41 *
8eb443e1 42 * @ingroup pwg2_forward_algo
ffca499d 43 * @ingroup pwg2_forward_aod
7e4038b5 44 */
45class AliFMDDensityCalculator : public TNamed
46{
47public:
48 /**
49 * Constructor
50 */
51 AliFMDDensityCalculator();
52 /**
53 * Constructor
54 *
55 * @param name Name of object
56 */
57 AliFMDDensityCalculator(const char* name);
58 /**
59 * Copy constructor
60 *
61 * @param o Object to copy from
62 */
63 AliFMDDensityCalculator(const AliFMDDensityCalculator& o);
64 /**
65 * Destructor
66 */
67 virtual ~AliFMDDensityCalculator();
68 /**
69 * Assignement operator
70 *
71 * @param o Object to assign from
72 *
73 * @return Reference to this object
74 */
7c1a1f1d 75 AliFMDDensityCalculator& operator=(const AliFMDDensityCalculator& o);
1174780f 76 /**
77 * Initialize this sub-algorithm
78 *
79 * @param etaAxis Not used
80 */
81 virtual void Init(const TAxis& etaAxis);
7e4038b5 82 /**
83 * Do the calculations
84 *
85 * @param fmd AliESDFMD object (possibly) corrected for sharing
86 * @param hists Histogram cache
87 * @param vtxBin Vertex bin
88 * @param lowFlux Low flux flag.
89 *
90 * @return true on successs
91 */
92 virtual Bool_t Calculate(const AliESDFMD& fmd,
93 AliForwardUtil::Histos& hists,
0bd4b00f 94 UShort_t vtxBin, Bool_t lowFlux);
7e4038b5 95 /**
96 * Scale the histograms to the total number of events
97 *
c389303e 98 * @param dir where to put the output
7e4038b5 99 * @param nEvents Number of events
100 */
fb3430ac 101 virtual void ScaleHistograms(const TList* dir, Int_t nEvents);
7e4038b5 102 /**
103 * Output diagnostic histograms to directory
104 *
105 * @param dir List to write in
106 */
8eb443e1 107 virtual void DefineOutput(TList* dir);
ea3e5d95 108 /**
109 * Set the debug level. The higher the value the more output
110 *
111 * @param dbg Debug level
112 */
113 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
0bd4b00f 114 /**
115 * Maximum particle weight to use
116 *
117 * @param m
118 */
119 void SetMaxParticles(UShort_t m) { fMaxParticles = m; }
9d05ffeb 120 /**
121 * Set whether to use poisson statistics to estimate the
122 * number of particles that has hit within a region. If this is true,
123 * then the average charge particle density is given by
124 * @f[
ffca499d 125 * \lambda = -\log\left(\frac{N_e}{N_t}\right)
9d05ffeb 126 * @f]
127 * where $N_e$ is the number of strips within the region that has no
128 * hits over threshold, and $N_t$ is the total number of strips in the
129 * region/
130 *
131 * @param u Whether to use poisson statistics to estimate the
132 * number of particles that has hit within a region.
133 */
134 void SetUsePoisson(Bool_t u) { fUsePoisson = u; }
0bd4b00f 135 /**
136 * Set the lower multiplicity cut. This overrides the setting in
137 * the energy loss fits.
138 *
139 * @param cut Cut to use
140 */
141 void SetMultCut(Double_t cut) { fMultCut = cut; }
142 /**
143 * Get the multiplicity cut. If the user has set fMultCut (via
144 * SetMultCut) then that value is used. If not, then the lower
145 * value of the fit range for the enery loss fits is returned.
146 *
147 * @return Lower cut on multiplicity
148 */
149 Double_t GetMultCut() const;
150 /**
151 * Print information
152 *
1174780f 153 * @param option Print options
154 * - max Print max weights
0bd4b00f 155 */
156 void Print(Option_t* option="") const;
7e4038b5 157protected:
1174780f 158 /**
159 * Find the max weight to use for FMD<i>dr</i> in eta bin @a iEta
160 *
161 * @param cor Correction
162 * @param d Detector
163 * @param r Ring
164 * @param iEta Eta bin
165 */
fb3430ac 166 Int_t FindMaxWeight(const AliFMDCorrELossFit* cor,
1174780f 167 UShort_t d, Char_t r, Int_t iEta) const;
168
169 /**
170 * Find the max weights and cache them
171 *
172 */
173 void CacheMaxWeights();
174 /**
175 * Find the (cached) maximum weight for FMD<i>dr</i> in
176 * @f$\eta@f$ bin @a iEta
177 *
178 * @param d Detector
179 * @param r Ring
180 * @param iEta Eta bin
181 *
182 * @return max weight or <= 0 in case of problems
183 */
184 Int_t GetMaxWeight(UShort_t d, Char_t r, Int_t iEta) const;
185 /**
186 * Find the (cached) maximum weight for FMD<i>dr</i> iat
187 * @f$\eta@f$
188 *
189 * @param d Detector
190 * @param r Ring
191 * @param eta Eta bin
192 *
193 * @return max weight or <= 0 in case of problems
194 */
195 Int_t GetMaxWeight(UShort_t d, Char_t r, Float_t eta) const;
196
7e4038b5 197 /**
198 * Get the number of particles corresponding to the signal mult
199 *
200 * @param mult Signal
201 * @param d Detector
202 * @param r Ring
203 * @param s Sector
204 * @param t Strip (not used)
205 * @param v Vertex bin
206 * @param eta Pseudo-rapidity
207 * @param lowFlux Low-flux flag
208 *
209 * @return The number of particles
210 */
211 virtual Float_t NParticles(Float_t mult,
212 UShort_t d, Char_t r, UShort_t s, UShort_t t,
0bd4b00f 213 UShort_t v, Float_t eta, Bool_t lowFlux) const;
7e4038b5 214 /**
215 * Get the inverse correction factor. This consist of
216 *
217 * - acceptance correction (corners of sensors)
218 * - double hit correction (for low-flux events)
219 * - dead strip correction
220 *
221 * @param d Detector
222 * @param r Ring
223 * @param s Sector
224 * @param t Strip (not used)
225 * @param v Vertex bin
226 * @param eta Pseudo-rapidity
227 * @param lowFlux Low-flux flag
228 *
229 * @return
230 */
231 virtual Float_t Correction(UShort_t d, Char_t r, UShort_t s, UShort_t t,
0bd4b00f 232 UShort_t v, Float_t eta, Bool_t lowFlux) const;
7e4038b5 233 /**
234 * Get the acceptance correction for strip @a t in an ring of type @a r
235 *
236 * @param r Ring type ('I' or 'O')
237 * @param t Strip number
238 *
239 * @return Inverse acceptance correction
240 */
241 virtual Float_t AcceptanceCorrection(Char_t r, UShort_t t) const;
0bd4b00f 242 /**
243 * Generate the acceptance corrections
244 *
245 * @param r Ring to generate for
246 *
247 * @return Newly allocated histogram of acceptance corrections
248 */
249 virtual TH1D* GenerateAcceptanceCorrection(Char_t r) const;
7e4038b5 250 /**
251 * Internal data structure to keep track of the histograms
252 */
9d99b0dd 253 struct RingHistos : public AliForwardUtil::RingHistos
7e4038b5 254 {
255 /**
256 * Default CTOR
257 */
258 RingHistos();
259 /**
260 * Constructor
261 *
262 * @param d detector
263 * @param r ring
264 */
265 RingHistos(UShort_t d, Char_t r);
266 /**
267 * Copy constructor
268 *
269 * @param o Object to copy from
270 */
271 RingHistos(const RingHistos& o);
272 /**
273 * Assignment operator
274 *
275 * @param o Object to assign from
276 *
277 * @return Reference to this
278 */
279 RingHistos& operator=(const RingHistos& o);
280 /**
281 * Destructor
282 */
283 ~RingHistos();
9d05ffeb 284 /**
285 * Initialize the object
286 *
287 * @param eAxis
288 */
289 void Init(const TAxis& eAxis);
c389303e 290 /**
291 * Make output
292 *
293 * @param dir Where to put it
294 */
7e4038b5 295 void Output(TList* dir);
9d99b0dd 296 /**
297 * Scale the histograms to the total number of events
298 *
c389303e 299 * @param dir Where the output is
9d99b0dd 300 * @param nEvents Number of events
301 */
302 void ScaleHistograms(TList* dir, Int_t nEvents);
e308a636 303 /**
304 * Create Poisson histograms
305 */
306 void ResetPoissonHistos();
7e4038b5 307 TH2D* fEvsN; // Correlation of Eloss vs uncorrected Nch
308 TH2D* fEvsM; // Correlation of Eloss vs corrected Nch
0bd4b00f 309 TProfile* fEtaVsN; // Average uncorrected Nch vs eta
310 TProfile* fEtaVsM; // Average corrected Nch vs eta
311 TProfile* fCorr; // Average correction vs eta
7e4038b5 312 TH2D* fDensity; // Distribution inclusive Nch
9d05ffeb 313 TH2D* fELossVsPoisson; // Correlation of energy loss vs Poisson N_ch
e308a636 314 TH2D* fTotalStrips; // Total number of strips in a region
315 TH2D* fEmptyStrips; // Total number of strips in a region
316 TH2D* fBasicHits ; // Total number basic hits in a region
9d05ffeb 317 TH2D* fEmptyVsTotal; // # of empty strips vs total number of strips
9fde7142 318
319
e308a636 320 ClassDef(RingHistos,3);
7e4038b5 321 };
322 /**
323 * Get the ring histogram container
324 *
325 * @param d Detector
326 * @param r Ring
327 *
328 * @return Ring histogram container
329 */
330 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
331
ea3e5d95 332 TList fRingHistos; // List of histogram containers
333 Double_t fMultCut; // Low cut on scaled energy loss
1174780f 334 TH1D* fSumOfWeights; // Histogram
335 TH1D* fWeightedSum; // Histogram
336 TH1D* fCorrections; // Histogram
0bd4b00f 337 UShort_t fMaxParticles; // Maximum particle weight to use
9d05ffeb 338 Bool_t fUsePoisson; // If true, then use poisson statistics
0bd4b00f 339 TH1D* fAccI; // Acceptance correction for inner rings
340 TH1D* fAccO; // Acceptance correction for outer rings
1174780f 341 TArrayI fFMD1iMax; // Array of max weights
342 TArrayI fFMD2iMax; // Array of max weights
343 TArrayI fFMD2oMax; // Array of max weights
344 TArrayI fFMD3iMax; // Array of max weights
345 TArrayI fFMD3oMax; // Array of max weights
ea3e5d95 346 Int_t fDebug; // Debug level
7e4038b5 347
9d05ffeb 348 ClassDef(AliFMDDensityCalculator,2); // Calculate Nch density
7e4038b5 349};
350
351#endif
352// Local Variables:
353// mode: C++
354// End:
355