]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliForwardCorrectionManager.h
Important bug fixes for the PWGLF/FORWARD directory
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardCorrectionManager.h
1 //
2 // Manager (singleton) of corrections 
3 // 
4 #ifndef ALIFORWARDCORRECTIONMANAGER_H
5 #define ALIFORWARDCORRECTIONMANAGER_H
6 /**
7  * @file   AliForwardCorrectionManager.h
8  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9  * @date   Wed Mar 23 14:04:27 2011
10  * 
11  * @brief  
12  * 
13  * 
14  * @ingroup pwglf_forward_aod
15  */
16 #include "AliCorrectionManagerBase.h"
17 #include <TString.h>
18 class TBrowser;
19 class AliFMDCorrELossFit;
20 class AliFMDCorrDoubleHit;
21 class AliFMDCorrVertexBias;
22 class AliFMDCorrMergingEfficiency;
23 class AliFMDCorrAcceptance;
24 class AliFMDCorrSecondaryMap;
25 class AliFMDCorrNoiseGain;
26 class TAxis;
27
28 /**
29  * Manager (singleton) of corrections 
30  *
31  * Note, that this class has a custom streamer.  That is to ensure
32  * that the singleton pointer is correctly set on reading in an object
33  * of this type.
34  * 
35  * @ingroup pwglf_forward_corr 
36  * @ingroup pwglf_forward_aod
37  */
38 class AliForwardCorrectionManager : public AliCorrectionManagerBase
39 {
40 private:
41   /**
42    * Enumeration of things that can be read in 
43    */
44   enum EId { 
45     kIdSecondaryMap            = 0, 
46     kIdELossFits,
47     kIdVertexBias,
48     kIdMergingEfficiency,
49     kIdDoubleHit,
50     kIdAcceptance,
51     kIdNoiseGain
52   };
53 public:
54   /**
55    * Enumeration of things that can be read in 
56    */
57   enum ECorrection { 
58     kSecondaryMap              = 0x01, 
59     kELossFits                 = 0x02, 
60     kVertexBias                = 0x04, 
61     kMergingEfficiency         = 0x08,
62     kDoubleHit                 = 0x10,
63     kAcceptance                = 0x20,
64     kNoiseGain                 = 0x40,
65     kDefault                   = (kSecondaryMap|kELossFits|kAcceptance),
66     kAll                       = (kSecondaryMap| 
67                                   kELossFits|
68                                   kVertexBias|
69                                   kMergingEfficiency|
70                                   kDoubleHit|
71                                   kAcceptance|
72                                   kNoiseGain)
73   };
74   /** 
75    * Default constructor.  This is public for the sake of the ROOT I/O
76    * system, but should never be used outside of that system - that
77    * is, do not use this constructor
78    */
79   AliForwardCorrectionManager();
80   /** 
81    * Access to the singleton object 
82    * 
83    * @return Reference to the singleton object 
84    */
85   static AliForwardCorrectionManager& Instance();
86
87   /** 
88    * Append the content of the file @a addition to the @a destination
89    * file for this manager.  This used TFileMerger::PartialMerge 
90    * 
91    * @param destination Filename of destination storage (in OADB_PATH)
92    * @param addition    Filename of addition. 
93    * 
94    * @return true on success 
95    */
96   virtual Bool_t Append(const TString& addition,
97                         const TString& destination="") const;
98
99   /** 
100    * @return name of object 
101    */
102   const Char_t* GetName() const { return "forwardCorrections"; }
103   /** 
104    * Set path to corrections 
105    * 
106    * @param d Path
107    */
108   void SetSecondaryMapPath(const char* d) 
109   {
110     SetCorrectionFile(kIdSecondaryMap, d);
111   }
112   /** 
113    * Set path to corrections 
114    * 
115    * @param d Path
116    */
117   void SetDoubleHitPath(const char* d)    
118   {
119     SetCorrectionFile(kIdDoubleHit, d);
120   }
121   /** 
122    * Set path to corrections 
123    * 
124    * @param d Path
125    */
126   void SetELossFitsPath(const char* d)    
127   {
128     SetCorrectionFile(kIdELossFits, d);
129   }
130   /** 
131    * Set path to corrections 
132    * 
133    * @param d Path
134    */
135   void SetVertexBiasPath(const char* d)   
136   {
137     SetCorrectionFile(kIdVertexBias, d);
138   }
139   /** 
140    * Set path to corrections 
141    * 
142    * @param d Path
143    */
144   void SetMergingEffPath(const char* d)   
145   {
146     SetCorrectionFile(kIdMergingEfficiency, d);
147   }
148   /** 
149    * Set path to corrections 
150    * 
151    * @param d Path
152    */
153   void SetAcceptancePath(const char* d)   
154   {
155     SetCorrectionFile(kIdAcceptance, d);
156   }
157   /** 
158    * Read in corrections based on the parameters given 
159    * 
160    * @param runNumber       Run number
161    * @param collisionSystem Collision system
162    * @param cmsNN           Center of mass energy per nuclean pair [GeV]
163    * @param field           Magnetic field setting [kG]
164    * @param mc              Monte-carlo switch
165    * @param what            What to read in. 
166    * @param force           Force (re-)reading of specified things
167    * @param satelliteCollisions For satellite collisions
168    * 
169    * @return 
170    */
171   Bool_t Init(ULong_t  runNumber,
172               UShort_t collisionSystem, 
173               UShort_t cmsNN, 
174               Short_t  field, 
175               Bool_t   mc=false,
176               Bool_t   satelliteCollisions=false,
177               UInt_t   what=kDefault,
178               Bool_t   force=false);
179   /** 
180    * Read in correction based on passed parameters
181    * 
182    * @param runNumber       Run number
183    * @param collisionSystem Collision system string 
184    * @param cmsNN           Center of mass energy per nucleon pair [GeV]
185    * @param field           Magnetic field [kG]
186    * @param mc              Monte-carlo switch
187    * @param what            What to read in 
188    * @param force           Force (re-)reading of specified things
189    * @param satelliteCollisions For satellite collisions
190    * 
191    * @return true on success
192    */
193   Bool_t Init(ULong_t     runNumber, 
194               const char* collisionSystem, 
195               Float_t     cmsNN, 
196               Float_t     field, 
197               Bool_t      mc=false,
198               Bool_t      satelliteCollisions=false,
199               UInt_t      what=kDefault,
200               Bool_t      force=false);
201   /** 
202    * Parse string with fields in it, and return the corresponding bit mask
203    * 
204    * @param what The string 
205    * 
206    * @return The corresponding bit mask
207    */
208   static UInt_t ParseFields(const TString& what);
209   /** 
210    * Get the eta axis 
211    * 
212    * @return Eta axis or null
213    */
214   const TAxis* GetEtaAxis() const;
215   /** 
216    * Get the vertex axis 
217    * 
218    * @return The vertex axis or null
219    */
220   const TAxis* GetVertexAxis() const;
221   /** 
222    * Get the energy loss fit correction object. 
223    * 
224    * @return Get the energy loss fits corrections object or null pointer
225    */
226   const AliFMDCorrELossFit* GetELossFit() const;
227   /** 
228    * Alias for GetELossFit
229    * 
230    * @return Get the energy loss fits corrections object or null pointer
231    */
232   const AliFMDCorrELossFit* GetELossFits() const { return GetELossFit(); }
233   /** 
234    * Get the secondary correction map
235    * 
236    * @return Get the secondary correction map object or null
237    */
238   const AliFMDCorrSecondaryMap* GetSecondaryMap() const;
239   /** 
240    * Get the double hit correction object
241    * 
242    * @return Get the double hit correction object or null 
243    */
244   const AliFMDCorrDoubleHit* GetDoubleHit() const;
245   /** 
246    * Get the vertex bias correction object
247    * 
248    * @return Get the vertex bias correction object or null 
249    */
250   const AliFMDCorrVertexBias* GetVertexBias() const;
251   /** 
252    * Get the merging efficiency 
253    * 
254    * @return Get the vertex efficiency correction 
255    */
256   const AliFMDCorrMergingEfficiency* GetMergingEfficiency() const;
257   /** 
258    * Get the acceptance correction due to dead channels 
259    * 
260    * @return Acceptance correction due to dead channels 
261    */
262   const AliFMDCorrAcceptance* GetAcceptance() const;
263   /** 
264    * Get the noise calibration.  That is, the ratio 
265    *
266    * @f[ 
267    *   \frac{\sigma_{i}}{g_{i}k}
268    * @f] 
269    *
270    * where @f$ k@f$ is a constant determined by the electronics of
271    * units DAC/MIP, and @f$ \sigma_i, g_i@f$ are the noise and gain of
272    * the @f$ i @f$ strip respectively
273    * 
274    * @return Noise-gain calibration
275    */
276   const AliFMDCorrNoiseGain* GetNoiseGain() const;
277 private:
278   /** 
279    * Non-default constructor - initializes corrections - used by
280    * singleton access member function Instance
281    * 
282    * @param notUsed Ignored
283    */
284   AliForwardCorrectionManager(Bool_t notUsed);
285   
286   /** Static singleton instance */
287   static AliForwardCorrectionManager* fgInstance; // Skeleton
288
289   /** 
290    * @{ 
291    * @name Object name 
292    */
293   static const Char_t* fgkSecondaryMapSkel;  // Name of correction object 
294   static const Char_t* fgkDoubleHitSkel;     // Name of correction object 
295   static const Char_t* fgkELossFitsSkel;     // Name of correction object 
296   static const Char_t* fgkVertexBiasSkel;    // Name of correction object 
297   static const Char_t* fgkMergingEffSkel;    // Name of correction object 
298   static const Char_t* fgkAcceptanceSkel;    // Name of correction object 
299   static const Char_t* fgkNoiseGainSkel;     // Name of correction object 
300   /* 
301    * @} 
302    */
303   ClassDef(AliForwardCorrectionManager,5) // Manager of corrections 
304 };
305
306 #endif
307 // Local Variables:
308 //   mode: C++ 
309 // End: 
310