Belle II Software development
tools.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <vector>
12
13namespace Belle2 {
18 namespace ECL {
19
21 template<typename T>
22 inline std::vector<std::vector<T>> create2Dvector(unsigned int n1, unsigned int n2)
23 {
24 std::vector<std::vector<T>> vec(n1);
25 for (auto& v2 : vec) v2.resize(n2);
26 return vec;
27 }
28
29
31 template<typename T>
32 inline std::vector<std::vector<std::vector<T>>> create3Dvector(unsigned int n1, unsigned int n2, unsigned int n3)
33 {
34 std::vector<std::vector<std::vector<T>>> vec(n1);
35 for (auto& v2 : vec) {
36 v2.resize(n2);
37 for (auto& v3 : v2)
38 v3.resize(n3);
39 }
40 return vec;
41 }
42
43
45 template<typename T>
46 inline std::vector<std::vector<std::vector<std::vector<T>>>> create4Dvector(unsigned int n1, unsigned int n2, unsigned int n3,
47 unsigned int n4)
48 {
49 std::vector<std::vector<std::vector<std::vector<T>>>> vec(n1);
50 for (auto& v2 : vec) {
51 v2.resize(n2);
52 for (auto& v3 : v2) {
53 v3.resize(n3);
54 for (auto& v4 : v3)
55 v4.resize(n4);
56 }
57 }
58 return vec;
59 }
60
61
62 }
64} // namespace Belle2
Abstract base class for different kinds of events.
const std::vector< double > v3
MATLAB generated random vector.
const std::vector< double > v2
MATLAB generated random vector.