ATLAS Offline Software
Typedefs | Functions | Variables
JetGroupReducerTest.cxx File Reference
#include "CxxUtils/checker_macros.h"
#include "gtest/gtest.h"
#include "TrigHLTJetHypo/../src/JetGroupReducer.h"
#include <vector>
#include <map>
Include dependency graph for JetGroupReducerTest.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 (JetGroupReducerTester, empty)
 
 TEST (JetGroupReducerTester, emptyCondition)
 
 TEST (JetGroupReducerTester, one_condition_elem)
 
 TEST (JetGroupReducerTester, one_condition_non_elem)
 
 TEST (JetGroupReducerTester, two_conditions_nooverlap_elem_elem)
 
 TEST (JetGroupReducerTester, two_conditions_nooverlap_elem_non_elem)
 
 TEST (JetGroupReducerTester, two_conditions_overlap_elem_non_elem)
 
 TEST (JetGroupReducerTester, two_conditions_no_overlap_non_elem_non_elem)
 
 TEST (JetGroupReducerTester, two_conditions_overlap_non_elem_non_elem)
 

Variables

 ATLAS_NO_CHECK_FILE_THREAD_SAFETY
 

Typedef Documentation

◆ res

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

Definition at line 13 of file JetGroupReducerTest.cxx.

◆ vec

using vec = std::vector<unsigned int>

Definition at line 14 of file JetGroupReducerTest.cxx.

Function Documentation

◆ TEST() [1/9]

TEST ( JetGroupReducerTester  ,
empty   
)

Definition at line 16 of file JetGroupReducerTest.cxx.

16  {
17  std::vector<std::size_t> siblings;
18  CondInd2JetGroupsInds satisfiedBy;
19  JetGroupInd2ElemInds jg2elem;
20 
21  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
22 
23  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
24 
25  EXPECT_TRUE(jgr.valid());
26  EXPECT_TRUE(jgr.next(collector).empty());
27 }

◆ TEST() [2/9]

TEST ( JetGroupReducerTester  ,
emptyCondition   
)

Definition at line 29 of file JetGroupReducerTest.cxx.

29  {
30  std::vector<std::size_t> siblings{1, 2, 3};
31  CondInd2JetGroupsInds satisfiedBy;
32  satisfiedBy[0] = std::vector<std::size_t> {0, 1, 2};
33  satisfiedBy[1] = std::vector<std::size_t> {};
34  satisfiedBy[2] = std::vector<std::size_t> {3, 4, 5};
35  JetGroupInd2ElemInds jg2elem;
36 
37 
38 
39  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
40 
41  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
42 
43  EXPECT_TRUE(jgr.valid());
44  EXPECT_TRUE(jgr.next(collector).empty());
45 }

◆ TEST() [3/9]

TEST ( JetGroupReducerTester  ,
one_condition_elem   
)

Definition at line 48 of file JetGroupReducerTest.cxx.

48  {
49 
50  // condition is satisfied by an elementary jet group
51  std::vector<std::size_t> siblings{1};
52 
53  CondInd2JetGroupsInds satisfiedBy;
54  satisfiedBy[1] = std::vector<std::size_t> {0};
55  JetGroupInd2ElemInds jg2elem;
56  jg2elem[0] = std::vector<std::size_t> {0};
57  jg2elem[1] = std::vector<std::size_t> {1};
58  jg2elem[2] = std::vector<std::size_t> {0, 1};
59 
60 
61  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
62 
63  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
64 
65  auto exp = std::vector<std::size_t>{0};
66  EXPECT_EQ(jgr.next(collector), exp);
67  EXPECT_TRUE(jgr.next(collector).empty());
68 }

◆ TEST() [4/9]

TEST ( JetGroupReducerTester  ,
one_condition_non_elem   
)

Definition at line 71 of file JetGroupReducerTest.cxx.

