]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AliFMDDensityCalculator.h
remove buggy histos
[u/mrichter/AliRoot.git] / PWGLF / 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 *
bd6f5206 14 * @ingroup pwglf_forward_aod
ffca499d 15 */
7e4038b5 16#include <TNamed.h>
17#include <TList.h>
1174780f 18#include <TArrayI.h>
7e4038b5 19#include "AliForwardUtil.h"
d2638bb7 20#include "AliFMDMultCuts.h"
821ffd28 21#include "AliPoissonCalculator.h"
7e4038b5 22class AliESDFMD;
23class TH2D;
dd497217 24class TH1D;
0bd4b00f 25class TProfile;
1174780f 26class AliFMDCorrELossFit;
7e4038b5 27
28/**
29 * This class calculates the inclusive charged particle density
30 * in each for the 5 FMD rings.
31 *
32 * @par Input:
33 * - AliESDFMD object possibly corrected for sharing
34 *
35 * @par Output:
36 * - 5 RingHistos objects - each with a number of vertex dependent
37 * 2D histograms of the inclusive charge particle density
38 *
39 * @par Corrections used:
40 * - AliFMDAnaCalibEnergyDistribution
41 * - AliFMDDoubleHitCorrection
42 * - AliFMDDeadCorrection
43 *
bd6f5206 44 * @ingroup pwglf_forward_algo
45 * @ingroup pwglf_forward_aod
7e4038b5 46 */
47class AliFMDDensityCalculator : public TNamed
48{
49public:
56236b95 50 /**
51 * How to correct for the missing phi coverage at the corners of the
52 * sensors
53 *
54 */
55 enum {
56 /** No correction */
57 kPhiNoCorrect,
58 /** Correct the calculated number charged particles */
59 kPhiCorrectNch,
60 /** Correct the energy loss */
61 kPhiCorrectELoss
62 };
7e4038b5 63 /**
64 * Constructor
65 */
66 AliFMDDensityCalculator();
67 /**
68 * Constructor
69 *
70 * @param name Name of object
71 */
72 AliFMDDensityCalculator(const char* name);
73 /**
74 * Copy constructor
75 *
76 * @param o Object to copy from
77 */
78 AliFMDDensityCalculator(const AliFMDDensityCalculator& o);
79 /**
80 * Destructor
81 */
82 virtual ~AliFMDDensityCalculator();
83 /**
84 * Assignement operator
85 *
86 * @param o Object to assign from
87 *
88 * @return Reference to this object
89 */
7c1a1f1d 90 AliFMDDensityCalculator& operator=(const AliFMDDensityCalculator& o);
1174780f 91 /**
92 * Initialize this sub-algorithm
93 *
94 * @param etaAxis Not used
95 */
96 virtual void Init(const TAxis& etaAxis);
7e4038b5 97 /**
98 * Do the calculations
99 *
100 * @param fmd AliESDFMD object (possibly) corrected for sharing
101 * @param hists Histogram cache
102 * @param vtxBin Vertex bin
103 * @param lowFlux Low flux flag.
290052e7 104 * @param cent Centrality
105 * @param vz Vertex Z position
7e4038b5 106 *
107 * @return true on successs
108 */
290052e7 109 virtual Bool_t Calculate(const AliESDFMD& fmd,
7e4038b5 110 AliForwardUtil::Histos& hists,
290052e7 111 UShort_t vtxBin,
112 Bool_t lowFlux,
113 Double_t cent=-1,
114 Double_t vz=0);
7e4038b5 115 /**
116 * Scale the histograms to the total number of events
117 *
c389303e 118 * @param dir where to put the output
7e4038b5 119 * @param nEvents Number of events
120 */
fb3430ac 121 virtual void ScaleHistograms(const TList* dir, Int_t nEvents);
7e4038b5 122 /**
123 * Output diagnostic histograms to directory
124 *
125 * @param dir List to write in
126 */
8eb443e1 127 virtual void DefineOutput(TList* dir);
ea3e5d95 128 /**
129 * Set the debug level. The higher the value the more output
130 *
131 * @param dbg Debug level
132 */
133 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
0bd4b00f 134 /**
135 * Maximum particle weight to use
136 *
137 * @param m
138 */
139 void SetMaxParticles(UShort_t m) { fMaxParticles = m; }
9d05ffeb 140 /**
141 * Set whether to use poisson statistics to estimate the
142 * number of particles that has hit within a region. If this is true,
143 * then the average charge particle density is given by
144 * @f[
ffca499d 145 * \lambda = -\log\left(\frac{N_e}{N_t}\right)
9d05ffeb 146 * @f]
147 * where $N_e$ is the number of strips within the region that has no
148 * hits over threshold, and $N_t$ is the total number of strips in the
149 * region/
150 *
151 * @param u Whether to use poisson statistics to estimate the
152 * number of particles that has hit within a region.
153 */
154 void SetUsePoisson(Bool_t u) { fUsePoisson = u; }
6f4a5c0d 155 /**
156 * In case of a displaced vertices recalculate eta and angle correction
157 *
158 * @param use recalculate or not
159 *
160 */
161 void SetRecalculateEta(Bool_t use) { fRecalculateEta = use; }
5bb5d1f6 162 /**
163 * Set whether to use the phi acceptance correction.
164 *
0082a8fc 165 * How the phi acceptance is used depends on the value passed.
166 * - 0: No phi acceptance
167 * - 1: Phi acceptance correction done to estimate of particles
168 * - 2: Phi acceptance correction done to energy deposited
169 *
170 * @param u If >0, use the phi acceptance (default is false)
5bb5d1f6 171 */
6f4a5c0d 172
56236b95 173 void SetUsePhiAcceptance(UShort_t u=kPhiCorrectNch) { fUsePhiAcceptance = u; }
b6b35c77 174 /**
175 * Set the luming factors used in the Poisson method
176 *
177 * @param eta Must be 1 or larger
178 * @param phi Must be 1 or larger
179 */
180 void SetLumping(Int_t eta, Int_t phi) {
181 fEtaLumping = (eta < 1 ? 1 : eta);
182 fPhiLumping = (phi < 1 ? 1 : phi);
183 }
5bb5d1f6 184 /**
185 * Get the multiplicity cut. If the user has set fMultCut (via
186 * SetMultCut) then that value is used. If not, then the lower
187 * value of the fit range for the enery loss fits is returned.
188 *
290052e7 189 * @param d Detector
190 * @param r Ring
191 * @param eta Psuedo-rapidity
192 * @param errors Factor in errors
193 *
5bb5d1f6 194 * @return Lower cut on multiplicity
195 */
196 Double_t GetMultCut(UShort_t d, Char_t r, Double_t eta,
197 Bool_t errors=true) const;
0bd4b00f 198 /**
199 * Get the multiplicity cut. If the user has set fMultCut (via
200 * SetMultCut) then that value is used. If not, then the lower
201 * value of the fit range for the enery loss fits is returned.
202 *
290052e7 203 * @param d Detector
204 * @param r Ring
205 * @param ieta Psuedo-rapidity bin
206 * @param errors Factor in errors
207 *
0bd4b00f 208 * @return Lower cut on multiplicity
209 */
5bb5d1f6 210 Double_t GetMultCut(UShort_t d, Char_t r, Int_t ieta,
211 Bool_t errors=true) const;
0bd4b00f 212 /**
213 * Print information
214 *
1174780f 215 * @param option Print options
216 * - max Print max weights
0bd4b00f 217 */
218 void Print(Option_t* option="") const;
e18cb8bd 219 /**
220 * Get the cuts used
221 *
222 * @return Reference to cuts object
223 */
d2638bb7 224 AliFMDMultCuts& GetCuts() { return fCuts; }
e18cb8bd 225 /**
226 * Set the cuts to use
227 *
228 * @param c Cuts to use
229 */
d2638bb7 230 void SetCuts(const AliFMDMultCuts& c) { fCuts = c; }
7e4038b5 231protected:
1174780f 232 /**
233 * Find the max weight to use for FMD<i>dr</i> in eta bin @a iEta
234 *
235 * @param cor Correction
236 * @param d Detector
237 * @param r Ring
238 * @param iEta Eta bin
290052e7 239 *
240 * @return The maximum weight
1174780f 241 */
fb3430ac 242 Int_t FindMaxWeight(const AliFMDCorrELossFit* cor,
1174780f 243 UShort_t d, Char_t r, Int_t iEta) const;
244
245 /**
246 * Find the max weights and cache them
247 *
e2ebf8c4 248 * @param axis Default @f$\eta@f$ axis from parent task
1174780f 249 */
e2ebf8c4 250 void CacheMaxWeights(const TAxis& axis);
1174780f 251 /**
252 * Find the (cached) maximum weight for FMD<i>dr</i> in
253 * @f$\eta@f$ bin @a iEta
254 *
255 * @param d Detector
256 * @param r Ring
257 * @param iEta Eta bin
258 *
259 * @return max weight or <= 0 in case of problems
260 */
261 Int_t GetMaxWeight(UShort_t d, Char_t r, Int_t iEta) const;
262 /**
263 * Find the (cached) maximum weight for FMD<i>dr</i> iat
264 * @f$\eta@f$
265 *
266 * @param d Detector
267 * @param r Ring
268 * @param eta Eta bin
269 *
270 * @return max weight or <= 0 in case of problems
271 */
272 Int_t GetMaxWeight(UShort_t d, Char_t r, Float_t eta) const;
273
7e4038b5 274 /**
275 * Get the number of particles corresponding to the signal mult
276 *
277 * @param mult Signal
278 * @param d Detector
279 * @param r Ring
280 * @param s Sector
281 * @param t Strip (not used)
282 * @param v Vertex bin
283 * @param eta Pseudo-rapidity
284 * @param lowFlux Low-flux flag
285 *
286 * @return The number of particles
287 */
288 virtual Float_t NParticles(Float_t mult,
289 UShort_t d, Char_t r, UShort_t s, UShort_t t,
0bd4b00f 290 UShort_t v, Float_t eta, Bool_t lowFlux) const;
7e4038b5 291 /**
292 * Get the inverse correction factor. This consist of
293 *
294 * - acceptance correction (corners of sensors)
295 * - double hit correction (for low-flux events)
296 * - dead strip correction
297 *
298 * @param d Detector
299 * @param r Ring
300 * @param s Sector
301 * @param t Strip (not used)
302 * @param v Vertex bin
303 * @param eta Pseudo-rapidity
304 * @param lowFlux Low-flux flag
305 *
306 * @return
307 */
308 virtual Float_t Correction(UShort_t d, Char_t r, UShort_t s, UShort_t t,
0bd4b00f 309 UShort_t v, Float_t eta, Bool_t lowFlux) const;
7e4038b5 310 /**
311 * Get the acceptance correction for strip @a t in an ring of type @a r
312 *
313 * @param r Ring type ('I' or 'O')
314 * @param t Strip number
315 *
316 * @return Inverse acceptance correction
317 */
318 virtual Float_t AcceptanceCorrection(Char_t r, UShort_t t) const;
0bd4b00f 319 /**
320 * Generate the acceptance corrections
321 *
322 * @param r Ring to generate for
323 *
324 * @return Newly allocated histogram of acceptance corrections
325 */
326 virtual TH1D* GenerateAcceptanceCorrection(Char_t r) const;
7e4038b5 327 /**
328 * Internal data structure to keep track of the histograms
329 */
9d99b0dd 330 struct RingHistos : public AliForwardUtil::RingHistos
7e4038b5 331 {
332 /**
333 * Default CTOR
334 */
335 RingHistos();
336 /**
337 * Constructor
338 *
339 * @param d detector
340 * @param r ring
341 */
342 RingHistos(UShort_t d, Char_t r);
343 /**
344 * Copy constructor
345 *
346 * @param o Object to copy from
347 */
348 RingHistos(const RingHistos& o);
349 /**
350 * Assignment operator
351 *
352 * @param o Object to assign from
353 *
354 * @return Reference to this
355 */
356 RingHistos& operator=(const RingHistos& o);
357 /**
358 * Destructor
359 */
360 ~RingHistos();
9d05ffeb 361 /**
362 * Initialize the object
363 *
364 * @param eAxis
365 */
366 void Init(const TAxis& eAxis);
c389303e 367 /**
368 * Make output
369 *
370 * @param dir Where to put it
371 */
7e4038b5 372 void Output(TList* dir);
9d99b0dd 373 /**
374 * Scale the histograms to the total number of events
375 *
c389303e 376 * @param dir Where the output is
9d99b0dd 377 * @param nEvents Number of events
378 */
379 void ScaleHistograms(TList* dir, Int_t nEvents);
b6b35c77 380 TH2D* fEvsN; // Correlation of Eloss vs uncorrected Nch
381 TH2D* fEvsM; // Correlation of Eloss vs corrected Nch
382 TProfile* fEtaVsN; // Average uncorrected Nch vs eta
383 TProfile* fEtaVsM; // Average corrected Nch vs eta
384 TProfile* fCorr; // Average correction vs eta
385 TH2D* fDensity; // Distribution inclusive Nch
9d05ffeb 386 TH2D* fELossVsPoisson; // Correlation of energy loss vs Poisson N_ch
821ffd28 387 AliPoissonCalculator fPoisson; // Calculate density using Poisson method
f7cfc454 388 TH1D* fELoss; // Energy loss as seen by this
389 TH1D* fELossUsed; // Energy loss in strips with signal
390 Double_t fMultCut; // If set, use this
9fde7142 391
e6463868 392 ClassDef(RingHistos,6);
7e4038b5 393 };
394 /**
395 * Get the ring histogram container
396 *
397 * @param d Detector
398 * @param r Ring
399 *
400 * @return Ring histogram container
401 */
402 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
ea3e5d95 403 TList fRingHistos; // List of histogram containers
1174780f 404 TH1D* fSumOfWeights; // Histogram
405 TH1D* fWeightedSum; // Histogram
406 TH1D* fCorrections; // Histogram
0bd4b00f 407 UShort_t fMaxParticles; // Maximum particle weight to use
9d05ffeb 408 Bool_t fUsePoisson; // If true, then use poisson statistics
0082a8fc 409 UShort_t fUsePhiAcceptance; // Whether to correct for corners
0bd4b00f 410 TH1D* fAccI; // Acceptance correction for inner rings
411 TH1D* fAccO; // Acceptance correction for outer rings
1174780f 412 TArrayI fFMD1iMax; // Array of max weights
413 TArrayI fFMD2iMax; // Array of max weights
414 TArrayI fFMD2oMax; // Array of max weights
415 TArrayI fFMD3iMax; // Array of max weights
416 TArrayI fFMD3oMax; // Array of max weights
5bb5d1f6 417 TH2D* fMaxWeights; // Histogram of max weights
418 TH2D* fLowCuts; // Histogram of low cuts
b6b35c77 419 Int_t fEtaLumping; // How to lump eta bins for Poisson
420 Int_t fPhiLumping; // How to lump phi bins for Poisson
ea3e5d95 421 Int_t fDebug; // Debug level
e18cb8bd 422 AliFMDMultCuts fCuts; // Cuts
6f4a5c0d 423 Bool_t fRecalculateEta; // //Whether to recalculate eta and angle correction (disp vtx)
7e4038b5 424
e18cb8bd 425 ClassDef(AliFMDDensityCalculator,7); // Calculate Nch density
7e4038b5 426};
427
428#endif
429// Local Variables:
430// mode: C++
431// End:
432