MpdEctTrackFinderCpc.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef MPD_ECTTRACKFINDERCPC_H
  2. #define MPD_ECTTRACKFINDERCPC_H
  3. #include "FairTask.h"
  4. //#include "FairStsKFTrackFitter.h"
  5. //#include "TLorentzVector.h"
  6. #include "TH1.h"
  7. #include "TVector3.h"
  8. #include <map>
  9. class MpdKalmanHit;
  10. class MpdKalmanTrack;
  11. class MpdTofHit;
  12. class MpdEctKalmanTrack;
  13. class FairGeoTransform;
  14. class TClonesArray;
  15. class TVector2;
  16. class MpdEctTrackFinderCpc :public FairTask
  17. {
  18. public:
  19. /** Constructor **/
  20. MpdEctTrackFinderCpc(const char *name="MpdEctTrackFinderCpc", Int_t iVerbose = 1 );
  21. /** Destructor **/
  22. virtual ~MpdEctTrackFinderCpc();
  23. /// * FairTask methods
  24. /** Intialisation at begin of run. To be implemented in the derived class.
  25. *@value Success If not kSUCCESS, task will be set inactive.
  26. **/
  27. InitStatus Init();
  28. /** Reinitialisation.
  29. *@value Success If not kSUCCESS, task will be set inactive.
  30. **/
  31. InitStatus ReInit();
  32. /** Intialise parameter containers.
  33. **/
  34. void SetParContainers();
  35. void Exec(Option_t * option);
  36. /** Action after each event. **/
  37. void Finish();
  38. void Reset();
  39. Bool_t Tpc() { return fTpc; } ///< TPC flag (if TRUE - reco after TPC to ECT reco)
  40. void SetTpc(Bool_t tpc) { fTpc = tpc; } ///< set TPC flag (if TRUE - reco after TPC to ECT reco)
  41. private:
  42. // Some constants
  43. static const Double_t fgkChi2Cut; ///< max accepted Chi2 of hit for track
  44. static const Int_t fgkNlays = 60 * 2, fgkNtube = 700, fgkNlays2 = 60; // nLaysMax, nTubesMax
  45. private:
  46. void InitGeo(); ///< initialize detector geometry
  47. Int_t GetNofHitsInLayer(Int_t lay) { return (Int_t)fhLays->GetCellContent(lay+1,0); }
  48. Int_t GetHitsInLayer(Int_t lay) { return fLayPointers[lay]; } ///< first index of hits in layer
  49. void MatchEtof(); ///< match tracks with ETOF hits
  50. void MatchCpc(); ///< match tracks with CPC hits
  51. void GetTrackSeeds(Int_t iPass); // build track seeds
  52. void GetTrackSeedsCpc(Int_t iPass); // build track seeds with CPC
  53. void DoTracking(Int_t iPass); // run tracking
  54. void MakeKalmanHits(); // create Kalman hits
  55. void EvalParams(const MpdTofHit *tof, const MpdKalmanHit *ect, MpdEctKalmanTrack *track,
  56. Double_t rEct, Double_t phEct); // evaluate params
  57. Bool_t EvalParamsCpc(TVector3 cpc, TVector3 tof, Double_t &pt, Double_t &phi, Double_t &the);
  58. void EvalCovar(const MpdTofHit *tof, const MpdKalmanHit *ect, MpdEctKalmanTrack *track,
  59. Double_t rEct, Double_t phEct); // eval. covariance
  60. Int_t RunKalmanFilter(MpdEctKalmanTrack *track, Int_t layBeg); ///< run Kalman filter
  61. void RemoveDoubles(); ///< remove double tracks
  62. Int_t NofCommonHits(MpdEctKalmanTrack* track, MpdEctKalmanTrack* track1); ///< get number of common hits
  63. void AddHits(); // add hit objects to tracks
  64. Int_t HitMotherId(MpdKalmanHit* hit, Int_t idM, Int_t &id1); // check if hit has the same mother ID as idM
  65. void SetTrackID(MpdEctKalmanTrack *track); // set track ID from IDs of its hits
  66. void SelectTracks(Int_t iPass); ///< do track selection and compute shared hit multiplicities
  67. void StoreTracks(Int_t iPass); // transfer tracks from fTrackCand to fTracks
  68. void ExcludeHits() { }; // exclude used hits
  69. void Write();
  70. void Writedir2current( TObject *obj );
  71. Double_t Proxim(MpdKalmanTrack *track, const MpdKalmanHit *hit); ///< adjust R-Phi coord. for continuity
  72. TVector2 GetDistance(MpdEctKalmanTrack *track, MpdKalmanHit *hit); ///< hit-track distance
  73. void MatchTpc(); ///< match tracks with TPC tracks
  74. void PassWall(MpdEctKalmanTrack *track, Double_t thick); ///< pass TPC end-plate
  75. void GoToBeamLine(); // propagate tracks to the beam line
  76. Double_t CorrectForLoss(Double_t pt, Double_t the, Int_t id); // correct for dE loss in pipe
  77. Int_t GetParticleId(Int_t id); ///< particle ID for track id
  78. void MergeWithTpc(MpdEctKalmanTrack *track); ///< merge track with TPC track
  79. void Smooth(); ///< primary vertex constraints
  80. void GoOutward(); ///< go outward
  81. void GetCpcPoints(); ///< store CPC coordinates with added errors
  82. Int_t fNPass;
  83. Bool_t fTpc;
  84. Double_t fZtpc; // Z-edge of TPC
  85. //Int_t fNofLays; //!< actual number of detector layers
  86. Int_t fNofTubes; //!< actual number of tubes in a layer
  87. Double_t frMinMax[3]; //!< min / max radii of ECT and tube radius
  88. Double_t fZplanes[fgkNlays];
  89. TDirectory *fHistoDir;
  90. TH1F *fhNBranches;
  91. Int_t fExact; //!< exact match flag (if 1 match IDs)
  92. TClonesArray *fEctHits; //! ECT hits
  93. TClonesArray *fTofHits; //! TOF hits
  94. TClonesArray *fTofPoints; //! TOF points
  95. TClonesArray *fCpcPoints; //! CPC points
  96. TClonesArray *fKHits; //!< array of Kalman hits
  97. TClonesArray *fMCTracks; //!< array of MC tracks
  98. TClonesArray *fTracks; //! ECT tracks
  99. TClonesArray *fTpcTracks; //! TPC tracks
  100. TClonesArray *fTrackCand; //! ECT track candidates
  101. TClonesArray *fPrimVtx; //! event vertices
  102. Int_t *fLayPointers; //!< locations of hits from different layers
  103. TH1F *fhLays; //!< histo with layer hit multiplicities
  104. std::map<Int_t,TVector3> fMapCpc[2]; // CPC points with added errors
  105. FairGeoTransform *fTransf[fgkNlays][fgkNtube];
  106. std::map<Int_t,std::pair<Double_t,Double_t> > fWireMap;
  107. ClassDef(MpdEctTrackFinderCpc,1);
  108. };
  109. #endif