1 // This class calculates the inclusive charged particle density
2 // in each for the 5 FMD rings.
4 #ifndef ALIFMDDENSITYCALCULATOR_H
5 #define ALIFMDDENSITYCALCULATOR_H
7 * @file AliFMDDensityCalculator.h
8 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9 * @date Wed Mar 23 14:02:09 2011
14 * @ingroup pwglf_forward_aod
19 #include "AliForwardUtil.h"
20 #include "AliFMDMultCuts.h"
21 #include "AliPoissonCalculator.h"
26 class AliFMDCorrELossFit;
29 * This class calculates the inclusive charged particle density
30 * in each for the 5 FMD rings.
33 * - AliESDFMD object possibly corrected for sharing
36 * - 5 RingHistos objects - each with a number of vertex dependent
37 * 2D histograms of the inclusive charge particle density
39 * @par Corrections used:
40 * - AliFMDAnaCalibEnergyDistribution
41 * - AliFMDDoubleHitCorrection
42 * - AliFMDDeadCorrection
44 * @ingroup pwglf_forward_algo
45 * @ingroup pwglf_forward_aod
47 class AliFMDDensityCalculator : public TNamed
51 * How to correct for the missing phi coverage at the corners of the
58 /** Correct the calculated number charged particles */
60 /** Correct the energy loss */
66 AliFMDDensityCalculator();
70 * @param name Name of object
72 AliFMDDensityCalculator(const char* name);
76 * @param o Object to copy from
78 AliFMDDensityCalculator(const AliFMDDensityCalculator& o);
82 virtual ~AliFMDDensityCalculator();
84 * Assignement operator
86 * @param o Object to assign from
88 * @return Reference to this object
90 AliFMDDensityCalculator& operator=(const AliFMDDensityCalculator& o);
92 * Initialize this sub-algorithm
94 * @param etaAxis Not used
96 virtual void Init(const TAxis& etaAxis);
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.
105 * @return true on successs
107 virtual Bool_t Calculate(const AliESDFMD& fmd,
108 AliForwardUtil::Histos& hists,
109 UShort_t vtxBin, Bool_t lowFlux, Double_t cent=-1, Double_t vz=0);
111 * Scale the histograms to the total number of events
113 * @param dir where to put the output
114 * @param nEvents Number of events
116 virtual void ScaleHistograms(const TList* dir, Int_t nEvents);
118 * Output diagnostic histograms to directory
120 * @param dir List to write in
122 virtual void DefineOutput(TList* dir);
124 * Set the debug level. The higher the value the more output
126 * @param dbg Debug level
128 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
130 * Maximum particle weight to use
134 void SetMaxParticles(UShort_t m) { fMaxParticles = m; }
136 * Set whether to use poisson statistics to estimate the
137 * number of particles that has hit within a region. If this is true,
138 * then the average charge particle density is given by
140 * \lambda = -\log\left(\frac{N_e}{N_t}\right)
142 * where $N_e$ is the number of strips within the region that has no
143 * hits over threshold, and $N_t$ is the total number of strips in the
146 * @param u Whether to use poisson statistics to estimate the
147 * number of particles that has hit within a region.
149 void SetUsePoisson(Bool_t u) { fUsePoisson = u; }
151 * In case of a displaced vertices recalculate eta and angle correction
153 * @param use recalculate or not
156 void SetRecalculateEta(Bool_t use) { fRecalculateEta = use; }
158 * Set whether to use the phi acceptance correction.
160 * How the phi acceptance is used depends on the value passed.
161 * - 0: No phi acceptance
162 * - 1: Phi acceptance correction done to estimate of particles
163 * - 2: Phi acceptance correction done to energy deposited
165 * @param u If >0, use the phi acceptance (default is false)
168 void SetUsePhiAcceptance(UShort_t u=kPhiCorrectNch) { fUsePhiAcceptance = u; }
170 * Set the luming factors used in the Poisson method
172 * @param eta Must be 1 or larger
173 * @param phi Must be 1 or larger
175 void SetLumping(Int_t eta, Int_t phi) {
176 fEtaLumping = (eta < 1 ? 1 : eta);
177 fPhiLumping = (phi < 1 ? 1 : phi);
180 * Get the multiplicity cut. If the user has set fMultCut (via
181 * SetMultCut) then that value is used. If not, then the lower
182 * value of the fit range for the enery loss fits is returned.
184 * @return Lower cut on multiplicity
186 Double_t GetMultCut(UShort_t d, Char_t r, Double_t eta,
187 Bool_t errors=true) const;
189 * Get the multiplicity cut. If the user has set fMultCut (via
190 * SetMultCut) then that value is used. If not, then the lower
191 * value of the fit range for the enery loss fits is returned.
193 * @return Lower cut on multiplicity
195 Double_t GetMultCut(UShort_t d, Char_t r, Int_t ieta,
196 Bool_t errors=true) const;
200 * @param option Print options
201 * - max Print max weights
203 void Print(Option_t* option="") const;
207 * @return Reference to cuts object
209 AliFMDMultCuts& GetCuts() { return fCuts; }
211 * Set the cuts to use
213 * @param c Cuts to use
215 void SetCuts(const AliFMDMultCuts& c) { fCuts = c; }
218 * Find the max weight to use for FMD<i>dr</i> in eta bin @a iEta
220 * @param cor Correction
223 * @param iEta Eta bin
225 Int_t FindMaxWeight(const AliFMDCorrELossFit* cor,
226 UShort_t d, Char_t r, Int_t iEta) const;
229 * Find the max weights and cache them
232 void CacheMaxWeights();
234 * Find the (cached) maximum weight for FMD<i>dr</i> in
235 * @f$\eta@f$ bin @a iEta
239 * @param iEta Eta bin
241 * @return max weight or <= 0 in case of problems
243 Int_t GetMaxWeight(UShort_t d, Char_t r, Int_t iEta) const;
245 * Find the (cached) maximum weight for FMD<i>dr</i> iat
252 * @return max weight or <= 0 in case of problems
254 Int_t GetMaxWeight(UShort_t d, Char_t r, Float_t eta) const;
257 * Get the number of particles corresponding to the signal mult
263 * @param t Strip (not used)
264 * @param v Vertex bin
265 * @param eta Pseudo-rapidity
266 * @param lowFlux Low-flux flag
268 * @return The number of particles
270 virtual Float_t NParticles(Float_t mult,
271 UShort_t d, Char_t r, UShort_t s, UShort_t t,
272 UShort_t v, Float_t eta, Bool_t lowFlux) const;
274 * Get the inverse correction factor. This consist of
276 * - acceptance correction (corners of sensors)
277 * - double hit correction (for low-flux events)
278 * - dead strip correction
283 * @param t Strip (not used)
284 * @param v Vertex bin
285 * @param eta Pseudo-rapidity
286 * @param lowFlux Low-flux flag
290 virtual Float_t Correction(UShort_t d, Char_t r, UShort_t s, UShort_t t,
291 UShort_t v, Float_t eta, Bool_t lowFlux) const;
293 * Get the acceptance correction for strip @a t in an ring of type @a r
295 * @param r Ring type ('I' or 'O')
296 * @param t Strip number
298 * @return Inverse acceptance correction
300 virtual Float_t AcceptanceCorrection(Char_t r, UShort_t t) const;
302 * Generate the acceptance corrections
304 * @param r Ring to generate for
306 * @return Newly allocated histogram of acceptance corrections
308 virtual TH1D* GenerateAcceptanceCorrection(Char_t r) const;
310 * Internal data structure to keep track of the histograms
312 struct RingHistos : public AliForwardUtil::RingHistos
324 RingHistos(UShort_t d, Char_t r);
328 * @param o Object to copy from
330 RingHistos(const RingHistos& o);
332 * Assignment operator
334 * @param o Object to assign from
336 * @return Reference to this
338 RingHistos& operator=(const RingHistos& o);
344 * Initialize the object
348 void Init(const TAxis& eAxis);
352 * @param dir Where to put it
354 void Output(TList* dir);
356 * Scale the histograms to the total number of events
358 * @param dir Where the output is
359 * @param nEvents Number of events
361 void ScaleHistograms(TList* dir, Int_t nEvents);
362 TH2D* fEvsN; // Correlation of Eloss vs uncorrected Nch
363 TH2D* fEvsM; // Correlation of Eloss vs corrected Nch
364 TProfile* fEtaVsN; // Average uncorrected Nch vs eta
365 TProfile* fEtaVsM; // Average corrected Nch vs eta
366 TProfile* fCorr; // Average correction vs eta
367 TH2D* fDensity; // Distribution inclusive Nch
368 TH2D* fELossVsPoisson; // Correlation of energy loss vs Poisson N_ch
369 AliPoissonCalculator fPoisson; // Calculate density using Poisson method
370 TH1D* fELoss; // Energy loss as seen by this
371 TH1D* fELossUsed; // Energy loss in strips with signal
372 Double_t fMultCut; // If set, use this
374 ClassDef(RingHistos,6);
377 * Get the ring histogram container
382 * @return Ring histogram container
384 RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
385 TList fRingHistos; // List of histogram containers
386 TH1D* fSumOfWeights; // Histogram
387 TH1D* fWeightedSum; // Histogram
388 TH1D* fCorrections; // Histogram
389 UShort_t fMaxParticles; // Maximum particle weight to use
390 Bool_t fUsePoisson; // If true, then use poisson statistics
391 UShort_t fUsePhiAcceptance; // Whether to correct for corners
392 TH1D* fAccI; // Acceptance correction for inner rings
393 TH1D* fAccO; // Acceptance correction for outer rings
394 TArrayI fFMD1iMax; // Array of max weights
395 TArrayI fFMD2iMax; // Array of max weights
396 TArrayI fFMD2oMax; // Array of max weights
397 TArrayI fFMD3iMax; // Array of max weights
398 TArrayI fFMD3oMax; // Array of max weights
399 TH2D* fMaxWeights; // Histogram of max weights
400 TH2D* fLowCuts; // Histogram of low cuts
401 Int_t fEtaLumping; // How to lump eta bins for Poisson
402 Int_t fPhiLumping; // How to lump phi bins for Poisson
403 Int_t fDebug; // Debug level
404 AliFMDMultCuts fCuts; // Cuts
405 Bool_t fRecalculateEta; // //Whether to recalculate eta and angle correction (disp vtx)
407 ClassDef(AliFMDDensityCalculator,7); // Calculate Nch density