]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AliFMDDensityCalculator.h
Made member functions virtual
[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 class TProfile;
10
11 /** 
12  * This class calculates the inclusive charged particle density
13  * in each for the 5 FMD rings. 
14  *
15  * @par Input:
16  *   - AliESDFMD object possibly corrected for sharing
17  *
18  * @par Output:
19  *   - 5 RingHistos objects - each with a number of vertex dependent 
20  *     2D histograms of the inclusive charge particle density 
21  * 
22  * @par Corrections used: 
23  *   - AliFMDAnaCalibEnergyDistribution 
24  *   - AliFMDDoubleHitCorrection 
25  *   - AliFMDDeadCorrection 
26  *
27  * @ingroup pwg2_forward 
28  */
29 class AliFMDDensityCalculator : public TNamed
30 {
31 public:
32   /** 
33    * Constructor 
34    */
35   AliFMDDensityCalculator();
36   /** 
37    * Constructor 
38    * 
39    * @param name Name of object
40    */
41   AliFMDDensityCalculator(const char* name);
42   /** 
43    * Copy constructor 
44    * 
45    * @param o Object to copy from 
46    */
47   AliFMDDensityCalculator(const AliFMDDensityCalculator& o);
48   /** 
49    * Destructor 
50    */
51   virtual ~AliFMDDensityCalculator();
52   /** 
53    * Assignement operator
54    * 
55    * @param o Object to assign from 
56    * 
57    * @return Reference to this object
58    */
59   AliFMDDensityCalculator& operator=(const AliFMDDensityCalculator& o);
60   /** 
61    * Do the calculations 
62    * 
63    * @param fmd      AliESDFMD object (possibly) corrected for sharing
64    * @param hists    Histogram cache
65    * @param vtxBin   Vertex bin 
66    * @param lowFlux  Low flux flag. 
67    * 
68    * @return true on successs 
69    */
70   virtual Bool_t Calculate(const AliESDFMD& fmd, 
71                            AliForwardUtil::Histos& hists, 
72                            UShort_t vtxBin, Bool_t lowFlux);
73   /** 
74    * Scale the histograms to the total number of events 
75    * 
76    * @param dir     where to put the output
77    * @param nEvents Number of events 
78    */
79   void ScaleHistograms(TList* dir, Int_t nEvents);
80   /** 
81    * Output diagnostic histograms to directory 
82    * 
83    * @param dir List to write in
84    */  
85   void DefineOutput(TList* dir);
86   /** 
87    * Set the debug level.  The higher the value the more output 
88    * 
89    * @param dbg Debug level 
90    */
91   void SetDebug(Int_t dbg=1) { fDebug = dbg; }
92   /** 
93    * Maximum particle weight to use 
94    * 
95    * @param m 
96    */
97   void SetMaxParticles(UShort_t m) { fMaxParticles = m; }  
98   /** 
99    * Set the lower multiplicity cut.  This overrides the setting in
100    * the energy loss fits.
101    * 
102    * @param cut Cut to use 
103    */
104   void SetMultCut(Double_t cut) { fMultCut = cut; }
105   /** 
106    * Get the multiplicity cut.  If the user has set fMultCut (via
107    * SetMultCut) then that value is used.  If not, then the lower
108    * value of the fit range for the enery loss fits is returned.
109    * 
110    * @return Lower cut on multiplicity
111    */
112   Double_t GetMultCut() const;
113   /** 
114    * Print information 
115    * 
116    * @param option Not used
117    */
118   void Print(Option_t* option="") const;
119 protected:
120   /** 
121    * Get the number of particles corresponding to the signal mult
122    * 
123    * @param mult     Signal
124    * @param d        Detector
125    * @param r        Ring 
126    * @param s        Sector 
127    * @param t        Strip (not used)
128    * @param v        Vertex bin 
129    * @param eta      Pseudo-rapidity 
130    * @param lowFlux  Low-flux flag 
131    * 
132    * @return The number of particles 
133    */
134   virtual Float_t NParticles(Float_t mult, 
135                              UShort_t d, Char_t r, UShort_t s, UShort_t t, 
136                              UShort_t v, Float_t eta, Bool_t lowFlux) const;
137   /** 
138    * Get the inverse correction factor.  This consist of
139    * 
140    * - acceptance correction (corners of sensors) 
141    * - double hit correction (for low-flux events) 
142    * - dead strip correction 
143    * 
144    * @param d        Detector
145    * @param r        Ring 
146    * @param s        Sector 
147    * @param t        Strip (not used)
148    * @param v        Vertex bin 
149    * @param eta      Pseudo-rapidity 
150    * @param lowFlux  Low-flux flag 
151    * 
152    * @return 
153    */
154   virtual Float_t Correction(UShort_t d, Char_t r, UShort_t s, UShort_t t, 
155                              UShort_t v, Float_t eta, Bool_t lowFlux) const;
156   /** 
157    * Get the acceptance correction for strip @a t in an ring of type @a r
158    * 
159    * @param r  Ring type ('I' or 'O')
160    * @param t  Strip number 
161    * 
162    * @return Inverse acceptance correction 
163    */
164   virtual Float_t AcceptanceCorrection(Char_t r, UShort_t t) const;
165   /** 
166    * Generate the acceptance corrections 
167    * 
168    * @param r Ring to generate for 
169    * 
170    * @return Newly allocated histogram of acceptance corrections
171    */
172   virtual TH1D*   GenerateAcceptanceCorrection(Char_t r) const;
173   /** 
174    * Internal data structure to keep track of the histograms
175    */
176   struct RingHistos : public AliForwardUtil::RingHistos
177   { 
178     /** 
179      * Default CTOR
180      */
181     RingHistos();
182     /** 
183      * Constructor
184      * 
185      * @param d detector
186      * @param r ring 
187      */
188     RingHistos(UShort_t d, Char_t r);
189     /** 
190      * Copy constructor 
191      * 
192      * @param o Object to copy from 
193      */
194     RingHistos(const RingHistos& o);
195     /** 
196      * Assignment operator 
197      * 
198      * @param o Object to assign from 
199      * 
200      * @return Reference to this 
201      */
202     RingHistos& operator=(const RingHistos& o);
203     /** 
204      * Destructor 
205      */
206     ~RingHistos();
207     /** 
208      * Make output 
209      * 
210      * @param dir Where to put it 
211      */
212     void Output(TList* dir);
213     /** 
214      * Scale the histograms to the total number of events 
215      * 
216      * @param dir     Where the output is 
217      * @param nEvents Number of events 
218      */
219     void ScaleHistograms(TList* dir, Int_t nEvents);
220     TH2D*     fEvsN;         // Correlation of Eloss vs uncorrected Nch
221     TH2D*     fEvsM;         // Correlation of Eloss vs corrected Nch
222     TProfile* fEtaVsN;       // Average uncorrected Nch vs eta
223     TProfile* fEtaVsM;       // Average corrected Nch vs eta
224     TProfile* fCorr;         // Average correction vs eta
225     TH2D*     fDensity;      // Distribution inclusive Nch
226     ClassDef(RingHistos,1);
227   };
228   /** 
229    * Get the ring histogram container 
230    * 
231    * @param d Detector
232    * @param r Ring 
233    * 
234    * @return Ring histogram container 
235    */
236   RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
237
238   TList    fRingHistos;    //  List of histogram containers
239   Double_t fMultCut;       //  Low cut on scaled energy loss
240   TH1D*    fSumOfWeights;  //! Histogram
241   TH1D*    fWeightedSum;   //! Histogram
242   TH1D*    fCorrections;   //! Histogram
243   UShort_t fMaxParticles;  //  Maximum particle weight to use 
244   TH1D*    fAccI;          //  Acceptance correction for inner rings
245   TH1D*    fAccO;          //  Acceptance correction for outer rings
246   Int_t    fDebug;         //  Debug level 
247
248   ClassDef(AliFMDDensityCalculator,1); // Calculate Nch density 
249 };
250
251 #endif
252 // Local Variables:
253 //   mode: C++
254 // End:
255