StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTrgRaiseThresholdEtHTTest.C
1 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
2 #include "StjTrgMock.hh"
3 
4 #include <StjTrgRaiseThresholdEtHT.h>
5 
6 #include "StjTrgRaiseThresholdEtHTTest.hh"
7 
8 // Registers the fixture into the 'registry'
9 CPPUNIT_TEST_SUITE_REGISTRATION( StjTrgRaiseThresholdEtHTTest );
10 
11 void StjTrgRaiseThresholdEtHTTest::setUp()
12 {
13 
14 }
15 
16 void StjTrgRaiseThresholdEtHTTest::tearDown()
17 {
18 
19 }
20 
21 void StjTrgRaiseThresholdEtHTTest::testOneTowerPass()
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._towers.push_back(1);
30  trgSrc._towerDsmAdc.push_back(0);
31  trgSrc._towerAdc.push_back(0);
32  trgSrc._towerEnergy.push_back(0);
33  trgSrc._towerEt.push_back(3.4);
34 
35  StjTrgRaiseThresholdEtHT 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.towers().size() );
41  CPPUNIT_ASSERT_EQUAL( 1, trg.towers()[0] );
42  CPPUNIT_ASSERT_EQUAL( 3.4, trg.towerEt()[0] );
43 }
44 
45 void StjTrgRaiseThresholdEtHTTest::testOneTowerNotPass()
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._towers.push_back(1);
54  trgSrc._towerDsmAdc.push_back(0);
55  trgSrc._towerAdc.push_back(0);
56  trgSrc._towerEnergy.push_back(0);
57  trgSrc._towerEt.push_back(3.4);
58 
59  StjTrgRaiseThresholdEtHT 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.towers().size() );
65 }
66 
67 void StjTrgRaiseThresholdEtHTTest::testTwoTowersPass()
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._towers.push_back(1);
77  trgSrc._towerDsmAdc.push_back(0);
78  trgSrc._towerAdc.push_back(0);
79  trgSrc._towerEnergy.push_back(0);
80  trgSrc._towerEt.push_back(3.4);
81 
82  trgSrc._towers.push_back(10);
83  trgSrc._towerDsmAdc.push_back(0);
84  trgSrc._towerAdc.push_back(0);
85  trgSrc._towerEnergy.push_back(0);
86  trgSrc._towerEt.push_back(2.5);
87 
88  StjTrgRaiseThresholdEtHT 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.towers().size() );
94  CPPUNIT_ASSERT_EQUAL( 1, trg.towers()[0] );
95  CPPUNIT_ASSERT_EQUAL( 3.4, trg.towerEt()[0] );
96 }
97 
98 void StjTrgRaiseThresholdEtHTTest::testTwoTowersNotPass()
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._towers.push_back(1);
108  trgSrc._towerDsmAdc.push_back(0);
109  trgSrc._towerAdc.push_back(0);
110  trgSrc._towerEnergy.push_back(0);
111  trgSrc._towerEt.push_back(3.4);
112 
113  trgSrc._towers.push_back(10);
114  trgSrc._towerDsmAdc.push_back(0);
115  trgSrc._towerAdc.push_back(0);
116  trgSrc._towerEnergy.push_back(0);
117  trgSrc._towerEt.push_back(2.5);
118 
119  StjTrgRaiseThresholdEtHT 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.towers().size() );
125 }
126