StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjJetCutTest.C
1 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
2 #include <StjJetCutPt.h>
3 #include <StjJetCutEta.h>
4 #include <StjJetCutDetectorEta.h>
5 #include <StjJetCutNFourVecs.h>
6 #include <StjJetCutTrgBHT.h>
7 #include <StjJetCutTrgBJP.h>
8 
9 #include <StjTrgBEMCJetPatchTowerIdMap2005.h>
10 
11 #include <StjJetList.h>
12 
13 #include "StjTrgMock.hh"
14 
15 #include "StjJetCutTest.hh"
16 
17 // Registers the fixture into the 'registry'
18 CPPUNIT_TEST_SUITE_REGISTRATION( StjJetCutTest );
19 
20 void StjJetCutTest::setUp()
21 {
22 
23 }
24 
25 void StjJetCutTest::tearDown()
26 {
27 
28 }
29 
30 void StjJetCutTest::testPt()
31 {
32  StjJetCutPt cut(5.0);
33 
34  StjJet p1;
35  p1.pt = 4.8;
36 
37  CPPUNIT_ASSERT( cut(p1) );
38 
39  StjJet p2;
40  p2.pt = 5.1;
41 
42  CPPUNIT_ASSERT( ! cut(p2) );
43 }
44 
45 void StjJetCutTest::testEta()
46 {
47  StjJetCutEta cut(-5.0, 5.0);
48 
49  StjJet p1;
50  p1.eta = 4.8;
51 
52  CPPUNIT_ASSERT( ! cut(p1) );
53 
54  StjJet p2;
55  p2.eta = 5.1;
56 
57  CPPUNIT_ASSERT( cut(p2) );
58 
59  StjJet p3;
60  p3.eta = -5.1;
61 
62  CPPUNIT_ASSERT( cut(p3) );
63 }
64 
65 void StjJetCutTest::testDetectorEta()
66 {
67  StjJetCutDetectorEta cut( 0.2, 0.8);
68 
69  StjJet p1;
70  p1.detectorEta = 0.3;
71 
72  CPPUNIT_ASSERT( ! cut(p1) );
73 
74  StjJet p2;
75  p2.detectorEta = 0.1;
76 
77  CPPUNIT_ASSERT( cut(p2) );
78 
79  StjJet p3;
80  p3.detectorEta = 0.9;
81 
82  CPPUNIT_ASSERT( cut(p3) );
83 }
84 
85 void StjJetCutTest::testNFourVecs()
86 {
87  StjJetCutNFourVecs cut(4);
88 
89  StjJet p1;
90  p1.fourVecList.push_back(StjFourVec());
91  p1.fourVecList.push_back(StjFourVec());
92  p1.fourVecList.push_back(StjFourVec());
93 
94  CPPUNIT_ASSERT( cut(p1) );
95 
96  StjJet p2;
97  p2.fourVecList.push_back(StjFourVec());
98  p2.fourVecList.push_back(StjFourVec());
99  p2.fourVecList.push_back(StjFourVec());
100  p2.fourVecList.push_back(StjFourVec());
101 
102  CPPUNIT_ASSERT( ! cut(p2) );
103 }
104 
105 void StjJetCutTest::testTrgBHT_notPass()
106 {
107  StjTrgMock trg;
108  trg._passed = false;
109 
110  StjJetCutTrgBHT cut(&trg);
111 
112  StjJet p1;
113  StjFourVec four1;
114  four1.type = 2;
115  four1.detectorId = 9;
116  four1.towerId = 1;
117  p1.fourVecList.push_back(four1);
118 
119  CPPUNIT_ASSERT( cut(p1) );
120 }
121 
122 void StjJetCutTest::testTrgBHT_pass()
123 {
124  StjTrgMock trg;
125  trg._passed = true;
126  trg._towers.push_back(1);
127 
128  StjJetCutTrgBHT cut(&trg);
129 
130  StjJet p1;
131  StjFourVec four1;
132  four1.type = 2;
133  four1.detectorId = 9;
134  four1.towerId = 1;
135  p1.fourVecList.push_back(four1);
136 
137  CPPUNIT_ASSERT( ! cut(p1) );
138 }
139 
140 void StjJetCutTest::testTrgBHT_type()
141 {
142  StjTrgMock trg;
143  trg._passed = true;
144  trg._towers.push_back(1);
145 
146  StjJetCutTrgBHT cut(&trg);
147 
148  StjJet p1;
149  StjFourVec four1;
150  four1.type = 1;
151  four1.detectorId = 0;
152  four1.towerId = 0;
153  p1.fourVecList.push_back(four1);
154 
155  CPPUNIT_ASSERT( cut(p1) );
156 }
157 
158 void StjJetCutTest::testTrgBHT_detectorId()
159 {
160  StjTrgMock trg;
161  trg._passed = true;
162  trg._towers.push_back(1);
163 
164  StjJetCutTrgBHT cut(&trg);
165 
166  StjJet p1;
167  StjFourVec four1;
168  four1.type = 2;
169  four1.detectorId = 13;
170  four1.towerId = 1;
171  p1.fourVecList.push_back(four1);
172 
173  CPPUNIT_ASSERT( cut(p1) );
174 }
175 
176 void StjJetCutTest::testTrgBHT_towerId()
177 {
178  StjTrgMock trg;
179  trg._passed = true;
180  trg._towers.push_back(1);
181 
182  StjJetCutTrgBHT cut(&trg);
183 
184  StjJet p1;
185  StjFourVec four1;
186  four1.type = 2;
187  four1.detectorId = 9;
188  four1.towerId = 3;
189  p1.fourVecList.push_back(four1);
190 
191  CPPUNIT_ASSERT( cut(p1) );
192 }
193 
194 void StjJetCutTest::testTrgBJP_notPass()
195 {
196  StjTrgMock trg;
197  trg._passed = false;
198 
200 
201  StjJet p1;
202  StjFourVec four1;
203  four1.type = 2;
204  four1.detectorId = 9;
205  four1.towerId = 1;
206  p1.fourVecList.push_back(four1);
207 
208  CPPUNIT_ASSERT( cut(p1) );
209 }
210 
211 void StjJetCutTest::testTrgBJP_pass()
212 {
213  StjTrgMock trg;
214  trg._passed = true;
215  trg._jetPatches.push_back(2);
216 
218 
219  StjJet p1;
220  StjFourVec four1;
221  four1.type = 2;
222  four1.detectorId = 9;
223  four1.towerId = 503;
224  p1.fourVecList.push_back(four1);
225 
226  CPPUNIT_ASSERT( ! cut(p1) );
227 }
228 
229 void StjJetCutTest::testTrgBJP_type()
230 {
231  StjTrgMock trg;
232  trg._passed = true;
233  trg._jetPatches.push_back(2);
234 
236 
237  StjJet p1;
238  StjFourVec four1;
239  four1.type = 1;
240  four1.detectorId = 0;
241  four1.towerId = 0;
242  p1.fourVecList.push_back(four1);
243 
244  CPPUNIT_ASSERT( cut(p1) );
245 }
246 
247 void StjJetCutTest::testTrgBJP_detectorId()
248 {
249  StjTrgMock trg;
250  trg._passed = true;
251  trg._jetPatches.push_back(2);
252 
254 
255  StjJet p1;
256  StjFourVec four1;
257  four1.type = 2;
258  four1.detectorId = 13;
259  four1.towerId = 503;
260  p1.fourVecList.push_back(four1);
261 
262  CPPUNIT_ASSERT( cut(p1) );
263 }
264 
265 void StjJetCutTest::testTrgBJP_jetPatchId()
266 {
267  StjTrgMock trg;
268  trg._passed = true;
269  trg._jetPatches.push_back(2);
270 
272 
273  StjJet p1;
274  StjFourVec four1;
275  four1.type = 2;
276  four1.detectorId = 9;
277  four1.towerId = 101;
278  p1.fourVecList.push_back(four1);
279 
280  CPPUNIT_ASSERT( cut(p1) );
281 }