CMake: Adding missing ALI_DATE flag
[u/mrichter/AliRoot.git] / TPC / AliTPCCombinedTrackfit.h
CommitLineData
1f30d65c 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
1f30d65c 15
0fd1fc0b 16/// \class AliTPCCombinedTrackfit
17/// \brief Combine cosmic track pairs (upper, lower) and do track fitting.
18///
19/// Usage
20/// -----
21///
22/// ~~~{.cxx}
23/// fCombinedTrackfit = new AliTPCCombinedTrackfit(debuglevel, "anystring");
24///
25/// //order not important; will be internally ordered (potinters modified due to &) such that track0 is the upper one
26/// //kfit = kTRUE: good fit, kFALSE: bad fit
27/// const Bool_t kfit = fCombinedTrackfit->CombineESDtracks(esdtrack0, esdtrack1);
28///
29/// //status = 0 for good fit (i.e. kfit=kTRUE), non-0 for bad fit (i.e. kfit=kFALSE), see "enum CombineStatus" definition in header file
30/// const Int_t status = fCombinedTrackfit->GetStatus();
31///
32/// //in Analysis Task write when terminate
33/// fCombinedTrackfit->GetStreamer()->GetFile()->Write();
34/// ~~~
35///
36/// Debug output
37/// ------------
38///
39/// For (debuglevel & 1)==1 && good fit, the following info saved:
40///
41/// ~~~{.cxx}
42///
43/// (*fStreamer)<<"TrackProp"<<
44/// "Tup.="<<fTrackparUp<< //AliExternalTrackParam at uppermost cluster obtained by upward propagation
45/// "Tlow.="<<fTrackparLow<< //AliExternalTrackParam at lowermost cluster obtained by downward propagation
46/// "icup.="<<&fInnerClusterUp<< //TVector3 position of the innermost cluster of the upper track
47/// "iclow.="<<&fInnerClusterLow<<
48/// "leverarm="<<fLeverArm<<
49/// "ncl="<<fFitNcls<< //number of clusters used in successful propagation
50/// "nmiss="<<fMissNcls<< //number of clusters failed in propagation, should always be 0 in this case.
51/// "chi2="<<fPreChi2<< //chi2/nfit
52/// "momup="<< momup << //momentum at uppermost cluster with upward propagation
53/// "momlow="<< momlow << //momentum at lowermost cluster with downward propagation
54/// "ptup="<< ptup <<
55/// "ptlow="<< ptlow <<
56/// "\n";
57/// ~~~
58///
59/// For (debuglevel & 2)==1, debug info in `AliTPCCosmicUtils::FitKernel` saved
60///
61/// Efficiency
62/// ----------
63///
64/// For 2011 Feb. cosmic data nch=2 events, the kfit and status look like:
65///
66/// ~~~{.cxx}
67/// kfit,status ( 0, 1): 68939 / 2611959 = 2.639% //kFailGetTPCseeds
68/// kfit,status ( 0, 2): 14886 / 2611959 = 0.570% //not both tracks have ncl > AliTPCCosmicUtils::fgkNclsMin
69/// kfit,status ( 0, 3): 53185 / 2611959 = 2.036% //clusters in two tracks should be clearly separated in y, i.e. lowest cluster of upper track higher than highest cluster of lower track; otherwise fail
70/// kfit,status ( 0, 4): 39841 / 2611959 = 1.525% //fLeverArm<fgkCutLeverArm
71/// kfit,status ( 0, 6): 12933 / 2611959 = 0.495% //fail in propagation of at least one cluster
72/// kfit,status ( 0, 7): 19994 / 2611959 = 0.765% //chi2/nfit > fgkMaxChi2
73/// kfit,status ( 1, 0): 2402181 / 2611959 = 91.969% //i.e. 92% of nch=2 events are successfully fitted.
74/// ~~~
75///
76/// Resolution
77/// ----------
78///
79/// For muon momentum small than 20 GeV, energy loss in muon filter is visable when compaing fTrackparUp and fTrackparLow; energy loss estimated as 5 MeV/cm.
80/// Particle traversing muon filter can be rejected by requiring `fInnerClusterUp.fZ > -40 && fInnerClusterLow.fZ > -40`
81/// Momentum resolution is estimated by comparing the trackfit result by upward propagation through odd pad rows and that by downward propagation through even pad rows. Number of clusters used in this case is only half of that in normal usage.
82/// RMS of log10 p = 0.01 at 10 GeV/c, 0.1 at 100 GeV/c, 0.5 at 1 TeV/c.
83/// Muon filter deteriorates momentum resolution by about +0.01 (absolute value).
84///
85/// \author Xianguo Lu <lu@physi.uni-heidelberg.de>
1f30d65c 86
1f30d65c 87/*
88//in [cm]
89const Double_t _TPCZMIN = -250;
90const Double_t _TPCZMAX = 250;
91const Double_t _TPCINR = 84.8;
92const Double_t _TPCOUR = 246.6;
93*/
94
95#ifndef ALITPCCOMBINEDTRACKFIT_H
96#define ALITPCCOMBINEDTRACKFIT_H
97
98class TTreeSRedirector;
99
100class AliTPCCombinedTrackfit
101{
102 public:
103 AliTPCCombinedTrackfit(const Int_t dlev=0, const TString tag="test");
104
105 ~AliTPCCombinedTrackfit();
106
107 Bool_t CombineESDtracks(AliESDtrack * &trk0, AliESDtrack *&trk1);
108 Bool_t CombineTPCseeds(AliTPCseed * &seed0, AliTPCseed *&seed1);
109 void Print() const ;
110 //--------- getters ------------
111
112 Int_t GetStatus()const{return fStatus;}
113 Int_t GetFitNcls()const{return fFitNcls;}
114 Int_t GetMissNcls()const{return fMissNcls;}
115 Double_t GetChi2PerCluster()const{return fPreChi2;}
116 Double_t GetLeverArm()const {return fLeverArm;}
117 TVector3 GetInnerClusterUp()const {return fInnerClusterUp;}
118 TVector3 GetInnerClusterLow()const {return fInnerClusterLow;}
119 Double_t ImpactParameter() const;
120 Double_t MinPhi()const;
121
122 AliExternalTrackParam * GetTrackParamUp() const {return fTrackparUp;}
123 AliExternalTrackParam * GetTrackParamLow() const {return fTrackparLow;}
124 AliTPCseed * GetTPCseedUp() const {return fSeedUp;}
125 AliTPCseed * GetTPCseedLow() const {return fSeedLow;}
126
127 TTreeSRedirector * GetStreamer() const {return fStreamer;}
128
129 private:
130 enum CombineStatus{
131 kFailGetTPCseeds=1,
132 kFailNclsMin =2,
133 kFailSwapSeeds =3,
134 kFailLeverArm =4,
135 kFailMakeSeed =5,
136 kFailPropagation=6,
137 kFailChi2 =7
138 };
139
140 AliTPCCombinedTrackfit(const AliTPCCombinedTrackfit & p);
141 AliTPCCombinedTrackfit & operator=(const AliTPCCombinedTrackfit & p);
142
143 void IniCombineESDtracks();
144 Bool_t GetTPCseeds(const AliESDtrack *trk0, const AliESDtrack *trk1);
145 Bool_t CheckNcls();
146 Bool_t CheckLeverArm();
147 Bool_t AnaSeeds(Bool_t &kswap);
148
149 void CombineTPCseeds(Bool_t &kswap);
150 void Update();
151
0fd1fc0b 152 TTreeSRedirector *fStreamer; //!< debug streamer
153 Int_t fDebugLevel; ///< debug level
1f30d65c 154
0fd1fc0b 155 AliTPCseed * fSeedUp; ///< TPC seed of upper track
156 AliTPCseed * fSeedLow; ///< TPC seed of lower track
157 AliExternalTrackParam * fTrackparUp; ///< track param of upper track
158 AliExternalTrackParam * fTrackparLow; ///< track param of lower track
1f30d65c 159
0fd1fc0b 160 Int_t fStatus; ///< status for CombineESDtracks/CombineTPCseeds: 0-successful, otherwise fail
1f30d65c 161
0fd1fc0b 162 TVector3 fInnerClusterUp; ///< xyz of the inner most TPC trackpoint of the Upper track
163 TVector3 fInnerClusterLow; ///< xyz of the inner most TPC trackpoint of the Lower track
164 Double_t fLeverArm; ///< transverse difference between upper most and lower most clusters
1f30d65c 165
0fd1fc0b 166 Int_t fFitNcls; ///< number of TPC clusters successful in propagation (mean of the two propagation: upwards and downwards)
167 Int_t fMissNcls; ///< number of TPC clusters fail in propagation (sum of the two propagation)
168 Double_t fPreChi2; ///< Predicted chi2/nfit over the two propagation
1f30d65c 169
0fd1fc0b 170 static const Double_t fgkCutLeverArm = 350; ///< minimum lever arm 350 ~ 250 * sqrt(2)
171 static const Double_t fgkMaxChi2 = 10; ///< max. chi2/ncls
1f30d65c 172};
173
174#endif