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