8 #include "gtest/gtest.h"
14 using res = std::pair<std::vector<unsigned int>,
bool>;
15 using vec = std::vector<unsigned int>;
17 TEST(JetGroupProductTester, empty) {
18 std::vector<std::size_t> siblings;
20 std::vector<std::size_t> condMult;
24 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
26 EXPECT_FALSE(jgp.
valid());
27 EXPECT_TRUE((jgp.
next(collector)).empty());
31 TEST(JetGroupProductTester, onecondition) {
32 std::vector<std::size_t> siblings{1};
35 satisfiedBy[0] = std::vector<std::size_t>();
36 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
38 std::vector<std::size_t> condMult{0, 1};
41 jg2elemjgs[0] = std::vector<std::size_t> {0};
42 jg2elemjgs[1] = std::vector<std::size_t> {1};
43 jg2elemjgs[2] = std::vector<std::size_t> {2};
47 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
49 EXPECT_TRUE(jgp.
valid());
51 auto exp = std::vector<std::size_t>{0};
52 EXPECT_EQ(jgp.
next(collector),
exp);
54 exp = std::vector<std::size_t>{1};
55 EXPECT_EQ(jgp.
next(collector),
exp);
57 exp = std::vector<std::size_t>{2};
58 EXPECT_EQ(jgp.
next(collector),
exp);
60 EXPECT_TRUE(jgp.
next(collector).empty());
63 TEST(JetGroupProductTester, repeatedcond) {
64 std::vector<std::size_t> siblings{1};
67 satisfiedBy[0] = std::vector<std::size_t>();
68 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
70 std::vector<std::size_t> condMult{1, 2};
73 jg2elemjgs[0] = std::vector<std::size_t> {0};
74 jg2elemjgs[1] = std::vector<std::size_t> {1};
75 jg2elemjgs[2] = std::vector<std::size_t> {2};
79 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
81 EXPECT_TRUE(jgp.
valid());
83 auto exp = std::vector<std::size_t>{0, 1};
84 EXPECT_EQ(jgp.
next(collector),
exp);
86 exp = std::vector<std::size_t>{0, 2};
87 EXPECT_EQ(jgp.
next(collector),
exp);
90 exp = std::vector<std::size_t>{1, 2};
91 EXPECT_EQ(jgp.
next(collector),
exp);
93 EXPECT_TRUE(jgp.
next(collector).empty());
96 TEST(JetGroupProductTester, twocond) {
97 std::vector<std::size_t> siblings{1, 2};
100 satisfiedBy[0] = std::vector<std::size_t>();
101 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
102 satisfiedBy[2] = std::vector<std::size_t> {0, 1, 2};
104 std::vector<std::size_t> condMult{1, 1, 1};
107 jg2elemjgs[0] = std::vector<std::size_t> {0};
108 jg2elemjgs[1] = std::vector<std::size_t> {1};
109 jg2elemjgs[2] = std::vector<std::size_t> {2};
113 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
115 EXPECT_TRUE(jgp.
valid());
117 auto exp = std::vector<std::size_t>{0, 1};
118 EXPECT_EQ(jgp.
next(collector),
exp);
120 exp = std::vector<std::size_t>{0, 2};
121 EXPECT_EQ(jgp.
next(collector),
exp);
123 exp = std::vector<std::size_t>{1, 2};
124 EXPECT_EQ(jgp.
next(collector),
exp);
126 EXPECT_TRUE(jgp.
next(collector).empty());
127 if(collector) {collector->write();}
131 TEST(JetGroupProductTester, reallife) {
132 std::vector<std::size_t> siblings{1, 2};
135 satisfiedBy[0] = std::vector<std::size_t>();
136 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
137 satisfiedBy[2] = std::vector<std::size_t> {
138 0, 1, 2, 3, 4, 6, 7, 9, 10, 11, 12, 13,
139 14, 15, 17, 19, 21, 25, 26, 29, 33};
141 std::vector<std::size_t> condMult{1, 1, 3};
144 for (
const auto&
i : satisfiedBy[2]){
145 jg2elemjgs[
i] = std::vector<std::size_t> {
i};
149 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
151 EXPECT_TRUE(jgp.
valid());
153 std::size_t ipass{0};
162 EXPECT_EQ (ipass, 2925
u);