StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTreeIndexListCreatorTest.C
1 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
2 
3 #include "UniqueStringGenerator.hh"
4 
5 #include <StjTreeIndex.h>
6 #include <StjTreeIndexList.h>
7 #include <StjTreeIndexListCreator.h>
8 
9 #include <TDirectory.h>
10 #include <TFile.h>
11 #include <TTree.h>
12 
13 #include <string>
14 
15 #include "StjTreeIndexListCreatorTest.hh"
16 
17 using namespace std;
18 
19 // Registers the fixture into the 'registry'
20 CPPUNIT_TEST_SUITE_REGISTRATION( StjTreeIndexListCreatorTest );
21 
22 void StjTreeIndexListCreatorTest::setUp()
23 {
24 
25 }
26 
27 void StjTreeIndexListCreatorTest::tearDown()
28 {
29 
30 }
31 
32 void StjTreeIndexListCreatorTest::testOne()
33 {
34  TDirectory* testDir = setupTestTDirecotry();
35 
36  StjTreeIndexListCreator idxCreator(testDir);
37  idxCreator.AddTrgTreeName("trgBHT2");
38  idxCreator.AddTrgTreeName("trgBJP2");
39 
40  StjTreeIndexList actualList = idxCreator.create();
41 
42  StjTreeIndexList expectedList = createExpectedList();
43 
44  cout << endl;
45  for(StjTreeIndexList::const_iterator it = actualList.begin(); it != actualList.end(); ++it) {
46  cout << (*it) << endl;
47  }
48 
49  CPPUNIT_ASSERT_EQUAL( expectedList, actualList);
50 
51 }
52 
53 TDirectory *StjTreeIndexListCreatorTest::setupTestTDirecotry()
54 {
55  return new TFile("./part_run6143024.root");
56 }
57 
58 StjTreeIndexList StjTreeIndexListCreatorTest::createExpectedList()
59 {
60  StjTreeIndexList ret;
61 
62  ret.push_back(StjTreeIndex(6143024, 3 ));
63  ret.push_back(StjTreeIndex(6143024, 4 ));
64  ret.push_back(StjTreeIndex(6143024, 6 ));
65  ret.push_back(StjTreeIndex(6143024, 1095 ));
66  ret.push_back(StjTreeIndex(6143024, 4823 ));
67  ret.push_back(StjTreeIndex(6143024, 14619 ));
68  ret.push_back(StjTreeIndex(6143024, 17180 ));
69  ret.push_back(StjTreeIndex(6143024, 17479 ));
70  ret.push_back(StjTreeIndex(6143024, 18358 ));
71  ret.push_back(StjTreeIndex(6143024, 20875 ));
72  ret.push_back(StjTreeIndex(6143024, 23411 ));
73  ret.push_back(StjTreeIndex(6143024, 24897 ));
74  ret.push_back(StjTreeIndex(6143024, 28661 ));
75  ret.push_back(StjTreeIndex(6143024, 31930 ));
76  ret.push_back(StjTreeIndex(6143024, 33177 ));
77  ret.push_back(StjTreeIndex(6143024, 34414 ));
78  ret.push_back(StjTreeIndex(6143024, 38442 ));
79  ret.push_back(StjTreeIndex(6143024, 39305 ));
80  ret.push_back(StjTreeIndex(6143024, 43061 ));
81  ret.push_back(StjTreeIndex(6143024, 43439 ));
82  ret.push_back(StjTreeIndex(6143024, 45577 ));
83  ret.push_back(StjTreeIndex(6143024, 46794 ));
84  ret.push_back(StjTreeIndex(6143024, 48044 ));
85  ret.push_back(StjTreeIndex(6143024, 53010 ));
86  ret.push_back(StjTreeIndex(6143024, 53026 ));
87  ret.push_back(StjTreeIndex(6143024, 55446 ));
88  ret.push_back(StjTreeIndex(6143024, 55474 ));
89  ret.push_back(StjTreeIndex(6143024, 55646 ));
90  ret.push_back(StjTreeIndex(6143024, 55720 ));
91  ret.push_back(StjTreeIndex(6143024, 56694 ));
92  ret.push_back(StjTreeIndex(6143024, 56712 ));
93  ret.push_back(StjTreeIndex(6143024, 57890 ));
94  ret.push_back(StjTreeIndex(6143024, 64039 ));
95  ret.push_back(StjTreeIndex(6143024, 65307 ));
96  ret.push_back(StjTreeIndex(6143024, 67815 ));
97  ret.push_back(StjTreeIndex(6143024, 70314 ));
98  ret.push_back(StjTreeIndex(6143024, 71596 ));
99  ret.push_back(StjTreeIndex(6143024, 72863 ));
100  ret.push_back(StjTreeIndex(6143024, 74068 ));
101  ret.push_back(StjTreeIndex(6143024, 80160 ));
102  ret.push_back(StjTreeIndex(6143024, 81099 ));
103  ret.push_back(StjTreeIndex(6143024, 81215 ));
104  ret.push_back(StjTreeIndex(6143024, 81234 ));
105  ret.push_back(StjTreeIndex(6143024, 81290 ));
106  ret.push_back(StjTreeIndex(6143024, 81313 ));
107  ret.push_back(StjTreeIndex(6143024, 81384 ));
108  ret.push_back(StjTreeIndex(6143024, 86137 ));
109 
110  return ret;
111 }
112