CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
TCurlFinder.cxx File Reference
#include <iostream>
#include <fstream>
#include <math.h>
#include <stdlib.h>
#include "CLHEP/String/Strings.h"
#include "TrkReco/TCurlFinder.h"
#include "TrkReco/TMDCWire.h"
#include "TrkReco/TMDCWireHit.h"
#include "TrkReco/TMLink.h"
#include "TrkReco/TCircle.h"
#include "TrkReco/TTrack.h"
#include "TrkReco/TSegmentCurl.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 2400 of file TCurlFinder.cxx.

2401{
2402 int nNeighbor = 0;
2403 int nIsolated = 0;
2404 TMLink * isolatedLink[2] = {NULL,NULL};
2405 unsigned layerID = link->wire()->layerId();
2406 unsigned localID = link->wire()->localId();
2407 for(int i=0;i<6;++i){
2408 if(link->neighbor(i)){
2409 if(link->neighbor(i)->wire()->layerId() == layerID){
2410 ++nNeighbor;
2411 int isolated = 1;
2412 int testEach = 0; // for test
2413 for(int j=0;j<6;++j){
2414 if(link->neighbor(i)->neighbor(j)){
2415 if(link->neighbor(i)->neighbor(j)->wire()->layerId() == layerID &&
2416 link->neighbor(i)->neighbor(j)->wire()->localId() != localID){
2417 isolated = 0;
2418 }
2419#if 1
2420 else if(link->neighbor(i)->neighbor(j)->wire()->layerId() == layerID &&
2421 link->neighbor(i)->neighbor(j)->wire()->localId() == localID){
2422 testEach = 1;
2423 }
2424#endif
2425 }else break;
2426 }
2427 if(isolated == 1){
2428 if(nIsolated < 2)
2429 isolatedLink[nIsolated] = link->neighbor(i);
2430 ++nIsolated;
2431 }
2432#if 1
2433 if(testEach == 0){
2434 std::cout << "Why?? Neighborhood info. dose not exist!!" << std::endl;
2435 }
2436#endif
2437 }
2438 }else break;
2439 }
2440#if 0
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;
2447#endif
2448 if(nIsolated == 1 &&
2449 nNeighbor == 1 && isolatedLink[0])return isolatedLink[0];
2450 else return NULL;
2451}
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 226 of file TCurlFinder.cxx.

226 {
227 const TMLink **a((const TMLink**)av);
228 const TMLink **b((const TMLink**)bv);
229 if( (*a)->position().x() > (*b)->position().x() ){
230 return 1;
231 }else if( (*a)->position().x() == (*b)->position().x() ){
232 return 0;
233 }else{
234 return -1;
235 }
236}

◆ sortBySequentialLength()

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

Definition at line 200 of file TCurlFinder.cxx.

200 {
201 const TSegmentCurl **a((const TSegmentCurl**)av);
202 const TSegmentCurl **b((const TSegmentCurl**)bv);
203 if( (*a)->maxSeq() < (*b)->maxSeq() ){
204 return 1;
205 }else if( (*a)->maxSeq() == (*b)->maxSeq() ){
206 return 0;
207 }else{
208 return -1;
209 }
210}

◆ TCurlFinder_doubleCompare()

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

Definition at line 1454 of file TCurlFinder.cxx.

1454 {
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;
1457 return 0;
1458}