Overwriting some previous changes by JFGO.... ops! Now fixed.
[u/mrichter/AliRoot.git] / CORRFW / AliCFParticleGenCuts.cxx
CommitLineData
563113d0 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16////////////////////////////////////////////////////////////////////////////
17// ---- CORRECTION FRAMEWORK ----
18// class AliCFParticleGenCuts implementation
19// Using this class a user may define selections relative to
20// MC particle (AliMCParticle) using generation-level information.
21////////////////////////////////////////////////////////////////////////////
22// author : R. Vernet (renaud.vernet@cern.ch)
23////////////////////////////////////////////////////////////////////////////
24
25#include "AliLog.h"
26#include "AliCFParticleGenCuts.h"
27#include "TParticle.h"
28#include "TParticlePDG.h"
563113d0 29#include "AliMCEvent.h"
30#include "TObject.h"
31#include "AliStack.h"
107a3100 32#include "TH1F.h"
33#include "TH2F.h"
34#include "TBits.h"
35#include "TList.h"
563113d0 36
37ClassImp(AliCFParticleGenCuts)
38
39//______________________________
40AliCFParticleGenCuts::AliCFParticleGenCuts() :
41 AliCFCutBase(),
42 fMCInfo(0x0),
43 fRequireIsCharged(0),
107a3100 44 fRequireIsNeutral(0),
563113d0 45 fRequireIsPrimary(0),
46 fRequireIsSecondary(0),
47 fRequirePdgCode(0),
48 fPdgCode(0),
49 fProdVtxXMin (-1.e+09),
50 fProdVtxYMin (-1.e+09),
51 fProdVtxZMin (-1.e+09),
52 fProdVtxXMax ( 1.e+09),
53 fProdVtxYMax ( 1.e+09),
54 fProdVtxZMax ( 1.e+09),
55 fDecayVtxXMin(-1.e+09),
56 fDecayVtxYMin(-1.e+09),
57 fDecayVtxZMin(-1.e+09),
58 fDecayVtxXMax( 1.e+09),
59 fDecayVtxYMax( 1.e+09),
60 fDecayVtxZMax( 1.e+09),
107a3100 61 fDecayLengthMin(-1.),
563113d0 62 fDecayLengthMax(1.e+09),
107a3100 63 fDecayRxyMin(-1),
64 fDecayRxyMax(1.e+09),
65 fhCutStatistics(0x0),
66 fhCutCorrelation(0x0),
67 fBitmap(new TBits(0))
563113d0 68{
69 //
70 //ctor
71 //
107a3100 72 for (int i=0; i<kNCuts; i++)
73 for (int j=0; j<kNStepQA; j++)
74 fhQA[i][j]=0x0;
563113d0 75}
76
77//______________________________
78AliCFParticleGenCuts::AliCFParticleGenCuts(const Char_t* name, const Char_t* title) :
79 AliCFCutBase(name,title),
80 fMCInfo(0x0),
81 fRequireIsCharged(0),
107a3100 82 fRequireIsNeutral(0),
563113d0 83 fRequireIsPrimary(0),
84 fRequireIsSecondary(0),
85 fRequirePdgCode(0),
86 fPdgCode(0),
87 fProdVtxXMin (-1.e+09),
88 fProdVtxYMin (-1.e+09),
89 fProdVtxZMin (-1.e+09),
90 fProdVtxXMax ( 1.e+09),
91 fProdVtxYMax ( 1.e+09),
92 fProdVtxZMax ( 1.e+09),
93 fDecayVtxXMin(-1.e+09),
94 fDecayVtxYMin(-1.e+09),
95 fDecayVtxZMin(-1.e+09),
96 fDecayVtxXMax( 1.e+09),
97 fDecayVtxYMax( 1.e+09),
98 fDecayVtxZMax( 1.e+09),
107a3100 99 fDecayLengthMin(-1.),
563113d0 100 fDecayLengthMax(1.e+09),
107a3100 101 fDecayRxyMin(-1.),
102 fDecayRxyMax(1.e+09),
103 fhCutStatistics(0x0),
104 fhCutCorrelation(0x0),
105 fBitmap(new TBits(0))
563113d0 106{
107 //
108 //ctor
109 //
107a3100 110 for (int i=0; i<kNCuts; i++)
111 for (int j=0; j<kNStepQA; j++)
112 fhQA[i][j]=0x0;
563113d0 113}
114
115//______________________________
116AliCFParticleGenCuts::AliCFParticleGenCuts(const AliCFParticleGenCuts& c) :
117 AliCFCutBase(c),
118 fMCInfo(c.fMCInfo),
119 fRequireIsCharged(c.fRequireIsCharged),
107a3100 120 fRequireIsNeutral(c.fRequireIsNeutral),
563113d0 121 fRequireIsPrimary(c.fRequireIsPrimary),
122 fRequireIsSecondary(c.fRequireIsSecondary),
123 fRequirePdgCode(c.fRequirePdgCode),
124 fPdgCode(c.fPdgCode),
125 fProdVtxXMin (c.fProdVtxXMin),
126 fProdVtxYMin (c.fProdVtxYMin),
127 fProdVtxZMin (c.fProdVtxZMin),
128 fProdVtxXMax (c.fProdVtxXMax),
129 fProdVtxYMax (c.fProdVtxYMax),
130 fProdVtxZMax (c.fProdVtxZMax),
131 fDecayVtxXMin(c.fDecayVtxXMin),
132 fDecayVtxYMin(c.fDecayVtxYMin),
133 fDecayVtxZMin(c.fDecayVtxZMin),
134 fDecayVtxXMax(c.fDecayVtxXMax),
135 fDecayVtxYMax(c.fDecayVtxYMax),
136 fDecayVtxZMax(c.fDecayVtxZMax),
137 fDecayLengthMin(c.fDecayLengthMin),
138 fDecayLengthMax(c.fDecayLengthMin),
139 fDecayRxyMin(c.fDecayLengthMin),
107a3100 140 fDecayRxyMax(c.fDecayLengthMin),
141 fhCutStatistics(new TH1F(*c.fhCutStatistics)),
142 fhCutCorrelation(new TH2F(*c.fhCutCorrelation)),
143 fBitmap(new TBits(*c.fBitmap))
563113d0 144{
145 //
146 //copy ctor
147 //
107a3100 148 if (c.fhCutStatistics) fhCutStatistics = new TH1F(*c.fhCutStatistics) ;
149 if (c.fhCutCorrelation) fhCutCorrelation = new TH2F(*c.fhCutCorrelation) ;
150
151 for (int i=0; i<kNCuts; i++)
152 for (int j=0; j<kNStepQA; j++)
153 fhQA[i][j]=(TH1F*)c.fhQA[i][j]->Clone();
563113d0 154}
155
156//______________________________
157AliCFParticleGenCuts& AliCFParticleGenCuts::operator=(const AliCFParticleGenCuts& c)
158{
159 //
160 // Assignment operator
161 //
162 if (this != &c) {
163 AliCFCutBase::operator=(c) ;
164 fMCInfo=c.fMCInfo;
165 fRequireIsCharged=c.fRequireIsCharged;
107a3100 166 fRequireIsNeutral=c.fRequireIsNeutral;
563113d0 167 fRequireIsPrimary=c.fRequireIsPrimary;
168 fRequireIsSecondary=c.fRequireIsSecondary;
169 fRequirePdgCode=c.fRequirePdgCode;
170 fPdgCode=c.fPdgCode;
171 fProdVtxXMin=c.fProdVtxXMin;
172 fProdVtxYMin=c.fProdVtxYMin;
173 fProdVtxZMin=c.fProdVtxZMin;
174 fProdVtxXMax=c.fProdVtxXMax;
175 fProdVtxYMax=c.fProdVtxYMax;
176 fProdVtxZMax=c.fProdVtxZMax;
177 fDecayVtxXMin=c.fDecayVtxXMin;
178 fDecayVtxYMin=c.fDecayVtxYMin;
179 fDecayVtxZMin=c.fDecayVtxZMin;
180 fDecayVtxXMax=c.fDecayVtxXMax;
181 fDecayVtxYMax=c.fDecayVtxYMax;
182 fDecayVtxZMax=c.fDecayVtxZMax;
183 fDecayLengthMin=c.fDecayVtxZMax;
184 fDecayLengthMax=c.fDecayLengthMax;
185 fDecayRxyMin=c.fDecayRxyMin;
186 fDecayRxyMax=c.fDecayRxyMax;
107a3100 187 fBitmap=new TBits(*c.fBitmap);
188
189 if (fhCutStatistics) fhCutStatistics =new TH1F(*c.fhCutStatistics) ;
190 if (fhCutCorrelation) fhCutCorrelation=new TH2F(*c.fhCutCorrelation);
191
192 for (int i=0; i<kNCuts; i++)
193 for (int j=0; j<kNStepQA; j++)
194 fhQA[i][j]=(TH1F*)c.fhQA[i][j]->Clone();
563113d0 195 }
196 return *this ;
197}
198
199//______________________________
200Bool_t AliCFParticleGenCuts::IsSelected(TObject* obj) {
201 //
202 // check if selections on 'obj' are passed
203 // 'obj' must be an AliMCParticle
204 //
205
107a3100 206 SelectionBitMap(obj);
207
208 if (fIsQAOn) FillHistograms(obj,0);
209
210 for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++)
211 if (!fBitmap->TestBitNumber(icut)) return kFALSE ;
212
213 if (fIsQAOn) FillHistograms(obj,1);
214 return kTRUE;
215}
216
217//__________________________________________________________________________________
218void AliCFParticleGenCuts::SelectionBitMap(TObject* obj)
219{
220 //
221 // test if the track passes the single cuts
222 // and store the information in a bitmap
223 //
224
225 for (UInt_t i=0; i<kNCuts; i++) fBitmap->SetBitNumber(i,kFALSE);
226
227 if (!obj) return ;
563113d0 228 TString className(obj->ClassName());
229 if (className.CompareTo("AliMCParticle") != 0) {
230 AliError("argument must point to an AliMCParticle !");
107a3100 231 return ;
563113d0 232 }
233
234 AliMCParticle* mcPart = (AliMCParticle*) obj ;
235 TParticle* part = mcPart->Particle();
107a3100 236 AliStack* stack = fMCInfo->Stack();
563113d0 237
107a3100 238 Double32_t partVx=(Double32_t)part->Vx();
239 Double32_t partVy=(Double32_t)part->Vy();
240 Double32_t partVz=(Double32_t)part->Vz();
241
242 TParticle* daughter=0x0;
243 Double32_t decayVx=0.;
244 Double32_t decayVy=0.;
245 Double32_t decayVz=0.;
246 Double32_t decayL=0.;
247 Double32_t decayRxy=0.;
248
249 if ( part->GetNDaughters() > 0 ) {
250 daughter = stack->Particle(part->GetFirstDaughter()) ;
251 decayVx=(Double32_t)daughter->Vx();
252 decayVy=(Double32_t)daughter->Vy();
253 decayVz=(Double32_t)daughter->Vz();
254 decayL = TMath::Sqrt(TMath::Power(partVx-decayVx,2) +
255 TMath::Power(partVy-decayVy,2) +
256 TMath::Power(partVz-decayVz,2) ) ;
257 decayRxy = TMath::Sqrt(TMath::Power(decayVx,2) + TMath::Power(decayVy,2) ) ;
258 }
259
260
261 Int_t iCutBit = 0;
262
263 // cut on charge
264 if ( fRequireIsCharged || fRequireIsNeutral ) {
265 if(fRequireIsCharged && IsCharged(mcPart)) fBitmap->SetBitNumber(iCutBit,kTRUE);
266 if(fRequireIsNeutral && !IsCharged(mcPart)) fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 267 }
107a3100 268 else fBitmap->SetBitNumber(iCutBit,kTRUE);
269 iCutBit++;
563113d0 270
107a3100 271 // cut on primary/secondary
272 if ( fRequireIsPrimary || fRequireIsSecondary) {
273 if (fRequireIsPrimary && IsPrimary(mcPart,stack)) fBitmap->SetBitNumber(iCutBit,kTRUE);
274 if (fRequireIsSecondary && !IsPrimary(mcPart,stack)) fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 275 }
107a3100 276 else fBitmap->SetBitNumber(iCutBit,kTRUE);
277 iCutBit++;
563113d0 278
107a3100 279 // cut on PDG code
280 if ( fRequirePdgCode ){
281 if (IsA(mcPart,fPdgCode,kTRUE)) fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 282 }
107a3100 283 else fBitmap->SetBitNumber(iCutBit,kTRUE);
284 iCutBit++;
285
563113d0 286 // production vertex cuts
107a3100 287 if ( partVx > fProdVtxXMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
288 iCutBit++;
289 if ( partVx < fProdVtxXMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
290 iCutBit++;
291 if ( partVy > fProdVtxYMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
292 iCutBit++;
293 if ( partVy < fProdVtxYMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
294 iCutBit++;
295 if ( partVz > fProdVtxZMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
296 iCutBit++;
297 if ( partVz < fProdVtxZMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
298 iCutBit++;
299
300 // decay vertex cuts
301 if ( decayVx > fDecayVtxXMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
302 iCutBit++;
303 if ( decayVx < fDecayVtxXMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
304 iCutBit++;
305 if ( decayVy > fDecayVtxYMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
306 iCutBit++;
307 if ( decayVy < fDecayVtxYMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
308 iCutBit++;
309 if ( decayVz > fDecayVtxZMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
310 iCutBit++;
311 if ( decayVz < fDecayVtxZMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
312 iCutBit++;
563113d0 313
107a3100 314 // decay length cuts
315 if ( decayL > fDecayLengthMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
316 iCutBit++;
317 if ( decayL < fDecayLengthMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
318 iCutBit++;
319
320 // transverse decay length cuts
321 if ( decayRxy > fDecayRxyMin ) fBitmap->SetBitNumber(iCutBit,kTRUE);
322 iCutBit++;
323 if ( decayRxy < fDecayRxyMax ) fBitmap->SetBitNumber(iCutBit,kTRUE);
324
325}
326
327//__________________________________________________________________________________
328void AliCFParticleGenCuts::FillHistograms(TObject* obj, Bool_t afterCuts)
329{
330 //
331 // fill the QA histograms
332 //
333
334 for (int iCutNumber = 0; iCutNumber < kNCuts; iCutNumber++)
335 fhQA[iCutNumber][afterCuts]->Fill(fBitmap->TestBitNumber(iCutNumber));
336
337 // fill cut statistics and cut correlation histograms with information from the bitmap
338 if (afterCuts) return;
339
340 // Number of single cuts in this class
341 UInt_t ncuts = fBitmap->GetNbits();
342 for(UInt_t bit=0; bit<ncuts;bit++) {
343 if (!fBitmap->TestBitNumber(bit)) {
344 fhCutStatistics->Fill(bit+1);
345 for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
346 if (!fBitmap->TestBitNumber(bit2))
347 fhCutCorrelation->Fill(bit+1,bit2+1);
348 }
349 }
563113d0 350 }
107a3100 351}
352
353//__________________________________________________________________________________
354void AliCFParticleGenCuts::AddQAHistograms(TList *qaList) {
355 //
356 // saves the histograms in a TList
357 //
563113d0 358
107a3100 359 DefineHistograms();
563113d0 360
107a3100 361 qaList->Add(fhCutStatistics);
362 qaList->Add(fhCutCorrelation);
363
364 for (Int_t j=0; j<kNStepQA; j++) {
365 for(Int_t i=0; i<kNCuts; i++)
366 qaList->Add(fhQA[i][j]);
367 }
368}
369
370//__________________________________________________________________________________
371void AliCFParticleGenCuts::DefineHistograms() {
372 //
373 // histograms for cut variables, cut statistics and cut correlations
374 //
375 Int_t color = 2;
376
377 // book cut statistics and cut correlation histograms
378 fhCutStatistics = new TH1F(Form("%s_cut_statistics",GetName()),"",kNCuts,0.5,kNCuts+0.5);
379 fhCutStatistics->SetLineWidth(2);
380 int k = 1;
381 fhCutStatistics->GetXaxis()->SetBinLabel(k,"charge") ; k++;
382 fhCutStatistics->GetXaxis()->SetBinLabel(k,"prim/sec") ; k++;
383 fhCutStatistics->GetXaxis()->SetBinLabel(k,"PDG") ; k++;
384 fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxXMin") ; k++;
385 fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxXMax") ; k++;
386 fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxYMin") ; k++;
387 fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxYMax") ; k++;
388 fhCutStatistics->GetXaxis()->SetBinLabel(k,"VtxZMin") ; k++;
389 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecZMax") ; k++;
390 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecXMin") ; k++;
391 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecXMax") ; k++;
392 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecYMin") ; k++;
393 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecYMax") ; k++;
394 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecZMin") ; k++;
395 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecZMax") ; k++;
396 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecLgthMin") ; k++;
397 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecLgthMax") ; k++;
398 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecRxyMin") ; k++;
399 fhCutStatistics->GetXaxis()->SetBinLabel(k,"DecRxyMax") ; k++;
400
401
402 fhCutCorrelation = new TH2F(Form("%s_cut_correlation",GetName()),"",kNCuts,0.5,kNCuts+0.5,kNCuts,0.5,kNCuts+0.5);
403 fhCutCorrelation->SetLineWidth(2);
404 for (k=1; k<=kNCuts; k++) {
405 fhCutCorrelation->GetXaxis()->SetBinLabel(k,fhCutStatistics->GetXaxis()->GetBinLabel(k));
406 fhCutCorrelation->GetYaxis()->SetBinLabel(k,fhCutStatistics->GetXaxis()->GetBinLabel(k));
407 }
408
409 Char_t str[256];
410 for (int i=0; i<kNStepQA; i++) {
411 if (i==0) sprintf(str," ");
412 else sprintf(str,"_cut");
413 fhQA[kCutCharge] [i] = new TH1F(Form("%s_charge%s" ,GetName(),str),"",2,-0.5,1.5);
414 fhQA[kCutPrimSec] [i] = new TH1F(Form("%s_primSec%s" ,GetName(),str),"",2,-0.5,1.5);
415 fhQA[kCutPDGCode] [i] = new TH1F(Form("%s_pdgCode%s" ,GetName(),str),"",10000,-5000,5000);
416 fhQA[kCutProdVtxXMin][i] = new TH1F(Form("%s_prodVtxXMin%s" ,GetName(),str),"",100,0,10);
417 fhQA[kCutProdVtxXMax][i] = new TH1F(Form("%s_prodVtxXMax%s" ,GetName(),str),"",100,0,10);
418 fhQA[kCutProdVtxYMin][i] = new TH1F(Form("%s_prodVtxYMin%s" ,GetName(),str),"",100,0,10);
419 fhQA[kCutProdVtxYMax][i] = new TH1F(Form("%s_prodVtxYMax%s" ,GetName(),str),"",100,0,10);
420 fhQA[kCutProdVtxZMin][i] = new TH1F(Form("%s_prodVtxZMin%s" ,GetName(),str),"",100,0,10);
421 fhQA[kCutProdVtxZMax][i] = new TH1F(Form("%s_prodVtxZMax%s" ,GetName(),str),"",100,0,10);
422 fhQA[kCutDecVtxXMin] [i] = new TH1F(Form("%s_decVtxXMin%s" ,GetName(),str),"",100,0,10);
423 fhQA[kCutDecVtxXMax] [i] = new TH1F(Form("%s_decVtxXMax%s" ,GetName(),str),"",100,0,10);
424 fhQA[kCutDecVtxYMin] [i] = new TH1F(Form("%s_decVtxYMin%s" ,GetName(),str),"",100,0,10);
425 fhQA[kCutDecVtxYMax] [i] = new TH1F(Form("%s_decVtxYMax%s" ,GetName(),str),"",100,0,10);
426 fhQA[kCutDecVtxZMin] [i] = new TH1F(Form("%s_decVtxZMin%s" ,GetName(),str),"",100,0,10);
427 fhQA[kCutDecVtxZMax] [i] = new TH1F(Form("%s_decVtxZMax%s" ,GetName(),str),"",100,0,10);
428 fhQA[kCutDecLgthMin] [i] = new TH1F(Form("%s_decLengthMin%s",GetName(),str),"",100,0,10);
429 fhQA[kCutDecLgthMax] [i] = new TH1F(Form("%s_decLengthMax%s",GetName(),str),"",100,0,10);
430 fhQA[kCutDecRxyMin] [i] = new TH1F(Form("%s_decRxyMin%s" ,GetName(),str),"",100,0,10);
431 fhQA[kCutDecRxyMax] [i] = new TH1F(Form("%s_decRxyMax%s" ,GetName(),str),"",100,0,10);
432 }
433 for(Int_t i=0; i<kNCuts; i++) fhQA[i][1]->SetLineColor(color);
563113d0 434}
107a3100 435
436
563113d0 437//______________________________
438Bool_t AliCFParticleGenCuts::IsCharged(AliMCParticle *mcPart) {
439 //
440 //check if particle is charged.
441 //
442 TParticle* part = mcPart->Particle();
443 TParticlePDG* pdgPart = part->GetPDG();
444 if(!pdgPart)return kFALSE;
445 if (pdgPart->Charge() == 0) return kFALSE;
446 return kTRUE;
447}
448//______________________________
449Bool_t AliCFParticleGenCuts::IsPrimary(AliMCParticle *mcPart, AliStack *stack) {
450 //
451 //check if particle is primary (standard definition)
452 //
453 if (!stack->IsPhysicalPrimary(mcPart->Label())) return kFALSE ;
454 return kTRUE;
455}
456//______________________________
457Bool_t AliCFParticleGenCuts::IsPrimaryCharged(AliMCParticle *mcPart, AliStack *stack) {
458 //
459 //check if a charged particle is primary (standard definition)
460 //
461 if (!stack->IsPhysicalPrimary(mcPart->Label()) || !IsCharged(mcPart)) return kFALSE ;
462 return kTRUE;
463}
464//______________________________
465Bool_t AliCFParticleGenCuts::IsA(AliMCParticle *mcPart, Int_t pdg, Bool_t abs) {
466 //
467 //Check on the pdg code of the MC particle. if abs=kTRUE then check on the
468 //absolute value. By default is set to kFALSE.
469 //
470 TParticle* part = mcPart->Particle();
471 Int_t pdgCode = part->GetPdgCode();
107a3100 472 if (abs) pdgCode = TMath::Abs(pdgCode);
473 if (pdgCode != pdg ) return kFALSE;
563113d0 474 return kTRUE;
475}
476//______________________________
107a3100 477void AliCFParticleGenCuts::SetEvtInfo(TObject* mcEvent) {
563113d0 478 //
107a3100 479 // Sets pointer to MC event information (AliMCEvent)
563113d0 480 //
481
107a3100 482 if (!mcEvent) {
483 AliError("Pointer to MC Event is null !");
563113d0 484 return;
485 }
486
107a3100 487 TString className(mcEvent->ClassName());
488 if (className.CompareTo("AliMCEvent") != 0) {
489 AliError("argument must point to an AliMCEvent !");
563113d0 490 return ;
491 }
492
107a3100 493 fMCInfo = (AliMCEvent*) mcEvent ;
563113d0 494}