FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | List of all members
PndSttNeighborhoodCreator Class Reference

#include <PndSttNeighborhoodCreator.h>

Inheritance diagram for PndSttNeighborhoodCreator:

Public Member Functions

 PndSttNeighborhoodCreator ()
 
virtual ~PndSttNeighborhoodCreator ()
 
std::vector< int > FindNeighbors (PndSttTube *tube)
 

Protected Member Functions

std::vector< std::pair< int,
int > > 
GetListOfSectorRowsToCompare (PndSttTube *tube)
 
bool Compare (PndSttTube *tube1, PndSttTube *tube2, double tolerance)
 
double GetTolerance (PndSttTube *tube1, PndSttTube *tube2)
 
 ClassDef (PndSttNeighborhoodCreator, 1)
 

Detailed Description

Definition at line 16 of file PndSttNeighborhoodCreator.h.

Constructor & Destructor Documentation

PndSttNeighborhoodCreator::PndSttNeighborhoodCreator ( )

Definition at line 19 of file PndSttNeighborhoodCreator.cxx.

19  {
20  // TODO Auto-generated constructor stub
21 
22 }
PndSttNeighborhoodCreator::~PndSttNeighborhoodCreator ( )
virtual

Definition at line 24 of file PndSttNeighborhoodCreator.cxx.

24  {
25  // TODO Auto-generated destructor stub
26 }

Member Function Documentation

PndSttNeighborhoodCreator::ClassDef ( PndSttNeighborhoodCreator  ,
 
)
protected
bool PndSttNeighborhoodCreator::Compare ( PndSttTube tube1,
PndSttTube tube2,
double  tolerance 
)
protected

Definition at line 78 of file PndSttNeighborhoodCreator.cxx.

References PndSttTube::GetDistance().

Referenced by FindNeighbors().

79 {
80  double distance = tube1->GetDistance(tube2);
81  return distance < tolerance;
82 }
Double_t GetDistance(PndSttTube *tube)
Definition: PndSttTube.cxx:153
std::vector< int > PndSttNeighborhoodCreator::FindNeighbors ( PndSttTube tube)

Definition at line 28 of file PndSttNeighborhoodCreator.cxx.

References Compare(), GetListOfSectorRowsToCompare(), PndSttTubeIdMap::GetRowInSector(), GetTolerance(), PndSttTubeMap::GetTube(), PndSttTubeMap::Instance(), and PndSttTubeIdMap::Instance().

Referenced by PndSttTubeMapCreatorRoot::AssignNeighbors().

29 {
30  std::vector<int> result;
31  std::vector< std::pair<int, int> > sectorRows = GetListOfSectorRowsToCompare(tube);
32 
33  for (auto pairs : sectorRows){
34  std::vector<int> tubesToTest = PndSttTubeIdMap::Instance()->GetRowInSector(pairs.first, pairs.second);
35  for (auto tubeId : tubesToTest){
36  PndSttTube* testTube = PndSttTubeMap::Instance()->GetTube(tubeId);
37  if (testTube == tube) continue;
38  double tolerance = GetTolerance(tube, testTube);
39  if (Compare(tube, testTube, tolerance) == true){
40  result.push_back(tubeId);
41  }
42  }
43  }
44  return result;
45 }
vector< int > GetRowInSector(int sector, int row)
double GetTolerance(PndSttTube *tube1, PndSttTube *tube2)
bool Compare(PndSttTube *tube1, PndSttTube *tube2, double tolerance)
PndSttTube * GetTube(int tubeId)
Definition: PndSttTubeMap.h:22
static PndSttTubeMap * Instance()
static PndSttTubeIdMap * Instance()
std::vector< std::pair< int, int > > GetListOfSectorRowsToCompare(PndSttTube *tube)
std::vector< std::pair< int, int > > PndSttNeighborhoodCreator::GetListOfSectorRowsToCompare ( PndSttTube tube)
protected

Definition at line 47 of file PndSttNeighborhoodCreator.cxx.

References PndSttTube::GetLayerID(), PndSttTube::GetSectorID(), offset(), and row.

Referenced by FindNeighbors().

48 {
49  int sector = tube->GetSectorID();
50  int row = tube->GetLayerID();
51 
52  std::vector<int> testRows;
53  std::vector<int> testSectors;
54  std::vector<std::pair<int, int> > result;
55 
56  for (int testRow = row-1; testRow < row+2 && testRow < 29 ; testRow++){
57  if (testRow > -1) testRows.push_back(testRow);
58  }
59 
60  int offset = (sector < 3 ? 0:3);
61 
62  for (int testSector = sector-1; testSector < 3 + offset; testSector++){
63  if (testSector > (offset - 1)) testSectors.push_back(testSector);
64  }
65 
66  for (auto testSector : testSectors){
67  for (auto testRow : testRows) {
68  result.push_back(std::make_pair(testSector, testRow));
69  }
70  }
71 
72 // std::cout << "PndSttNeighborhoodCreator::GetListOfSectorRowsToCompare sector/row " << tube->GetTubeID() << " " << sector << "/" << row << std::endl;
73 // for_each(result.begin(), result.end(), [](std::pair<int, int>& p){std::cout << p.first << "/" << p.second << std::endl;});
74 
75  return result;
76 }
int row
Definition: anaLmdDigi.C:67
TVector3 offset(2, 0, 0)
int GetLayerID()
Definition: PndSttTube.cxx:128
int GetSectorID()
Definition: PndSttTube.cxx:124
double PndSttNeighborhoodCreator::GetTolerance ( PndSttTube tube1,
PndSttTube tube2 
)
protected

Definition at line 84 of file PndSttNeighborhoodCreator.cxx.

References PndSttTube::GetLayerID(), PndSttTube::IsParallel(), and PndSttTube::IsSkew().

Referenced by FindNeighbors().

84  {
85 
86  double tolerance0 = 1.2; // parallel/parallel && inner parallel/skew
87  double tolerance1 = 1.3; // skew/skew
88  double tolerance2 = 1.5; // outer parallel/skew
89  double tolerance = 1.5; // CHECK tolerance
90 
91 
92  if (tube2->IsSkew() == kTRUE && tube1->IsSkew() == kTRUE)
93  tolerance = tolerance1;
94  else if (tube2->IsParallel() == kTRUE && tube1->IsParallel() == kTRUE)
95  tolerance = tolerance0;
96  else {
97  if (tube1->GetLayerID() > 17 || tube2->GetLayerID() > 17)
98  tolerance = tolerance2;
99  else
100  tolerance = tolerance1;
101  }
102  return tolerance;
103 }
int GetLayerID()
Definition: PndSttTube.cxx:128
bool IsParallel()
Definition: PndSttTube.h:66
bool IsSkew()
Definition: PndSttTube.h:70

The documentation for this class was generated from the following files: