]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // Manager (singleton) of corrections | |
3 | // | |
0bd4b00f | 4 | #include "AliForwardCorrectionManager.h" |
8449e3e0 | 5 | #include "AliFMDCorrSecondaryMap.h" |
fb3430ac | 6 | #include "AliFMDCorrDoubleHit.h" |
7 | #include "AliFMDCorrELossFit.h" | |
8 | #include "AliFMDCorrVertexBias.h" | |
9 | #include "AliFMDCorrMergingEfficiency.h" | |
10 | #include "AliFMDCorrAcceptance.h" | |
0bd4b00f | 11 | #include "AliForwardUtil.h" |
8449e3e0 | 12 | #include "AliOADBForward.h" |
0bd4b00f | 13 | #include <TString.h> |
14 | #include <AliLog.h> | |
15 | #include <TFile.h> | |
16 | #include <TSystem.h> | |
19abe41d | 17 | #include <TBrowser.h> |
18 | #include <TROOT.h> | |
8449e3e0 | 19 | #include <TClass.h> |
19abe41d | 20 | #include <iostream> |
21 | #include <iomanip> | |
0bd4b00f | 22 | |
23 | //____________________________________________________________________ | |
8449e3e0 | 24 | AliForwardCorrectionManager* AliForwardCorrectionManager::fgInstance= 0; |
0bd4b00f | 25 | const char* AliForwardCorrectionManager::fgkSecondaryMapSkel = "secondary"; |
26 | const char* AliForwardCorrectionManager::fgkDoubleHitSkel = "doublehit"; | |
27 | const char* AliForwardCorrectionManager::fgkELossFitsSkel = "elossfits"; | |
28 | const char* AliForwardCorrectionManager::fgkVertexBiasSkel = "vertexbias"; | |
29 | const char* AliForwardCorrectionManager::fgkMergingEffSkel = "merging"; | |
72cc12cd | 30 | const char* AliForwardCorrectionManager::fgkAcceptanceSkel = "acceptance"; |
0bd4b00f | 31 | |
8449e3e0 | 32 | #define PREFIX "$(ALICE_ROOT)/OADB/PWGLF/FORWARD/CORRECTIONS/data/" |
33 | #define DB_NAME "fmd_corrections.root" | |
0bd4b00f | 34 | |
35 | //____________________________________________________________________ | |
36 | AliForwardCorrectionManager& AliForwardCorrectionManager::Instance() | |
37 | { | |
7984e5f7 | 38 | // |
39 | // Access to the singleton object | |
40 | // | |
41 | // Return: | |
42 | // Reference to the singleton object | |
43 | // | |
8449e3e0 | 44 | if (!fgInstance) fgInstance= new AliForwardCorrectionManager(false); |
0bd4b00f | 45 | return *fgInstance; |
46 | } | |
47 | ||
48 | //____________________________________________________________________ | |
49 | AliForwardCorrectionManager::AliForwardCorrectionManager() | |
0bd4b00f | 50 | { |
7984e5f7 | 51 | // |
52 | // Default constructor | |
53 | // | |
0bd4b00f | 54 | } |
55 | //____________________________________________________________________ | |
8449e3e0 | 56 | AliForwardCorrectionManager::AliForwardCorrectionManager(Bool_t d) |
57 | : AliCorrectionManagerBase(d) | |
0bd4b00f | 58 | { |
7984e5f7 | 59 | // |
8449e3e0 | 60 | // Non-default constructor |
7984e5f7 | 61 | // |
62 | // Parameters: | |
8449e3e0 | 63 | // Not used |
7984e5f7 | 64 | // |
8449e3e0 | 65 | RegisterCorrection(kIdSecondaryMap, fgkSecondaryMapSkel, |
66 | PREFIX DB_NAME, AliFMDCorrSecondaryMap::Class(), | |
67 | kStandard|kSatellite); | |
68 | RegisterCorrection(kIdELossFits, fgkELossFitsSkel, | |
69 | PREFIX DB_NAME, AliFMDCorrELossFit::Class(), kFull); | |
70 | RegisterCorrection(kIdVertexBias, fgkVertexBiasSkel, | |
71 | PREFIX DB_NAME, AliFMDCorrVertexBias::Class(), | |
72 | kStandard|kSatellite); | |
73 | RegisterCorrection(kIdMergingEfficiency, fgkMergingEffSkel, | |
74 | PREFIX DB_NAME, AliFMDCorrMergingEfficiency::Class(), | |
75 | kStandard|kSatellite); | |
76 | RegisterCorrection(kIdDoubleHit, fgkDoubleHitSkel, | |
77 | PREFIX DB_NAME, AliFMDCorrDoubleHit::Class(), | |
78 | kStandard|kMC); | |
79 | RegisterCorrection(kIdAcceptance, fgkAcceptanceSkel, | |
80 | PREFIX DB_NAME, AliFMDCorrAcceptance::Class(), | |
81 | kRun|kSys|kSNN|kSatellite); | |
0bd4b00f | 82 | } |
0bd4b00f | 83 | //____________________________________________________________________ |
84 | Bool_t | |
8449e3e0 | 85 | AliForwardCorrectionManager::Init(ULong_t runNo, |
86 | const char* sys, | |
87 | Float_t sNN, | |
88 | Float_t field, | |
89 | Bool_t mc, | |
90 | Bool_t sat, | |
91 | UInt_t what, | |
92 | Bool_t force) | |
0bd4b00f | 93 | { |
7984e5f7 | 94 | // |
95 | // Read in correction based on passed parameters | |
96 | // | |
97 | // Parameters: | |
98 | // collisionSystem Collision system string | |
99 | // cmsNN Center of mass energy per nucleon pair [GeV] | |
100 | // field Magnetic field [kG] | |
101 | // mc Monte-carlo switch | |
102 | // what What to read in | |
103 | // force Force (re-)reading of specified things | |
104 | // | |
105 | // Return: | |
106 | // true on success | |
107 | // | |
8449e3e0 | 108 | UShort_t col = AliForwardUtil::ParseCollisionSystem(sys); |
cc83fca2 | 109 | // AliInfo(Form("Initialising with cms='%s', sNN=%fGeV field=%fkG", |
110 | // cms, sNN, field)); | |
8449e3e0 | 111 | return Init(runNo, col, |
0bd4b00f | 112 | AliForwardUtil::ParseCenterOfMassEnergy(col, sNN), |
113 | AliForwardUtil::ParseMagneticField(field), | |
8449e3e0 | 114 | mc, sat, what, force); |
0bd4b00f | 115 | } |
116 | ||
117 | //____________________________________________________________________ | |
118 | Bool_t | |
8449e3e0 | 119 | AliForwardCorrectionManager::Init(ULong_t runNo, |
120 | UShort_t sys, | |
121 | UShort_t sNN, | |
122 | Short_t field, | |
123 | Bool_t mc, | |
124 | Bool_t sat, | |
125 | UInt_t what, | |
126 | Bool_t force) | |
0bd4b00f | 127 | { |
7984e5f7 | 128 | // |
129 | // Read in corrections based on the parameters given | |
130 | // | |
131 | // Parameters: | |
132 | // collisionSystem Collision system | |
133 | // cmsNN Center of mass energy per nuclean pair [GeV] | |
134 | // field Magnetic field setting [kG] | |
135 | // mc Monte-carlo switch | |
136 | // what What to read in. | |
137 | // force Force (re-)reading of specified things | |
138 | // | |
139 | // Return: | |
140 | // | |
141 | // | |
8449e3e0 | 142 | EnableCorrection(kIdSecondaryMap, what & kSecondaryMap); |
143 | EnableCorrection(kIdDoubleHit, what & kDoubleHit); | |
144 | EnableCorrection(kIdELossFits, what & kELossFits); | |
145 | EnableCorrection(kIdAcceptance, what & kAcceptance); | |
146 | EnableCorrection(kIdVertexBias, what & kVertexBias); | |
147 | EnableCorrection(kIdMergingEfficiency,what & kMergingEfficiency); | |
0bd4b00f | 148 | |
8449e3e0 | 149 | return InitCorrections(runNo, sys, sNN, field, mc, sat, force); |
0bd4b00f | 150 | } |
151 | ||
152 | //____________________________________________________________________ | |
8449e3e0 | 153 | UInt_t |
154 | AliForwardCorrectionManager::ParseFields(const TString& fields) | |
0bd4b00f | 155 | { |
8449e3e0 | 156 | UInt_t ret = 0; |
157 | TObjArray* tokens = fields.Tokenize(" \t,|+:;-&"); | |
158 | TIter next(tokens); | |
159 | TObjString* ostr = 0; | |
160 | while ((ostr = static_cast<TObjString*>(next()))) { | |
161 | const TString& str = ostr->String(); | |
162 | ||
163 | if (str.Contains("all", TString::kIgnoreCase)) | |
164 | ret |= kAll; | |
165 | else if (str.Contains("default", TString::kIgnoreCase)) | |
166 | ret |= kDefault; | |
167 | else if (str.Contains(fgkSecondaryMapSkel, TString::kIgnoreCase)) | |
168 | ret |= kSecondaryMap; | |
169 | else if (str.Contains(fgkDoubleHitSkel, TString::kIgnoreCase)) | |
170 | ret |= kDoubleHit; | |
171 | else if (str.Contains(fgkELossFitsSkel, TString::kIgnoreCase)) | |
172 | ret |= kELossFits; | |
173 | else if (str.Contains(fgkVertexBiasSkel, TString::kIgnoreCase)) | |
174 | ret |= kVertexBias; | |
175 | else if (str.Contains(fgkMergingEffSkel, TString::kIgnoreCase)) | |
176 | ret |= kMergingEfficiency; | |
177 | else if (str.Contains(fgkAcceptanceSkel, TString::kIgnoreCase)) | |
178 | ret |= kAcceptance; | |
179 | else | |
180 | AliWarningClassF("Unknown correction: %s", str.Data()); | |
181 | } | |
182 | delete tokens; | |
183 | return ret; | |
0bd4b00f | 184 | } |
185 | ||
0bd4b00f | 186 | |
187 | //____________________________________________________________________ | |
8449e3e0 | 188 | Bool_t |
189 | AliForwardCorrectionManager::Append(const TString& addition, | |
190 | const TString& destination) const | |
0bd4b00f | 191 | { |
8449e3e0 | 192 | TString dest(destination); |
193 | if (dest.IsNull()) | |
194 | dest = PREFIX DB_NAME; | |
2a50d35b | 195 | return AliCorrectionManagerBase::Append(addition, dest); |
0bd4b00f | 196 | } |
197 | ||
198 | ||
199 | //____________________________________________________________________ | |
8449e3e0 | 200 | const AliFMDCorrELossFit* |
201 | AliForwardCorrectionManager::GetELossFit() const | |
0bd4b00f | 202 | { |
8449e3e0 | 203 | /** |
204 | * Get the energy loss fit correction object. | |
205 | * | |
206 | * @return Get the energy loss fits corrections object or null pointer | |
207 | */ | |
208 | return static_cast<const AliFMDCorrELossFit*>(Get(kIdELossFits)); | |
0bd4b00f | 209 | } |
0bd4b00f | 210 | //____________________________________________________________________ |
8449e3e0 | 211 | const AliFMDCorrSecondaryMap* |
212 | AliForwardCorrectionManager::GetSecondaryMap() const | |
0bd4b00f | 213 | { |
8449e3e0 | 214 | /** |
215 | * Get the secondary correction map | |
216 | * | |
217 | * @return Get the secondary correction map object or null | |
218 | */ | |
219 | return static_cast<const AliFMDCorrSecondaryMap*>(Get(kIdSecondaryMap)); | |
0bd4b00f | 220 | } |
0bd4b00f | 221 | //____________________________________________________________________ |
8449e3e0 | 222 | const AliFMDCorrDoubleHit* |
223 | AliForwardCorrectionManager::GetDoubleHit() const | |
0bd4b00f | 224 | { |
8449e3e0 | 225 | /** |
226 | * Get the double hit correction object | |
227 | * | |
228 | * @return Get the double hit correction object or null | |
229 | */ | |
230 | return static_cast<const AliFMDCorrDoubleHit*>(Get(kIdDoubleHit)); | |
0bd4b00f | 231 | } |
0bd4b00f | 232 | //____________________________________________________________________ |
8449e3e0 | 233 | const AliFMDCorrVertexBias* |
234 | AliForwardCorrectionManager::GetVertexBias() const | |
0bd4b00f | 235 | { |
8449e3e0 | 236 | /** |
237 | * Get the vertex bias correction object | |
238 | * | |
239 | * @return Get the vertex bias correction object or null | |
240 | */ | |
241 | return static_cast<const AliFMDCorrVertexBias*>(Get(kIdVertexBias)); | |
0bd4b00f | 242 | } |
72cc12cd | 243 | //____________________________________________________________________ |
8449e3e0 | 244 | const AliFMDCorrMergingEfficiency* |
245 | AliForwardCorrectionManager::GetMergingEfficiency() const | |
72cc12cd | 246 | { |
8449e3e0 | 247 | /** |
248 | * Get the merging efficiency | |
249 | * | |
250 | * | |
251 | * @return Get the vertex efficiency correction | |
252 | */ | |
253 | return | |
254 | static_cast<const AliFMDCorrMergingEfficiency*>(Get(kIdMergingEfficiency)); | |
72cc12cd | 255 | } |
19abe41d | 256 | //____________________________________________________________________ |
8449e3e0 | 257 | const AliFMDCorrAcceptance* |
258 | AliForwardCorrectionManager::GetAcceptance() const | |
19abe41d | 259 | { |
8449e3e0 | 260 | /** |
261 | * Get the acceptance correction due to dead channels | |
262 | * | |
263 | * | |
264 | * @return Acceptance correction due to dead channels | |
265 | */ | |
266 | return static_cast<const AliFMDCorrAcceptance*>(Get(kIdAcceptance)); | |
19abe41d | 267 | } |
268 | ||
269 | //____________________________________________________________________ | |
8449e3e0 | 270 | const TAxis* |
271 | AliForwardCorrectionManager::GetEtaAxis() const | |
19abe41d | 272 | { |
8449e3e0 | 273 | const AliFMDCorrSecondaryMap* map = GetSecondaryMap(); |
274 | if (!map) return 0; | |
275 | return &(map->GetEtaAxis()); | |
19abe41d | 276 | } |
e42d5338 | 277 | //____________________________________________________________________ |
8449e3e0 | 278 | const TAxis* |
279 | AliForwardCorrectionManager::GetVertexAxis() const | |
e42d5338 | 280 | { |
8449e3e0 | 281 | const AliFMDCorrSecondaryMap* map = GetSecondaryMap(); |
282 | if (!map) return 0; | |
283 | return &(map->GetVertexAxis()); | |
e42d5338 | 284 | } |
285 | ||
8449e3e0 | 286 | |
ffca499d | 287 | #ifndef DOXY_INPUT |
19abe41d | 288 | //______________________________________________________________________________ |
289 | void AliForwardCorrectionManager::Streamer(TBuffer &R__b) | |
290 | { | |
fb3430ac | 291 | // |
292 | // Stream an object of class AliForwardCorrectionManager. | |
293 | // | |
294 | if (R__b.IsReading()) { | |
295 | R__b.ReadClassBuffer(AliForwardCorrectionManager::Class(),this); | |
8449e3e0 | 296 | if (fgInstance) { |
fb3430ac | 297 | AliWarning(Form("Singleton instance already set (%p) when reading " |
298 | "singleton object (%p). Read object will be new " | |
299 | "singleton object", fgInstance, this)); | |
8449e3e0 | 300 | // delete fgInstance; |
301 | } | |
fb3430ac | 302 | fgInstance = this; |
8449e3e0 | 303 | // fgInstance->fCorrections.ls(); |
fb3430ac | 304 | } else { |
305 | R__b.WriteClassBuffer(AliForwardCorrectionManager::Class(),this); | |
306 | } | |
19abe41d | 307 | } |
308 | #endif | |
72cc12cd | 309 | |
0bd4b00f | 310 | //____________________________________________________________________ |
311 | // | |
312 | // EOF | |
313 | // |