#ifndef PNDRIEMANNTRACKFINDER_H_ #define PNDRIEMANNTRACKFINDER_H_ #include "PndRiemannTrack.h" #include "PndRiemannHit.h" #include "FairHit.h" #include "PndSdsHit.h" #include "TClonesArray.h" #include "PndTrackCand.h" #include "TH2F.h" #include #include class PndRiemannTrackFinder { public: PndRiemannTrackFinder(); virtual ~PndRiemannTrackFinder(); void FindTracks(); ///< Main function to start the riemann track finding void MergeTracks(); void SetHits(std::vector hits){fHits = hits;}; ///< Replaces the existing array of hits with a new one void AddHits(std::vector hits, Int_t branchId); ///< Appends the new array of hits to the existing one void AddHits(TClonesArray* hits, Int_t branchId); ///< Appends the new array of hits to the existing one void AddHit(FairHit* hit){fHits.push_back(hit);}; ///< Adds one new hit to the array of hits void SetVerbose (int val){fVerbose = val;} int NTracks(){return fTrackCand.size();}; ///< Returns the number of found tracks PndRiemannTrack GetTrack(int i){return fTracks[i];}; ///< Returns the track with the index i PndTrack GetPndTrack(int i, double B){return fTracks[i].getPndTrack(B);}; std::set GetTrackCandidates(int i){return fHitsInTracks[i];}; ///< Returns the hits belonging to track i std::vector GetTrackCand(){return fTrackCand;} std::vector GetMergedTrackCands(){return fMergedTrackCand;} PndTrackCand GetTrackCand(int i) {return fTrackCand[i];} double HitDistance(FairHit* h1, FairHit* h2); ///< Calculates the distance between two hits int HitTooClose(std::set hitsInUse, FairHit* newHit, double threshold); ///< returns if and which hit was too close to the hit which is tested void SetMaxPlaneDistance(double val){fMaxPlaneDist = val;} void SetMaxSZDist(double val){fMaxSZDist = val;} void SetMaxSZChi2(double val){fMaxSZChi2 = val;} void SetMinPointDist(double val){fMinPointDist = val;} void SetUseZeroPos(bool val){fUseZeroPos = val;} void SetMinNumberOfHits(int val){fMinNumberOfHits = val;} void SetCurvDiff(double val){fCurvDiff = val;} void SetDipDiff(double val){fDipDiff = val;} protected: std::vector fHits; ///< Vector of all FairHits used for track finding (fitting) std::vector fTracks; ///< Resulting Riemann Tracks std::vector > fHitsInTracks; ///< Vector of indizes which hits where used in which track std::vector fTrackCand; ///< List of track candidates std::vector< std::pair > fCurvAndDipOfCand; ///< Curvature and dip of fPndTrackCand std::vector fMergedTrackCand; std::vector< std::set > fHitsTooClose; ///< matrix of TrackNr and hits which are too close to one of the three starting points std::map fMapHitToID; ///< map to convert the list of hits back into a FairLink std::map fMapIDtoHit; /// > GetStartTracks(); bool CheckHitDistance(int hit1, int hit2); ///< Tests if the distance is larger than fMinPointDistance bool CheckSZ(PndRiemannTrack aTrack); ///< Tests the results of the sz fit bool CheckRiemannHit(PndRiemannTrack* track, PndRiemannHit* hit); bool CheckHitInSameSensor(int hit1, int hit2); ///< Tests if hits in the same sensor are selected bool CheckHitInTrack(std::set hitIds, int hit); ///< Check if this HitId is used in the track already bool CheckZeroPassing(std::set hitIds, int hit); ///< If the track contains (0,0) all points have to go forward or all have to go backward PndRiemannTrack CreateRiemannTrack(std::set aHits); ///< Creates a PndRiemannTrack from an array of indices of Hits bool TrackExists(std::set hitsInTrack); std::vector FindTracksWithSimilarParameters(int TrackInd, std::vector& TracksToTest, double curvDiff, double dipDiff); std::vector FindTracksWithSimilarHits(std::vector& TracksToTest,std::vector tempTrCnd, std::vector& tempKillAfter); ///<------------added by me void RemoveTrack(int TrackInd, std::vector& TrackList); // void PrintTrackCand(PndTrackCand* cand); PndTrackCand CreateOneTrackCand(std::vector tracks,std::vector tempTrCnd);//////////////aded by AG // Fast method to figure out if a combination of hits is already used as a track //Problem: It does not work for more than 32 hits // std::vector fHitsInTracks; ///< one int stands for the hits used in one track. The hits are encoded as bits in an int32 //Solution: use a vector > fHitsInTracks instead. This is not so fast but works for more than 32 hits // void SetHitInTrack(Int_t position, Int_t& value); // std::vector GetHitsInTrack(Int_t value); // bool TrackExists(Int_t hitsInTrack); // std::vector GetHitsInTrack(Int_t value); public: ClassDef(PndRiemannTrackFinder,2) }; #endif /*PNDRIEMANNTRACKFINDER_H_*/