25 #ifndef PndFtsHoughSpace_H 26 #define PndFtsHoughSpace_H 36 #include "FairLogger.h" 39 #include "TClonesArray.h" 42 #include "FairField.h" 68 Double_t zRefPos = 0., Double_t interceptZx = 0.,
145 inline void Print()
const;
153 inline UInt_t
GetNHits()
const {
return fHitId.size(); };
160 void throwError(
const TString s)
const {
throw std::runtime_error(s.Data()); };
162 Bool_t setParametersForHsOption();
163 void filterInputHits();
165 inline void AddHitToHS(UInt_t hitId, Double_t rho);
166 inline void AddHitToHS(FairLink link, Double_t rho);
167 inline Bool_t IsHitFromTubeIdAlreadyAdded(
const Int_t tubeIdToAdd);
168 inline const PndFtsHit *getHitFromHS(UInt_t index)
const;
169 inline Int_t getHitIdFromHS(UInt_t index)
const {
return fHitId.at(index).GetHitId(); };
170 inline const TVector3 CalculateHitPosFromIntersectionsWithZxTrackModel(
const PndFtsHit *
const myHit)
const;
171 inline const TVector3 GetRawOrCalculatedHitPos(
const PndFtsHit *
const myHit)
const;
184 const Int_t fRefIndex;
188 std::vector<PndTrackCandHit> fHitId;
194 Double_t fOnlyUseHitsFromZ;
195 Double_t fOnlyUseHitsUpToZ;
196 Bool_t fUseNonSkewedStraws;
197 Bool_t fUseSkewedStraws;
199 Bool_t fKeepBConstant;
216 Double_t fInterceptZx;
224 static const Bool_t fCorrectPzx = kFALSE;
240 inline Bool_t FillHoles(
const Int_t lastBinX,
const Int_t lastBinY,
const Int_t currentBinY,
IdxPath *ptrThetaYIdxPathVec);
242 inline Double_t equationParabola(Double_t thetaRad, Double_t hitZShifted, Double_t hitXShifted, Double_t By)
245 const Double_t n = 1.;
246 const Double_t e = 1.;
247 const Double_t c = n * e / 2.;
249 Double_t yVal = 1. / c / By * (-hitZShifted *
sin(thetaRad) + hitXShifted *
cos(thetaRad)) / pow((hitZShifted *
cos(thetaRad) + hitXShifted *
sin(thetaRad)), 2);
256 inline Double_t equationParabolaPz(Double_t thetaRad, Double_t hitZShifted, Double_t hitXShifted, Double_t By)
259 const Double_t n = 1.;
260 const Double_t e = 1.;
261 const Double_t c = n * e / 2.;
264 Double_t yVal = c * By * pow((hitZShifted *
cos(thetaRad) + hitXShifted *
sin(thetaRad)), 2) / (-hitZShifted *
sin(thetaRad) + hitXShifted *
cos(thetaRad));
272 inline Double_t equationLineZxOrZy(Double_t thetaRad, Double_t hitZShifted, Double_t hitXLabSys)
275 Double_t yVal = -tan(thetaRad) * hitZShifted + hitXLabSys;
284 inline TString GetDebugOutName(TString title =
"", Int_t param = -1)
const;
287 void WriteHistoOfHoughSpace()
const;
290 TH2S MakeEmptyHistoOfSameDimensions(TString specifier =
"", Int_t index = -1)
const;
293 void WriteHistoOfAllPeaks(
const std::vector<PndFtsHoughSpacePeak> &peaksToPlot)
const;
296 void WriteHistoOfAllPaths()
const;
300 void WriteHistoOfAllPathsForEachMcTruthTrack()
const;
301 inline void PrintFoundTracklets(
const std::vector<PndFtsHoughTracklet> &tracklets)
const;
302 inline Double_t getByFromBField(Double_t hitXLabSys, Double_t hitYLabSys, Double_t hitZLabSys);
311 std::cout <<
"=========== PndFtsHoughSpace::Print() ==========" <<
'\n';
312 std::cout <<
"fZRefPos = " << fZRefPos <<
'\n';
313 std::cout <<
"fInterceptZx = " << fInterceptZx <<
'n';
317 void PndFtsHoughSpace::PrintFoundTracklets(
const std::vector<PndFtsHoughTracklet> &tracklets)
const 319 std::cout << tracklets.size() <<
" peaks found for " << GetName() <<
'\n';
321 for (UInt_t
i = 0;
i < tracklets.size(); ++
i) {
322 tracklets[
i].Print();
327 const PndFtsHit *PndFtsHoughSpace::getHitFromHS(UInt_t index)
const 330 throwError(
"index too high");
332 Int_t hitIndex = fHitId.at(index).GetHitId();
337 const TVector3 PndFtsHoughSpace::GetRawOrCalculatedHitPos(
const PndFtsHit *
const myHit)
const 342 myHit->Position(hitPos);
344 hitPos = CalculateHitPosFromIntersectionsWithZxTrackModel(myHit);
349 const TVector3 PndFtsHoughSpace::CalculateHitPosFromIntersectionsWithZxTrackModel(
const PndFtsHit *
const myHit)
const 351 if (0 == fAssociatedTrackCand)
352 throwError(
"No track cand associated with Hough space. Cannot calculate possible hit pos. from track model.");
356 const TVector3 wireCenter = ftsTube->
GetPosition();
358 const Double_t hitZLabSys = wireCenter.Z();
361 const Double_t xTM = fAssociatedTrackCand->
getXLabSys(hitZLabSys);
364 const Double_t param = (xTM - wireCenter.X()) / wireDirection.X();
366 const Double_t yStraw = wireCenter.Y() + param * wireDirection.Y();
368 TVector3 crossingPosition(xTM, yStraw, hitZLabSys);
369 return crossingPosition;
372 TString PndFtsHoughSpace::GetDebugOutName(TString title, Int_t param)
const 374 TString debugOut =
"/home/plots/";
377 if (-1 != fRefIndex) {
379 debugOut += fRefIndex;
388 Double_t PndFtsHoughSpace::getByFromBField(Double_t hitXLabSys, Double_t hitYLabSys, Double_t hitZLabSys)
392 if (kTRUE == fKeepBConstant) {
397 Double_t po[3], BB[3];
401 fField->GetFieldValue(po, BB);
void setVerbose(Int_t verbose)
friend F32vec4 cos(const F32vec4 &a)
std::vector< PndFtsHoughTracklet > FindAllPeaksWithTSpectrum2(const UInt_t minHeight)
Finds all peaks that satisfy the minimum height requirement minHeight.
const PndFtsTube * GetFtsTube(const PndFtsHit *const myHit) const
Returns pointer to the FTS tube corresponding to input FTS hit.
std::vector< PndFtsHoughTracklet > FindAllPeaksBinsWoMergingWithSearchWindow(const UInt_t minHeight, const Int_t vicinityLength=0)
Finds all peaks that satisfy the minimum height requirement minHeight.
Interface between PandaRoot (data input and output) and PndFtsHoughTrackFinder (implementation of PR ...
Double_t getZRefPos() const
friend F32vec4 sin(const F32vec4 &a)
TVector3 GetPosition() const
const PndFtsHit * GetFtsHit(UInt_t hitId) const
Returns pointer to the hit with index hitId in the FTS hit array.
std::vector< PndFtsHoughTracklet > FindAllPeaksScanPathsMergeBins(const UInt_t minHeight)
Finds all peaks that satisfy the minimum height requirement minHeight.
std::vector< PndFtsHoughTracklet > FindAllPeaksScanPathsMergeBinsCalculatingPaths(const UInt_t minHeight)
Finds all peaks that satisfy the minimum height requirement minHeight.
UInt_t GetEventNr() const
Returns the save debug flag.
Class for saving the result of one Hough transform for FTS PR.
std::ostream & operator<<(std::ostream &os, const IdxPath &outVector)
Double_t getXLabSys(const Double_t zLabSys) const
Class for Hough space based on TH2S (for the moment). Saves the hits which enter this Hough space and...
std::map< Int_t, IdxPath > HitIdxPathMap
Helper class for Hough space containing binning. Created: 09.02.2015.
PndFtsHoughSpace(const char *name=nullptr, const Int_t refIndex=-1, PndFtsHoughSpaceBinning binning=PndFtsHoughSpaceBinning(), Double_t zRefPos=0., Double_t interceptZx=0., PndFtsHoughTrackCand *associatedTrackCand=nullptr, PndFtsHoughTrackerTask *trackerTask=nullptr)
TVector3 GetWireDirection() const
Class for saving a FTS track cand. for Hough transform based FTS PR.
std::vector< PndFtsHoughTracklet > FindAllPeaksBlanko(const UInt_t minHeight)
Finds all peaks that satisfy the minimum height requirement minHeight.
ClassDef(PndFtsHoughSpace, 1)
Double_t getInterceptZx() const
std::pair< Int_t, IdxPath > HitIdxPathPair
void FillHoughSpace()
Fills the Hough space using the equation which corresponds to the name of the Hough space...
std::vector< Int_t > IdxPath