9#include "CLHEP/String/Strings.h"
26#define DEBUG_CURL_DUMP 0
27#define DEBUG_CURL_SEGMENT 0
28#define DEBUG_CURL_GNUPLOT 0
29#define DEBUG_CURL_MC 0
31#if (DEBUG_CURL_DUMP+DEBUG_CURL_GNUPLOT+DEBUG_CURL_MC)
37static int debugMcFlag = 1;
44 : m_builder(
"CurlBuilder"),
45 m_fitter(
"TCurlFinder Fitter"),
46 m_debugCdcFrame(
false),
48 m_debugFileNumber(0) {
55 const unsigned min_salvage,
56 const double bad_distance_for_salvage,
57 const double good_distance_for_salvage,
58 const unsigned min_sequence,
59 const unsigned min_fullwire,
60 const double range_for_axial_search,
61 const double range_for_stereo_search,
62 const unsigned superlayer_for_stereo_search,
63 const double range_for_axial_last2d_search,
64 const double range_for_stereo_last2d_search,
65 const double trace2d_distance,
66 const double trace2d_first_distance,
67 const double trace3d_distance,
68 const unsigned determine_one_track,
70 const double selector_max_impact,
71 const double selector_max_sigma,
72 const double selector_strange_pz,
73 const double selector_replace_dz,
75 const unsigned stereo_2dfind,
76 const unsigned merge_exe,
77 const double merge_ratio,
78 const double merge_z_diff,
79 const double mask_distance,
80 const double ratio_used_wire,
81 const double range_for_stereo1,
82 const double range_for_stereo2,
83 const double range_for_stereo3,
84 const double range_for_stereo4,
85 const double range_for_stereo5,
86 const double range_for_stereo6,
89 const double z_diff_for_last_attend,
90 const unsigned svd_reconstruction,
91 const double min_svd_electrons,
92 const unsigned on_correction,
93 const unsigned output_2dtracks,
94 const unsigned curl_version,
97 const double minimum_seedLength,
98 const double minimum_2DTrackLength,
99 const double minimum_3DTrackLength,
100 const double minimum_closeHitsLength,
101 const double MIN_RADIUS_OF_STRANGE_TRACK,
102 const double ULTIMATE_MIN_RADIUS_OF_STRANGE_TRACK)
103 : m_builder(
"CurlBuilder"),
104 m_fitter(
"TCurlFinder Fitter"),
105 m_debugCdcFrame(
false),
107 m_debugFileNumber(0) {
108 StatusCode scmgn = Gaudi::svcLocator()->service(
"MagneticFieldSvc",m_pmgnIMF);
109 if(scmgn!=StatusCode::SUCCESS) {
110 std::cout<< __FILE__<<
" Unable to open Magnetic field service"<<std::endl;
147 m_param.
Z_CUT = z_cut;
176 return std::string(
"Curling Track Finder");
181 return std::string(
"3.00");
190 if( (*a)->maxSeq() < (*b)->maxSeq() ){
192 }
else if( (*a)->maxSeq() == (*b)->maxSeq() ){
203 if( (*a)->maxSeq() < (*b)->maxSeq() ){
205 }
else if( (*a)->maxSeq() == (*b)->maxSeq() ){
216 if( (*a)->position().x() > (*b)->position().x() ){
218 }
else if( (*a)->position().x() == (*b)->position().x() ){
229 if( (*a)->position().x() > (*b)->position().x() ){
231 }
else if( (*a)->position().x() == (*b)->position().x() ){
242TCurlFinder::distance(
const double x,
const double y)
const {
243 return sqrt(x*x+
y*
y);
247TCurlFinder::offset(
const unsigned layerId)
const {
250 if( layerId == 0 || layerId == 2 || layerId == 4 ||
251 layerId == 6 || layerId == 8 || layerId == 9 ||
252 layerId == 11 || layerId == 13 || layerId == 15 ||
253 layerId == 17 || layerId == 18 || layerId == 20 ||
254 layerId == 22 || layerId == 24 || layerId == 26 ||
255 layerId == 27 || layerId == 29 || layerId == 31 ||
256 layerId == 33 || layerId == 35 || layerId == 36 ||
257 layerId == 38 || layerId == 40 || layerId == 42 ||
258 layerId == 44 || layerId == 45 || layerId == 47 ||
259 layerId == 49 )
return 1;
264TCurlFinder::layerId(
const double &R)
const {
287 if(r < 73.0 || r > 772.2)
return 43;
288 if(r <= 85.0)
return 0;
if(r <= 97.0)
return 1;
if(r <= 109.0)
return 2;
289 if(r <= 121.0)
return 3;
if(r <= 133.0)
return 4;
if(r <= 145.0)
return 5;
290 if(r <= 157.0)
return 6;
if(r <= 179.0)
return 7;
if(r <= 205.2)
return 8;
291 if(r <= 221.4)
return 9;
if(r <= 237.6)
return 10;
if(r <= 253.8)
return 11;
292 if(r <= 270.0)
return 12;
if(r <= 286.2)
return 13;
if(r <= 302.4)
return 14;
293 if(r <= 318.6)
return 15;
if(r <= 334.8)
return 16;
if(r <= 351.0)
return 17;
294 if(r <= 367.2)
return 18;
if(r <= 387.45)
return 19;
if(r <= 407.7)
return 20;
295 if(r <= 423.9)
return 21;
if(r <= 440.1)
return 22;
if(r <= 456.3)
return 23;
296 if(r <= 472.5)
return 24;
if(r <= 488.7)
return 25;
if(r <= 504.9)
return 26;
297 if(r <= 521.1)
return 27;
if(r <= 537.3)
return 28;
if(r <= 554.5)
return 29;
298 if(r <= 569.7)
return 30;
if(r <= 585.9)
return 31;
if(r <= 602.1)
return 32;
299 if(r <= 618.3)
return 33;
if(r <= 634.5)
return 34;
if(r <= 654.75)
return 35;
300 if(r <= 675.0)
return 36;
if(r <= 691.2)
return 37;
if(r <= 707.4)
return 38;
301 if(r <= 723.6)
return 39;
if(r <= 739.8)
return 40;
if(r <= 756.0)
return 41;
302 if(r <= 772.2)
return 42;
306TCurlFinder::maxLocalLayerId(
const unsigned superLayerId)
const {
316 if(superLayerId == 10)
return 2;
317 if(superLayerId >= 0 && superLayerId < 10)
return 3;
319 std::cerr <<
"Error in the CurlFinder(maxLocalLayerId). superLayerId = "
320 << superLayerId << std::endl;
325TCurlFinder::nextSuperAxialLayerId(
const unsigned superLayerId,
const int in)
const {
334 if(superLayerId > 10 || superLayerId < 0){
335 std::cerr <<
"Error in the CurlFinder(nextSuperAxialLayerId)." << std::endl;
340 if(superLayerId == 2 || superLayerId == 3 ||
341 superLayerId == 4 || superLayerId == 9 ||
350 if((superLayerId == 3 ) && in == 1)
return 2;
351 if(superLayerId == 4){
352 if(in == 1)
return 3;
if(in == 2)
return 2;
354 if(superLayerId == 5 || superLayerId == 6 ||
355 superLayerId == 7 || superLayerId == 8 ||
357 if(in == 1)
return 4;
if(in == 2)
return 3;
360 if(superLayerId == 10){
361 if(in == 1)
return 9;
if(in == 2)
return 4;
362 if(in == 3)
return 3;
if(in == 4)
return 2;
365 if(superLayerId == 0 || superLayerId == 1){
366 if(in == -1)
return 2;
if(in == -2)
return 3;
367 if(in == -3)
return 4;
if(in == -4)
return 9;
368 if(in == -5)
return 10;
370 if( superLayerId == 2){
371 if(in == -1)
return 3;
if(in == -2)
return 4;
372 if(in == -3)
return 9;
if(in == -4)
return 10;
374 if(superLayerId == 3){
375 if(in == -1)
return 4;
if(in == -2)
return 9;
376 if(in == -3)
return 10;
378 if(superLayerId == 4){
379 if(in == -1)
return 9;
if(in == -2)
return 10;
381 if(superLayerId == 5 || superLayerId == 6 ||
382 superLayerId == 7 || superLayerId == 8 ||
384 if(in == -1)
return 10;
391TCurlFinder::nextSuperStereoLayerId(
const unsigned superLayerId,
const int in)
const {
400 if(superLayerId > 10 || superLayerId < 0){
401 std::cerr <<
"Error in the CurlFinder(nextSuperStereoLayerId)." << std::endl;
406 if(superLayerId == 0 || superLayerId == 1 ||
407 superLayerId == 5 || superLayerId == 6 ||
408 superLayerId == 7 || superLayerId == 8){
415 if((superLayerId == 1 || superLayerId == 2 ||
416 superLayerId == 3 || superLayerId == 4) && in == 1)
return 0;
417 if(superLayerId == 5){
418 if(in == 1)
return 1;
if(in == 2)
return 0;
420 if(superLayerId == 6){
421 if(in == 1)
return 5;
if(in == 2)
return 1;
424 if(superLayerId == 7){
425 if(in == 1)
return 6;
if(in == 2)
return 5;
426 if(in == 3)
return 1;
if(in == 4)
return 0;
428 if(superLayerId == 8){
429 if(in == 1)
return 7;
if(in == 2)
return 6;
430 if(in == 3)
return 5;
if(in == 4)
return 1;
433 if(superLayerId == 9 || superLayerId == 10){
434 if(in == 1)
return 8;
if(in == 2)
return 7;
435 if(in == 3)
return 6;
if(in == 4)
return 5;
436 if(in == 5)
return 1;
if(in == 6)
return 0;
439 if(superLayerId == 0){
440 if(in == -1)
return 1;
if(in == -2)
return 5;
441 if(in == -3)
return 6;
if(in == -4)
return 7;
442 if(in == -5)
return 8;
444 if(superLayerId == 1 || superLayerId == 2 ||
445 superLayerId == 3 || superLayerId == 4){
446 if(in == -1)
return 5;
if(in == -2)
return 6;
447 if(in == -3)
return 7;
if(in == -4)
return 8;
449 if(superLayerId == 5){
450 if(in == -1)
return 6;
if(in == -2)
return 7;
451 if(in == -3)
return 8;
453 if(superLayerId == 6){
454 if(in == -1)
return 7;
if(in == -2)
return 8;
456 if(superLayerId == 7){
457 if(in == -1)
return 8;
464TCurlFinder::nAxialHits(
const double &r)
const {
466 const double eps = 0.2;
502 if(r < 20.52-
eps)
return 0;
503 else if(r < 22.14-
eps)
return 1;
504 else if(r < 23.76-
eps)
return 2;
505 else if(r < 25.38-
eps)
return 3;
506 else if(r < 27.0-
eps)
return 4;
507 else if(r < 28.62-
eps)
return 5;
508 else if(r < 30.24-
eps)
return 6;
509 else if(r < 31.86-
eps)
return 7;
510 else if(r < 33.48-
eps)
return 8;
511 else if(r < 35.1-
eps)
return 9;
512 else if(r < 36.72-
eps)
return 10;
513 else if(r < 38.34-
eps)
return 11;
514 else if(r < 67.5-
eps)
return 12;
515 else if(r < 69.12-
eps)
return 13;
516 else if(r < 70.74-
eps)
return 14;
517 else if(r < 72.36-
eps)
return 15;
518 else if(r < 73.98-
eps)
return 16;
519 else if(r < 75.6-
eps)
return 17;
520 else if(r < 77.22-
eps)
return 18;
533 madeList.removeAll();
534 for(
unsigned i = 0, size = originalList.length(); i < size; ++i)
535 madeList.append(originalList[i]->list());
536 madeList.remove(removeList);
546 madeList.removeAll();
547 madeList.append(originalList);
548 madeList.remove(removeList);
555 HepAListDeleteAll(m_allAxialHitsOriginal);
556 HepAListDeleteAll(m_allStereoHitsOriginal);
557 HepAListDeleteAll(m_segmentList);
558 HepAListDeleteAll(m_allCircles);
559 HepAListDeleteAll(m_allTracks);
561 m_unusedAxialHitsOriginal.removeAll();
562 m_unusedStereoHitsOriginal.removeAll();
563 m_unusedAxialHits.removeAll();
564 m_unusedStereoHits.removeAll();
565 m_removedHits.removeAll();
566 m_circles.removeAll();
567 m_tracks.removeAll();
568 m_2dTracks.removeAll();
570 for(
int i=0;i<19;++i)
571 m_unusedAxialHitsOnEachLayer[i].removeAll();
572 for(
int i=0;i<24;++i)
573 m_unusedStereoHitsOnEachLayer[i].removeAll();
575 m_unusedAxialHitsOnEachSuperLayer[i].removeAll();
577 m_unusedStereoHitsOnEachSuperLayer[i].removeAll();
578 m_hitsOnInnerSuperLayer.removeAll();
589#if (DEBUG_CURL_DUMP+DEBUG_CURL_GNUPLOT+DEBUG_CURL_MC)
590 Belle_event_Manager &evtMgr = Belle_event_Manager::get_manager();
592 if(evtMgr.count() != 0 &&
593 evtMgr[0].ExpMC() != 2)debugMcFlag = 0;
594 m_debugCdcFrame =
false;
598 std::cout <<
"(TCurlFinder)Plot Menu : All Off = 0, Interactive = 1, All On = 2" << std::endl;
599 cin >> m_debugPlotFlag;
603 makeWireHitsListsSegments(axialHits, stereoHits);
604#if DEBUG_CURL_SEGMENT
605 std::cout <<
"(TCurlFinder)# of segment = " << m_segmentList.length() << std::endl;
606 debugCheckSegments0();
607 debugCheckSegments1();
608 debugCheckSegments2();
611 if(checkSortSegments() == 0)
return 0;
615 if(m_debugPlotFlag == 1){
616 std::cout <<
"(TCurlFinder) Do you want to see Segment Plot? : yes = 1, no = other #" << std::endl;
620 for(
int i=0;i<m_segmentList.length();++i)
621 plotSegment(m_segmentList[i]->list(),0);
626 makeCurlTracks(tracks,tracks2D);
628 makeWithMC(axialHits, stereoHits, tracks);
632 unsigned n = tracks2D.length();
633 for (
unsigned i = 0; i <
n; i++)
653 unsigned size = axialList.length();
654 for(
unsigned i=0;i<size;++i){
655 if(axialList[i]->reccdc()->tdc > 500)
continue;
657 m_allAxialHitsOriginal.append(
new TMLink(0,axialList[i]));
658 if(axialList[i]->wire()->superLayerId() <= 3)
659 m_hitsOnInnerSuperLayer.append(axialList[i]);
663 size = m_allAxialHitsOriginal.length();
664 for(
unsigned i=0;i<size;++i){
665 if(!(m_allAxialHitsOriginal[i]->hit()->state() &
WireHitUsed)){
667 unsigned newState = m_allAxialHitsOriginal[i]->hit()->state()&(~WireHitInvalidForFit);
668 m_allAxialHitsOriginal[i]->hit()->state(newState);
670 m_unusedAxialHitsOriginal.append(m_allAxialHitsOriginal[i]);
673 m_unusedAxialHits = m_unusedAxialHitsOriginal;
675 size = stereoList.length();
676 for(
unsigned i=0;i<size;++i){
677 if (stereoList[i]->reccdc()->tdc > 500)
continue;
679 m_allStereoHitsOriginal.append(
new TMLink(0,stereoList[i]));
680 if(stereoList[i]->wire()->superLayerId() <= 3)
681 m_hitsOnInnerSuperLayer.append(stereoList[i]);
684 size = m_allStereoHitsOriginal.length();
685 for(
unsigned i=0;i<size;++i){
686 if(!(m_allStereoHitsOriginal[i]->hit()->state() &
WireHitUsed)){
688 unsigned newState = m_allStereoHitsOriginal[i]->hit()->state()&(~WireHitInvalidForFit);
689 m_allStereoHitsOriginal[i]->hit()->state(newState);
691 m_unusedStereoHitsOriginal.append(m_allStereoHitsOriginal[i]);
694 m_unusedStereoHits = m_unusedStereoHitsOriginal;
697 size = m_unusedAxialHitsOriginal.length();
698 for(
unsigned i=0;i<size;++i){
699 m_unusedAxialHitsOnEachLayer[m_unusedAxialHitsOriginal[i]->hit()->wire()->
700 axialStereoLayerId()].append(m_unusedAxialHitsOriginal[i]);
702 size = m_unusedStereoHitsOriginal.length();
703 for(
unsigned i=0;i<size;++i){
704 m_unusedStereoHitsOnEachLayer[m_unusedStereoHitsOriginal[i]->hit()->wire()->
705 axialStereoLayerId()].append(m_unusedStereoHitsOriginal[i]);
709 linkNeighboringWires(m_unusedAxialHitsOnEachLayer,19);
710 linkNeighboringWires(m_unusedStereoHitsOnEachLayer,24);
715 m_segmentList.removeAll();
716 for(
unsigned i=0;i<5;++i)
717 if(m_unusedAxialHitsOnEachSuperLayer[i].length() > 0)
718 createSegments(m_unusedAxialHitsOnEachSuperLayer[i]);
719 for(
unsigned i=0;i<6;++i)
720 if(m_unusedStereoHitsOnEachSuperLayer[i].length() > 0)
721 createSegments(m_unusedStereoHitsOnEachSuperLayer[i]);
731 for(
int i=0;i<
num;++i){
732 if(list[i].length() == 0)
continue;
733 for(
int j=0;j<list[i].length();++j){
737 if( i == 0 || i == 4 || i == 8 ||
738 i == 12 || i == 16)
goto outer;
740 if( i == 0 || i == 4 ||
741 i == 8 || i == 12 || i == 16 || i == 20 )
goto outer;
744 for(
int k=0;k<list[i-1].length();++k){
745 if(list[i-1][k]->hit()->wire()->localId() ==
746 list[i][j]->wire()->neighbor(1)->localId())
747 setNeighboringWires(list[i][j], list[i-1][k]);
748 else if(list[i-1][k]->hit()->wire()->localId() ==
749 list[i][j]->wire()->neighbor(0)->localId())
750 setNeighboringWires(list[i][j], list[i-1][k]);
755 if( i == 3 || i == 7 || i == 11 ||
756 i == 15 || i == 18)
goto same;
758 if( i == 3 || i == 7 || i == 11 ||
759 i == 15 || i == 19 || i == 23 )
goto same;
761 for(
int k=0;k<list[i+1].length();++k){
762 if(list[i+1][k]->hit()->wire()->localId() ==
763 list[i][j]->hit()->wire()->neighbor(4)->localId())
764 setNeighboringWires(list[i][j], list[i+1][k]);
765 else if(list[i+1][k]->wire()->localId() ==
766 list[i][j]->wire()->neighbor(5)->localId())
767 setNeighboringWires(list[i][j], list[i+1][k]);
771 for(
int k=0;k<list[i].length();++k){
772 if(list[i][k]->hit()->wire()->localId() ==
773 list[i][j]->hit()->wire()->localIdForPlus()+1){
774 setNeighboringWires(list[i][j], list[i][k]);
775 }
else if(list[i][k]->hit()->wire()->localId() ==
776 list[i][j]->hit()->wire()->localIdForMinus()-1){
777 setNeighboringWires(list[i][j], list[i][k]);
785TCurlFinder::setNeighboringWires(
TMLink *list,
const TMLink *next) {
788 for(
int i=0;i<6;++i){
797TCurlFinder::createSuperLayer(
void) {
799 for(
int i=0;i<4;++i){
800 if(m_unusedAxialHitsOnEachLayer[i].length() > 0)
801 m_unusedAxialHitsOnEachSuperLayer[0].append(m_unusedAxialHitsOnEachLayer[i]);
802 if(m_unusedAxialHitsOnEachLayer[i+4].length() > 0)
803 m_unusedAxialHitsOnEachSuperLayer[1].append(m_unusedAxialHitsOnEachLayer[i+4]);
804 if(m_unusedAxialHitsOnEachLayer[i+8].length() > 0)
805 m_unusedAxialHitsOnEachSuperLayer[2].append(m_unusedAxialHitsOnEachLayer[i+8]);
806 if(m_unusedAxialHitsOnEachLayer[i+12].length() > 0)
807 m_unusedAxialHitsOnEachSuperLayer[3].append(m_unusedAxialHitsOnEachLayer[i+12]);
808 if(m_unusedAxialHitsOnEachLayer[i+16].length() > 0 && i+16 < 19)
809 m_unusedAxialHitsOnEachSuperLayer[4].append(m_unusedAxialHitsOnEachLayer[i+16]);
811 for(
int i=0;i<4;++i){
812 if(m_unusedStereoHitsOnEachLayer[i].length() > 0)
813 m_unusedStereoHitsOnEachSuperLayer[0].append(m_unusedStereoHitsOnEachLayer[i]);
814 if(m_unusedStereoHitsOnEachLayer[i+4].length() > 0)
815 m_unusedStereoHitsOnEachSuperLayer[1].append(m_unusedStereoHitsOnEachLayer[i+4]);
816 if(m_unusedStereoHitsOnEachLayer[i+8].length() > 0)
817 m_unusedStereoHitsOnEachSuperLayer[2].append(m_unusedStereoHitsOnEachLayer[i+8]);
818 if(m_unusedStereoHitsOnEachLayer[i+12].length() > 0)
819 m_unusedStereoHitsOnEachSuperLayer[3].append(m_unusedStereoHitsOnEachLayer[i+12]);
820 if(m_unusedStereoHitsOnEachLayer[i+16].length() > 0)
821 m_unusedStereoHitsOnEachSuperLayer[4].append(m_unusedStereoHitsOnEachLayer[i+16]);
822 if(m_unusedStereoHitsOnEachLayer[i+20].length() > 0)
823 m_unusedStereoHitsOnEachSuperLayer[5].append(m_unusedStereoHitsOnEachLayer[i+20]);
834 maxLocalLayerId(list[0]->hit()->wire()
841 searchSegment(seed, list, seedStock, segment);
842 if(seedStock.length() > 0){
844 seedStock.remove(seed);
848 m_segmentList.append(segment);
850 std::cout <<
"Segment # = " << m_segmentList.length() << std::endl;
856 }
while(list.length() > 0);
862 for(
int i=0;i<6;++i){
864 if(!findLink(seed->
neighbor(i),list))
continue;
866 seedStock.append(seed->
neighbor(i));
879 unsigned size = list.length();
880 if(size == 0)
return NULL;
881 for(
unsigned i=0;i<size;++i){
882 if(seed == list[i])
return list[i];
892TCurlFinder::checkSortSegments(
void) {
895 std::cout <<
"(TCurlFinder)checking and sorting segments..." << std::endl;
897 unsigned length = m_segmentList.length();
898 if(length == 0)
return 0;
899 checkExceptionalSegmentsType03();
901 checkExceptionalSegmentsType01();
904 std::cout <<
"(TCurlFinder)...done check and sort of segments." << std::endl;
910TCurlFinder::checkExceptionalSegmentsType03(
void) {
913 if(
max == 7)nMinWires = 21;
914 else if(
max == 6)nMinWires = 19;
915 else if(
max == 5)nMinWires = 18;
916 else if(
max == 4)nMinWires = 16;
917 else if(
max == 3)nMinWires = 14;
918 else if(
max == 2)nMinWires = 12;
919 else if(
max == 1)nMinWires = 10;
920 else if(
max == 0)nMinWires = 7;
923 for(
unsigned i = 0, length = m_segmentList.length(); i < length; ++i){
924 if(m_segmentList[i]->size() >= nMinWires){
925 unsigned nWires = m_segmentList[i]->size();
926 unsigned n6Wires = 0;
927 for(
unsigned j=0;j<nWires;++j){
928 if(((m_segmentList[i]->list())[j])->neighbor(5))++n6Wires;
929 if(n6Wires >
max)
break;
931 if(n6Wires <=
max)
continue;
932 removeList.append(m_segmentList[i]);
933#if DEBUG_CURL_SEGMENT
934 writeSegment(m_segmentList[i]->list(),3);
938 if(removeList.length() >= 1){
940 std::cout <<
"(TCurlFinder)removing large segments: # = " << removeList.length() << std::endl;
942 m_segmentList.remove(removeList);
943 HepAListDeleteAll(removeList);
948TCurlFinder::checkExceptionalSegmentsType02(
void) {
952 for(
unsigned i = 0, length = m_segmentList.length(); i < length; ++i){
953 int lSize =
max*3+hmax*3;
955 if(m_segmentList[i]->superLayerId() == 1 ||
956 m_segmentList[i]->superLayerId() == 3){
960 if(m_segmentList[i]->superLayerId() == 5 ||
961 m_segmentList[i]->superLayerId() == 7 ||
962 m_segmentList[i]->superLayerId() == 9){
963 lSize =
max*2+hmax*2;
966 if(m_segmentList[i]->superLayerId() == 4 ||
967 m_segmentList[i]->superLayerId() == 6 ||
968 m_segmentList[i]->superLayerId() == 8 ||
969 m_segmentList[i]->superLayerId() == 10)lSize =
max*3+hmax*2;
970 if(m_segmentList[i]->size() < lSize)
continue;
972 for(
unsigned j=0,size=m_segmentList[i]->maxLocalLayerId();j<size;++j){
973 if(m_segmentList[i]->sizeOfLayer(j) >=
max)++nL;
975 if(nL < lNum)
continue;
976 removeList.append(m_segmentList[i]);
978#if DEBUG_CURL_SEGMENT
982 if(removeList.length() >= 1){
984 std::cout <<
"(TCurlFinder)removing large segments: # = " << removeList.length() << std::endl;
986 m_segmentList.remove(removeList);
987 HepAListDeleteAll(removeList);
992TCurlFinder::checkExceptionalSegmentsType01(
void) {
993 for(
unsigned i = 0, length = m_segmentList.length(); i < length; ++i){
994 if(m_segmentList[i]->maxLocalLayerId() != m_segmentList[i]->layerIdOfMaxSeq() &&
996 unsigned innerHits = 0;
997 if(m_segmentList[i]->layerIdOfMaxSeq() == 0)
continue;
999 m_segmentList[i]->maxLocalLayerId());
1000 for(
unsigned j = 0, size = m_segmentList[i]->size(); j < size; ++j){
1001 if(m_segmentList[i]->layerIdOfMaxSeq()+1 <=
1002 (m_segmentList[i]->list())[j]->hit()->wire()->localLayerId() &&
1003 (m_segmentList[i]->list())[j]->hit()->wire()->localLayerId() <=
1004 m_segmentList[i]->maxLocalLayerId()){
1005 outer->
append((m_segmentList[i]->list())[j]);
1006 }
else if(m_segmentList[i]->layerIdOfMaxSeq()-1 >=
1007 (m_segmentList[i]->list())[j]->hit()->wire()->localLayerId()){
1011 if(innerHits != 0 && outer->
size() != 0){
1013 std::cout <<
"(TCurlFinder)removing some wires in the segment." << std::endl;
1015#if DEBUG_CURL_SEGMENT
1044 for(
unsigned i = 0, size = m_segmentList.length(); i < size; ++i){
1045 TCircle *circle = make2DTrack(segmentList[i]->list(), segmentList, 1);
1049 std::cout <<
"(TCurlFinder) 2D:Created Circle!!!" << std::endl;
1050 if(m_debugPlotFlag){
1052 if(m_debugPlotFlag == 1){
1053 std::cout <<
"(TCurlFinder) Do you want to see Circle Plot(2D)? : yes = 1, no = other #" << std::endl;
1056 if(noPlot == 1)plotCircle(*circle,0);
1069 if(
TCircle *dividedCircle = dividing2DTrack(circle)){
1071 std::cout <<
"(TCurlFinder) 2D:dividing...good...2 Circles!!!" << std::endl;
1074 int ok2d[2] = { 0, 0 };
1075 int ok3d[2] = { 0, 0 };
1078 if(trace2DTrack(circle) &&
1079 check2DCircle(circle) &&
1083 std::cout <<
"(TCurlFinder) 2D:Success Circle Fit!!!" << std::endl;
1085 track1 = make3DTrack(circle, segmentList);
1089 if(trace2DTrack(dividedCircle) &&
1090 check2DCircle(dividedCircle) &&
1091 dividedCircle->fitForCurl(1) != -1){
1094 std::cout <<
"(TCurlFinder) 2D:Success Circle Fit!!!" << std::endl;
1096 track2 = make3DTrack(dividedCircle, segmentList);
1098 if(track1 && track2){
1100 std::cout <<
"(TCurlFinder) 3D:Create Track!!! in track1 && track2" << std::endl;
1102 salvage3DTrack(track1,
true);
1103 salvage3DTrack(track2,
true);
1105 std::cout <<
"(TCurlFinder) 1:dz = " << track1->helix().dz()
1106 <<
", 2:dz = " << track2->helix().dz() << std::endl;
1109 if(fabs(track1->helix().dz()) < fabs(track2->helix().dz())){
1110 m_tracks.remove(track2);
1111 if(merge3DTrack(track1, tracks))
1112 if(check3DTrack(track1) &&
1113 trace3DTrack(track1)){
1116 mask3DTrack(track1,tmp);
1117 tmp.append(track1->links());
1120 m_tracks.remove(track1);
1121 if(merge3DTrack(track2, tracks))
1122 if(check3DTrack(track2) &&
1123 trace3DTrack(track2)){
1126 mask3DTrack(track2,tmp);
1127 tmp.append(track2->links());
1131 int isSaved[2] = { 0, 0 };
1132 if(merge3DTrack(track1, tracks)){
1133 if(check3DTrack(track1) &&
1134 trace3DTrack(track1)){
1136 mask3DTrack(track1,tmp);
1137 tmp.append(track1->links());
1141 if(merge3DTrack(track2, tracks)){
1142 if(check3DTrack(track2) &&
1143 trace3DTrack(track2)){
1145 mask3DTrack(track2,tmp);
1146 tmp.append(track2->links());
1150 if(isSaved[0] == 1 && isSaved[1] == 1){
1151 track1->daughter(track2);
1152 track2->daughter(track1);
1157 std::cout <<
"(TCurlFinder) 3D:Create Track!!! in track1" << std::endl;
1159 salvage3DTrack(track1,
true);
1160 if(merge3DTrack(track1, tracks))
1161 if(check3DTrack(track1) &&
1162 trace3DTrack(track1)){
1164 mask3DTrack(track1,tmp);
1165 tmp.append(track1->links());
1169 std::cout <<
"(TCurlFinder) 3D:Create Track!!! in track2" << std::endl;
1171 salvage3DTrack(track2,
true);
1172 if(merge3DTrack(track2, tracks))
1173 if(check3DTrack(track2) &&
1174 trace3DTrack(track2)){
1176 mask3DTrack(track2,tmp);
1177 tmp.append(track2->links());
1183 if(ok2d[0] == 1 && ok3d[0] == 0){
1184 removeStereo(*circle);
1187 if(fitWDD(*circle,chi2_2d,ndf_2d)){
1189 trk2d->_ndf = ndf_2d;
1190 trk2d->_chi2 = chi2_2d;
1191 m_2dTracks.append(trk2d);
1192 m_allTracks.append(trk2d);
1196 std::cout <<
"(TCurlFinder) 2D:fit with drift information!!!" << std::endl;
1200 if(ok2d[1] == 1 && ok3d[1] == 0){
1201 removeStereo(*dividedCircle);
1204 if(fitWDD(*dividedCircle,chi2_2d,ndf_2d)){
1206 trk2d->_ndf = ndf_2d;
1207 trk2d->_chi2 = chi2_2d;
1208 m_2dTracks.append(trk2d);
1209 m_allTracks.append(trk2d);
1213 std::cout <<
"(TCurlFinder) 2D:fit with drift information!!!" << std::endl;
1221 std::cout <<
"(TCurlFinder) 2D:dividing...no good...1 Circles!!!" << std::endl;
1227 if(trace2DTrack(circle) &&
1228 check2DCircle(circle) &&
1231 std::cout <<
"(TCurlFinder) 2D:Success Circle Fit!!!" << std::endl;
1234 TTrack *track3 = make3DTrack(circle, segmentList);
1237 std::cout <<
"(TCurlFinder) 3D:Create Track!!! in track3" << std::endl;
1239 salvage3DTrack(track3,
true);
1240 if(merge3DTrack(track3, tracks))
1241 if(check3DTrack(track3) &&
1242 trace3DTrack(track3)){
1244 mask3DTrack(track3,tmp);
1245 tmp.append(track3->
links());
1251 if(ok2d == 1 && ok3d == 0){
1252 removeStereo(*circle);
1255 if(fitWDD(*circle,chi2_2d,ndf_2d)){
1257 trk2d->_ndf = ndf_2d;
1258 trk2d->_chi2 = chi2_2d;
1259 m_2dTracks.append(trk2d);
1260 m_allTracks.append(trk2d);
1264 std::cout <<
"(TCurlFinder) 2D:fit with drift information!!!" << std::endl;
1271 m_unusedAxialHits.remove(tmp);
1272 m_unusedStereoHits.remove(tmp);
1273 for(
unsigned ii=0, nsize=m_segmentList.length();ii<nsize;++ii){
1274 m_segmentList[ii]->remove(tmp);
1275 if(m_segmentList[ii]->list().length() < m_param.
MIN_SEGMENT)
1276 m_segmentList[ii]->removeAll();
1279 segmentList[i]->removeAll();
1289 std::cout <<
"(TCurlFinder)MDC Rec Track # 3D = " << m_tracks.length()
1290 <<
", 2D = " << m_2dTracks.length() << std::endl;
1291 std::cout <<
"3D Track List" << std::endl;
1292 for(
int j=0;j<m_tracks.length();++j){
1293 m_tracks[j]->setFinderType(3);
1294 unsigned nA = 0, nS = 0;
1295 unsigned nAOK = 0, nSOK = 0;
1296 for(
unsigned i=0,size=m_tracks[j]->nLinks();i<size;++i){
1297 if(m_tracks[j]->links()[i]->wire()->stereo())++nS;
1301 if(m_tracks[j]->links()[i]->wire()->stereo())++nSOK;
1305 std::cout <<
"(TCurlFinder) #" << j <<
": wire info...A+S: " << m_tracks[j]->nLinks()
1306 <<
", A: " << nAOK <<
"/" << nA
1307 <<
", S: " << nSOK <<
"/" << nS << std::endl;
1308 if(m_tracks[j]->daughter())
1309 std::cout <<
"(TCurlFinder) Relation = EXIST" << std::endl;
1311 std::cout <<
"(TCurlFinder) Relation = NO EXIST" << std::endl;
1313 std::cout <<
"2D Track List" << std::endl;
1314 for(
int j=0;j<m_2dTracks.length();++j){
1315 unsigned nA = 0, nS = 0;
1316 unsigned nAOK = 0, nSOK = 0;
1317 for(
unsigned i=0,size=m_2dTracks[j]->nLinks();i<size;++i){
1318 if(m_2dTracks[j]->links()[i]->wire()->stereo())++nS;
1322 if(m_2dTracks[j]->links()[i]->wire()->stereo())++nSOK;
1326 std::cout <<
"(TCurlFinder) #" << j <<
": wire info...A+S: " << m_2dTracks[j]->nLinks()
1327 <<
", A: " << nAOK <<
"/" << nA
1328 <<
", S: " << nSOK <<
"/" << nS
1329 <<
", Chi2: " << m_2dTracks[j]->chi2()
1330 <<
", Ndf: " << m_2dTracks[j]->ndf() << std::endl;
1331 if(m_2dTracks[j]->daughter())
1332 std::cout <<
"(TCurlFinder) Relation = EXIST" << std::endl;
1334 std::cout <<
"(TCurlFinder) Relation = NO EXIST" << std::endl;
1339 m_allTracks.remove(m_tracks);
1340 checkRelation(m_tracks);
1341 tracks.append(m_tracks);
1344 m_allTracks.remove(m_2dTracks);
1345 tracks2D.append(m_2dTracks);
1350TCurlFinder::check2DTracks(
void)
1352 if(m_2dTracks.length() == 0)
return;
1354 for(
int i=0;i<m_tracks.length();++i){
1355 allWires_3Dtrks.append(m_tracks[i]->links());
1359 for(
int i=0;i<m_2dTracks.length();++i){
1361 for(
int j=0;j<m_2dTracks[i]->nLinks();++j){
1363 for(
int k=0;k<allWires_3Dtrks.length();++k){
1364 if(m_2dTracks[i]->links()[j]->wire()->
id() ==
1365 allWires_3Dtrks[k]->wire()->
id()){
1371 usedWires.append(m_2dTracks[i]->links()[j]);
1376 m_2dTracks[i]->remove(usedWires);
1382 unsigned nT = list.length();
1384 for(
unsigned i=0;i<nT;++i){
1385 if(list[i]->daughter()){
1387 for(
unsigned j=0;j<nT;++j){
1389 list[i]->daughter() == list[j]){
1395 list[i]->daughter(
NULL);
1402TCurlFinder::dividing2DTrack(
TCircle *circle) {
1404 for(
unsigned i = 0, size = circle->
nLinks(); i < size; ++i){
1405 if(circle->
center().x()*circle->
links()[i]->hit()->wire()->xyPosition().y() -
1406 circle->
center().y()*circle->
links()[i]->hit()->wire()->xyPosition().x() > 0.){
1407 positive.append(circle->
links()[i]);
1409 negative.append(circle->
links()[i]);
1412 if(positive.length() > negative.length()){
1413 circle->
remove(negative);
1415 if(negative.length() >= 3){
1417 m_allCircles.append(new_circle);
1424 circle->
remove(positive);
1426 if(positive.length() >= 3){
1428 m_allCircles.append(new_circle);
1438TCurlFinder::assignTracks(
void) {
1440 for(
int i=0,size=m_tracks.length();i<size;++i) {
1447 for(
int i=0,size=m_2dTracks.length();i<size;++i) {
1455 if(*(
static_cast<const double*
>(i)) > *(
static_cast<const double*
>(j)))
return 1;
1456 if(*(
static_cast<const double*
>(i)) < *(
static_cast<const double*
>(j)))
return -1;
1461TCurlFinder::trace2DTrack(
TCircle *circle) {
1463 unsigned nSize = circle->
links().length();
1464 if(nSize == 0)
return 0;
1465 double r = fabs(circle->
radius());
1466 if(r < 0.01)
return 0;
1467 double cx = circle->
center().x();
1468 double cy = circle->
center().y();
1469 double th = atan2(-cy,-cx);
1470 if(th < 0.)th += 2.*
M_PI;
1472 unsigned innerOK = 0;
1473 double *angle =
new double [circle->
links().length()];
1474 for(
unsigned i=0,size=nSize;i<size;++i){
1475 double th_r = atan2(circle->
links()[i]->wire()->xyPosition().y()-cy,
1476 circle->
links()[i]->wire()->xyPosition().x()-cx);
1477 if(th_r < 0.)th_r += 2.*
M_PI;
1478 double diff = th_r-th+2.*
M_PI;
1479 if(th_r > th)diff = th_r-th;
1480 if(circle->
links()[i]->wire()->superLayerId() <= 2)innerOK = 1;
1484 double maxDiffAngle = 0.;
1485 unsigned maxIndex = 0;
1486 for(
unsigned i=0,size=nSize;i<size-1;++i){
1487 if(angle[i+1]-angle[i] > maxDiffAngle){
1488 maxDiffAngle = angle[i+1]-angle[i];
1497 if(innerOK == 1)
return 1;
1499 double q = circle->
radius() > 0. ? 1. : -1;
1500 for(
unsigned i=0,size=m_hitsOnInnerSuperLayer.length();i<size;++i){
1501 double mag = distance(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
x()-cx,
1502 m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
y()-cy);
1504 q*(cx*m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().y()-
1505 cy*m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().x()) > 0.){
1513TCurlFinder::check2DCircle(
TCircle *circle) {
1514 unsigned nA(nAxialHits(fabs(circle->
radius())*2.0));
1516 unsigned nMA =
static_cast<unsigned>(floor(m_param.
RATIO_USED_WIRE*
static_cast<double>(nA)));
1519 unsigned nAhits(0), nShits(0);
1520 for(
unsigned i=0,size=circle->
nLinks();i<size;++i){
1521 if((circle->
links()[i])->wire()->axial())++nAhits;
1526 std::cout <<
"(TCurlFinder) 2D:Fail...checking axial wires # = "
1527 << nAhits <<
" < " << nMA << std::endl;
1530 if(nAhits >= nMA)
return true;
1535TCurlFinder::check3DTrack(
TTrack *track) {
1536 trace3DTrack(track);
1537 unsigned nA = 0, nS = 0;
1538 for(
unsigned i=0,size=track->
nLinks();i<size;++i){
1540 if(track->
links()[i]->wire()->stereo())++nS;
1542 if(nA >= 3 && nS >= 2)
return true;
1544 m_tracks.remove(track);
1546 std::cout <<
"(TCurlFinder) 3D:Checked...Fail...removing this track. Valid Axial # = "
1547 << nA <<
", Stereo # = " << nS << std::endl;
1553TCurlFinder::trace3DTrack(
TTrack *track) {
1555 unsigned nSize = track->
links().length();
1557 m_tracks.remove(track);
1562 m_tracks.remove(track);
1567 double th = atan2(-cy,-cx);
1568 if(th < 0.)th += 2.*
M_PI;
1570 double *angle =
new double [track->
links().length()];
1571 for(
unsigned i=0,size=nSize;i<size;++i){
1572 double th_r = atan2(track->
links()[i]->positionOnTrack().y()-cy,
1573 track->
links()[i]->positionOnTrack().x()-cx);
1574 if(th_r < 0.)th_r += 2.*
M_PI;
1575 double diff = th_r-th+2.*
M_PI;
1576 if(th_r > th)diff = th_r-th;
1580 double maxDiffAngle = 0.;
1581 unsigned maxIndex = 0;
1582 for(
unsigned i=0,size=nSize;i<size-1;++i){
1583 if(angle[i+1]-angle[i] > maxDiffAngle){
1584 maxDiffAngle = angle[i+1]-angle[i];
1592 m_tracks.remove(track);
1600TCurlFinder::mask3DTrack(
TTrack *track,
1607 list.append(m_unusedStereoHits);
1608 list.remove(track->
links());
1612 for(
unsigned i=0,size=list.length();i<size;++i){
1613 double d = distance(*track, *(list[i]));
1616 list[i]->position(tmp);
1617 removeList.append(list[i]);
1621 int pLayerId1 =
static_cast<int>(layerId(2.*r));
1622 if(pLayerId1 != 50)pLayerId1 -= 1;
1623 int pLayerId2 = pLayerId1+2;
1626 while(removeList.length()){
1627 preCand.removeAll();
1628 preCand.append(removeList[0]);
1629 if(removeList.length() >= 2){
1630 for(
unsigned j=1,size=removeList.length();j<size;++j){
1631 if(removeList[0]->wire()->layerId() == removeList[j]->wire()->layerId()){
1632 for(
unsigned k=0,
num=preCand.length();k<
num;++k){
1633 if(preCand[k]->wire()->localIdForPlus()+1 == removeList[j]->wire()->localId()){
1634 preCand.append(removeList[j]);
1642 if(preCand[0]->wire()->layerId() >= pLayerId1 &&
1643 preCand[0]->wire()->layerId() <= pLayerId2){
1644 cand.append(preCand);
1645 }
else if(preCand.length() == 2){
1646 cand.append(preCand);
1647 }
else if(preCand.length() == 1){
1648 cand.append(preCand[0]);
1651 if(preCand.length() == 1){
1652 if(preCand[0]->position().x() < MASK_DISTANCE)cand.append(preCand[0]);
1654 if(preCand[0]->wire()->layerId() >= pLayerId1 &&
1655 preCand[0]->wire()->layerId() <= pLayerId2){
1656 cand.append(preCand);
1657 }
else if(preCand.length() == 2){
1658 cand.append(preCand);
1663 cand.append(removeList[0]);
1665 removeList.remove(removeList[0]);
1666 removeList.remove(cand);
1668 maskList.append(cand);
1676 tracks.append(m_tracks);
1677 tracks.remove(track);
1678 if(tracks.length() == 0)
return track;
1684 unsigned bestIndex = 0;
1685 double bestDiff = 1.0e+20;
1687 for(
unsigned i=0,size=tracks.length();i<size;++i){
1688 R = fabs(tracks[i]->helix().radius());
1689 cX = tracks[i]->helix().center().x();
1690 cY = tracks[i]->helix().center().y();
1693 double diff = fabs((fabs(r)-fabs(R))*(cx-cX)*(cy-cY));
1694 if(diff < bestDiff){
1701 if(bestDiff == 1.0e20)
return track;
1702 R = tracks[bestIndex]->helix().radius();
1703 cX = tracks[bestIndex]->helix().center().x();
1704 cY = tracks[bestIndex]->helix().center().y();
1707 if(track->
nLinks() > tracks[bestIndex]->nLinks()){
1708 m_tracks.remove(tracks[bestIndex]);
1711 m_tracks.remove(track);
1713 std::cout <<
"(TCurlFinder) 3D:Merged...removing this track.(type1)" << std::endl;
1719 bool newTrack(
false), oldTrack(
false);
1720 unsigned newCounter(0), oldCounter(0);
1721 for(
unsigned i=0, size=m_hitsOnInnerSuperLayer.length();
1725 cX*(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
y()-cY)-
1726 cY*(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
x()-cX) > 0.) ||
1728 cX*(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
y()-cY)-
1729 cY*(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
x()-cX) < 0.)){
1730 double dist = distance(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
x()-cX,
1731 m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
y()-cY);
1733 if(fabs(fabs(R)-dist-m_hitsOnInnerSuperLayer[i]->drift()) < 0.5){
1735 if(oldCounter >= 3)oldTrack =
true;
1738 if(fabs(dist-fabs(R)-m_hitsOnInnerSuperLayer[i]->drift()) < 0.5){
1740 if(oldCounter >= 3)oldTrack =
true;
1747 cx*(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
y()-cy)-
1748 cy*(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
x()-cx) > 0.) ||
1750 cx*(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
y()-cy)-
1751 cy*(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
x()-cx) < 0.)){
1752 double dist = distance(m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
x()-cx,
1753 m_hitsOnInnerSuperLayer[i]->wire()->xyPosition().
y()-cy);
1755 if(fabs(fabs(r)-dist-m_hitsOnInnerSuperLayer[i]->drift()) < 0.5){
1757 if(newCounter >= 3)newTrack =
true;
1760 if(fabs(dist-fabs(r)-m_hitsOnInnerSuperLayer[i]->drift()) < 0.5){
1762 if(newCounter >= 3)newTrack =
true;
1767 if(oldTrack && newTrack)
break;
1769 if(oldTrack && !newTrack){
1770 m_tracks.remove(track);
1772 std::cout <<
"(TCurlFinder) 3D:Merged...removing this track.(type2)" << std::endl;
1775 }
else if(!oldTrack && newTrack){
1776 m_tracks.remove(tracks[bestIndex]);
1778 }
else if(!oldTrack && !newTrack){
1779 m_tracks.remove(track);
1780 m_tracks.remove(tracks[bestIndex]);
1782 std::cout <<
"(TCurlFinder) 3D:Merged...removing this track.(type3)" << std::endl;
1785 }
else if(oldTrack && newTrack){
1786 if(fabs(track->
helix().
dz()) > fabs(tracks[bestIndex]->helix().dz()) &&
1788 m_tracks.remove(track);
1790 std::cout <<
"(TCurlFinder) 3D:Merged...removing this track.(type4)" << std::endl;
1793 }
else if(fabs(tracks[bestIndex]->helix().dz()) > fabs(track->
helix().
dz()) &&
1795 m_tracks.remove(tracks[bestIndex]);
1804TCurlFinder::salvage3DTrack(
TTrack *track,
bool half) {
1807 list.append(m_unusedStereoHits);
1808 list.remove(track->
links());
1816 for(
unsigned i = 0, size = list.length(); i < size; ++i){
1817 if(
q*Bz*(x*list[i]->wire()->xyPosition().
y()-
y*list[i]->wire()->xyPosition().
x())<0.){
1819#ifdef TRKRECO_DEBUG_DETAIL
1820 std::cout<<
" "<<__FILE__<<
" "<<__LINE__<<
" removeList append "<<i<<std::endl;
1822 removeList.append(list[i]);
1825 list.remove(removeList);
1830 for(
unsigned j=0, nLinks=track->
nLinks();j<nLinks;++j){
1831 dist = distance(*track, *(track->
links()[j]));
1832#ifdef TRKRECO_DEBUG_DETAIL
1833 std::cout<<
" "<<__FILE__<<
" "<<__LINE__<<
" "<<j<<
" distance "<<dist<<std::endl;
1837 for(
unsigned j=0, nList=list.length();j<nList;++j){
1838 dist = distance(*track, *(list[j]));
1839#ifdef TRKRECO_DEBUG_DETAIL
1840 std::cout<<
" "<<__FILE__<<
" "<<__LINE__<<
" "<<j<<
" distance "<<dist<<std::endl;
1844 track->TTrackBase::remove(badCand);
1845 track->TTrackBase::append(goodCand);
1846 if(m_fitter.
fit(*track) < 0){
1847 track->TTrackBase::remove(goodCand);
1848 track->TTrackBase::append(badCand);
1849 m_fitter.
fit(*track);
1856TCurlFinder::distance(
const TTrack &track,
const TMLink &link)
const {
1862 double diff = fabs(d - fabs(track.
helix().
radius()));
1863 return fabs(link.
hit()->
drift()-diff);
1870 double vCrs(v0.x() * v1.y() - v0.y() * v1.x());
1871 double vDot(v0.x() * v1.x() + v0.y() * v1.y());
1872 double dPhi = atan2(vCrs, vDot);
1874 double kappa = a[2];
1880 double tanLambda = a[4];
1885 HepDiagMatrix e(3,1);
1887 t[0][0] =
v.x() *
v.x();
1888 t[0][1] =
v.x() *
v.y();
1889 t[0][2] =
v.x() *
v.z();
1891 t[1][1] =
v.y() *
v.y();
1892 t[1][2] =
v.y() *
v.z();
1895 t[2][2] =
v.z() *
v.z();
1899 unsigned nTrial = 0;
1906 const double convergence = 1.0e-5;
1907 while(nTrial < 100){
1909 double cosPhi =
cos(phi0+dPhi);
1910 double sinPhi =
sin(phi0+dPhi);
1911 dXdPhi[0] = rho*sinPhi;
1912 dXdPhi[1] = - rho*cosPhi;
1913 dXdPhi[2] = - rho*tanLambda;
1916 double f = dot(c,dXdPhi)+dot(x,(
t*dXdPhi));
1918 if(fabs(
f) < convergence)
break;
1920 double eval = (1.-0.25*factor)*fabs(fOld)-fabs(
f);
1921 if(eval <= 0.)factor *= 0.5;
1924 d2Xd2Phi[0] = rho*cosPhi;
1925 d2Xd2Phi[1] = rho*sinPhi;
1927 double df = dot(c, d2Xd2Phi)+
1928 dot(dXdPhi, (
t * dXdPhi))+
1929 dot(x, (
t * d2Xd2Phi));
1930 dPhi -= factor *
f / df;
1948 const unsigned ip) {
1952 m_allCircles.append(circle);
1957 int searchDirection = 1;
1958 int searchPath(searchDirection);
1959 bool searchZero(
false);
1960 bool changeDirection(
false);
1961 unsigned superLayerId = seed[0]->hit()->wire()->superLayerId();
1965 makeList(tmpList, segmentList, seed);
1966 for(
unsigned i=0, size=tmpList.length();i<size;++i){
1967 if(tmpList[i]->wire()){
1968 if(tmpList[i]->wire()->axial()) preAxialCand.append(tmpList[i]);
1969 else preStereoCand.append(tmpList[i]);
1973 std::cout <<
"(TCurlFinder) 2D: Superlayer of seed = " << superLayerId << std::endl;
1976 bool appendFlag =
false;
1979 std::cout <<
"(TCurlFinder) 2D: SearchPath = " << searchPath
1980 <<
" Search SelfSuperlayer = " << (int)(searchZero)
1981 <<
" Change Direction of Search = " << (int)(changeDirection) << std::endl;
1983 if(preAxialCand.length() == 0 && preStereoCand.length() == 0){
1984 if(circle->
links().length() >= 3){
1985 if(m_unusedAxialHits.length() == 0)
1986 if(errorFlag == -1)
return NULL;
1990 if(m_unusedAxialHits.length() == 0)
return NULL;
1994 searchAxialCand(cand, preAxialCand, circle,
1996 if(cand.length() > 0){
1998 for(
unsigned i = 0, size = cand.length(); i < size; ++i)circle->
append(*cand[i]);
2000 preAxialCand.remove(circle->
links());
2002 searchStereoCand(cand, preStereoCand, circle,
2004 if(cand.length() > 0){
2006 for(
unsigned i = 0, size = cand.length(); i < size; ++i)circle->
append(*cand[i]);
2008 preStereoCand.remove(circle->
links());
2011 if(searchDirection == 1)++searchPath;
2016 searchStereoCand(cand, preStereoCand, circle,
2018 if(cand.length() > 0){
2020 for(
unsigned i = 0, size = cand.length(); i < size; ++i)circle->
append(*cand[i]);
2022 preStereoCand.remove(circle->
links());
2023 if(searchDirection == 1)++searchPath;
2026 }
else if((searchPath == 1 || searchPath == -1) && !searchZero){
2030 }
else if((searchPath == 1 || searchPath == -1) && searchZero && !changeDirection){
2032 searchDirection *= -1;
2033 changeDirection =
true;
2036 if(circle->
links().length() >= 3){
2037 if(m_unusedAxialHits.length() == 0)
2038 if(errorFlag == -1)
return NULL;
2042 if(m_unusedAxialHits.length() == 0)
return NULL;
2047 if((searchPath == 1 || searchPath == -1) && !searchZero){
2051 }
else if((searchPath == 1 || searchPath == -1) && searchZero && !changeDirection){
2053 searchDirection *= -1;
2054 changeDirection =
true;
2057 if(circle->
links().length() >= 3){
2058 if(m_unusedAxialHits.length() == 0)
2059 if(errorFlag == -1)
return NULL;
2063 if(m_unusedAxialHits.length() == 0)
return NULL;
2076 if(checkAppendHits(circle->
links(), cand)){
2078 if(circle->
nLinks() >= 3)
2082 }
else if(circle->
nLinks() >= 3){
2095 const unsigned superLayerID,
2096 const double searchError) {
2098 int innerSuperLayerId = nextSuperAxialLayerId(superLayerID, depth);
2099 if(innerSuperLayerId < 0)
return;
2100 for(
unsigned i = 0, size = preCand.length(); i < size; ++i){
2101 if(preCand[i]->hit()->wire()->superLayerId() ==
2102 (
static_cast<unsigned>(innerSuperLayerId))){
2104 if(searchHits(preCand[i], circle, searchError))cand.append(preCand[i]);
2106 if(searchHits(preCand[i], circle, searchError)){
2107 cand.remove(preCand[i]);
2108 cand.append(preCand[i]);
2111 for(
unsigned j = 0; j < size; ++j){
2112 if(preCand[j]->wire()->
id() == cand2->
wire()->
id()){
2116 std::cout <<
"Axial Appending....";
2117 std::cout <<
" layerID = " << cand2->
wire()->
layerId();
2118 std::cout <<
" localID = " << cand2->
wire()->
localId() << std::endl;
2119 if(searchHits(cand2, circle, searchError)){
2120 std::cout <<
" But this can be added by default!" << std::endl;
2122 std::cout <<
" Good!! this cannot be added by default!" << std::endl;
2140 const unsigned superLayerID,
2141 const double searchError) {
2143 int innerSuperLayerId = nextSuperStereoLayerId(superLayerID, depth);
2145 for(
unsigned i = 0, size = preCand.length(); i < size; ++i){
2146 if(preCand[i]->hit()->wire()->superLayerId() ==
2147 (
static_cast<unsigned>(innerSuperLayerId))){
2148 if(searchHits(preCand[i], circle, searchError))cand.append(preCand[i]);
2154TCurlFinder::searchHits(
const TMLink *link,
const TCircle *circle,
2155 const double searchError)
const {
2162 double radius = fabs(circle->
radius());
2165 if(radius - searchError < dist &&
2166 radius + searchError > dist)
return 1;
2174 const double searchError)
const {
2175 unsigned numBefore = cand.length();
2176 for(
unsigned i = 0, size = preCand.length(); i < size; ++i){
2177 if(searchHits(preCand[i], circle, searchError)){
2179 cand.append(preCand[i]);
2181 cand.remove(preCand[i]);
2182 cand.append(preCand[i]);
2185 for(
unsigned j = 0; j < size; ++j){
2186 if(preCand[j]->wire()->
id() == cand2->
wire()->
id()){
2196 if(numBefore == cand.length())
return 0;
2203 if(cand.length() == 0)
return 0;
2205 for(
unsigned i = 0,
size1 = cand.length(),
size2 = link.length(); i <
size1; ++i){
2206 for(
unsigned j = 0; j <
size2; ++j){
2207 if((cand[i])->wire()->
id() == (link[j])->wire()->
id()){
2208 tmp.append(cand[i]);
2214 if(cand.length() > 0)
return 1;
2219TCurlFinder::removeStereo(
TCircle &c)
const
2222 for(
int i=0;i<c.
links().length();++i){
2223 if(c.
links()[i]->wire()->stereo()){
2224 stereoList.append(c.
links()[i]);
2227 if(stereoList.length()>0)c.
remove(stereoList);
2231TCurlFinder::fitWDD(
TCircle &c,
2235 if(c.
links().length() <= 3)
return false;
2238 for(
int i=0;i<c.
links().length();++i){
2240 (c.
links()[i])->wire()->xyPosition().y(),1.0);
2243 if (circle.
fit() < 0.0 || circle.
kappa() == 0.0)
return false;
2244 double xc = circle.
center()[0];
2245 double yc = circle.
center()[1];
2246 double r = circle.
radius();
2247 const int maxIte = 2;
2248 for(
int ite=0;ite<maxIte;++ite){
2252 for(
int i=0;i<c.
links().length();++i){
2254 double R = sqrt(((c.
links()[i])->wire()->xyPosition().x()-xc)*((c.
links()[i])->wire()->xyPosition().x()-xc)+
2255 ((c.
links()[i])->wire()->xyPosition().y()-yc)*((c.
links()[i])->wire()->xyPosition().y()-yc));
2256 if(R == 0.)
continue;
2258 double dir =
R > r ? -1. : 1.;
2259 double X = xc+((c.
links()[i])->wire()->xyPosition().x()-xc)*U*(R+dir*(c.
links()[i])->hit()->drift());
2260 double Y = yc+((c.
links()[i])->wire()->xyPosition().y()-yc)*U*(R+dir*(c.
links()[i])->hit()->drift());
2264 if (circle2.
fit() < 0.0 || circle2.
kappa() == 0.0)
return false;
2265 xc = circle2.
center()[0];
2266 yc = circle2.
center()[1];
2272 double totalChi2 = 0.;
2274 for(
int i=0;i<c.
links().length();++i){
2276 double xw = (c.
links()[i])->wire()->xyPosition().x();
2277 double yw = (c.
links()[i])->wire()->xyPosition().y();
2278 double R = sqrt((xw-xc)*(xw-xc)+(yw-yc)*(yw-yc));
2279 if(R == 0.)
continue;
2281 double X = xc+(xw-xc)*U*r;
2282 double Y = yc+(yw-yc)*U*r;
2283 double zlr = xw*Y-yw*X;
2285 double pChi2 = sqrt((X-xw)*(X-xw)+(Y-yw)*(Y-yw))-(c.
links()[i])->hit()->drift();
2288 if((c.
links()[i])->hit()->dDrift() != 0.){
2289 pChi2 *= pChi2/((c.
links()[i])->hit()->dDrift()*(c.
links()[i])->hit()->dDrift());
2293 }
else pChi2 = 1.0e+10;
2298 if(totalNHit <= 3)
return false;
2305 for(
int i=0;i<c.
links().length();++i){
2311 if(
q > 0.)qSum += 1;
2314 if(qSum >= 0)
charge = +1.;
2329 unsigned size = segmentList.length();
2330 if(
TTrack *track = make3DTrack(circle)){
2331 m_tracks.append(track);
2333 std::cout <<
"MDC Helix+Pt: " << track->
helix().
dr() <<
", "
2336 << track->
helix().
dz() <<
", "
2338 <<
": " << 10000./2.9979258/15./track->
helix().
kappa() << std::endl;
2346TCurlFinder::make3DTrack(
const TCircle *circle) {
2348 m_allTracks.append(track);
2353 std::cout <<
"(TCurlFinder) 3D:Fail...inital hit wire # < 3." << std::endl;
2358 allStereoHits.remove(track->
links());
2360 findCloseHits(allStereoHits, *track, closeHits);
2365 std::cout <<
"(TCurlFinder) 3D:Fail...stereohit wire # < 5." << std::endl;
2370 if(!m_builder.
buildStereo(*track, closeHits, m_allStereoHitsOriginal)){
2372 std::cout <<
"(TCurlFinder) 3D:Fail...can not build stereo." << std::endl;
2380 std::cout <<
"(TCurlFinder) 3D:Fail...success 3D fit, but large radius > "
2388 std::cout <<
"(TCurlFinder) 3D:Success...can build stereo!!!" << std::endl;
2393 std::cout <<
"(TCurlFinder) 3D:Fail...success 3D fit, but final hit wire # < 3." << std::endl;
2407 for(
int i=0;i<6;++i){
2413 for(
int j=0;j<6;++j){
2429 isolatedLink[nIsolated] = link->
neighbor(i);
2434 std::cout <<
"Why?? Neighborhood info. dose not exist!!" << std::endl;
2441 std::cout <<
"isolated/neighbor # = " << nIsolated <<
"/" << nNeighbor << std::endl;
2442 std::cout <<
"layer ID = " << layerID <<
" ";
2443 std::cout <<
"local ID = " << localID <<
" --> ";
2444 if(isolatedLink[0])std::cout << isolatedLink[0]->
wire()->
localId() <<
" ";
2445 if(isolatedLink[1])std::cout << isolatedLink[1]->
wire()->
localId() <<
" ";
2446 std::cout << std::endl;
2448 if(nIsolated == 1 &&
2449 nNeighbor == 1 && isolatedLink[0])
return isolatedLink[0];
2469 for(
unsigned i = 0, size = links.length(); i < size; ++i){
2470 if(fabs((links[i]->wire()->xyPosition() - track.
helix().
center()).mag() - r) <
2471 dRcut[links[i]->wire()->superLayerId()]){
2472 if(
q*(x*links[i]->wire()->xyPosition().
y()-
y*links[i]->wire()->xyPosition().
x()) > 0.){
2473 list.remove(links[i]);
2474 list.append(links[i]);
2497#define MAX_INDEX_MAKEMC 100
2499 std::cout <<
"(TCurlFinder)Now making tracks using MC info..." << std::endl;
2501 int index[MAX_INDEX_MAKEMC];
2502 for(
unsigned i = 0; i < MAX_INDEX_MAKEMC; ++i)index[i] = 9999;
2507 for(
unsigned i = 0, size = axialHits.length(); i < size; ++i){
2508 if(axialHits[i]->mc() &&
2509 axialHits[i]->mc()->hep() &&
2512 for(
unsigned j = 0; j < MAX_INDEX_MAKEMC; ++j){
2513 if(index[j] != 9999 && index[j] == axialHits[i]->mc()->hep()->
id()){
2519 index[counter] = axialHits[i]->mc()->hep()->id();
2525 std::cout <<
"(TCurlFinder)Found " << counter
2526 <<
" tracks with MC information." << std::endl;
2528 for(
unsigned j = 0; j < counter; ++j){
2531 int axialCounter(0);
2532 int stereoCounter(0);
2534 for(
unsigned i = 0, size = axialHits.length(); i < size; ++i){
2535 if(index[j] == axialHits[i]->mc()->hep()->
id() &&
2537 axialList.append(
new TMLink(0, axialHits[i]));
2541 if(axialCounter < 3){
2542 HepAListDeleteAll(axialList);
2546 for(
unsigned i = 0, size = stereoHits.length(); i < size; ++i){
2547 if(index[j] == stereoHits[i]->mc()->hep()->
id() &&
2549 stereoList.append(
new TMLink(0, stereoHits[i]));
2553 if(stereoCounter < 2){
2554 HepAListDeleteAll(axialList);
2555 HepAListDeleteAll(stereoList);
2559 std::cout <<
"(TCurlFinder)#" << j <<
" : Use "
2560 << axialCounter <<
" axial hit wires and "
2561 << stereoCounter <<
" stereo hit wires" << std::endl;
2562 std::cout <<
"(TCurlFinder)Particle Type(LUND) = "
2563 << axialList[0]->hit()->mc()->hep()->pType() << std::endl;
2566 m_unusedAxialHitsOriginal.append(axialList);
2567 m_unusedAxialHitsOriginal.append(stereoList);
2569 m_allCircles.append(circle);
2572 if(axialList[0]->hit()->mc()->hep()->
pType() < 0)
charge = -1.;
2573 if(fabs(axialList[0]->hit()->mc()->hep()->
pType()) == 11 ||
2574 fabs(axialList[0]->hit()->mc()->hep()->
pType()) == 13 ||
2575 fabs(axialList[0]->hit()->mc()->hep()->
pType()) == 15)
charge *= -1.;
2579 double x = circle->
center().x();
2580 double y = circle->
center().y();
2582 for(
unsigned i = 0, size = axialList.length();
2584 if(
charge*(x*axialList[i]->xyPosition().
y()-
2585 y*axialList[i]->xyPosition().
x())< 0.){
2586 removeList.append(axialList[i]);
2590 circle->
remove(removeList);
2591 if(circle->
nLinks() < 3)
continue;
2596 removeList.removeAll();
2598 for(
unsigned i = 0, size = stereoList.length();
2600 if(
charge*(x*stereoList[i]->xyPosition().
y()-
2601 y*stereoList[i]->xyPosition().
x())< 0.){
2602 removeList.append(stereoList[i]);
2605 stereoList.remove(removeList);
2606 if(stereoList.length() < 2)
continue;
2609 m_allTracks.append(track);
2611 if(track->
links().length() >= 5){
2613 tracks.append(track);
2614 m_allTracks.remove(track);
2616 std::cout <<
"Can not reconstruct with MC information!" << std::endl;
2619 std::cout <<
"Can not reconstruct with MC information!" << std::endl;
2627TCurlFinder::makeCdcFrame(
void) {
2628#if DEBUG_CURL_GNUPLOT+DEBUG_CURL_SEGMENT
2632 double R[12] = {8.3, 16.9, 21.7, 31.3, 36.1, 44.1,
2633 50.5, 58.5, 64.9, 72.9, 79.3, 87.4};
2635 double dStep = 2.*
M_PI/step;
2637 std::string nameHead =
"tmp.cdc_";
2638 for(
int j=0;j<12;++j){
2639 std::string nameFile = nameHead+
"0"+itostring(j);
2640 if(j>=10)nameFile = nameHead+itostring(j);
2641 if((
data = fopen(nameFile,
"w")) !=
NULL){
2642 for(
int i=0;i<step;++i){
2643 double x = X +
R[j] *
cos(dStep*
static_cast<double>(i));
2644 double y = Y +
R[j] *
sin(dStep*
static_cast<double>(i));
2645 fprintf(
data,
"%lf, %lf\n",x,
y);
2651 if((
data = fopen(
"tmp_wires.dat",
"w")) !=
NULL){
2653 list.append(m_unusedStereoHitsOriginal);
2654 for(
int i=0;i<list.length();i++){
2655 double x = list[i]->hit()->wire()->xyPosition().x();
2656 double y = list[i]->hit()->wire()->xyPosition().y();
2657 fprintf(
data,
"%lf, %lf\n",x,
y);
2667#if DEBUG_CURL_GNUPLOT
2668 if(!m_debugCdcFrame){
2670 m_debugCdcFrame =
true;
2672 double gmaxX = 90. ,gminX = -90.;
2673 double gmaxY = 90. ,gminY = -90.;
2674 FILE *gnuplot, *
data;
2675 if((
data = fopen(
"tmp.dat",
"w")) !=
NULL){
2676 if(
flag)std::cout <<
"Wire ID = ";
2677 for(
int i=0;i<list.length();i++){
2678 double x = list[i]->hit()->wire()->xyPosition().x();
2679 double y = list[i]->hit()->wire()->xyPosition().y();
2680 fprintf(
data,
"%lf, %lf\n",x,
y);
2681 if(
flag)std::cout << list[i]->hit()->wire()->id() <<
", ";
2683 if(
flag)std::cout << std::endl;
2686 if((gnuplot = popen(
"gnuplot",
"w")) !=
NULL){
2687 fprintf(gnuplot,
"set nokey \n");
2688 fprintf(gnuplot,
"set size 0.721,1.0 \n");
2689 fprintf(gnuplot,
"set xrange [%f:%f] \n",gminX,gmaxX);
2690 fprintf(gnuplot,
"set yrange [%f:%f] \n",gminY,gmaxY);
2691 std::string longName =
"plot \"tmp_wires.dat\", \"tmp.dat\"";
2692 std::string nameHead =
",\"tmp.cdc_";
2693 for(
int j=0;j<12;++j){
2694 std::string nameFile = nameHead+
"0"+itostring(j)+
"\"w l 0";
2695 if(j>=10)nameFile = nameHead+itostring(j)+
"\"w l 0";
2696 longName += nameFile;
2699 fprintf(gnuplot,longName);
2710TCurlFinder::plotCircle(
const TCircle& circle,
const int flag) {
2711#if DEBUG_CURL_GNUPLOT
2713 if(!m_debugCdcFrame){
2715 m_debugCdcFrame =
true;
2717 double gmaxX = 90. ,gminX = -90.;
2718 double gmaxY = 90. ,gminY = -90.;
2719 FILE *gnuplot, *
data;
2720 if((
data = fopen(
"tmp.dat1",
"w")) !=
NULL){
2721 if(
flag)std::cout <<
"Axial Wire ID ==> " << std::endl;
2722 for(
int i=0;i<circle.
nLinks();++i){
2723 if(circle.
links()[i]->hit()->wire()->axial()){
2724 double x = circle.
links()[i]->hit()->wire()->xyPosition().x();
2725 double y = circle.
links()[i]->hit()->wire()->xyPosition().y();
2726 fprintf(
data,
"%lf, %lf\n",x,
y);
2736 if(
flag)std::cout << std::endl;
2739 if((
data = fopen(
"tmp.dat2",
"w")) !=
NULL){
2740 if(
flag)std::cout <<
"Stereo Wire ID ==> " << std::endl;
2741 for(
int i=0;i<circle.
nLinks();++i){
2742 if(circle.
links()[i]->hit()->wire()->stereo()){
2743 double x = circle.
links()[i]->hit()->wire()->xyPosition().x();
2744 double y = circle.
links()[i]->hit()->wire()->xyPosition().y();
2745 fprintf(
data,
"%lf, %lf\n",x,
y);
2755 if(
flag)std::cout << std::endl;
2758 double X = circle.
center().x();
2759 double Y = circle.
center().y();
2760 double R = fabs(circle.
radius());
2762 double dStep = 2.*
M_PI/step;
2763 if((
data = fopen(
"tmp.dat3",
"w")) !=
NULL){
2764 for(
int i=0;i<step;++i){
2765 double x = X +
R *
cos(dStep*
static_cast<double>(i));
2766 double y = Y +
R *
sin(dStep*
static_cast<double>(i));
2767 fprintf(
data,
"%lf, %lf\n",x,
y);
2771 if((gnuplot = popen(
"gnuplot",
"w")) !=
NULL){
2772 fprintf(gnuplot,
"set nokey \n");
2773 fprintf(gnuplot,
"set size 0.721,1.0 \n");
2774 fprintf(gnuplot,
"set xrange [%f:%f] \n",gminX,gmaxX);
2775 fprintf(gnuplot,
"set yrange [%f:%f] \n",gminY,gmaxY);
2776 std::string longName =
"plot \"tmp_wires.dat\", \"tmp.dat1\", \"tmp.dat3\" w l, \"tmp.dat2\"";
2777 std::string nameHead =
",\"tmp.cdc_";
2778 for(
int j=0;j<12;++j){
2779 std::string nameFile = nameHead+
"0"+std::string(j)+
"\"w l 0";
2780 if(j>=10)nameFile = nameHead+std::string(j)+
"\"w l 0";
2781 longName += nameFile;
2784 fprintf(gnuplot,longName);
2795TCurlFinder::plotTrack(
const TTrack& track,
const int flag) {
2796#if DEBUG_CURL_GNUPLOT
2797 if(!m_debugCdcFrame){
2799 m_debugCdcFrame =
true;
2801 double gmaxX = 90. ,gminX = -90.;
2802 double gmaxY = 90. ,gminY = -90.;
2803 FILE *gnuplot, *
data;
2804 if((
data = fopen(
"tmp.dat1",
"w")) !=
NULL){
2805 if(
flag)std::cout <<
"Axial Wire ID ==> " << std::endl;
2806 for(
int i=0;i<track.
nLinks();++i){
2807 if(track.
links()[i]->hit()->wire()->axial()){
2808 double x = track.
links()[i]->hit()->wire()->xyPosition().x();
2809 double y = track.
links()[i]->hit()->wire()->xyPosition().y();
2810 fprintf(
data,
"%lf, %lf\n",x,
y);
2813 std::cout <<
" A:" << track.
links()[i]->hit()->wire()->id() <<
", ";
2814 std::cout <<
", HepTrackID = " << track.
links()[i]->hit()->mc()->hep()->id();
2815 std::cout <<
", HepLundID = " << track.
links()[i]->hit()->mc()->hep()->pType() << std::endl;
2816 }
else std::cout <<
" A:" << track.
links()[i]->hit()->wire()->id() << std::endl;
2820 if(
flag)std::cout << std::endl;
2823 if((
data = fopen(
"tmp.dat2",
"w")) !=
NULL){
2824 if(
flag)std::cout <<
"Stereo Wire ID ==> " << std::endl;
2825 for(
int i=0;i<track.
nLinks();++i){
2826 if(track.
links()[i]->hit()->wire()->stereo()){
2827 double x = track.
links()[i]->hit()->wire()->xyPosition().x();
2828 double y = track.
links()[i]->hit()->wire()->xyPosition().y();
2829 fprintf(
data,
"%lf, %lf\n",x,
y);
2832 std::cout <<
" S:" << track.
links()[i]->hit()->wire()->id() <<
", ";
2833 std::cout <<
", HepTrackID = " << track.
links()[i]->hit()->mc()->hep()->id();
2834 std::cout <<
", HepLundID = " << track.
links()[i]->hit()->mc()->hep()->pType() << std::endl;
2835 }
else std::cout <<
" S:" << track.
links()[i]->hit()->wire()->id() << std::endl;
2839 if(
flag)std::cout << std::endl;
2846 double dStep = 2.*
M_PI/step;
2847 if((
data = fopen(
"tmp.dat3",
"w")) !=
NULL){
2848 for(
int i=0;i<step;++i){
2849 double x = X +
R *
cos(dStep*
static_cast<double>(i));
2850 double y = Y +
R *
sin(dStep*
static_cast<double>(i));
2851 fprintf(
data,
"%lf, %lf\n",x,
y);
2855 if((gnuplot = popen(
"gnuplot",
"w")) !=
NULL){
2856 fprintf(gnuplot,
"set nokey \n");
2857 fprintf(gnuplot,
"set size 0.721,1.0 \n");
2858 fprintf(gnuplot,
"set xrange [%f:%f] \n",gminX,gmaxX);
2859 fprintf(gnuplot,
"set yrange [%f:%f] \n",gminY,gmaxY);
2860 std::string longName =
"plot \"tmp_wires.dat\", \"tmp.dat1\", \"tmp.dat3\" w l, \"tmp.dat2\"";
2861 std::string nameHead =
",\"tmp.cdc_";
2862 for(
int j=0;j<12;++j){
2863 std::string nameFile = nameHead+
"0"+itostring(j)+
"\"w l 0";
2864 if(j>=10)nameFile = nameHead+itostring(j)+
"\"w l 0";
2865 longName += nameFile;
2868 fprintf(gnuplot,longName);
2879TCurlFinder::writeSegment(
const AList<TMLink>& list,
const int type) {
2880#if DEBUG_CURL_SEGMENT
2881 if(!m_debugCdcFrame){
2883 m_debugCdcFrame =
true;
2885 double gmaxX = 90. ,gminX = -90.;
2886 double gmaxY = 90. ,gminY = -90.;
2889 std::string nameHead =
"tmp.segment_";
2890 std::string nameFile = nameHead+itostring(type)+
"_"+itostring(m_debugFileNumber);
2891 ++m_debugFileNumber;
2892 if((
data = fopen(nameFile,
"w")) !=
NULL){
2893 for(
int i=0;i<list.length();i++){
2894 double x = list[i]->hit()->wire()->xyPosition().x();
2895 double y = list[i]->hit()->wire()->xyPosition().y();
2896 fprintf(
data,
"%lf, %lf\n",x,
y);
2905TCurlFinder::dumpType1(
TTrack *track) {
2907 for(
int j=0;j<track->
nLinks();++j){
2908 std::cout <<
"Used Wire Info...";
2909 if(track->
links()[j]->hit()->wire()->axial()){
2910 std::cout <<
"A:" << track->
links()[j]->hit()->wire()->id() <<
", ";
2912 std::cout <<
"S:" << track->
links()[j]->hit()->wire()->id() <<
", ";
2915 std::cout <<
", HepTrackID = " << track->
links()[j]->hit()->mc()->hep()->id();
2916 std::cout <<
", HepLundID = " << track->
links()[j]->hit()->mc()->hep()->pType();
2918 double dist = distance(*track, *(track->
links()[j]));
2919 if(dist > 2.)std::cout <<
": Large Distance( >2cm ) = " << dist;
2920 std::cout << std::endl;
2923 list.append(m_unusedStereoHits);
2924 for(
unsigned j=0, nList=list.length();j<nList;++j){
2925 double dist = distance(*track, *(list[j]));
2926 std::cout <<
"Close Wire Info in ALL( <0.5cm )...";
2928 if(list[j]->hit()->wire()->axial())
2929 std::cout <<
"CA:" << list[j]->hit()->wire()->id() <<
", ";
2931 std::cout <<
"CS:" << list[j]->hit()->wire()->id() <<
", ";
2933 std::cout <<
", HepTrackID = " << list[j]->hit()->mc()->hep()->id();
2934 std::cout <<
", HepLundID = " << list[j]->hit()->mc()->hep()->pType();
2936 std::cout <<
", Distance = " << dist << std::endl;
2944TCurlFinder::dumpType2(
TTrack *track) {
2946 unsigned size = track->
nLinks();
2947 if(size == 0)
return;
2949 set< int, less<int> > uniqueHepID;
2951 vector<double> ratio;
2952 for(
int i=0;i<size;++i){
2953 uniqueHepID.insert(track->
links()[i]->hit()->mc()->hep()->id());
2954 hepID.push_back(track->
links()[i]->hit()->mc()->hep()->id());
2958 set< int, less<int> >::iterator u = uniqueHepID.begin();
2959 vector<int>::size_type sizeInt;
2960 for(
unsigned i=0;i<uniqueHepID.size();++i){
2962 count(hepID.begin(), hepID.end(), *u, sizeInt);
2963 ratio.push_back((
static_cast<double>(sizeInt)/
static_cast<double>(size)));
2968 vector<double>::iterator m = max_element(ratio.begin(), ratio.end());
2970 ::distance(ratio.begin(), m, maxIndex);
2971 u = uniqueHepID.begin();
2972 advance(u,maxIndex);
2974 std::cout <<
"Ratio " << ratio[maxIndex] << std::endl;
2975 for(
int i=0;i<size;++i){
2976 if(track->
links()[i]->hit()->wire()->axial())std::cout <<
"A ";
2977 else std::cout <<
"S ";
2979 double dist = distance(*track, *(track->
links()[i]));
2980 if(*u != track->
links()[i]->hit()->mc()->hep()->id()){
2981 std::cout <<
"Bad " << dist << std::endl;
2983 std::cout <<
"Good " << dist << std::endl;
3006cluster2hep(Recsvd_cluster *clus) {
3008 Datsvd_hit_Manager& svdHitMgr = Datsvd_hit_Manager::get_manager();
3009 for(Datsvd_hit_Manager::iterator
3010 it = svdHitMgr.begin(),
3011 end = svdHitMgr.end();
3013 m_datsvd_hit.append(it);
3017 unsigned size = m_datsvd_hit.length();
3018 int startPosition = -1;
3021 for(
unsigned i=0;i<size;++i){
3023 std::cout << i <<
": " << clus->hit().get_ID() <<
" <--> " << m_datsvd_hit[i]->get_ID()
3024 <<
", RLA = " << m_datsvd_hit[i]->rla() <<
", LSA = " << m_datsvd_hit[i]->amp()
3025 <<
", Width = " << clus->width()
3026 <<
", Cluster LSA = " << clus->lsa() << std::endl;
3029 for(
unsigned i=0;i<size;++i){
3030 if(m_datsvd_hit[i]->amp() == 0)std::cout <<
"DatSVD_Hit:amp == 0" << std::endl;
3032 if(m_datsvd_hit[i]->rla() == 0)std::cout <<
"DatSVD_Hit:rla == 0" << std::endl;
3033 if(m_datsvd_hit[i]->rla() == 81920)std::cout <<
"DatSVD_Hit:rla == 81920" << std::endl;
3034 if(clus->hit().get_ID() == m_datsvd_hit[i]->get_ID()){
3036 if(
static_cast<double>(m_datsvd_hit[i]->amp()-1) > clus->lsa())direction = -1;
3040 if(startPosition == -1)
return NULL;
3041 int width = clus->width();
3043 std::cout <<
"Start # = " << startPosition
3044 <<
", Width = " << width
3045 <<
", Direction = " << direction <<std::endl;
3048 int* hepID =
new int[width];
3049 set< int, less<int> > uniqueHepID;
3051 for(
int i=startPosition;i<startPosition+width;++i)hepID[i-startPosition] = 0;
3053 Datsvd_mcdata_Manager& svdMcHitMgr = Datsvd_mcdata_Manager::get_manager();
3056 for(
int i=startPosition;i<startPosition+width;++i){
3057 for(Datsvd_mcdata_Manager::iterator
3058 it = svdMcHitMgr.begin(),
3059 end = svdMcHitMgr.end();
3062 if(m_datsvd_hit[i]->rla() == it->rla() &&
3063 it->Hep().get_ID() != 0){
3064 hepID[i-startPosition] = it->Hep().get_ID();
3065 uniqueHepID.insert(it->Hep().get_ID());
3073 for(
int i=startPosition;i<startPosition+width;++i){
3077 for(Datsvd_mcdata_Manager::iterator
3078 it = svdMcHitMgr.begin(),
3079 end = svdMcHitMgr.end();
3082 if(m_datsvd_hit[startPosition+1-reverse]->rla() == it->rla() &&
3083 it->Hep().get_ID() != 0){
3084 hepID[i-startPosition] = it->Hep().get_ID();
3085 uniqueHepID.insert(it->Hep().get_ID());
3093 unsigned num = uniqueHepID.size();
3094 int* counter =
new int[
num];
3095 set< int, less<int> >::iterator u = uniqueHepID.begin();
3096 for(
int i=0;i<
num;++i) counter[i] = 0;
3098 for(
int i=0;i<
num;++i){
3099 for(
int j=0;j<width;++j){
3107 Gen_hepevt_Manager& genMgr = Gen_hepevt_Manager::get_manager();
3109 u = uniqueHepID.begin();
3110 for(
int i=0;i<
num;++i){
3111 std::cout << i <<
": TrackID = "<< *u - 1
3112 <<
", Count = " << counter[i]
3113 <<
", LundID = " << genMgr[*u-1].idhep() << std::endl;
3122 return &(genMgr[*(uniqueHepID.begin())-1]);
3133TCurlFinder::debugCheckSegments1(
void) {
3134#if DEBUG_CURL_SEGMENT
3137 std::cout <<
"(TCurlFinder)checking consistency of segement..." << std::endl;
3138 unsigned nA = m_unusedAxialHitsOriginal.length();
3140 for(
unsigned i=0;i<nA-1;++i){
3141 int superLayerId = (int)(m_unusedAxialHitsOriginal[i]->wire()->superLayerId());
3142 int layerId = (int)(m_unusedAxialHitsOriginal[i]->wire()->layerId());
3143 int localId = (int)(m_unusedAxialHitsOriginal[i]->wire()->localId());
3144 int localIdP = (int)(m_unusedAxialHitsOriginal[i]->wire()->localIdForPlus());
3145 int localIdM = (int)(m_unusedAxialHitsOriginal[i]->wire()->localIdForMinus());
3146 for(
unsigned j=i+1;j<nA;++j){
3147 int superLayerId2 = (int)(m_unusedAxialHitsOriginal[j]->wire()->superLayerId());
3148 int layerId2 = (int)(m_unusedAxialHitsOriginal[j]->wire()->layerId());
3149 int localId2 = (int)(m_unusedAxialHitsOriginal[j]->wire()->localId());
3150 if(superLayerId == superLayerId2){
3151 if(layerId2 == layerId){
3152 if(localIdP+1 == localId2 || localIdM-1 == localId2)
3153 debugCheckSegments(localId, layerId,
3155 }
else if(layerId2 == layerId-1 || layerId2 == layerId+1){
3156 if(offset(layerId) == offset(layerId2)){
3157 std::cout <<
"(TCurlFinder: Waring) Offset is same at the same superlayer!!" << std::endl;
3158 }
else if(offset(layerId) > offset(layerId2)){
3159 if(localId == localId2 || localIdP+1 == localId2)
3160 debugCheckSegments(localId, layerId,
3163 if(localId == localId2 || localIdM-1 == localId2)
3164 debugCheckSegments(localId, layerId,
3172 unsigned nS = m_unusedStereoHitsOriginal.length();
3174 for(
unsigned i=0;i<nS-1;++i){
3175 int superLayerId = (int)(m_unusedStereoHitsOriginal[i]->wire()->superLayerId());
3176 int layerId = (int)(m_unusedStereoHitsOriginal[i]->wire()->layerId());
3177 int localId = (int)(m_unusedStereoHitsOriginal[i]->wire()->localId());
3178 int localIdP = (int)(m_unusedStereoHitsOriginal[i]->wire()->localIdForPlus());
3179 int localIdM = (int)(m_unusedStereoHitsOriginal[i]->wire()->localIdForMinus());
3180 for(
unsigned j=i+1;j<nS;++j){
3181 int superLayerId2 = (int)(m_unusedStereoHitsOriginal[j]->wire()->superLayerId());
3182 int layerId2 = (int)(m_unusedStereoHitsOriginal[j]->wire()->layerId());
3183 int localId2 = (int)(m_unusedStereoHitsOriginal[j]->wire()->localId());
3184 if(superLayerId == superLayerId2){
3185 if(layerId2 == layerId){
3186 if(localIdP+1 == localId2 || localIdM-1 == localId2)
3187 debugCheckSegments(localId, layerId,
3189 }
else if(layerId2 == layerId-1 || layerId2 == layerId+1){
3190 if(offset(layerId) == offset(layerId2)){
3191 std::cout <<
"(TCurlFinder: Waring) Offset is same at the same superlayer!!" << std::endl;
3192 }
else if(offset(layerId) > offset(layerId2)){
3193 if(localId == localId2 || localIdP+1 == localId2)
3194 debugCheckSegments(localId, layerId,
3197 if(localId == localId2 || localIdM-1 == localId2)
3198 debugCheckSegments(localId, layerId,
3206 std::cout <<
"(TCurlFinder)...done check of segement!" << std::endl;
3207 std::cout <<
"(TCurlFinder)...If no warning message exists, check of segement is complete!" << std::endl;
3208 std::cout <<
"(TCurlFinder)...Note: a segment size should be 1 or 2 to use this debugger." << std::endl;
3214TCurlFinder::debugCheckSegments(
const double localId,
const double layerId,
3215 const double localId2,
const double layerId2) {
3217 unsigned nSeg = m_segmentList.length();
3218 unsigned nFound = 0;
3219 for(
unsigned i=0;i<nSeg;++i){
3220 unsigned nWire = m_segmentList[i]->list().length();
3221 unsigned mFound = 0;
3222 for(
unsigned j=0;j<nWire;++j){
3223 if(((m_segmentList[i]->list())[j])->wire()->layerId() == layerId &&
3224 ((m_segmentList[i]->list())[j])->wire()->localId() == localId)++mFound;
3225 if(((m_segmentList[i]->list())[j])->wire()->layerId() == layerId2 &&
3226 ((m_segmentList[i]->list())[j])->wire()->localId() == localId2)++mFound;
3228 if(mFound != 0 && mFound != 2){
3229 std::cout <<
"(TCurlFinder: Warning) Segment is inconsistency(0)!! mFound = " << mFound << std::endl;
3231 if(mFound == 2)++nFound;
3234 std::cout <<
"(TCurlFinder: Warning) Segment is inconsistency(1)!! nFound = " << nFound << std::endl;
3240TCurlFinder::debugCheckSegments0(
void) {
3241#if DEBUG_CURL_SEGMENT
3242 unsigned nSeg = m_segmentList.length();
3244 for(
unsigned i=0;i<nSeg;++i)nWire += m_segmentList[i]->list().length();
3246 unsigned nWireOriginal = m_unusedAxialHitsOriginal.length()+
3247 m_unusedStereoHitsOriginal.length();
3249 std::cout <<
"(TCurlFinder: SelfChecker) Segment Parts" << std::endl;
3250 std::cout <<
" MIN_SEGMENT = " << m_param.
MIN_SEGMENT << std::endl;
3251 std::cout <<
" Wire # of Orinal List = " << nWireOriginal << std::endl;
3252 std::cout <<
" Wire # of Segments = " << nWire << std::endl;
3253 std::cout <<
" If MIN_SEGMENT <= 1, above numbers should be same." << std::endl;
3254 std::cout <<
" If MIN_SEGMENT > 1, former >= latter." << std::endl;
3260TCurlFinder::debugCheckSegments2(
void) {
3261#if DEBUG_CURL_SEGMENT
3263#define DEBUG_TMP_N_CURL 50
3265 unsigned nSeg = m_segmentList.length();
3266 unsigned nWire[DEBUG_TMP_N_CURL] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3267 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3269 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
3271 for(
unsigned i=0;i<nSeg;++i){
3272 if(m_segmentList[i]->list().length() < DEBUG_TMP_N_CURL)
3273 ++(nWire[m_segmentList[i]->list().length()]);
3275 ++(nWire[DEBUG_TMP_N_CURL-1]);
3277 std::ifstream fin(
"tmp.wire.data");
3278 unsigned nTotalWire[DEBUG_TMP_N_CURL] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3279 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3280 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
3284 for(
int i=0;i<DEBUG_TMP_N_CURL;++i)fin >> nTotalWire[i];
3286 std::cout <<
"(TCurlFinder) tmp.wire.data does not exist!" << std::endl;
3288 for(
int i=0;i<DEBUG_TMP_N_CURL;++i)nTotalWire[i] += nWire[i];
3289 std::ofstream fout(
"tmp.wire.data");
3291 fout << nTotalWire[0];
3292 for(
int i=1;i<DEBUG_TMP_N_CURL;++i)fout <<
" " << nTotalWire[i];
3294 std::cout <<
"(TCurlFinder) tmp.wire.data can not be made!" << std::endl;
3300#undef DEBUG_CURL_DUMP
3301#undef DEBUG_CURL_SEGMENT
3302#undef DEBUG_CURL_GNUPLOT
double sin(const BesAngle a)
double cos(const BesAngle a)
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
HepGeom::Point3D< double > HepPoint3D
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
int sortByArcLength(const void *av, const void *bv)
TMLink * findIsolatedCloseHits(TMLink *link)
int sortBySequentialLength(const void *av, const void *bv)
int TCurlFinder_doubleCompare(const void *i, const void *j)
#define WireHitFindingValid
#define WireHitFittingValid
#define WireHitCurlFinder
#define WireHitInvalidForFit
int SortByWireId(const void *av, const void *bv)
Sorter.
EvtTensor3C eps(const EvtVector3R &v)
DOUBLE_PRECISION count[3]
double precision pisqo6 half
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
double radius(void) const
returns radious of helix.
double dr(void) const
returns an element of parameters.
const HepVector & a(void) const
returns helix parameters.
virtual double getReferField()=0
void add_point(double x, double y, double w=1)
TTrack * buildStereo(TTrack &track, const AList< TMLink > &) const
appends stereo hits to a track.
TTrack * buildStereoMC(TTrack &track, const AList< TMLink > &) const
void setParam(const TCurlFinderParameter &)
A class to represent a circle in tracking.
double radius(void) const
returns radius.
const HepPoint3D & center(void) const
returns position of center.
void property(double charge, double radius, HepPoint3D center)
sets circle properties.
int fitForCurl(int ipConst=0)
fits itself. Error was happened if return value is not zero.
double RANGE_FOR_STEREO_FIRST
double GOOD_DISTANCE_FOR_SALVAGE
double MIN_RADIUS_OF_STRANGE_TRACK
double minimum_2DTrackLength
double BAD_DISTANCE_FOR_SALVAGE
double TRACE2D_FIRST_SUPERLAYER
double RANGE_FOR_AXIAL_LAST2D_SEARCH
double RANGE_FOR_STEREO_LAST2D_SEARCH
double SELECTOR_STRANGE_PZ
double RANGE_FOR_STEREO_THIRD
double SELECTOR_MAX_IMPACT
unsigned SUPERLAYER_FOR_STEREO_SEARCH
double RANGE_FOR_STEREO_FORTH
unsigned SVD_RECONSTRUCTION
double minimum_closeHitsLength
unsigned DETERMINE_ONE_TRACK
double RANGE_FOR_STEREO_SECOND
double Z_DIFF_FOR_LAST_ATTEND
double RANGE_FOR_STEREO_SEARCH
double RANGE_FOR_STEREO_FIFTH
double SELECTOR_REPLACE_DZ
double SELECTOR_MAX_SIGMA
double RANGE_FOR_STEREO_SIXTH
double minimum_3DTrackLength
const double ALPHA_SAME_WITH_HELIX
double minimum_seedLength
double ULTIMATE_MIN_RADIUS_OF_STRANGE_TRACK
double RANGE_FOR_AXIAL_SEARCH
std::string name(void) const
returns name.
int doit(const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D)
main function
std::string version(void) const
returns version.
void clear(void)
cleans all members of this class
int fit(TTrackBase &) const
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
unsigned id(void) const
returns id.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
const HepVector3D & direction(void) const
returns direction vector of the wire.
const HepPoint3D & xyPosition(void) const
returns middle position of a wire. z componet is 0.
unsigned superLayerId(void) const
returns super layer id.
const HepPoint3D & backwardPosition(void) const
returns position in backward endplate.
A class to relate TMDCWireHit and TTrack objects.
TMLink * neighbor(unsigned int) const
returns neighbor TMLink.
const HepPoint3D & xyPosition(void) const
returns middle position of a wire. z componet is 0.
const TMDCWireHit * hit(void) const
returns a pointer to a hit.
const TMDCWire *const wire(void) const
returns a pointer to a wire.
const AList< TMLink > & list(void)
const unsigned size(void)
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 remove(TMLink &a)
removes a TMLink.
unsigned nLinks(unsigned mask=0) const
returns # of masked TMLinks assigned to this track object.
A class to represent a track in tracking.
void assign(unsigned maskForWireHit)
assigns wire hits to this track.
const Helix & helix(void) const
returns helix parameter.
double charge(void) const
returns charge.
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)