Project
Loading...
Searching...
No Matches
test_Algorithm.cxx File Reference

A unit test of mergers. More...

#include <gsl/span>
#include <memory>
#include <stdexcept>
#include <boost/test/unit_test.hpp>
#include "Mergers/MergerAlgorithm.h"
#include "Mergers/CustomMergeableTObject.h"
#include "Mergers/CustomMergeableObject.h"
#include "Mergers/Mergeable.h"
#include "Mergers/ObjectStore.h"
#include <TObjArray.h>
#include <TObjString.h>
#include <TH1.h>
#include <TH2.h>
#include <TH3.h>
#include <THn.h>
#include <TTree.h>
#include <THnSparse.h>
#include <TF1.h>
#include <TGraph.h>
#include <TProfile.h>
#include <TCanvas.h>
#include <TPaveText.h>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   Test Utilities MergerAlgorithm
 
#define BOOST_TEST_MAIN
 
#define BOOST_TEST_DYN_LINK
 

Functions

 BOOST_AUTO_TEST_CASE (MergerEmptyObjects)
 
 BOOST_AUTO_TEST_CASE (MergerNotSupportedTObject)
 
 BOOST_AUTO_TEST_CASE (MergerTheSameObject)
 
 BOOST_AUTO_TEST_CASE (MergerSingularObjects)
 
 BOOST_AUTO_TEST_CASE (MergerCollection)
 
TCanvas * createCanvas (std::string name, std::string title, std::vector< std::shared_ptr< TH1I > > &histograms)
 
auto collectUnderlyingObjects (TCanvas *canvas) -> std::vector< TObject * >
 
 BOOST_AUTO_TEST_CASE (MergerTCanvas)
 
 BOOST_AUTO_TEST_CASE (Deleting)
 
 BOOST_AUTO_TEST_CASE (AverageHisto)
 
gsl::span< float > to_span (std::shared_ptr< TH1F > &histo)
 
template<typename T , std::size_t N>
gsl::span< T, N > to_array (T(&&arr)[N])
 
target1_1 Fill (5)
 
 BOOST_TEST (target.size()==2)
 
 BOOST_TEST (other.size()==2)
 
 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())
 
 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())
 
 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())
 
 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())
 
 BOOST_CHECK_NO_THROW (algorithm::merge(target, other))
 
 BOOST_TEST (std::string_view{target[0]->GetName()}=="histo 1-1")
 
 BOOST_TEST (std::string_view{target[1]->GetName()}=="histo 1-2")
 

Variables

constexpr size_t bins = 10
 
constexpr size_t min = 0
 
constexpr size_t max = 10
 
auto target1_2 = std::make_shared<TH1F>("histo 1-2", "histo 1-2", bins, min, max)
 
VectorOfTObjectPtrs target {target1_1, target1_2}
 
auto other1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max)
 
auto other1_2 = std::make_shared<TH1F>("histo 1-2", "histo 1-2", bins, min, max)
 
VectorOfTObjectPtrs other {other1_1, other1_2}
 

Detailed Description

A unit test of mergers.

Author
Piotr Konopka, piotr.nosp@m..jan.nosp@m..kono.nosp@m.pka@.nosp@m.cern..nosp@m.ch

Definition in file test_Algorithm.cxx.

Macro Definition Documentation

◆ BOOST_TEST_DYN_LINK

#define BOOST_TEST_DYN_LINK

Definition at line 22 of file test_Algorithm.cxx.

◆ BOOST_TEST_MAIN

#define BOOST_TEST_MAIN

Definition at line 21 of file test_Algorithm.cxx.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   Test Utilities MergerAlgorithm

Definition at line 20 of file test_Algorithm.cxx.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/8]

BOOST_AUTO_TEST_CASE ( AverageHisto  )

Definition at line 474 of file test_Algorithm.cxx.

◆ BOOST_AUTO_TEST_CASE() [2/8]

BOOST_AUTO_TEST_CASE ( Deleting  )

Definition at line 444 of file test_Algorithm.cxx.

