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