StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTrgRaiseThresholdEtJPTest.C
1 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
2 #include "StjTrgMock.hh"
3 
4 #include <StjTrgRaiseThresholdEtJP.h>
5 
6 #include "StjTrgRaiseThresholdEtJPTest.hh"
7 
8 // Registers the fixture into the 'registry'
9 CPPUNIT_TEST_SUITE_REGISTRATION( StjTrgRaiseThresholdEtJPTest );
10 
11 void StjTrgRaiseThresholdEtJPTest::setUp()
12 {
13 
14 }
15 
16 void StjTrgRaiseThresholdEtJPTest::tearDown()
17 {
18 
19 }
20 
21 void StjTrgRaiseThresholdEtJPTest::testOneJetPatchPass()
22 {
23  StjTrgMock trgSrc;
24  trgSrc._runNumber = 1;
25  trgSrc._eventId = 1;
26  trgSrc._passed = true;
27  trgSrc._hard = true;
28  trgSrc._soft = true;
29  trgSrc._jetPatches.push_back(1);
30  trgSrc._jetPatchDsmAdc.push_back(0);
31  trgSrc._jetPatchAdc.push_back(0);
32  trgSrc._jetPatchEnergy.push_back(0);
33  trgSrc._jetPatchEt.push_back(3.4);
34 
35  StjTrgRaiseThresholdEtJP trg(&trgSrc, 3.0);
36 
37  CPPUNIT_ASSERT( trg.passed() );
38  CPPUNIT_ASSERT( trg.hard() );
39  CPPUNIT_ASSERT( trg.soft() );
40  CPPUNIT_ASSERT_EQUAL( (size_t)1, trg.jetPatches().size() );
41  CPPUNIT_ASSERT_EQUAL( 1, trg.jetPatches()[0] );
42  CPPUNIT_ASSERT_EQUAL( 3.4, trg.jetPatchEt()[0] );
43 }
44 
45 void StjTrgRaiseThresholdEtJPTest::testOneJetPatchNotPass()
46 {
47  StjTrgMock trgSrc;
48  trgSrc._runNumber = 1;
49  trgSrc._eventId = 1;
50  trgSrc._passed = true;
51  trgSrc._hard = true;
52  trgSrc._soft = true;
53  trgSrc._jetPatches.push_back(1);
54  trgSrc._jetPatchDsmAdc.push_back(0);
55  trgSrc._jetPatchAdc.push_back(0);
56  trgSrc._jetPatchEnergy.push_back(0);
57  trgSrc._jetPatchEt.push_back(3.4);
58 
59  StjTrgRaiseThresholdEtJP trg(&trgSrc, 4.0);
60 
61  CPPUNIT_ASSERT( ! trg.passed() );
62  CPPUNIT_ASSERT( trg.hard() );
63  CPPUNIT_ASSERT( ! trg.soft() );
64  CPPUNIT_ASSERT_EQUAL( (size_t)0, trg.jetPatches().size() );
65 }
66 
67 void StjTrgRaiseThresholdEtJPTest::testTwoJetPatchesPass()
68 {
69  StjTrgMock trgSrc;
70  trgSrc._runNumber = 1;
71  trgSrc._eventId = 1;
72  trgSrc._passed = true;
73  trgSrc._hard = true;
74  trgSrc._soft = true;
75 
76  trgSrc._jetPatches.push_back(1);
77  trgSrc._jetPatchDsmAdc.push_back(0);
78  trgSrc._jetPatchAdc.push_back(0);
79  trgSrc._jetPatchEnergy.push_back(0);
80  trgSrc._jetPatchEt.push_back(3.4);
81 
82  trgSrc._jetPatches.push_back(3);
83  trgSrc._jetPatchDsmAdc.push_back(0);
84  trgSrc._jetPatchAdc.push_back(0);
85  trgSrc._jetPatchEnergy.push_back(0);
86  trgSrc._jetPatchEt.push_back(2.5);
87 
88  StjTrgRaiseThresholdEtJP trg(&trgSrc, 3.0);
89 
90  CPPUNIT_ASSERT( trg.passed() );
91  CPPUNIT_ASSERT( trg.hard() );
92  CPPUNIT_ASSERT( trg.soft() );
93  CPPUNIT_ASSERT_EQUAL( (size_t)1, trg.jetPatches().size() );
94  CPPUNIT_ASSERT_EQUAL( 1, trg.jetPatches()[0] );
95  CPPUNIT_ASSERT_EQUAL( 3.4, trg.jetPatchEt()[0] );
96 }
97 
98 void StjTrgRaiseThresholdEtJPTest::testTwoJetPatchesNotPass()
99 {
100  StjTrgMock trgSrc;
101  trgSrc._runNumber = 1;
102  trgSrc._eventId = 1;
103  trgSrc._passed = true;
104  trgSrc._hard = true;
105  trgSrc._soft = true;
106 
107  trgSrc._jetPatches.push_back(1);
108  trgSrc._jetPatchDsmAdc.push_back(0);
109  trgSrc._jetPatchAdc.push_back(0);
110  trgSrc._jetPatchEnergy.push_back(0);
111  trgSrc._jetPatchEt.push_back(3.4);
112 
113  trgSrc._jetPatches.push_back(3);
114  trgSrc._jetPatchDsmAdc.push_back(0);
115  trgSrc._jetPatchAdc.push_back(0);
116  trgSrc._jetPatchEnergy.push_back(0);
117  trgSrc._jetPatchEt.push_back(2.5);
118 
119  StjTrgRaiseThresholdEtJP trg(&trgSrc, 4.0);
120 
121  CPPUNIT_ASSERT( ! trg.passed() );
122  CPPUNIT_ASSERT( trg.hard() );
123  CPPUNIT_ASSERT( ! trg.soft() );
124  CPPUNIT_ASSERT_EQUAL( (size_t)0, trg.jetPatches().size() );
125 }
126