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