]>
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" |
66d1d1a4 | 15 | #include "AliHBTClusterMap.h" |
1b446896 | 16 | |
17 | ClassImp(AliHBTPairCut) | |
ea197c3e | 18 | const Int_t AliHBTPairCut::fgkMaxCuts = 50; |
1b446896 | 19 | /**********************************************************/ |
20 | ||
e3131968 | 21 | AliHBTPairCut::AliHBTPairCut(): |
22 | fNCuts(0) | |
1b446896 | 23 | { |
ea197c3e | 24 | //constructor |
1b446896 | 25 | fFirstPartCut = new AliHBTEmptyParticleCut(); //empty cuts |
26 | fSecondPartCut= new AliHBTEmptyParticleCut(); //empty cuts | |
27 | ||
ea197c3e | 28 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; |
1b446896 | 29 | } |
30 | /**********************************************************/ | |
31 | ||
bed069a4 | 32 | AliHBTPairCut::AliHBTPairCut(const AliHBTPairCut& in): |
33 | TNamed(in) | |
1b446896 | 34 | { |
ea197c3e | 35 | //copy constructor |
36 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; | |
37 | fNCuts = in.fNCuts; | |
38 | ||
39 | fFirstPartCut = (AliHBTParticleCut*)in.fFirstPartCut->Clone(); | |
40 | fSecondPartCut = (AliHBTParticleCut*)in.fSecondPartCut->Clone(); | |
41 | ||
42 | for (Int_t i = 0;i<fNCuts;i++) | |
43 | { | |
44 | fCuts[i] = (AliHbtBasePairCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it | |
45 | } | |
46 | } | |
47 | /**********************************************************/ | |
48 | ||
49 | AliHBTPairCut& AliHBTPairCut::operator=(const AliHBTPairCut& in) | |
50 | { | |
51 | //assignment operator | |
52 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; | |
53 | fNCuts = in.fNCuts; | |
1b446896 | 54 | |
ea197c3e | 55 | fFirstPartCut = (AliHBTParticleCut*)in.fFirstPartCut->Clone(); |
56 | fSecondPartCut = (AliHBTParticleCut*)in.fSecondPartCut->Clone(); | |
1b446896 | 57 | |
ea197c3e | 58 | for (Int_t i = 0;i<fNCuts;i++) |
59 | { | |
60 | fCuts[i] = (AliHbtBasePairCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it | |
61 | } | |
62 | return * this; | |
1b446896 | 63 | } |
64 | /**********************************************************/ | |
65 | ||
66 | AliHBTPairCut::~AliHBTPairCut() | |
67 | { | |
ea197c3e | 68 | //destructor |
e3131968 | 69 | if (fFirstPartCut != fSecondPartCut) |
ea197c3e | 70 | { |
71 | delete fSecondPartCut; | |
72 | } | |
e3131968 | 73 | delete fFirstPartCut; |
1b446896 | 74 | for (Int_t i = 0;i<fNCuts;i++) |
ea197c3e | 75 | { |
76 | delete fCuts[i]; | |
77 | } | |
1b446896 | 78 | delete []fCuts; |
79 | } | |
80 | /**********************************************************/ | |
81 | ||
82 | /**********************************************************/ | |
83 | ||
84 | void AliHBTPairCut::AddBasePairCut(AliHbtBasePairCut* basecut) | |
ea197c3e | 85 | { |
86 | //adds the base pair cut (cut on one value) | |
87 | ||
88 | if (!basecut) return; | |
89 | if( fNCuts == (fgkMaxCuts-1) ) | |
1b446896 | 90 | { |
91 | Warning("AddBasePairCut","Not enough place for another cut"); | |
92 | return; | |
93 | } | |
ea197c3e | 94 | fCuts[fNCuts++]=basecut; |
95 | } | |
1b446896 | 96 | /**********************************************************/ |
97 | ||
ea197c3e | 98 | Bool_t AliHBTPairCut::Pass(AliHBTPair* pair) const |
1b446896 | 99 | { |
ea197c3e | 100 | //methods which checks if given pair meets all criteria of the cut |
101 | //if it meets returns FALSE | |
102 | //if NOT returns TRUE | |
103 | if(!pair) | |
104 | { | |
105 | Warning("Pass","No Pasaran! We never accept NULL pointers"); | |
106 | return kTRUE; | |
107 | } | |
108 | ||
109 | //check particle's cuts | |
110 | if( ( fFirstPartCut->Pass( pair->Particle1()) ) || | |
111 | ( fSecondPartCut->Pass(pair->Particle2()) ) ) | |
112 | { | |
113 | return kTRUE; | |
114 | } | |
115 | return PassPairProp(pair); | |
48704f50 | 116 | } |
117 | /**********************************************************/ | |
118 | ||
ea197c3e | 119 | Bool_t AliHBTPairCut::PassPairProp(AliHBTPair* pair) const |
48704f50 | 120 | { |
ea197c3e | 121 | //methods which checks if given pair meets all criteria of the cut |
122 | //if it meets returns FALSE | |
123 | //if NOT returns TRUE | |
124 | //examine all base pair cuts | |
125 | for (Int_t i = 0;i<fNCuts;i++) | |
126 | { | |
127 | if ( (fCuts[i]->Pass(pair)) ) return kTRUE; //if one of the cuts reject, then reject | |
128 | } | |
129 | return kFALSE; | |
1b446896 | 130 | } |
131 | /**********************************************************/ | |
132 | ||
133 | void AliHBTPairCut::SetFirstPartCut(AliHBTParticleCut* cut) | |
134 | { | |
ea197c3e | 135 | // set cut for the first particle |
136 | if(!cut) | |
137 | { | |
138 | Error("SetFirstPartCut","argument is NULL"); | |
139 | return; | |
140 | } | |
141 | delete fFirstPartCut; | |
142 | fFirstPartCut = (AliHBTParticleCut*)cut->Clone(); | |
143 | ||
1b446896 | 144 | } |
145 | /**********************************************************/ | |
146 | ||
147 | void AliHBTPairCut::SetSecondPartCut(AliHBTParticleCut* cut) | |
148 | { | |
ea197c3e | 149 | // set cut for the second particle |
150 | if(!cut) | |
151 | { | |
152 | Error("SetSecondPartCut","argument is NULL"); | |
153 | return; | |
154 | } | |
155 | delete fSecondPartCut; | |
156 | fSecondPartCut = (AliHBTParticleCut*)cut->Clone(); | |
1b446896 | 157 | } |
158 | /**********************************************************/ | |
159 | ||
160 | void AliHBTPairCut::SetPartCut(AliHBTParticleCut* cut) | |
161 | { | |
ea197c3e | 162 | //sets the the same cut on both particles |
163 | if(!cut) | |
164 | { | |
165 | Error("SetFirstPartCut","argument is NULL"); | |
166 | return; | |
167 | } | |
9aaf37fe | 168 | if (fFirstPartCut == fSecondPartCut) fSecondPartCut = 0x0; |
169 | ||
ea197c3e | 170 | delete fFirstPartCut; |
171 | fFirstPartCut = (AliHBTParticleCut*)cut->Clone(); | |
172 | ||
173 | delete fSecondPartCut; //even if null should not be harmful | |
174 | fSecondPartCut = fFirstPartCut; | |
1b446896 | 175 | } |
176 | /**********************************************************/ | |
177 | ||
178 | void AliHBTPairCut::SetQInvRange(Double_t min, Double_t max) | |
179 | { | |
ea197c3e | 180 | // set range of accepted invariant masses |
1b446896 | 181 | AliHBTQInvCut* cut= (AliHBTQInvCut*)FindCut(kHbtPairCutPropQInv); |
182 | if(cut) cut->SetRange(min,max); | |
183 | else fCuts[fNCuts++] = new AliHBTQInvCut(min,max); | |
a37908e0 | 184 | } |
185 | /**********************************************************/ | |
186 | void AliHBTPairCut::SetQOutCMSLRange(Double_t min, Double_t max) | |
187 | { | |
ea197c3e | 188 | // set range of accepted QOut in CMS |
a37908e0 | 189 | AliHBTQOutCMSLCCut* cut= (AliHBTQOutCMSLCCut*)FindCut(kHbtPairCutPropQOutCMSLC); |
190 | if(cut) cut->SetRange(min,max); | |
191 | else fCuts[fNCuts++] = new AliHBTQOutCMSLCCut(min,max); | |
192 | } | |
1b446896 | 193 | |
a37908e0 | 194 | /**********************************************************/ |
195 | void AliHBTPairCut::SetQSideCMSLRange(Double_t min, Double_t max) | |
196 | { | |
ea197c3e | 197 | // set range of accepted QSide in CMS |
a37908e0 | 198 | AliHBTQSideCMSLCCut* cut= (AliHBTQSideCMSLCCut*)FindCut(kHbtPairCutPropQSideCMSLC); |
199 | if(cut) cut->SetRange(min,max); | |
200 | else fCuts[fNCuts++] = new AliHBTQSideCMSLCCut(min,max); | |
1b446896 | 201 | } |
202 | ||
a37908e0 | 203 | /**********************************************************/ |
204 | void AliHBTPairCut::SetQLongCMSLRange(Double_t min, Double_t max) | |
205 | { | |
ea197c3e | 206 | // set range of accepted QLong in CMS |
a37908e0 | 207 | AliHBTQLongCMSLCCut* cut= (AliHBTQLongCMSLCCut*)FindCut(kHbtPairCutPropQLongCMSLC); |
208 | if(cut) cut->SetRange(min,max); | |
209 | else fCuts[fNCuts++] = new AliHBTQLongCMSLCCut(min,max); | |
210 | } | |
211 | ||
212 | /**********************************************************/ | |
213 | ||
bce80f3b | 214 | void AliHBTPairCut::SetKtRange(Double_t min, Double_t max) |
215 | { | |
ea197c3e | 216 | // set range of accepted Kt (?) |
bce80f3b | 217 | AliHBTKtCut* cut= (AliHBTKtCut*)FindCut(kHbtPairCutPropKt); |
218 | if(cut) cut->SetRange(min,max); | |
219 | else fCuts[fNCuts++] = new AliHBTKtCut(min,max); | |
220 | } | |
221 | /**********************************************************/ | |
222 | ||
e3131968 | 223 | void AliHBTPairCut::SetKStarRange(Double_t min, Double_t max) |
224 | { | |
ea197c3e | 225 | // set range of accepted KStar (?) |
e3131968 | 226 | AliHBTKStarCut* cut= (AliHBTKStarCut*)FindCut(kHbtPairCutPropKStar); |
227 | if(cut) cut->SetRange(min,max); | |
228 | else fCuts[fNCuts++] = new AliHBTKStarCut(min,max); | |
229 | } | |
230 | /**********************************************************/ | |
6d7ee019 | 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 | } | |
6d7ee019 | 255 | /**********************************************************/ |
66d1d1a4 | 256 | |
1b446896 | 257 | AliHbtBasePairCut* AliHBTPairCut::FindCut(AliHBTPairCutProperty property) |
258 | { | |
ea197c3e | 259 | // Find the cut corresponding to "property" |
260 | for (Int_t i = 0;i<fNCuts;i++) | |
261 | { | |
262 | if (fCuts[i]->GetProperty() == property) | |
263 | return fCuts[i]; //we found the cut we were searching for | |
264 | } | |
265 | ||
266 | return 0x0; //we did not found this cut | |
1b446896 | 267 | |
268 | } | |
269 | /**********************************************************/ | |
270 | ||
271 | void AliHBTPairCut::Streamer(TBuffer &b) | |
272 | { | |
e3131968 | 273 | // Stream all objects in the array to or from the I/O buffer. |
ea197c3e | 274 | |
275 | UInt_t R__s, R__c; | |
276 | if (b.IsReading()) | |
1b446896 | 277 | { |
278 | Version_t v = b.ReadVersion(&R__s, &R__c); | |
1b934a85 | 279 | if (v > -1) |
88cb7938 | 280 | { |
281 | delete fFirstPartCut; | |
282 | delete fSecondPartCut; | |
283 | fFirstPartCut = 0x0; | |
284 | fSecondPartCut = 0x0; | |
285 | TObject::Streamer(b); | |
286 | b >> fFirstPartCut; | |
287 | b >> fSecondPartCut; | |
288 | b >> fNCuts; | |
289 | for (Int_t i = 0;i<fNCuts;i++) | |
290 | { | |
291 | b >> fCuts[i]; | |
292 | } | |
1b934a85 | 293 | } |
ea197c3e | 294 | b.CheckByteCount(R__s, R__c,AliHBTPairCut::IsA()); |
1b446896 | 295 | } |
ea197c3e | 296 | else |
1b446896 | 297 | { |
ea197c3e | 298 | R__c = b.WriteVersion(AliHBTPairCut::IsA(), kTRUE); |
299 | TObject::Streamer(b); | |
9aaf37fe | 300 | |
301 | // printf("Streamer Cut 1 %#x Cut 2 %#x\n",fFirstPartCut,fSecondPartCut); | |
302 | // this->Dump(); | |
303 | // fFirstPartCut->Dump(); | |
304 | ||
ea197c3e | 305 | b << fFirstPartCut; |
306 | b << fSecondPartCut; | |
307 | b << fNCuts; | |
308 | for (Int_t i = 0;i<fNCuts;i++) | |
88cb7938 | 309 | { |
310 | b << fCuts[i]; | |
311 | } | |
ea197c3e | 312 | b.SetByteCount(R__c, kTRUE); |
313 | } | |
1b446896 | 314 | } |
49d1e071 | 315 | /******************************************************************/ |
1b446896 | 316 | |
317 | ClassImp(AliHBTEmptyPairCut) | |
ea197c3e | 318 | |
1b446896 | 319 | void AliHBTEmptyPairCut::Streamer(TBuffer &b) |
ea197c3e | 320 | { |
88cb7938 | 321 | //streamer for empty pair cut |
ea197c3e | 322 | AliHBTPairCut::Streamer(b); |
323 | } | |
49d1e071 | 324 | /******************************************************************/ |
1b446896 | 325 | |
326 | ClassImp(AliHbtBasePairCut) | |
1b446896 | 327 | ClassImp(AliHBTQInvCut) |
bce80f3b | 328 | ClassImp(AliHBTKtCut) |
c6b93712 | 329 | ClassImp(AliHBTQSideCMSLCCut) |
330 | ClassImp(AliHBTQOutCMSLCCut) | |
331 | ClassImp(AliHBTQLongCMSLCCut) | |
9616170a | 332 | |
49d1e071 | 333 | /******************************************************************/ |
334 | ClassImp(AliHBTAvSeparationCut) | |
9616170a | 335 | |
336 | Double_t AliHBTAvSeparationCut::GetValue(AliHBTPair* pair) const | |
337 | { | |
087f87e7 | 338 | //checks if avarage distance of two tracks is in given range |
339 | return pair->GetAvarageDistance(); | |
9616170a | 340 | } |
49d1e071 | 341 | /******************************************************************/ |
9616170a | 342 | |
66d1d1a4 | 343 | ClassImp(AliHBTCluterOverlapCut) |
344 | ||
345 | Double_t AliHBTCluterOverlapCut::GetValue(AliHBTPair* pair) const | |
346 | { | |
347 | //Returns Cluter Overlap Factor | |
348 | //It ranges between -0.5 (in all padrows both tracks have cluters) | |
349 | // and 1 (in all padrows one track has cluter and second has not) | |
350 | // When Overlap Factor is 1 this pair of tracks in highly probable to be | |
351 | // splitted track: one particle that is recontructed twise | |
352 | ||
353 | AliHBTClusterMap* cm1 = pair->Particle1()->GetClusterMap(); | |
354 | if ( cm1 == 0x0) | |
355 | { | |
356 | Warning("GetValue","Track 1 does not have Cluster Map. Returning -0.5."); | |
357 | return -.5; | |
358 | } | |
359 | ||
360 | AliHBTClusterMap* cm2 = pair->Particle2()->GetClusterMap(); | |
361 | if ( cm2 == 0x0) | |
362 | { | |
363 | Warning("GetValue","Track 2 does not have Cluster Map. Returning -0.5."); | |
364 | return -.5; | |
365 | } | |
366 | return cm1->GetOverlapFactor(*cm2); | |
367 | } | |
49d1e071 | 368 | /******************************************************************/ |
369 | ||
370 | ClassImp( AliHBTLogicalOperPairCut ) | |
371 | ||
372 | AliHBTLogicalOperPairCut::AliHBTLogicalOperPairCut(): | |
373 | AliHbtBasePairCut(-10e10,10e10,kHbtPairCutPropNone), | |
374 | fFirst(new AliHBTDummyBasePairCut), | |
375 | fSecond(new AliHBTDummyBasePairCut) | |
376 | { | |
377 | //ctor | |
378 | } | |
379 | /******************************************************************/ | |
380 | ||
381 | AliHBTLogicalOperPairCut::AliHBTLogicalOperPairCut(AliHbtBasePairCut* first, AliHbtBasePairCut* second): | |
382 | AliHbtBasePairCut(-10e10,10e10,kHbtPairCutPropNone), | |
383 | fFirst((first)?(AliHbtBasePairCut*)first->Clone():0x0), | |
384 | fSecond((second)?(AliHbtBasePairCut*)second->Clone():0x0) | |
385 | { | |
386 | //ctor | |
387 | //note that base cuts are copied, not just pointers assigned | |
388 | if ( (fFirst && fSecond) == kFALSE) | |
389 | { | |
390 | Fatal("AliHBTLogicalOperPairCut","One of parameters is NULL!"); | |
391 | } | |
392 | } | |
393 | /******************************************************************/ | |
394 | ||
395 | AliHBTLogicalOperPairCut::~AliHBTLogicalOperPairCut() | |
396 | { | |
397 | //destructor | |
398 | delete fFirst; | |
399 | delete fSecond; | |
400 | } | |
401 | /******************************************************************/ | |
402 | ||
403 | Bool_t AliHBTLogicalOperPairCut::AliHBTDummyBasePairCut::Pass(AliHBTPair* /*pair*/) const | |
404 | { | |
405 | //checks if particles passes properties defined by this cut | |
406 | Warning("Pass","You are using dummy base cut! Probobly some logical cut is not set up properly"); | |
407 | return kFALSE;//accept | |
408 | } | |
409 | /******************************************************************/ | |
410 | ||
411 | void AliHBTLogicalOperPairCut::Streamer(TBuffer &b) | |
412 | { | |
413 | // Stream all objects in the array to or from the I/O buffer. | |
414 | UInt_t R__s, R__c; | |
415 | if (b.IsReading()) | |
416 | { | |
417 | delete fFirst; | |
418 | delete fSecond; | |
419 | fFirst = 0x0; | |
420 | fSecond = 0x0; | |
421 | ||
422 | b.ReadVersion(&R__s, &R__c); | |
423 | TObject::Streamer(b); | |
424 | b >> fFirst; | |
425 | b >> fSecond; | |
426 | b.CheckByteCount(R__s, R__c,AliHBTLogicalOperPairCut::IsA()); | |
427 | } | |
428 | else | |
429 | { | |
430 | R__c = b.WriteVersion(AliHBTLogicalOperPairCut::IsA(), kTRUE); | |
431 | TObject::Streamer(b); | |
432 | b << fFirst; | |
433 | b << fSecond; | |
434 | b.SetByteCount(R__c, kTRUE); | |
435 | } | |
436 | } | |
437 | ||
438 | /******************************************************************/ | |
439 | ClassImp(AliHBTOrPairCut) | |
440 | ||
441 | Bool_t AliHBTOrPairCut::Pass(AliHBTPair * p) const | |
442 | { | |
443 | //returns true when rejected | |
444 | //AND operation is a little bit misleading but is correct | |
445 | //User wants to build logical cuts with natural (positive) logic | |
446 | //while HBTAN use inernally reverse (returns true when rejected) | |
447 | if (fFirst->Pass(p) && fSecond->Pass(p) ) return kTRUE;//rejected (both rejected, returned kTRUE) | |
448 | return kFALSE;//accepted, at least one accepted (returned kFALSE) | |
449 | } | |
450 | /******************************************************************/ | |
451 | ||
452 | ClassImp(AliHBTAndPairCut) | |
453 | ||
454 | Bool_t AliHBTAndPairCut::Pass(AliHBTPair * p) const | |
455 | { | |
456 | //returns true when rejected | |
457 | //OR operation is a little bit misleading but is correct | |
458 | //User wants to build logical cuts with natural (positive) logic | |
459 | //while HBTAN use inernally reverse (returns true when rejected) | |
460 | if (fFirst->Pass(p) || fSecond->Pass(p)) return kTRUE;//rejected (any of two rejected(returned kTRUE) ) | |
461 | return kFALSE;//accepted (both accepted (returned kFALSE)) | |
462 | } | |
463 | /******************************************************************/ |