2 // Manager (singleton) of corrections
4 #ifndef ALIFORWARDCORRECTIONMANAGER_H
5 #define ALIFORWARDCORRECTIONMANAGER_H
7 * @file AliForwardCorrectionManager.h
8 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9 * @date Wed Mar 23 14:04:27 2011
14 * @ingroup pwg2_forward_aod
17 #include "AliFMDCorrSecondaryMap.h"
21 class AliFMDCorrELossFit;
22 class AliFMDCorrDoubleHit;
23 class AliFMDCorrVertexBias;
24 class AliFMDCorrMergingEfficiency;
25 class AliFMDCorrAcceptance;
28 * Manager (singleton) of corrections
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
34 * @ingroup pwg2_forward_corr
35 * @ingroup pwg2_forward_aod
37 class AliForwardCorrectionManager : public TObject
41 * Enumeration of things that can be read in
47 kMergingEfficiency = 0x08,
50 kAll = (kSecondaryMap|
58 * Default constructor. This is public for the sake of the ROOT I/O
59 * system, but should never be used outside of that system - that
60 * is, do not use this constructor
62 AliForwardCorrectionManager();
64 * Access to the singleton object
66 * @return Reference to the singleton object
68 static AliForwardCorrectionManager& Instance();
71 * @param prefix Prefix to correction objects.
73 void SetPrefix(const char* prefix);
75 * Set the file directory for a type
78 * @param dirname Directory name
80 void SetFileDir(ECorrection what, const char* dirname);
81 void SetSecondaryMapPath(const char* d) { SetFileDir(kSecondaryMap, d); }
82 void SetDoubleHitPath(const char* d) { SetFileDir(kDoubleHit, d); }
83 void SetELossFitsPath(const char* d) { SetFileDir(kELossFits, d); }
84 void SetVertexBiasPath(const char* d) { SetFileDir(kVertexBias, d); }
85 void SetMergingEffPath(const char* d) { SetFileDir(kMergingEfficiency, d); }
86 void SetAcceptancePath(const char* d) { SetFileDir(kAcceptance, d); }
88 * Read in corrections based on the parameters given
90 * @param collisionSystem Collision system
91 * @param cmsNN Center of mass energy per nuclean pair [GeV]
92 * @param field Magnetic field setting [kG]
93 * @param mc Monte-carlo switch
94 * @param what What to read in.
95 * @param force Force (re-)reading of specified things
99 Bool_t Init(UShort_t collisionSystem,
106 * Read in correction based on passed parameters
108 * @param collisionSystem Collision system string
109 * @param cmsNN Center of mass energy per nucleon pair [GeV]
110 * @param field Magnetic field [kG]
111 * @param mc Monte-carlo switch
112 * @param what What to read in
113 * @param force Force (re-)reading of specified things
115 * @return true on success
117 Bool_t Init(const char* collisionSystem,
126 * @return Eta axis or null
128 const TAxis* GetEtaAxis() const;
130 * Get the vertex axis
132 * @return The vertex axis or null
134 const TAxis* GetVertexAxis() const;
136 * Get the energy loss fit correction object.
138 * @return Get the energy loss fits corrections object or null pointer
140 AliFMDCorrELossFit* GetELossFit() const { return fELossFit; }
142 * Get the secondary correction map
144 * @return Get the secondary correction map object or null
146 AliFMDCorrSecondaryMap* GetSecondaryMap() const { return fSecondaryMap; }
148 * Get the double hit correction object
150 * @return Get the double hit correction object or null
152 AliFMDCorrDoubleHit* GetDoubleHit() const { return fDoubleHit; }
154 * Get the vertex bias correction object
156 * @return Get the vertex bias correction object or null
158 AliFMDCorrVertexBias* GetVertexBias() const { return fVertexBias; }
160 * Get the merging efficiency
163 * @return Get the vertex efficiency correction
165 AliFMDCorrMergingEfficiency* GetMergingEfficiency() const
167 return fMergingEfficiency;
170 * Get the acceptance correction due to dead channels
173 * @return Acceptance correction due to dead channels
175 AliFMDCorrAcceptance* GetAcceptance() const { return fAcceptance; }
178 * @name Path, file, and object access utilities
181 * Get the path to the specified object
183 * @param what Which stuff to get the path for
184 * @param sys Collision system
185 * @param sNN Center of mass energy [GeV]
186 * @param field Magnetic field in the L3 magnet [kG]
187 * @param mc Whether the correction objects should be valid for MC
189 * @return The file name (sans directory) or null
191 TString GetFileName(ECorrection what,
197 * Get the file name of the specified object
199 * @param what Which stuff to get the path for
201 * @return The file name (sans directory) or null
203 TString GetFileName(ECorrection what) const;
205 * Get the path to the specified object
207 * @param what Which stuff to get the path for
209 * @return The files directory full path or null
211 const Char_t* GetFileDir(ECorrection what) const;
213 * Get the path to the specified object
215 * @param what Which stuff to get the path for
216 * @param sys Collision system
217 * @param sNN Center of mass energy [GeV]
218 * @param field Magnetic field in the L3 magnet [kG]
219 * @param mc Whether the correction objects should be valid for MC
221 * @return The full path or null
223 TString GetFilePath(ECorrection what,
229 * Get the full path to the object. Note, the manager must be
230 * initialised for this to work
232 * @param what Which stuff to get the path for
234 * @return The full path or null
236 TString GetFilePath(ECorrection what) const;
238 * Open the file that contains the correction object specified
240 * @param what Which stuff to get the path for
241 * @param sys Collision system
242 * @param sNN Center of mass energy [GeV]
243 * @param field Magnetic field in the L3 magnet [kG]
244 * @param mc Whether the correction objects should be valid for MC
245 * @param rw Whether to open the file in read/write
246 * @param newfile Wheter to make the file if it doesn't exist
248 * @return The file that contains the correction object or null
250 TFile* GetFile(ECorrection what,
256 Bool_t newfile=false) const;
258 * Get the file that contains the object specifed. Note, the manager
259 * must be initialised for this to work.
261 * @param what Which stuff to get the path for
263 * @return The file that contains the correction object or null
265 TFile* GetFile(ECorrection what) const;
267 * Get the object name corresponding to correction type
269 * @param what Correction
271 * @return Object name or null
273 const Char_t* GetObjectName(ECorrection what) const;
275 * Check if the specified objet exists in the file, and return it
277 * @param file File to query
278 * @param what Correction type
280 * @return Object found, or null
282 TObject* CheckObject(TFile* file, ECorrection what) const;
284 * Get the path to the specified object
286 * @param what Which stuff to get the path for
287 * @param sys Collision system
288 * @param sNN Center of mass energy [GeV]
289 * @param field Magnetic field in the L3 magnet [kG]
290 * @param mc Whether the correction objects should be valid for MC
292 * @return The full path or null
294 TObject* GetObject(ECorrection what,
300 * Get the object that contaisn the specified correction
302 * @param what Which object to get
304 * @return The object or null
306 TObject* GetObject(ECorrection what) const;
317 * @param option Passed verbatim to correction objects
319 void Print(Option_t* option="") const;
323 * @param b Browser to use
325 void Browse(TBrowser* b);
330 * Write a correction object to (a temporary) file.
332 * @param what What kind of correction
333 * @param sys Collision system
334 * @param cms Center of mass energy
336 * @param mc Whether this is for MC only
337 * @param o Object to write
338 * @param full If true, write to full path
340 * @return True on success
342 Bool_t WriteFile(ECorrection what,
343 UShort_t sys, UShort_t cms, Short_t field, Bool_t mc,
344 TObject* o, Bool_t full) const;
349 * @param o Object to copy from
351 AliForwardCorrectionManager(const AliForwardCorrectionManager& o);
353 * Assignment operator
355 * @param o Object to assign from
357 * @return Reference to this object
359 AliForwardCorrectionManager& operator=(const AliForwardCorrectionManager& o);
362 * @name Read in corrections
365 * Read in the secondary map
367 * @param sys Collision system
368 * @param sNN Center of mass energy [GeV]
369 * @param field Magnetic field in the L3 magnet [kG]
371 * @return True on success, false otherwise
373 Bool_t ReadSecondaryMap(UShort_t sys, UShort_t sNN, Short_t field);
375 * Read in the double hit correction
377 * @param sys Collision system
378 * @param sNN Center of mass energy [GeV]
379 * @param field Magnetic field in the L3 magnet [kG]
381 * @return True on success, false otherwise
383 Bool_t ReadDoubleHit(UShort_t sys, UShort_t sNN, Short_t field);
385 * Read in the energy loss fits
387 * @param sys Collision system
388 * @param sNN Center of mass energy [GeV]
389 * @param field Magnetic field in the L3 magnet [kG]
390 * @param mc Whether the correction objects should be valid for MC
392 * @return True on success, false otherwise
394 Bool_t ReadELossFits(UShort_t sys, UShort_t sNN, Short_t field, Bool_t mc);
396 * Read in the event selection efficiency
398 * @param sys Collision system
399 * @param sNN Center of mass energy [GeV]
400 * @param field Magnetic field in the L3 magnet [kG]
402 * @return True on success, false otherwise
404 Bool_t ReadVertexBias(UShort_t sys, UShort_t sNN, Short_t field);
406 * Read in the merging efficiency
408 * @param sys Collision system
409 * @param sNN Center of mass energy [GeV]
410 * @param field Magnetic field in the L3 magnet [kG]
412 * @return True on success, false otherwise
414 Bool_t ReadMergingEfficiency(UShort_t sys, UShort_t sNN, Short_t field);
416 * Read in the acceptance correction due to dead-channels
418 * @param sys Collision system
419 * @param sNN Center of mass energy [GeV]
420 * @param field Magnetic field in the L3 magnet [kG]
422 * @return True on success, false otherwise
424 Bool_t ReadAcceptance(UShort_t sys, UShort_t sNN, Short_t field);
429 /** Static singleton instance */
430 static AliForwardCorrectionManager* fgInstance; // Skeleton
431 Bool_t fInit; // whether we have been initialised
432 UShort_t fSys; // Collision System
433 UShort_t fSNN; // Collision energy per nucleon (GeV)
434 Short_t fField; // L3 magnetic field (kG)
440 TString fELossFitsPath; // Path to energy loss fit correction
441 TString fMergingEffPath; // Path to sharing efficiency correction
442 TString fSecondaryMapPath; // Path to secondary efficiency correction
443 TString fDoubleHitPath; // Path to double hit correction
444 TString fVertexBiasPath; // Path to event selection efficiency correction
445 TString fAcceptancePath; // Path to acceptance correction from dead areas
453 static const Char_t* fgkSecondaryMapSkel; // Name of correction object
454 static const Char_t* fgkDoubleHitSkel; // Name of correction object
455 static const Char_t* fgkELossFitsSkel; // Name of correction object
456 static const Char_t* fgkVertexBiasSkel; // Name of correction object
457 static const Char_t* fgkMergingEffSkel; // Name of correction object
458 static const Char_t* fgkAcceptanceSkel; // Name of correction object
464 * @name Correction objects
466 AliFMDCorrELossFit* fELossFit; // Energy loss fits
467 AliFMDCorrSecondaryMap* fSecondaryMap; // Secondary particle correction
468 AliFMDCorrDoubleHit* fDoubleHit; // Double hit corr. (low flux)
469 AliFMDCorrVertexBias* fVertexBias; // Vertex bias correction
470 AliFMDCorrMergingEfficiency* fMergingEfficiency; // Merging eff.
471 AliFMDCorrAcceptance* fAcceptance; // Acceptance corr.
475 ClassDef(AliForwardCorrectionManager,2) // Manager of corrections
477 //____________________________________________________________________
479 AliForwardCorrectionManager::GetEtaAxis() const
481 if (!fSecondaryMap) return 0;
482 return &(fSecondaryMap->GetEtaAxis());
484 //____________________________________________________________________
486 AliForwardCorrectionManager::GetVertexAxis() const
488 if (!fSecondaryMap) return 0;
489 return &(fSecondaryMap->GetVertexAxis());