Project
Loading...
Searching...
No Matches
test_Algorithm.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#include <gsl/span>
18#include <memory>
19#include <stdexcept>
20#define BOOST_TEST_MODULE Test Utilities MergerAlgorithm
21#define BOOST_TEST_MAIN
22#define BOOST_TEST_DYN_LINK
23
24#include <boost/test/unit_test.hpp>
25
29#include "Mergers/ObjectStore.h"
30
31#include <TObjArray.h>
32#include <TObjString.h>
33#include <TH1.h>
34#include <TH2.h>
35#include <TH3.h>
36#include <THn.h>
37#include <TTree.h>
38#include <THnSparse.h>
39#include <TF1.h>
40#include <TGraph.h>
41#include <TProfile.h>
42#include <TCanvas.h>
43
44// using namespace o2::framework;
45using namespace o2::mergers;
46
47constexpr size_t bins = 10;
48constexpr size_t min = 0;
49constexpr size_t max = 10;
50
51BOOST_AUTO_TEST_CASE(MergerEmptyObjects)
52{
53 {
54 TH1I* target = nullptr;
55 TH1I* other = new TH1I("obj1", "obj1", bins, min, max);
56 BOOST_CHECK_THROW(algorithm::merge(target, other), std::runtime_error);
57 delete other;
58 }
59 {
60 TH1I* target = new TH1I("obj1", "obj1", bins, min, max);
61 TH1I* other = nullptr;
62 BOOST_CHECK_THROW(algorithm::merge(target, other), std::runtime_error);
63 delete target;
64 }
65}
66
67BOOST_AUTO_TEST_CASE(MergerNotSupportedTObject)
68{
69 TObjString* target = new TObjString("foo");
70 TObjString* other = new TObjString("bar");
72 BOOST_CHECK(target->GetString() == "foo");
73 delete target;
74 delete other;
75}
76
77BOOST_AUTO_TEST_CASE(MergerTheSameObject)
78{
79 TH1I* object = new TH1I("obj1", "obj1", bins, min, max);
80 BOOST_CHECK_THROW(algorithm::merge(object, object), std::runtime_error);
81 delete object;
82}
83
84BOOST_AUTO_TEST_CASE(MergerSingularObjects)
85{
86 {
87 TH1I* target = new TH1I("obj1", "obj1", bins, min, max);
88 target->Fill(5);
89 TH1I* other = new TH1I("obj2", "obj2", bins, min, max);
90 other->Fill(2);
91 other->Fill(2);
92
94 BOOST_CHECK_EQUAL(target->GetBinContent(target->FindBin(2)), 2);
95 BOOST_CHECK_EQUAL(target->GetBinContent(target->FindBin(5)), 1);
96
97 delete other;
98 delete target;
99 }
100 {
101 TH2I* target = new TH2I("obj1", "obj1", bins, min, max, bins, min, max);
102 target->Fill(5, 5);
103 TH2I* other = new TH2I("obj2", "obj2", bins, min, max, bins, min, max);
104 other->Fill(2, 2);
105 other->Fill(2, 2);
106
108 BOOST_CHECK_EQUAL(target->GetBinContent(target->FindBin(2, 2)), 2);
109 BOOST_CHECK_EQUAL(target->GetBinContent(target->FindBin(5, 5)), 1);
110
111 delete other;
112 delete target;
113 }
114 {
115 TH3I* target = new TH3I("obj1", "obj1", bins, min, max, bins, min, max, bins, min, max);
116 target->Fill(5, 5, 5);
117 TH3I* other = new TH3I("obj2", "obj2", bins, min, max, bins, min, max, bins, min, max);
118 other->Fill(2, 2, 2);
119 other->Fill(2, 2, 2);
120
122 BOOST_CHECK_EQUAL(target->GetBinContent(target->FindBin(2, 2, 2)), 2);
123 BOOST_CHECK_EQUAL(target->GetBinContent(target->FindBin(5, 5, 5)), 1);
124
125 delete other;
126 delete target;
127 }
128 {
129 const size_t dim = 5;
130 const Int_t binsDims[dim] = {bins, bins, bins, bins, bins};
131 const Double_t mins[dim] = {min, min, min, min, min};
132 const Double_t maxs[dim] = {max, max, max, max, max};
133
134 THnI* target = new THnI("obj1", "obj1", dim, binsDims, mins, maxs);
135 target->FillBin(5, 1);
136 THnI* other = new THnI("obj2", "obj2", dim, binsDims, mins, maxs);
137 other->FillBin(2, 1);
138 other->FillBin(2, 1);
139
141 BOOST_CHECK_EQUAL(target->GetBinContent(2), 2);
142 BOOST_CHECK_EQUAL(target->GetBinContent(5), 1);
143
144 delete other;
145 delete target;
146 }
147 {
148 const size_t dim = 5;
149 const Int_t binsDims[dim] = {bins, bins, bins, bins, bins};
150 const Double_t mins[dim] = {min, min, min, min, min};
151 const Double_t maxs[dim] = {max, max, max, max, max};
152
153 Double_t entry[dim] = {5, 5, 5, 5, 5};
154
155 THnSparseI* target = new THnSparseI("obj1", "obj1", dim, binsDims, mins, maxs);
156 target->Fill(entry);
157 THnSparseI* other = new THnSparseI("obj2", "obj2", dim, binsDims, mins, maxs);
158 entry[0] = entry[1] = entry[2] = entry[3] = entry[4] = 2;
159 other->Fill(entry);
160 other->Fill(entry);
161
163 BOOST_CHECK_EQUAL(target->GetBinContent(0, nullptr), 1);
164 BOOST_CHECK_EQUAL(target->GetBinContent(1), 2);
165
166 delete other;
167 delete target;
168 }
169 {
170 struct format1 {
171 Int_t a;
172 Double_t b;
173 } branch1;
174 ULong64_t branch2;
175
176 auto createTree = [&](std::string name) -> TTree* {
177 TTree* tree = new TTree();
178 tree->SetName(name.c_str());
179 tree->Branch("b1", &branch1, "a/I:b/L:c/F:d/D");
180 tree->Branch("b2", &branch2);
181 return tree;
182 };
183
184 TTree* target = createTree("obj1");
185 TTree* other = createTree("obj2");
186
187 branch1.a = 1;
188 branch1.b = 2;
189 branch2 = 3;
190
191 target->Fill();
192 other->Fill();
193 other->Fill();
194
196 BOOST_CHECK_EQUAL(target->GetEntries(), 3);
197
198 delete other;
199 delete target;
200 }
201 {
202 constexpr Int_t points = 5;
203 Double_t x1[] = {0, 1, 2, 3, 4};
204 Double_t y1[] = {0, 1, 2, 3, 4};
205 Double_t x2[] = {5, 6, 7, 8, 9};
206 Double_t y2[] = {5, 6, 7, 8, 9};
207
208 TGraph* target = new TGraph(points, x1, y1);
209 TGraph* other = new TGraph(points, x2, y2);
210
212 BOOST_CHECK_EQUAL(target->GetN(), 2 * points);
213
214 delete other;
215 delete target;
216 }
217 {
218 auto target = new TProfile("hprof1", "hprof1", bins, min, max, min, max);
219 target->Fill(2, 2, 1);
220 auto other = new TProfile("hprof2", "hprof2", bins, min, max, min, max);
221 other->Fill(5, 5, 1);
222
224 BOOST_CHECK_EQUAL(target->GetEntries(), 2);
225 BOOST_CHECK_EQUAL(target->GetBinContent(target->FindBin(0)), 0);
226 BOOST_CHECK_EQUAL(target->GetBinContent(target->FindBin(1)), 0);
227 BOOST_CHECK_CLOSE(target->GetBinContent(target->FindBin(2)), 2, 0.001);
228 BOOST_CHECK_CLOSE(target->GetBinContent(target->FindBin(5)), 5, 0.001);
229
230 delete other;
231 delete target;
232 }
233 {
234 auto* target = new CustomMergeableTObject("obj1", 123);
235 auto* other = new CustomMergeableTObject("obj2", 321);
236
238 BOOST_CHECK_EQUAL(target->getSecret(), 444);
239
240 delete other;
241 delete target;
242 }
243 {
244 auto* target = new CustomMergeableObject(123);
245 auto* other = new CustomMergeableObject(321);
246
248 BOOST_CHECK_EQUAL(target->getSecret(), 444);
249
250 delete other;
251 delete target;
252 }
253}
254
255BOOST_AUTO_TEST_CASE(MergerCollection)
256{
257 // Setting up the target. Histo 1D + Custom stored in TObjArray.
258 TObjArray* target = new TObjArray();
259 target->SetOwner(true);
260
261 TH1I* targetTH1I = new TH1I("histo 1d", "histo 1d", bins, min, max);
262 targetTH1I->Fill(5);
263 target->Add(targetTH1I);
264
265 CustomMergeableTObject* targetCustom = new CustomMergeableTObject("custom", 9000);
266 target->Add(targetCustom);
267
268 // Setting up the other. Histo 1D + Histo 2D + Custom stored in TList.
269 TList* other = new TList();
270 other->SetOwner(true);
271
272 TH1I* otherTH1I = new TH1I("histo 1d", "histo 1d", bins, min, max);
273 otherTH1I->Fill(2);
274 otherTH1I->Fill(2);
275 other->Add(otherTH1I);
276
277 TH2I* otherTH2I = new TH2I("histo 2d", "histo 2d", bins, min, max, bins, min, max);
278 otherTH2I->Fill(5, 5);
279 other->Add(otherTH2I);
280
281 CustomMergeableTObject* otherCustom = new CustomMergeableTObject("custom", 1);
282 other->Add(otherCustom);
283
284 // Merge
286
287 // Make sure that deleting the object present only in `other` doesn't delete it in the `target`
288 delete other;
289
290 // Checks
291 BOOST_REQUIRE_EQUAL(target->GetEntries(), 3);
292
293 TH1I* resultTH1I = dynamic_cast<TH1I*>(target->FindObject("histo 1d"));
294 BOOST_REQUIRE(resultTH1I != nullptr);
295 BOOST_CHECK_EQUAL(resultTH1I->GetBinContent(resultTH1I->FindBin(2)), 2);
296 BOOST_CHECK_EQUAL(resultTH1I->GetBinContent(resultTH1I->FindBin(5)), 1);
297
298 TH2I* resultTH2I = dynamic_cast<TH2I*>(target->FindObject("histo 2d"));
299 BOOST_REQUIRE(resultTH2I != nullptr);
300 BOOST_CHECK_EQUAL(resultTH2I->GetBinContent(resultTH2I->FindBin(5, 5)), 1);
301
302 auto* resultCustom = dynamic_cast<CustomMergeableTObject*>(target->FindObject("custom"));
303 BOOST_REQUIRE(resultCustom != nullptr);
304 BOOST_CHECK_EQUAL(resultCustom->getSecret(), 9001);
305
306 delete target;
307}
308
309TCanvas* createCanvas(std::string name, std::string title, std::vector<std::shared_ptr<TH1I>>& histograms)
310{
311 auto canvas = new TCanvas(name.c_str(), title.c_str(), 100, 100);
312 canvas->Divide(histograms.size(), 1);
313 for (size_t i = 1; const auto& hist : histograms) {
314 canvas->cd(i);
315 hist->Draw();
316 ++i;
317 }
318 return canvas;
319}
320
321auto collectUnderlyingObjects(TCanvas* canvas) -> std::vector<TObject*>
322{
323 auto collectFromTPad = [](TPad* pad, std::vector<TObject*>& objects, const auto& collectFromTPad) {
324 if (!pad) {
325 return;
326 }
327 auto* primitives = pad->GetListOfPrimitives();
328 for (int i = 0; i < primitives->GetSize(); ++i) {
329 auto* primitive = primitives->At(i);
330 if (auto* primitivePad = dynamic_cast<TPad*>(primitive)) {
331 collectFromTPad(primitivePad, objects, collectFromTPad);
332 } else {
333 objects.push_back(primitive);
334 }
335 }
336 };
337
338 std::vector<TObject*> collectedObjects;
339 collectFromTPad(canvas, collectedObjects, collectFromTPad);
340
341 return collectedObjects;
342}
343
345{
346 // working example
347 {
348 std::vector<std::shared_ptr<TH1I>> histsC1{
349 std::make_shared<TH1I>("th1", "obj1", bins, min, max),
350 std::make_shared<TH1I>("th2", "obj2", bins, min, max),
351 };
352 histsC1[0]->Fill(5);
353 histsC1[1]->Fill(2);
354 BOOST_CHECK_EQUAL(histsC1[0]->GetBinContent(histsC1[0]->FindBin(5)), 1);
355 BOOST_CHECK_EQUAL(histsC1[1]->GetBinContent(histsC1[1]->FindBin(2)), 1);
356
357 std::vector<std::shared_ptr<TH1I>> histsC2{
358 std::make_shared<TH1I>("th1", "obj1", bins, min, max),
359 std::make_shared<TH1I>("th2", "obj2", bins, min, max),
360 };
361
362 histsC2[0]->Fill(5);
363 histsC2[1]->Fill(2);
364 BOOST_CHECK_EQUAL(histsC2[0]->GetBinContent(histsC2[0]->FindBin(5)), 1);
365 BOOST_CHECK_EQUAL(histsC2[1]->GetBinContent(histsC2[1]->FindBin(2)), 1);
366
367 auto targetCanvas = createCanvas("c1", "test title 1", histsC1);
368 auto otherCanvas = createCanvas("c2", "test title 2", histsC2);
369
370 algorithm::merge(targetCanvas, otherCanvas);
371
372 auto targetObjects = collectUnderlyingObjects(targetCanvas);
373
374 BOOST_CHECK_EQUAL(targetObjects.size(), 2);
375 for (const auto& object : targetObjects) {
376 auto th = static_cast<TH1*>(object);
377 if (std::string(th->GetName()) == "th1") {
378 BOOST_CHECK_EQUAL(th->GetBinContent(th->FindBin(5)), 2);
379 }
380 if (std::string(th->GetName()) == "th2") {
381 BOOST_CHECK_EQUAL(th->GetBinContent(th->FindBin(2)), 2);
382 }
383 }
384 }
385
386 // throw because we try to merge canvases with different number of underlying items
387 {
388 std::vector<std::shared_ptr<TH1I>> histsC1{
389 std::make_shared<TH1I>("th1", "obj1", bins, min, max),
390 std::make_shared<TH1I>("th2", "obj2", bins, min, max),
391 };
392
393 std::vector<std::shared_ptr<TH1I>> histsC2{
394 std::make_shared<TH1I>("th1", "obj1", bins, min, max),
395 };
396
397 auto targetCanvas = createCanvas("c1", "test title 1", histsC1);
398 auto otherCanvas = createCanvas("c2", "test title 2", histsC2);
399
400 BOOST_CHECK_THROW(algorithm::merge(targetCanvas, otherCanvas), std::runtime_error);
401 }
402
403 // throw because we try to merge canvases with different underlying items
404 {
405 std::vector<std::shared_ptr<TH1I>> histsC1{
406 std::make_shared<TH1I>("th1", "obj1", bins, min, max),
407 };
408
409 std::vector<std::shared_ptr<TH1I>> histsC2{
410 std::make_shared<TH1I>("th2", "obj2", bins, min, max),
411 };
412
413 auto targetCanvas = createCanvas("c1", "test title 1", histsC1);
414 auto otherCanvas = createCanvas("c2", "test title 2", histsC2);
415
416 BOOST_CHECK_THROW(algorithm::merge(targetCanvas, otherCanvas), std::runtime_error);
417 }
418}
419
421{
422 TObjArray* main = new TObjArray();
423 main->SetOwner(false);
424
425 TH1I* histo1D = new TH1I("histo 1d", "histo 1d", bins, min, max);
426 histo1D->Fill(5);
427 main->Add(histo1D);
428
429 CustomMergeableTObject* custom = new CustomMergeableTObject("custom", 9000);
430 main->Add(custom);
431
432 // Setting up the other. Histo 1D + Histo 2D + Custom stored in TList.
433 auto* collectionInside = new TList();
434 collectionInside->SetOwner(true);
435
436 TH1I* histo1DinsideCollection = new TH1I("histo 1d", "histo 1d", bins, min, max);
437 histo1DinsideCollection->Fill(2);
438 collectionInside->Add(histo1DinsideCollection);
439
440 TH2I* histo2DinsideCollection = new TH2I("histo 2d", "histo 2d", bins, min, max, bins, min, max);
441 histo2DinsideCollection->Fill(5, 5);
442 collectionInside->Add(histo2DinsideCollection);
443
444 main->Add(collectionInside);
445
446 // I am afraid we can't check more than that.
448}
449
451{
452 TH1F* target = new TH1F("histo 1", "histo 1", bins, min, max);
453 target->SetBit(TH1::kIsAverage);
454 target->Fill(5);
455
456 TH1F* other = new TH1F("histo 2", "histo 2", bins, min, max);
457 other->SetBit(TH1::kIsAverage);
458 other->Fill(5);
459
461 BOOST_CHECK_CLOSE(target->GetBinContent(other->FindBin(5)), 1.0, 0.001);
462
463 delete target;
464 delete other;
465}
466
467BOOST_AUTO_TEST_SUITE(VectorOfHistos)
468
469gsl::span<float> to_span(std::shared_ptr<TH1F>& histo)
470{
471 return {histo->GetArray(), static_cast<uint>(histo->GetSize())};
472}
473
474template <typename T, std::size_t N>
475gsl::span<T, N> to_array(T (&&arr)[N])
476{
477 return arr;
478}
479
480BOOST_AUTO_TEST_CASE(SameLength, *boost::unit_test::tolerance(0.001))
481{
482 auto target1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max);
483 target1_1->Fill(5);
484 target1_1->Fill(5);
485
486 auto target1_2 = std::make_shared<TH1F>("histo 1-2", "histo 1-2", bins, min, max);
487 target1_2->Fill(5);
488 target1_2->Fill(5);
489 target1_2->Fill(5);
490 target1_2->Fill(5);
491
493
494 auto other1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max);
495 other1_1->Fill(5);
496
497 auto other1_2 = std::make_shared<TH1F>("histo 1-2", "histo 1-2", bins, min, max);
498 other1_2->Fill(5);
499 other1_2->Fill(5);
500
502
503 BOOST_TEST(target.size() == 2);
504 BOOST_TEST(other.size() == 2);
505
506 BOOST_TEST(to_span(target1_1) == to_array({0., 0., 0., 0., 0., 0., 2., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
507 BOOST_TEST(to_span(target1_2) == to_array({0., 0., 0., 0., 0., 0., 4., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
508 BOOST_TEST(to_span(other1_1) == to_array({0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
509 BOOST_TEST(to_span(other1_2) == to_array({0., 0., 0., 0., 0., 0., 2., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
510
512
513 BOOST_TEST(target.size() == 2);
514 BOOST_TEST(other.size() == 2);
515
516 BOOST_TEST(to_span(target1_1) == to_array({0., 0., 0., 0., 0., 0., 3., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
517 BOOST_TEST(to_span(target1_2) == to_array({0., 0., 0., 0., 0., 0., 6., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
518 BOOST_TEST(to_span(other1_1) == to_array({0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
519 BOOST_TEST(to_span(other1_2) == to_array({0., 0., 0., 0., 0., 0., 2., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
520}
521
522BOOST_AUTO_TEST_CASE(TargetLonger, *boost::unit_test::tolerance(0.001))
523{
524 auto target1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max);
525 target1_1->Fill(5);
526 target1_1->Fill(5);
527
528 auto target1_2 = std::make_shared<TH1F>("histo 1-2", "histo 1-2", bins, min, max);
529 target1_2->Fill(5);
530 target1_2->Fill(5);
531 target1_2->Fill(5);
532 target1_2->Fill(5);
533
535
536 auto other1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max);
537 other1_1->Fill(5);
538
540
541 BOOST_TEST(target.size() == 2);
542 BOOST_TEST(other.size() == 1);
543
544 BOOST_TEST(to_span(target1_1) == to_array({0., 0., 0., 0., 0., 0., 2., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
545 BOOST_TEST(to_span(target1_2) == to_array({0., 0., 0., 0., 0., 0., 4., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
546 BOOST_TEST(to_span(other1_1) == to_array({0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
547
549
550 BOOST_TEST(target.size() == 2);
551 BOOST_TEST(other.size() == 1);
552
553 BOOST_TEST(to_span(target1_1) == to_array({0., 0., 0., 0., 0., 0., 3., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
554 BOOST_TEST(to_span(target1_2) == to_array({0., 0., 0., 0., 0., 0., 4., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
555 BOOST_TEST(to_span(other1_1) == to_array({0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
556}
557
558BOOST_AUTO_TEST_CASE(OtherLonger, *boost::unit_test::tolerance(0.001))
559{
560 auto target1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max);
561 target1_1->Fill(5);
562 target1_1->Fill(5);
563
564 VectorOfTObjectPtrs target{target1_1};
565
566 auto other1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max);
567 other1_1->Fill(5);
568
569 auto other1_2 = std::make_shared<TH1F>("histo 1-2", "histo 1-2", bins, min, max);
570 other1_2->Fill(5);
571 other1_2->Fill(5);
572
574
575 BOOST_TEST(target.size() == 1);
576 BOOST_TEST(other.size() == 2);
577
578 BOOST_TEST(std::string_view{target[0]->GetName()} == "histo 1-1");
579
580 BOOST_TEST(to_span(target1_1) == to_array({0., 0., 0., 0., 0., 0., 2., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
581 BOOST_TEST(to_span(other1_1) == to_array({0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
582 BOOST_TEST(to_span(other1_2) == to_array({0., 0., 0., 0., 0., 0., 2., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
583
585
586 BOOST_TEST(target.size() == 2);
587 BOOST_TEST(other.size() == 2);
588
589 BOOST_TEST(std::string_view{target[0]->GetName()} == "histo 1-1");
590 BOOST_TEST(std::string_view{target[1]->GetName()} == "histo 1-2");
591
592 BOOST_TEST(to_span(target1_1) == to_array({0., 0., 0., 0., 0., 0., 3., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
593 BOOST_TEST(to_span(other1_1) == to_array({0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
594 BOOST_TEST(to_span(other1_2) == to_array({0., 0., 0., 0., 0., 0., 2., 0., 0., 0., 0., 0.}), boost::test_tools::per_element());
595}
596
597BOOST_AUTO_TEST_SUITE_END()
std::vector< std::string > objects
An example of overriding O2 Mergers merging interface, v0.1.
An example of a custom TObject inheriting MergeInterface.
int32_t i
Algorithms for merging objects.
Definition of ObjectStore for Mergers, v0.1.
GLuint entry
Definition glcorearb.h:5735
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition glcorearb.h:5034
GLuint GLfloat GLfloat GLfloat x1
Definition glcorearb.h:5034
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLenum target
Definition glcorearb.h:1641
GLuint object
Definition glcorearb.h:4041
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
void merge(TObject *const target, TObject *const other)
A function which merges TObjects.
void deleteTCollections(TObject *obj)
std::vector< TObjectPtr > VectorOfTObjectPtrs
Definition ObjectStore.h:43
Defining DataPointCompositeObject explicitly as copiable.
gsl::span< T, N > to_array(T(&&arr)[N])
gsl::span< float > to_span(std::shared_ptr< TH1F > &histo)
BOOST_AUTO_TEST_CASE(MergerEmptyObjects)
auto collectUnderlyingObjects(TCanvas *canvas) -> std::vector< TObject * >
auto target1_2
VectorOfTObjectPtrs target
constexpr size_t min
TCanvas * createCanvas(std::string name, std::string title, std::vector< std::shared_ptr< TH1I > > &histograms)
constexpr size_t bins
constexpr size_t max
auto other1_1
BOOST_CHECK_NO_THROW(algorithm::merge(target, other))
auto other1_2
VectorOfTObjectPtrs other
BOOST_TEST(target.size()==2)
#define main
BOOST_CHECK(tree)
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())