ATLAS Offline Software
Typedefs | Functions | Variables
JetGroupProductTest.cxx File Reference
#include "CxxUtils/checker_macros.h"
#include "gtest/gtest.h"
#include "TrigHLTJetHypo/../src/JetGroupProduct.h"
#include "TrigHLTJetHypo/../src/DebugInfoCollector.h"
#include <vector>
#include <map>
Include dependency graph for JetGroupProductTest.cxx:

Go to the source code of this file.

Typedefs

using res = std::pair< std::vector< unsigned int >, bool >
 
using vec = std::vector< unsigned int >
 

Functions

 TEST (JetGroupProductTester, empty)
 
 TEST (JetGroupProductTester, onecondition)
 
 TEST (JetGroupProductTester, repeatedcond)
 
 TEST (JetGroupProductTester, twocond)
 
 TEST (JetGroupProductTester, reallife)
 

Variables

 ATLAS_NO_CHECK_FILE_THREAD_SAFETY
 

Typedef Documentation

◆ res

using res = std::pair<std::vector<unsigned int>, bool>

Definition at line 14 of file JetGroupProductTest.cxx.

◆ vec

using vec = std::vector<unsigned int>

Definition at line 15 of file JetGroupProductTest.cxx.

Function Documentation

◆ TEST() [1/5]

TEST ( JetGroupProductTester  ,
empty   
)

Definition at line 17 of file JetGroupProductTest.cxx.

17  {
18  std::vector<std::size_t> siblings;
19  CondInd2JetGroupsInds satisfiedBy;
20  std::vector<std::size_t> condMult;
21  JetGroupInd2ElemInds jg2elemjgs;
22 
23  JetGroupProduct jgp(siblings, satisfiedBy, condMult, jg2elemjgs);
24  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
25 
26  EXPECT_FALSE(jgp.valid());
27  EXPECT_TRUE((jgp.next(collector)).empty());
28 }

◆ TEST() [2/5]

TEST ( JetGroupProductTester  ,
onecondition   
)

Definition at line 31 of file JetGroupProductTest.cxx.

31  {
32  std::vector<std::size_t> siblings{1};
33 
34  CondInd2JetGroupsInds satisfiedBy;
35  satisfiedBy[0] = std::vector<std::size_t>();
36  satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
37 
38  std::vector<std::size_t> condMult{0, 1};
39 
40  JetGroupInd2ElemInds jg2elemjgs;
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};
44 
45  JetGroupProduct jgp(siblings, satisfiedBy, condMult, jg2elemjgs);
46 
47  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
48 
49  EXPECT_TRUE(jgp.valid());
50 
51  auto exp = std::vector<std::size_t>{0};
52  EXPECT_EQ(jgp.next(collector), exp);
53 
54  exp = std::vector<std::size_t>{1};
55  EXPECT_EQ(jgp.next(collector), exp);
56 
57  exp = std::vector<std::size_t>{2};
58  EXPECT_EQ(jgp.next(collector), exp);
59 
60  EXPECT_TRUE(jgp.next(collector).empty());
61 }

◆ TEST() [3/5]

TEST ( JetGroupProductTester  ,
reallife   
)

Definition at line 131 of file JetGroupProductTest.cxx.

131  {
132  std::vector<std::size_t> siblings{1, 2};
133 
134  CondInd2JetGroupsInds satisfiedBy;
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};
140 
141  std::vector<std::size_t> condMult{1, 1, 3};
142 
143  JetGroupInd2ElemInds jg2elemjgs;
144  for (const auto& i : satisfiedBy[2]){
145  jg2elemjgs[i] = std::vector<std::size_t> {i};
146  }
147  JetGroupProduct jgp(siblings, satisfiedBy, condMult, jg2elemjgs);
148 
149  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
150 
151  EXPECT_TRUE(jgp.valid());
152 
153  std::size_t ipass{0};
154 
155  while (true) {
156  auto indices = jgp.next(collector);
157  if (indices.empty()){break;}
158  ++ipass;
159  }
160 
161  // 2925 = 3*C(21,3) - overlaps and duplicates
162  EXPECT_EQ (ipass, 2925u);
163 
164 }

◆ TEST() [4/5]

TEST ( JetGroupProductTester  ,
repeatedcond   
)

Definition at line 63 of file JetGroupProductTest.cxx.

63  {
64  std::vector<std::size_t> siblings{1};
65 
66  CondInd2JetGroupsInds satisfiedBy;
67  satisfiedBy[0] = std::vector<std::size_t>();
68  satisfiedBy[1] = std::vector<std::size_t> {0, 1, 2};
69 
70  std::vector<std::size_t> condMult{1, 2};
71 
72  JetGroupInd2ElemInds jg2elemjgs;
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};
76 
77  JetGroupProduct jgp(siblings, satisfiedBy, condMult, jg2elemjgs);
78 
79  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
80 
81  EXPECT_TRUE(jgp.valid());
82 
83  auto exp = std::vector<std::size_t>{0, 1};
84  EXPECT_EQ(jgp.next(collector), exp);
85 
86  exp = std::vector<std::size_t>{0, 2};
87  EXPECT_EQ(jgp.next(collector), exp);
88 
89 
90  exp = std::vector<std::size_t>{1, 2};
91  EXPECT_EQ(jgp.next(collector), exp);
92 
93  EXPECT_TRUE(jgp.next(collector).empty());
94 }

◆ TEST() [5/5]

TEST ( JetGroupProductTester  ,
twocond   
)

Definition at line 96 of file JetGroupProductTest.cxx.

96  {
97  std::vector<std::size_t> siblings{1, 2};
98 
99  CondInd2JetGroupsInds satisfiedBy;
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};
103 
104  std::vector<std::size_t> condMult{1, 1, 1};
105 
106  JetGroupInd2ElemInds jg2elemjgs;
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};
110 
111  JetGroupProduct jgp(siblings, satisfiedBy, condMult, jg2elemjgs);
112 
113  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
114 
115  EXPECT_TRUE(jgp.valid());
116 
117  auto exp = std::vector<std::size_t>{0, 1};
118  EXPECT_EQ(jgp.next(collector), exp);
119 
120  exp = std::vector<std::size_t>{0, 2};
121  EXPECT_EQ(jgp.next(collector), exp);
122 
123  exp = std::vector<std::size_t>{1, 2};
124  EXPECT_EQ(jgp.next(collector), exp);
125 
126  EXPECT_TRUE(jgp.next(collector).empty());
127  if(collector) {collector->write();}
128 
129 }

Variable Documentation

◆ ATLAS_NO_CHECK_FILE_THREAD_SAFETY

ATLAS_NO_CHECK_FILE_THREAD_SAFETY

Definition at line 6 of file JetGroupProductTest.cxx.

CondInd2JetGroupsInds
std::map< int, std::vector< std::size_t > > CondInd2JetGroupsInds
Definition: JetGroupProduct.h:15
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
JetGroupProduct
Definition: JetGroupProduct.h:20
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
lumiFormat.i
int i
Definition: lumiFormat.py:85
JetGroupInd2ElemInds
std::map< int, std::vector< std::size_t > > JetGroupInd2ElemInds
Definition: elementalJetGroups.h:11