8 #include "gtest/gtest.h"
12 using vec = std::vector<std::size_t>;
14 TEST(JetGroupProductFactoryTester, nosiblings) {
15 std::vector<std::size_t> siblings{};
18 satisfiedBy[0] = std::vector<std::size_t>();
20 std::vector<std::size_t> condMult{1};
21 std::vector<unsigned int> condCap{0};
22 std::vector<int> condClique{1};
26 std::size_t parCapacity{0};
28 bool simpleTree{
true};
29 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
41 EXPECT_TRUE(jgp !=
nullptr);
42 EXPECT_TRUE(jgp->valid());
43 EXPECT_TRUE(jgp->next(collector).empty());
51 TEST(JetGroupProductFactoryTester, one_clique_fail) {
52 std::vector<std::size_t> siblings{1, 2};
55 satisfiedBy[0] = std::vector<std::size_t> {};
56 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
57 satisfiedBy[2] = std::vector<std::size_t> {0, 1, 2};
59 std::vector<std::size_t> condMult{1
u, 5
u, 1
u};
60 std::vector<unsigned int> condCap{0, 1, 1};
61 std::vector<int> condClique{-1, 0, 0};
64 jg2elemjgs[0] = std::vector<std::size_t> {0};
65 jg2elemjgs[1] = std::vector<std::size_t> {1};
66 jg2elemjgs[2] = std::vector<std::size_t> {2};
68 std::size_t parCapacity{0};
69 bool simpleTree{
true};
71 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
84 EXPECT_TRUE(jgp !=
nullptr);
85 EXPECT_TRUE(jgp->valid());
87 EXPECT_TRUE(jgp->next(collector).empty());
88 EXPECT_TRUE(jgp->next(collector).empty());
91 TEST(JetGroupProductFactoryTester, one_clique_pass) {
92 std::vector<std::size_t> siblings{1, 2};
97 satisfiedBy[0] = std::vector<std::size_t> {};
98 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2, 3, 4, 5};
99 satisfiedBy[2] = std::vector<std::size_t> {0, 1, 2, 3, 4, 5};
101 std::vector<std::size_t> condMult{1
u, 5
u, 1
u};
102 std::vector<unsigned int> condCap{0, 1, 1};
103 std::vector<int> condClique{-1, 0, 0};
106 jg2elemjgs[0] = std::vector<std::size_t> {0};
107 jg2elemjgs[1] = std::vector<std::size_t> {1};
108 jg2elemjgs[2] = std::vector<std::size_t> {2};
109 jg2elemjgs[3] = std::vector<std::size_t> {3};
110 jg2elemjgs[4] = std::vector<std::size_t> {4};
111 jg2elemjgs[5] = std::vector<std::size_t> {5};
114 std::size_t parCapacity{0};
115 bool simpleTree{
true};
117 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
129 EXPECT_TRUE(jgp !=
nullptr);
130 EXPECT_TRUE(jgp->valid());
133 EXPECT_EQ(jgp->next(collector), exp0);
134 EXPECT_TRUE(jgp->next(collector).empty());
135 EXPECT_TRUE(jgp->next(collector).empty());
138 TEST(JetGroupProductFactoryTester, njets_eq_nsiblings) {
139 std::vector<std::size_t> siblings{1, 2};
144 satisfiedBy[0] = std::vector<std::size_t> {};
145 satisfiedBy[1] = std::vector<std::size_t> {0,1};
146 satisfiedBy[2] = std::vector<std::size_t> {0,1};
148 std::vector<std::size_t> condMult{1
u, 1
u, 1
u};
149 std::vector<unsigned int> condCap{0, 1, 1};
150 std::vector<int> condClique{-1, 0, 1};
153 jg2elemjgs[0] = std::vector<std::size_t> {0};
154 jg2elemjgs[1] = std::vector<std::size_t> {1};
156 std::size_t parCapacity{0};
157 bool simpleTree{
true};
159 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
172 EXPECT_TRUE(jgp !=
nullptr);
173 EXPECT_TRUE(jgp->valid());
176 EXPECT_EQ(jgp->next(collector), exp0);
177 EXPECT_TRUE(jgp->next(collector).empty());
178 EXPECT_TRUE(jgp->next(collector).empty());
184 TEST(JetGroupProductFactoryTester, 3siblings_3jets_pass) {
185 std::vector<std::size_t> siblings{1, 2, 3};
188 satisfiedBy[0] = std::vector<std::size_t> {};
189 satisfiedBy[1] = std::vector<std::size_t> {0,1,2};
190 satisfiedBy[2] = std::vector<std::size_t> {0};
191 satisfiedBy[3] = std::vector<std::size_t> {1};
193 std::vector<std::size_t> condMult{1
u, 1
u, 1
u, 1
u};
194 std::vector<unsigned int> condCap{0, 1, 1, 1};
195 std::vector<int> condClique{-1, 0, 1, 2};
198 jg2elemjgs[0] = std::vector<std::size_t> {0};
199 jg2elemjgs[1] = std::vector<std::size_t> {1};
200 jg2elemjgs[2] = std::vector<std::size_t> {2};
202 std::size_t parCapacity{0};
203 bool simpleTree{
true};
205 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
216 EXPECT_TRUE(jgp !=
nullptr);
217 EXPECT_TRUE(jgp->valid());
220 EXPECT_EQ(jgp->next(collector), exp0);
221 EXPECT_TRUE(jgp->next(collector).empty());
222 EXPECT_TRUE(jgp->next(collector).empty());
225 TEST(JetGroupProductFactoryTester, 3siblings_3jets_fail) {
226 std::vector<std::size_t> siblings{1, 2, 3};
230 satisfiedBy[0] = std::vector<std::size_t> {};
231 satisfiedBy[1] = std::vector<std::size_t> {0,1,2};
232 satisfiedBy[2] = std::vector<std::size_t> {1};
233 satisfiedBy[3] = std::vector<std::size_t> {1};
235 std::vector<std::size_t> condMult{1
u, 1
u, 1
u, 1
u};
236 std::vector<unsigned int> condCap{0, 1, 1, 1};
237 std::vector<int> condClique{-1, 0, 1, 2};
240 jg2elemjgs[0] = std::vector<std::size_t> {0};
241 jg2elemjgs[1] = std::vector<std::size_t> {1};
242 jg2elemjgs[2] = std::vector<std::size_t> {2};
244 std::size_t parCapacity{0};
245 bool simpleTree{
true};
247 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
258 EXPECT_TRUE(jgp !=
nullptr);
259 EXPECT_TRUE(jgp->valid());
261 EXPECT_TRUE(jgp->next(collector).empty());
262 EXPECT_TRUE(jgp->next(collector).empty());
268 TEST(JetGroupProductFactoryTester, dijet_jets_overlap) {
269 std::vector<std::size_t> siblings{1, 2};
273 satisfiedBy[0] = std::vector<std::size_t> {};
274 satisfiedBy[1] = std::vector<std::size_t> {0, 1};
275 satisfiedBy[2] = std::vector<std::size_t> {0, 1};
277 std::vector<std::size_t> condMult{1
u, 1
u, 1
u};
278 std::vector<unsigned int> condCap{2, 1, 1};
279 std::vector<int> condClique{-1, 0, 0};
282 jg2elemjgs[0] = std::vector<std::size_t> {0};
283 jg2elemjgs[1] = std::vector<std::size_t> {1};
285 std::size_t parCapacity{2};
286 bool simpleTree{
false};
288 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
300 EXPECT_TRUE(jgp !=
nullptr);
301 EXPECT_TRUE(jgp->valid());
304 EXPECT_EQ(jgp->next(collector),
e0);
306 EXPECT_TRUE(jgp->next(collector).empty());
307 EXPECT_TRUE(jgp->next(collector).empty());
310 TEST(JetGroupProductFactoryTester, dijet_jets_no_overlap) {
311 std::vector<std::size_t> siblings{1, 2};
315 satisfiedBy[0] = std::vector<std::size_t> {};
316 satisfiedBy[1] = std::vector<std::size_t> {0, 1};
317 satisfiedBy[2] = std::vector<std::size_t> {2, 3};
319 std::vector<std::size_t> condMult{1
u, 1
u, 1
u};
320 std::vector<unsigned int> condCap{2, 1, 1};
321 std::vector<int> condClique{-1, 0, 0};
324 jg2elemjgs[0] = std::vector<std::size_t> {0};
325 jg2elemjgs[1] = std::vector<std::size_t> {1};
326 jg2elemjgs[2] = std::vector<std::size_t> {2};
327 jg2elemjgs[3] = std::vector<std::size_t> {3};
329 std::size_t parCapacity{2};
330 bool simpleTree{
false};
332 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
343 EXPECT_TRUE(jgp !=
nullptr);
344 EXPECT_TRUE(jgp->valid());
350 EXPECT_EQ(jgp->next(collector),
e0);
351 EXPECT_EQ(jgp->next(collector),
e1);
352 EXPECT_EQ(jgp->next(collector),
e2);
353 EXPECT_EQ(jgp->next(collector),
e3);
354 EXPECT_TRUE(jgp->next(collector).empty());
355 EXPECT_TRUE(jgp->next(collector).empty());
359 TEST(JetGroupProductFactoryTester, dijet_jets_some_overlap) {
360 std::vector<std::size_t> siblings{1, 2};
363 satisfiedBy[0] = std::vector<std::size_t> {};
364 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
365 satisfiedBy[2] = std::vector<std::size_t> {2, 3, 4};
367 std::vector<std::size_t> condMult{1
u, 1
u, 1
u};
368 std::vector<unsigned int> condCap{2, 1, 1};
369 std::vector<int> condClique{-1, 0, 0};
372 jg2elemjgs[0] = std::vector<std::size_t> {0};
373 jg2elemjgs[1] = std::vector<std::size_t> {1};
374 jg2elemjgs[2] = std::vector<std::size_t> {2};
375 jg2elemjgs[3] = std::vector<std::size_t> {3};
376 jg2elemjgs[4] = std::vector<std::size_t> {4};
378 std::size_t parCapacity{2};
379 bool simpleTree{
false};
381 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
392 EXPECT_TRUE(jgp !=
nullptr);
393 EXPECT_TRUE(jgp->valid());
404 EXPECT_EQ(jgp->next(collector),
e0);
405 EXPECT_EQ(jgp->next(collector),
e1);
406 EXPECT_EQ(jgp->next(collector),
e2);
407 EXPECT_EQ(jgp->next(collector),
e3);
408 EXPECT_EQ(jgp->next(collector),
e4);
409 EXPECT_EQ(jgp->next(collector), e5);
410 EXPECT_EQ(jgp->next(collector), e6);
411 EXPECT_EQ(jgp->next(collector), e7);
413 EXPECT_TRUE(jgp->next(collector).empty());
414 EXPECT_TRUE(jgp->next(collector).empty());
419 TEST(JetGroupProductFactoryTester, max_jet_0) {
421 satisfiedBy[0] = std::vector<std::size_t> {};
422 satisfiedBy[1] = std::vector<std::size_t> {0};
423 satisfiedBy[2] = std::vector<std::size_t> {0};
425 std::vector<std::size_t> siblings{1, 2};
427 EXPECT_EQ(0
u,
max_jet(siblings, satisfiedBy));
430 TEST(JetGroupProductFactoryTester, max_jet_1) {
432 satisfiedBy[0] = std::vector<std::size_t> {};
433 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
434 satisfiedBy[2] = std::vector<std::size_t> {2, 3, 4};
436 std::vector<std::size_t> siblings{1, 2};
438 EXPECT_EQ(4
u,
max_jet(siblings, satisfiedBy));
442 TEST(JetGroupProductFactoryTester, willpass_fail_0) {
444 satisfiedBy[0] = std::vector<std::size_t> {};
445 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
446 satisfiedBy[2] = std::vector<std::size_t> {1};
447 satisfiedBy[3] = std::vector<std::size_t> {1};
449 std::vector<std::size_t> condMult{1, 1, 1, 1};
451 std::vector<std::size_t> siblings{1, 2, 3};
456 TEST(JetGroupProductFactoryTester, willpass_fail_1) {
458 satisfiedBy[0] = std::vector<std::size_t> {};
459 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
460 satisfiedBy[2] = std::vector<std::size_t> {2};
461 satisfiedBy[3] = std::vector<std::size_t> {1};
463 std::vector<std::size_t> condMult{1, 2, 1, 1};
465 std::vector<std::size_t> siblings{1, 2, 3};
471 TEST(JetGroupProductFactoryTester, willpass_fail_2) {
473 satisfiedBy[0] = std::vector<std::size_t> {};
474 satisfiedBy[1] = std::vector<std::size_t> {};
475 satisfiedBy[2] = std::vector<std::size_t> {};
476 satisfiedBy[3] = std::vector<std::size_t> {};
478 std::vector<std::size_t> condMult{1, 2, 1, 1};
480 std::vector<std::size_t> siblings{1, 2, 3};
485 TEST(JetGroupProductFactoryTester, willpass_pass_0) {
487 satisfiedBy[0] = std::vector<std::size_t> {};
488 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
489 satisfiedBy[2] = std::vector<std::size_t> {2};
490 satisfiedBy[3] = std::vector<std::size_t> {1};
492 std::vector<std::size_t> condMult{1, 1, 1, 1};
494 std::vector<std::size_t> siblings{1, 2, 3};
499 TEST(JetGroupProductFactoryTester, willpass_pass_1) {
501 satisfiedBy[0] = std::vector<std::size_t> {};
502 satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2, 3};
503 satisfiedBy[2] = std::vector<std::size_t> {0, 1, 2};
505 std::vector<std::size_t> condMult{1, 2, 2};
507 std::vector<std::size_t> siblings{1, 2};