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