]>
Commit | Line | Data |
---|---|---|
8449e3e0 | 1 | #ifndef __CINT__ |
2 | # include "SummaryDrawer.C" | |
3 | # include "AliFMDCorrAcceptance.h" | |
4 | # include "AliFMDCorrSecondaryMap.h" | |
5 | # include "AliFMDCorrELossFit.h" | |
0ccdab7b | 6 | # include "AliFMDCorrNoiseGain.h" |
8449e3e0 | 7 | # include "AliForwardUtil.h" |
8 | # include "AliForwardCorrectionManager.h" | |
9 | # include "AliLog.h" | |
10 | # include <TString.h> | |
11 | # include <TError.h> | |
12 | #else | |
e65b8b56 | 13 | class SummaryDrawer; |
14 | class TObject; | |
bfab35d9 | 15 | // class TAxis; |
e65b8b56 | 16 | class AliFMDCorrAcceptance; |
17 | class AliFMDCorrSecondaryMap; | |
18 | class AliFMDCorrELossFit; | |
0ccdab7b | 19 | class AliFMDCorrNoiseGain; |
e65b8b56 | 20 | #include <TString.h> |
8449e3e0 | 21 | #endif |
22 | ||
23 | class CorrDrawer : public SummaryDrawer | |
24 | { | |
25 | public: | |
81775aba | 26 | TString fELossExtra; |
27 | UShort_t fMinQuality; | |
8449e3e0 | 28 | /** |
29 | * Constructor | |
8449e3e0 | 30 | */ |
31 | CorrDrawer() | |
32 | { | |
0ccdab7b | 33 | fELossExtra = ""; // forward_eloss.root"; |
81775aba | 34 | fMinQuality = 8; |
8449e3e0 | 35 | } |
36 | /** | |
37 | * Destructor. Closes the PDF | |
38 | */ | |
39 | ~CorrDrawer() | |
40 | { | |
41 | CloseCanvas(); | |
42 | } | |
43 | /** | |
44 | * Create output file name | |
45 | * | |
46 | * @param out Output file name on return | |
47 | * @param prefix Prefix of the file name | |
671df6c9 | 48 | */ |
49 | static void MakeFileName(TString& out, | |
50 | const TString& prefix) | |
8449e3e0 | 51 | { |
e65b8b56 | 52 | out = TString::Format("forward_%s.pdf", prefix.Data()); |
8449e3e0 | 53 | } |
a19faec0 | 54 | |
55 | /** | |
56 | * Run the correction drawer, fetching information from extra file | |
57 | * | |
58 | * @param what What to draw | |
59 | * @param extra Extra file | |
60 | * @param options Options | |
61 | * @param local Local DB | |
62 | */ | |
63 | void Run(const Char_t* what, | |
64 | const Char_t* extra, | |
65 | Option_t* options="", | |
66 | const Char_t* local="") | |
67 | { | |
68 | Run(AliForwardCorrectionManager::ParseFields(what), | |
69 | extra, options, local); | |
70 | } | |
71 | /** | |
72 | * Run the correction drawer, fetching information from extra file | |
73 | * | |
74 | * @param what What to draw | |
75 | * @param extra Extra file | |
76 | * @param options Options | |
77 | * @param local Local DB | |
78 | */ | |
79 | void Run(UShort_t what, | |
80 | const Char_t* extra, | |
81 | Option_t* options="", | |
82 | const Char_t* local="") | |
83 | { | |
84 | fELossExtra = extra; | |
85 | ULong_t runNo = 0; | |
86 | UShort_t sys = 0; | |
87 | UShort_t sNN = 0; | |
88 | Short_t fld = 0; | |
89 | Bool_t mc = false; | |
90 | Bool_t sat = false; | |
91 | if (!GetInformation(runNo, sys, sNN, fld, mc, sat)) return; | |
92 | ||
93 | Run(what, runNo, sys, sNN, fld, mc, sat, options, local); | |
94 | } | |
95 | ||
8449e3e0 | 96 | /** |
97 | * Draw corrections using the correction manager to get them | |
98 | * | |
99 | * @param what What to draw | |
8449e3e0 | 100 | * @param runNo Run Number |
101 | * @param sys Collision system | |
102 | * @param sNN Center of mass energy | |
103 | * @param field L3 Field | |
104 | * @param mc Simulations or not | |
105 | * @param sat Satellite interactions or not | |
106 | * @param options Options | |
107 | * @param local Local database file | |
108 | */ | |
109 | void Run(const Char_t* what, | |
110 | ULong_t runNo, | |
111 | const Char_t* sys, | |
112 | UShort_t sNN, | |
113 | UShort_t field, | |
114 | Bool_t mc=false, | |
115 | Bool_t sat=false, | |
116 | Option_t* options="", | |
117 | const char* local="") | |
118 | { | |
119 | Run(AliForwardCorrectionManager::ParseFields(what), | |
120 | runNo, AliForwardUtil::ParseCollisionSystem(sys), | |
121 | sNN, field, mc, sat, options, local); | |
122 | } | |
123 | /** | |
124 | * Draw corrections using the correction manager to get them | |
125 | * | |
126 | * @param what What to draw | |
8449e3e0 | 127 | * @param runNo Run Number |
128 | * @param sys Collision system | |
129 | * @param sNN Center of mass energy | |
130 | * @param field L3 Field | |
131 | * @param mc Simulations or not | |
132 | * @param sat Satellite interactions or not | |
8449e3e0 | 133 | * @param local Local database file |
134 | */ | |
135 | void Run(UShort_t what, | |
136 | ULong_t runNo, | |
137 | UShort_t sys, | |
138 | UShort_t sNN, | |
139 | UShort_t field, | |
140 | Bool_t mc=false, | |
141 | Bool_t sat=false, | |
f37328ed | 142 | Option_t* options="", |
8449e3e0 | 143 | const char* local="") |
144 | { | |
145 | AliForwardCorrectionManager& mgr = AliForwardCorrectionManager::Instance(); | |
146 | mgr.SetDebug(true); | |
81775aba | 147 | |
a19faec0 | 148 | // Set local prefix |
149 | if (local) mgr.SetPrefix(gSystem->DirName(local)); | |
150 | ||
151 | // Get output file name | |
152 | TString name; | |
153 | if (what & AliForwardCorrectionManager::kSecondaryMap) | |
81775aba | 154 | AppendName(name, AliForwardCorrectionManager::kSecondaryMap); |
a19faec0 | 155 | if (what & AliForwardCorrectionManager::kAcceptance) |
81775aba | 156 | AppendName(name, AliForwardCorrectionManager::kAcceptance); |
a19faec0 | 157 | if (what & AliForwardCorrectionManager::kELossFits) |
81775aba | 158 | AppendName(name, AliForwardCorrectionManager::kELossFits); |
0ccdab7b | 159 | if (what & AliForwardCorrectionManager::kNoiseGain) |
160 | AppendName(name, AliForwardCorrectionManager::kNoiseGain); | |
8449e3e0 | 161 | if (what & AliForwardCorrectionManager::kVertexBias) |
162 | Warning("CorrDrawer","Vertex bias not implemented yet"); | |
163 | if (what & AliForwardCorrectionManager::kDoubleHit) | |
164 | Warning("CorrDrawer","Double hit not implemented yet"); | |
165 | if (what & AliForwardCorrectionManager::kMergingEfficiency) | |
166 | Warning("CorrDrawer","Merging efficiency not implemented yet"); | |
a19faec0 | 167 | |
168 | // Filter the ones we can handle | |
169 | UShort_t flags = what & (AliForwardCorrectionManager::kELossFits| | |
170 | AliForwardCorrectionManager::kAcceptance| | |
0ccdab7b | 171 | AliForwardCorrectionManager::kSecondaryMap| |
172 | AliForwardCorrectionManager::kNoiseGain); | |
8449e3e0 | 173 | if (!mgr.Init(runNo, sys, sNN, field, mc, sat, flags, true)) { |
174 | Error("CorrDrawer", "Failed to initialize for flags=0x%02x" | |
175 | "run=%lu, sys=%hu, sNN=%hu, field=%hd, mc=%d, sat=%d", | |
176 | flags, runNo, sys, sNN, field, mc, sat); | |
177 | return; | |
178 | } | |
179 | ||
180 | TString out; | |
c8b1a7db | 181 | MakeFileName(out, name); // , runNo, sys, sNN, field, mc, sat); |
f37328ed | 182 | |
183 | TString opts(options); | |
184 | opts.ToUpper(); | |
185 | Bool_t landscape = opts.Contains("LANDSCAPE"); | |
a19faec0 | 186 | Bool_t few = opts.Contains("FEW"); |
f37328ed | 187 | CreateCanvas(out, landscape); |
a19faec0 | 188 | |
8449e3e0 | 189 | |
190 | fBody->cd(); | |
191 | Double_t y = .8; | |
192 | DrawParameter(y, "Run #", Form("%lu", runNo)); | |
193 | DrawParameter(y, "System", AliForwardUtil::CollisionSystemString(sys)); | |
194 | DrawParameter(y, "#sqrt{s_{NN}}", | |
44bacd46 | 195 | AliForwardUtil::CenterOfMassEnergyString(sNN)); |
8449e3e0 | 196 | DrawParameter(y, "L3 field", AliForwardUtil::MagneticFieldString(field)); |
197 | DrawParameter(y, "Simulation", Form("%s", mc ? "yes" : "no")); | |
198 | DrawParameter(y, "Satellite", Form("%s", sat ? "yes" : "no")); | |
199 | PrintCanvas("Title"); | |
200 | ||
a19faec0 | 201 | Bool_t details = !opts.Contains("SINGLE"); |
202 | if (what & AliForwardCorrectionManager::kSecondaryMap) | |
203 | DrawIt(mgr.GetSecondaryMap(), details); | |
204 | if (what & AliForwardCorrectionManager::kAcceptance) | |
205 | DrawIt(mgr.GetAcceptance(), details); | |
206 | if (what & AliForwardCorrectionManager::kELossFits) | |
207 | DrawIt(mgr.GetELossFit(), details, few); | |
0ccdab7b | 208 | if (what & AliForwardCorrectionManager::kNoiseGain) |
209 | DrawIt(mgr.GetNoiseGain(), details); | |
a19faec0 | 210 | |
211 | // Done | |
8449e3e0 | 212 | CloseCanvas(); |
213 | } | |
214 | /** | |
215 | * Fall-back method | |
216 | * | |
217 | * @param o Object to draw | |
218 | */ | |
e65b8b56 | 219 | virtual void Draw(const TObject* o) |
8449e3e0 | 220 | { |
221 | if (!o) return; | |
222 | Warning("CorrDrawer", "Don't know how to draw a %s object", | |
223 | o->ClassName()); | |
224 | } | |
225 | /** | |
226 | * Draw a single plot of the mean acceptance correction | |
227 | * | |
228 | * @param acc Acceptance correction | |
229 | */ | |
e65b8b56 | 230 | virtual void Draw(const AliFMDCorrAcceptance* acc) { Summarize(acc, false); } |
8449e3e0 | 231 | /** |
232 | * Draw a single plot of the mean secondary correction | |
233 | * | |
234 | * @param sec Secondary correction | |
235 | */ | |
e65b8b56 | 236 | virtual void Draw(const AliFMDCorrSecondaryMap* sec) { Summarize(sec, false);} |
8449e3e0 | 237 | /** |
238 | * Draw a single plot summarizing the energy loss fits | |
239 | * | |
c8b1a7db | 240 | * @param fits Energy loss fits |
8449e3e0 | 241 | */ |
e65b8b56 | 242 | virtual void Draw(const AliFMDCorrELossFit* fits) { Summarize(fits, false); } |
8449e3e0 | 243 | /** |
244 | * A generalized entry to the summarization functions | |
245 | * | |
246 | * @param what What to show - only one field | |
247 | * @param runNo Run number | |
248 | * @param sys System | |
249 | * @param sNN Center of mass energy in GeV | |
250 | * @param field L3 magnetic field | |
251 | * @param mc Simulation flag | |
252 | * @param sat Satellite interaction flag | |
253 | * @param options Options | |
254 | * @param local Local storage | |
a19faec0 | 255 | * |
256 | * @deprecated See Run instead | |
8449e3e0 | 257 | */ |
e65b8b56 | 258 | virtual void Summarize(const TString& what, |
259 | ULong_t runNo, | |
260 | const Char_t* sys, | |
261 | UShort_t sNN, | |
262 | Short_t field, | |
263 | Bool_t mc=false, | |
264 | Bool_t sat=false, | |
265 | Option_t* options="", | |
266 | const char* local="") | |
8449e3e0 | 267 | { |
268 | Summarize(AliForwardCorrectionManager::ParseFields(what), | |
269 | runNo, AliForwardUtil::ParseCollisionSystem(sys), | |
270 | sNN, field, mc, sat, options, local); | |
271 | } | |
272 | /** | |
273 | * A generalized entry to the summarization functions | |
274 | * | |
275 | * @param what What to show - only one field | |
276 | * @param runNo Run number | |
277 | * @param sys System | |
278 | * @param sNN Center of mass energy in GeV | |
279 | * @param field L3 magnetic field | |
280 | * @param mc Simulation flag | |
281 | * @param sat Satellite interaction flag | |
8449e3e0 | 282 | * @param local Local storage |
a19faec0 | 283 | * |
284 | * @deprecated See Run instead | |
8449e3e0 | 285 | */ |
e65b8b56 | 286 | virtual void Summarize(UShort_t what, |
287 | ULong_t runNo, | |
288 | UShort_t sys, | |
289 | UShort_t sNN, | |
290 | Short_t field, | |
291 | Bool_t mc=false, | |
292 | Bool_t sat=false, | |
a19faec0 | 293 | Option_t* options="", |
e65b8b56 | 294 | const char* local="") |
8449e3e0 | 295 | { |
a19faec0 | 296 | Run(what, runNo, sys, sNN, field, mc, sat, options, local); |
8449e3e0 | 297 | } |
298 | /** | |
299 | * Fall-back method | |
300 | * | |
301 | * @param o Object to draw | |
302 | * @param pdf Not used | |
303 | */ | |
e65b8b56 | 304 | virtual void Summarize(const TObject* o, Bool_t pdf=true) |
8449e3e0 | 305 | { |
306 | if (!o) return; | |
c8b1a7db | 307 | Warning("CorrDrawer", "Don't know how to draw a %s object (PDF: %s)", |
308 | o->ClassName(), pdf ? "yes" : "no"); | |
8449e3e0 | 309 | } |
310 | /** | |
311 | * Draw a single summary plot or multiple plots of the acceptance | |
312 | * correction. A new Canvas is created for this. | |
313 | * | |
314 | * @param acc Acceptance correction | |
315 | * @param pdf If true, do multiple plots. Otherwise a single summary plot | |
316 | */ | |
e65b8b56 | 317 | virtual void Summarize(const AliFMDCorrAcceptance* acc, Bool_t pdf=true) |
8449e3e0 | 318 | { |
a19faec0 | 319 | CreateCanvas(CanvasName("acceptance.pdf"), false, pdf); |
8449e3e0 | 320 | DrawIt(acc, pdf); |
321 | if (pdf) CloseCanvas(); | |
322 | } | |
323 | /** | |
324 | * Draw a single summary plot multiple plots of the secondary | |
325 | * correction. A new canvas is created for this. | |
326 | * | |
327 | * @param sec Secondary correction | |
328 | * @param pdf If true, do multiple plots. Otherwise a single summary plot | |
329 | */ | |
c8b1a7db | 330 | virtual void Summarize(const AliFMDCorrSecondaryMap* sec, Bool_t pdf=true) |
8449e3e0 | 331 | { |
a19faec0 | 332 | CreateCanvas(CanvasName("secondarymap.pdf"), false, pdf); |
8449e3e0 | 333 | DrawIt(sec, pdf); |
334 | if (pdf) CloseCanvas(); | |
335 | } | |
0ccdab7b | 336 | /** |
337 | * Draw a single summary plot multiple plots of the energy loss | |
338 | * fits. A new canvas is created for this. | |
339 | * | |
340 | * @param fits Energy loss fits | |
341 | * @param pdf If true, do multiple plots. Otherwise a single summary plot | |
342 | */ | |
343 | virtual void Summarize(const AliFMDCorrNoiseGain* corr, Bool_t pdf=true) | |
344 | { | |
345 | CreateCanvas(CanvasName("noisegain.pdf"), true, pdf); | |
346 | DrawIt(corr, pdf); | |
347 | if (pdf) CloseCanvas(); | |
348 | } | |
8449e3e0 | 349 | /** |
350 | * Draw a single summary plot multiple plots of the energy loss | |
351 | * fits. A new canvas is created for this. | |
352 | * | |
c8b1a7db | 353 | * @param fits Energy loss fits |
354 | * @param pdf If true, do multiple plots. Otherwise a single summary plot | |
8449e3e0 | 355 | */ |
c8b1a7db | 356 | virtual void Summarize(const AliFMDCorrELossFit* fits, Bool_t pdf=true) |
8449e3e0 | 357 | { |
a19faec0 | 358 | CreateCanvas(CanvasName("elossfits.pdf"), true, pdf); |
8449e3e0 | 359 | DrawIt(fits, pdf); |
360 | if (pdf) CloseCanvas(); | |
361 | } | |
a19faec0 | 362 | /** |
363 | * Draw a single summary plot/multiple plots of the correction. | |
364 | * A new canvas is created for this. | |
365 | * | |
366 | * @param what What to plot | |
367 | * @param mc MC input or not | |
368 | * @param output Output of correction pass (must exist) | |
369 | * @param local Local storage of correction | |
370 | * @param options Various options | |
371 | * | |
372 | * @deprecated Use Run instead | |
373 | */ | |
0ccdab7b | 374 | static void Summarize(const TString& what = "", |
375 | Bool_t mc = false, | |
376 | const TString& output = "", | |
377 | const TString& local = "fmd_corrections.root", | |
bfab35d9 | 378 | Option_t* options= "") |
379 | { | |
a19faec0 | 380 | CorrDrawer* drawer = new CorrDrawer; |
381 | drawer->Run(AliForwardCorrectionManager::ParseFields(what), | |
382 | output, local, options); | |
bfab35d9 | 383 | } |
a19faec0 | 384 | /** |
385 | * Draw a single summary plot/multiple plots of the correction. | |
386 | * A new canvas is created for this. | |
387 | * | |
388 | * @param what What to plot | |
389 | * @param mc MC input or not | |
390 | * @param output Output of correction pass (must exist) | |
391 | * @param local Local storage of correction | |
392 | * @param options Various options | |
393 | * | |
394 | * @deprecated Use Run instead | |
395 | */ | |
bfab35d9 | 396 | static void Summarize(UShort_t what, |
0ccdab7b | 397 | Bool_t mc = false, |
398 | const TString& output = "", | |
bfab35d9 | 399 | const TString& local = "fmd_corrections.root", |
400 | Option_t* options= "") | |
401 | { | |
bfab35d9 | 402 | CorrDrawer* drawer = new CorrDrawer; |
a19faec0 | 403 | drawer->Run(what, output, options, local); |
bfab35d9 | 404 | } |
8449e3e0 | 405 | protected: |
a19faec0 | 406 | /** |
407 | * Append a name to output prefix | |
408 | * | |
409 | * @param what What to append to | |
410 | * @param which Which string to append | |
411 | */ | |
412 | void AppendName(TString& what, UShort_t which) | |
413 | { | |
414 | if (!what.IsNull()) what.Append("_"); | |
415 | switch (which) { | |
416 | case AliForwardCorrectionManager::kSecondaryMap: | |
417 | what.Append("secondary"); break; | |
418 | case AliForwardCorrectionManager::kAcceptance: | |
419 | what.Append("acceptance"); break; | |
420 | case AliForwardCorrectionManager::kELossFits: | |
421 | what.Append("elossfits"); break; | |
0ccdab7b | 422 | case AliForwardCorrectionManager::kNoiseGain: |
423 | what.Append("noisegain"); break; | |
a19faec0 | 424 | default: |
425 | what.Append("unknown"); break; | |
426 | } | |
427 | } | |
428 | ||
429 | /** | |
430 | * Get information from auxillary file | |
431 | * | |
432 | * @param runNo On return, the run number | |
433 | * @param sys On return, the collision system | |
434 | * @param sNN On return, the collision energy | |
435 | * @param fld On return, the L3 magnetic field | |
436 | * @param mc On return, true for MC input | |
437 | * @param sat On return, true for satellite input enabled | |
438 | * | |
439 | * @return true on success, false otherwise | |
440 | */ | |
441 | virtual Bool_t GetInformation(ULong_t& runNo, | |
442 | UShort_t& sys, | |
443 | UShort_t& sNN, | |
444 | Short_t& fld, | |
445 | Bool_t& mc, | |
446 | Bool_t& sat) | |
447 | { | |
448 | TFile* fout = TFile::Open(fELossExtra, "READ"); | |
449 | if (!fout) { | |
450 | Warning("SummarizeELoss", "Correction task output \"%s\" not found", | |
451 | fELossExtra.Data()); | |
452 | return false; | |
453 | } | |
454 | Bool_t ret = false; | |
455 | try { | |
456 | TCollection* forward = GetCollection(fout, "ForwardELossSums"); | |
457 | if (!forward) throw false; | |
458 | ||
459 | TCollection* eventInsp = GetCollection(forward, "fmdEventInspector"); | |
460 | if (!eventInsp) throw false; | |
461 | ||
462 | if (!GetParameter(eventInsp, "sys", sys)) throw false; | |
463 | if (!GetParameter(eventInsp, "sNN", sNN)) throw false; | |
464 | if (!GetParameter(eventInsp, "field", fld)) throw false; | |
465 | if (!GetParameter(eventInsp, "satellite", sat)) throw false; | |
466 | if (!GetParameter(eventInsp, "runNo", runNo)) throw false; | |
467 | if (!GetParameter(eventInsp, "mc", mc)) throw false; | |
468 | ||
469 | ret = true; | |
470 | } | |
471 | catch (bool e) { | |
472 | ret = e; | |
473 | } | |
474 | if (fout) fout->Close(); | |
475 | return ret; | |
476 | } | |
477 | /** | |
478 | * Get the canvas name. If the auxillary file has been set, use | |
479 | * that as the base of the canvas name. Otherwise use @a def. | |
480 | * | |
481 | * @param def Default value | |
482 | * | |
483 | * @return Canvas name | |
484 | */ | |
485 | virtual TString CanvasName(const char* def) | |
486 | { | |
487 | TString canName(def); | |
488 | if (!fELossExtra.IsNull()) { | |
489 | canName = gSystem->BaseName(fELossExtra.Data()); | |
490 | canName.ReplaceAll(".root", ".pdf"); | |
491 | } | |
492 | return canName; | |
493 | } | |
8449e3e0 | 494 | /** |
495 | * Fall-back method | |
496 | * | |
497 | * @param o Object to summarize | |
498 | */ | |
e65b8b56 | 499 | virtual void DrawIt(const TObject* o) |
8449e3e0 | 500 | { |
501 | if (!o) return; | |
502 | Warning("CorrDrawer", "Don't know how to summarize a %s object", | |
503 | o->ClassName()); | |
504 | } | |
505 | /** | |
506 | * Draw the acceptance correction | |
507 | * | |
508 | * @param corr Correction | |
509 | * @param details If true, make a multipage PDF, otherwise plot the mean. | |
510 | */ | |
e65b8b56 | 511 | virtual void DrawIt(const AliFMDCorrAcceptance* corr, Bool_t details=true) |
8449e3e0 | 512 | { |
a19faec0 | 513 | if (!corr) { |
514 | Warning("CorrDrawer","No acceptance available"); | |
515 | return; | |
516 | } | |
517 | ||
518 | if (!fCanvas) { | |
519 | Warning("CorrDrawer", "No canvas"); | |
520 | return; | |
521 | } | |
8449e3e0 | 522 | |
523 | // --- Get vertex axis --------------------------------------------- | |
524 | const TAxis& vtxAxis = corr->GetVertexAxis(); | |
525 | Int_t nVtx = vtxAxis.GetNbins(); | |
526 | ||
527 | // --- Create stacks for summaries --------------------------------- | |
528 | TObjArray* stacks = CreateVtxStacks(vtxAxis); | |
529 | TObjArray* stacks2 = (corr->HasOverflow() && details | |
530 | ? CreateVtxStacks(vtxAxis) : 0); | |
531 | ||
532 | //__________________________________________________________________ | |
533 | // Create a title page | |
534 | if (details) { | |
535 | fBody->cd(); | |
536 | TLatex* ll = new TLatex(.5,.8, fCanvas->GetTitle()); | |
537 | ll->SetTextAlign(22); | |
538 | ll->SetTextSize(0.03); | |
539 | ll->SetNDC(); | |
540 | ll->Draw(); | |
541 | ||
542 | TLatex* l = new TLatex(.5,.8, ""); | |
543 | l->SetNDC(); | |
544 | l->SetTextSize(0.03); | |
545 | l->SetTextFont(132); | |
546 | l->SetTextAlign(12); | |
547 | l->DrawLatex(0.2, 0.70, "Acceptance due to dead channels"); | |
548 | l->SetTextAlign(22); | |
549 | l->DrawLatex(0.5, 0.55, "c_{v,r}(#eta,#phi) = #frac{" | |
550 | "#sum active strips #in (#eta,#phi)}{" | |
551 | "#sum strips #in (#eta,#phi)}"); | |
552 | ||
553 | PrintCanvas("Acceptance"); | |
554 | } | |
555 | ||
556 | // --- Loop over vertex ------------------------------------------ | |
557 | for (UShort_t v=1; v <= nVtx; v++) { | |
558 | Double_t vzMin = vtxAxis.GetBinLowEdge(v); | |
559 | Double_t vzMax = vtxAxis.GetBinUpEdge(v); | |
560 | ||
561 | if (details) DivideForRings(true, true); | |
562 | ||
563 | // --- Loop over detectors ------------------------------------- | |
564 | for (UShort_t d = 1; d <= 3; d++) { | |
565 | UShort_t nQ = (d == 1 ? 1 : 2); | |
566 | for (UShort_t q = 0; q < nQ; q++) { | |
567 | Char_t r = (q == 0 ? 'I' : 'O'); | |
568 | ||
569 | TH2* h2 = corr->GetCorrection(d, r, v); | |
570 | if (!h2) { | |
571 | Warning("DrawCorrAcc", "No correction for FMD%d%c, v=%d", d, r, v); | |
bfab35d9 | 572 | corr->ls(); |
8449e3e0 | 573 | continue; |
574 | } | |
575 | ||
576 | if (details) DrawInRingPad(d, r, h2, "colz"); | |
577 | ||
578 | Int_t nY = h2->GetNbinsY(); | |
579 | TH1* hh = h2->ProjectionX(Form("FMD%d%c", d, r), 1, nY); | |
580 | hh->Scale(1. / nY); | |
581 | hh->SetDirectory(0); | |
582 | hh->SetMarkerColor(AliForwardUtil::RingColor(d, r)); | |
583 | hh->SetLineColor(AliForwardUtil::RingColor(d, r)); | |
584 | hh->SetFillColor(AliForwardUtil::RingColor(d, r)); | |
585 | hh->SetFillStyle(3001); | |
586 | ||
587 | THStack* stack = static_cast<THStack*>(stacks->At(v-1)); | |
588 | if (!stack) { | |
589 | Error("", "No stack at v=%d", v-1); | |
590 | continue; | |
591 | } | |
592 | stack->Add(hh); | |
593 | ||
594 | if (!stacks2) { | |
595 | Warning("", "No phi acceptance defined"); | |
596 | continue; | |
597 | } | |
598 | stack = static_cast<THStack*>(stacks2->At(v-1)); | |
599 | if (!stack) { | |
600 | Error("", "No stack at v=%d", v-1); | |
601 | continue; | |
602 | } | |
603 | TH1* hp = corr->GetPhiAcceptance(d, r, v); | |
604 | if (!hp) { | |
605 | Error("", "No phi acceptance at v=%d", v-1); | |
606 | continue; | |
607 | } | |
608 | hp->SetDirectory(0); | |
609 | hp->SetMarkerColor(AliForwardUtil::RingColor(d, r)); | |
610 | hp->SetLineColor(AliForwardUtil::RingColor(d, r)); | |
611 | hp->SetFillColor(AliForwardUtil::RingColor(d, r)); | |
612 | hp->SetFillStyle(3001); | |
613 | // Info("", "Adding phi acceptance plot %d", Int_t(hp->GetEntries())); | |
614 | stack->Add(hp); | |
615 | ||
616 | } | |
617 | } | |
618 | if (details) | |
619 | PrintCanvas(Form("%+5.1fcm<IP_{z}<%+5.1fcm", vzMin, vzMax)); | |
620 | } | |
621 | if (DrawVtxStacks(stacks2, 1.2)) { | |
622 | PrintCanvas("#phi acceptance"); | |
623 | } | |
624 | if (DrawVtxStacks(stacks, 1.2)) { | |
625 | PrintCanvas("#LTacceptance#GT"); | |
626 | } | |
627 | } | |
628 | /** | |
629 | * Draw the secondary correction | |
630 | * | |
631 | * @param corr Correction | |
632 | * @param details If true, make a multipage PDF, otherwise plot the mean. | |
633 | */ | |
e65b8b56 | 634 | virtual void DrawIt(const AliFMDCorrSecondaryMap* corr, bool details) |
8449e3e0 | 635 | { |
a19faec0 | 636 | if (!corr) { |
637 | Warning("CorrDrawer","No secondary map available"); | |
638 | return; | |
639 | } | |
640 | ||
641 | if (!fCanvas) { | |
642 | Warning("CorrDrawer", "No canvas"); | |
643 | return; | |
644 | } | |
8449e3e0 | 645 | |
646 | const TAxis& vtxAxis = corr->GetVertexAxis(); | |
647 | Int_t nVtx = vtxAxis.GetNbins(); | |
648 | TObjArray* stacks = CreateVtxStacks(vtxAxis); | |
649 | ||
650 | //__________________________________________________________________ | |
651 | // Create a title page | |
652 | if (details) { | |
653 | fBody->cd(); | |
654 | TLatex* ll = new TLatex(.5,.8, fCanvas->GetTitle()); | |
655 | ll->SetTextAlign(22); | |
656 | ll->SetTextSize(0.03); | |
657 | ll->SetNDC(); | |
658 | ll->Draw(); | |
659 | ||
660 | TLatex* l = new TLatex(.5,.8, ""); | |
661 | l->SetNDC(); | |
662 | l->SetTextSize(0.03); | |
663 | l->SetTextFont(132); | |
664 | l->SetTextAlign(12); | |
665 | l->DrawLatex(0.2, 0.70, "Secondary map"); | |
666 | l->SetTextAlign(22); | |
667 | l->DrawLatex(0.5, 0.60, "c_{v,r}(#eta,#phi)=#frac{" | |
668 | "#sum N_{ch,primary,i}(#eta,#phi)}{" | |
669 | "#sum N_{ch,FMD,i}(#eta,#phi)}"); | |
670 | l->SetTextAlign(12); | |
671 | l->DrawLatex(0.2, 0.50, "N: Number of events"); | |
672 | l->DrawLatex(0.2, 0.45, "N_{ch,primary,i}(#eta,#phi): Number of charged, " | |
673 | "primary particles in (#eta,#phi) bin"); | |
674 | l->DrawLatex(0.2, 0.40, "N_{ch,primary,i}(#eta,#phi): Number of charged, " | |
675 | "particles that hit the FMD in (#eta,#phi) bin"); | |
676 | l->DrawLatex(0.2, 0.35, "All quantities determined in MC"); | |
677 | ||
678 | PrintCanvas("Secondary maps"); | |
679 | } | |
680 | ||
681 | // --- Loop over vertex ------------------------------------------ | |
682 | for (UShort_t v=1; v <= nVtx; v++) { | |
683 | Double_t vzMin = vtxAxis.GetBinLowEdge(v); | |
684 | Double_t vzMax = vtxAxis.GetBinUpEdge(v); | |
685 | ||
686 | if (details) DivideForRings(true, true); | |
687 | ||
688 | // --- Loop over detectors ------------------------------------- | |
689 | for (UShort_t d = 1; d <= 3; d++) { | |
690 | UShort_t nQ = (d == 1 ? 1 : 2); | |
691 | for (UShort_t q = 0; q < nQ; q++) { | |
692 | Char_t r = (q == 0 ? 'I' : 'O'); | |
693 | ||
694 | TH2* h2 = corr->GetCorrection(d, r, v); | |
695 | if (!h2) { | |
696 | Warning("DrawCorrSec", "No correction for FMD%d%c, v=%d", d, r, v); | |
697 | continue; | |
698 | } | |
699 | ||
700 | if (details) DrawInRingPad(d, r, h2, "colz"); | |
701 | ||
702 | Int_t nY = h2->GetNbinsY(); | |
703 | TH1* hh = h2->ProjectionX(Form("FMD%d%c", d, r), 1, nY); | |
704 | hh->Scale(1. / nY); | |
705 | hh->SetDirectory(0); | |
706 | hh->SetMarkerColor(AliForwardUtil::RingColor(d, r)); | |
707 | hh->SetLineColor(AliForwardUtil::RingColor(d, r)); | |
708 | hh->SetFillColor(AliForwardUtil::RingColor(d, r)); | |
709 | hh->SetFillStyle(3001); | |
710 | ||
711 | THStack* stack = static_cast<THStack*>(stacks->At(v-1)); | |
712 | if (!stack) { | |
713 | Error("", "No stack at v=%d", v-1); | |
714 | continue; | |
715 | } | |
716 | stack->Add(hh); | |
717 | } | |
718 | } | |
719 | if (details) | |
720 | PrintCanvas(Form("%+5.1fcm<IP_{z}<%+5.1fcm", vzMin, vzMax)); | |
721 | } | |
722 | if (DrawVtxStacks(stacks, 3.5)) { | |
723 | PrintCanvas("#LTsecondary map#GT"); | |
724 | } | |
725 | } | |
0ccdab7b | 726 | virtual void DrawIt(const AliFMDCorrNoiseGain* corr, bool details) |
727 | { | |
728 | if (!corr) { | |
729 | Warning("CorrDrawer","No noise-gain correction available"); | |
730 | return; | |
731 | } | |
732 | ||
733 | if (!fCanvas) { | |
734 | Warning("CorrDrawer", "No canvas"); | |
735 | return; | |
736 | } | |
737 | ||
738 | DivideForRings(false,false); | |
739 | ||
740 | for (UShort_t d = 1; d <= 3; d++) { | |
741 | UShort_t nQ = d == 1 ? 1 : 2; | |
742 | for (UShort_t q = 0; q < nQ; q++) { | |
743 | Char_t r = q == 0 ? 'I' : 'O'; | |
744 | UShort_t nS = q == 0 ? 20 : 40; | |
745 | UShort_t nT = q == 0 ? 512 : 256; | |
746 | ||
747 | TH2* h = new TH2D(Form("fmd%d%c", d, r), | |
748 | Form("FMD%d%c", d, r), | |
749 | nT, -.5, nT-.5, nS, -.5, nS-.5); | |
750 | h->SetDirectory(0); | |
751 | h->SetXTitle("Strip"); | |
752 | h->SetYTitle("Sector"); | |
753 | ||
754 | for (UShort_t s = 0; s < nS; s++) { | |
755 | for (UShort_t t = 0; t < nT; t++) { | |
756 | Float_t c = corr->Get(d,r,s,t); | |
757 | h->Fill(t,s,c); | |
758 | } | |
759 | } | |
760 | h->GetZaxis()->SetRangeUser(0,0.05); | |
761 | DrawInRingPad(d,r,h,"COLZ"); | |
762 | } | |
763 | } | |
764 | PrintCanvas("Noise correction"); | |
765 | } | |
8449e3e0 | 766 | /** |
767 | * Draw the energy loss fits correction | |
768 | * | |
769 | * @param corr Correction | |
770 | * @param details If true, make a multipage PDF, | |
771 | * otherwise plot the parameters. | |
772 | */ | |
a19faec0 | 773 | virtual void DrawIt(const AliFMDCorrELossFit* corr, bool details, |
774 | bool few=true) | |
8449e3e0 | 775 | { |
a19faec0 | 776 | if (!corr) { |
777 | Warning("CorrDrawer","No energy loss fits available"); | |
778 | return; | |
779 | } | |
780 | ||
781 | if (!fCanvas) { | |
782 | Warning("CorrDrawer", "No canvas"); | |
783 | return; | |
784 | } | |
8449e3e0 | 785 | |
786 | AliFMDCorrELossFit* fits = const_cast<AliFMDCorrELossFit*>(corr); | |
787 | fits->CacheBins(8); | |
788 | fits->Print("C"); | |
789 | TList* fitter = 0; | |
790 | if (details) { | |
791 | TFile* hists = 0; | |
792 | TDirectory* savDir = gDirectory; | |
81775aba | 793 | if (!gSystem->AccessPathName(fELossExtra.Data())) { |
794 | hists = TFile::Open(fELossExtra, "READ"); | |
77f97e3f | 795 | Info("", "Opened forward_eloss.root -> %p", hists); |
8449e3e0 | 796 | } |
77f97e3f CHC |
797 | else |
798 | Warning("", "Couldn't open %s", fELossExtra.Data()); | |
8449e3e0 | 799 | if (hists) { |
c8b1a7db | 800 | TList* fr = static_cast<TList*>(hists->Get("ForwardELossResults")); |
8449e3e0 | 801 | // Info("", "Got forward results -> %p", fr); |
802 | if (fr) { | |
803 | fitter = static_cast<TList*>(fr->FindObject("fmdEnergyFitter")); | |
804 | // Info("", "Got fitter -> %p", fitter); | |
805 | } | |
806 | hists->Close(); | |
807 | savDir->cd(); | |
808 | } | |
809 | fBody->cd(); | |
a19faec0 | 810 | TLatex* ll = new TLatex(.5,.9, "ESD #rightarrow #Delta-fits" |
e65b8b56 | 811 | /* fCanvas->GetTitle() */); |
8449e3e0 | 812 | ll->SetTextAlign(22); |
813 | ll->SetTextSize(0.05); | |
814 | ll->SetNDC(); | |
815 | ll->Draw(); | |
a19faec0 | 816 | |
817 | const Double_t fontSize = 0.03; | |
818 | #define DL(X,Y,T) do { l->DrawLatex(X,Y,T); Y -= fontSize; } while (false) | |
8449e3e0 | 819 | TLatex* l = new TLatex(.5,.8, ""); |
820 | l->SetNDC(); | |
a19faec0 | 821 | l->SetTextSize(fontSize); |
8449e3e0 | 822 | l->SetTextFont(132); |
823 | l->SetTextAlign(12); | |
a19faec0 | 824 | Double_t y = 0.80; |
825 | Double_t x = 0.20; | |
826 | Double_t z = 0.30; | |
827 | DL(x,y,"1^{st} page is a summary of fit parameters"); | |
828 | DL(x,y,"2^{nd} page is a summary of relative errors"); | |
829 | DL(x,y,"Subsequent pages shows the fitted functions"); | |
830 | y -= 0.01; | |
831 | DL(z,y,"Black line is the full fitted function"); | |
832 | DL(z,y,"Coloured lines are the individual N-mip comp."); | |
833 | DL(x,y,"Each component has the form"); | |
834 | y -= 0.02; | |
835 | DL(z,y,"f_{n}(x; #Delta, #xi, #sigma') = " | |
836 | "#int_{-#infty}^{+#infty}dx' " | |
837 | "landau(x'; #Delta, #xi)gaus(x'; x, #sigma')"); | |
838 | y -= 0.02; | |
839 | DL(x,y,"The full function is given by"); | |
840 | y -= 0.02; | |
841 | DL(z,y,"f_{N}(x; #Delta, #xi, #sigma', #bf{a}) = " | |
842 | "C #sum_{i=1}^{N} a_{i} " | |
843 | "f_{i}(x; #Delta_{i}, #xi_{i}, #sigma_{i}')"); | |
844 | y -= 0.03; | |
845 | DL(z,y,"#Delta_{i} = i (#Delta_{1} + #xi_{1} log(i)) +#delta_{i}"); | |
846 | DL(z,y,"#xi_{i} = i #xi_{1}"); | |
847 | DL(z,y,"#sigma_{i} = #sqrt{i} #sigma_{1}"); | |
848 | DL(z,y,"#sigma_{n} #dot{=} 0"); | |
849 | DL(z,y,"#sigma_{i}'^{2} = #sigma^{2}_{n} + #sigma_{i}^{2}"); | |
850 | DL(z,y,"#delta_{i} = c#sigmau/(1+1/i)^{pu#sqrt{u}}"); | |
851 | DL(z,y,"u = #sigma/#xi"); | |
852 | DL(z,y,"a_{1} #dot{=} 1"); | |
853 | y -= 0.02; | |
854 | DL(z,y,Form("Least quality: %d", fMinQuality)); | |
855 | y -= 0.02; | |
81775aba | 856 | if (fitter) { |
857 | TObject* refit = fitter->FindObject("refitted"); | |
a19faec0 | 858 | if (refit) DL(z,y, "Refitted distributions");//.10 |
81775aba | 859 | } |
8449e3e0 | 860 | PrintCanvas("Energy loss fits"); |
861 | } | |
a19faec0 | 862 | |
863 | if (details && fitter) { | |
864 | // Draw parameter from the fitter | |
865 | fBody->cd(); | |
866 | Double_t y = 0.90; | |
867 | Double_t s = fParName->GetTextSize(); | |
868 | Double_t t = fParVal->GetTextSize(); | |
869 | fParName->SetTextSize(0.04); | |
870 | fParVal->SetTextSize(0.04); | |
871 | DrawTParameter<double>(y, fitter, "lowCut"); | |
872 | DrawTParameter<int> (y, fitter, "nParticles"); | |
873 | DrawTParameter<int> (y, fitter, "minEntries"); | |
874 | DrawTParameter<int> (y, fitter, "subtractBins"); | |
875 | DrawTParameter<bool> (y, fitter, "doFits"); | |
876 | DrawTParameter<double>(y, fitter, "maxE"); | |
877 | DrawTParameter<int> (y, fitter, "nEbins"); | |
878 | DrawTParameter<bool> (y, fitter, "increasingBins"); | |
879 | DrawTParameter<double>(y, fitter, "maxRelPerError"); | |
880 | DrawTParameter<double>(y, fitter, "maxChi2PerNDF"); | |
881 | DrawTParameter<double>(y, fitter, "minWeight"); | |
882 | DrawTParameter<double>(y, fitter, "regCut"); | |
883 | DrawParameter(y,"Use #delta#Delta(#sigma/#xi)", | |
884 | Form("%s", | |
885 | fits->TestBit(AliFMDCorrELossFit::kHasShift) | |
886 | ? "yes" : "no")); | |
887 | PrintCanvas("Fitter settings"); | |
888 | fParName->SetTextSize(s); | |
889 | fParVal->SetTextSize(t); | |
890 | } | |
8449e3e0 | 891 | |
892 | fBody->cd(); | |
f37328ed | 893 | fits->Draw("error good"); |
8449e3e0 | 894 | PrintCanvas("Fit overview"); |
895 | if (!details) return; | |
896 | ||
897 | //__________________________________________________________________ | |
898 | // Draw relative parameter errors | |
899 | fBody->cd(); | |
f37328ed | 900 | fits->Draw("relative good"); |
8449e3e0 | 901 | PrintCanvas("Relative parameter errors"); |
902 | ||
903 | //__________________________________________________________________ | |
904 | // Draw all fits individually | |
905 | for (UShort_t d=1; d<=3; d++) { | |
906 | UShort_t nQ = (d == 1 ? 1 : 2); | |
907 | for (UShort_t q = 0; q < nQ; q++) { | |
908 | Char_t r = (q == 0 ? 'I' : 'O'); | |
909 | TList* dists = 0; | |
e65b8b56 | 910 | TList* resis = 0; |
8449e3e0 | 911 | if (fitter) { |
912 | // Info("", "Fitter: %s", fitter->GetName()); | |
913 | TList* dl = | |
914 | static_cast<TList*>(fitter->FindObject(Form("FMD%d%c",d,r))); | |
915 | // Info("", "Got detector list -> %p", dl); | |
916 | if (dl) { | |
917 | // Info("", "Detector list: %s", dl->GetName()); | |
77f97e3f | 918 | dists = static_cast<TList*>(dl->FindObject("elossDists")); |
8449e3e0 | 919 | // Info("", "Got distributions -> %p", dists); |
77f97e3f CHC |
920 | resis = static_cast<TList*>(dl->FindObject("elossResiduals")); |
921 | // Info("", "Got residuals -> %p", resis); | |
8449e3e0 | 922 | } |
923 | } | |
924 | ||
925 | printf("FMD%d%c ", d, r); | |
926 | ClearCanvas(); | |
927 | TObjArray* ra = fits->GetRingArray(d, r); | |
928 | if (!ra) continue; | |
a19faec0 | 929 | DrawELossFits(d, r, ra, dists, resis, few); |
8449e3e0 | 930 | } |
931 | } | |
932 | } | |
933 | /** | |
934 | * CINT does too much when optimizing on a loop, so we take this out | |
935 | * to force CINT to not optimize the third nested loop. | |
936 | * | |
c8b1a7db | 937 | * @param d Detector |
938 | * @param r Ring | |
939 | * @param ra Ring array | |
940 | * @param dists Distributions (optional) | |
941 | * @param resis Residuals (optional) | |
8449e3e0 | 942 | */ |
e65b8b56 | 943 | void DrawELossFits(UShort_t d, Char_t r, TObjArray* ra, |
a19faec0 | 944 | TList* dists, TList* resis, bool few) |
8449e3e0 | 945 | { |
a19faec0 | 946 | Int_t nRow = 3; |
947 | Int_t nCol = (few ? 1 : 2); | |
948 | Int_t nPad = nRow * nCol; | |
8449e3e0 | 949 | AliFMDCorrELossFit::ELossFit* fit = 0; |
950 | TIter next(ra); | |
951 | Int_t i = 0; | |
952 | Int_t j = 0; | |
a19faec0 | 953 | DividedPad divided(fBody, fLandscape, nCol, nRow); |
8449e3e0 | 954 | while ((fit = static_cast<AliFMDCorrELossFit::ELossFit*>(next()))) { |
955 | j = i % nPad; | |
956 | Bool_t last = j == nPad-1; | |
a19faec0 | 957 | if (j == 0) divided.Divide(true, true); |
8449e3e0 | 958 | |
e65b8b56 | 959 | Bool_t same = false; |
a19faec0 | 960 | TVirtualPad* drawPad = divided.GetPad(j); // fBody->GetPad(j+1); |
e65b8b56 | 961 | Int_t subPad = 0; |
a19faec0 | 962 | // fBody->ls(); |
963 | // Info("", "Now in sub-pad %d of %d: %p", j, nPad, drawPad); | |
964 | // Info("", "Pad %s", drawPad->GetName()); | |
8449e3e0 | 965 | if (dists) { |
966 | // Info("", "Distributions: %s", dists->GetName()); | |
e65b8b56 | 967 | TString hName(Form("FMD%d%c_etabin%03d", d,r,fit->GetBin())); |
968 | TH1* dist = static_cast<TH1*>(dists->FindObject(hName)); | |
969 | TH1* resi = 0; | |
970 | if (resis) resi = static_cast<TH1*>(resis->FindObject(hName)); | |
8449e3e0 | 971 | // Info("", "Got histogram -> %p", dist); |
e65b8b56 | 972 | if (resi) { |
973 | Bool_t err = resi->GetUniqueID() <= 1; | |
974 | drawPad->SetGridx(); | |
975 | if (err) { | |
976 | resi->SetYTitle("#chi^{2}_{bin}=(h-f)^{2}/#delta^{2}h"); | |
977 | for (Int_t k=1; k<=resi->GetNbinsX(); k++) { | |
978 | Double_t c = resi->GetBinContent(k); | |
979 | Double_t e = resi->GetBinError(k); | |
980 | if (e <= 0) continue; | |
981 | c *= c; | |
982 | c /= (e*e); | |
983 | resi->SetBinContent(k, c); | |
984 | resi->SetBinError(k, 0); | |
985 | } | |
986 | } | |
987 | drawPad->Divide(1,2,0,0); | |
44bacd46 | 988 | DrawInPad(drawPad, 2, resi, "HIST", kGridx); |
e65b8b56 | 989 | subPad = 1; |
990 | Double_t red = fit->GetNu() > 0 ? fit->GetChi2() / fit->GetNu() : 0; | |
991 | if (red > 0) { | |
992 | drawPad->cd(2); | |
993 | TLine* l = new TLine(resi->GetXaxis()->GetXmin(), red, | |
994 | resi->GetXaxis()->GetXmax(), red); | |
995 | l->SetLineWidth(2); | |
996 | l->SetLineStyle(2); | |
997 | l->Draw(); | |
998 | TLatex* cltx = new TLatex(0.5, 0.5, | |
999 | Form("#chi^{2}/#nu=%6.2f", red)); | |
1000 | cltx->SetNDC(); | |
1001 | cltx->SetTextAlign(22); | |
1002 | cltx->SetTextFont(42); | |
1003 | cltx->SetTextSize(0.07); | |
1004 | cltx->Draw(); | |
1005 | cltx->DrawLatex(0.5,0.4,Form("%g", dist->GetEntries())); | |
1006 | } | |
1007 | } | |
8449e3e0 | 1008 | if (dist) { |
1009 | // Info("", "Histogram: %s", dist->GetName()); | |
77f97e3f CHC |
1010 | dist->SetFillStyle(3001); |
1011 | dist->SetMarkerStyle(0); | |
44bacd46 | 1012 | DrawInPad(drawPad, subPad, dist, "HIST E", (subPad * kGridx) + kLogy); |
8449e3e0 | 1013 | same = true; |
1014 | } | |
1015 | } | |
1016 | // if (same) | |
e65b8b56 | 1017 | DrawInPad(drawPad, subPad, fit, |
a19faec0 | 1018 | Form("comp good values legend peak %s", (same ? "same" : "")), |
44bacd46 | 1019 | kLogy); |
81775aba | 1020 | if (fit->GetQuality() < fMinQuality) { |
8449e3e0 | 1021 | TLatex* ltx = new TLatex(.2, .2, "NOT USED"); |
1022 | ltx->SetNDC(); | |
1023 | ltx->SetTextFont(62); | |
1024 | ltx->SetTextColor(kRed+1); | |
1025 | ltx->SetTextAngle(30); | |
1026 | ltx->SetTextSize(0.2); | |
1027 | DrawInPad(fBody, j+1, ltx, "", 0); | |
1028 | // ltx->Draw(); | |
1029 | } | |
1030 | ||
1031 | // else | |
44bacd46 | 1032 | // DrawInPad(fBody, j+1, fit, "comp good values legend", kLogy); |
8449e3e0 | 1033 | printf("."); |
1034 | ||
1035 | if (last) | |
1036 | PrintCanvas(Form("FMD%d%c page %d", d, r, (i/nPad)+1)); | |
1037 | i++; | |
1038 | } | |
1039 | j = i % nPad; | |
1040 | if (j != 0) | |
1041 | PrintCanvas(Form("FMD%d%c page %d", d, r, (i/nPad)+1)); | |
1042 | printf(" done\n"); | |
1043 | } | |
1044 | ||
1045 | /** | |
1046 | * Create an array of per-vertex bin stacks | |
1047 | * | |
1048 | * @param vtxAxis Vertex axis | |
1049 | * | |
1050 | * @return Array of stacks | |
1051 | */ | |
1052 | TObjArray* CreateVtxStacks(const TAxis& vtxAxis) | |
1053 | { | |
1054 | // --- Create stacks for summaries --------------------------------- | |
1055 | Int_t nVtx = vtxAxis.GetNbins(); | |
1056 | TObjArray* stacks = new TObjArray(nVtx); | |
1057 | for (UShort_t v = 1; v <= nVtx; v++) { | |
1058 | THStack* stack = new THStack(Form("vtx%02d", v), | |
1059 | Form("%+5.1f<v_{z}<%+5.1f", | |
1060 | vtxAxis.GetBinLowEdge(v), | |
1061 | vtxAxis.GetBinUpEdge(v))); | |
1062 | stacks->AddAt(stack, v-1); | |
1063 | } | |
1064 | return stacks; | |
1065 | } | |
1066 | /** | |
1067 | * Draw the vertex stacks in the canvas | |
1068 | * | |
1069 | * @param stacks Stacks to draw | |
1070 | * @param max Possible maximum of the stacks | |
1071 | * | |
1072 | * @return true on success | |
1073 | */ | |
1074 | Bool_t DrawVtxStacks(TObjArray* stacks, Double_t max=-1) | |
1075 | { | |
1076 | if (!stacks) return false; | |
1077 | // --- Make summary page ------------------------------------------- | |
1078 | Int_t nVtx = 10; // stacks->GetEntries(); | |
1079 | ||
1080 | fBody->Divide(3, (nVtx+2)/3, 0, 0); | |
1081 | Int_t ipad = 0; | |
1082 | for (UShort_t v = 1; v <= nVtx; v++) { | |
1083 | ipad++; | |
1084 | ||
1085 | if (ipad == 1 || ipad == 12) ipad++; | |
1086 | ||
1087 | THStack* stack = static_cast<THStack*>(stacks->At(v-1)); | |
1088 | if (!stack) { | |
1089 | Error("", "No stack at v=%d", v-1); | |
1090 | continue; | |
1091 | } | |
1092 | TVirtualPad* pad = fBody->cd(ipad); | |
1093 | if (!pad) { | |
1094 | Error("", "No pad at %d", ipad); | |
1095 | continue; | |
1096 | } | |
1097 | pad->SetFillColor(kWhite); | |
1098 | ||
1099 | if (max > 0) stack->SetMaximum(max); | |
1100 | stack->Draw("nostack hist"); | |
1101 | } | |
1102 | return true; | |
1103 | } | |
1104 | ||
1105 | }; | |
1106 | ||
1107 | ||
1108 | ||
1109 | // | |
1110 | // EOF | |
1111 | // |