PandaRoot
PndApollonius::TripletSolution Struct Reference

#include <PndApolloniusTriplet.h>

Public Types

enum  detID {
  MVDpixel, MVDstrip, STT, GEM,
  NOTDEFINED
}
 

Public Member Functions

 TripletSolution ()
 
 TripletSolution (TVector3 track)
 
void AddHits (detID detector, std::vector< FairHit *> data)
 
void AddHits (std::vector< PndSttHit *> sttHits)
 
void AddHit (detID detector, FairHit *data)
 
int GetNHits ()
 
TVector2 HitOnTrack (FairHit *hit)
 
void IsClockwise ()
 
void SortHits (TVector2 &firstHit, detID detector)
 
void SortStt (PndSttGeometryMap *fGeometryMap)
 
FairHit * GetFirstHit (PndSttGeometryMap *fGeometryMap)
 
void SortAllHits (PndSttGeometryMap *fGeometryMap)
 

Public Attributes

std::vector< std::string > detID_Names {"MVD_Pixel", "MVD_Strip", "STT", "GEM", "NOTDEFINED"}
 
Triplet fTriplet {nullptr, nullptr, nullptr}
 
TVector3 fTrack
 
std::map< detID, std::vector< FairHit * > > fHits
 
std::vector< FairHit * > fAllHits
 
double fMeanSquare = 1000000.
 
bool fClockwise = true
 

Friends

std::ostream & operator<< (std::ostream &output, const TripletSolution &t)
 

Detailed Description

Definition at line 53 of file PndApolloniusTriplet.h.

Member Enumeration Documentation

◆ detID

Constructor & Destructor Documentation

◆ TripletSolution() [1/2]

PndApollonius::TripletSolution::TripletSolution ( )
inline

Definition at line 58 of file PndApolloniusTriplet.h.

58 {};

◆ TripletSolution() [2/2]

PndApollonius::TripletSolution::TripletSolution ( TVector3  track)
inline

Definition at line 59 of file PndApolloniusTriplet.h.

Member Function Documentation

◆ AddHit()

void PndApollonius::TripletSolution::AddHit ( detID  detector,
FairHit *  data 
)
inline

Definition at line 65 of file PndApolloniusTriplet.h.

66  {
67  if (fHits.count(detector) == 0) {
68  fHits[detector];
69  }
70  if (std::find(fHits[detector].begin(), fHits[detector].end(), data) == fHits[detector].end()) { // add only if hit is not in dataset
71  fHits[detector].push_back(data);
72  }
73  }
std::map< detID, std::vector< FairHit * > > fHits

◆ AddHits() [1/2]

void PndApollonius::TripletSolution::AddHits ( detID  detector,
std::vector< FairHit *>  data 
)
inline

Definition at line 61 of file PndApolloniusTriplet.h.

Referenced by PndApollonius::ApolloniusTripletFunctions::FindHitsCloseToCircle().

61 { fHits[detector] = data; }
std::map< detID, std::vector< FairHit * > > fHits

◆ AddHits() [2/2]

void PndApollonius::TripletSolution::AddHits ( std::vector< PndSttHit *>  sttHits)
inline

Definition at line 63 of file PndApolloniusTriplet.h.

63 { fHits[STT].insert(fHits[STT].end(), sttHits.begin(), sttHits.end()); }
std::map< detID, std::vector< FairHit * > > fHits

◆ GetFirstHit()

FairHit* PndApollonius::TripletSolution::GetFirstHit ( PndSttGeometryMap fGeometryMap)
inline

Definition at line 147 of file PndApolloniusTriplet.h.

References GEM.

