Coverity fix
[u/mrichter/AliRoot.git] / TRD / TRDbase / AliTRDonlineTrackMatching.h
CommitLineData
30bd9a5a 1#ifndef ALITRDONLINETRACKMATCHING_H
2#define ALITRDONLINETRACKMATCHING_H
3
4//
5// Track matching between TRD online tracks and ESD tracks.
6// Author: Felix Rettig <rettig@compeng.uni-frankfurt.de>
7
8#include "TObject.h"
9class TH1;
10class AliESDEvent;
11class AliExternalTrackParam;
12class AliTRDgeometry;
db19c583 13class AliESDtrack;
30bd9a5a 14class AliESDTrdTrack;
15
16//#define TRD_TM_DEBUG
17
633f3ec4 18class AliTRDonlineTrackMatching : public TObject {
30bd9a5a 19 public:
20 AliTRDonlineTrackMatching();
21 ~AliTRDonlineTrackMatching();
22
23 inline static Short_t TrdLsiSec(Short_t lsi) { return (lsi < 0) ? -1 : (lsi/5); } // convert linear stack index 0-89 to TRD sector 0-17
24 inline static Short_t TrdLsiSi(Short_t lsi) { return (lsi < 0) ? -1 : (lsi%5); } // convert stack index 0-89 to local stack index 0-4
25 inline static Short_t TrdDetLsi(Short_t det) { return det/6; } // convert TRD detector/chamber 0-539 index to linear stack index 0-89
26 inline static Short_t TrdDetSi(Short_t det) { return (det%30)/6; } // convert detector (=chamber) number 0-539 to local stack index 0-4
27 inline static Short_t TrdDetLyr(Short_t det) { return det%6; } // convert detector (=chamber) number 0-539 to local layer 0-5
28 inline static Short_t TrdSecSiLsi(Short_t sec, Short_t si) { return 5*sec + si; } // convert sector (0-17) and local stack index (0-4) to linear stack index 0-89
29
30 static Short_t EstimateSector(const Double_t globalCoords[3]);
6403ed35 31 static Short_t EstimateLayer(Double_t radius);
30bd9a5a 32 static Short_t EstimateLocalStack(const Double_t globalCoords[3]);
33 static Short_t EstimateStack(const Double_t globalCoords[3]);
34
6403ed35 35 static Bool_t StackToTrack(const AliExternalTrackParam* track, Short_t &stack, UShort_t &layersWithTracklet, Double_t magFieldinKiloGauss);
36 static Bool_t StackToTrack(const AliESDtrack* track, Short_t &stack, UShort_t &layersWithTracklet, Double_t magFieldinKiloGauss);
30bd9a5a 37
38 static Bool_t TrackPlaneIntersect(AliExternalTrackParam *trk, Double_t pnt[3], Double_t norm[3], Double_t mag);
39 Int_t EstimateTrackDistance(AliESDtrack *esd_track, AliESDTrdTrack* gtu_track, Double_t mag, Double_t *ydist, Double_t *zdist);
6403ed35 40 static Double_t RateTrackMatch(Double_t distY, Double_t distZ, Double_t rpt, Double_t gpt);
41
42 static void SetEsdTrackCutMinTPCrows(Double_t setting) { fEsdTrackCutMinTPCrows = setting; };
43 static void SetEsdTrackCutMinRatioRowsFindableClusters(Double_t setting) { fEsdTrackCutMinRatioRowsFindableClusters = setting; };
44 static void SetEsdTrackCutMaxChi2TPCclusters(Float_t setting) { fEsdTrackCutMaxChi2TPCclusters = setting; };
45 static void SetEsdTrackCutMaxChi2ITSclusters(Float_t setting) { fEsdTrackCutMaxChi2ITSclusters = setting; };
46 static void SetEsdTrackCutMaxDCAtoVertexXY(Float_t setting) { fEsdTrackCutMaxDCAtoVertexXY = setting; };
47 static void SetEsdTrackCutMaxDCAtoVertexZ( Float_t setting) { fEsdTrackCutMaxDCAtoVertexZ = setting; };
48 static void SetEsdTrackCutITSlayerMask(UShort_t setting) { fEsdTrackCutsITSlayerMask = setting; };
49 static void SetEsdTrackCutsChi2TPCconstrainedVsGlobal(Float_t setting) { fEsdTrackVCutsChi2TPCconstrainedVsGlobal = setting; };
50 static void SetEsdTrackCutMinimal(Bool_t setting) { fEsdTrackCutMinimal = setting; };
51 static void SetEsdTrackCutRequireITSrefit(Bool_t setting) { fEsdTrackCutRequireITSrefit = setting; };
52 static void SetEsdTrackCutRequireTPCrefit(Bool_t setting) { fEsdTrackCutRequireTPCrefit = setting; };
53 static void SetEsdTrackCutPrim(Bool_t setting) { fEsdTrackCutPrim = setting; };
30bd9a5a 54
55 static void SetEsdTrackDefaultCuts(const char* cutIdent = "minimal");
56
6403ed35 57 void SetMinMatchRating(Float_t setting) { fMinMatchRating = setting; };
30bd9a5a 58 void SetHistMatchRating(TH1* hist) { fHistMatchRating = hist; };
59
60 static Bool_t AcceptTrack(const AliESDtrack* esdTrack, const AliESDEvent* esdEvent);
34d48b8f 61 Bool_t ProcessEvent(AliESDEvent *esdEvent, Bool_t updateRef = kTRUE, Int_t label = -1);
30bd9a5a 62
63 protected:
64
6403ed35 65 inline static Double_t PtDiffRel(Double_t refPt, Double_t gtuPt);
30bd9a5a 66
67 static const unsigned int fgkMaxEsdTracksPerStack = 20000; // max no. of tracks per stack
68 static const unsigned int fgkTrdStacks = 90; // no. of TRD stacks (0-89)
69 static const Float_t fgkSaveInnerRadius; // inner radius for extrapolation
70 static const Float_t fgkSaveOuterRadius; // outer radius for extrapolation
71
72 static Float_t fEsdTrackCutMinTPCrows; // track cut
73 static Float_t fEsdTrackCutMinRatioRowsFindableClusters; // track cut
74 static Float_t fEsdTrackCutMaxChi2TPCclusters; // track cut
75 static Float_t fEsdTrackCutMaxChi2ITSclusters; // track cut
76 static Float_t fEsdTrackCutMaxDCAtoVertexXY; // track cut
77 static Float_t fEsdTrackCutMaxDCAtoVertexZ; // track cut
78 static UShort_t fEsdTrackCutsITSlayerMask; // track cut
79 static Float_t fEsdTrackVCutsChi2TPCconstrainedVsGlobal; // track cut
80 static Float_t fEsdTrackCutPtDCAOfs; // track cut
81 static Float_t fEsdTrackCutPtDCACoeff; // track cut
82 static Bool_t fEsdTrackCutMinimal; // activate/deactive minimal track cuts
83 static Bool_t fEsdTrackCutRequireITSrefit; // track cut
84 static Bool_t fEsdTrackCutRequireTPCrefit; // track cut
85 static Bool_t fEsdTrackCutPrim; // select primaries or keep secondaries for matching
86
87 AliTRDgeometry* fTRDgeo; //! TRD geometry instance
88 Float_t fMinMatchRating; //! min rating to accept pair of matched tracks
89 TH1* fHistMatchRating; //! optional histogram for match rating for all TRD tracks
90
91 AliTRDonlineTrackMatching(const AliTRDonlineTrackMatching &c);
92 AliTRDonlineTrackMatching& operator=(const AliTRDonlineTrackMatching& rhs);
633f3ec4 93
94 ClassDef(AliTRDonlineTrackMatching, 0);
30bd9a5a 95};
96
97#endif