71  {
72 
73  // condition is satisfied by an non-elementary jet group
74  std::vector<std::size_t> siblings{1};
75 
76  CondInd2JetGroupsInds satisfiedBy;
77  satisfiedBy[1] = std::vector<std::size_t> {2};
78  JetGroupInd2ElemInds jg2elem;
79  jg2elem[0] = std::vector<std::size_t> {0};
80  jg2elem[1] = std::vector<std::size_t> {1};
81  jg2elem[2] = std::vector<std::size_t> {0, 1};
82 
83 
84  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
85 
86  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
87 
88  auto exp = std::vector<std::size_t>{0, 1};
89  EXPECT_EQ(jgr.next(collector), exp);
90  EXPECT_TRUE(jgr.next(collector).empty());
91 }

◆ TEST() [5/9]

TEST ( JetGroupReducerTester  ,
two_conditions_no_overlap_non_elem_non_elem   
)

Definition at line 177 of file JetGroupReducerTest.cxx.

177  {
178  std::vector<std::size_t> siblings{1, 2};
179 
180  CondInd2JetGroupsInds satisfiedBy;
181  satisfiedBy[1] = std::vector<std::size_t> {6, 7};
182  satisfiedBy[2] = std::vector<std::size_t> {8};
183  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
184 
185  JetGroupInd2ElemInds jg2elem;
186 
187  jg2elem[0] = std::vector<std::size_t> {0};
188  jg2elem[1] = std::vector<std::size_t> {1};
189  jg2elem[2] = std::vector<std::size_t> {2};
190  jg2elem[3] = std::vector<std::size_t> {3};
191  jg2elem[4] = std::vector<std::size_t> {4};
192  jg2elem[5] = std::vector<std::size_t> {5};
193  jg2elem[6] = std::vector<std::size_t> {0, 1};
194  jg2elem[7] = std::vector<std::size_t> {2, 3};
195  jg2elem[8] = std::vector<std::size_t> {4, 5};
196 
197 
198  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
199 
200  auto exp = std::vector<std::size_t>{0, 1, 2, 3, 4, 5};
201  EXPECT_EQ(jgr.next(collector), exp);
202  EXPECT_TRUE(jgr.next(collector).empty());
203 }

◆ TEST() [6/9]

TEST ( JetGroupReducerTester  ,
two_conditions_nooverlap_elem_elem   
)

Definition at line 93 of file JetGroupReducerTest.cxx.

93  {
94  std::vector<std::size_t> siblings{1, 2};
95 
96  CondInd2JetGroupsInds satisfiedBy;
97  satisfiedBy[1] = std::vector<std::size_t> {0, 1};
98  satisfiedBy[2] = std::vector<std::size_t> {2};
99  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
100 
101  JetGroupInd2ElemInds jg2elem;
102 
103  jg2elem[0] = std::vector<std::size_t> {0};
104  jg2elem[1] = std::vector<std::size_t> {1};
105  jg2elem[2] = std::vector<std::size_t> {2};
106  jg2elem[3] = std::vector<std::size_t> {3};
107  jg2elem[4] = std::vector<std::size_t> {4};
108  jg2elem[5] = std::vector<std::size_t> {5};
109  jg2elem[6] = std::vector<std::size_t> {0, 1};
110  jg2elem[7] = std::vector<std::size_t> {2, 3};
111  jg2elem[8] = std::vector<std::size_t> {4, 5};
112 
113 
114  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
115 
116  auto exp = std::vector<std::size_t>{0, 1, 2};
117  EXPECT_EQ(jgr.next(collector), exp);
118  EXPECT_TRUE(jgr.next(collector).empty());
119 }

◆ TEST() [7/9]

TEST ( JetGroupReducerTester  ,
two_conditions_nooverlap_elem_non_elem   
)

Definition at line 121 of file JetGroupReducerTest.cxx.

121  {
122  std::vector<std::size_t> siblings{1, 2};
123 
124  CondInd2JetGroupsInds satisfiedBy;
125  satisfiedBy[1] = std::vector<std::size_t> {0, 1};
126  satisfiedBy[2] = std::vector<std::size_t> {7};
127  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
128 
129  JetGroupInd2ElemInds jg2elem;
130 
131  jg2elem[0] = std::vector<std::size_t> {0};
132  jg2elem[1] = std::vector<std::size_t> {1};
133  jg2elem[2] = std::vector<std::size_t> {2};
134  jg2elem[3] = std::vector<std::size_t> {3};
135  jg2elem[4] = std::vector<std::size_t> {4};
136  jg2elem[5] = std::vector<std::size_t> {5};
137  jg2elem[6] = std::vector<std::size_t> {0, 1};
138  jg2elem[7] = std::vector<std::size_t> {2, 3};
139  jg2elem[8] = std::vector<std::size_t> {4, 5};
140 
141 
142  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
143 
144  auto exp = std::vector<std::size_t>{0, 1, 2, 3};
145  EXPECT_EQ(jgr.next(collector), exp);
146  EXPECT_TRUE(jgr.next(collector).empty());
147 }

