]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDCorrector.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDCorrector.h
1 // This class calculates the exclusive charged particle density
2 // in each for the 5 FMD rings. 
3 //
4 #ifndef ALIFMDCORRECTOR_H
5 #define ALIFMDCORRECTOR_H
6 /**
7  * @file   AliFMDCorrector.h
8  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9  * @date   Wed Mar 23 14:01:02 2011
10  * 
11  * @brief  
12  * 
13  * @ingroup pwglf_forward_aod
14  * 
15  */
16 #include <TNamed.h>
17 #include <TList.h>
18 #include "AliForwardUtil.h"
19 class TH2D;
20 class TH2;
21 /** 
22  * @defgroup pwglf_forward_algo Algorithms 
23  *
24  * Various sub-algorithms used in the analysis 
25  *
26  * @ingroup pwglf_forward 
27  */
28 /** 
29  * This class calculates the exclusive charged particle density
30  * in each for the 5 FMD rings. 
31  *
32  * @par Input:
33  *   - 5 RingHistos objects - each with a number of vertex dependent 
34  *     2D histograms of the inclusive charge particle density 
35  *
36  * @par Output:
37  *   - 5 RingHistos objects - each with a number of vertex dependent 
38  *     2D histograms of the exclusive charge particle density 
39  * 
40  * @par Corrections used: 
41  *   - AliFMDCorrSecondaryMap;
42  *   - AliFMDCorrVertexBias
43  *   - AliFMDCorrMergingEfficiency
44  *
45  * @ingroup pwglf_forward_algo 
46  * @ingroup pwglf_forward_aod
47  */
48 class AliFMDCorrector : public TNamed
49 {
50 public:
51   /** 
52    * Constructor 
53    */
54   AliFMDCorrector();
55   /** 
56    * Constructor 
57    * 
58    * @param name Name of object
59    */
60   AliFMDCorrector(const char* name);
61   /** 
62    * Copy constructor 
63    * 
64    * @param o Object to copy from 
65    */
66   AliFMDCorrector(const AliFMDCorrector& o);
67   /** 
68    * Destructor 
69    */
70   virtual ~AliFMDCorrector();
71   /** 
72    * Assignement operator
73    * 
74    * @param o Object to assign from 
75    * 
76    * @return Reference to this object
77    */
78   AliFMDCorrector& operator=(const AliFMDCorrector&);
79   /** 
80    * Initialize this object
81    *
82    * @param etaAxis Eta axis to use  -- not used
83    */
84   virtual void SetupForData(const TAxis& etaAxis);
85   /**
86    * Do the calculations 
87    * 
88    * @param hists    Cache of histograms 
89    * @param vtxBin   Vertex bin 
90    * 
91    * @return true on successs 
92    */
93   virtual Bool_t Correct(AliForwardUtil::Histos& hists, UShort_t vtxBin);
94   /** 
95    * Scale the histograms to the total number of events 
96    * 
97    * @param dir     Where the output is stored
98    * @param output  Output list 
99    * @param nEvents Number of events 
100    */
101   virtual void Terminate(const TList* dir, TList* output, Int_t nEvents);
102   /** 
103    * Output diagnostic histograms to directory 
104    * 
105    * @param dir List to write in
106    */  
107   virtual void CreateOutputObjects(TList* dir);
108   /** 
109    * Set the debug level.  The higher the value the more output 
110    * 
111    * @param dbg Debug level 
112    */
113   void SetDebug(Int_t dbg=1) { fDebug = dbg; }
114   /** 
115    * @{
116    * @name Enable/disable parts of the corrections
117    */
118   /** 
119    *  Whether to do correction for secondaries
120    *
121    * @param use If true, use the secondary correction
122    */
123   void SetUseSecondaryMap(Bool_t use=true) { fUseSecondaryMap = use; }
124   /**
125    * Check
126    *
127    * @return true if the correction for secondaries is done
128    */
129   Bool_t IsUseSecondaryMap() const { return fUseSecondaryMap; }
130   /**
131    *  Whether to do correction for vertex bias
132    *
133    * @param use If true, use the vertex bias correction
134    */
135   void SetUseVertexBias(Bool_t use=true) { fUseVertexBias = use; }
136   /**
137    * Check
138    *
139    * @return true if the correction for vertex bias is done
140    */
141   Bool_t IsUseVertexBias() const { return fUseVertexBias; }
142   /**
143    *  Whether to do correction for dead-channel acceptance
144    *
145    * @param use If true, use the dead-channel acceptance correction
146    */
147   void SetUseAcceptance(Bool_t use=true) { fUseAcceptance = use; }
148   /**
149    * Check
150    *
151    * @return true if the correction for dead-channel acceptance is done
152    */
153   Bool_t IsUseAcceptance() const { return fUseAcceptance; }
154   /**
155    * Whether to use the merging efficiency correction
156    *
157    * @param use If true, use the merging efficiency correction
158    */
159   void SetUseMergingEfficiency(Bool_t use=true) { fUseMergingEfficiency = use; }
160   /**
161    * Check
162    *
163    * @return true if the merging efficiency correction is used.
164    */
165   Bool_t IsUseMergingEfficiency() const { return fUseMergingEfficiency; }
166   /* @} */
167
168   /**
169    * Print information
170    * 
171    * @param option Not used 
172    */
173   virtual void Print(Option_t* option="") const;
174 protected:
175   /** 
176    * Internal data structure to keep track of the histograms
177    */
178   struct RingHistos : public AliForwardUtil::RingHistos 
179   { 
180     /** 
181      * Default CTOR
182      */
183     RingHistos();
184     /** 
185      * Constructor
186      * 
187      * @param d detector
188      * @param r ring 
189      */
190     RingHistos(UShort_t d, Char_t r);
191     /** 
192      * Copy constructor 
193      * 
194      * @param o Object to copy from 
195      */
196     RingHistos(const RingHistos& o);
197     /** 
198      * Assignment operator 
199      * 
200      * @param o Object to assign from 
201      * 
202      * @return Reference to this 
203      */
204     RingHistos& operator=(const RingHistos& o);
205     /** 
206      * Destructor 
207      */
208     ~RingHistos();
209     /** 
210      * Make output 
211      * 
212      * @param dir Where to put it 
213      */
214     void CreateOutputObjects(TList* dir);
215     /** 
216      * Scale the histograms to the total number of events 
217      * 
218      * @param dir     where the output is stored
219      * @param nEvents Number of events 
220      */
221     void Terminate(TList* dir, Int_t nEvents);
222     TH2D*     fDensity;      // Distribution primary Nch
223     ClassDef(RingHistos,2);
224   };
225   /** 
226    * Get the ring histogram container 
227    * 
228    * @param d Detector
229    * @param r Ring 
230    * 
231    * @return Ring histogram container 
232    */
233   RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
234   /** 
235    * Divide a map with another map.  This is a reimplementation of
236    * TH1::Divide, but we assume compatible histograms, and the under-
237    * and overflow bins are only divided if the third argument is true.
238    * 
239    * @param num             Numerator. On return contains the result 
240    * @param denom           Denominator
241    * @param alsoUnderOver   If true, also divide under/overflow bins
242    */
243   void DivideMap(TH2* num, const TH2* denom, Bool_t alsoUnderOver=false) const;
244   TList    fRingHistos;           // List of histogram containers
245   Bool_t   fUseSecondaryMap;      // Whether to do correction for secondaries
246   Bool_t   fUseVertexBias;        // Whether to do correction for vertex bias
247   Bool_t   fUseAcceptance;        // Whether to do correction for dead ch's.
248   Bool_t   fUseMergingEfficiency; // Whether to use the merging efficiency
249   Int_t    fDebug;                //  Debug level 
250
251   ClassDef(AliFMDCorrector,4); // Correct the inclusive d2N/detadphi
252 };
253
254 #endif
255 // Local Variables:
256 //   mode: C++
257 // End:
258