]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliStarTrackCuts.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliStarTrackCuts.cxx
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 /* $Id$ */ 
17
18 // AliStarTrackCuts:
19 // A track cut class for the AliStarTrack
20 //
21 // origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
22
23 #include <limits.h>
24 #include <float.h>
25 #include "TNamed.h"
26 #include "AliStarTrack.h"
27 #include "AliStarTrackCuts.h"
28
29 ClassImp(AliStarTrackCuts)
30
31 //-----------------------------------------------------------------------
32 AliStarTrackCuts::AliStarTrackCuts():
33   TNamed(),
34   fCutID(kFALSE),
35   fIDMax(INT_MAX),
36   fIDMin(INT_MIN),
37   fCutCharge(kFALSE),
38   fChargeMax(INT_MAX),
39   fChargeMin(INT_MIN),
40   fCutEta(kFALSE),
41   fEtaMax(FLT_MAX),
42   fEtaMin(-FLT_MAX),
43   fCutPhi(kFALSE),
44   fPhiMax(FLT_MAX),
45   fPhiMin(-FLT_MAX),
46   fCutPt(kFALSE),
47   fPtMax(FLT_MAX),
48   fPtMin(-FLT_MAX),
49   fCutDCA(kFALSE),
50   fDCAMax(FLT_MAX),
51   fDCAMin(-FLT_MAX),
52   fCutNHits(kFALSE),
53   fNHitsMax(INT_MAX),
54   fNHitsMin(INT_MIN),
55   fCutNHitsFit(kFALSE),
56   fNHitsFitMax(INT_MAX),
57   fNHitsFitMin(INT_MIN),
58   fCutNHitsPoss(kFALSE),
59   fNHitsPossMax(INT_MAX),
60   fNHitsPossMin(INT_MIN),
61   fCutNHitsDedx(kFALSE),
62   fNHitsDedxMax(INT_MAX),
63   fNHitsDedxMin(INT_MIN),
64   fCutdEdx(kFALSE),
65   fdEdxMax(FLT_MAX),
66   fdEdxMin(-FLT_MAX),
67   fCutNSigElect(kFALSE),
68   fNSigElectMax(FLT_MAX),
69   fNSigElectMin(-FLT_MAX),
70   fCutNSigPi(kFALSE),
71   fNSigPiMax(FLT_MAX),
72   fNSigPiMin(-FLT_MAX),
73   fCutNSigK(kFALSE),
74   fNSigKMax(FLT_MAX),
75   fNSigKMin(-FLT_MAX),
76   fCutNSigProton(kFALSE),
77   fNSigProtonMax(FLT_MAX),
78   fNSigProtonMin(-FLT_MAX),
79   fCutFitRatio(kFALSE),
80   fFitRatioMax(FLT_MAX),
81   fFitRatioMin(FLT_MIN)
82 {
83   //ctor 
84 }
85
86 ////-----------------------------------------------------------------------
87 //AliStarTrackCuts::AliStarTrackCuts(const AliStarTrackCuts& that):
88 //  TNamed(),
89 //  fCutID(that.fCutID),
90 //  fIDMax(that.fIDMax),
91 //  fIDMin(that.fIDMin),
92 //  fCutCharge(that.fCutCharge),
93 //  fChargeMax(that.fChargeMax),
94 //  fChargeMin(that.fChargeMin),
95 //  fCutEta(that.fCutEta),
96 //  fEtaMax(that.fEtaMax),
97 //  fEtaMin(that.fEtaMin),
98 //  fCutPhi(that.fCutPhi),
99 //  fPhiMax(that.fPhiMax),
100 //  fPhiMin(that.fPhiMin),
101 //  fCutPt(that.fCutPt),
102 //  fPtMax(that.fPtMax),
103 //  fPtMin(that.fPtMin),
104 //  fCutDCA(that.fCutDCA),
105 //  fDCAMax(that.fDCAMax),
106 //  fDCAMin(that.fDCAMin),
107 //  fCutNHits(that.fCutNHits),
108 //  fNHitsMax(that.fNHitsMax),
109 //  fNHitsMin(that.fNHitsMin),
110 //  fCutNHitsFit(that.fCutNHitsFit),
111 //  fNHitsFitMax(that.fNHitsFitMax),
112 //  fNHitsFitMin(that.fNHitsFitMin),
113 //  fCutNHitsPoss(that.fCutNHitsPoss),
114 //  fNHitsPossMax(that.fNHitsPossMax),
115 //  fNHitsPossMin(that.fNHitsPossMin),
116 //  fCutNHitsDedx(that.fCutNHitsDedx),
117 //  fNHitsDedxMax(that.fNHitsDedxMax),
118 //  fNHitsDedxMin(that.fNHitsDedxMin),
119 //  fCutdEdx(that.fCutdEdx),
120 //  fdEdxMax(that.fdEdxMax),
121 //  fdEdxMin(that.fdEdxMin),
122 //  fCutNSigElect(that.fCutNSigElect),
123 //  fNSigElectMax(that.fNSigElectMax),
124 //  fNSigElectMin(that.fNSigElectMin),
125 //  fCutNSigPi(that.fCutNSigPi),
126 //  fNSigPiMax(that.fNSigPiMax),
127 //  fNSigPiMin(that.fNSigPiMin),
128 //  fCutNSigK(that.fCutNSigK),
129 //  fNSigKMax(that.fNSigKMax),
130 //  fNSigKMin(that.fNSigKMin),
131 //  fCutNSigProton(that.fCutNSigProton),
132 //  fNSigProtonMax(that.fNSigProtonMax),
133 //  fNSigProtonMin(that.fNSigProtonMin),
134 //  fCutFitRatio(that.fCutFitRatio),
135 //  fFitRatioMax(that.fFitRatioMax),
136 //  fFitRatioMin(that.fFitRatioMin)
137 //{
138 //  //copy ctor 
139 //}
140 //
141 ////-----------------------------------------------------------------------
142 //AliStarTrackCuts& AliStarTrackCuts::operator=(const AliStarTrackCuts& that)
143 //{
144 //  //assignment
145 //  fCutID=that.fCutID;
146 //  fIDMax=that.fIDMax;
147 //  fIDMin=that.fIDMin;
148 //  fCutCharge=that.fCutCharge;
149 //  fChargeMax=that.fChargeMax;
150 //  fChargeMin=that.fChargeMin;
151 //  fCutEta=that.fCutEta;
152 //  fEtaMax=that.fEtaMax;
153 //  fEtaMin=that.fEtaMin;
154 //  fCutPhi=that.fCutPhi;
155 //  fPhiMax=that.fPhiMax;
156 //  fPhiMin=that.fPhiMin;
157 //  fCutPt=that.fCutPt;
158 //  fPtMax=that.fPtMax;
159 //  fPtMin=that.fPtMin;
160 //  fCutDCA=that.fCutDCA;
161 //  fDCAMax=that.fDCAMax;
162 //  fDCAMin=that.fDCAMin;
163 //  fCutNHits=that.fCutNHits;
164 //  fNHitsMax=that.fNHitsMax;
165 //  fNHitsMin=that.fNHitsMin;
166 //  fCutNHitsFit=that.fCutNHitsFit;
167 //  fNHitsFitMax=that.fNHitsFitMax;
168 //  fNHitsFitMin=that.fNHitsFitMin;
169 //  fCutNHitsPoss=that.fCutNHitsPoss;
170 //  fNHitsPossMax=that.fNHitsPossMax;
171 //  fNHitsPossMin=that.fNHitsPossMin;
172 //  fCutNHitsDedx=that.fCutNHitsDedx;
173 //  fNHitsDedxMax=that.fNHitsDedxMax;
174 //  fNHitsDedxMin=that.fNHitsDedxMin;
175 //  fCutdEdx=that.fCutdEdx;
176 //  fdEdxMax=that.fdEdxMax;
177 //  fdEdxMin=that.fdEdxMin;
178 //  fCutNSigElect=that.fCutNSigElect;
179 //  fNSigElectMax=that.fNSigElectMax;
180 //  fNSigElectMin=that.fNSigElectMin;
181 //  fCutNSigPi=that.fCutNSigPi;
182 //  fNSigPiMax=that.fNSigPiMax;
183 //  fNSigPiMin=that.fNSigPiMin;
184 //  fCutNSigK=that.fCutNSigK;
185 //  fNSigKMax=that.fNSigKMax;
186 //  fNSigKMin=that.fNSigKMin;
187 //  fCutNSigProton=that.fCutNSigProton;
188 //  fNSigProtonMax=that.fNSigProtonMax;
189 //  fNSigProtonMin=that.fNSigProtonMin;
190 //  fCutFitRatio=that.fCutFitRatio;
191 //  fFitRatioMax=that.fFitRatioMax;
192 //  fFitRatioMin=that.fFitRatioMin;
193 //  
194 //  return *this;
195 //}
196
197 //----------------------------------------------------------------------- 
198 Bool_t AliStarTrackCuts::PassesCuts(const AliStarTrack *track) const
199 {
200   //check is track passes cuts
201   if(fCutID) {if (track->GetID() < fIDMin || track->GetID() > fIDMax ) return kFALSE;} //integer values: non inclusive bound!
202   if(fCutCharge) {if (track->GetCharge() < fChargeMin || track->GetCharge() > fChargeMax ) return kFALSE;}
203   if(fCutEta) {if (track->GetEta() < fEtaMin || track->GetEta() >= fEtaMax ) return kFALSE;}
204   if(fCutPhi) {if (track->GetPhi() < fPhiMin || track->GetPhi() >= fPhiMax ) return kFALSE;}
205   if(fCutPt) {if (track->GetPt() < fPtMin || track->GetPt() >= fPtMax ) return kFALSE;}
206   if(fCutDCA) {if (track->GetDCA() < fDCAMin || track->GetDCA() >= fDCAMax ) return kFALSE;}
207   if(fCutNHits) {if (track->GetNHits() < fNHitsMin || track->GetNHits() > fNHitsMax ) return kFALSE;}
208   if(fCutNHitsFit) {if (track->GetNHitsFit() < fNHitsFitMin || track->GetNHitsFit() > fNHitsFitMax ) return kFALSE;}
209   if(fCutNHitsPoss) {if (track->GetNHitsPoss() < fNHitsPossMin || track->GetNHitsPoss() > fNHitsPossMax ) return kFALSE;}
210   if(fCutNHitsDedx) {if (track->GetNHitsDedx() < fNHitsDedxMin || track->GetNHitsDedx() > fNHitsDedxMax ) return kFALSE;}
211   if(fCutdEdx) {if (track->GetdEdx() < fdEdxMin || track->GetdEdx() >= fdEdxMax ) return kFALSE;}
212   if(fCutNSigElect) {if (track->GetNSigElect() < fNSigElectMin || track->GetNSigElect() > fNSigElectMax ) return kFALSE;}
213   if(fCutNSigPi) {if (track->GetNSigPi() < fNSigPiMin || track->GetNSigPi() > fNSigPiMax ) return kFALSE;}
214   if(fCutNSigK) {if (track->GetNSigK() < fNSigKMin || track->GetNSigK() > fNSigKMax ) return kFALSE;}
215   if(fCutNSigProton) {if (track->GetNSigProton() < fNSigProtonMin || track->GetNSigProton() > fNSigProtonMax ) return kFALSE;}
216   if(fCutFitRatio)
217   {
218     Int_t nhitsposs =  track->GetNHitsPoss();
219     if (nhitsposs==0) return kFALSE;
220     Float_t ratio = Float_t(track->GetNHitsFit()) / nhitsposs;
221     if ( ratio < fFitRatioMin && ratio >= fFitRatioMax ) return kFALSE;
222   }
223
224   return kTRUE;
225 }
226
227 //----------------------------------------------------------------------- 
228 AliStarTrackCuts* AliStarTrackCuts::StandardCuts()
229 {
230   //return a set of standard cuts, caller becomes owner
231   AliStarTrackCuts* cuts = new AliStarTrackCuts();
232   cuts->SetDCAMin(0.0);     // cm
233   cuts->SetDCAMax(3.0);      
234   cuts->SetPtMin(0.15);      // GeV
235   cuts->SetPtMax(8.0);
236   cuts->SetEtaMin(-1.1);
237   cuts->SetEtaMax(1.1);
238   cuts->SetFitRatioMin(0.52);  // Number of hits over number of hits possible
239   cuts->SetFitRatioMax(2.0);      //should not exceed 1.0 but who knows...
240   cuts->SetNHitsPossMin(5);    // Don't bother to fit tracks if # possible hits is too low
241   cuts->SetNHitsPossMax(100);
242   cuts->SetNHitsFitMin(15);    // 15 is typical but sometimes goes as high as 25
243   cuts->SetNHitsFitMax(100);   // 45 pad rows in the TPC and so anything bigger than 45+Silicon is infinite
244   return cuts;
245 }