◆ TEST() [8/9]

TEST ( JetGroupReducerTester  ,
two_conditions_overlap_elem_non_elem   
)

Definition at line 149 of file JetGroupReducerTest.cxx.

149  {
150  std::vector<std::size_t> siblings{1, 2};
151 
152  CondInd2JetGroupsInds satisfiedBy;
153  satisfiedBy[1] = std::vector<std::size_t> {0, 1};
154  satisfiedBy[2] = std::vector<std::size_t> {6};
155  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
156 
157  JetGroupInd2ElemInds jg2elem;
158 
159  jg2elem[0] = std::vector<std::size_t> {0};
160  jg2elem[1] = std::vector<std::size_t> {1};
161  jg2elem[2] = std::vector<std::size_t> {2};
162  jg2elem[3] = std::vector<std::size_t> {3};
163  jg2elem[4] = std::vector<std::size_t> {4};
164  jg2elem[5] = std::vector<std::size_t> {5};
165  jg2elem[6] = std::vector<std::size_t> {0, 1};
166  jg2elem[7] = std::vector<std::size_t> {2, 3};
167  jg2elem[8] = std::vector<std::size_t> {4, 5};
168 
169 
170  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
171 
172  auto exp = std::vector<std::size_t>{0, 1};
173  EXPECT_EQ(jgr.next(collector), exp);
174  EXPECT_TRUE(jgr.next(collector).empty());
175 }

◆ TEST() [9/9]

TEST ( JetGroupReducerTester  ,
two_conditions_overlap_non_elem_non_elem   
)

Definition at line 205 of file JetGroupReducerTest.cxx.

205  {
206  std::vector<std::size_t> siblings{1, 2};
207 
208  CondInd2JetGroupsInds satisfiedBy;
209  satisfiedBy[1] = std::vector<std::size_t> {6, 7};
210  satisfiedBy[2] = std::vector<std::size_t> {9};
211  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
212 
213  JetGroupInd2ElemInds jg2elem;
214 
215  jg2elem[0] = std::vector<std::size_t> {0};
216  jg2elem[1] = std::vector<std::size_t> {1};
217  jg2elem[2] = std::vector<std::size_t> {2};
218  jg2elem[3] = std::vector<std::size_t> {3};
219  jg2elem[4] = std::vector<std::size_t> {4};
220  jg2elem[5] = std::vector<std::size_t> {5};
221  jg2elem[6] = std::vector<std::size_t> {0, 1};
222  jg2elem[7] = std::vector<std::size_t> {2, 3};
223  jg2elem[8] = std::vector<std::size_t> {4, 5};
224  jg2elem[9] = std::vector<std::size_t> {1, 5};
225 
226 
227  JetGroupReducer jgr(siblings, satisfiedBy, jg2elem);
228 
229  auto exp = std::vector<std::size_t>{0, 1, 2, 3, 5};
230  EXPECT_EQ(jgr.next(collector), exp);
231  EXPECT_TRUE(jgr.next(collector).empty());
232 }

Variable Documentation

◆ ATLAS_NO_CHECK_FILE_THREAD_SAFETY

ATLAS_NO_CHECK_FILE_THREAD_SAFETY

Definition at line 6 of file JetGroupReducerTest.cxx.

CondInd2JetGroupsInds
std::map< int, std::vector< std::size_t > > CondInd2JetGroupsInds
Definition: JetGroupProduct.h:15
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
JetGroupReducer
Definition: JetGroupReducer.h:29
JetGroupInd2ElemInds
std::map< int, std::vector< std::size_t > > JetGroupInd2ElemInds
Definition: elementalJetGroups.h:11