]>
Commit | Line | Data |
---|---|---|
ea197c3e | 1 | /* $Id$ */ |
9616170a | 2 | //____________________________________ |
3 | ///////////////////////////////////////////////////////////////////////// | |
4 | // | |
ea197c3e | 5 | // Class AliHBTPairCut: |
9616170a | 6 | // |
ea197c3e | 7 | // implements cut on the pair of particles |
8 | // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html | |
9 | // Author: Piotr.Skowronski@cern.ch | |
10 | //------------------------------------------------------------------- | |
11 | ||
1b446896 | 12 | #include "AliHBTPairCut.h" |
13 | #include "AliHBTPair.h" | |
ea197c3e | 14 | #include "AliHBTParticleCut.h" |
9616170a | 15 | #include "AliHBTTrackPoints.h" |
66d1d1a4 | 16 | #include "AliHBTClusterMap.h" |
1b446896 | 17 | |
18 | ClassImp(AliHBTPairCut) | |
ea197c3e | 19 | const Int_t AliHBTPairCut::fgkMaxCuts = 50; |
1b446896 | 20 | /**********************************************************/ |
21 | ||
e3131968 | 22 | AliHBTPairCut::AliHBTPairCut(): |
23 | fNCuts(0) | |
1b446896 | 24 | { |
ea197c3e | 25 | //constructor |
1b446896 | 26 | fFirstPartCut = new AliHBTEmptyParticleCut(); //empty cuts |
27 | fSecondPartCut= new AliHBTEmptyParticleCut(); //empty cuts | |
28 | ||
ea197c3e | 29 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; |
1b446896 | 30 | } |
31 | /**********************************************************/ | |
32 | ||
bed069a4 | 33 | AliHBTPairCut::AliHBTPairCut(const AliHBTPairCut& in): |
34 | TNamed(in) | |
1b446896 | 35 | { |
ea197c3e | 36 | //copy constructor |
37 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; | |
38 | fNCuts = in.fNCuts; | |
39 | ||
40 | fFirstPartCut = (AliHBTParticleCut*)in.fFirstPartCut->Clone(); | |
41 | fSecondPartCut = (AliHBTParticleCut*)in.fSecondPartCut->Clone(); | |
42 | ||
43 | for (Int_t i = 0;i<fNCuts;i++) | |
44 | { | |
45 | fCuts[i] = (AliHbtBasePairCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it | |
46 | } | |
47 | } | |
48 | /**********************************************************/ | |
49 | ||
50 | AliHBTPairCut& AliHBTPairCut::operator=(const AliHBTPairCut& in) | |
51 | { | |
52 | //assignment operator | |
53 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; | |
54 | fNCuts = in.fNCuts; | |
1b446896 | 55 | |
ea197c3e | 56 | fFirstPartCut = (AliHBTParticleCut*)in.fFirstPartCut->Clone(); |
57 | fSecondPartCut = (AliHBTParticleCut*)in.fSecondPartCut->Clone(); | |
1b446896 | 58 | |
ea197c3e | 59 | for (Int_t i = 0;i<fNCuts;i++) |
60 | { | |
61 | fCuts[i] = (AliHbtBasePairCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it | |
62 | } | |
63 | return * this; | |
1b446896 | 64 | } |
65 | /**********************************************************/ | |
66 | ||
67 | AliHBTPairCut::~AliHBTPairCut() | |
68 | { | |
ea197c3e | 69 | //destructor |
e3131968 | 70 | if (fFirstPartCut != fSecondPartCut) |
ea197c3e | 71 | { |
72 | delete fSecondPartCut; | |
73 | } | |
e3131968 | 74 | delete fFirstPartCut; |
1b446896 | 75 | for (Int_t i = 0;i<fNCuts;i++) |
ea197c3e | 76 | { |
77 | delete fCuts[i]; | |
78 | } | |
1b446896 | 79 | delete []fCuts; |
80 | } | |
81 | /**********************************************************/ | |
82 | ||
83 | /**********************************************************/ | |
84 | ||
85 | void AliHBTPairCut::AddBasePairCut(AliHbtBasePairCut* basecut) | |
ea197c3e | 86 | { |
87 | //adds the base pair cut (cut on one value) | |
88 | ||
89 | if (!basecut) return; | |
90 | if( fNCuts == (fgkMaxCuts-1) ) | |
1b446896 | 91 | { |
92 | Warning("AddBasePairCut","Not enough place for another cut"); | |
93 | return; | |
94 | } | |
ea197c3e | 95 | fCuts[fNCuts++]=basecut; |
96 | } | |
1b446896 | 97 | /**********************************************************/ |
98 | ||
ea197c3e | 99 | Bool_t AliHBTPairCut::Pass(AliHBTPair* pair) const |
1b446896 | 100 | { |
ea197c3e | 101 | //methods which checks if given pair meets all criteria of the cut |
102 | //if it meets returns FALSE | |
103 | //if NOT returns TRUE | |
104 | if(!pair) | |
105 | { | |
106 | Warning("Pass","No Pasaran! We never accept NULL pointers"); | |
107 | return kTRUE; | |
108 | } | |
109 | ||
110 | //check particle's cuts | |
111 | if( ( fFirstPartCut->Pass( pair->Particle1()) ) || | |
112 | ( fSecondPartCut->Pass(pair->Particle2()) ) ) | |
113 | { | |
114 | return kTRUE; | |
115 | } | |
116 | return PassPairProp(pair); | |
48704f50 | 117 | } |
118 | /**********************************************************/ | |
119 | ||
ea197c3e | 120 | Bool_t AliHBTPairCut::PassPairProp(AliHBTPair* pair) const |
48704f50 | 121 | { |
ea197c3e | 122 | //methods which checks if given pair meets all criteria of the cut |
123 | //if it meets returns FALSE | |
124 | //if NOT returns TRUE | |
125 | //examine all base pair cuts | |
126 | for (Int_t i = 0;i<fNCuts;i++) | |
127 | { | |
128 | if ( (fCuts[i]->Pass(pair)) ) return kTRUE; //if one of the cuts reject, then reject | |
129 | } | |
130 | return kFALSE; | |
1b446896 | 131 | } |
132 | /**********************************************************/ | |
133 | ||
134 | void AliHBTPairCut::SetFirstPartCut(AliHBTParticleCut* cut) | |
135 | { | |
ea197c3e | 136 | // set cut for the first particle |
137 | if(!cut) | |
138 | { | |
139 | Error("SetFirstPartCut","argument is NULL"); | |
140 | return; | |
141 | } | |
142 | delete fFirstPartCut; | |
143 | fFirstPartCut = (AliHBTParticleCut*)cut->Clone(); | |
144 | ||
1b446896 | 145 | } |
146 | /**********************************************************/ | |
147 | ||
148 | void AliHBTPairCut::SetSecondPartCut(AliHBTParticleCut* cut) | |
149 | { | |
ea197c3e | 150 | // set cut for the second particle |
151 | if(!cut) | |
152 | { | |
153 | Error("SetSecondPartCut","argument is NULL"); | |
154 | return; | |
155 | } | |
156 | delete fSecondPartCut; | |
157 | fSecondPartCut = (AliHBTParticleCut*)cut->Clone(); | |
1b446896 | 158 | } |
159 | /**********************************************************/ | |
160 | ||
161 | void AliHBTPairCut::SetPartCut(AliHBTParticleCut* cut) | |
162 | { | |
ea197c3e | 163 | //sets the the same cut on both particles |
164 | if(!cut) | |
165 | { | |
166 | Error("SetFirstPartCut","argument is NULL"); | |
167 | return; | |
168 | } | |
9aaf37fe | 169 | if (fFirstPartCut == fSecondPartCut) fSecondPartCut = 0x0; |
170 | ||
ea197c3e | 171 | delete fFirstPartCut; |
172 | fFirstPartCut = (AliHBTParticleCut*)cut->Clone(); | |
173 | ||
174 | delete fSecondPartCut; //even if null should not be harmful | |
175 | fSecondPartCut = fFirstPartCut; | |
1b446896 | 176 | } |
177 | /**********************************************************/ | |
178 | ||
179 | void AliHBTPairCut::SetQInvRange(Double_t min, Double_t max) | |
180 | { | |
ea197c3e | 181 | // set range of accepted invariant masses |
1b446896 | 182 | AliHBTQInvCut* cut= (AliHBTQInvCut*)FindCut(kHbtPairCutPropQInv); |
183 | if(cut) cut->SetRange(min,max); | |
184 | else fCuts[fNCuts++] = new AliHBTQInvCut(min,max); | |
a37908e0 | 185 | } |
186 | /**********************************************************/ | |
187 | void AliHBTPairCut::SetQOutCMSLRange(Double_t min, Double_t max) | |
188 | { | |
ea197c3e | 189 | // set range of accepted QOut in CMS |
a37908e0 | 190 | AliHBTQOutCMSLCCut* cut= (AliHBTQOutCMSLCCut*)FindCut(kHbtPairCutPropQOutCMSLC); |
191 | if(cut) cut->SetRange(min,max); | |
192 | else fCuts[fNCuts++] = new AliHBTQOutCMSLCCut(min,max); | |
193 | } | |
1b446896 | 194 | |
a37908e0 | 195 | /**********************************************************/ |
196 | void AliHBTPairCut::SetQSideCMSLRange(Double_t min, Double_t max) | |
197 | { | |
ea197c3e | 198 | // set range of accepted QSide in CMS |
a37908e0 | 199 | AliHBTQSideCMSLCCut* cut= (AliHBTQSideCMSLCCut*)FindCut(kHbtPairCutPropQSideCMSLC); |
200 | if(cut) cut->SetRange(min,max); | |
201 | else fCuts[fNCuts++] = new AliHBTQSideCMSLCCut(min,max); | |
1b446896 | 202 | } |
203 | ||
a37908e0 | 204 | /**********************************************************/ |
205 | void AliHBTPairCut::SetQLongCMSLRange(Double_t min, Double_t max) | |
206 | { | |
ea197c3e | 207 | // set range of accepted QLong in CMS |
a37908e0 | 208 | AliHBTQLongCMSLCCut* cut= (AliHBTQLongCMSLCCut*)FindCut(kHbtPairCutPropQLongCMSLC); |
209 | if(cut) cut->SetRange(min,max); | |
210 | else fCuts[fNCuts++] = new AliHBTQLongCMSLCCut(min,max); | |
211 | } | |
212 | ||
213 | /**********************************************************/ | |
214 | ||
bce80f3b | 215 | void AliHBTPairCut::SetKtRange(Double_t min, Double_t max) |
216 | { | |
ea197c3e | 217 | // set range of accepted Kt (?) |
bce80f3b | 218 | AliHBTKtCut* cut= (AliHBTKtCut*)FindCut(kHbtPairCutPropKt); |
219 | if(cut) cut->SetRange(min,max); | |
220 | else fCuts[fNCuts++] = new AliHBTKtCut(min,max); | |
221 | } | |
222 | /**********************************************************/ | |
223 | ||
e3131968 | 224 | void AliHBTPairCut::SetKStarRange(Double_t min, Double_t max) |
225 | { | |
ea197c3e | 226 | // set range of accepted KStar (?) |
e3131968 | 227 | AliHBTKStarCut* cut= (AliHBTKStarCut*)FindCut(kHbtPairCutPropKStar); |
228 | if(cut) cut->SetRange(min,max); | |
229 | else fCuts[fNCuts++] = new AliHBTKStarCut(min,max); | |
230 | } | |
231 | /**********************************************************/ | |
9616170a | 232 | void AliHBTPairCut::SetAvSeparationRange(Double_t min, Double_t max) |
233 | { | |
234 | //sets avarage separation cut ->Anti-Merging cut | |
235 | AliHbtBasePairCut* cut= FindCut(kHbtPairCutPropAvSepar); | |
236 | if(cut) cut->SetRange(min,max); | |
237 | else fCuts[fNCuts++] = new AliHBTAvSeparationCut(min,max); | |
238 | } | |
239 | /**********************************************************/ | |
e3131968 | 240 | |
66d1d1a4 | 241 | void AliHBTPairCut::SetClusterOverlapRange(Double_t min,Double_t max) |
242 | { | |
243 | //sets cluster overlap factor cut ->Anti-Splitting cut | |
244 | //cluster overlap factor ranges between | |
245 | // -0.5 (in all padrows both tracks have cluters) | |
246 | // and 1 (in all padrows one track has cluter and second has not) | |
247 | // When Overlap Factor is 1 this pair of tracks in highly probable to be | |
248 | // splitted track: one particle that is recontructed twise | |
249 | // STAR uses range from -0.5 to 0.6 | |
250 | ||
251 | AliHbtBasePairCut* cut= FindCut(kHbtPairCutPropClOverlap); | |
252 | if(cut) cut->SetRange(min,max); | |
253 | else fCuts[fNCuts++] = new AliHBTCluterOverlapCut(min,max); | |
254 | } | |
255 | ||
1b446896 | 256 | AliHbtBasePairCut* AliHBTPairCut::FindCut(AliHBTPairCutProperty property) |
257 | { | |
ea197c3e | 258 | // Find the cut corresponding to "property" |
259 | for (Int_t i = 0;i<fNCuts;i++) | |
260 | { | |
261 | if (fCuts[i]->GetProperty() == property) | |
262 | return fCuts[i]; //we found the cut we were searching for | |
263 | } | |
264 | ||
265 | return 0x0; //we did not found this cut | |
1b446896 | 266 | |
267 | } | |
268 | /**********************************************************/ | |
269 | ||
270 | void AliHBTPairCut::Streamer(TBuffer &b) | |
271 | { | |
e3131968 | 272 | // Stream all objects in the array to or from the I/O buffer. |
ea197c3e | 273 | |
274 | UInt_t R__s, R__c; | |
275 | if (b.IsReading()) | |
1b446896 | 276 | { |
277 | Version_t v = b.ReadVersion(&R__s, &R__c); | |
1b934a85 | 278 | if (v > -1) |
88cb7938 | 279 | { |
280 | delete fFirstPartCut; | |
281 | delete fSecondPartCut; | |
282 | fFirstPartCut = 0x0; | |
283 | fSecondPartCut = 0x0; | |
284 | TObject::Streamer(b); | |
285 | b >> fFirstPartCut; | |
286 | b >> fSecondPartCut; | |
287 | b >> fNCuts; | |
288 | for (Int_t i = 0;i<fNCuts;i++) | |
289 | { | |
290 | b >> fCuts[i]; | |
291 | } | |
1b934a85 | 292 | } |
ea197c3e | 293 | b.CheckByteCount(R__s, R__c,AliHBTPairCut::IsA()); |
1b446896 | 294 | } |
ea197c3e | 295 | else |
1b446896 | 296 | { |
ea197c3e | 297 | R__c = b.WriteVersion(AliHBTPairCut::IsA(), kTRUE); |
298 | TObject::Streamer(b); | |
9aaf37fe | 299 | |
300 | // printf("Streamer Cut 1 %#x Cut 2 %#x\n",fFirstPartCut,fSecondPartCut); | |
301 | // this->Dump(); | |
302 | // fFirstPartCut->Dump(); | |
303 | ||
ea197c3e | 304 | b << fFirstPartCut; |
305 | b << fSecondPartCut; | |
306 | b << fNCuts; | |
307 | for (Int_t i = 0;i<fNCuts;i++) | |
88cb7938 | 308 | { |
309 | b << fCuts[i]; | |
310 | } | |
ea197c3e | 311 | b.SetByteCount(R__c, kTRUE); |
312 | } | |
1b446896 | 313 | } |
314 | ||
315 | ClassImp(AliHBTEmptyPairCut) | |
ea197c3e | 316 | |
1b446896 | 317 | void AliHBTEmptyPairCut::Streamer(TBuffer &b) |
ea197c3e | 318 | { |
88cb7938 | 319 | //streamer for empty pair cut |
ea197c3e | 320 | AliHBTPairCut::Streamer(b); |
321 | } | |
1b446896 | 322 | |
323 | ClassImp(AliHbtBasePairCut) | |
1b446896 | 324 | ClassImp(AliHBTQInvCut) |
bce80f3b | 325 | ClassImp(AliHBTKtCut) |
c6b93712 | 326 | ClassImp(AliHBTQSideCMSLCCut) |
327 | ClassImp(AliHBTQOutCMSLCCut) | |
328 | ClassImp(AliHBTQLongCMSLCCut) | |
9616170a | 329 | ClassImp(AliHBTAvSeparationCut) |
330 | ||
331 | ||
332 | Double_t AliHBTAvSeparationCut::GetValue(AliHBTPair* pair) const | |
333 | { | |
334 | //chacks if avarage distance of two tracks is in given range | |
9616170a | 335 | AliHBTTrackPoints* tpts1 = pair->Particle1()->GetTrackPoints(); |
336 | if ( tpts1 == 0x0) | |
2ac5756f | 337 | {//it could be simulated pair |
338 | // Warning("GetValue","Track 1 does not have Track Points. Pair NOT Passed."); | |
339 | return 10e5; | |
9616170a | 340 | } |
341 | ||
342 | AliHBTTrackPoints* tpts2 = pair->Particle2()->GetTrackPoints(); | |
343 | if ( tpts2 == 0x0) | |
344 | { | |
2ac5756f | 345 | // Warning("GetValue","Track 2 does not have Track Points. Pair NOT Passed."); |
346 | return 10e5; | |
9616170a | 347 | } |
348 | ||
349 | return tpts1->AvarageDistance(*tpts2); | |
350 | } | |
351 | ||
66d1d1a4 | 352 | ClassImp(AliHBTCluterOverlapCut) |
353 | ||
354 | Double_t AliHBTCluterOverlapCut::GetValue(AliHBTPair* pair) const | |
355 | { | |
356 | //Returns Cluter Overlap Factor | |
357 | //It ranges between -0.5 (in all padrows both tracks have cluters) | |
358 | // and 1 (in all padrows one track has cluter and second has not) | |
359 | // When Overlap Factor is 1 this pair of tracks in highly probable to be | |
360 | // splitted track: one particle that is recontructed twise | |
361 | ||
362 | AliHBTClusterMap* cm1 = pair->Particle1()->GetClusterMap(); | |
363 | if ( cm1 == 0x0) | |
364 | { | |
365 | Warning("GetValue","Track 1 does not have Cluster Map. Returning -0.5."); | |
366 | return -.5; | |
367 | } | |
368 | ||
369 | AliHBTClusterMap* cm2 = pair->Particle2()->GetClusterMap(); | |
370 | if ( cm2 == 0x0) | |
371 | { | |
372 | Warning("GetValue","Track 2 does not have Cluster Map. Returning -0.5."); | |
373 | return -.5; | |
374 | } | |
375 | return cm1->GetOverlapFactor(*cm2); | |
376 | } |