]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCombinedTrackfit.h
Store seed in friends regardless on stream-level, since needed for calibration
[u/mrichter/AliRoot.git] / TPC / AliTPCCombinedTrackfit.h
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  **************************************************************************/
15 //
16 // Combine cosmic track pairs (upper, lower) and do track fitting
17 //
18 // ----- Usage:
19 /*
20   fCombinedTrackfit = new AliTPCCombinedTrackfit(debuglevel, "anystring");
21
22   //order not important; will be internally ordered (potinters modified due to &) such that track0 is the upper one
23   //kfit = kTRUE: good fit, kFALSE: bad fit
24   const Bool_t kfit = fCombinedTrackfit->CombineESDtracks(esdtrack0, esdtrack1);
25
26   //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
27   const Int_t status = fCombinedTrackfit->GetStatus(); 
28
29   //in Analysis Task write when terminate 
30   fCombinedTrackfit->GetStreamer()->GetFile()->Write();
31 */
32 //
33 // ----- Debug output:
34 // for (debuglevel & 1)==1 && good fit, the following info saved:
35 /*
36   (*fStreamer)<<"TrackProp"<<
37       "Tup.="<<fTrackparUp<<          //AliExternalTrackParam at uppermost cluster obtained by upward propagation
38       "Tlow.="<<fTrackparLow<<        //AliExternalTrackParam at lowermost cluster obtained by downward propagation
39       "icup.="<<&fInnerClusterUp<<    //TVector3 position of the innermost cluster of the upper track
40       "iclow.="<<&fInnerClusterLow<<
41       "leverarm="<<fLeverArm<<
42       "ncl="<<fFitNcls<<              //number of clusters used in successful propagation  
43       "nmiss="<<fMissNcls<<           //number of clusters failed in propagation, should always be 0 in this case.
44       "chi2="<<fPreChi2<<             //chi2/nfit  
45       "momup="<<  momup <<            //momentum at uppermost cluster with upward propagation
46       "momlow="<< momlow <<           //momentum at lowermost cluster with downward propagation
47       "ptup="<<   ptup <<
48       "ptlow="<<  ptlow <<
49       "\n";
50  */
51 // for (debuglevel & 2)==1, debug info in AliTPCCosmicUtils::FitKernel saved
52 //
53 // ----- Efficiency:
54 // for 2011 Feb. cosmic data nch=2 events, the kfit and status look like:
55 /*
56 kfit,status (  0,   1):   68939 / 2611959 =   2.639%          //kFailGetTPCseeds
57 kfit,status (  0,   2):   14886 / 2611959 =   0.570%          //not both tracks have ncl > AliTPCCosmicUtils::fgkNclsMin
58 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
59 kfit,status (  0,   4):   39841 / 2611959 =   1.525%          //fLeverArm<fgkCutLeverArm
60 kfit,status (  0,   6):   12933 / 2611959 =   0.495%          //fail in propagation of at least one cluster
61 kfit,status (  0,   7):   19994 / 2611959 =   0.765%          //chi2/nfit > fgkMaxChi2
62 kfit,status (  1,   0): 2402181 / 2611959 =  91.969%          //i.e. 92% of nch=2 events are successfully fitted.
63 */
64 //
65 // ----- Resolution:
66 // 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.
67 // particle traversing muon filter can be rejected by requiring "fInnerClusterUp.fZ > -40 && fInnerClusterLow.fZ > -40"
68 // 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.
69 // RMS of log10 p = 0.01 at 10 GeV/c, 0.1 at 100 GeV/c, 0.5 at 1 TeV/c.
70 // muon filter deteriorates momentum resolution by about +0.01 (absolute value).
71 //
72 //  Xianguo Lu <lu@physi.uni-heidelberg.de>
73 //
74 /*
75 //in [cm]
76 const Double_t _TPCZMIN = -250;
77 const Double_t _TPCZMAX =  250;
78 const Double_t _TPCINR  =  84.8;
79 const Double_t _TPCOUR  =  246.6;
80 */
81
82 #ifndef ALITPCCOMBINEDTRACKFIT_H
83 #define ALITPCCOMBINEDTRACKFIT_H
84
85 class TTreeSRedirector;
86
87 class AliTPCCombinedTrackfit
88 {
89  public:
90   AliTPCCombinedTrackfit(const Int_t dlev=0, const TString tag="test");
91   
92   ~AliTPCCombinedTrackfit();
93
94   Bool_t CombineESDtracks(AliESDtrack * &trk0, AliESDtrack *&trk1);
95   Bool_t CombineTPCseeds(AliTPCseed * &seed0, AliTPCseed *&seed1);
96   void Print() const ;
97   //--------- getters ------------
98
99   Int_t GetStatus()const{return fStatus;}
100   Int_t GetFitNcls()const{return fFitNcls;}
101   Int_t GetMissNcls()const{return fMissNcls;}
102   Double_t GetChi2PerCluster()const{return fPreChi2;}
103   Double_t GetLeverArm()const {return fLeverArm;}
104   TVector3 GetInnerClusterUp()const {return fInnerClusterUp;}
105   TVector3 GetInnerClusterLow()const {return fInnerClusterLow;}
106   Double_t ImpactParameter() const;
107   Double_t MinPhi()const;
108
109   AliExternalTrackParam * GetTrackParamUp() const {return fTrackparUp;}
110   AliExternalTrackParam * GetTrackParamLow() const {return fTrackparLow;}
111   AliTPCseed * GetTPCseedUp()   const {return fSeedUp;}
112   AliTPCseed * GetTPCseedLow() const {return fSeedLow;}
113
114   TTreeSRedirector * GetStreamer() const {return fStreamer;}
115
116  private:
117   enum CombineStatus{
118     kFailGetTPCseeds=1,
119     kFailNclsMin    =2,
120     kFailSwapSeeds  =3,
121     kFailLeverArm   =4,
122     kFailMakeSeed   =5,
123     kFailPropagation=6,
124     kFailChi2       =7
125   };
126   
127   AliTPCCombinedTrackfit(const AliTPCCombinedTrackfit & p);
128   AliTPCCombinedTrackfit & operator=(const AliTPCCombinedTrackfit & p);
129
130   void IniCombineESDtracks();
131   Bool_t GetTPCseeds(const AliESDtrack *trk0,  const AliESDtrack *trk1);
132   Bool_t CheckNcls();
133   Bool_t CheckLeverArm();
134   Bool_t AnaSeeds(Bool_t &kswap);
135
136   void CombineTPCseeds(Bool_t &kswap);
137   void Update();
138
139   TTreeSRedirector *fStreamer;     //!debug streamer
140   Int_t fDebugLevel;                    //debug level
141
142   AliTPCseed * fSeedUp;                         //TPC seed of upper track
143   AliTPCseed * fSeedLow;                        //TPC seed of lower track
144   AliExternalTrackParam * fTrackparUp;          //track param of upper track
145   AliExternalTrackParam * fTrackparLow;         //track param of lower track
146
147   Int_t fStatus;                               //status for CombineESDtracks/CombineTPCseeds: 0-successful, otherwise fail
148   
149   TVector3 fInnerClusterUp;                    //xyz of the inner most TPC trackpoint of the Upper track
150   TVector3 fInnerClusterLow;                   //xyz of the inner most TPC trackpoint of the Lower track
151   Double_t fLeverArm;                          //transverse difference between upper most and lower most clusters
152
153   Int_t fFitNcls;                              //number of TPC clusters successful in propagation (mean of the two propagation: upwards and downwards)
154   Int_t fMissNcls;                             //number of TPC clusters fail in propagation (sum of the two propagation)
155   Double_t fPreChi2;                           //Predicted chi2/nfit over the two propagation
156
157   static const Double_t fgkCutLeverArm = 350;  //minimum lever arm 350 ~ 250 * sqrt(2)
158   static const Double_t fgkMaxChi2 = 10;       //max. chi2/ncls
159 };
160
161 #endif