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