FairRoot/PandaRoot
PndSttNeighborhoodCreator.cxx
Go to the documentation of this file.
1 /*
2  * PndSttNeighborhoodCreator.cxx
3  *
4  * Created on: 03.08.2018
5  * Author: tstockmanns
6  */
7 
9 #include "PndSttTube.h"
10 #include "PndSttTubeIdMap.h"
11 #include "PndSttTubeMap.h"
12 
13 #include <utility>
14 #include <algorithm>
15 #include <iostream>
16 
18 
20  // TODO Auto-generated constructor stub
21 
22 }
23 
25  // TODO Auto-generated destructor stub
26 }
27 
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 }
46 
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 }
77 
78 bool PndSttNeighborhoodCreator::Compare(PndSttTube* tube1, PndSttTube* tube2, double tolerance)
79 {
80  double distance = tube1->GetDistance(tube2);
81  return distance < tolerance;
82 }
83 
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 }
vector< int > GetRowInSector(int sector, int row)
int row
Definition: anaLmdDigi.C:67
double GetTolerance(PndSttTube *tube1, PndSttTube *tube2)
bool Compare(PndSttTube *tube1, PndSttTube *tube2, double tolerance)
PndSttTube * GetTube(int tubeId)
Definition: PndSttTubeMap.h:22
TVector3 offset(2, 0, 0)
std::vector< int > FindNeighbors(PndSttTube *tube)
Double_t GetDistance(PndSttTube *tube)
Definition: PndSttTube.cxx:153
int GetLayerID()
Definition: PndSttTube.cxx:128
static PndSttTubeMap * Instance()
static PndSttTubeIdMap * Instance()
std::vector< std::pair< int, int > > GetListOfSectorRowsToCompare(PndSttTube *tube)
ClassImp(PndAnaContFact)
bool IsParallel()
Definition: PndSttTube.h:66
int GetSectorID()
Definition: PndSttTube.cxx:124
bool IsSkew()
Definition: PndSttTube.h:70