StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunJetFinderTest.C
1 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
2 
3 #include <StjRunJetFinder.h>
4 
5 #include <StjFourVecPrint.h>
6 #include <StjJetPrint.h>
7 
8 #include <StProtoJet.h>
9 #include <StConePars.h>
10 #include <StConeJetFinder.h>
11 
12 #include <TTree.h>
13 
14 #include <iostream>
15 #include <string>
16 
17 #include "RunJetFinderTest.hh"
18 
19 using namespace std;
20 
21 // Registers the fixture into the 'registry'
22 CPPUNIT_TEST_SUITE_REGISTRATION( RunJetFinderTest );
23 
24 void RunJetFinderTest::setUp()
25 {
26 
27 }
28 
29 void RunJetFinderTest::tearDown()
30 {
31 
32 }
33 
34 void RunJetFinderTest::testRun()
35 {
36  StConePars* cpars = new StConePars();
37  cpars->setGridSpacing(56, -1.6, 1.6, 120, -3.141592613589793, 3.141592613589793);
38  cpars->setConeRadius(0.4);
39  cpars->setSeedEtMin(0.5);
40  cpars->setAssocEtMin(0.1);
41  cpars->setSplitFraction(0.5);
42  cpars->setPerformMinimization(true);
43  cpars->setAddMidpoints(true);
44  cpars->setRequireStableMidpoints(true);
45  cpars->setDoSplitMerge(true);
46  cpars->setDebug(false);
47  StjRunJetFinder jetFinder;
48  jetFinder.Init(cpars);
49 
50  StjFourVecList fourList = createFourVecList();
51 
52  StjFourVecPrint fourprint;
53  // fourprint(fourList);
54 
55  StjJetList jetList = jetFinder(fourList);
56 
57  StjJetPrint jetprint;
58  jetprint(jetList);
59 
60  StjJetList expectedJetList = createJetList();
61 
62  CPPUNIT_ASSERT_EQUAL( expectedJetList, jetList);
63 
64 }
65 
66 void RunJetFinderTest::testRunRepeat()
67 {
68  StConePars* cpars = new StConePars();
69  cpars->setGridSpacing(56, -1.6, 1.6, 120, -3.141592613589793, 3.141592613589793);
70  cpars->setConeRadius(0.4);
71  cpars->setSeedEtMin(0.5);
72  cpars->setAssocEtMin(0.1);
73  cpars->setSplitFraction(0.5);
74  cpars->setPerformMinimization(true);
75  cpars->setAddMidpoints(true);
76  cpars->setRequireStableMidpoints(true);
77  cpars->setDoSplitMerge(true);
78  cpars->setDebug(false);
79  StjRunJetFinder jetFinder;
80  jetFinder.Init(cpars);
81 
82  StjFourVecList fourList = createFourVecList();
83 
84  StjFourVecPrint fourprint;
85  // fourprint(fourList);
86 
87  // while(1) jetFinder(fourList);
88 
89  StjJetList jetList = jetFinder(fourList);
90 
91  StjJetPrint jetprint;
92  jetprint(jetList);
93 
94  StjJetList expectedJetList = createJetList();
95 
96  CPPUNIT_ASSERT_EQUAL( expectedJetList, jetList);
97 
98 }
99 
100 StjFourVecList RunJetFinderTest::createFourVecList()
101 {
102  StjFourVecList ret;
103 
104  ret.push_back(createFourVec(6143024, 18358, 1, 1, 1, 2799, 0, 0, 0.923283, 0.724552, 0.874879, 0.13957, -118.55));
105  ret.push_back(createFourVec(6143024, 18358, 2, 1, 1, 2798, 0, 0, 1.20774, 0.290082, 1.3077, 0.13957, -118.55));
106  ret.push_back(createFourVec(6143024, 18358, 3, 1, 1, 2797, 0, 0, 0.747889, -0.342101, 1.43174, 0.13957, -118.55));
107  ret.push_back(createFourVec(6143024, 18358, 4, 1, 1, 2796, 0, 0, 0.553708, 0.796128, 1.53265, 0.13957, -118.55));
108  ret.push_back(createFourVec(6143024, 18358, 5, 1, 1, 2795, 0, 0, 1.00236, 0.993059, 1.56782, 0.13957, -118.55));
109  ret.push_back(createFourVec(6143024, 18358, 6, 1, 1, 2787, 0, 0, 0.33272, 0.905262, -1.73633, 0.13957, -118.55));
110  ret.push_back(createFourVec(6143024, 18358, 7, 1, 1, 2785, 0, 0, 0.467436, 0.587571, -1.06465, 0.13957, -118.55));
111  ret.push_back(createFourVec(6143024, 18358, 8, 1, 1, 2784, 0, 0, 1.14746, 1.09041, -1.3133, 0.13957, -118.55));
112  ret.push_back(createFourVec(6143024, 18358, 9, 1, 1, 2782, 0, 0, 0.302314, 0.77667, -1.56462, 0.13957, -118.55));
113  ret.push_back(createFourVec(6143024, 18358, 10, 1, 1, 2780, 0, 0, 1.21214, 0.883992, -0.998302, 0.13957, -118.55));
114  ret.push_back(createFourVec(6143024, 18358, 11, 1, 1, 2774, 0, 0, 0.289968, 0.339625, 1.8854, 0.13957, -118.55));
115  ret.push_back(createFourVec(6143024, 18358, 12, 1, 1, 2770, 0, 0, 0.749084, 0.124089, 2.32001, 0.13957, -118.55));
116  ret.push_back(createFourVec(6143024, 18358, 13, 1, 1, 2759, 0, 0, 0.335719, -0.36807, -1.26502, 0.13957, -118.55));
117  ret.push_back(createFourVec(6143024, 18358, 14, 1, 1, 2758, 0, 0, 0.31488, 1.43786, 1.77108, 0.13957, -118.55));
118  ret.push_back(createFourVec(6143024, 18358, 15, 1, 1, 2754, 0, 0, 0.373382, -0.614185, -0.557547, 0.13957, -118.55));
119  ret.push_back(createFourVec(6143024, 18358, 16, 2, 9, 0, 181, 0, 0.0615938, 0.52526, 0.810193, 4.969e-10, -118.55));
120  ret.push_back(createFourVec(6143024, 18358, 17, 2, 9, 0, 193, 0, 0.0400255, 1.00946, 0.810193, -5.45648e-10, -118.55));
121  ret.push_back(createFourVec(6143024, 18358, 18, 2, 9, 0, 247, 0, 0.106678, 0.774646, 0.650698, -2.53721e-10, -118.55));
122  ret.push_back(createFourVec(6143024, 18358, 19, 2, 9, 0, 402, 0, 0.0793278, 0.567974, 0.233078, -3.31835e-10, -118.55));
123  ret.push_back(createFourVec(6143024, 18358, 20, 2, 9, 0, 788, 0, 0.0128473, 0.814254, -0.755653, 2.01506e-10, -118.55));
124  ret.push_back(createFourVec(6143024, 18358, 21, 2, 9, 0, 829, 0, 0.0154157, 0.853815, -0.860093, -3.34021e-10, -118.55));
125  ret.push_back(createFourVec(6143024, 18358, 22, 2, 9, 0, 877, 0, 0.0327906, 1.16356, -0.96456, 9.34727e-10, -118.55));
126  ret.push_back(createFourVec(6143024, 18358, 23, 2, 9, 0, 892, 0, 0.0259874, 0.970873, -1.0196, -4.64523e-10, -118.55));
127  ret.push_back(createFourVec(6143024, 18358, 24, 2, 9, 0, 893, 0, 0.635404, 1.00949, -1.0196, -5.61696e-09, -118.55));
128  ret.push_back(createFourVec(6143024, 18358, 25, 2, 9, 0, 894, 0, 0.0131186, 1.04804, -1.0196, 3.18401e-10, -118.55));
129  ret.push_back(createFourVec(6143024, 18358, 26, 2, 9, 0, 913, 0, 0.031355, 1.0096, -1.06906, -6.75999e-10, -118.55));
130  ret.push_back(createFourVec(6143024, 18358, 27, 2, 9, 0, 930, 0, 0.191831, 0.893451, -1.12411, 4.76592e-09, -118.55));
131  ret.push_back(createFourVec(6143024, 18358, 28, 2, 9, 0, 931, 0, 0.218992, 0.932361, -1.12411, 1.9129e-09, -118.55));
132  ret.push_back(createFourVec(6143024, 18358, 29, 2, 9, 0, 932, 0, 0.107828, 0.971102, -1.12411, 1.859e-09, -118.55));
133  ret.push_back(createFourVec(6143024, 18358, 30, 2, 9, 0, 952, 0, 0.0888896, 0.971216, -1.17358, 1.9978e-09, -118.55));
134  ret.push_back(createFourVec(6143024, 18358, 31, 2, 9, 0, 980, 0, 0.0352992, 1.27669, -1.22865, -9.80717e-10, -118.55));
135  ret.push_back(createFourVec(6143024, 18358, 32, 2, 9, 0, 999, 0, 0.063427, 1.2418, -1.27815, 1.49538e-09, -118.55));
136  ret.push_back(createFourVec(6143024, 18358, 33, 2, 9, 0, 1000, 0, 1.32632, 1.27683, -1.27815, 1.28205e-08, -118.55));
137  ret.push_back(createFourVec(6143024, 18358, 34, 2, 9, 0, 1015, 0, 0.14217, 1.08734, -1.33323, -2.47023e-09, -118.55));
138  ret.push_back(createFourVec(6143024, 18358, 35, 2, 9, 0, 1016, 0, 0.181738, 1.12589, -1.33323, -3.02568e-09, -118.55));
139  ret.push_back(createFourVec(6143024, 18358, 36, 2, 9, 0, 1020, 0, 0.0562451, 1.27698, -1.33323, 8.43509e-10, -118.55));
140  ret.push_back(createFourVec(6143024, 18358, 37, 2, 9, 0, 1043, 0, 0.289149, 0.611852, -1.43785, -1.97906e-09, -118.55));
141  ret.push_back(createFourVec(6143024, 18358, 38, 2, 9, 0, 1055, 0, 0.430705, 1.08762, -1.43785, 2.09548e-09, -118.55));
142  ret.push_back(createFourVec(6143024, 18358, 39, 2, 9, 0, 1073, 0, 0.068084, 1.01064, -1.48738, -1.74089e-09, -118.55));
143  ret.push_back(createFourVec(6143024, 18358, 40, 2, 9, 0, 1074, 0, 0.134123, 1.04921, -1.48738, -9.42173e-10, -118.55));
144  ret.push_back(createFourVec(6143024, 18358, 41, 2, 9, 0, 1076, 0, 0.0727401, 1.12632, -1.48738, -8.27286e-10, -118.55));
145  ret.push_back(createFourVec(6143024, 18358, 42, 2, 9, 0, 1063, 0, 0.102148, 0.611946, -1.48738, -8.36957e-10, -118.55));
146  ret.push_back(createFourVec(6143024, 18358, 43, 2, 9, 0, 1064, 0, 0.090681, 0.653812, -1.48738, 9.19423e-10, -118.55));
147  ret.push_back(createFourVec(6143024, 18358, 44, 2, 9, 0, 1093, 0, 1.14872, 1.01079, -1.54251, -1.45849e-08, -118.55));
148  ret.push_back(createFourVec(6143024, 18358, 45, 2, 9, 0, 1094, 0, 0.421368, 1.04936, -1.54251, -4.80557e-09, -118.55));
149  ret.push_back(createFourVec(6143024, 18358, 46, 2, 9, 0, 1113, 0, 0.0251327, 1.01092, -1.59205, -3.33109e-10, -118.55));
150  ret.push_back(createFourVec(6143024, 18358, 47, 2, 9, 0, 1341, 0, 0.0224743, 0.52721, -2.22089, -1.12484e-10, -118.55));
151  ret.push_back(createFourVec(6143024, 18358, 48, 2, 9, 0, 1371, 0, 0.105216, 0.93518, -2.27615, 1.68098e-09, -118.55));
152  ret.push_back(createFourVec(6143024, 18358, 49, 2, 9, 0, 1392, 0, 0.231948, 0.974095, -2.32582, 2.96116e-09, -118.55));
153  ret.push_back(createFourVec(6143024, 18358, 50, 2, 9, 0, 1788, 0, 0.109902, 0.818492, 2.90688, 1.24502e-09, -118.55));
154  ret.push_back(createFourVec(6143024, 18358, 51, 2, 9, 0, 1919, 0, 0.0194559, 1.24563, 2.59166, -2.52047e-11, -118.55));
155  ret.push_back(createFourVec(6143024, 18358, 52, 2, 9, 0, 2023, 0, 0.012137, 0.613679, 2.27659, -1.81535e-10, -118.55));
156  ret.push_back(createFourVec(6143024, 18358, 53, 2, 9, 0, 2086, 0, 0.078437, 0.737449, 2.11634, -1.03308e-09, -118.55));
157  ret.push_back(createFourVec(6143024, 18358, 54, 2, 9, 0, 2189, 0, 0.135158, 0.856501, 1.85689, -9.529e-10, -118.55));
158  ret.push_back(createFourVec(6143024, 18358, 55, 2, 9, 0, 2230, 0, 0.168227, 0.895446, 1.75205, -2.34859e-09, -118.55));
159  ret.push_back(createFourVec(6143024, 18358, 56, 2, 9, 0, 2232, 0, 0.146151, 0.973198, 1.75205, 1.15832e-09, -118.55));
160  ret.push_back(createFourVec(6143024, 18358, 57, 2, 9, 0, 2233, 0, 0.574076, 1.01187, 1.75205, -1.38236e-08, -118.55));
161  ret.push_back(createFourVec(6143024, 18358, 58, 2, 9, 0, 2234, 0, 0.0122867, 1.05047, 1.75205, -1.22401e-10, -118.55));
162  ret.push_back(createFourVec(6143024, 18358, 59, 2, 9, 0, 2251, 0, 0.0124482, 0.934269, 1.69685, 2.21768e-10, -118.55));
163  ret.push_back(createFourVec(6143024, 18358, 60, 2, 9, 0, 2252, 0, 0.0231807, 0.973056, 1.69685, 3.58225e-10, -118.55));
164  ret.push_back(createFourVec(6143024, 18358, 61, 2, 9, 0, 2293, 0, 0.107901, 1.01144, 1.59207, 3.74977e-10, -118.55));
165  ret.push_back(createFourVec(6143024, 18358, 62, 2, 9, 0, 2299, 0, 0.0104751, 1.24329, 1.59207, 1.79408e-10, -118.55));
166  ret.push_back(createFourVec(6143024, 18358, 63, 2, 9, 0, 2322, 0, 0.032346, 0.569719, 1.48732, -2.89762e-10, -118.55));
167 
168 
169  return ret;
170 }
171 
172 StjFourVec RunJetFinderTest::createFourVec(int runNumber, int eventId,
173  int fourvecId, int type, int detectorId, short trackId, int towerId, int mcparticleId,
174  double pt, double eta, double phi, double m,
175  double vertexZ)
176 {
177  StjFourVec ret;
178  ret.runNumber = runNumber;
179  ret.eventId = eventId;
180  ret.fourvecId = fourvecId;
181  ret.type = type;
182  ret.detectorId = detectorId;
183  ret.trackId = trackId;
184  ret.towerId = towerId;
185  ret.mcparticleId = mcparticleId;
186  ret.pt = pt;
187  ret.eta = eta;
188  ret.phi = phi;
189  ret.m = m;
190  ret.vertexZ = vertexZ;
191  return ret;
192 }
193 
194 StjJetList RunJetFinderTest::createJetList()
195 {
196  StjJetList ret;
197  StjFourVecList fourveclist;
198 
199  fourveclist.push_back(createFourVec(6143024, 18358, 9, 1, 1, 2782, 0, 0, 0.302314, 0.77667, -1.56462, 0.13957, -118.55));
200  fourveclist.push_back(createFourVec(6143024, 18358, 27, 2, 9, 0, 930, 0, 0.191831, 0.893451, -1.12411, 4.76592e-09, -118.55));
201  fourveclist.push_back(createFourVec(6143024, 18358, 10, 1, 1, 2780, 0, 0, 1.21214, 0.883992, -0.998302, 0.13957, -118.55));
202  fourveclist.push_back(createFourVec(6143024, 18358, 28, 2, 9, 0, 931, 0, 0.218992, 0.932361, -1.12411, 1.9129e-09, -118.55));
203  fourveclist.push_back(createFourVec(6143024, 18358, 29, 2, 9, 0, 932, 0, 0.107828, 0.971102, -1.12411, 1.859e-09, -118.55));
204  fourveclist.push_back(createFourVec(6143024, 18358, 44, 2, 9, 0, 1093, 0, 1.14872, 1.01079, -1.54251, -1.45849e-08, -118.55));
205  fourveclist.push_back(createFourVec(6143024, 18358, 24, 2, 9, 0, 893, 0, 0.635404, 1.00949, -1.0196, -5.61696e-09, -118.55));
206  fourveclist.push_back(createFourVec(6143024, 18358, 45, 2, 9, 0, 1094, 0, 0.421368, 1.04936, -1.54251, -4.80557e-09, -118.55));
207  fourveclist.push_back(createFourVec(6143024, 18358, 40, 2, 9, 0, 1074, 0, 0.134123, 1.04921, -1.48738, -9.42173e-10, -118.55));
208  fourveclist.push_back(createFourVec(6143024, 18358, 38, 2, 9, 0, 1055, 0, 0.430705, 1.08762, -1.43785, 2.09548e-09, -118.55));
209  fourveclist.push_back(createFourVec(6143024, 18358, 8, 1, 1, 2784, 0, 0, 1.14746, 1.09041, -1.3133, 0.13957, -118.55));
210  fourveclist.push_back(createFourVec(6143024, 18358, 34, 2, 9, 0, 1015, 0, 0.14217, 1.08734, -1.33323, -2.47023e-09, -118.55));
211  fourveclist.push_back(createFourVec(6143024, 18358, 35, 2, 9, 0, 1016, 0, 0.181738, 1.12589, -1.33323, -3.02568e-09, -118.55));
212  fourveclist.push_back(createFourVec(6143024, 18358, 33, 2, 9, 0, 1000, 0, 1.32632, 1.27683, -1.27815, 1.28205e-08, -118.55));
213  ret.push_back(createJet(6143024, 18358, 1, 7.45059, 1.06812, -1.28799, 2.04423, 0.647659, -118.55, 0.693636, fourveclist));
214 
215  fourveclist.clear();
216 
217  fourveclist.push_back(createFourVec(6143024, 18358, 4, 1, 1, 2796, 0, 0, 0.553708, 0.796128, 1.53265, 0.13957, -118.55));
218  fourveclist.push_back(createFourVec(6143024, 18358, 54, 2, 9, 0, 2189, 0, 0.135158, 0.856501, 1.85689, -9.529e-10, -118.55));
219  fourveclist.push_back(createFourVec(6143024, 18358, 55, 2, 9, 0, 2230, 0, 0.168227, 0.895446, 1.75205, -2.34859e-09, -118.55));
220  fourveclist.push_back(createFourVec(6143024, 18358, 5, 1, 1, 2795, 0, 0, 1.00236, 0.993059, 1.56782, 0.13957, -118.55));
221  fourveclist.push_back(createFourVec(6143024, 18358, 61, 2, 9, 0, 2293, 0, 0.107901, 1.01144, 1.59207, 3.74977e-10, -118.55));
222  fourveclist.push_back(createFourVec(6143024, 18358, 56, 2, 9, 0, 2232, 0, 0.146151, 0.973198, 1.75205, 1.15832e-09, -118.55));
223  fourveclist.push_back(createFourVec(6143024, 18358, 57, 2, 9, 0, 2233, 0, 0.574076, 1.01187, 1.75205, -1.38236e-08, -118.55));
224 
225  ret.push_back(createJet(6143024, 18358, 2, 2.67293, 0.949761, 1.63687, 0.534153, 0.418847, -118.55, 0.539992, fourveclist));
226 
227  fourveclist.clear();
228 
229  fourveclist.push_back(createFourVec(6143024, 18358, 3, 1, 1, 2797, 0, 0, 0.747889, -0.342101, 1.43174, 0.13957, -118.55));
230  fourveclist.push_back(createFourVec(6143024, 18358, 2, 1, 1, 2798, 0, 0, 1.20774, 0.290082, 1.3077, 0.13957, -118.55));
231  ret.push_back(createJet(6143024, 18358, 3, 1.95208, 0.0483421, 1.35512, 0.684942, 0.0, -118.55, -0.466989, fourveclist));
232 
233  fourveclist.clear();
234 
235  fourveclist.push_back(createFourVec(6143024, 18358, 1, 1, 1, 2799, 0, 0, 0.923283, 0.724552, 0.874879, 0.13957, -118.55));
236  fourveclist.push_back(createFourVec(6143024, 18358, 18, 2, 9, 0, 247, 0, 0.106678, 0.774646, 0.650698, -2.53721e-10, -118.55));
237  ret.push_back(createJet(6143024, 18358, 4, 1.02757, 0.731266, 0.851798, 0.164231, 0.102928, -118.55, 0.262665, fourveclist));
238 
239  fourveclist.clear();
240 
241  fourveclist.push_back(createFourVec(6143024, 18358, 12, 1, 1, 2770, 0, 0, 0.749084, 0.124089, 2.32001, 0.13957, -118.55));
242  ret.push_back(createJet(6143024, 18358, 5, 0.749084, 0.124089, 2.32001, 0.13957, 0.0, -118.55, -0.397547, fourveclist));
243 
244  return ret;
245 }
246 
247 StjJet RunJetFinderTest::createJet(int runNumber, int eventId,
248  int jetId,
249  double pt, double eta, double phi, double m,
250  double neuRt,
251  double vertexZ, double detectorEta,
252  const StjFourVecList& fourVecList)
253 {
254  StjJet ret;
255  ret.runNumber = runNumber;
256  ret.eventId = eventId;
257  ret.jetId = jetId;
258  ret.pt = pt;
259  ret.eta = eta;
260  ret.phi = phi;
261  ret.m = m;
262  ret.neuRt = neuRt;
263  ret.vertexZ = vertexZ;
264  ret.detectorEta = detectorEta;
265  ret.fourVecList = fourVecList;
266  return ret;
267 }
void setConeRadius(double v)
Set cone radius:
Definition: StConePars.h:65
void setAddMidpoints(bool v)
Add seeds at midpoints?
Definition: StConePars.h:56
void setSplitFraction(double v)
split jets if E_shared/E_neighbor&gt;splitFraction
Definition: StConePars.h:50
void setGridSpacing(int nEta, double etaMin, double etaMax, int nPhi, double phiMin, double phiMax)
Set the grid spacing:
Definition: StConePars.h:36
void setDoSplitMerge(bool v)
Do Split/Merge step?
Definition: StConePars.h:59
void setDebug(bool v)
Toggle debug streams on/off.
Definition: StConePars.h:68
void setSeedEtMin(double v)
minimum et threshold to be considered a seed
Definition: StConePars.h:44
void setAssocEtMin(double v)
minimum et threshold to be considered for addition to the seed
Definition: StConePars.h:47
void setRequireStableMidpoints(bool v)
Require stable midpoints?
Definition: StConePars.h:62
void setPerformMinimization(bool v)
Let jet wander to minimum?
Definition: StConePars.h:53