◆ BOOST_AUTO_TEST_CASE() [3/8]

BOOST_AUTO_TEST_CASE ( MergerCollection  )

Definition at line 273 of file test_Algorithm.cxx.

◆ BOOST_AUTO_TEST_CASE() [4/8]

BOOST_AUTO_TEST_CASE ( MergerEmptyObjects  )

Definition at line 53 of file test_Algorithm.cxx.

◆ BOOST_AUTO_TEST_CASE() [5/8]

BOOST_AUTO_TEST_CASE ( MergerNotSupportedTObject  )

Definition at line 69 of file test_Algorithm.cxx.

◆ BOOST_AUTO_TEST_CASE() [6/8]

BOOST_AUTO_TEST_CASE ( MergerSingularObjects  )

Definition at line 86 of file test_Algorithm.cxx.

◆ BOOST_AUTO_TEST_CASE() [7/8]

BOOST_AUTO_TEST_CASE ( MergerTCanvas  )

Definition at line 368 of file test_Algorithm.cxx.

◆ BOOST_AUTO_TEST_CASE() [8/8]

BOOST_AUTO_TEST_CASE ( MergerTheSameObject  )

Definition at line 79 of file test_Algorithm.cxx.

◆ BOOST_CHECK_NO_THROW()

BOOST_CHECK_NO_THROW ( algorithm::merge(target, other)  )

◆ BOOST_TEST() [1/8]

BOOST_TEST ( other.  size() = =2)

◆ BOOST_TEST() [2/8]

BOOST_TEST ( std::string_view{target[0]->GetName()}  = ="histo 1-1")

◆ BOOST_TEST() [3/8]

BOOST_TEST ( std::string_view{target[1]->GetName()}  = ="histo 1-2")

◆ BOOST_TEST() [4/8]

BOOST_TEST ( target.  size() = =2)

◆ BOOST_TEST() [5/8]

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()   
)

◆ BOOST_TEST() [6/8]

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()   
)

◆ BOOST_TEST() [7/8]

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()   
)

◆ BOOST_TEST() [8/8]

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()   
)

◆ collectUnderlyingObjects()

auto collectUnderlyingObjects ( TCanvas *  canvas) -> std::vector<TObject*>

Definition at line 345 of file test_Algorithm.cxx.

◆ createCanvas()

TCanvas * createCanvas ( std::string  name,
std::string  title,
std::vector< std::shared_ptr< TH1I > > &  histograms 
)

Definition at line 327 of file test_Algorithm.cxx.

◆ Fill()

other1_2 Fill ( 5  )
Initial value:
{
auto target1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max)
constexpr size_t min
constexpr size_t bins
constexpr size_t max

◆ to_array()

template<typename T , std::size_t N>
gsl::span< T, N > to_array ( T(&&)  arr[N])

Definition at line 499 of file test_Algorithm.cxx.

◆ to_span()

gsl::span< float > to_span ( std::shared_ptr< TH1F > &  histo)

Definition at line 493 of file test_Algorithm.cxx.

Variable Documentation

◆ bins

constexpr size_t bins = 10
constexpr

Definition at line 49 of file test_Algorithm.cxx.

◆ max

constexpr size_t max = 10
constexpr

Definition at line 51 of file test_Algorithm.cxx.

◆ min

configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti min = 0
constexpr

Definition at line 50 of file test_Algorithm.cxx.

◆ other

◆ other1_1

auto other1_1 = std::make_shared<TH1F>("histo 1-1", "histo 1-1", bins, min, max)

Definition at line 518 of file test_Algorithm.cxx.

◆ other1_2

auto other1_2 = std::make_shared<TH1F>("histo 1-2", "histo 1-2", bins, min, max)

Definition at line 521 of file test_Algorithm.cxx.

◆ target

Definition at line 516 of file test_Algorithm.cxx.

◆ target1_2

auto target1_2 = std::make_shared<TH1F>("histo 1-2", "histo 1-2", bins, min, max)

Definition at line 510 of file test_Algorithm.cxx.