]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/AliForwardCorrectionManager.h
Fixes for AliForwardCorrectionManager persistency
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliForwardCorrectionManager.h
CommitLineData
7984e5f7 1//
2// Manager (singleton) of corrections
3//
4#ifndef ALIFORWARDCORRECTIONMANAGER_H
5#define ALIFORWARDCORRECTIONMANAGER_H
0bd4b00f 6#include <TObject.h>
7#include "AliFMDCorrELossFit.h"
8#include "AliFMDCorrSecondaryMap.h"
9#include "AliFMDCorrDoubleHit.h"
10#include "AliFMDCorrVertexBias.h"
11#include "AliFMDCorrMergingEfficiency.h"
72cc12cd 12#include "AliFMDCorrAcceptance.h"
0bd4b00f 13#include <TString.h>
14class TFile;
19abe41d 15class TBrowser;
0bd4b00f 16
7c1a1f1d 17/**
18 * Manager (singleton) of corrections
19abe41d 19 *
20 * Note, that this class has a custom streamer. That is to ensure
21 * that the singleton pointer is correctly set on reading in an object
22 * of this type.
7c1a1f1d 23 *
24 * @ingroup pwg2_forward_corr
25 */
0bd4b00f 26class AliForwardCorrectionManager : public TObject
27{
28public:
29 /**
30 * Enumeration of things that can be read in
31 */
32 enum ECorrection {
33 kSecondaryMap = 0x01,
34 kELossFits = 0x02,
35 kVertexBias = 0x04,
36 kMergingEfficiency = 0x08,
37 kDoubleHit = 0x10,
72cc12cd 38 kAcceptance = 0x20,
0bd4b00f 39 kAll = (kSecondaryMap|
40 kELossFits|
41 kVertexBias|
42 kMergingEfficiency|
72cc12cd 43 kDoubleHit|
44 kAcceptance)
0bd4b00f 45 };
19abe41d 46 /**
47 * Default constructor. This is public for the sake of the ROOT I/O
48 * system, but should never be used outside of that system - that
49 * is, do not use this constructor
50 */
51 AliForwardCorrectionManager();
0bd4b00f 52 /**
53 * Access to the singleton object
54 *
55 * @return Reference to the singleton object
56 */
57 static AliForwardCorrectionManager& Instance();
cc83fca2 58 /**
59 *
60 * @param prefix Prefix to correction objects.
61 */
62 void SetPrefix(const char* prefix);
63 void SetFileDir(ECorrection what, const char* dirname);
64 void SetSecondaryMapPath(const char* d) { SetFileDir(kSecondaryMap, d); }
65 void SetDoubleHitPath(const char* d) { SetFileDir(kDoubleHit, d); }
66 void SetELossFitsPath(const char* d) { SetFileDir(kELossFits, d); }
67 void SetVertexBiasPath(const char* d) { SetFileDir(kVertexBias, d); }
68 void SetMergingEffPath(const char* d) { SetFileDir(kMergingEfficiency, d); }
69 void SetAcceptancePath(const char* d) { SetFileDir(kAcceptance, d); }
0bd4b00f 70 /**
71 * Read in corrections based on the parameters given
72 *
73 * @param collisionSystem Collision system
74 * @param cmsNN Center of mass energy per nuclean pair [GeV]
75 * @param field Magnetic field setting [kG]
7c1a1f1d 76 * @param mc Monte-carlo switch
0bd4b00f 77 * @param what What to read in.
78 * @param force Force (re-)reading of specified things
79 *
80 * @return
81 */
82 Bool_t Init(UShort_t collisionSystem,
83 UShort_t cmsNN,
84 Short_t field,
85 Bool_t mc=false,
86 UInt_t what=kAll,
87 Bool_t force=false);
7984e5f7 88 /**
89 * Read in correction based on passed parameters
90 *
91 * @param collisionSystem Collision system string
92 * @param cmsNN Center of mass energy per nucleon pair [GeV]
93 * @param field Magnetic field [kG]
94 * @param mc Monte-carlo switch
95 * @param what What to read in
96 * @param force Force (re-)reading of specified things
97 *
98 * @return true on success
99 */
0bd4b00f 100 Bool_t Init(const char* collisionSystem,
101 Float_t cmsNN,
102 Float_t field,
103 Bool_t mc=false,
104 UInt_t what=kAll,
105 Bool_t force=false);
106 /**
107 * Get the eta axis
108 *
109 * @return Eta axis or null
110 */
111 const TAxis* GetEtaAxis() const;
112 /**
113 * Get the vertex axis
114 *
115 * @return The vertex axis or null
116 */
117 const TAxis* GetVertexAxis() const;
118 /**
119 * Get the energy loss fit correction object.
120 *
121 * @return Get the energy loss fits corrections object or null pointer
122 */
123 AliFMDCorrELossFit* GetELossFit() const { return fELossFit; }
124 /**
125 * Get the secondary correction map
126 *
127 * @return Get the secondary correction map object or null
128 */
129 AliFMDCorrSecondaryMap* GetSecondaryMap() const { return fSecondaryMap; }
130 /**
131 * Get the double hit correction object
132 *
133 * @return Get the double hit correction object or null
134 */
135 AliFMDCorrDoubleHit* GetDoubleHit() const { return fDoubleHit; }
136 /**
137 * Get the vertex bias correction object
138 *
139 * @return Get the vertex bias correction object or null
140 */
141 AliFMDCorrVertexBias* GetVertexBias() const { return fVertexBias; }
72cc12cd 142 /**
143 * Get the merging efficiency
144 *
145 *
146 * @return Get the vertex efficiency correction
147 */
0bd4b00f 148 AliFMDCorrMergingEfficiency* GetMergingEfficiency() const
149 {
150 return fMergingEfficiency;
151 }
72cc12cd 152 /**
153 * Get the acceptance correction due to dead channels
154 *
155 *
156 * @return Acceptance correction due to dead channels
157 */
158 AliFMDCorrAcceptance* GetAcceptance() const { return fAcceptance; }
0bd4b00f 159 /**
160 * @{
161 * @name Path, file, and object access utilities
162 */
163 /**
164 * Get the path to the specified object
165 *
166 * @param what Which stuff to get the path for
167 * @param sys Collision system
168 * @param sNN Center of mass energy [GeV]
169 * @param field Magnetic field in the L3 magnet [kG]
170 * @param mc Whether the correction objects should be valid for MC
171 *
72cc12cd 172 * @return The file name (sans directory) or null
0bd4b00f 173 */
174 TString GetFileName(ECorrection what,
175 UShort_t sys,
176 UShort_t sNN,
177 Short_t field,
178 Bool_t mc) const;
7984e5f7 179 /**
180 * Get the file name of the specified object
181 *
182 * @param what Which stuff to get the path for
183 *
72cc12cd 184 * @return The file name (sans directory) or null
7984e5f7 185 */
0bd4b00f 186 TString GetFileName(ECorrection what) const;
187 /**
188 * Get the path to the specified object
189 *
190 * @param what Which stuff to get the path for
191 *
72cc12cd 192 * @return The files directory full path or null
0bd4b00f 193 */
194 const Char_t* GetFileDir(ECorrection what) const;
195 /**
196 * Get the path to the specified object
197 *
198 * @param what Which stuff to get the path for
199 * @param sys Collision system
200 * @param sNN Center of mass energy [GeV]
201 * @param field Magnetic field in the L3 magnet [kG]
202 * @param mc Whether the correction objects should be valid for MC
203 *
204 * @return The full path or null
205 */
206 TString GetFilePath(ECorrection what,
207 UShort_t sys,
208 UShort_t sNN,
209 Short_t field,
210 Bool_t mc) const;
7984e5f7 211 /**
212 * Get the full path to the object. Note, the manager must be
213 * initialised for this to work
214 *
215 * @param what Which stuff to get the path for
216 *
217 * @return The full path or null
218 */
0bd4b00f 219 TString GetFilePath(ECorrection what) const;
220 /**
221 * Open the file that contains the correction object specified
222 *
223 * @param what Which stuff to get the path for
224 * @param sys Collision system
225 * @param sNN Center of mass energy [GeV]
226 * @param field Magnetic field in the L3 magnet [kG]
227 * @param mc Whether the correction objects should be valid for MC
228 * @param rw Whether to open the file in read/write
229 * @param newfile Wheter to make the file if it doesn't exist
230 *
231 * @return The file that contains the correction object or null
232 */
233 TFile* GetFile(ECorrection what,
234 UShort_t sys,
235 UShort_t sNN,
236 Short_t field,
237 Bool_t mc=false,
238 Bool_t rw=false,
239 Bool_t newfile=false) const;
7984e5f7 240 /**
241 * Get the file that contains the object specifed. Note, the manager
242 * must be initialised for this to work.
243 *
244 * @param what Which stuff to get the path for
245 *
246 * @return The file that contains the correction object or null
247 */
0bd4b00f 248 TFile* GetFile(ECorrection what) const;
249 /**
250 * Get the object name corresponding to correction type
251 *
252 * @param what Correction
253 *
254 * @return Object name or null
255 */
256 const Char_t* GetObjectName(ECorrection what) const;
257 /**
258 * Check if the specified objet exists in the file, and return it
259 *
260 * @param file File to query
261 * @param what Correction type
262 *
263 * @return Object found, or null
264 */
265 TObject* CheckObject(TFile* file, ECorrection what) const;
266 /**
267 * Get the path to the specified object
268 *
269 * @param what Which stuff to get the path for
270 * @param sys Collision system
271 * @param sNN Center of mass energy [GeV]
272 * @param field Magnetic field in the L3 magnet [kG]
273 * @param mc Whether the correction objects should be valid for MC
274 *
275 * @return The full path or null
276 */
277 TObject* GetObject(ECorrection what,
278 UShort_t sys,
279 UShort_t sNN,
280 Short_t field,
281 Bool_t mc) const;
7984e5f7 282 /**
283 * Get the object that contaisn the specified correction
284 *
285 * @param what Which object to get
286 *
287 * @return The object or null
288 */
0bd4b00f 289 TObject* GetObject(ECorrection what) const;
290 /*
291 * @}
292 */
19abe41d 293 /**
294 * @{
295 * @name Misc
296 */
0bd4b00f 297 /**
19abe41d 298 * Print this object
299 *
300 * @param option Passed verbatim to correction objects
0bd4b00f 301 */
19abe41d 302 void Print(Option_t* option="") const;
303 /**
304 * Browse this object
305 *
306 * @param b Browser to use
307 */
308 void Browse(TBrowser* b);
309 /*
310 * @}
311 */
312private:
0bd4b00f 313 /**
314 * Copy constructor
315 *
316 * @param o Object to copy from
317 */
318 AliForwardCorrectionManager(const AliForwardCorrectionManager& o);
319 /**
320 * Assignment operator
321 *
322 * @param o Object to assign from
323 *
324 * @return Reference to this object
325 */
326 AliForwardCorrectionManager& operator=(const AliForwardCorrectionManager& o);
327 /**
328 * @{
329 * @name Read in corrections
330 */
331 /**
332 * Read in the secondary map
333 *
334 * @param sys Collision system
335 * @param sNN Center of mass energy [GeV]
336 * @param field Magnetic field in the L3 magnet [kG]
337 *
338 * @return True on success, false otherwise
339 */
340 Bool_t ReadSecondaryMap(UShort_t sys, UShort_t sNN, Short_t field);
341 /**
342 * Read in the double hit correction
343 *
344 * @param sys Collision system
345 * @param sNN Center of mass energy [GeV]
346 * @param field Magnetic field in the L3 magnet [kG]
347 *
348 * @return True on success, false otherwise
349 */
350 Bool_t ReadDoubleHit(UShort_t sys, UShort_t sNN, Short_t field);
351 /**
352 * Read in the energy loss fits
353 *
354 * @param sys Collision system
355 * @param sNN Center of mass energy [GeV]
356 * @param field Magnetic field in the L3 magnet [kG]
357 * @param mc Whether the correction objects should be valid for MC
358 *
359 * @return True on success, false otherwise
360 */
361 Bool_t ReadELossFits(UShort_t sys, UShort_t sNN, Short_t field, Bool_t mc);
362 /**
363 * Read in the event selection efficiency
364 *
365 * @param sys Collision system
366 * @param sNN Center of mass energy [GeV]
367 * @param field Magnetic field in the L3 magnet [kG]
368 *
369 * @return True on success, false otherwise
370 */
371 Bool_t ReadVertexBias(UShort_t sys, UShort_t sNN, Short_t field);
372 /**
373 * Read in the merging efficiency
374 *
375 * @param sys Collision system
376 * @param sNN Center of mass energy [GeV]
377 * @param field Magnetic field in the L3 magnet [kG]
378 *
379 * @return True on success, false otherwise
380 */
381 Bool_t ReadMergingEfficiency(UShort_t sys, UShort_t sNN, Short_t field);
72cc12cd 382 /**
383 * Read in the acceptance correction due to dead-channels
384 *
385 * @param sys Collision system
386 * @param sNN Center of mass energy [GeV]
387 * @param field Magnetic field in the L3 magnet [kG]
388 *
389 * @return True on success, false otherwise
390 */
391 Bool_t ReadAcceptance(UShort_t sys, UShort_t sNN, Short_t field);
0bd4b00f 392 /*
393 * @}
394 */
395
396 /** Static singleton instance */
397 static AliForwardCorrectionManager* fgInstance;
398 Bool_t fInit; // whether we have been initialised
399 UShort_t fSys; // Collision System
400 UShort_t fSNN; // Collision energy per nucleon (GeV)
401 Short_t fField; // L3 magnetic field (kG)
402
403 /**
404 * @{
405 * @name Paths
406 */
407 TString fELossFitsPath; // Path to energy loss fit correction
408 TString fMergingEffPath; // Path to sharing efficiency correction
409 TString fSecondaryMapPath; // Path to secondary efficiency correction
410 TString fDoubleHitPath; // Path to double hit correction
411 TString fVertexBiasPath; // Path to event selection efficiency correction
72cc12cd 412 TString fAcceptancePath; // Path to acceptance correction from dead areas
0bd4b00f 413 /*
414 * @}
415 */
416 /**
417 * @{
418 * @name Object name
419 */
420 static const Char_t* fgkSecondaryMapSkel; // Name of correction object
421 static const Char_t* fgkDoubleHitSkel; // Name of correction object
422 static const Char_t* fgkELossFitsSkel; // Name of correction object
423 static const Char_t* fgkVertexBiasSkel; // Name of correction object
424 static const Char_t* fgkMergingEffSkel; // Name of correction object
72cc12cd 425 static const Char_t* fgkAcceptanceSkel; // Name of correction object
0bd4b00f 426 /*
427 * @}
428 */
429 /**
430 * @{
431 * @name Correction objects
432 */
72cc12cd 433 AliFMDCorrELossFit* fELossFit; // Energy loss fits
434 AliFMDCorrSecondaryMap* fSecondaryMap; // Secondary particle correction
435 AliFMDCorrDoubleHit* fDoubleHit; // Double hit corr. (low flux)
436 AliFMDCorrVertexBias* fVertexBias; // Vertex bias correction
437 AliFMDCorrMergingEfficiency* fMergingEfficiency; // Merging eff.
438 AliFMDCorrAcceptance* fAcceptance; // Acceptance corr.
0bd4b00f 439 /*
440 * @}
441 */
19abe41d 442 ClassDef(AliForwardCorrectionManager,2) // Manager of corrections
0bd4b00f 443};
444//____________________________________________________________________
445inline const TAxis*
446AliForwardCorrectionManager::GetEtaAxis() const
447{
448 if (!fSecondaryMap) return 0;
449 return &(fSecondaryMap->GetEtaAxis());
450}
451//____________________________________________________________________
452inline const TAxis*
453AliForwardCorrectionManager::GetVertexAxis() const
454{
455 if (!fSecondaryMap) return 0;
456 return &(fSecondaryMap->GetVertexAxis());
457}
458
459#endif
460// Local Variables:
461// mode: C++
462// End:
463