]>
Commit | Line | Data |
---|---|---|
073745bc | 1 | #include "AliAODPairCut.h" |
78d7c6d3 | 2 | /* $Id$ */ |
3 | //____________________________________ | |
4 | ///////////////////////////////////////////////////////////////////////// | |
5 | // | |
6 | // Class AliAODPairCut: | |
7 | // | |
8 | // implements cut on the pair of particles | |
9 | // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html | |
10 | // Author: Piotr.Skowronski@cern.ch | |
11 | //------------------------------------------------------------------- | |
78d7c6d3 | 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 | |
b4fb427e | 25 | fFirstPartCut = new AliAODParticleEmptyCut(); //empty cuts |
26 | fSecondPartCut= new AliAODParticleEmptyCut(); //empty cuts | |
78d7c6d3 | 27 | |
b4fb427e | 28 | fCuts = new AliAODPairBaseCut*[fgkMaxCuts]; |
78d7c6d3 | 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 | |
b4fb427e | 40 | fCuts = new AliAODPairBaseCut*[fgkMaxCuts]; |
78d7c6d3 | 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 | { | |
b4fb427e | 48 | fCuts[i] = (AliAODPairBaseCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it |
78d7c6d3 | 49 | } |
50 | } | |
51 | /**********************************************************/ | |
52 | ||
53 | AliAODPairCut& AliAODPairCut::operator=(const AliAODPairCut& in) | |
54 | { | |
55 | //assignment operator | |
b4fb427e | 56 | fCuts = new AliAODPairBaseCut*[fgkMaxCuts]; |
78d7c6d3 | 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 | { | |
b4fb427e | 64 | fCuts[i] = (AliAODPairBaseCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it |
78d7c6d3 | 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 | ||
b4fb427e | 88 | void AliAODPairCut::AddBasePairCut(AliAODPairBaseCut* basecut) |
78d7c6d3 | 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 | ||
cea0a066 | 102 | Bool_t AliAODPairCut::Rejected(AliAODPair* pair) const |
78d7c6d3 | 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 | |
cea0a066 | 114 | if( ( fFirstPartCut->Rejected( pair->Particle1()) ) || |
115 | ( fSecondPartCut->Rejected(pair->Particle2()) ) ) | |
78d7c6d3 | 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 | { | |
cea0a066 | 131 | if ( (fCuts[i]->Rejected(pair)) ) return kTRUE; //if one of the cuts reject, then reject |
78d7c6d3 | 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 | |
073745bc | 195 | AliAODQInvCut* cut= (AliAODQInvCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropQInv); |
78d7c6d3 | 196 | if(cut) cut->SetRange(min,max); |
197 | else fCuts[fNCuts++] = new AliAODQInvCut(min,max); | |
198 | } | |
199 | /**********************************************************/ | |
5c9d56e2 | 200 | |
e6375609 | 201 | void AliAODPairCut::SetQOutLCMSRange(Double_t min, Double_t max) |
78d7c6d3 | 202 | { |
203 | // set range of accepted QOut in CMS | |
073745bc | 204 | AliAODQOutLCMSCut* cut= (AliAODQOutLCMSCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropQOutLCMS); |
78d7c6d3 | 205 | if(cut) cut->SetRange(min,max); |
206 | else fCuts[fNCuts++] = new AliAODQOutLCMSCut(min,max); | |
207 | } | |
78d7c6d3 | 208 | /**********************************************************/ |
5c9d56e2 | 209 | |
e6375609 | 210 | void AliAODPairCut::SetQSideLCMSRange(Double_t min, Double_t max) |
78d7c6d3 | 211 | { |
212 | // set range of accepted QSide in CMS | |
073745bc | 213 | AliAODQSideLCMSCut* cut= (AliAODQSideLCMSCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropQSideLCMS); |
78d7c6d3 | 214 | if(cut) cut->SetRange(min,max); |
215 | else fCuts[fNCuts++] = new AliAODQSideLCMSCut(min,max); | |
216 | } | |
217 | ||
218 | /**********************************************************/ | |
5c9d56e2 | 219 | |
e6375609 | 220 | void AliAODPairCut::SetQLongLCMSRange(Double_t min, Double_t max) |
78d7c6d3 | 221 | { |
222 | // set range of accepted QLong in CMS | |
073745bc | 223 | AliAODQLongLCMSCut* cut= (AliAODQLongLCMSCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropQLongLCMS); |
78d7c6d3 | 224 | if(cut) cut->SetRange(min,max); |
225 | else fCuts[fNCuts++] = new AliAODQLongLCMSCut(min,max); | |
226 | } | |
5c9d56e2 | 227 | /**********************************************************/ |
78d7c6d3 | 228 | |
5c9d56e2 | 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 | } | |
78d7c6d3 | 245 | /**********************************************************/ |
246 | ||
247 | void AliAODPairCut::SetKtRange(Double_t min, Double_t max) | |
248 | { | |
5c9d56e2 | 249 | // set range of accepted Kt (avarage transverse pair momentum) |
073745bc | 250 | AliAODKtCut* cut= (AliAODKtCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropKt); |
78d7c6d3 | 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 | { | |
5c9d56e2 | 258 | // set range of accepted KStar (invariant pair momentum difference (fourvector)) |
073745bc | 259 | AliAODKStarCut* cut= (AliAODKStarCut*)FindCut(AliAODPairBaseCut::kHbtPairCutPropKStar); |
78d7c6d3 | 260 | if(cut) cut->SetRange(min,max); |
261 | else fCuts[fNCuts++] = new AliAODKStarCut(min,max); | |
262 | } | |
263 | /**********************************************************/ | |
264 | ||
265 | void AliAODPairCut::SetAvSeparationRange(Double_t min, Double_t max) | |
266 | { | |
267 | //sets avarage separation cut ->Anti-Merging cut | |
073745bc | 268 | AliAODPairBaseCut* cut= FindCut(AliAODPairBaseCut::kHbtPairCutPropAvSepar); |
78d7c6d3 | 269 | if(cut) cut->SetRange(min,max); |
270 | else fCuts[fNCuts++] = new AliAODAvSeparationCut(min,max); | |
271 | } | |
272 | /**********************************************************/ | |
273 | ||
274 | void AliAODPairCut::SetITSSeparation(Int_t layer, Double_t drphi, Double_t dz) | |
275 | { | |
276 | //Anti-Merging Cut for first pixel layer | |
073745bc | 277 | AliAODITSSeparationCut* cut= dynamic_cast<AliAODITSSeparationCut*>(FindCut(AliAODPairBaseCut::kHbtPairCutPropPixelSepar)); |
78d7c6d3 | 278 | if(cut) |
279 | { | |
280 | if (layer == cut->GetLayer()) | |
281 | { | |
282 | cut->SetRange(drphi,dz);//In this cut fMin is drphi, and fMax dz | |
283 | return; | |
284 | } | |
285 | } | |
286 | fCuts[fNCuts++] = new AliAODITSSeparationCut(layer,drphi,dz); | |
287 | // Info("SetITSSeparation","Added %d at address %#x",fNCuts-1,fCuts[fNCuts-1]); | |
288 | } | |
289 | /**********************************************************/ | |
290 | ||
291 | void AliAODPairCut::SetClusterOverlapRange(Double_t min,Double_t max) | |
292 | { | |
293 | //sets cluster overlap factor cut ->Anti-Splitting cut | |
294 | //cluster overlap factor ranges between | |
295 | // -0.5 (in all padrows both tracks have cluters) | |
296 | // and 1 (in all padrows one track has cluter and second has not) | |
297 | // When Overlap Factor is 1 this pair of tracks in highly probable to be | |
298 | // splitted track: one particle that is recontructed twise | |
299 | // STAR uses range from -0.5 to 0.6 | |
300 | ||
073745bc | 301 | AliAODPairBaseCut* cut= FindCut(AliAODPairBaseCut::kHbtPairCutPropClOverlap); |
78d7c6d3 | 302 | if(cut) cut->SetRange(min,max); |
303 | else fCuts[fNCuts++] = new AliAODCluterOverlapCut(min,max); | |
304 | } | |
305 | /**********************************************************/ | |
306 | ||
073745bc | 307 | AliAODPairBaseCut* AliAODPairCut::FindCut(AliAODPairBaseCut::EAODPairCutProperty property) |
78d7c6d3 | 308 | { |
309 | // Find the cut corresponding to "property" | |
310 | for (Int_t i = 0;i<fNCuts;i++) | |
311 | { | |
312 | if (fCuts[i]->GetProperty() == property) | |
313 | return fCuts[i]; //we found the cut we were searching for | |
314 | } | |
315 | ||
316 | return 0x0; //we did not found this cut | |
317 | ||
318 | } | |
319 | /**********************************************************/ | |
320 | ||
321 | void AliAODPairCut::Streamer(TBuffer &b) | |
322 | { | |
323 | // Stream all objects in the array to or from the I/O buffer. | |
324 | ||
325 | UInt_t R__s, R__c; | |
326 | if (b.IsReading()) | |
327 | { | |
328 | Version_t v = b.ReadVersion(&R__s, &R__c); | |
329 | if (v > -1) | |
330 | { | |
331 | delete fFirstPartCut; | |
332 | delete fSecondPartCut; | |
333 | fFirstPartCut = 0x0; | |
334 | fSecondPartCut = 0x0; | |
335 | TObject::Streamer(b); | |
336 | b >> fFirstPartCut; | |
337 | b >> fSecondPartCut; | |
338 | b >> fNCuts; | |
339 | for (Int_t i = 0;i<fNCuts;i++) | |
340 | { | |
341 | b >> fCuts[i]; | |
342 | } | |
343 | } | |
344 | b.CheckByteCount(R__s, R__c,AliAODPairCut::IsA()); | |
345 | } | |
346 | else | |
347 | { | |
348 | R__c = b.WriteVersion(AliAODPairCut::IsA(), kTRUE); | |
349 | TObject::Streamer(b); | |
350 | ||
351 | // printf("Streamer Cut 1 %#x Cut 2 %#x\n",fFirstPartCut,fSecondPartCut); | |
352 | // this->Dump(); | |
353 | // fFirstPartCut->Dump(); | |
354 | ||
355 | b << fFirstPartCut; | |
356 | b << fSecondPartCut; | |
357 | b << fNCuts; | |
358 | for (Int_t i = 0;i<fNCuts;i++) | |
359 | { | |
360 | b << fCuts[i]; | |
361 | } | |
362 | b.SetByteCount(R__c, kTRUE); | |
363 | } | |
364 | } | |
365 | /******************************************************************/ | |
366 | ||
b4fb427e | 367 | ClassImp(AliAODPairEmptyCut) |
78d7c6d3 | 368 | |
b4fb427e | 369 | void AliAODPairEmptyCut::Streamer(TBuffer &b) |
78d7c6d3 | 370 | { |
371 | //streamer for empty pair cut | |
372 | AliAODPairCut::Streamer(b); | |
373 | } | |
374 | /******************************************************************/ | |
375 |