BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TCurlFinder.cxx File Reference
#include <fstream>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include "TrkReco/TCircle.h"
#include "TrkReco/TCurlFinder.h"
#include "TrkReco/TMDCWire.h"
#include "TrkReco/TMDCWireHit.h"
#include "TrkReco/TMLink.h"
#include "TrkReco/TSegmentCurl.h"
#include "TrkReco/TTrack.h"
#include "MdcTables/MdcTables.h"

Go to the source code of this file.

Macros

#define DEBUG_CURL_DUMP   0
#define DEBUG_CURL_SEGMENT   0
#define DEBUG_CURL_GNUPLOT   0
#define DEBUG_CURL_MC   0

Functions

int sortBySequentialLength (const void *av, const void *bv)
int sortByArcLength (const void *av, const void *bv)
int TCurlFinder_doubleCompare (const void *i, const void *j)
TMLinkfindIsolatedCloseHits (TMLink *link)

Macro Definition Documentation

◆ DEBUG_CURL_DUMP

#define DEBUG_CURL_DUMP   0

Definition at line 26 of file TCurlFinder.cxx.

◆ DEBUG_CURL_GNUPLOT

#define DEBUG_CURL_GNUPLOT   0

Definition at line 28 of file TCurlFinder.cxx.

◆ DEBUG_CURL_MC

#define DEBUG_CURL_MC   0

Definition at line 29 of file TCurlFinder.cxx.

◆ DEBUG_CURL_SEGMENT

#define DEBUG_CURL_SEGMENT   0

Definition at line 27 of file TCurlFinder.cxx.

Function Documentation

◆ findIsolatedCloseHits()

TMLink * findIsolatedCloseHits ( TMLink * link)

Definition at line 2594 of file TCurlFinder.cxx.

2594 {
2595 int nNeighbor = 0;
2596 int nIsolated = 0;
2597 TMLink* isolatedLink[2] = { NULL, NULL };
2598 unsigned layerID = link->wire()->layerId();
2599 unsigned localID = link->wire()->localId();
2600 for ( int i = 0; i < 6; ++i )
2601 {
2602 if ( link->neighbor( i ) )
2603 {
2604 if ( link->neighbor( i )->wire()->layerId() == layerID )
2605 {
2606 ++nNeighbor;
2607 int isolated = 1;
2608 int testEach = 0; // for test
2609 for ( int j = 0; j < 6; ++j )
2610 {
2611 if ( link->neighbor( i )->neighbor( j ) )
2612 {
2613 if ( link->neighbor( i )->neighbor( j )->wire()->layerId() == layerID &&
2614 link->neighbor( i )->neighbor( j )->wire()->localId() != localID )
2615 { isolated = 0; }
2616#if 1
2617 else if ( link->neighbor( i )->neighbor( j )->wire()->layerId() == layerID &&
2618 link->neighbor( i )->neighbor( j )->wire()->localId() == localID )
2619 { testEach = 1; }
2620#endif
2621 }
2622 else break;
2623 }
2624 if ( isolated == 1 )
2625 {
2626 if ( nIsolated < 2 ) isolatedLink[nIsolated] = link->neighbor( i );
2627 ++nIsolated;
2628 }
2629#if 1
2630 if ( testEach == 0 )
2631 { std::cout << "Why?? Neighborhood info. dose not exist!!" << std::endl; }
2632#endif
2633 }
2634 }
2635 else break;
2636 }
2637#if 0
2638 std::cout << "isolated/neighbor # = " << nIsolated << "/" << nNeighbor << std::endl;
2639 std::cout << "layer ID = " << layerID << " ";
2640 std::cout << "local ID = " << localID << " --> ";
2641 if(isolatedLink[0])std::cout << isolatedLink[0]->wire()->localId() << " ";
2642 if(isolatedLink[1])std::cout << isolatedLink[1]->wire()->localId() << " ";
2643 std::cout << std::endl;
2644#endif
2645 if ( nIsolated == 1 && nNeighbor == 1 && isolatedLink[0] ) return isolatedLink[0];
2646 else return NULL;
2647}
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.

◆ sortByArcLength()

int sortByArcLength ( const void * av,
const void * bv )

Definition at line 179 of file TCurlFinder.cxx.

179 {
180 const TMLink** a( (const TMLink**)av );
181 const TMLink** b( (const TMLink**)bv );
182 if ( ( *a )->position().x() > ( *b )->position().x() ) { return 1; }
183 else if ( ( *a )->position().x() == ( *b )->position().x() ) { return 0; }
184 else { return -1; }
185}

◆ sortBySequentialLength()

int sortBySequentialLength ( const void * av,
const void * bv )

Definition at line 163 of file TCurlFinder.cxx.

163 {
164 const TSegmentCurl** a( (const TSegmentCurl**)av );
165 const TSegmentCurl** b( (const TSegmentCurl**)bv );
166 if ( ( *a )->maxSeq() < ( *b )->maxSeq() ) { return 1; }
167 else if ( ( *a )->maxSeq() == ( *b )->maxSeq() ) { return 0; }
168 else { return -1; }
169}

◆ TCurlFinder_doubleCompare()

int TCurlFinder_doubleCompare ( const void * i,
const void * j )

Definition at line 1520 of file TCurlFinder.cxx.

1520 {
1521 if ( *( static_cast<const double*>( i ) ) > *( static_cast<const double*>( j ) ) ) return 1;
1522 if ( *( static_cast<const double*>( i ) ) < *( static_cast<const double*>( j ) ) ) return -1;
1523 return 0;
1524}