Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
HistogramManager.cxx
1/*
2 * HalHistogramManager.cxx
3 *
4 * Created on: 12-08-2014
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "HistogramManager.h"
11
12#include "Package.h"
13
14#include <TH1.h>
15#include <TH2.h>
16#include <TH3.h>
17#include <TList.h>
18#include <TRandom.h>
19
20#include <iostream>
21namespace Hal {
22 HistogramAxisConf::HistogramAxisConf() : fBins(100), fMin(0), fMax(0) { fTitle = ""; }
23
24 HistogramAxisConf::HistogramAxisConf(Int_t bins, Double_t min, Double_t max) : fBins(bins), fMin(min), fMax(max) {}
25
26 HistogramAxisConf::HistogramAxisConf(TString title, Int_t bins, Double_t min, Double_t max) :
27 TNamed(), fBins(bins), fMin(min), fMax(max) {
28 SetName(title);
29 }
30
31 void HistogramAxisConf::Print(Option_t* /*option*/) const {
32 std::cout << "HistogramAxisConf" << std::endl;
33 std::cout << "Name: " << GetName() << std::endl;
34 std::cout << "Nbins: " << fBins << std::endl;
35 std::cout << "Range: " << fMin << " " << fMax << std::endl;
36 std::cout << "Title: " << fTitle << std::endl;
37 }
38
39 template<class T>
40 HistogramManager_1_1D<T>::HistogramManager_1_1D(const HistogramManager_1_1D& manager) :
41 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fComments(NULL), fArray(NULL) {
42 if (manager.fComments) {
43 fComments = new TString[fSize];
44 fArray = new T*[fSize];
45 for (int i = 0; i < fSize; i++) {
46 fComments[i] = manager.fComments[i];
47 fArray[i] = (T*) manager.fArray[i]->Clone();
48 }
49 }
50 }
51
52 template<class T>
53 HistogramManager_1_1D<T>& HistogramManager_1_1D<T>::operator=(const HistogramManager_1_1D& manager) {
54 if (this == &manager) { return *this; }
55 if (fSize > 0) {
56 for (int i = 0; i < fSize; i++) {
57 delete fArray[i];
58 }
59 delete[] fArray;
60 delete[] fComments;
61 fArray = NULL;
62 fComments = NULL;
63 }
64 fSize = manager.fSize;
65 fAxisNo = manager.fAxisNo;
66 if (manager.fSize > 0) {
67 fComments = new TString[fSize];
68 fArray = new T*[fSize];
69 for (int i = 0; i < fSize; i++) {
70 fComments[i] = manager.fComments[i];
71 fArray[i] = (T*) manager.fArray[i]->Clone();
72 }
73 }
74 return *this;
75 }
76
77 template<class T>
78 void HistogramManager_1_1D<T>::Init(Int_t size, HistogramAxisConf** axisconf, TString title, Bool_t Sumw) {
79 fSize = size;
80 fAxisNo = 1;
81 fArray = new T*[size];
82 fComments = new TString[size];
83 title = title + "[%i]";
84 for (int i = 0; i < fSize; i++) {
85 fArray[i] = new T(Form(title, i), Form(title, i), axisconf[0]->GetNBins(), axisconf[0]->GetMin(), axisconf[0]->GetMax());
86 fArray[i]->GetXaxis()->SetTitle(axisconf[0]->GetTitle());
87 fArray[i]->GetYaxis()->SetTitle(axisconf[1]->GetTitle());
88 fComments[i] = " ";
89 if (Sumw) { fArray[i]->Sumw2(); }
90 }
91 }
92
93 template<class T>
94 void HistogramManager_1_1D<T>::Init(Int_t size, Int_t binsX, Double_t minX, Double_t maxX, Bool_t sumw) {
95 fSize = size;
96 fAxisNo = 1;
97 fArray = new T*[size];
98 fComments = new TString[size];
99 TString title = "[%i]";
100 for (int i = 0; i < fSize; i++) {
101 Int_t ran = gRandom->Rndm() * 1E+9;
102 fArray[i] = new T(Form(title, ran), Form(title, ran), binsX, minX, maxX);
103 fComments[i] = " ";
104 if (sumw) { fArray[i]->Sumw2(); }
105 }
106 }
108 template<class T>
110 if (pos < 0) return;
111 if (pos > fSize) return;
112 if (fArray[pos]) delete fArray[pos];
113 fArray[pos] = t;
114 fArray[pos]->SetDirectory(0x0);
115 fComments[pos] = "";
117
118 template<class T>
120 Package* pack = new Package(this);
121 for (int i = 0; i < fSize; i++) {
122 pack->AddObject(fArray[i]);
123 }
124 return pack;
125 }
126
127 template<class T>
129 TList* list = new TList();
130 list->SetOwner(kFALSE);
131 for (int i = 0; i < fSize; i++) {
132 list->Add(fArray[i]);
133 }
134 return list;
135 }
136
137 template<class T>
139 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fComments(NULL), fArray(NULL) {
140 if (manager.fComments) {
141 fComments = new TString[fSize];
142 fArray = new T*[fSize];
143 for (int i = 0; i < fSize; i++) {
144 fComments[i] = manager.fComments[i];
145 fArray[i] = (T*) manager.fArray[i]->Clone();
146 }
147 }
148 }
149
150 template<class T>
151 HistogramManager_1_2D<T>& HistogramManager_1_2D<T>::operator=(const HistogramManager_1_2D& manager) {
152 if (this == &manager) { return *this; }
153 if (fSize > 0) {
154 for (int i = 0; i < fSize; i++) {
155 delete fArray[i];
156 }
157 delete[] fArray;
158 delete[] fComments;
159 fArray = NULL;
160 fComments = NULL;
161 }
162 fSize = manager.fSize;
163 fAxisNo = manager.fAxisNo;
164 if (manager.fSize > 0) {
165 fComments = new TString[fSize];
166 fArray = new T*[fSize];
167 for (int i = 0; i < fSize; i++) {
168 fComments[i] = manager.fComments[i];
169 fArray[i] = (T*) manager.fArray[i]->Clone();
170 }
171 }
172 return *this;
174 template<class T>
175 void HistogramManager_1_2D<T>::Init(Int_t size, HistogramAxisConf** axisconf, TString title, Bool_t Sumw) {
176 fSize = size;
177 fAxisNo = 2;
178 fArray = new T*[size];
179 fComments = new TString[size];
180 title = title + "[%i]";
181 for (int i = 0; i < fSize; i++) {
182 fArray[i] = new T(Form(title, i),
183 Form(title, i),
184 axisconf[0]->GetNBins(),
185 axisconf[0]->GetMin(),
186 axisconf[0]->GetMax(),
187 axisconf[1]->GetNBins(),
188 axisconf[1]->GetMin(),
189 axisconf[1]->GetMax());
190 fArray[i]->GetXaxis()->SetTitle(axisconf[0]->GetTitle());
191 fArray[i]->GetYaxis()->SetTitle(axisconf[1]->GetTitle());
192 fArray[i]->GetZaxis()->SetTitle(axisconf[2]->GetTitle());
193 if (Sumw) { fArray[i]->Sumw2(); }
194 fComments[i] = " ";
195 }
196 }
197
198 template<class T>
200 Int_t binsX,
201 Double_t minX,
202 Double_t maxX,
203 Int_t binY,
204 Double_t minY,
205 Double_t maxY,
206 Bool_t Sumw) {
207 fSize = size;
208 fAxisNo = 2;
209 fArray = new T*[size];
210 fComments = new TString[size];
211 TString title = "[%i]";
212 for (int i = 0; i < fSize; i++) {
213 Int_t ran = gRandom->Rndm() * 1E+9;
214 fArray[i] = new T(Form(title, ran), Form(title, ran), binsX, minX, maxX, binY, minY, maxY);
215 if (Sumw) { fArray[i]->Sumw2(); }
216 fComments[i] = " ";
217 }
218 }
219
220 template<class T>
222 if (pos < 0) return;
223 if (pos > fSize) return;
224 if (fArray[pos]) delete fArray[pos];
225 fArray[pos] = t;
226 fArray[pos]->SetDirectory(0x0);
227 fComments[pos] = "";
229
230 template<class T>
232 Package* pack = new Package(this);
233 for (int i = 0; i < fSize; i++) {
234 pack->AddObject(fArray[i]);
235 }
236 return pack;
237 }
238
239 template<class T>
241 TList* list = new TList();
242 list->SetOwner(kFALSE);
243 for (int i = 0; i < fSize; i++) {
244 list->Add(fArray[i]);
245 }
246 return list;
247 }
248
249 template<class T>
251 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fComments(NULL), fArray(NULL) {
252 if (manager.fComments) {
253 fComments = new TString[fSize];
254 fArray = new T*[fSize];
255 for (int i = 0; i < fSize; i++) {
256 fComments[i] = manager.fComments[i];
257 fArray[i] = (T*) manager.fArray[i]->Clone();
258 }
259 }
260 }
261
262 template<class T>
263 HistogramManager_1_3D<T>& HistogramManager_1_3D<T>::operator=(const HistogramManager_1_3D& manager) {
264 if (this == &manager) { return *this; }
265 if (fSize > 0) {
266 for (int i = 0; i < fSize; i++) {
267 delete fArray[i];
268 }
269 delete[] fArray;
270 delete[] fComments;
271 fArray = NULL;
272 fComments = NULL;
273 }
274 fSize = manager.fSize;
275 fAxisNo = manager.fAxisNo;
276 if (manager.fSize > 0) {
277 fComments = new TString[fSize];
278 fArray = new T*[fSize];
279 for (int i = 0; i < fSize; i++) {
280 fComments[i] = manager.fComments[i];
281 fArray[i] = (T*) manager.fArray[i]->Clone();
283 }
284 return *this;
285 }
286
287 template<class T>
288 void HistogramManager_1_3D<T>::Init(Int_t size, HistogramAxisConf** axisconf, TString title, Bool_t Sumw) {
289 fSize = size;
290 fAxisNo = 3;
291 fArray = new T*[size];
292 fComments = new TString[size];
293 title = title + "[%i]";
294 for (int i = 0; i < fSize; i++) {
295 fArray[i] = new T(Form(title, i),
296 Form(title, i),
297 axisconf[0]->GetNBins(),
298 axisconf[0]->GetMin(),
299 axisconf[0]->GetMax(),
300 axisconf[1]->GetNBins(),
301 axisconf[1]->GetMin(),
302 axisconf[1]->GetMax(),
303 axisconf[2]->GetNBins(),
304 axisconf[2]->GetMin(),
305 axisconf[2]->GetMax());
306 fArray[i]->GetXaxis()->SetTitle(axisconf[0]->GetTitle());
307 fArray[i]->GetYaxis()->SetTitle(axisconf[1]->GetTitle());
308 fArray[i]->GetZaxis()->SetTitle(axisconf[2]->GetTitle());
309 fComments[i] = " ";
310 if (Sumw) { fArray[i]->Sumw2(); }
311 }
312 }
313
314 template<class T>
316 Int_t binsX,
317 Double_t minX,
318 Double_t maxX,
319 Int_t binsY,
320 Double_t minY,
321 Double_t maxY,
322 Int_t binsZ,
323 Double_t minZ,
324 Double_t maxZ,
325 Bool_t Sumw) {
326 fSize = size;
327 fAxisNo = 3;
328 fArray = new T*[size];
329 fComments = new TString[size];
330 TString title = "[%i]";
331 for (int i = 0; i < fSize; i++) {
332 Int_t ran = gRandom->Rndm() * 1E+9;
333 fArray[i] = new T(Form(title, ran), Form(title, ran), binsX, minX, maxX, binsY, minY, maxY, binsZ, minZ, maxZ);
334 fComments[i] = " ";
335 if (Sumw) { fArray[i]->Sumw2(); }
336 }
337 }
338
339 template<class T>
341 if (pos < 0) return;
342 if (pos > fSize) return;
343 if (fArray[pos]) delete fArray[pos];
344 fArray[pos] = t;
345 fArray[pos]->SetDirectory(0x0);
346 fComments[pos] = "";
347 }
348
349 template<class T>
351 Package* pack = new Package(this);
352 for (int i = 0; i < fSize; i++) {
353 pack->AddObject(fArray[i]);
354 }
355 return pack;
356 }
357
358 template<class T>
360 TList* list = new TList();
361 list->SetOwner(kFALSE);
362 for (int i = 0; i < fSize; i++) {
363 list->Add(fArray[i]);
364 }
365 return list;
366 }
367
368 template<class T>
370 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
371 if (manager.fArray) {
372 fArray = new HistogramManager_1_1D<T>[fSize];
373 for (int i = 0; i < fSize; i++) {
374 fArray[i] = manager.fArray[i];
375 }
376 }
377 }
379 template<class T>
381 if (this == &manager) { return *this; }
382 if (fSize > 0) {
383 delete[] fArray;
384 fArray = NULL;
385 }
386 fSize = manager.fSize;
387 fAxisNo = manager.fAxisNo;
388 if (manager.fSize > 0) {
389 fArray = new HistogramManager_1_1D<T>[fSize];
390 for (int i = 0; i < fSize; i++) {
391 fArray[i] = manager.fArray[i];
392 }
393 }
394 return *this;
395 }
396
397 template<class T>
398 void HistogramManager_2_1D<T>::Init(Int_t sizeX, Int_t sizeY, HistogramAxisConf** axisconf, TString title, Bool_t Sumw) {
399 fSize = sizeX;
400 fAxisNo = 2;
401 fArray = new HistogramManager_1_1D<T>[fSize];
402 title = title + "[%i]";
403 for (int i = 0; i < fSize; i++) {
404 TString Title = Form(title, i);
405 fArray[i].Init(sizeY, axisconf, Title, Sumw);
406 }
407 }
408
409 template<class T>
410 void HistogramManager_2_1D<T>::Init(Int_t sizeX, Int_t sizeY, Int_t binsX, Double_t minX, Double_t maxX, Bool_t Sumw) {
411 fSize = sizeX;
412 fAxisNo = 2;
413 fArray = new HistogramManager_1_1D<T>[fSize];
414 for (int i = 0; i < fSize; i++) {
415 fArray[i].Init(sizeY, binsX, minX, maxX, Sumw);
416 }
417 }
418
419 template<class T>
421 Package* pack = new Package(this);
422 for (int i = 0; i < fSize; i++) {
423 pack->AddObject(fArray[i].Report());
424 }
425 return pack;
426 }
427
428 template<class T>
430 TList* list = new TList();
431 list->SetOwner(kFALSE);
432 for (int i = 0; i < fSize; i++) {
433 for (int j = 0; j < fArray[i].GetSize(); j++) {
434 list->Add(fArray[i].fArray[j]);
435 }
436 }
437 return list;
438 }
439
440 template<class T>
442 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
443 if (manager.fArray) {
444 fArray = new HistogramManager_1_2D<T>[fSize];
445 for (int i = 0; i < fSize; i++) {
446 fArray[i] = manager.fArray[i];
447 }
448 }
449 }
450
451 template<class T>
452 HistogramManager_2_2D<T>& HistogramManager_2_2D<T>::operator=(const HistogramManager_2_2D& manager) {
453 if (this == &manager) { return *this; }
454 if (fSize > 0) {
455 delete[] fArray;
456 fArray = NULL;
457 }
458 fSize = manager.fSize;
459 fAxisNo = manager.fAxisNo;
460 if (manager.fSize > 0) {
461 fArray = new HistogramManager_1_2D<T>[fSize];
462 for (int i = 0; i < fSize; i++) {
463 fArray[i] = manager.fArray[i];
464 }
465 }
466 return *this;
467 }
468
469 template<class T>
470 void HistogramManager_2_2D<T>::Init(Int_t sizeX, Int_t sizeY, HistogramAxisConf** axisconf, TString title, Bool_t Sumw) {
471 fSize = sizeX;
472 fAxisNo = 2;
473 fArray = new HistogramManager_1_2D<T>[fSize];
474 title = title + "[%i]";
475 for (int i = 0; i < fSize; i++) {
476 TString Title = Form(title, i);
477 fArray[i].Init(sizeY, axisconf, Title, Sumw);
478 }
480
481 template<class T>
483 Int_t sizeY,
484 Int_t binsX,
485 Double_t minX,
486 Double_t maxX,
487 Int_t binsY,
488 Int_t minY,
489 Int_t maxY,
490 Bool_t Sumw) {
491 fSize = sizeX;
492 fAxisNo = 2;
493 fArray = new HistogramManager_1_2D<T>[fSize];
494 for (int i = 0; i < fSize; i++) {
495 fArray[i].Init(sizeY, binsX, minX, maxX, binsY, minY, maxY, Sumw);
496 }
497 }
498
499 template<class T>
501 Package* pack = new Package(this);
502 for (int i = 0; i < fSize; i++) {
503 pack->AddObject(fArray[i].Report());
504 }
505 return pack;
506 }
507
508 template<class T>
510 TList* list = new TList();
511 list->SetOwner(kFALSE);
512 for (int i = 0; i < fSize; i++) {
513 for (int j = 0; j < fArray[i].GetSize(); j++) {
514 list->Add(fArray[i].fArray[j]);
515 }
516 }
517 return list;
518 }
519
520 template<class T>
522 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
523 if (manager.fArray) {
524 fArray = new HistogramManager_1_3D<T>[fSize];
525 for (int i = 0; i < fSize; i++) {
526 fArray[i] = manager.fArray[i];
527 }
528 }
529 }
530
531 template<class T>
532 HistogramManager_2_3D<T>& HistogramManager_2_3D<T>::operator=(const HistogramManager_2_3D& manager) {
533 if (this == &manager) { return *this; }
534 if (fSize > 0) {
535 delete[] fArray;
536 fArray = NULL;
537 }
538 fSize = manager.fSize;
539 fAxisNo = manager.fAxisNo;
540 if (manager.fSize > 0) {
541 fArray = new HistogramManager_1_3D<T>[fSize];
542 for (int i = 0; i < fSize; i++) {
543 fArray[i] = manager.fArray[i];
544 }
545 }
546 return *this;
547 }
548
549 template<class T>
550 void HistogramManager_2_3D<T>::Init(Int_t sizeX, Int_t sizeY, HistogramAxisConf** axisconf, TString title, Bool_t Sumw) {
551 fSize = sizeX;
552 fAxisNo = 3;
553 fArray = new HistogramManager_1_3D<T>[fSize];
554 title = title + "[%i]";
555 for (int i = 0; i < fSize; i++) {
556 TString Title = Form(title, i);
557 fArray[i].Init(sizeY, axisconf, Title, Sumw);
558 }
559 }
560
561 template<class T>
563 Int_t sizeY,
564 Int_t binsX,
565 Double_t minX,
566 Double_t maxX,
567 Int_t binsY,
568 Double_t minY,
569 Double_t maxY,
570 Int_t binsZ,
571 Double_t minZ,
572 Double_t maxZ,
573 Bool_t Sumw) {
574 fSize = sizeX;
575 fAxisNo = 3;
576 fArray = new HistogramManager_1_3D<T>[fSize];
577 for (int i = 0; i < fSize; i++) {
578 fArray[i].Init(sizeY, binsX, minX, maxX, binsY, minY, maxY, binsZ, minZ, maxZ, Sumw);
579 }
580 }
581
582 template<class T>
584 Package* pack = new Package(this);
585 for (int i = 0; i < fSize; i++) {
586 pack->AddObject(fArray[i].Report());
587 }
588 return pack;
589 }
590
591 template<class T>
593 TList* list = new TList();
594 list->SetOwner(kFALSE);
595 for (int i = 0; i < fSize; i++) {
596 for (int j = 0; j < fArray[i].GetSize(); j++) {
597 list->Add(fArray[i].fArray[j]);
598 }
599 }
600 return list;
601 }
602
603 template<class T>
605 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
606 if (manager.fArray) {
607 fArray = new HistogramManager_2_1D<T>[fSize];
608 for (int i = 0; i < fSize; i++) {
609 fArray[i] = manager.fArray[i];
610 }
611 }
612 }
613
614 template<class T>
615 HistogramManager_3_1D<T>& HistogramManager_3_1D<T>::operator=(const HistogramManager_3_1D& manager) {
616 if (this == &manager) { return *this; }
617 if (fSize > 0) {
618 delete[] fArray;
619 fArray = NULL;
620 }
621 fSize = manager.fSize;
622 fAxisNo = manager.fAxisNo;
623 if (manager.fSize > 0) {
624 fArray = new HistogramManager_2_1D<T>[fSize];
625 for (int i = 0; i < fSize; i++) {
626 fArray[i] = manager.fArray[i];
627 }
628 }
629 return *this;
630 }
631
632 template<class T>
634 Int_t sizeY,
635 Int_t sizeZ,
637 TString title,
638 Bool_t Sumw) {
639 fSize = sizeX;
640 fAxisNo = 1;
641 fArray = new HistogramManager_2_1D<T>[fSize];
642 title = title + "[%i]";
643 for (int i = 0; i < fSize; i++) {
644 TString Title = Form(title, i);
645 fArray[i].Init(sizeY, sizeZ, axisconf, Title, Sumw);
646 }
647 }
648
649 template<class T>
650 void
651 HistogramManager_3_1D<T>::Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, Int_t binsX, Double_t minX, Double_t maxX, Bool_t Sumw) {
652 fSize = sizeX;
653 fAxisNo = 1;
654 fArray = new HistogramManager_2_1D<T>[fSize];
655 for (int i = 0; i < fSize; i++) {
656 fArray[i].Init(sizeY, sizeZ, binsX, minX, maxX, Sumw);
657 }
658 }
659
660 template<class T>
662 Package* pack = new Package(this);
663 for (int i = 0; i < fSize; i++) {
664 pack->AddObject(fArray[i].Report());
665 }
666 return pack;
667 }
668
669 template<class T>
671 TList* list = new TList();
672 list->SetOwner(kFALSE);
673 for (int i = 0; i < fSize; i++) {
674 for (int j = 0; j < fArray[i].GetSize(); j++) {
675 for (int k = 0; k < fArray[i].fArray[j].GetSize(); k++) {
676 list->Add(fArray[i].fArray[j].fArray[k]);
677 }
679 }
680 return list;
681 }
682
683 template<class T>
684 HistogramManager_3_2D<T>::HistogramManager_3_2D(const HistogramManager_3_2D& manager) :
685 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
686 if (manager.fArray) {
687 fArray = new HistogramManager_2_2D<T>[fSize];
688 for (int i = 0; i < fSize; i++) {
689 fArray[i] = manager.fArray[i];
690 }
691 }
692 }
693
694 template<class T>
695 HistogramManager_3_2D<T>& HistogramManager_3_2D<T>::operator=(const HistogramManager_3_2D& manager) {
696 if (this == &manager) { return *this; }
697 if (fSize > 0) {
698 delete[] fArray;
699 fArray = NULL;
700 }
701 fSize = manager.fSize;
702 fAxisNo = manager.fAxisNo;
703 if (manager.fSize > 0) {
704 fArray = new HistogramManager_2_2D<T>[fSize];
705 for (int i = 0; i < fSize; i++) {
706 fArray[i] = manager.fArray[i];
707 }
708 }
709 return *this;
710 }
711
712 template<class T>
714 Int_t sizeY,
715 Int_t sizeZ,
716 HistogramAxisConf** axisconf,
717 TString title,
718 Bool_t Sumw) {
719 fSize = sizeX;
720 fAxisNo = 2;
721 fArray = new HistogramManager_2_2D<T>[fSize];
722 title = title + "[%i]";
723 for (int i = 0; i < fSize; i++) {
724 TString Title = Form(title, i);
725 fArray[i].Init(sizeY, sizeZ, axisconf, Title, Sumw);
726 }
727 }
728
729 template<class T>
731 Int_t sizeY,
732 Int_t sizeZ,
733 Int_t binsX,
734 Double_t minX,
735 Double_t maxX,
736 Int_t binsY,
737 Int_t minY,
738 Int_t maxY,
739 Bool_t Sumw) {
740 fSize = sizeX;
741 fAxisNo = 2;
742 fArray = new HistogramManager_2_2D<T>[fSize];
743 for (int i = 0; i < fSize; i++) {
744 fArray[i].Init(sizeY, sizeZ, binsX, minX, maxX, binsY, minY, maxY, Sumw);
745 }
746 }
747
748 template<class T>
750 Package* pack = new Package(this);
751 for (int i = 0; i < fSize; i++) {
752 pack->AddObject(fArray[i].Report());
753 }
754 return pack;
756
757 template<class T>
759 TList* list = new TList();
760 list->SetOwner(kFALSE);
761 for (int i = 0; i < fSize; i++) {
762 for (int j = 0; j < fArray[i].GetSize(); j++) {
763 for (int k = 0; k < fArray[i].fArray[j].GetSize(); k++) {
764 list->Add(fArray[i].fArray[j].fArray[k]);
766 }
767 }
768 return list;
769 }
771 template<class T>
773 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
774 if (manager.fArray) {
775 fArray = new HistogramManager_2_3D<T>[fSize];
776 for (int i = 0; i < fSize; i++) {
777 fArray[i] = manager.fArray[i];
778 }
779 }
780 }
781
782 template<class T>
783 HistogramManager_3_3D<T>& HistogramManager_3_3D<T>::operator=(const HistogramManager_3_3D& manager) {
784 if (this == &manager) { return *this; }
785 if (fSize > 0) {
786 delete[] fArray;
787 fArray = NULL;
788 }
789 fSize = manager.fSize;
790 fAxisNo = manager.fAxisNo;
791 if (manager.fSize > 0) {
792 fArray = new HistogramManager_2_3D<T>[fSize];
793 for (int i = 0; i < fSize; i++) {
794 fArray[i] = manager.fArray[i];
795 }
796 }
797 return *this;
798 }
799
800 template<class T>
802 Int_t sizeY,
803 Int_t sizeZ,
804 HistogramAxisConf** axisconf,
805 TString title,
806 Bool_t Sumw) {
807 fSize = sizeX;
808 fAxisNo = 3;
809 fArray = new HistogramManager_2_3D<T>[fSize];
810 title = title + "[%i]";
811 for (int i = 0; i < fSize; i++) {
812 TString Title = Form(title, i);
813 fArray[i].Init(sizeY, sizeZ, axisconf, Title, Sumw);
814 }
815 }
816
817 template<class T>
819 Int_t sizeY,
820 Int_t sizeZ,
821 Int_t binsX,
822 Double_t minX,
823 Double_t maxX,
824 Int_t binsY,
825 Double_t minY,
826 Double_t maxY,
827 Int_t binsZ,
828 Double_t minZ,
829 Double_t maxZ,
830 Bool_t Sumw) {
831 fSize = sizeX;
832 fAxisNo = 3;
833 fArray = new HistogramManager_2_3D<T>[fSize];
834 for (int i = 0; i < fSize; i++) {
835 fArray[i].Init(sizeY, sizeZ, binsX, minX, maxX, binsY, minY, maxY, binsZ, minZ, maxZ, Sumw);
836 }
837 }
838
839 template<class T>
841 Package* pack = new Package(this);
842 for (int i = 0; i < fSize; i++) {
843 pack->AddObject(fArray[i].Report());
844 }
845 return pack;
846 }
847
848 template<class T>
850 TList* list = new TList();
851 list->SetOwner(kFALSE);
852 for (int i = 0; i < fSize; i++) {
853 for (int j = 0; j < fArray[i].GetSize(); j++) {
854 for (int k = 0; k < fArray[i].fArray[j].GetSize(); k++) {
855 list->Add(fArray[i].fArray[j].fArray[k]);
856 }
857 }
858 }
859 return list;
860 }
861
862 template<class T>
864 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
865 if (manager.fArray) {
866 fArray = new HistogramManager_3_1D<T>[fSize];
867 for (int i = 0; i < fSize; i++) {
868 fArray[i] = manager.fArray[i];
869 }
870 }
871 }
872
873 template<class T>
874 HistogramManager_4_1D<T>& HistogramManager_4_1D<T>::operator=(const HistogramManager_4_1D& manager) {
875 if (this == &manager) { return *this; }
876 if (fSize > 0) {
877 delete[] fArray;
878 fArray = NULL;
879 }
880 fSize = manager.fSize;
881 fAxisNo = manager.fAxisNo;
882 if (manager.fSize > 0) {
883 fArray = new HistogramManager_3_1D<T>[fSize];
884 for (int i = 0; i < fSize; i++) {
885 fArray[i] = manager.fArray[i];
886 }
887 }
888 return *this;
889 }
890
891 template<class T>
893 Int_t sizeY,
894 Int_t sizeZ,
895 Int_t sizeD,
896 HistogramAxisConf** axisconf,
897 TString title,
898 Bool_t Sumw) {
899 fSize = sizeX;
900 fAxisNo = 1;
901 fArray = new HistogramManager_3_1D<T>[fSize];
902 title = title + "[%i]";
903 for (int i = 0; i < fSize; i++) {
904 TString Title = Form(title, i);
905 fArray[i].Init(sizeY, sizeZ, sizeD, axisconf, Title, Sumw);
906 }
907 }
908
909 template<class T>
911 Int_t sizeY,
912 Int_t sizeZ,
913 Int_t sizeT,
914 Int_t binsX,
915 Double_t minX,
916 Double_t maxX,
917 Bool_t Sumw) {
918 fSize = sizeX;
919 fAxisNo = 1;
920 fArray = new HistogramManager_3_1D<T>[fSize];
921 for (int i = 0; i < fSize; i++) {
922 fArray[i].Init(sizeY, sizeZ, sizeT, binsX, minX, maxX, Sumw);
923 }
924 }
925
926 template<class T>
928 Package* pack = new Package(this);
929 for (int i = 0; i < fSize; i++) {
930 pack->AddObject(fArray[i].Report());
931 }
932 return pack;
933 }
934
935 template<class T>
937 TList* list = new TList();
938 list->SetOwner(kFALSE);
939 for (int i = 0; i < fSize; i++) {
940 for (int j = 0; j < fArray[i].GetSize(); j++) {
941 for (int k = 0; k < fArray[i].fArray[j].GetSize(); k++) {
942 for (int l = 0; l < fArray[i].fArray[j].fArray[j].GetSize(); l++) {
943 list->Add(fArray[i].fArray[j].fArray[k].fArray[l]);
944 }
945 }
946 }
947 }
948 return list;
950
951 template<class T>
953 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
954 if (manager.fArray) {
955 fArray = new HistogramManager_3_2D<T>[fSize];
956 for (int i = 0; i < fSize; i++) {
957 fArray[i] = manager.fArray[i];
958 }
959 }
960 }
961
962 template<class T>
963 HistogramManager_4_2D<T>& HistogramManager_4_2D<T>::operator=(const HistogramManager_4_2D& manager) {
964 if (this == &manager) { return *this; }
965 if (fSize > 0) {
966 delete[] fArray;
967 fArray = NULL;
968 }
969 fSize = manager.fSize;
970 fAxisNo = manager.fAxisNo;
971 if (manager.fSize > 0) {
972 fArray = new HistogramManager_3_2D<T>[fSize];
973 for (int i = 0; i < fSize; i++) {
974 fArray[i] = manager.fArray[i];
975 }
977 return *this;
978 }
979
980 template<class T>
982 Int_t sizeY,
983 Int_t sizeZ,
984 Int_t sizeD,
985 HistogramAxisConf** axisconf,
986 TString title,
987 Bool_t Sumw) {
988 fSize = sizeX;
989 fAxisNo = 2;
990 fArray = new HistogramManager_3_2D<T>[fSize];
991 title = title + "[%i]";
992 for (int i = 0; i < fSize; i++) {
993 TString Title = Form(title, i);
994 fArray[i].Init(sizeY, sizeZ, sizeD, axisconf, Title, Sumw);
995 }
996 }
997
998 template<class T>
1000 Int_t sizeY,
1001 Int_t sizeZ,
1002 Int_t sizeT,
1003 Int_t binsX,
1004 Double_t minX,
1005 Double_t maxX,
1006 Int_t binsY,
1007 Int_t minY,
1008 Int_t maxY,
1009 Bool_t Sumw) {
1010 fSize = sizeX;
1011 fAxisNo = 2;
1012 fArray = new HistogramManager_3_2D<T>[fSize];
1013 for (int i = 0; i < fSize; i++) {
1014 fArray[i].Init(sizeY, sizeZ, sizeT, binsX, minX, maxX, binsY, minY, maxY, Sumw);
1015 }
1016 }
1017
1018 template<class T>
1020 Package* pack = new Package(this);
1021 for (int i = 0; i < fSize; i++) {
1022 pack->AddObject(fArray[i].Report());
1023 }
1024 return pack;
1025 }
1026
1027 template<class T>
1029 TList* list = new TList();
1030 list->SetOwner(kFALSE);
1031 for (int i = 0; i < fSize; i++) {
1032 for (int j = 0; j < fArray[i].GetSize(); j++) {
1033 for (int k = 0; k < fArray[i].fArray[j].GetSize(); k++) {
1034 for (int l = 0; l < fArray[i].fArray[j].fArray[j].GetSize(); l++) {
1035 list->Add(fArray[i].fArray[j].fArray[k].fArray[l]);
1036 }
1037 }
1038 }
1039 }
1040 return list;
1041 }
1042
1043 template<class T>
1045 TObject(manager), fSize(manager.fSize), fAxisNo(manager.fAxisNo), fArray(NULL) {
1046 if (manager.fArray) {
1047 fArray = new HistogramManager_3_3D<T>[fSize];
1048 for (int i = 0; i < fSize; i++) {
1049 fArray[i] = manager.fArray[i];
1050 }
1051 }
1052 }
1053
1054 template<class T>
1055 HistogramManager_4_3D<T>& HistogramManager_4_3D<T>::operator=(const HistogramManager_4_3D& manager) {
1056 if (this == &manager) { return *this; }
1057 if (fSize > 0) {
1058 delete[] fArray;
1059 fArray = NULL;
1060 }
1061 fSize = manager.fSize;
1062 fAxisNo = manager.fAxisNo;
1063 if (manager.fSize > 0) {
1064 fArray = new HistogramManager_3_3D<T>[fSize];
1065 for (int i = 0; i < fSize; i++) {
1066 fArray[i] = manager.fArray[i];
1067 }
1068 }
1069 return *this;
1070 }
1071
1072 template<class T>
1074 Int_t sizeY,
1075 Int_t sizeZ,
1076 Int_t sizeD,
1077 HistogramAxisConf** axisconf,
1078 TString title,
1079 Bool_t Sumw) {
1080 fSize = sizeX;
1081 fAxisNo = 3;
1082 ;
1083 fArray = new HistogramManager_3_3D<T>[fSize];
1084 title = title + "[%i]";
1085 for (int i = 0; i < fSize; i++) {
1086 TString Title = Form(title, i);
1087 fArray[i].Init(sizeY, sizeZ, sizeD, axisconf, Title, Sumw);
1088 }
1089 }
1090
1091 template<class T>
1093 Int_t sizeY,
1094 Int_t sizeZ,
1095 Int_t sizeT,
1096 Int_t binsX,
1097 Double_t minX,
1098 Double_t maxX,
1099 Int_t binsY,
1100 Double_t minY,
1101 Double_t maxY,
1102 Int_t binsZ,
1103 Double_t minZ,
1104 Double_t maxZ,
1105 Bool_t Sumw) {
1106 fSize = sizeX;
1107 fAxisNo = 3;
1108 fArray = new HistogramManager_3_3D<T>[fSize];
1109 for (int i = 0; i < fSize; i++) {
1110 fArray[i].Init(sizeY, sizeZ, sizeT, binsX, minX, maxX, binsY, minY, maxY, binsZ, minZ, maxZ, Sumw);
1111 }
1112 }
1113
1114 template<class T>
1116 Package* pack = new Package(this);
1117 for (int i = 0; i < fSize; i++) {
1118 pack->AddObject(fArray[i].Report());
1119 }
1120 return pack;
1121 }
1122
1123 template<class T>
1125 TList* list = new TList();
1126
1127 for (int i = 0; i < fSize; i++) {
1128 for (int j = 0; j < fArray[i].GetSize(); j++) {
1129 for (int k = 0; k < fArray[i].fArray[j].GetSize(); k++) {
1130 for (int l = 0; l < fArray[i].fArray[j].fArray[j].GetSize(); l++) {
1131 list->Add(fArray[i].fArray[j].fArray[k].fArray[l]);
1132 }
1133 }
1134 }
1135 }
1136 list->SetOwner(kFALSE);
1137 return list;
1138 }
1139
1140 template class HistogramManager_1_1D<TH1D>;
1141 template class HistogramManager_1_1D<TH1F>;
1142 template class HistogramManager_1_1D<TH1I>;
1143 template class HistogramManager_1_2D<TH2D>;
1144 template class HistogramManager_1_2D<TH2F>;
1145 template class HistogramManager_1_2D<TH2I>;
1146 template class HistogramManager_1_3D<TH3D>;
1147 template class HistogramManager_1_3D<TH3F>;
1148 template class HistogramManager_1_3D<TH3I>;
1149
1150 template class HistogramManager_2_1D<TH1D>;
1151 template class HistogramManager_2_1D<TH1F>;
1152 template class HistogramManager_2_1D<TH1I>;
1153 template class HistogramManager_2_2D<TH2D>;
1154 template class HistogramManager_2_2D<TH2F>;
1155 template class HistogramManager_2_2D<TH2I>;
1156 template class HistogramManager_2_3D<TH3D>;
1157 template class HistogramManager_2_3D<TH3F>;
1158 template class HistogramManager_2_3D<TH3I>;
1159
1160 template class HistogramManager_3_1D<TH1D>;
1161 template class HistogramManager_3_1D<TH1F>;
1162 template class HistogramManager_3_1D<TH1I>;
1163 template class HistogramManager_3_2D<TH2D>;
1164 template class HistogramManager_3_2D<TH2F>;
1165 template class HistogramManager_3_2D<TH2I>;
1166 template class HistogramManager_3_3D<TH3D>;
1167 template class HistogramManager_3_3D<TH3F>;
1168 template class HistogramManager_3_3D<TH3I>;
1169
1170 template class HistogramManager_4_1D<TH1D>;
1171 template class HistogramManager_4_1D<TH1F>;
1172 template class HistogramManager_4_1D<TH1I>;
1173 template class HistogramManager_4_2D<TH2D>;
1174 template class HistogramManager_4_2D<TH2F>;
1175 template class HistogramManager_4_2D<TH2I>;
1176 template class HistogramManager_4_3D<TH3D>;
1177 template class HistogramManager_4_3D<TH3F>;
1178 template class HistogramManager_4_3D<TH3I>;
1179
1180} // namespace Hal
void OverwriteAt(T *t, Int_t pos)
void Init(Int_t size, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
void Init(Int_t size, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
void OverwriteAt(T *t, Int_t pos)
HistogramManager_1_1D< T > * fArray
void Init(Int_t sizeX, Int_t sizeY, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
HistogramManager_1_2D< T > * fArray
void Init(Int_t sizeX, Int_t sizeY, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
void Init(Int_t sizeX, Int_t sizeY, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
HistogramManager_1_3D< T > * fArray
void Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
HistogramManager_2_1D< T > * fArray
void Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
void Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
HistogramManager_2_3D< T > * fArray
void Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, Int_t sizeD, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
HistogramManager_3_1D< T > * fArray
void Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, Int_t sizeD, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
HistogramManager_3_2D< T > * fArray
HistogramManager_3_3D< T > * fArray
void Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, Int_t sizeD, HistogramAxisConf **axisconf, TString title, Bool_t Sumw=kFALSE)
void AddObject(TObject *object)
Definition Package.cxx:209