13#ifdef TRKRECO_DEBUG_DETAIL
18#include "TrkReco/TBuilder0.h"
19#include "TrkReco/TMDC.h"
20#include "TrkReco/TMDCWire.h"
21#include "TrkReco/TMDCWireHit.h"
22#include "TrkReco/TMLink.h"
23#include "TrkReco/TCircle.h"
24#include "TrkReco/TLine0.h"
25#include "TrkReco/TTrack.h"
28#include "TrkReco/TWindow.h"
33 _fitter(
"TBuilder0 Fitter"),
39 _stereoMaxSigma(30.) {
44 _fitter(
"TBuilder0 Fitter"),
45 _salvageLevel(salvageLevel),
50 _stereoMaxSigma(30.) {
62 _fitter(
"TBuilder0 Fitter"),
65 _stereoChisq3(stereoChisq3),
66 _stereoChisq4(stereoChisq4),
67 _stereoMaxSigma(stereoMaxSigma),
68 _salvageLevel(salvageLevel) {
84#ifdef TRKRECO_DEBUG_DETAIL
85 std::cout << _name <<
" ... building a rphi track" << std::endl;
86 std::cout << _name <<
" ... selecting good hits" << std::endl;
94#ifdef TRKRECO_DEBUG_DETAIL
95 std::cout << _name <<
" ... rejected by nLinks(";
96 std::cout << list.length() <<
") < ";
104 if (cores.length() < 5) cores = list;
108#ifdef TRKRECO_DEBUG_DETAIL
109 std::cout << _name <<
" ... checking cores : cores=" << std::endl;
110 Dump(cores,
"detail");
114#ifdef TRKRECO_DEBUG_DETAIL
115 std::cout <<
" super layer ptn=" << sLinks;
116 std::cout <<
",super layer used=" << sUsed << std::endl;
118 if (sLinks != sUsed) {
119#ifdef TRKRECO_DEBUG_DETAIL
120 std::cout << _name <<
" ... appending hits to cores" << std::endl;
122 unsigned diff = sLinks - sUsed;
123 unsigned asl[5] = {2, 3, 4, 9, 10};
124 for (
unsigned j = 0; j < 5; j++) {
126 if (diff & (1 << asl[5 - j])) {
127#ifdef TRKRECO_DEBUG_DETAIL
128 std::cout <<
" super layer " << (5 - j) * 2 <<
"searching";
129 std::cout << std::endl;
134 for (
unsigned i = 0; i < links.length(); i++) {
135 double dist = links[i]->hit()->drift();
137#ifdef TRKRECO_DEBUG_DETAIL
138 std::cout <<
" " << links[i]->wire()->name();
139 std::cout <<
" appended (small dist)" << std::endl;
141 cores.append(links[i]);
151#ifdef TRKRECO_DEBUG_DETAIL
152 std::cout <<
" " << best->
wire()->
name();
153 std::cout <<
" appended (best)" << std::endl;
161 unsigned nCores = cores.length();
163 for (
unsigned i = 0; i < nCores; i++) {
169#ifdef TRKRECO_DEBUG_DETAIL
170 std::cout <<
" ... rejected by small number of super layers" << std::endl;
175#ifdef TRKRECO_DEBUG_DETAIL
176 std::cout <<
" ... rejected by small number of layers" << std::endl;
182#ifdef TRKRECO_DEBUG_DETAIL
183 std::cout << _name <<
" ... making a circle : #cores=" << cores.length();
184 std::cout << std::endl;
196#ifdef TRKRECO_DEBUG_DETAIL
197 std::cout <<
" ... rejected by failure of the 1st fit : ";
198 std::cout <<
"err = " << err << std::endl;
207#ifdef TRKRECO_DEBUG_DETAIL
208 std::cout << _name <<
" ... making a track" << std::endl;
220 if (err < 0)
goto discard;
224 if (err < 0)
goto discard;
225#ifdef TRKRECO_DEBUG_DETAIL
226 t->dump(
"detail",
" 1st> ");
233#ifdef TRKRECO_DEBUG_DETAIL
234 std::cout << _name <<
" ... appending non-core hits" << std::endl;
238 if (err < 0)
goto discard;
242 if (err < 0)
goto discard;
246 if (err < 0)
goto discard;
248#ifdef TRKRECO_DEBUG_DETAIL
249 t->dump(
"detail",
" 2nd> ");
256#ifdef TRKRECO_DEBUG_DETAIL
268#ifdef TRKRECO_DEBUG_DETAIL
269 std::cout <<
" ... rejected by fitting failure : ";
270 std::cout <<
" err = " << err << std::endl;
284 for (
unsigned i = 0; i < list.length(); i++) {
285 unsigned state = list[i]->hit()->state();
298#ifdef TRKRECO_DEBUG_DETAIL
299 std::cout << _name <<
"(TBuilder0::selectHits) ... dump of candidates" << std::endl;
300 Dump(list,
"detail");
308#ifdef TRKRECO_DEBUG_DETAIL
309 std::cout << _name <<
"(stereo) ... dump of stereo candidate hits" << std::endl;
310 Dump(list,
"sort flag",
" ");
315#ifdef TRKRECO_DEBUG_DETAIL
316 std::cout << _name <<
"(stereo) ... rejected by nLinks(";
317 std::cout << list.length() <<
") < ";
324 unsigned n = list.length();
326 for (
unsigned i = 0; i <
n; i++) {
343#ifdef TRKRECO_DEBUG_DETAIL
344 std::cout << _name <<
"(stereo) ... dump of sz links" << std::endl;
345 Dump(forLine,
"sort flag",
" ");
350#ifdef TRKRECO_DEBUG_DETAIL
351 std::cout << _name <<
"(stereo) ... rejected by sz nLinks(";
352 std::cout << forLine.length() <<
") < ";
355 HepAListDeleteAll(forLine);
360 unsigned nLine = forLine.length();
365 if (err < 0) err = line.
fit();
370#ifdef TRKRECO_DEBUG_DETAIL
371 std::cout << _name <<
"(stereo) ... linear fit failure. nLinks(";
372 std::cout << forLine.length() <<
")" << std::endl;
374 HepAListDeleteAll(forLine);
378#ifdef TRKRECO_DEBUG_DETAIL
379 std::cout << _name <<
"(stereo) ... dump of left-right" << std::endl;
384 for (
unsigned i = 0; i < nLine; i++) {
402 if ((tl == NULL) && (tr == NULL))
continue;
405 if (tl == NULL) best = tr;
406 else if (tr == NULL) best = tl;
418#ifdef TRKRECO_DEBUG_DETAIL
420 std::cout <<
t->wire()->layerId() <<
"-";
421 std::cout <<
t->wire()->localId();
426 std::cout << std::endl;
429 best->
link(
t->link());
430 forNewLine.append(best);
435#ifdef TRKRECO_DEBUG_DETAIL
436 std::cout << _name <<
"(stereo) ... rejected by lr nLinks(";
437 std::cout << forNewLine.length() <<
") < ";
440 HepAListDeleteAll(forLine);
441 HepAListDeleteAll(forNewLine);
446#ifdef TRKRECO_DEBUG_DETAIL
447 std::cout << _name <<
"(stereo) ... creating a new line" << std::endl;
449 unsigned nNewLine = forNewLine.length();
450 TLine0 newLine(forNewLine);
458 err = newLine.
fit2p();
459 if (err < 0) err = newLine.
fit();
464#ifdef TRKRECO_DEBUG_DETAIL
465 std::cout << _name <<
"(stereo) ... 2nd linear fit failure. nLinks(";
466 std::cout << forNewLine.length() <<
")" << std::endl;
468 HepAListDeleteAll(forLine);
469 HepAListDeleteAll(forNewLine);
491 HepAListDeleteAll(forLine);
492 HepAListDeleteAll(forNewLine);
493#ifdef TRKRECO_DEBUG_DETAIL
494 std::cout <<
" appendStereo cut ... new line 2nd linear fit failure. ";
495 std::cout <<
"# of links = " <<
n <<
"," << nLine;
496 std::cout <<
"," << nNewLine << std::endl;
503 unsigned nn = good.length();
504 for (
unsigned i = 0; i < nn; i++) {
505 track.
append(* good[i]->link());
509 a[4] = track.
charge() * newLine.
a();
523 HepAListDeleteAll(forLine);
524 HepAListDeleteAll(forNewLine);
529 HepAListDeleteAll(forLine);
530 HepAListDeleteAll(forNewLine);
536#ifdef TRKRECO_DEBUG_DETAIL
537 std::cout << _name <<
"(stereo) ... building in 3D" << std::endl;
538 std::cout <<
"... dump of stereo candidate hits" << std::endl;
539 Dump(list,
"sort flag",
" ");
544#ifdef TRKRECO_DEBUG_DETAIL
545 std::cout <<
"... rejected by nLinks(";
546 std::cout << list.length() <<
") < ";
556 unsigned nlyr[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
557 unsigned llyr[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
564 unsigned n = list.length();
566 unsigned iforLine = 0;
567 for (
unsigned i = 0; i <
n; i++) {
571 TMLink * lnext = list[i + 1];
575 int LorR = consectiveHits(* l, * lnext, ichg);
606 if(err1 == 0 && err2 == 0){
607 double deltaZ = fabs(l->
position().y() -
614 l->
zPair(iforLine + 1);
615 lnext->
zPair(iforLine);
617#ifdef TRKRECO_DEBUG_DETAIL
619 std::cout <<
" ... rejected because delta z > 1.5";
620 std::cout << std::endl;
624#ifdef TRKRECO_DEBUG_DETAIL
627 std::cout <<
" ... s-z calculation error with ";
628 std::cout << l->
wire()->
name() << std::endl;
631 std::cout <<
" ... s-z calculation error with ";
632 std::cout << lnext->
wire()->
name() << std::endl;
709#ifdef TRKRECO_DEBUG_DETAIL
710 std::cout <<
"... dump of sz links" << std::endl;
711 Dump(forLine,
"sort flag",
" ");
712 for (
unsigned i = 0; i < 18; i++) {
713 std::cout << i <<
" : " << nlyr[i] <<
", " << llyr[i] << std::endl;
719#ifdef TRKRECO_DEBUG_DETAIL
720 std::cout <<
"... rejected by sz nLinks(";
721 std::cout << forLine.length() <<
") < ";
724 HepAListDeleteAll(forLine);
734 double min_chi2[5] = {9999.,9999.,9999.,9999.,9999.};
735 double min_a[5] = {9999.,9999.,9999.,9999.,9999.};
737#ifdef TRKRECO_DEBUG_DETAIL
743 bool display =
false;
751 for (
unsigned isl=0; isl < 5; isl++) {
755#ifdef TRKRECO_DEBUG_DETAIL
756 std::cout <<
" ... stereo supter layer " << isl << std::endl;
764 ->first()->axialStereoLayerId();
765 unsigned ily2 = ily1 + 1;
766 unsigned ily3 = ily2 + 1;
769 unsigned ilst = llyr[ily1] + 1;
770 unsigned ifst = ilst - nlyr[ily1];
771 for (
unsigned i =ifst; i<ilst; i++) {
772 TMLink & l = * forLine[i];
776 if (l.
zPair() < i ) {
787 unsigned jlst = llyr[ily2] + 1;
788 unsigned jfst = jlst - nlyr[ily2];
789 for (
unsigned j =jfst; j< jlst; j++) {
790 TMLink & l2 = * forLine[j];
794 if (l2.
zPair() < j) {
805 unsigned klst = llyr[ily3] + 1;
806 unsigned kfst = klst - nlyr[ily3];
807 for (
unsigned k=kfst; k < klst; k++) {
808 TMLink & l3 = * forLine[k];
812 if (l3.
zPair() < k) {
836 if (l.
zStatus() == 20 && relation12 < 0)
845 if (l.
zStatus() == 20 && relation23 < 0)
851 if(relation12 || relation23 ) {
852#ifdef TRKRECO_DEBUG_DETAIL
853 std::cout <<
" ... bad relations";
854 std::cout <<
" : segment rejected";
855 Dump(tmpLine,
"detail stereo",
" ");
858 int err = line.
fit();
867 if (l3.
zStatus() == 20) tmpLine.remove(m3);
872 unsigned ntmp = tmpLine.length();
874 std::cout <<
"!!! is this possible !!!???" << std::endl;
877 if(l3.
zStatus() == 20) tmpLine.remove(m3);
883 int err = line.
fit();
885#ifdef TRKRECO_DEBUG_DETAIL
886 std::cout <<
" ... line fit error";
887 std::cout <<
" : segment rejected" << std::endl;
888 Dump(line.
links(),
"detail stereo",
" ");
898 if(l3.
zStatus() == 20) tmpLine.remove(m3);
908 chi2 < min_chi2[isl]) {
910 min_chi2[isl] = chi2;
911 min_a[isl] = line.
a();
912#ifdef TRKRECO_DEBUG_DETAIL
913 std::cout <<
" ... segment accepted : " << std::endl;
916#ifdef TRKRECO_DEBUG_DETAIL
918 std::cout <<
" ... bad quality : segment rejected :";
919 std::cout <<
"chi2=" << chi2;
920 std::cout <<
", b=" << line.
b() << std::endl;
922 Dump(line.
links(),
"detail stereo",
" ");
932 if(l3.
zStatus() ==20) tmpLine.remove(m3);
936 if(l2.
zStatus() ==20) tmpLine.remove(m2);
940 if(l.
zStatus() ==20) tmpLine.remove(m);
945 if(isl==0) gdSLine0 = goodLine;
946 if(isl==1) gdSLine1 = goodLine;
947 goodLine.removeAll();
957 ->first()->axialStereoLayerId();
958 unsigned ily2 = ily1 + 1;
959 unsigned ily3 = ily2 + 1;
960 unsigned ily4 = ily3 + 1;
961 if (nlyr[ily1] == 0 ||
964 nlyr[ily4] == 0)
continue;
967 unsigned ilst = llyr[ily1] + 1;
968 unsigned ifst = ilst - nlyr[ily1];
969 for(
unsigned i =ifst; i<ilst;i++ ){
970 TMLink & l = * forLine[i];
983 unsigned jlst = llyr[ily2] + 1;
984 unsigned jfst = jlst - nlyr[ily2];
985 for(
unsigned j =jfst; j< jlst; j++){
986 TMLink & l2 = * forLine[j];
999 unsigned klst = llyr[ily3] + 1;
1000 unsigned kfst = klst - nlyr[ily3];
1001 for(
unsigned k=kfst; k < klst; k++ ){
1002 TMLink & l3 = * forLine[k];
1015 unsigned hlst = llyr[ily4] + 1;
1016 unsigned hfst = hlst - nlyr[ily4];
1017 for(
unsigned h=hfst; h < hlst; h++ ){
1018 TMLink & l4 = * forLine[h];
1037 int relation12 = -1;
1038 int relation23 = -1;
1039 int relation34 = -1;
1050 if (l.
zStatus() == 20 && relation12 < 0)
1060 if (l.
zStatus() == 20 && relation23 < 0)
1070 if (l3.
zStatus() == 20 && relation34 < 0)
1077 if(relation12 || relation23 || relation34) {
1079#ifdef TRKRECO_DEBUG_DETAIL
1080 std::cout <<
" ... bad relations";
1081 std::cout <<
" : segment rejected";
1082 Dump(tmpLine,
"detail stereo",
" ");
1085 int err = line.
fit();
1094 if(l4.
zStatus() == 20) tmpLine.remove(m4);
1099 unsigned ntmp = tmpLine.length();
1102 if(l4.
zStatus() == 20) tmpLine.remove(m4);
1108 int err = line.
fit();
1110#ifdef TRKRECO_DEBUG_DETAIL
1111 std::cout <<
" ... line fit error";
1112 std::cout <<
" : segment rejected" << std::endl;
1113 Dump(line.
links(),
"detail stereo",
" ");
1123 if(l4.
zStatus() == 20) tmpLine.remove(m4);
1132 chi2 < min_chi2[isl]) {
1136 min_chi2[isl] = chi2;
1137 min_a[isl] = line.
a();
1139#ifdef TRKRECO_DEBUG_DETAIL
1140 std::cout <<
" segment accepted : " << std::endl;
1143#ifdef TRKRECO_DEBUG_DETAIL
1145 std::cout <<
" ... bad quality : segment rejected :";
1146 std::cout <<
" chi2=" << chi2;
1147 std::cout <<
", b=" << line.
b() << std::endl;
1149 Dump(line.
links(),
"detail stereo",
" ");
1159 if(l4.
zStatus() ==20) tmpLine.remove(m4);
1163 if(l3.
zStatus() ==20) tmpLine.remove(m3);
1167 if(l2.
zStatus() ==20) tmpLine.remove(m2);
1171 if(l.
zStatus() ==20) tmpLine.remove(m);
1176 if(isl==2) gdSLine2 = goodLine;
1177 if(isl==3) gdSLine3 = goodLine;
1178 if(isl==4) gdSLine4 = goodLine;
1179 goodLine.removeAll();
1187 unsigned Nsgmnts[5] = {0,0,0,0,0};
1188 Nsgmnts[0] = gdSLine0.length();
1189 Nsgmnts[1] = gdSLine1.length();
1190 Nsgmnts[2] = gdSLine2.length();
1191 Nsgmnts[3] = gdSLine3.length();
1192 Nsgmnts[4] = gdSLine4.length();
1194 unsigned NusedSgmnts = 0;
1195 for(
unsigned jsl = 0; jsl < 5; jsl++) {
1196 if(Nsgmnts[jsl] > 0) NusedSgmnts +=1;
1200 if (NusedSgmnts == 0) {
1201#ifdef TRKRECO_DEBUG_DETAIL
1202 std::cout <<
"... rejected because no segment found" << std::endl;
1204 HepAListDeleteAll(forLine);
1210 forNewLine.append(gdSLine0);
1211 forNewLine.append(gdSLine1);
1212 forNewLine.append(gdSLine2);
1213 forNewLine.append(gdSLine3);
1214 forNewLine.append(gdSLine4);
1217 unsigned nNewLine = forNewLine.length();
1219 TLine0 newLine(forNewLine);
1222 int err = newLine.
fit();
1225 double newLine_a = newLine.
a();
1231 if(((R > 80. && newLine_chi2 > 4.0) ||(R < 80. && newLine_chi2 > 13.0))&& NusedSgmnts > 1){
1233 double max_diff_a = 0.;
1234 unsigned this_sly = 999;
1235 for(
unsigned isl=0; isl < 5; isl++){
1236 if(Nsgmnts[isl]==0)
continue;
1237 double diff_a = fabs((min_a[isl]-newLine_a)/newLine_a);
1238 if(diff_a > max_diff_a){
1239 max_diff_a = diff_a;
1245 if((R< 50. && max_diff_a > 0.4) || (R > 50. && max_diff_a > 0.3)) {
1248 Nsgmnts[this_sly]=0;
1253 }
else if (this_sly == 1){
1255 }
else if (this_sly == 2){
1257 }
else if (this_sly == 3){
1259 }
else if (this_sly == 4){
1264 unsigned NnewLine_2 = newLine.
links().length();
1265 if(NnewLine_2 < 3) {
1266#ifdef TRKRECO_DEBUG_DETAIL
1267 std::cout <<
"... rejected because of few links for line" << std::endl;
1269 HepAListDeleteAll(forLine);
1273 int err = newLine.
fit();
1275#ifdef TRKRECO_DEBUG_DETAIL
1276 std::cout <<
"... rejected because of line fit failure" << std::endl;
1278 HepAListDeleteAll(forLine);
1281 double newLine_chi2_2 = newLine.
chi2()/NnewLine_2;
1287 double maxSigma = 1.0;
1288 if(R < 80) maxSigma = 1.5;
1289 newLine.
refine(bad, maxSigma);
1290 if(newLine.
links().length()< 2) {
1291#ifdef TRKRECO_DEBUG_DETAIL
1292 std::cout <<
"... rejected because of few links for line after refine";
1293 std::cout << std::endl;
1295 HepAListDeleteAll(forLine);
1298 err = newLine.
fit();
1300#ifdef TRKRECO_DEBUG_DETAIL
1301 std::cout <<
"... rejected because of line fit failure(2)" << std::endl;
1303 HepAListDeleteAll(forLine);
1308 for(
unsigned isl = 0; isl < 5; isl++){
1309 if(Nsgmnts[isl] == 0) {
1310 double maxdist = 0.5;
1311 if(R < 80) maxdist = 1.25;
1315 err = newLine.
fit();
1317#ifdef TRKRECO_DEBUG_DETAIL
1318 std::cout <<
"... rejected because of line fit failure(3)" << std::endl;
1320 HepAListDeleteAll(forLine);
1326 newLine.
refine(bad, maxSigma);
1327 if(newLine.
links().length()< 2) {
1328#ifdef TRKRECO_DEBUG_DETAIL
1329 std::cout <<
"... rejected because of few links for line after 2nd refine";
1330 std::cout << std::endl;
1332 HepAListDeleteAll(forLine);
1337 err = newLine.
fit();
1339 HepAListDeleteAll(forLine);
1340#ifdef TRKRECO_DEBUG_DETAIL
1341 std::cout <<
" appendStereo cut ... new line 2nd linear fit failure. ";
1342 std::cout <<
"# of links = " <<
n <<
",";
1343 std::cout <<
"," << nNewLine << std::endl;
1349 unsigned NnewLine_3 = newLine.
links().length();
1350 double newLine_chi2_3 = newLine.
chi2()/NnewLine_3;
1357 unsigned nn = good.length();
1358 for (
unsigned i = 0; i < nn; i++) {
1359 track.
append(* good[i]->link());
1366 a[4] = track.
charge() * newLine.
a();
1371 if (err < 0)
goto discard;
1374 if (err < 0)
goto discard;
1377 if (err < 0)
goto discard;
1380 if (err < 0)
goto discard;
1386 HepAListDeleteAll(forLine);
1391#ifdef TRKRECO_DEBUG_DETAIL
1392 std::cout <<
" ... rejected by fitting failure : ";
1393 std::cout <<
" err = " << err << std::endl;
1395 HepAListDeleteAll(forLine);
1432TBuilder0::checkHits(
unsigned i,
unsigned j,
unsigned isl)
const {
1434 int nWr[5] = {80,128,160,208,256};
1435 int ilast = nWr[isl]-1;
1436 int ilocal = (int) i;
1437 int jlocal = (int) j;
1439 if(ilocal > 0 && ilocal < ilast){
1440 if(fabs(
float(jlocal-ilocal)) > 1 ) {
1445 }
else if(ilocal == 0){
1446 if(jlocal > 1 && jlocal < ilast){
1449 if(jlocal == ilast){
1451 }
else if(jlocal == 0){
1453 }
else if(jlocal == 1){
1459 }
else if(ilocal == ilast){
1460 if(jlocal > 0 && jlocal < ilast-1){
1463 if(jlocal == ilast-1){
1465 }
else if(jlocal == ilast){
1467 }
else if(jlocal == 0){
1482 salvageNormal(
t, hits);
1486#ifdef TRKRECO_DEBUG_DETAIL
1487 std::cout <<
name() <<
" ... salvaging" << std::endl;
1488 std::cout <<
" # of given hits=" << hits.length() << std::endl;
1491 unsigned nHits = hits.length();
1492 if (nHits == 0)
return;
1496 for (
unsigned i = 0; i < nHits; i++) {
1502 candidates.append(l);
1507 t.appendByApproach(candidates, _salvageLevel);
1509 hits.remove(candidates);
1518#ifdef TRKRECO_DEBUG_DETAIL
1519 std::cout <<
name() <<
" ... normal salvaging : ";
1520 std::cout <<
" # of hits=" << hits.length() << std::endl;
1523 unsigned nHits = hits.length();
1524 if (nHits == 0)
return;
1532 for (
unsigned i = 0; i < nHits; i++) {
1535 if (a.cross(h.
xyPosition()).z() *
t.charge() > 0.)
continue;
1539 candidates.append(l);
1543 t.appendByApproach(candidates, 30.);
1545 hits.remove(candidates);
1552TBuilder0::check2CnHits(
TMLink &l,
TMLink &
s,
int ichg)
const {
1555 if(l.
hit()->
wire()->
layerId() !=
s.hit()->wire()->layerId())
return -1;
1558 int nsl[11] = {64,80,96,128,144,160,192,208,240,256,288};
1559 float hcell[50] = {0.,0.,0.,0.,0.,0.,0.687499,0.747198,0.806896,0.,0.,0.,0.,0.,0.,0.782967,0.820598,0.858229,0.,0.,0.,0.,0.,0.878423,0.908646,0.939845,0.970068,0.,0.,0.,0.,0.,0.892908,0.916188,0.940219,0.963499,0.,0.,0.,0.,0.,0.901912,0.920841,0.940382,0.959312,0.,0.,0.,0.,0.};
1563 int jlocal =
s.hit()->wire()->localId();
1566 double ddist2 =
s.hit()->drift() / hcell[
s.hit()->wire()->layerId()];
1567 double ddist = 0.5 * (ddist1 + ddist2);
1570 if (ilocal > 0 && ilocal < ilast) {
1571 if (
abs(jlocal - ilocal) > 1) {
1576 ((ddist1 > 0.7 && ddist2 > 0.7) ||
1577 (ddist1 > 0.95 || ddist2 >0.95))) {
1592 else if (ilocal == 0) {
1593 if (jlocal > 1 && jlocal < ilast) {
1598 ((ddist1 > 0.7 && ddist2 > 0.7) ||
1599 (ddist1 > 0.95 || ddist2 > 0.95))) {
1600 if (jlocal == ilast) {
1610 else if (jlocal == 1) {
1621 else if (ilocal == ilast) {
1622 if(jlocal > 0 && jlocal < ilast-1) {
1627 ((ddist1 > 0.7 && ddist2 > 0.7) ||
1628 (ddist1 > 0.95 || ddist2 > 0.95))) {
1629 if (jlocal == ilast-1) {
1636 }
else if(jlocal == 0){
1654TBuilder0::consectiveHits(
TMLink & l,
TMLink &
s,
int ichg)
const {
1657 static float hcell[50] = {0.,0.,0.,0.,0.,0.,
1658 0.687499,0.747198,0.806896,
1660 0.782967,0.820598,0.858229,
1662 0.878423,0.908646,0.939845,0.970068,
1664 0.892908,0.916188,0.940219,0.963499,
1666 0.901912,0.920841,0.940382,0.959312,
1679 unsigned layerId = wire.
layerId();
1680 double ddist1 = l.
hit()->
drift() / hcell[layerId];
1681 double ddist2 =
s.hit()->drift() / hcell[layerId];
1682 double ddist = 0.5 * (ddist1 + ddist2);
1686 ((ddist1 > 0.7 && ddist2 > 0.7) || (ddist1 > 0.95 || ddist2 > 0.95))) {
1689 if (ichg > 0)
return 1;
double abs(const EvtComplex &c)
const HepPoint3D ORIGIN
Constants.
#define WireHitContinuous
#define WireHitFittingValid
#define WireHitConformalFinder
void Dump(const CAList< TMLink > &links, const std::string &message=std::string(""), const std::string &prefix=std::string(""))
dumps TMLinks.
AList< TMLink > SameSuperLayer(const AList< TMLink > &list, const TMLink &a)
returns links which are in the same super layer as 'a' or 'id'.
unsigned SuperLayer(const AList< TMLink > &list)
returns super layer pattern.
unsigned NLayers(const AList< TMLink > &links)
returns # of layers.
unsigned NSuperLayers(const AList< TMLink > &links)
returns # of layers.
#define TrackOldConformalFinder
const HepVector & a(void) const
returns helix parameters.
TTrack * buildRphi(const AList< TMLink > &) const
builds a r/phi track from TMLinks or from Segments.
const TMSelector & trackSelector(void) const
returns a track selector.
virtual ~TBuilder0()
Destructor.
TMSelector _circleSelector
TTrack * buildStereo0(TTrack &track, const AList< TMLink > &) const
appends stereo hits to a track. (old version)
TMSelector _trackSelector
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
const std::string & name(void) const
returns name.
TBuilder0(const std::string &name)
Constructor.
virtual TTrack * buildStereo(TTrack &track, const AList< TMLink > &) const
appends stereo hits to a track.
void salvage(TTrack &track, AList< TMLink > &list) const
salvages links in a list. Used links will be removed from a list.
virtual int fit(TTrackBase &) const
fits a track using a private fitter.
void appendClusters(TTrack &track, const AList< TMLink > &) const
appends TMLinks in a list.
A class to represent a circle in tracking.
A class to represent a track in tracking.
int fit2sp()
fits itself using single hits in a wire-layer. Error was happened if return value is not zero.
double chi2(void) const
returns chi2.
double distance(const TMLink &) const
returns distance to a position of TMLink itself. (not to a wire)
void appendByszdistance(AList< TMLink > &list, unsigned isl, float maxSigma)
double b(void) const
returns coefficient b.
double reducedChi2(void) const
returns reduced-chi2.
void removeChits()
remove extremly bad points.
void removeSLY(AList< TMLink > &list)
int fit2p()
fits itself using isolated hits. Error was happened if return value is not zero.
void refine(AList< TMLink > &list, float maxSigma)
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling...
double a(void) const
returns coefficient a.
unsigned axialStereoLayerId(void) const
returns id of axial or stereo id.
unsigned nWires(void) const
returns # of wires.
unsigned state(void) const
returns state.
float drift(unsigned) const
returns drift distance.
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
const HepPoint3D & xyPosition(void) const
returns drift time
A class to represent a wire in MDC.
bool consective(const TMDCWire &) const
returns true if a given wire is consective in a layer.
const TMDCLayer *const layer(void) const
returns a pointer to a layer.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
unsigned superLayerId(void) const
returns super layer id.
std::string name(void) const
returns name.
static TMDC * getTMDC(void)
const AList< TMDCLayer > *const superLayer(unsigned id) const
returns a pointer to a super-layer. 0 will be returned if 'id' is invalid.
A class to relate TMDCWireHit and TTrack objects.
TMLink * link(void) const
returns a pointer to a TMLink.
int zPair(void) const
returns id# of the pair, if zStatus == 20 (2 consective hits).
unsigned leftRight(void) const
returns left-right. 0:left, 1:right, 2:wire
int zStatus(void) const
returns stauts of stereo hit
const TMDCWireHit * hit(void) const
returns a pointer to a hit.
const HepPoint3D & position(void) const
returns position.
const TMDCWire *const wire(void) const
returns a pointer to a wire.
A class to select a TTrackBase object.
double maxDistance(void) const
returns max. distance required for stereo hits.
unsigned nSuperLayers(void) const
returns min. # of super layers required.
double maxImpact(void) const
returns max. impact(2D) required.
unsigned nLinks(void) const
returns min. # of hits(TMLinks) requried.
double maxSigma(void) const
returns max. sigma for each TMLink.
unsigned nLinksStereo(void) const
returns min. # of stereo hits(TMLinks) requried.
double minPt(void) const
returns min. pt required.
bool preSelect(const TTrackBase &) const
returns true if given track satisfys criteria before fitting.
bool select(TTrackBase &) const
returns true if given track satisfys criteria after fitting.
virtual int fit(void)
fits itself by a default fitter. Error was happened if return value is not zero.
virtual void refine(AList< TMLink > &list, double maxSigma)
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
void append(TMLink &)
appends a TMLink.
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
void appendByApproach(AList< TMLink > &list, double maxSigma)
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when ...
A class to represent a track in tracking.
const Helix & helix(void) const
returns helix parameter.
int szPosition(TMLink &link) const
calculates arc length and z for a stereo hit.
double charge(void) const
returns charge.