148  {
149  std::vector<FairHit *> mvdPixelHits = fHits[MVDpixel];
150  std::vector<FairHit *> mvdStripHits = fHits[MVDstrip];
151  std::vector<FairHit *> sttHits = fHits[STT];
152  std::vector<FairHit *> gemHits = fHits[GEM];
153 
154  if (mvdPixelHits.size() > 0) {
155  double dSquare = 100000.;
156  FairHit *first = nullptr;
157  for (auto hit : mvdPixelHits) {
158  if (((hit->GetX() * hit->GetX()) + (hit->GetY() * hit->GetY() + (hit->GetZ() * hit->GetZ()))) < dSquare) {
159  dSquare = ((hit->GetX() * hit->GetX()) + (hit->GetY() * hit->GetY()) + (hit->GetZ() * hit->GetZ()));
160  first = hit;
161  }
162  }
163  return first;
164  } else if (mvdStripHits.size() > 0) {
165  double dSquare = 100000.;
166  FairHit *first = nullptr;
167  for (auto hit : mvdStripHits) {
168  if (((hit->GetX() * hit->GetX()) + (hit->GetY() * hit->GetY() + (hit->GetZ() * hit->GetZ()))) < dSquare) {
169  dSquare = ((hit->GetX() * hit->GetX()) + (hit->GetY() * hit->GetY()) + (hit->GetZ() * hit->GetZ()));
170  first = hit;
171  }
172  }
173  return first;
174 
175  } else if (sttHits.size() > 0) {
176  return sttHits.front();
177  } else if (gemHits.size() > 0) {
178  double dSquare = 100000.;
179  FairHit *first = nullptr;
180  for (auto hit : gemHits) {
181  if (((hit->GetX() * hit->GetX()) + (hit->GetY() * hit->GetY())) < dSquare) {
182  dSquare = ((hit->GetX() * hit->GetX()) + (hit->GetY() * hit->GetY()));
183  first = hit;
184  }
185  }
186  return first;
187  } else
188  return nullptr;
189  }
std::map< detID, std::vector< FairHit * > > fHits

◆ GetNHits()

◆ HitOnTrack()

TVector2 PndApollonius::TripletSolution::HitOnTrack ( FairHit *  hit)
inline

Definition at line 77 of file PndApolloniusTriplet.h.

77 { return TVector2(hit->GetX() - fTrack.X(), hit->GetY() - fTrack.Y()); }

◆ IsClockwise()

void PndApollonius::TripletSolution::IsClockwise ( )
inline

Definition at line 79 of file PndApolloniusTriplet.h.

80  {
81  std::vector<FairHit *> sttHits = fHits[STT];
82  if (sttHits.size() > 2) {
83 
84  fClockwise = true;
85  std::sort(sttHits.begin(), sttHits.end(), [](FairHit *first, FairHit *second) { return (*(static_cast<PndSttHit *>(first)) < *(static_cast<PndSttHit *>(second))); });
86  TVector2 firstHit(HitOnTrack(sttHits.front()));
87  TVector2 secondHit(HitOnTrack(sttHits.back()));
88  if (firstHit.DeltaPhi(secondHit) < 0) {
89  fClockwise = false;
90  }
91  }
92  }
TVector2 HitOnTrack(FairHit *hit)
std::map< detID, std::vector< FairHit * > > fHits

◆ SortAllHits()

void PndApollonius::TripletSolution::SortAllHits ( PndSttGeometryMap fGeometryMap)
inline

Definition at line 191 of file PndApolloniusTriplet.h.

References GEM.

