]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AliFMDDensityCalculator.h
Fixes
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliFMDDensityCalculator.h
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"
6 class AliESDFMD;
7 class TH2D;
8 class TH1D;
9
10 /** 
11  * This class calculates the inclusive charged particle density
12  * in each for the 5 FMD rings. 
13  *
14  * @par Input:
15  *   - AliESDFMD object possibly corrected for sharing
16  *
17  * @par Output:
18  *   - 5 RingHistos objects - each with a number of vertex dependent 
19  *     2D histograms of the inclusive charge particle density 
20  * 
21  * @par Corrections used: 
22  *   - AliFMDAnaCalibEnergyDistribution 
23  *   - AliFMDDoubleHitCorrection 
24  *   - AliFMDDeadCorrection 
25  *
26  * @ingroup pwg2_forward_analysis 
27  */
28 class AliFMDDensityCalculator : public TNamed
29 {
30 public:
31   /** 
32    * Constructor 
33    */
34   AliFMDDensityCalculator();
35   /** 
36    * Constructor 
37    * 
38    * @param name Name of object
39    */
40   AliFMDDensityCalculator(const char* name);
41   /** 
42    * Copy constructor 
43    * 
44    * @param o Object to copy from 
45    */
46   AliFMDDensityCalculator(const AliFMDDensityCalculator& o);
47   /** 
48    * Destructor 
49    */
50   virtual ~AliFMDDensityCalculator();
51   /** 
52    * Assignement operator
53    * 
54    * @param o Object to assign from 
55    * 
56    * @return Reference to this object
57    */
58   AliFMDDensityCalculator& operator=(const AliFMDDensityCalculator&);
59   /** 
60    * Do the calculations 
61    * 
62    * @param fmd      AliESDFMD object (possibly) corrected for sharing
63    * @param hists    Histogram cache
64    * @param vtxBin   Vertex bin 
65    * @param lowFlux  Low flux flag. 
66    * 
67    * @return true on successs 
68    */
69   virtual Bool_t Calculate(const AliESDFMD& fmd, 
70                            AliForwardUtil::Histos& hists, 
71                            Int_t vtxBin, Bool_t lowFlux);
72   /** 
73    * Scale the histograms to the total number of events 
74    * 
75    * @param nEvents Number of events 
76    */
77   void ScaleHistograms(TList* dir, Int_t nEvents);
78   /** 
79    * Output diagnostic histograms to directory 
80    * 
81    * @param dir List to write in
82    */  
83   void DefineOutput(TList* dir);
84 protected:
85   /** 
86    * Get the number of particles corresponding to the signal mult
87    * 
88    * @param mult     Signal
89    * @param d        Detector
90    * @param r        Ring 
91    * @param s        Sector 
92    * @param t        Strip (not used)
93    * @param v        Vertex bin 
94    * @param eta      Pseudo-rapidity 
95    * @param lowFlux  Low-flux flag 
96    * 
97    * @return The number of particles 
98    */
99   virtual Float_t NParticles(Float_t mult, 
100                              UShort_t d, Char_t r, UShort_t s, UShort_t t, 
101                              Int_t v, Float_t eta, Bool_t lowFlux) const;
102   /** 
103    * Get the inverse correction factor.  This consist of
104    * 
105    * - acceptance correction (corners of sensors) 
106    * - double hit correction (for low-flux events) 
107    * - dead strip correction 
108    * 
109    * @param d        Detector
110    * @param r        Ring 
111    * @param s        Sector 
112    * @param t        Strip (not used)
113    * @param v        Vertex bin 
114    * @param eta      Pseudo-rapidity 
115    * @param lowFlux  Low-flux flag 
116    * 
117    * @return 
118    */
119   virtual Float_t Correction(UShort_t d, Char_t r, UShort_t s, UShort_t t, 
120                              Int_t v, Float_t eta, Bool_t lowFlux) const;
121   /** 
122    * Get the acceptance correction for strip @a t in an ring of type @a r
123    * 
124    * @param r  Ring type ('I' or 'O')
125    * @param t  Strip number 
126    * 
127    * @return Inverse acceptance correction 
128    */
129   virtual Float_t AcceptanceCorrection(Char_t r, UShort_t t) const;
130
131   /** 
132    * Internal data structure to keep track of the histograms
133    */
134   struct RingHistos : public AliForwardUtil::RingHistos
135   { 
136     /** 
137      * Default CTOR
138      */
139     RingHistos();
140     /** 
141      * Constructor
142      * 
143      * @param d detector
144      * @param r ring 
145      */
146     RingHistos(UShort_t d, Char_t r);
147     /** 
148      * Copy constructor 
149      * 
150      * @param o Object to copy from 
151      */
152     RingHistos(const RingHistos& o);
153     /** 
154      * Assignment operator 
155      * 
156      * @param o Object to assign from 
157      * 
158      * @return Reference to this 
159      */
160     RingHistos& operator=(const RingHistos& o);
161     /** 
162      * Destructor 
163      */
164     ~RingHistos();
165     void Output(TList* dir);
166     /** 
167      * Scale the histograms to the total number of events 
168      * 
169      * @param nEvents Number of events 
170      */
171     void ScaleHistograms(TList* dir, Int_t nEvents);
172     TH2D*     fEvsN;         // Correlation of Eloss vs uncorrected Nch
173     TH2D*     fEvsM;         // Correlation of Eloss vs corrected Nch
174     TH2D*     fDensity;      // Distribution inclusive Nch
175     ClassDef(RingHistos,1);
176   };
177   /** 
178    * Get the ring histogram container 
179    * 
180    * @param d Detector
181    * @param r Ring 
182    * 
183    * @return Ring histogram container 
184    */
185   RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
186
187   TList    fRingHistos;    // List of histogram containers
188   Double_t fMultCut;       // Low cut on scaled energy loss
189   TH1D*    fSumOfWeights;
190   TH1D*    fWeightedSum;
191   TH1D*    fCorrections;
192
193   ClassDef(AliFMDDensityCalculator,1); // Calculate Nch density 
194 };
195
196 #endif
197 // Local Variables:
198 //   mode: C++
199 // End:
200