37 #ifndef PndFtsHoughSpace_H 38 #define PndFtsHoughSpace_H 48 #include "FairLogger.h" 51 #include "TClonesArray.h" 54 #include "FairField.h" 80 Double_t zRefPos = 0., Double_t interceptZx = 0.,
157 inline void Print()
const;
165 inline UInt_t
GetNHits()
const {
return fHitId.size(); };
172 void throwError(
const TString s)
const {
throw std::runtime_error(s.Data()); };
174 Bool_t setParametersForHsOption();
175 void filterInputHits();
177 inline void AddHitToHS(UInt_t hitId, Double_t rho);
178 inline void AddHitToHS(FairLink link, Double_t rho);
179 inline Bool_t IsHitFromTubeIdAlreadyAdded(
const Int_t tubeIdToAdd);
180 inline const PndFtsHit *getHitFromHS(UInt_t index)
const;
181 inline Int_t getHitIdFromHS(UInt_t index)
const {
return fHitId.at(index).GetHitId(); };
182 inline const TVector3 CalculateHitPosFromIntersectionsWithZxTrackModel(
const PndFtsHit *
const myHit)
const;
183 inline const TVector3 GetRawOrCalculatedHitPos(
const PndFtsHit *
const myHit)
const;
196 const Int_t fRefIndex;
200 std::vector<PndTrackCandHit> fHitId;
206 Double_t fOnlyUseHitsFromZ;
207 Double_t fOnlyUseHitsUpToZ;
208 Bool_t fUseNonSkewedStraws;
209 Bool_t fUseSkewedStraws;
211 Bool_t fKeepBConstant;
228 Double_t fInterceptZx;
236 static const Bool_t fCorrectPzx = kFALSE;
252 inline Bool_t FillHoles(
const Int_t lastBinX,
const Int_t lastBinY,
const Int_t currentBinY,
IdxPath *ptrThetaYIdxPathVec);
254 inline Double_t equationParabola(Double_t thetaRad, Double_t hitZShifted, Double_t hitXShifted, Double_t By)
257 const Double_t n = 1.;
258 const Double_t e = 1.;
259 const Double_t c = n * e / 2.;
261 Double_t yVal = 1. / c / By * (-hitZShifted *
sin(thetaRad) + hitXShifted *
cos(thetaRad)) / pow((hitZShifted *
cos(thetaRad) + hitXShifted *
sin(thetaRad)), 2);
268 inline Double_t equationParabolaPz(Double_t thetaRad, Double_t hitZShifted, Double_t hitXShifted, Double_t By)
271 const Double_t n = 1.;
272 const Double_t e = 1.;
273 const Double_t c = n * e / 2.;
276 Double_t yVal = c * By * pow((hitZShifted *
cos(thetaRad) + hitXShifted *
sin(thetaRad)), 2) / (-hitZShifted *
sin(thetaRad) + hitXShifted *
cos(thetaRad));
284 inline Double_t equationLineZxOrZy(Double_t thetaRad, Double_t hitZShifted, Double_t hitXLabSys)
287 Double_t yVal = -tan(thetaRad) * hitZShifted + hitXLabSys;
296 inline TString GetDebugOutName(TString title =
"", Int_t param = -1)
const;
299 void WriteHistoOfHoughSpace()
const;
302 TH2S MakeEmptyHistoOfSameDimensions(TString specifier =
"", Int_t index = -1)
const;
305 void WriteHistoOfAllPeaks(
const std::vector<PndFtsHoughSpacePeak> &peaksToPlot)
const;
308 void WriteHistoOfAllPaths()
const;
312 void WriteHistoOfAllPathsForEachMcTruthTrack()
const;
313 inline void PrintFoundTracklets(
const std::vector<PndFtsHoughTracklet> &tracklets)
const;
314 inline Double_t getByFromBField(Double_t hitXLabSys, Double_t hitYLabSys, Double_t hitZLabSys);
323 std::cout <<
"=========== PndFtsHoughSpace::Print() ==========" <<
'\n';
324 std::cout <<
"fZRefPos = " << fZRefPos <<
'\n';
325 std::cout <<
"fInterceptZx = " << fInterceptZx <<
'n';
329 void PndFtsHoughSpace::PrintFoundTracklets(
const std::vector<PndFtsHoughTracklet> &tracklets)
const 331 std::cout << tracklets.size() <<
" peaks found for " << GetName() <<
'\n';
333 for (UInt_t
i = 0;
i < tracklets.size(); ++
i) {
334 tracklets[
i].Print();
339 const PndFtsHit *PndFtsHoughSpace::getHitFromHS(UInt_t index)
const 342 throwError(
"index too high");
344 Int_t hitIndex = fHitId.at(index).GetHitId();
349 const TVector3 PndFtsHoughSpace::GetRawOrCalculatedHitPos(
const PndFtsHit *
const myHit)
const 354 myHit->Position(hitPos);
356 hitPos = CalculateHitPosFromIntersectionsWithZxTrackModel(myHit);
361 const TVector3 PndFtsHoughSpace::CalculateHitPosFromIntersectionsWithZxTrackModel(
const PndFtsHit *
const myHit)
const 363 if (0 == fAssociatedTrackCand)
364 throwError(
"No track cand associated with Hough space. Cannot calculate possible hit pos. from track model.");
368 const TVector3 wireCenter = ftsTube->
GetPosition();
370 const Double_t hitZLabSys = wireCenter.Z();
373 const Double_t xTM = fAssociatedTrackCand->
getXLabSys(hitZLabSys);
376 const Double_t param = (xTM - wireCenter.X()) / wireDirection.X();
378 const Double_t yStraw = wireCenter.Y() + param * wireDirection.Y();
380 TVector3 crossingPosition(xTM, yStraw, hitZLabSys);
381 return crossingPosition;
384 TString PndFtsHoughSpace::GetDebugOutName(TString title, Int_t param)
const 386 TString debugOut =
"/home/plots/";
389 if (-1 != fRefIndex) {
391 debugOut += fRefIndex;
400 Double_t PndFtsHoughSpace::getByFromBField(Double_t hitXLabSys, Double_t hitYLabSys, Double_t hitZLabSys)
404 if (kTRUE == fKeepBConstant) {
409 Double_t po[3], BB[3];
413 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