192  {
193  std::vector<FairHit *> sttHits = fHits[STT];
194  fAllHits.clear();
195  if (sttHits.size() > 2) {
196  FairHit *first = GetFirstHit(fGeometryMap);
197 
198  TVector2 firstHit(HitOnTrack(first));
199  TVector2 secondHit(HitOnTrack(sttHits.back()));
200  bool hasChanged = false;
201  if (firstHit.DeltaPhi(secondHit) < 0 && fClockwise) {
202  hasChanged = true;
203  fClockwise = false;
204  } else if (firstHit.DeltaPhi(secondHit) >= 0 && !fClockwise) {
205  hasChanged = true;
206  fClockwise = true;
207  }
208 
209  if (hasChanged) {
210  SortHits(firstHit, MVDpixel);
211  SortHits(firstHit, MVDstrip);
212  SortHits(firstHit, STT);
213  SortHits(firstHit, GEM);
214  fAllHits.insert(fAllHits.end(), fHits[MVDpixel].begin(), fHits[MVDpixel].end());
215  fAllHits.insert(fAllHits.end(), fHits[MVDstrip].begin(), fHits[MVDstrip].end());
216  fAllHits.insert(fAllHits.end(), fHits[STT].begin(), fHits[STT].end());
217  fAllHits.insert(fAllHits.end(), fHits[GEM].begin(), fHits[GEM].end());
218  } else {
219  SortHits(firstHit, MVDpixel);
220  SortHits(firstHit, MVDstrip);
221  fAllHits.insert(fAllHits.end(), fHits[MVDpixel].begin(), fHits[MVDpixel].end());
222  fAllHits.insert(fAllHits.end(), fHits[MVDstrip].begin(), fHits[MVDstrip].end());
223  fAllHits.insert(fAllHits.end(), fHits[STT].begin(), fHits[STT].end());
224  SortHits(firstHit, GEM);
225  fAllHits.insert(fAllHits.end(), fHits[GEM].begin(), fHits[GEM].end());
226  }
227  }
228  }
FairHit * GetFirstHit(PndSttGeometryMap *fGeometryMap)
void SortHits(TVector2 &firstHit, detID detector)
TVector2 HitOnTrack(FairHit *hit)
std::map< detID, std::vector< FairHit * > > fHits
std::vector< FairHit * > fAllHits

◆ SortHits()

void PndApollonius::TripletSolution::SortHits ( TVector2 &  firstHit,
detID  detector 
)
inline

Definition at line 94 of file PndApolloniusTriplet.h.

References CAMath::Pi().

95  {
96  if (fClockwise) {
97  std::sort(fHits[detector].begin(), fHits[detector].end(), [&](FairHit *a, FairHit *b) {
98  double phi_a = HitOnTrack(a).DeltaPhi(firstHit);
99  double phi_b = HitOnTrack(b).DeltaPhi(firstHit);
100  if (phi_a <= 0)
101  phi_a += 2 * TMath::Pi();
102  if (phi_b <= 0)
103  phi_b += 2 * TMath::Pi();
104 
105  return (phi_a > phi_b);
106  });
107  } else {
108  std::sort(fHits[detector].begin(), fHits[detector].end(), [&](FairHit *a, FairHit *b) {
109  double phi_a = HitOnTrack(a).DeltaPhi(firstHit);
110  double phi_b = HitOnTrack(b).DeltaPhi(firstHit);
111  if (phi_a < 0)
112  phi_a += 2 * TMath::Pi();
113  if (phi_b < 0)
114  phi_b += 2 * TMath::Pi();
115  return (phi_a < phi_b);
116  });
117  }
118  }
TVector2 HitOnTrack(FairHit *hit)
static float Pi()
Definition: PndCAMath.h:115
std::map< detID, std::vector< FairHit * > > fHits

◆ SortStt()

void PndApollonius::TripletSolution::SortStt ( PndSttGeometryMap fGeometryMap)
inline

Definition at line 120 of file PndApolloniusTriplet.h.

References PndSttGeometryMap::GetRow().

Referenced by PndApollonius::ApolloniusTripletFunctions::FindHitsCloseToCircle(), and PndApollonius::ApolloniusTripletFunctions::IsContinuous().

