3 #include <StjTrgReader.h>
4 #include <StjTrgTree.h>
9 #include "StjTrgTreeTest.hh"
14 void StjTrgTreeTest::setUp()
19 void StjTrgTreeTest::tearDown()
24 void StjTrgTreeTest::testOne()
26 TFile* file =
new TFile(
"./part_run6143024.root");
28 TTree *tree =
dynamic_cast<TTree*
>(file->Get(
"trgBJP2"));
32 tree->BuildIndex(
"runNumber",
"eventId");
38 reader->GetEntryWithIndex(6143024, 1095);
39 CPPUNIT_ASSERT_EQUAL( 96233, trg->id() );
40 CPPUNIT_ASSERT_EQUAL( 6143024, trg->runNumber() );
41 CPPUNIT_ASSERT_EQUAL( 1095, trg->eventId() );
42 CPPUNIT_ASSERT_EQUAL(
true, trg->hard() );
43 CPPUNIT_ASSERT_EQUAL(
true, trg->soft() );
44 CPPUNIT_ASSERT_EQUAL(
true, trg->passed() );
45 CPPUNIT_ASSERT_EQUAL( 1.0, trg->prescale() );
46 CPPUNIT_ASSERT_EQUAL( (
size_t)0, trg->towers().size() );
47 CPPUNIT_ASSERT_EQUAL( (
size_t)1, trg->jetPatches().size() );
48 CPPUNIT_ASSERT_EQUAL( 3, trg->jetPatches()[0] );
50 reader->GetEntryWithIndex(6143024, 2000);
51 CPPUNIT_ASSERT_EQUAL(
false, trg->hard() );
52 CPPUNIT_ASSERT_EQUAL(
false, trg->soft() );
53 CPPUNIT_ASSERT_EQUAL(
false, trg->passed() );
54 CPPUNIT_ASSERT_EQUAL( (
size_t)0, trg->towers().size() );
55 CPPUNIT_ASSERT_EQUAL( (
size_t)0, trg->jetPatches().size() );
57 reader->GetEntryWithIndex(6143024, 24897);
58 CPPUNIT_ASSERT_EQUAL( 96233, trg->id() );
59 CPPUNIT_ASSERT_EQUAL( 6143024, trg->runNumber() );
60 CPPUNIT_ASSERT_EQUAL( 24897, trg->eventId() );
61 CPPUNIT_ASSERT_EQUAL(
true, trg->hard() );
62 CPPUNIT_ASSERT_EQUAL(
true, trg->soft() );
63 CPPUNIT_ASSERT_EQUAL(
true, trg->passed() );
64 CPPUNIT_ASSERT_EQUAL( 1.0, trg->prescale() );
65 CPPUNIT_ASSERT_EQUAL( (
size_t)0, trg->towers().size() );
66 CPPUNIT_ASSERT_EQUAL( (
size_t)1, trg->jetPatches().size() );
67 CPPUNIT_ASSERT_EQUAL( 4, trg->jetPatches()[0] );
69 reader->GetEntryWithIndex(6143024, 28661);
70 CPPUNIT_ASSERT_EQUAL( 96233, trg->id() );
71 CPPUNIT_ASSERT_EQUAL( 6143024, trg->runNumber() );
72 CPPUNIT_ASSERT_EQUAL( 28661, trg->eventId() );
73 CPPUNIT_ASSERT_EQUAL(
true, trg->hard() );
74 CPPUNIT_ASSERT_EQUAL(
true, trg->soft() );
75 CPPUNIT_ASSERT_EQUAL(
true, trg->passed() );
76 CPPUNIT_ASSERT_EQUAL( 1.0, trg->prescale() );
77 CPPUNIT_ASSERT_EQUAL( (
size_t)0, trg->towers().size() );
78 CPPUNIT_ASSERT_EQUAL( (
size_t)1, trg->jetPatches().size() );
79 CPPUNIT_ASSERT_EQUAL( 2, trg->jetPatches()[0] );