2 // Manager (singleton) of corrections
4 #ifndef ALIFORWARDCORRECTIONMANAGER_H
5 #define ALIFORWARDCORRECTIONMANAGER_H
7 #include "AliFMDCorrELossFit.h"
8 #include "AliFMDCorrSecondaryMap.h"
9 #include "AliFMDCorrDoubleHit.h"
10 #include "AliFMDCorrVertexBias.h"
11 #include "AliFMDCorrMergingEfficiency.h"
16 * Manager (singleton) of corrections
18 * @ingroup pwg2_forward_corr
20 class AliForwardCorrectionManager : public TObject
24 * Enumeration of things that can be read in
30 kMergingEfficiency = 0x08,
32 kAll = (kSecondaryMap|
39 * Access to the singleton object
41 * @return Reference to the singleton object
43 static AliForwardCorrectionManager& Instance();
45 * Read in corrections based on the parameters given
47 * @param collisionSystem Collision system
48 * @param cmsNN Center of mass energy per nuclean pair [GeV]
49 * @param field Magnetic field setting [kG]
50 * @param mc Monte-carlo switch
51 * @param what What to read in.
52 * @param force Force (re-)reading of specified things
56 Bool_t Init(UShort_t collisionSystem,
63 * Read in correction based on passed parameters
65 * @param collisionSystem Collision system string
66 * @param cmsNN Center of mass energy per nucleon pair [GeV]
67 * @param field Magnetic field [kG]
68 * @param mc Monte-carlo switch
69 * @param what What to read in
70 * @param force Force (re-)reading of specified things
72 * @return true on success
74 Bool_t Init(const char* collisionSystem,
83 * @return Eta axis or null
85 const TAxis* GetEtaAxis() const;
89 * @return The vertex axis or null
91 const TAxis* GetVertexAxis() const;
93 * Get the energy loss fit correction object.
95 * @return Get the energy loss fits corrections object or null pointer
97 AliFMDCorrELossFit* GetELossFit() const { return fELossFit; }
99 * Get the secondary correction map
101 * @return Get the secondary correction map object or null
103 AliFMDCorrSecondaryMap* GetSecondaryMap() const { return fSecondaryMap; }
105 * Get the double hit correction object
107 * @return Get the double hit correction object or null
109 AliFMDCorrDoubleHit* GetDoubleHit() const { return fDoubleHit; }
111 * Get the vertex bias correction object
113 * @return Get the vertex bias correction object or null
115 AliFMDCorrVertexBias* GetVertexBias() const { return fVertexBias; }
116 AliFMDCorrMergingEfficiency* GetMergingEfficiency() const
118 return fMergingEfficiency;
122 * @name Path, file, and object access utilities
125 * Get the path to the specified object
127 * @param what Which stuff to get the path for
128 * @param sys Collision system
129 * @param sNN Center of mass energy [GeV]
130 * @param field Magnetic field in the L3 magnet [kG]
131 * @param mc Whether the correction objects should be valid for MC
133 * @return The full path or null
135 TString GetFileName(ECorrection what,
141 * Get the file name of the specified object
143 * @param what Which stuff to get the path for
145 * @return The full path or null
147 TString GetFileName(ECorrection what) const;
149 * Get the path to the specified object
151 * @param what Which stuff to get the path for
153 * @return The full path or null
155 const Char_t* GetFileDir(ECorrection what) const;
157 * Get the path to the specified object
159 * @param what Which stuff to get the path for
160 * @param sys Collision system
161 * @param sNN Center of mass energy [GeV]
162 * @param field Magnetic field in the L3 magnet [kG]
163 * @param mc Whether the correction objects should be valid for MC
165 * @return The full path or null
167 TString GetFilePath(ECorrection what,
173 * Get the full path to the object. Note, the manager must be
174 * initialised for this to work
176 * @param what Which stuff to get the path for
178 * @return The full path or null
180 TString GetFilePath(ECorrection what) const;
182 * Open the file that contains the correction object specified
184 * @param what Which stuff to get the path for
185 * @param sys Collision system
186 * @param sNN Center of mass energy [GeV]
187 * @param field Magnetic field in the L3 magnet [kG]
188 * @param mc Whether the correction objects should be valid for MC
189 * @param rw Whether to open the file in read/write
190 * @param newfile Wheter to make the file if it doesn't exist
192 * @return The file that contains the correction object or null
194 TFile* GetFile(ECorrection what,
200 Bool_t newfile=false) const;
202 * Get the file that contains the object specifed. Note, the manager
203 * must be initialised for this to work.
205 * @param what Which stuff to get the path for
207 * @return The file that contains the correction object or null
209 TFile* GetFile(ECorrection what) const;
211 * Get the object name corresponding to correction type
213 * @param what Correction
215 * @return Object name or null
217 const Char_t* GetObjectName(ECorrection what) const;
219 * Check if the specified objet exists in the file, and return it
221 * @param file File to query
222 * @param what Correction type
224 * @return Object found, or null
226 TObject* CheckObject(TFile* file, ECorrection what) const;
228 * Get the path to the specified object
230 * @param what Which stuff to get the path for
231 * @param sys Collision system
232 * @param sNN Center of mass energy [GeV]
233 * @param field Magnetic field in the L3 magnet [kG]
234 * @param mc Whether the correction objects should be valid for MC
236 * @return The full path or null
238 TObject* GetObject(ECorrection what,
244 * Get the object that contaisn the specified correction
246 * @param what Which object to get
248 * @return The object or null
250 TObject* GetObject(ECorrection what) const;
256 * Default constructor
258 AliForwardCorrectionManager();
262 * @param o Object to copy from
264 AliForwardCorrectionManager(const AliForwardCorrectionManager& o);
266 * Assignment operator
268 * @param o Object to assign from
270 * @return Reference to this object
272 AliForwardCorrectionManager& operator=(const AliForwardCorrectionManager& o);
275 * @name Read in corrections
278 * Read in the secondary map
280 * @param sys Collision system
281 * @param sNN Center of mass energy [GeV]
282 * @param field Magnetic field in the L3 magnet [kG]
284 * @return True on success, false otherwise
286 Bool_t ReadSecondaryMap(UShort_t sys, UShort_t sNN, Short_t field);
288 * Read in the double hit correction
290 * @param sys Collision system
291 * @param sNN Center of mass energy [GeV]
292 * @param field Magnetic field in the L3 magnet [kG]
294 * @return True on success, false otherwise
296 Bool_t ReadDoubleHit(UShort_t sys, UShort_t sNN, Short_t field);
298 * Read in the energy loss fits
300 * @param sys Collision system
301 * @param sNN Center of mass energy [GeV]
302 * @param field Magnetic field in the L3 magnet [kG]
303 * @param mc Whether the correction objects should be valid for MC
305 * @return True on success, false otherwise
307 Bool_t ReadELossFits(UShort_t sys, UShort_t sNN, Short_t field, Bool_t mc);
309 * Read in the event selection efficiency
311 * @param sys Collision system
312 * @param sNN Center of mass energy [GeV]
313 * @param field Magnetic field in the L3 magnet [kG]
315 * @return True on success, false otherwise
317 Bool_t ReadVertexBias(UShort_t sys, UShort_t sNN, Short_t field);
319 * Read in the merging efficiency
321 * @param sys Collision system
322 * @param sNN Center of mass energy [GeV]
323 * @param field Magnetic field in the L3 magnet [kG]
325 * @return True on success, false otherwise
327 Bool_t ReadMergingEfficiency(UShort_t sys, UShort_t sNN, Short_t field);
332 /** Static singleton instance */
333 static AliForwardCorrectionManager* fgInstance;
334 Bool_t fInit; // whether we have been initialised
335 UShort_t fSys; // Collision System
336 UShort_t fSNN; // Collision energy per nucleon (GeV)
337 Short_t fField; // L3 magnetic field (kG)
343 TString fELossFitsPath; // Path to energy loss fit correction
344 TString fMergingEffPath; // Path to sharing efficiency correction
345 TString fSecondaryMapPath; // Path to secondary efficiency correction
346 TString fDoubleHitPath; // Path to double hit correction
347 TString fVertexBiasPath; // Path to event selection efficiency correction
355 static const Char_t* fgkSecondaryMapSkel; // Name of correction object
356 static const Char_t* fgkDoubleHitSkel; // Name of correction object
357 static const Char_t* fgkELossFitsSkel; // Name of correction object
358 static const Char_t* fgkVertexBiasSkel; // Name of correction object
359 static const Char_t* fgkMergingEffSkel; // Name of correction object
365 * @name Correction objects
367 AliFMDCorrELossFit* fELossFit; // Energy loss fits
368 AliFMDCorrSecondaryMap* fSecondaryMap; // Secondary particle correction
369 AliFMDCorrDoubleHit* fDoubleHit; // Double hit correction (low flux)
370 AliFMDCorrVertexBias* fVertexBias; // Vertex bias correction
371 AliFMDCorrMergingEfficiency* fMergingEfficiency;
376 ClassDef(AliForwardCorrectionManager,1) // Manager of corrections
378 //____________________________________________________________________
380 AliForwardCorrectionManager::GetEtaAxis() const
382 if (!fSecondaryMap) return 0;
383 return &(fSecondaryMap->GetEtaAxis());
385 //____________________________________________________________________
387 AliForwardCorrectionManager::GetVertexAxis() const
389 if (!fSecondaryMap) return 0;
390 return &(fSecondaryMap->GetVertexAxis());