Project
Loading...
Searching...
No Matches
testDigitMerging.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
12#define BOOST_TEST_MODULE Test MCHSimulation DigitMerging
13#define BOOST_TEST_DYN_LINK
14
15#include <boost/test/unit_test.hpp>
16
19#include "DigitMerging.h"
20#include "boost/format.hpp"
21#include <boost/test/data/test_case.hpp>
22#include <fstream>
23#include <iomanip>
24#include <iostream>
25
26using o2::mch::Digit;
27
28std::vector<Digit> createNonOverlappingDigits()
29{
30 return std::vector<Digit>{
31 {100, 2, 5, 0},
32 {100, 3, 6, 0},
33 {100, 1, 2, 0},
34 {100, 0, 1, 0}};
35}
36
37std::vector<o2::MCCompLabel> createLabelsNonOverlappingDigits()
38{
39 return std::vector<o2::MCCompLabel>{
40 {0, 0, 10, false},
41 {0, 0, 10, false},
42 {10, 0, 10, false},
43 {11, 0, 10, false}};
44}
45
46std::vector<Digit> createOverlappingDigits()
47{
48 return std::vector<Digit>{
49 {100, 2, 5, 0},
50 {100, 3, 6, 0},
51 {100, 1, 2, 0},
52 {100, 0, 0, 0},
53 {100, 0, 1, 0},
54 {100, 1, 3, 0},
55 {100, 3, 7, 0},
56 {100, 1, 4, 0}};
57}
58
59std::vector<o2::MCCompLabel> createLabelsOverlappingDigits()
60{
61 return std::vector<o2::MCCompLabel>{
62 {0, 0, 10, false},
63 {0, 0, 10, false},
64 {10, 0, 10, false},
65 {11, 0, 10, false},
66 {10, 0, 10, false},
67 {2, 0, 10, false},
68 {4, 0, 10, false},
69 {5, 0, 10, false},
70 {6, 0, 10, false}};
71}
72
73std::vector<Digit> expected()
74{
75 return std::vector<Digit>{
76 {100, 0, 1, 0},
77 {100, 1, 9, 0},
78 {100, 2, 5, 0},
79 {100, 3, 13, 0}};
80}
81
82std::vector<o2::MCCompLabel> labelexpected()
83{
84 return std::vector<o2::MCCompLabel>{
85 {0, 0, 10, false},
86 {0, 0, 10, false},
87 {10, 0, 10, false},
88 {11, 0, 10, false}};
89}
90
91BOOST_DATA_TEST_CASE(DigitMergingIdentity, boost::unit_test::data::make(mergingFunctions()), mergingFunction)
92{
94 auto e = m;
95 BOOST_CHECK(std::is_permutation(m.begin(), m.end(), e.begin()));
96}
97
98BOOST_DATA_TEST_CASE(DigitMerging, boost::unit_test::data::make(mergingFunctions()), mergingFunction)
99{
100 auto m = mergingFunction(createOverlappingDigits(), createLabelsOverlappingDigits());
101 BOOST_CHECK(std::is_permutation(m.begin(), m.end(), expected().begin()));
102}
std::vector< MergingFunctionType > mergingFunctions()
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
MCH digit implementation.
Definition Digit.h:31
const GLfloat * m
Definition glcorearb.h:4066
std::vector< o2::MCCompLabel > createLabelsNonOverlappingDigits()
std::vector< Digit > createOverlappingDigits()
BOOST_DATA_TEST_CASE(DigitMergingIdentity, boost::unit_test::data::make(mergingFunctions()), mergingFunction)
std::vector< Digit > createNonOverlappingDigits()
std::vector< Digit > expected()
std::vector< o2::MCCompLabel > labelexpected()
std::vector< o2::MCCompLabel > createLabelsOverlappingDigits()
BOOST_CHECK(tree)