1 #include "AliAODPairCut.h"
3 //____________________________________
4 /////////////////////////////////////////////////////////////////////////
6 // Class AliAODPairCut:
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 //-------------------------------------------------------------------
12 #include "AliAODPair.h"
13 #include "AliAODParticleCut.h"
14 #include "AliTrackPoints.h"
15 #include "AliClusterMap.h"
17 ClassImp(AliAODPairCut)
18 const Int_t AliAODPairCut::fgkMaxCuts = 50;
19 /**********************************************************/
21 AliAODPairCut::AliAODPairCut():
25 fFirstPartCut = new AliAODParticleEmptyCut(); //empty cuts
26 fSecondPartCut= new AliAODParticleEmptyCut(); //empty cuts
28 fCuts = new AliAODPairBaseCut*[fgkMaxCuts];
29 for (Int_t i = 0;i<fNCuts;i++)
34 /**********************************************************/
36 AliAODPairCut::AliAODPairCut(const AliAODPairCut& in):
40 fCuts = new AliAODPairBaseCut*[fgkMaxCuts];
43 fFirstPartCut = (AliAODParticleCut*)in.fFirstPartCut->Clone();
44 fSecondPartCut = (AliAODParticleCut*)in.fSecondPartCut->Clone();
46 for (Int_t i = 0;i<fNCuts;i++)
48 fCuts[i] = (AliAODPairBaseCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it
51 /**********************************************************/
53 AliAODPairCut& AliAODPairCut::operator=(const AliAODPairCut& in)
56 fCuts = new AliAODPairBaseCut*[fgkMaxCuts];
59 fFirstPartCut = (AliAODParticleCut*)in.fFirstPartCut->Clone();
60 fSecondPartCut = (AliAODParticleCut*)in.fSecondPartCut->Clone();
62 for (Int_t i = 0;i<fNCuts;i++)
64 fCuts[i] = (AliAODPairBaseCut*)in.fCuts[i]->Clone();//create new object (clone) and rember pointer to it
68 /**********************************************************/
70 AliAODPairCut::~AliAODPairCut()
73 if (fFirstPartCut != fSecondPartCut)
75 delete fSecondPartCut;
78 for (Int_t i = 0;i<fNCuts;i++)
84 /**********************************************************/
86 /**********************************************************/
88 void AliAODPairCut::AddBasePairCut(AliAODPairBaseCut* basecut)
90 //adds the base pair cut (cut on one value)
93 if( fNCuts == (fgkMaxCuts-1) )
95 Warning("AddBasePairCut","Not enough place for another cut");
98 fCuts[fNCuts++]=basecut;
100 /**********************************************************/
102 Bool_t AliAODPairCut::Rejected(AliAODPair* pair) const
104 //methods which checks if given pair meets all criteria of the cut
105 //if it meets returns FALSE
106 //if NOT returns TRUE
109 Warning("Pass","No Pasaran! We never accept NULL pointers");
113 //check particle's cuts
114 if( ( fFirstPartCut->Rejected( pair->Particle1()) ) ||
115 ( fSecondPartCut->Rejected(pair->Particle2()) ) )
119 return PassPairProp(pair);
121 /**********************************************************/
123 Bool_t AliAODPairCut::PassPairProp(AliAODPair* pair) const
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++)
131 if ( (fCuts[i]->Rejected(pair)) ) return kTRUE; //if one of the cuts reject, then reject
135 /**********************************************************/
137 void AliAODPairCut::Print()
140 for (Int_t i = 0;i<fNCuts;i++)
145 /**********************************************************/
147 void AliAODPairCut::SetFirstPartCut(AliAODParticleCut* cut)
149 // set cut for the first particle
152 Error("SetFirstPartCut","argument is NULL");
155 delete fFirstPartCut;
156 fFirstPartCut = (AliAODParticleCut*)cut->Clone();
159 /**********************************************************/
161 void AliAODPairCut::SetSecondPartCut(AliAODParticleCut* cut)
163 // set cut for the second particle
166 Error("SetSecondPartCut","argument is NULL");
169 delete fSecondPartCut;
170 fSecondPartCut = (AliAODParticleCut*)cut->Clone();
172 /**********************************************************/
174 void AliAODPairCut::SetPartCut(AliAODParticleCut* cut)
176 //sets the the same cut on both particles
179 Error("SetFirstPartCut","argument is NULL");
182 if (fFirstPartCut == fSecondPartCut) fSecondPartCut = 0x0;
184 delete fFirstPartCut;
185 fFirstPartCut = (AliAODParticleCut*)cut->Clone();
187 delete fSecondPartCut; //even if null should not be harmful
188 fSecondPartCut = fFirstPartCut;
190 /**********************************************************/
192 void AliAODPairCut::SetQInvRange(Double_t min, Double_t max)
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);
199 /**********************************************************/
201 void AliAODPairCut::SetQOutLCMSRange(Double_t min, Double_t max)
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);
208 /**********************************************************/
210 void AliAODPairCut::SetQSideLCMSRange(Double_t min, Double_t max)
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);
218 /**********************************************************/
220 void AliAODPairCut::SetQLongLCMSRange(Double_t min, Double_t max)
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);
227 /**********************************************************/
229 void AliAODPairCut::SetDeltaERange(Double_t min, Double_t max)
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);
236 /**********************************************************/
238 void AliAODPairCut::SetDeltaPRange(Double_t min, Double_t max)
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);
245 /**********************************************************/
247 void AliAODPairCut::SetKtRange(Double_t min, Double_t max)
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);
254 /**********************************************************/
256 void AliAODPairCut::SetKStarRange(Double_t min, Double_t max)
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);
263 /**********************************************************/
265 void AliAODPairCut::SetAvSeparationRange(Double_t min, Double_t max)
267 //sets avarage separation cut ->Anti-Merging cut
268 AliAODPairBaseCut* cut= FindCut(AliAODPairBaseCut::kHbtPairCutPropAvSepar);
269 if(cut) cut->SetRange(min,max);
270 else fCuts[fNCuts++] = new AliAODAvSeparationCut(min,max);
272 /**********************************************************/
274 void AliAODPairCut::SetITSSeparation(Int_t layer, Double_t drphi, Double_t dz)
276 //Anti-Merging Cut for first pixel layer
277 AliAODITSSeparationCut* cut= dynamic_cast<AliAODITSSeparationCut*>(FindCut(AliAODPairBaseCut::kHbtPairCutPropPixelSepar));
280 if (layer == cut->GetLayer())
282 cut->SetRange(drphi,dz);//In this cut fMin is drphi, and fMax dz
286 fCuts[fNCuts++] = new AliAODITSSeparationCut(layer,drphi,dz);
287 // Info("SetITSSeparation","Added %d at address %#x",fNCuts-1,fCuts[fNCuts-1]);
289 /**********************************************************/
291 void AliAODPairCut::SetClusterOverlapRange(Double_t min,Double_t max)
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
301 AliAODPairBaseCut* cut= FindCut(AliAODPairBaseCut::kHbtPairCutPropClOverlap);
302 if(cut) cut->SetRange(min,max);
303 else fCuts[fNCuts++] = new AliAODCluterOverlapCut(min,max);
305 /**********************************************************/
307 AliAODPairBaseCut* AliAODPairCut::FindCut(AliAODPairBaseCut::EAODPairCutProperty property)
309 // Find the cut corresponding to "property"
310 for (Int_t i = 0;i<fNCuts;i++)
312 if (fCuts[i]->GetProperty() == property)
313 return fCuts[i]; //we found the cut we were searching for
316 return 0x0; //we did not found this cut
319 /**********************************************************/
321 void AliAODPairCut::Streamer(TBuffer &b)
323 // Stream all objects in the array to or from the I/O buffer.
328 Version_t v = b.ReadVersion(&R__s, &R__c);
331 delete fFirstPartCut;
332 delete fSecondPartCut;
334 fSecondPartCut = 0x0;
335 TObject::Streamer(b);
339 for (Int_t i = 0;i<fNCuts;i++)
344 b.CheckByteCount(R__s, R__c,AliAODPairCut::IsA());
348 R__c = b.WriteVersion(AliAODPairCut::IsA(), kTRUE);
349 TObject::Streamer(b);
351 // printf("Streamer Cut 1 %#x Cut 2 %#x\n",fFirstPartCut,fSecondPartCut);
353 // fFirstPartCut->Dump();
358 for (Int_t i = 0;i<fNCuts;i++)
362 b.SetByteCount(R__c, kTRUE);
365 /******************************************************************/
367 ClassImp(AliAODPairEmptyCut)
369 void AliAODPairEmptyCut::Streamer(TBuffer &b)
371 //streamer for empty pair cut
372 AliAODPairCut::Streamer(b);
374 /******************************************************************/