]>
Commit | Line | Data |
---|---|---|
ea197c3e | 1 | /* $Id$ */ |
2 | ||
3 | //------------------------------------------------------------------- | |
4 | // Class AliHBTPairCut: | |
5 | // implements cut on the pair of particles | |
6 | // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html | |
7 | // Author: Piotr.Skowronski@cern.ch | |
8 | //------------------------------------------------------------------- | |
9 | ||
1b446896 | 10 | #include "AliHBTPairCut.h" |
11 | #include "AliHBTPair.h" | |
ea197c3e | 12 | #include "AliHBTParticleCut.h" |
1b446896 | 13 | |
14 | ClassImp(AliHBTPairCut) | |
ea197c3e | 15 | const Int_t AliHBTPairCut::fgkMaxCuts = 50; |
1b446896 | 16 | /**********************************************************/ |
17 | ||
e3131968 | 18 | AliHBTPairCut::AliHBTPairCut(): |
19 | fNCuts(0) | |
1b446896 | 20 | { |
ea197c3e | 21 | //constructor |
1b446896 | 22 | fFirstPartCut = new AliHBTEmptyParticleCut(); //empty cuts |
23 | fSecondPartCut= new AliHBTEmptyParticleCut(); //empty cuts | |
24 | ||
ea197c3e | 25 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; |
1b446896 | 26 | } |
27 | /**********************************************************/ | |
28 | ||
bed069a4 | 29 | AliHBTPairCut::AliHBTPairCut(const AliHBTPairCut& in): |
30 | TNamed(in) | |
1b446896 | 31 | { |
ea197c3e | 32 | //copy constructor |
33 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; | |
34 | fNCuts = in.fNCuts; | |
35 | ||
36 | fFirstPartCut = (AliHBTParticleCut*)in.fFirstPartCut->Clone(); | |
37 | fSecondPartCut = (AliHBTParticleCut*)in.fSecondPartCut->Clone(); | |
38 | ||
39 | for (Int_t i = 0;i<fNCuts;i++) | |
40 | { | |
41 | fCuts[i] = (AliHbtBasePairCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it | |
42 | } | |
43 | } | |
44 | /**********************************************************/ | |
45 | ||
46 | AliHBTPairCut& AliHBTPairCut::operator=(const AliHBTPairCut& in) | |
47 | { | |
48 | //assignment operator | |
49 | fCuts = new AliHbtBasePairCut*[fgkMaxCuts]; | |
50 | fNCuts = in.fNCuts; | |
1b446896 | 51 | |
ea197c3e | 52 | fFirstPartCut = (AliHBTParticleCut*)in.fFirstPartCut->Clone(); |
53 | fSecondPartCut = (AliHBTParticleCut*)in.fSecondPartCut->Clone(); | |
1b446896 | 54 | |
ea197c3e | 55 | for (Int_t i = 0;i<fNCuts;i++) |
56 | { | |
57 | fCuts[i] = (AliHbtBasePairCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it | |
58 | } | |
59 | return * this; | |
1b446896 | 60 | } |
61 | /**********************************************************/ | |
62 | ||
63 | AliHBTPairCut::~AliHBTPairCut() | |
64 | { | |
ea197c3e | 65 | //destructor |
e3131968 | 66 | if (fFirstPartCut != fSecondPartCut) |
ea197c3e | 67 | { |
68 | delete fSecondPartCut; | |
69 | } | |
e3131968 | 70 | delete fFirstPartCut; |
1b446896 | 71 | for (Int_t i = 0;i<fNCuts;i++) |
ea197c3e | 72 | { |
73 | delete fCuts[i]; | |
74 | } | |
1b446896 | 75 | delete []fCuts; |
76 | } | |
77 | /**********************************************************/ | |
78 | ||
79 | /**********************************************************/ | |
80 | ||
81 | void AliHBTPairCut::AddBasePairCut(AliHbtBasePairCut* basecut) | |
ea197c3e | 82 | { |
83 | //adds the base pair cut (cut on one value) | |
84 | ||
85 | if (!basecut) return; | |
86 | if( fNCuts == (fgkMaxCuts-1) ) | |
1b446896 | 87 | { |
88 | Warning("AddBasePairCut","Not enough place for another cut"); | |
89 | return; | |
90 | } | |
ea197c3e | 91 | fCuts[fNCuts++]=basecut; |
92 | } | |
1b446896 | 93 | /**********************************************************/ |
94 | ||
ea197c3e | 95 | Bool_t AliHBTPairCut::Pass(AliHBTPair* pair) const |
1b446896 | 96 | { |
ea197c3e | 97 | //methods which checks if given pair meets all criteria of the cut |
98 | //if it meets returns FALSE | |
99 | //if NOT returns TRUE | |
100 | if(!pair) | |
101 | { | |
102 | Warning("Pass","No Pasaran! We never accept NULL pointers"); | |
103 | return kTRUE; | |
104 | } | |
105 | ||
106 | //check particle's cuts | |
107 | if( ( fFirstPartCut->Pass( pair->Particle1()) ) || | |
108 | ( fSecondPartCut->Pass(pair->Particle2()) ) ) | |
109 | { | |
110 | return kTRUE; | |
111 | } | |
112 | return PassPairProp(pair); | |
48704f50 | 113 | } |
114 | /**********************************************************/ | |
115 | ||
ea197c3e | 116 | Bool_t AliHBTPairCut::PassPairProp(AliHBTPair* pair) const |
48704f50 | 117 | { |
ea197c3e | 118 | //methods which checks if given pair meets all criteria of the cut |
119 | //if it meets returns FALSE | |
120 | //if NOT returns TRUE | |
121 | //examine all base pair cuts | |
122 | for (Int_t i = 0;i<fNCuts;i++) | |
123 | { | |
124 | if ( (fCuts[i]->Pass(pair)) ) return kTRUE; //if one of the cuts reject, then reject | |
125 | } | |
126 | return kFALSE; | |
1b446896 | 127 | } |
128 | /**********************************************************/ | |
129 | ||
130 | void AliHBTPairCut::SetFirstPartCut(AliHBTParticleCut* cut) | |
131 | { | |
ea197c3e | 132 | // set cut for the first particle |
133 | if(!cut) | |
134 | { | |
135 | Error("SetFirstPartCut","argument is NULL"); | |
136 | return; | |
137 | } | |
138 | delete fFirstPartCut; | |
139 | fFirstPartCut = (AliHBTParticleCut*)cut->Clone(); | |
140 | ||
1b446896 | 141 | } |
142 | /**********************************************************/ | |
143 | ||
144 | void AliHBTPairCut::SetSecondPartCut(AliHBTParticleCut* cut) | |
145 | { | |
ea197c3e | 146 | // set cut for the second particle |
147 | if(!cut) | |
148 | { | |
149 | Error("SetSecondPartCut","argument is NULL"); | |
150 | return; | |
151 | } | |
152 | delete fSecondPartCut; | |
153 | fSecondPartCut = (AliHBTParticleCut*)cut->Clone(); | |
1b446896 | 154 | } |
155 | /**********************************************************/ | |
156 | ||
157 | void AliHBTPairCut::SetPartCut(AliHBTParticleCut* cut) | |
158 | { | |
ea197c3e | 159 | //sets the the same cut on both particles |
160 | if(!cut) | |
161 | { | |
162 | Error("SetFirstPartCut","argument is NULL"); | |
163 | return; | |
164 | } | |
165 | delete fFirstPartCut; | |
166 | fFirstPartCut = (AliHBTParticleCut*)cut->Clone(); | |
167 | ||
168 | delete fSecondPartCut; //even if null should not be harmful | |
169 | fSecondPartCut = fFirstPartCut; | |
1b446896 | 170 | } |
171 | /**********************************************************/ | |
172 | ||
173 | void AliHBTPairCut::SetQInvRange(Double_t min, Double_t max) | |
174 | { | |
ea197c3e | 175 | // set range of accepted invariant masses |
1b446896 | 176 | AliHBTQInvCut* cut= (AliHBTQInvCut*)FindCut(kHbtPairCutPropQInv); |
177 | if(cut) cut->SetRange(min,max); | |
178 | else fCuts[fNCuts++] = new AliHBTQInvCut(min,max); | |
a37908e0 | 179 | } |
180 | /**********************************************************/ | |
181 | void AliHBTPairCut::SetQOutCMSLRange(Double_t min, Double_t max) | |
182 | { | |
ea197c3e | 183 | // set range of accepted QOut in CMS |
a37908e0 | 184 | AliHBTQOutCMSLCCut* cut= (AliHBTQOutCMSLCCut*)FindCut(kHbtPairCutPropQOutCMSLC); |
185 | if(cut) cut->SetRange(min,max); | |
186 | else fCuts[fNCuts++] = new AliHBTQOutCMSLCCut(min,max); | |
187 | } | |
1b446896 | 188 | |
a37908e0 | 189 | /**********************************************************/ |
190 | void AliHBTPairCut::SetQSideCMSLRange(Double_t min, Double_t max) | |
191 | { | |
ea197c3e | 192 | // set range of accepted QSide in CMS |
a37908e0 | 193 | AliHBTQSideCMSLCCut* cut= (AliHBTQSideCMSLCCut*)FindCut(kHbtPairCutPropQSideCMSLC); |
194 | if(cut) cut->SetRange(min,max); | |
195 | else fCuts[fNCuts++] = new AliHBTQSideCMSLCCut(min,max); | |
1b446896 | 196 | } |
197 | ||
a37908e0 | 198 | /**********************************************************/ |
199 | void AliHBTPairCut::SetQLongCMSLRange(Double_t min, Double_t max) | |
200 | { | |
ea197c3e | 201 | // set range of accepted QLong in CMS |
a37908e0 | 202 | AliHBTQLongCMSLCCut* cut= (AliHBTQLongCMSLCCut*)FindCut(kHbtPairCutPropQLongCMSLC); |
203 | if(cut) cut->SetRange(min,max); | |
204 | else fCuts[fNCuts++] = new AliHBTQLongCMSLCCut(min,max); | |
205 | } | |
206 | ||
207 | /**********************************************************/ | |
208 | ||
bce80f3b | 209 | void AliHBTPairCut::SetKtRange(Double_t min, Double_t max) |
210 | { | |
ea197c3e | 211 | // set range of accepted Kt (?) |
bce80f3b | 212 | AliHBTKtCut* cut= (AliHBTKtCut*)FindCut(kHbtPairCutPropKt); |
213 | if(cut) cut->SetRange(min,max); | |
214 | else fCuts[fNCuts++] = new AliHBTKtCut(min,max); | |
215 | } | |
216 | /**********************************************************/ | |
217 | ||
e3131968 | 218 | void AliHBTPairCut::SetKStarRange(Double_t min, Double_t max) |
219 | { | |
ea197c3e | 220 | // set range of accepted KStar (?) |
e3131968 | 221 | AliHBTKStarCut* cut= (AliHBTKStarCut*)FindCut(kHbtPairCutPropKStar); |
222 | if(cut) cut->SetRange(min,max); | |
223 | else fCuts[fNCuts++] = new AliHBTKStarCut(min,max); | |
224 | } | |
225 | /**********************************************************/ | |
226 | ||
1b446896 | 227 | AliHbtBasePairCut* AliHBTPairCut::FindCut(AliHBTPairCutProperty property) |
228 | { | |
ea197c3e | 229 | // Find the cut corresponding to "property" |
230 | for (Int_t i = 0;i<fNCuts;i++) | |
231 | { | |
232 | if (fCuts[i]->GetProperty() == property) | |
233 | return fCuts[i]; //we found the cut we were searching for | |
234 | } | |
235 | ||
236 | return 0x0; //we did not found this cut | |
1b446896 | 237 | |
238 | } | |
239 | /**********************************************************/ | |
240 | ||
241 | void AliHBTPairCut::Streamer(TBuffer &b) | |
242 | { | |
e3131968 | 243 | // Stream all objects in the array to or from the I/O buffer. |
ea197c3e | 244 | |
245 | UInt_t R__s, R__c; | |
246 | if (b.IsReading()) | |
1b446896 | 247 | { |
248 | Version_t v = b.ReadVersion(&R__s, &R__c); | |
1b934a85 | 249 | if (v > -1) |
88cb7938 | 250 | { |
251 | delete fFirstPartCut; | |
252 | delete fSecondPartCut; | |
253 | fFirstPartCut = 0x0; | |
254 | fSecondPartCut = 0x0; | |
255 | TObject::Streamer(b); | |
256 | b >> fFirstPartCut; | |
257 | b >> fSecondPartCut; | |
258 | b >> fNCuts; | |
259 | for (Int_t i = 0;i<fNCuts;i++) | |
260 | { | |
261 | b >> fCuts[i]; | |
262 | } | |
1b934a85 | 263 | } |
ea197c3e | 264 | b.CheckByteCount(R__s, R__c,AliHBTPairCut::IsA()); |
1b446896 | 265 | } |
ea197c3e | 266 | else |
1b446896 | 267 | { |
ea197c3e | 268 | R__c = b.WriteVersion(AliHBTPairCut::IsA(), kTRUE); |
269 | TObject::Streamer(b); | |
270 | b << fFirstPartCut; | |
271 | b << fSecondPartCut; | |
272 | b << fNCuts; | |
273 | for (Int_t i = 0;i<fNCuts;i++) | |
88cb7938 | 274 | { |
275 | b << fCuts[i]; | |
276 | } | |
ea197c3e | 277 | b.SetByteCount(R__c, kTRUE); |
278 | } | |
1b446896 | 279 | } |
280 | ||
281 | ClassImp(AliHBTEmptyPairCut) | |
ea197c3e | 282 | |
1b446896 | 283 | void AliHBTEmptyPairCut::Streamer(TBuffer &b) |
ea197c3e | 284 | { |
88cb7938 | 285 | //streamer for empty pair cut |
ea197c3e | 286 | AliHBTPairCut::Streamer(b); |
287 | } | |
1b446896 | 288 | |
289 | ClassImp(AliHbtBasePairCut) | |
1b446896 | 290 | ClassImp(AliHBTQInvCut) |
bce80f3b | 291 | ClassImp(AliHBTKtCut) |
c6b93712 | 292 | ClassImp(AliHBTQSideCMSLCCut) |
293 | ClassImp(AliHBTQOutCMSLCCut) | |
294 | ClassImp(AliHBTQLongCMSLCCut) |