1 #ifndef ALIROOT_PWG2_FORWARD_ALIFORWARDCORRECTIONMANAGER_H
2 #define ALIROOT_PWG2_FORWARD_ALIFORWARDCORRECTIONMANAGER_H
4 #include "AliFMDCorrELossFit.h"
5 #include "AliFMDCorrSecondaryMap.h"
6 #include "AliFMDCorrDoubleHit.h"
7 #include "AliFMDCorrVertexBias.h"
8 #include "AliFMDCorrMergingEfficiency.h"
13 * Manager (singleton) of corrections
15 * @ingroup pwg2_forward_corr
17 class AliForwardCorrectionManager : public TObject
21 * Enumeration of things that can be read in
27 kMergingEfficiency = 0x08,
29 kAll = (kSecondaryMap|
36 * Access to the singleton object
38 * @return Reference to the singleton object
40 static AliForwardCorrectionManager& Instance();
42 * Read in corrections based on the parameters given
44 * @param collisionSystem Collision system
45 * @param cmsNN Center of mass energy per nuclean pair [GeV]
46 * @param field Magnetic field setting [kG]
47 * @param mc Monte-carlo switch
48 * @param what What to read in.
49 * @param force Force (re-)reading of specified things
53 Bool_t Init(UShort_t collisionSystem,
59 Bool_t Init(const char* collisionSystem,
68 * @return Eta axis or null
70 const TAxis* GetEtaAxis() const;
74 * @return The vertex axis or null
76 const TAxis* GetVertexAxis() const;
78 * Get the energy loss fit correction object.
80 * @return Get the energy loss fits corrections object or null pointer
82 AliFMDCorrELossFit* GetELossFit() const { return fELossFit; }
84 * Get the secondary correction map
86 * @return Get the secondary correction map object or null
88 AliFMDCorrSecondaryMap* GetSecondaryMap() const { return fSecondaryMap; }
90 * Get the double hit correction object
92 * @return Get the double hit correction object or null
94 AliFMDCorrDoubleHit* GetDoubleHit() const { return fDoubleHit; }
96 * Get the vertex bias correction object
98 * @return Get the vertex bias correction object or null
100 AliFMDCorrVertexBias* GetVertexBias() const { return fVertexBias; }
101 AliFMDCorrMergingEfficiency* GetMergingEfficiency() const
103 return fMergingEfficiency;
107 * @name Path, file, and object access utilities
110 * Get the path to the specified object
112 * @param what Which stuff to get the path for
113 * @param sys Collision system
114 * @param sNN Center of mass energy [GeV]
115 * @param field Magnetic field in the L3 magnet [kG]
116 * @param mc Whether the correction objects should be valid for MC
118 * @return The full path or null
120 TString GetFileName(ECorrection what,
125 TString GetFileName(ECorrection what) const;
127 * Get the path to the specified object
129 * @param what Which stuff to get the path for
131 * @return The full path or null
133 const Char_t* GetFileDir(ECorrection what) const;
135 * Get the path to the specified object
137 * @param what Which stuff to get the path for
138 * @param sys Collision system
139 * @param sNN Center of mass energy [GeV]
140 * @param field Magnetic field in the L3 magnet [kG]
141 * @param mc Whether the correction objects should be valid for MC
143 * @return The full path or null
145 TString GetFilePath(ECorrection what,
150 TString GetFilePath(ECorrection what) const;
152 * Open the file that contains the correction object specified
154 * @param what Which stuff to get the path for
155 * @param sys Collision system
156 * @param sNN Center of mass energy [GeV]
157 * @param field Magnetic field in the L3 magnet [kG]
158 * @param mc Whether the correction objects should be valid for MC
159 * @param rw Whether to open the file in read/write
160 * @param newfile Wheter to make the file if it doesn't exist
162 * @return The file that contains the correction object or null
164 TFile* GetFile(ECorrection what,
170 Bool_t newfile=false) const;
171 TFile* GetFile(ECorrection what) const;
173 * Get the object name corresponding to correction type
175 * @param what Correction
177 * @return Object name or null
179 const Char_t* GetObjectName(ECorrection what) const;
181 * Check if the specified objet exists in the file, and return it
183 * @param file File to query
184 * @param what Correction type
186 * @return Object found, or null
188 TObject* CheckObject(TFile* file, ECorrection what) const;
190 * Get the path to the specified object
192 * @param what Which stuff to get the path for
193 * @param sys Collision system
194 * @param sNN Center of mass energy [GeV]
195 * @param field Magnetic field in the L3 magnet [kG]
196 * @param mc Whether the correction objects should be valid for MC
198 * @return The full path or null
200 TObject* GetObject(ECorrection what,
205 TObject* GetObject(ECorrection what) const;
211 * Default constructor
213 AliForwardCorrectionManager();
217 * @param o Object to copy from
219 AliForwardCorrectionManager(const AliForwardCorrectionManager& o);
221 * Assignment operator
223 * @param o Object to assign from
225 * @return Reference to this object
227 AliForwardCorrectionManager& operator=(const AliForwardCorrectionManager& o);
230 * @name Read in corrections
233 * Read in the secondary map
235 * @param sys Collision system
236 * @param sNN Center of mass energy [GeV]
237 * @param field Magnetic field in the L3 magnet [kG]
239 * @return True on success, false otherwise
241 Bool_t ReadSecondaryMap(UShort_t sys, UShort_t sNN, Short_t field);
243 * Read in the double hit correction
245 * @param sys Collision system
246 * @param sNN Center of mass energy [GeV]
247 * @param field Magnetic field in the L3 magnet [kG]
249 * @return True on success, false otherwise
251 Bool_t ReadDoubleHit(UShort_t sys, UShort_t sNN, Short_t field);
253 * Read in the energy loss fits
255 * @param sys Collision system
256 * @param sNN Center of mass energy [GeV]
257 * @param field Magnetic field in the L3 magnet [kG]
258 * @param mc Whether the correction objects should be valid for MC
260 * @return True on success, false otherwise
262 Bool_t ReadELossFits(UShort_t sys, UShort_t sNN, Short_t field, Bool_t mc);
264 * Read in the event selection efficiency
266 * @param sys Collision system
267 * @param sNN Center of mass energy [GeV]
268 * @param field Magnetic field in the L3 magnet [kG]
270 * @return True on success, false otherwise
272 Bool_t ReadVertexBias(UShort_t sys, UShort_t sNN, Short_t field);
274 * Read in the merging efficiency
276 * @param sys Collision system
277 * @param sNN Center of mass energy [GeV]
278 * @param field Magnetic field in the L3 magnet [kG]
280 * @return True on success, false otherwise
282 Bool_t ReadMergingEfficiency(UShort_t sys, UShort_t sNN, Short_t field);
287 /** Static singleton instance */
288 static AliForwardCorrectionManager* fgInstance;
289 Bool_t fInit; // whether we have been initialised
290 UShort_t fSys; // Collision System
291 UShort_t fSNN; // Collision energy per nucleon (GeV)
292 Short_t fField; // L3 magnetic field (kG)
298 TString fELossFitsPath; // Path to energy loss fit correction
299 TString fMergingEffPath; // Path to sharing efficiency correction
300 TString fSecondaryMapPath; // Path to secondary efficiency correction
301 TString fDoubleHitPath; // Path to double hit correction
302 TString fVertexBiasPath; // Path to event selection efficiency correction
310 static const Char_t* fgkSecondaryMapSkel; // Name of correction object
311 static const Char_t* fgkDoubleHitSkel; // Name of correction object
312 static const Char_t* fgkELossFitsSkel; // Name of correction object
313 static const Char_t* fgkVertexBiasSkel; // Name of correction object
314 static const Char_t* fgkMergingEffSkel; // Name of correction object
320 * @name Correction objects
322 AliFMDCorrELossFit* fELossFit; // Energy loss fits
323 AliFMDCorrSecondaryMap* fSecondaryMap; // Secondary particle correction
324 AliFMDCorrDoubleHit* fDoubleHit; // Double hit correction (low flux)
325 AliFMDCorrVertexBias* fVertexBias; // Vertex bias correction
326 AliFMDCorrMergingEfficiency* fMergingEfficiency;
331 ClassDef(AliForwardCorrectionManager,1) // Manager of corrections
333 //____________________________________________________________________
335 AliForwardCorrectionManager::GetEtaAxis() const
337 if (!fSecondaryMap) return 0;
338 return &(fSecondaryMap->GetEtaAxis());
340 //____________________________________________________________________
342 AliForwardCorrectionManager::GetVertexAxis() const
344 if (!fSecondaryMap) return 0;
345 return &(fSecondaryMap->GetVertexAxis());