]>
Commit | Line | Data |
---|---|---|
1 | #include "AliAODPairCut.h" | |
2 | /* $Id$ */ | |
3 | //____________________________________ | |
4 | ///////////////////////////////////////////////////////////////////////// | |
5 | // | |
6 | // Class AliAODPairCut: | |
7 | // | |
8 | // implements cut on the pair of particles | |
9 | // more info: http://aliweb.cern.ch/people/skowron/analyzer/index.html | |
10 | // Author: Piotr.Skowronski@cern.ch | |
11 | //------------------------------------------------------------------- | |
12 | #include "AliAODPair.h" | |
13 | #include "AliAODParticleCut.h" | |
14 | #include "AliTrackPoints.h" | |
15 | #include "AliClusterMap.h" | |
16 | ||
17 | ClassImp(AliAODPairCut) | |
18 | const Int_t AliAODPairCut::fgkMaxCuts = 50; | |
19 | /**********************************************************/ | |
20 | ||
21 | AliAODPairCut::AliAODPairCut(): | |
22 | fNCuts(0) | |
23 | { | |
24 | //constructor | |
25 | fFirstPartCut = new AliAODParticleEmptyCut(); //empty cuts | |
26 | fSecondPartCut= new AliAODParticleEmptyCut(); //empty cuts | |
27 | ||
28 | fCuts = new AliAODPairBaseCut*[fgkMaxCuts]; | |
29 | for (Int_t i = 0;i<fNCuts;i++) | |
30 | { | |
31 | fCuts[i] = 0x0; | |
32 | } | |
33 | } | |
34 | /**********************************************************/ | |
35 | ||
36 | AliAODPairCut::AliAODPairCut(const AliAODPairCut& in): | |
37 | TNamed(in) | |
38 | { | |
39 | //copy constructor | |
40 | fCuts = new AliAODPairBaseCut*[fgkMaxCuts]; | |
41 | fNCuts = in.fNCuts; | |
42 | ||
43 | fFirstPartCut = (AliAODParticleCut*)in.fFirstPartCut->Clone(); | |
44 | fSecondPartCut = (AliAODParticleCut*)in.fSecondPartCut->Clone(); | |
45 | ||
46 | for (Int_t i = 0;i<fNCuts;i++) | |
47 | { | |
48 | fCuts[i] = (AliAODPairBaseCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it | |
49 | } | |
50 | } | |
51 | /**********************************************************/ | |
52 | ||
53 | AliAODPairCut& AliAODPairCut::operator=(const AliAODPairCut& in) | |
54 | { | |
55 | //assignment operator | |
56 | fCuts = new AliAODPairBaseCut*[fgkMaxCuts]; | |
57 | fNCuts = in.fNCuts; | |
58 | ||
59 | fFirstPartCut = (AliAODParticleCut*)in.fFirstPartCut->Clone(); | |
60 | fSecondPartCut = (AliAODParticleCut*)in.fSecondPartCut->Clone(); | |
61 | ||
62 | for (Int_t i = 0;i<fNCuts;i++) | |
63 | { | |
64 | fCuts[i] = (AliAODPairBaseCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it | |
65 | } | |
66 | return * this; | |
67 | } | |
68 | /**********************************************************/ | |
69 | ||
70 | AliAODPairCut::~AliAODPairCut() | |
71 | { | |
72 | //destructor | |
73 | if (fFirstPartCut != fSecondPartCut) | |
74 | { | |
75 | delete fSecondPartCut; | |
76 | } | |
77 | delete fFirstPartCut; | |
78 | for (Int_t i = 0;i<fNCuts;i++) | |
79 | { | |
80 | delete fCuts[i]; | |
81 | } | |
82 | delete []fCuts; | |
83 | } | |
84 | /**********************************************************/ | |
85 | ||
86 | /**********************************************************/ | |
87 | ||
88 | void AliAODPairCut::AddBasePairCut(AliAODPairBaseCut* basecut) | |
89 | { | |
90 | //adds the base pair cut (cut on one value) | |
91 | ||
92 | if (!basecut) return; | |
93 | if( fNCuts == (fgkMaxCuts-1) ) | |
94 | { | |
95 | Warning("AddBasePairCut","Not enough place for another cut"); | |
96 | return; | |
97 | } | |
98 | fCuts[fNCuts++]=basecut; | |
99 | } | |
100 | /**********************************************************/ | |
101 | ||
102 | Bool_t AliAODPairCut::Rejected(AliAODPair* pair) const | |
103 | { | |
104 | //methods which checks if given pair meets all criteria of the cut | |
105 | //if it meets returns FALSE | |
106 | //if NOT returns TRUE | |
107 | if(!pair) | |
108 | { | |
109 | Warning("Pass","No Pasaran! We never accept NULL pointers"); | |
110 | return kTRUE; | |
111 | } | |
112 | ||
113 | //check particle's cuts | |
114 | if( ( fFirstPartCut->Rejected( pair->Particle1()) ) || | |
115 | ( fSecondPartCut->Rejected(pair->Particle2()) ) ) | |
116 | { | |
117 | return kTRUE; | |
118 | } | |
119 | return PassPairProp(pair); | |
120 | } | |
121 | /**********************************************************/ | |
122 | ||
123 | Bool_t AliAODPairCut::PassPairProp(AliAODPair* pair) const | |
124 | { | |
125 | //methods which checks if given pair meets all criteria of the cut | |
126 | //if it meets returns FALSE | |
127 | //if NOT returns TRUE | |
128 | //examine all base pair cuts | |
129 | for (Int_t i = 0;i<fNCuts;i++) | |
130 | { | |
131 | if ( (fCuts[i]->Rejected(pair)) ) return kTRUE; //if one of the cuts reject, then reject | |
132 | } | |
133 | return kFALSE; | |
134 | } | |
135 | /**********************************************************/ | |
136 | ||
137 | void AliAODPairCut::Print() | |
138 | { | |
139 | //Prints the cut | |
140 | for (Int_t i = 0;i<fNCuts;i++) | |
141 | { | |
142 | fCuts[i]->Dump(); | |
143 | } | |
144 | } | |
145 | /**********************************************************/ | |
146 | ||
147 | void AliAODPairCut::SetFirstPartCut(AliAODParticleCut* cut) | |
148 | { | |
149 | // set cut for the first particle | |
150 | if(!cut) | |
151 | { | |
152 | Error("SetFirstPartCut","argument is NULL"); | |
153 | return; | |
154 | } | |
155 | delete fFirstPartCut; | |
156 | fFirstPartCut = (AliAODParticleCut*)cut->Clone(); | |
157 | ||
158 | } | |
159 | /**********************************************************/ | |
160 | ||
161 | void AliAODPairCut::SetSecondPartCut(AliAODParticleCut* cut) | |
162 | { | |
163 | // set cut for the second particle | |
164 | if(!cut) | |
165 | { | |
166 | Error("SetSecondPartCut","argument is NULL"); | |
167 | return; | |
168 | } | |
169 | delete fSecondPartCut; | |
170 | fSecondPartCut = (AliAODParticleCut*)cut->Clone(); | |
171 | } | |
172 | /**********************************************************/ | |
173 | ||
174 | void AliAODPairCut::SetPartCut(AliAODParticleCut* cut) | |
175 | { | |
176 | //sets the the same cut on both particles | |
177 | if(!cut) | |
178 | { | |
179 | Error("SetFirstPartCut","argument is NULL"); | |
180 | return; | |
181 | } | |
182 | if (fFirstPartCut == fSecondPartCut) fSecondPartCut = 0x0; | |
183 | ||
184 | delete fFirstPartCut; | |
185 | fFirstPartCut = (AliAODParticleCut*)cut->Clone(); | |
186 | ||
187 | delete fSecondPartCut; //even if null should not be harmful | |
188 | fSecondPartCut = fFirstPartCut; | |
189 | } | |
190 | /**********************************************************/ | |
191 | ||
192 | void AliAODPairCut::SetQInvRange(Double_t min, Double_t max) | |
193 | { | |
194 | // set range of accepted invariant masses | |
195 | AliAODQInvCut* cut= (AliAODQInvCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropQInv); | |
196 | if(cut) cut->SetRange(min,max); | |
197 | else fCuts[fNCuts++] = new AliAODQInvCut(min,max); | |
198 | } | |
199 | /**********************************************************/ | |
200 | ||
201 | void AliAODPairCut::SetQOutLCMSRange(Double_t min, Double_t max) | |
202 | { | |
203 | // set range of accepted QOut in CMS | |
204 | AliAODQOutLCMSCut* cut= (AliAODQOutLCMSCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropQOutLCMS); | |
205 | if(cut) cut->SetRange(min,max); | |
206 | else fCuts[fNCuts++] = new AliAODQOutLCMSCut(min,max); | |
207 | } | |
208 | /**********************************************************/ | |
209 | ||
210 | void AliAODPairCut::SetQSideLCMSRange(Double_t min, Double_t max) | |
211 | { | |
212 | // set range of accepted QSide in CMS | |
213 | AliAODQSideLCMSCut* cut= (AliAODQSideLCMSCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropQSideLCMS); | |
214 | if(cut) cut->SetRange(min,max); | |
215 | else fCuts[fNCuts++] = new AliAODQSideLCMSCut(min,max); | |
216 | } | |
217 | ||
218 | /**********************************************************/ | |
219 | ||
220 | void AliAODPairCut::SetQLongLCMSRange(Double_t min, Double_t max) | |
221 | { | |
222 | // set range of accepted QLong in CMS | |
223 | AliAODQLongLCMSCut* cut= (AliAODQLongLCMSCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropQLongLCMS); | |
224 | if(cut) cut->SetRange(min,max); | |
225 | else fCuts[fNCuts++] = new AliAODQLongLCMSCut(min,max); | |
226 | } | |
227 | /**********************************************************/ | |
228 | ||
229 | void AliAODPairCut::SetDeltaERange(Double_t min, Double_t max) | |
230 | { | |
231 | // set range of accepted DeltaE | |
232 | AliAODKtCut* cut= (AliAODKtCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropDeltaE); | |
233 | if(cut) cut->SetRange(min,max); | |
234 | else fCuts[fNCuts++] = new AliAODDeltaECut(min,max); | |
235 | } | |
236 | /**********************************************************/ | |
237 | ||
238 | void AliAODPairCut::SetDeltaPRange(Double_t min, Double_t max) | |
239 | { | |
240 | // set range of accepted DeltaP | |
241 | AliAODKtCut* cut= (AliAODKtCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropDeltaP); | |
242 | if(cut) cut->SetRange(min,max); | |
243 | else fCuts[fNCuts++] = new AliAODDeltaPCut(min,max); | |
244 | } | |
245 | /**********************************************************/ | |
246 | ||
247 | void AliAODPairCut::SetKtRange(Double_t min, Double_t max) | |
248 | { | |
249 | // set range of accepted Kt (avarage transverse pair momentum) | |
250 | AliAODKtCut* cut= (AliAODKtCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropKt); | |
251 | if(cut) cut->SetRange(min,max); | |
252 | else fCuts[fNCuts++] = new AliAODKtCut(min,max); | |
253 | } | |
254 | /**********************************************************/ | |
255 | ||
256 | void AliAODPairCut::SetKStarRange(Double_t min, Double_t max) | |
257 | { | |
258 | // set range of accepted KStar (invariant pair momentum difference (fourvector)) | |
259 | AliAODKStarCut* cut= (AliAODKStarCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropKStar); | |
260 | if(cut) cut->SetRange(min,max); | |
261 | else fCuts[fNCuts++] = new AliAODKStarCut(min,max); | |
262 | } | |
263 | /**********************************************************/ | |
264 | ||
265 | void AliAODPairCut::SetKStarOutRange(Double_t min, Double_t max) | |
266 | { | |
267 | // set range of accepted KStar (invariant pair momentum difference (fourvector)) | |
268 | AliAODKStarOutCut* cut= (AliAODKStarOutCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropKStarOut); | |
269 | if(cut) cut->SetRange(min,max); | |
270 | else fCuts[fNCuts++] = new AliAODKStarOutCut(min,max); | |
271 | } | |
272 | /**********************************************************/ | |
273 | ||
274 | void AliAODPairCut::SetKStarSideRange(Double_t min, Double_t max) | |
275 | { | |
276 | // set range of accepted KStar (invariant pair momentum difference (fourvector)) | |
277 | AliAODKStarSideCut* cut= (AliAODKStarSideCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropKStarSide); | |
278 | if(cut) cut->SetRange(min,max); | |
279 | else fCuts[fNCuts++] = new AliAODKStarSideCut(min,max); | |
280 | } | |
281 | /**********************************************************/ | |
282 | ||
283 | void AliAODPairCut::SetKStarLongRange(Double_t min, Double_t max) | |
284 | { | |
285 | // set range of accepted KStar (invariant pair momentum difference (fourvector)) | |
286 | AliAODKStarLongCut* cut= (AliAODKStarLongCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropKStarLong); | |
287 | if(cut) cut->SetRange(min,max); | |
288 | else fCuts[fNCuts++] = new AliAODKStarLongCut(min,max); | |
289 | } | |
290 | /**********************************************************/ | |
291 | ||
292 | void AliAODPairCut::SetAvSeparationRange(Double_t min, Double_t max) | |
293 | { | |
294 | //sets avarage separation cut ->Anti-Merging cut | |
295 | AliAODPairBaseCut* cut= FindCut(AliAODPairBaseCut::kHbtPairCutPropAvSepar); | |
296 | if(cut) cut->SetRange(min,max); | |
297 | else fCuts[fNCuts++] = new AliAODAvSeparationCut(min,max); | |
298 | } | |
299 | /**********************************************************/ | |
300 | ||
301 | void AliAODPairCut::SetITSSeparation(Int_t layer, Double_t drphi, Double_t dz) | |
302 | { | |
303 | //Anti-Merging Cut for first pixel layer | |
304 | AliAODITSSeparationCut* cut= dynamic_cast<AliAODITSSeparationCut*>(FindCut(AliAODPairBaseCut::kHbtPairCutPropPixelSepar)); | |
305 | if(cut) | |
306 | { | |
307 | if (layer == cut->GetLayer()) | |
308 | { | |
309 | cut->SetRange(drphi,dz);//In this cut fMin is drphi, and fMax dz | |
310 | return; | |
311 | } | |
312 | } | |
313 | fCuts[fNCuts++] = new AliAODITSSeparationCut(layer,drphi,dz); | |
314 | // Info("SetITSSeparation","Added %d at address %#x",fNCuts-1,fCuts[fNCuts-1]); | |
315 | } | |
316 | /**********************************************************/ | |
317 | ||
318 | void AliAODPairCut::SetClusterOverlapRange(Double_t min,Double_t max) | |
319 | { | |
320 | //sets cluster overlap factor cut ->Anti-Splitting cut | |
321 | //cluster overlap factor ranges between | |
322 | // -0.5 (in all padrows both tracks have cluters) | |
323 | // and 1 (in all padrows one track has cluter and second has not) | |
324 | // When Overlap Factor is 1 this pair of tracks in highly probable to be | |
325 | // splitted track: one particle that is recontructed twise | |
326 | // STAR uses range from -0.5 to 0.6 | |
327 | ||
328 | AliAODPairBaseCut* cut= FindCut(AliAODPairBaseCut::kHbtPairCutPropClOverlap); | |
329 | if(cut) cut->SetRange(min,max); | |
330 | else fCuts[fNCuts++] = new AliAODCluterOverlapCut(min,max); | |
331 | } | |
332 | /**********************************************************/ | |
333 | ||
334 | AliAODPairBaseCut* AliAODPairCut::FindCut(AliAODPairBaseCut::EAODPairCutProperty property) | |
335 | { | |
336 | // Find the cut corresponding to "property" | |
337 | for (Int_t i = 0;i<fNCuts;i++) | |
338 | { | |
339 | if (fCuts[i]->GetProperty() == property) | |
340 | return fCuts[i]; //we found the cut we were searching for | |
341 | } | |
342 | ||
343 | return 0x0; //we did not found this cut | |
344 | ||
345 | } | |
346 | /**********************************************************/ | |
347 | ||
348 | void AliAODPairCut::Streamer(TBuffer &b) | |
349 | { | |
350 | // Stream all objects in the array to or from the I/O buffer. | |
351 | ||
352 | UInt_t R__s, R__c; | |
353 | if (b.IsReading()) | |
354 | { | |
355 | Version_t v = b.ReadVersion(&R__s, &R__c); | |
356 | if (v > -1) | |
357 | { | |
358 | delete fFirstPartCut; | |
359 | delete fSecondPartCut; | |
360 | fFirstPartCut = 0x0; | |
361 | fSecondPartCut = 0x0; | |
362 | TObject::Streamer(b); | |
363 | b >> fFirstPartCut; | |
364 | b >> fSecondPartCut; | |
365 | b >> fNCuts; | |
366 | for (Int_t i = 0;i<fNCuts;i++) | |
367 | { | |
368 | b >> fCuts[i]; | |
369 | } | |
370 | } | |
371 | b.CheckByteCount(R__s, R__c,AliAODPairCut::IsA()); | |
372 | } | |
373 | else | |
374 | { | |
375 | R__c = b.WriteVersion(AliAODPairCut::IsA(), kTRUE); | |
376 | TObject::Streamer(b); | |
377 | ||
378 | // printf("Streamer Cut 1 %#x Cut 2 %#x\n",fFirstPartCut,fSecondPartCut); | |
379 | // this->Dump(); | |
380 | // fFirstPartCut->Dump(); | |
381 | ||
382 | b << fFirstPartCut; | |
383 | b << fSecondPartCut; | |
384 | b << fNCuts; | |
385 | for (Int_t i = 0;i<fNCuts;i++) | |
386 | { | |
387 | b << fCuts[i]; | |
388 | } | |
389 | b.SetByteCount(R__c, kTRUE); | |
390 | } | |
391 | } | |
392 | /******************************************************************/ | |
393 | ||
394 | ClassImp(AliAODPairEmptyCut) | |
395 | ||
396 | void AliAODPairEmptyCut::Streamer(TBuffer &b) | |
397 | { | |
398 | //streamer for empty pair cut | |
399 | AliAODPairCut::Streamer(b); | |
400 | } | |
401 | /******************************************************************/ | |
402 |