121  {
122  std::vector<FairHit *> sttHits = fHits[STT];
123  if (sttHits.size() > 2) {
124 
125  IsClockwise();
126 
127  std::sort(sttHits.begin(), sttHits.end(), [](FairHit *first, FairHit *second) { return (*(static_cast<PndSttHit *>(first)) < *(static_cast<PndSttHit *>(second))); });
128  std::vector<FairHit *> possibleFirstHits;
129  int minRow = 100;
130  for( auto hit : sttHits){
131  if (fGeometryMap->GetRow(static_cast<PndSttHit *>(hit)->GetTubeID()) <= minRow) {
132  minRow = fGeometryMap->GetRow(static_cast<PndSttHit *>(hit)->GetTubeID());
133  possibleFirstHits.push_back(hit);
134  } else
135  break;
136  }
137  TVector2 firstHit;
138  if (fClockwise) {
139  firstHit = HitOnTrack(possibleFirstHits.back());
140  } else {
141  firstHit = HitOnTrack(possibleFirstHits.front());
142  }
143  SortHits(firstHit, STT);
144  }
145  }
int GetRow(int strawindex) const
void SortHits(TVector2 &firstHit, detID detector)
TVector2 HitOnTrack(FairHit *hit)
std::map< detID, std::vector< FairHit * > > fHits

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  output,
const TripletSolution t 
)
friend

Definition at line 230 of file PndApolloniusTriplet.h.

231  {
232  output << "Track x/y/r " << t.fTrack.X() << "/" << t.fTrack.Y() << "/" << t.fTrack.Z() << " ";
233  if (t.fTriplet.fTripletHits[0] != nullptr) {
234  output << " trip: " << t.fTriplet.fTripletHits[0]->GetTubeID() << "/" << t.fTriplet.fTripletHits[1]->GetTubeID() << "/" << t.fTriplet.fTripletHits[2]->GetTubeID() << " ";
235  }
236  if (t.fHits.count(TripletSolution::detID::MVDpixel) > 0) {
237  output << t.detID_Names.at(TripletSolution::detID::MVDpixel) << " : ";
238  for (auto hit : t.fHits.at(TripletSolution::detID::MVDpixel)) {
239  output << hit->GetEntryNr() << "/";
240  }
241  output << " ";
242  }
243  if (t.fHits.count(TripletSolution::detID::MVDstrip) > 0) {
244  output << t.detID_Names.at(TripletSolution::detID::MVDstrip) << " : ";
245  for (auto hit : t.fHits.at(TripletSolution::detID::MVDstrip)) {
246  output << hit->GetEntryNr() << "/";
247  }
248  output << " ";
249  }
250  if (t.fHits.count(TripletSolution::detID::STT) > 0) {
251  output << t.detID_Names.at(TripletSolution::detID::STT) << " : ";
252  for (auto hit : t.fHits.at(TripletSolution::detID::STT)) {
253  PndSttHit *myHit = static_cast<PndSttHit *>(hit);
254  output << myHit->GetTubeID() << "/";
255  }
256  output << " ";
257  }
258  if (t.fHits.count(TripletSolution::detID::GEM) > 0) {
259  output << t.detID_Names.at(TripletSolution::detID::GEM) << " : ";
260  for (auto hit : t.fHits.at(TripletSolution::detID::GEM)) {
261  output << hit->GetEntryNr() << "/";
262  }
263  output << " ";
264  }
265 
266  output << "MSD: " << t.fMeanSquare;
267  return output;
268  }
Int_t GetTubeID() const
Definition: PndSttHit.h:71
#define GEM

Member Data Documentation

◆ detID_Names

std::vector<std::string> PndApollonius::TripletSolution::detID_Names {"MVD_Pixel", "MVD_Strip", "STT", "GEM", "NOTDEFINED"}

Definition at line 56 of file PndApolloniusTriplet.h.

◆ fAllHits

std::vector<FairHit *> PndApollonius::TripletSolution::fAllHits

Definition at line 273 of file PndApolloniusTriplet.h.

◆ fClockwise

bool PndApollonius::TripletSolution::fClockwise = true

Definition at line 275 of file PndApolloniusTriplet.h.

◆ fHits

◆ fMeanSquare

double PndApollonius::TripletSolution::fMeanSquare = 1000000.

◆ fTrack

TVector3 PndApollonius::TripletSolution::fTrack

◆ fTriplet

Triplet PndApollonius::TripletSolution::fTriplet {nullptr, nullptr, nullptr}

The documentation for this struct was generated from the following file: