]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/EvTrkSelection/AliSingleTrackEffCuts.cxx
Coverity fixes (Jitendra).
[u/mrichter/AliRoot.git] / PWGPP / EvTrkSelection / AliSingleTrackEffCuts.cxx
CommitLineData
c0757458 1#include "AliVEvent.h"
2#include "AliMCEvent.h"
3#include "TParticle.h"
4#include "AliVParticle.h"
5#include "AliESDEvent.h"
6#include "AliAODEvent.h"
7#include "AliVVertex.h"
8#include "AliLog.h"
9#include "AliGenEventHeader.h"
10#include "AliInputEventHandler.h"
11#include "AliAnalysisManager.h"
12#include "AliAODMCHeader.h"
13#include "AliAODMCParticle.h"
14#include "AliMCParticle.h"
15#include "AliVParticle.h"
16#include "AliStack.h"
17#include "AliMCEventHandler.h"
18#include "AliPIDResponse.h"
19
20#include "AliSingleTrackEffCuts.h"
21
a0ec15ff 22using std::cout;
23using std::endl;
c0757458 24
25ClassImp(AliSingleTrackEffCuts)
26
27//_____________________________________________________
28AliSingleTrackEffCuts::AliSingleTrackEffCuts():
29AliAnalysisCuts(),
30 fisAOD(kTRUE),
31 fIsPdgCode(kFALSE),
32 fPdgCode(0),
33 fEtaMin(-12),
34 fEtaMax(12),
35 fYMin(-12),
36 fYMax(12),
37 fPtMin(-15),
38 fPtMax(15),
39 fIsCharged(kTRUE),
40 fTriggerMask(AliVEvent::kAny),
41 fMinVtxType(0),
42 fMinVtxContr(1),
43 fMaxVtxZ(10.),
44 fCutOnZVertexSPD(0),
45 fnClusITS(0),
46 fnClusTPC(0),
47 fnClusTOF(0),
48 fnClusMUON(0),
49 fusePid(kFALSE),
50 fParticlePid(AliPID::kPion),
51 fuseTPCPid(kTRUE),
52 fnPTPCBins(0),
53 fnPTPCBinLimits(0),
54 fPTPCBinLimits(0),
55 fnSigmaTPC(0),
56 fPmaxTPC(9999.),
57 fuseTOFPid(kTRUE),
58 fnPTOFBins(0),
59 fnPTOFBinLimits(0),
60 fPTOFBinLimits(0),
61 fnSigmaTOF(0),
62 fPmaxTOF(9999.)
63{
64 //
65 // Default constructor
66 //
67}
68
69//________________________________________________________________________________
70AliSingleTrackEffCuts::AliSingleTrackEffCuts(const char* name, const char* title):
71AliAnalysisCuts(name,title),
72 fisAOD(kTRUE),
73 fIsPdgCode(kFALSE),
74 fPdgCode(0),
75 fEtaMin(-12),
76 fEtaMax(12),
77 fYMin(-12),
78 fYMax(12),
79 fPtMin(-15),
80 fPtMax(15),
81 fIsCharged(kTRUE),
82 fTriggerMask(AliVEvent::kAny),
83 fMinVtxType(0),
84 fMinVtxContr(1),
85 fMaxVtxZ(10.),
86 fCutOnZVertexSPD(0),
87 fnClusITS(0),
88 fnClusTPC(0),
89 fnClusTOF(0),
90 fnClusMUON(0),
91 fusePid(kFALSE),
92 fParticlePid(AliPID::kPion),
93 fuseTPCPid(kTRUE),
94 fnPTPCBins(0),
95 fnPTPCBinLimits(0),
96 fPTPCBinLimits(0),
97 fnSigmaTPC(0),
98 fPmaxTPC(9999.),
99 fuseTOFPid(kTRUE),
100 fnPTOFBins(0),
101 fnPTOFBinLimits(0),
102 fPTOFBinLimits(0),
103 fnSigmaTOF(0),
104 fPmaxTOF(9999.)
105{
106 //
107 // Default constructor
108 //
109}
110
111//_________________________________________________________________________________
112AliSingleTrackEffCuts::AliSingleTrackEffCuts(const AliSingleTrackEffCuts &source):
113 AliAnalysisCuts(source),
114 fisAOD(source.fisAOD),
115 fIsPdgCode(source.fIsPdgCode),
116 fPdgCode(source.fPdgCode),
117 fEtaMin(source.fEtaMin),
118 fEtaMax(source.fEtaMax),
119 fYMin(source.fYMin),
120 fYMax(source.fYMax),
121 fPtMin(source.fPtMin),
122 fPtMax(source.fPtMax),
123 fIsCharged(source.fIsCharged),
124 fTriggerMask(source.fTriggerMask),
125 fMinVtxType(source.fMinVtxType),
126 fMinVtxContr(source.fMinVtxContr),
127 fMaxVtxZ(source.fMaxVtxZ),
128 fCutOnZVertexSPD(source.fCutOnZVertexSPD),
129 fnClusITS(source.fnClusITS),
130 fnClusTPC(source.fnClusTPC),
131 fnClusTOF(source.fnClusTOF),
132 fnClusMUON(source.fnClusMUON),
133 fusePid(source.fusePid),
134 fParticlePid(source.fParticlePid),
135 fuseTPCPid(source.fuseTPCPid),
136 fnPTPCBins(source.fnPTPCBins),
137 fnPTPCBinLimits(source.fnPTPCBinLimits),
138 fPTPCBinLimits(source.fPTPCBinLimits),
139 fnSigmaTPC(source.fnSigmaTPC),
140 fPmaxTPC(source.fPmaxTPC),
141 fuseTOFPid(source.fuseTOFPid),
142 fnPTOFBins(source.fnPTOFBins),
143 fnPTOFBinLimits(source.fnPTOFBinLimits),
144 fPTOFBinLimits(source.fPTOFBinLimits),
145 fnSigmaTOF(source.fnSigmaTOF),
146 fPmaxTOF(source.fPmaxTOF)
147{
148 //
149 // Copy constructor
150 //
151}
152
153
154//_________________________________________________________________________________________
155AliSingleTrackEffCuts &AliSingleTrackEffCuts::operator=(const AliSingleTrackEffCuts &source)
156{
157 //
158 // assignment operator
159 //
160 if(&source == this) return *this;
161
162 fisAOD = source.fisAOD;
163
164 fIsPdgCode = source.fIsPdgCode;
165 fPdgCode = source.fPdgCode;
166 fEtaMin = source.fEtaMin;
167 fEtaMax = source.fEtaMax;
168 fYMin = source.fYMin;
169 fYMax = source.fYMax;
170 fPtMin = source.fPtMin;
171 fPtMax = source.fPtMax;
172 fIsCharged = source.fIsCharged;
173
174 fTriggerMask = source.fTriggerMask;
175 fMinVtxType = source.fMinVtxType;
176 fMinVtxContr = source.fMinVtxContr;
177 fMaxVtxZ = source.fMaxVtxZ;
178 fCutOnZVertexSPD = source.fCutOnZVertexSPD;
179
180 fnClusITS = source.fnClusITS;
181 fnClusTPC = source.fnClusTPC;
182 fnClusTOF = source.fnClusTOF;
183 fnClusMUON = source.fnClusMUON;
184
185 fusePid = source.fusePid;
186 fParticlePid = source.fParticlePid;
187 fuseTPCPid = source.fuseTPCPid;
188 fnPTPCBins = source.fnPTPCBins;
189 fnPTPCBinLimits = source.fnPTPCBinLimits;
190 if(source.fPTPCBinLimits && source.fnSigmaTPC)
191 SetTPCSigmaPtBins(source.fnPTPCBins,source.fPTPCBinLimits,source.fnSigmaTPC);
192 fPmaxTPC = source.fPmaxTPC;
193 fuseTOFPid = source.fuseTOFPid;
194 fnPTOFBins = source.fnPTOFBins;
195 fnPTOFBinLimits = source.fnPTOFBinLimits;
196 if(source.fPTOFBinLimits && source.fnSigmaTOF)
197 SetTOFSigmaPtBins(source.fnPTOFBins,source.fPTOFBinLimits,source.fnSigmaTOF);
198 fPmaxTOF = source.fPmaxTOF;
199
200 return *this;
201}
202
203//______________________________________________
204AliSingleTrackEffCuts::~AliSingleTrackEffCuts()
205{
206 //
207 // Destructor
208 //
209
210 if(fPTPCBinLimits){
211 delete [] fPTPCBinLimits;
212 fPTPCBinLimits=NULL;
213 }
214 if(fnSigmaTPC){
215 delete [] fnSigmaTPC;
216 fnSigmaTPC=NULL;
217 }
218 if(fPTOFBinLimits){
219 delete [] fPTOFBinLimits;
220 fPTOFBinLimits=NULL;
221 }
222 if(fnSigmaTOF){
223 delete [] fnSigmaTOF;
224 fnSigmaTOF=NULL;
225 }
226
227}
228
229//______________________________________________
230Bool_t AliSingleTrackEffCuts::IsMCEventSelected(TObject* obj)
231{
232 //
233 // Event selection at MC level
234 // |zvtx|<=fMaxVtxZ
235 //
236 if(!obj) return kFALSE;
237 Bool_t isSelected = kTRUE;
238
239 AliMCEvent *event=0;
240 AliGenEventHeader *genHeader=0; //ESDs
241 AliAODMCHeader *mcHeader=0; // AODs
242 Bool_t isAOD = obj->IsA()->InheritsFrom("AliAODEvent");
243
244 if(!isAOD) {
245 event = dynamic_cast<AliMCEvent*>(obj);
246 if (!event) return kFALSE;
247 genHeader = event->GenEventHeader();
248 if (!genHeader) return kFALSE;
249 } else {
250 AliAODEvent *aodEvent = dynamic_cast<AliAODEvent*> (obj);
251 if (!aodEvent) return kFALSE;
252 mcHeader = dynamic_cast<AliAODMCHeader*>(aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
253 if (!mcHeader) {
254 AliError("Could not find MC Header in AOD");
255 return kFALSE;
256 }
257
258 // Check for not null trigger mask to evict pPb MC buggy-events
259 Int_t runnumber = aodEvent->GetRunNumber();
260 if(aodEvent->GetTriggerMask()==0 &&
261 (runnumber>=195344 && runnumber<=195677)){
262 AliDebug(3,"Event rejected because of null trigger mask");
263 return kFALSE;
264 }
265 }
266
267
268 // Cut on Z Vertex ( |z-vtx| <= fMaxVtxZ )
269 TArrayF vtxPos(3);
270 Double_t zMCVertex=-1000;
271 if(!isAOD) {
272 genHeader->PrimaryVertex(vtxPos);
273 zMCVertex = vtxPos[2];
274 } else {
275 zMCVertex = mcHeader->GetVtxZ();
276 }
277 if( TMath::Abs(zMCVertex)>fMaxVtxZ ) isSelected = kFALSE;
278
279
280 return isSelected;
281}
282
283//__________________________________________________________
284Bool_t AliSingleTrackEffCuts::IsMCParticleGenerated(TObject* obj)
285{
286 //
287 // Check generated particles (primary, charged, pdgcode)
288 //
289
290 if(!obj) return kFALSE;
291 if(!obj->InheritsFrom("AliVParticle")) {
292 AliError("object must derived from AliVParticle !");
293 return kFALSE;
294 }
295 AliVParticle* particle = dynamic_cast<AliVParticle *>(obj);
296 if(!particle) return kFALSE;
297
298 Bool_t isSelected = kTRUE;
299
300 // Check particle Pdg Code
301 if(fIsPdgCode && TMath::Abs( particle->PdgCode() )!= fPdgCode) isSelected = kFALSE;
302
303 // Charge selection
304 if(fIsCharged && !(particle->Charge()!=0)) isSelected = kFALSE;
305
306 // Selection of Physical Primary particles
307 if(!fisAOD) { // check on ESDs
308 AliMCEventHandler* mcinfo = (AliMCEventHandler*) (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
309 AliMCEvent* mcevent = mcinfo->MCEvent();
310 AliStack* stack = ((AliMCEvent*)mcevent)->Stack();
c37908f3 311 AliMCParticle* mcPart = dynamic_cast<AliMCParticle *>(obj);
312 if (!mcPart) return kFALSE;
c0757458 313 if(!stack->IsPhysicalPrimary(mcPart->GetLabel())) {
314 isSelected = kFALSE;
315 }
316 } else { // Check on AODs
317 AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle *>(obj);
318 if(!mcPart->IsPhysicalPrimary()) isSelected = kFALSE;
319 }
320
321 return isSelected;
322}
323
324
325//_____________________________________________________________________
326Bool_t AliSingleTrackEffCuts::IsMCParticleInKineAcceptance(TObject *obj)
327{
328 //
329 // Check generated particles (eta, y, pt)
330 //
331
332 if(!obj) return kFALSE;
333 if(!obj->InheritsFrom("AliVParticle")) AliError("object must derived from AliVParticle !");
334 AliVParticle* particle = dynamic_cast<AliVParticle *>(obj);
335 if(!particle) return kFALSE;
336
337 Bool_t isSelected = kTRUE;
338
339 // Cut on eta
340 if(particle->Eta()<fEtaMin || particle->Eta()>fEtaMax) isSelected = kFALSE;
341
342 // Cut on y
343 Double_t energy = particle->E();
344 Double_t pz = particle->Pz();
345 Double_t particleY = (TMath::Abs(energy-pz)>1e-10) ? 0.5*TMath::Log( (energy+pz)/(energy-pz) ) : 1e6;
346 if(particleY<fYMin || particleY>fYMax) isSelected = kFALSE;
347
348 // Cut on pt
349 if(particle->Pt()<fPtMin || particle->Pt()>fPtMax) isSelected = kFALSE;
350
351 return isSelected;
352}
353
354
355//_______________________________________________________________________
356Bool_t AliSingleTrackEffCuts::IsMCParticleInReconstructable(TObject *obj)
357{
358 //
359 // Check if particle has left enough hits in the detectors (only at ESD level)
360 //
361
362 if(!obj) return kFALSE;
363 TString className(obj->ClassName());
364 if (className.CompareTo("AliMCParticle") != 0) {
365 AliError("obj must point to an AliMCParticle !");
366 return kTRUE; // <===================================== FIX ME !!
367 }
368
369 AliMCParticle * part = dynamic_cast<AliMCParticle*>(obj);
370 if(!part) return kFALSE;
371
372 Bool_t isSelected = kTRUE;
373
374 Int_t nHitsITS=0, nHitsTPC=0, nHitsTRD=0, nHitsTOF=0, nHitsMUON=0;
375 for(Int_t iTrackRef=0; iTrackRef<part->GetNumberOfTrackReferences(); iTrackRef++) {
376 AliTrackReference * trackRef = part->GetTrackReference(iTrackRef);
377 if(trackRef){
378 Int_t detectorId = trackRef->DetectorId();
379 switch(detectorId) {
5cc7b66d 380 case AliTrackReference::kITS :
381 nHitsITS++;
382 break;
383 case AliTrackReference::kTPC :
384 nHitsTPC++;
385 break;
386 case AliTrackReference::kTRD :
387 nHitsTRD++;
388 break;
389 case AliTrackReference::kTOF :
390 nHitsTOF++;
391 break;
392 case AliTrackReference::kMUON :
393 nHitsMUON++;
394 break;
395 default : break;
c0757458 396 }
397 }
398 }
399
400 if(nHitsITS<fnClusITS) isSelected = kFALSE;
401 if(nHitsTPC<fnClusTPC) isSelected = kFALSE;
402 if(nHitsTOF<fnClusTOF) isSelected = kFALSE;
403 if(nHitsMUON<fnClusMUON) isSelected = kFALSE;
404
405 return isSelected;
406}
407
408
409//_____________________________________________________________
410Bool_t AliSingleTrackEffCuts::IsRecoEventSelected(TObject* obj)
411{
412 //
413 // Event selection at reconstructed level (trigger, zvtx)
414 //
415
416 AliVEvent *event = dynamic_cast<AliVEvent*>(obj);
417 if(!event) return kFALSE;
418
419 Bool_t isSelected = kTRUE;
420
421 // Check if event is accepted by the Physics selection
422 UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
423 Bool_t isEvtSelected = (trigFired & fTriggerMask);
424 if(!isEvtSelected) isSelected = kFALSE;
425
426 // Vertex selection
427 Bool_t isVtxSelected = IsVertexSelected(event);
428 if(!isVtxSelected) isSelected = kFALSE;
429
430 return isSelected;
431}
432
433
434//______________________________________________________________________
435Bool_t AliSingleTrackEffCuts::IsRecoParticleKineAcceptance(TObject *obj)
436{
437 //
438 // Check if reconstructed particle is in the acceptance (eta, y, pt)
439 //
440
441 Bool_t isSelected = kTRUE;
442
443 AliVParticle *track = dynamic_cast<AliVParticle*>(obj);
c37908f3 444 if (!track) return kFALSE;
c0757458 445
446 // Cut on eta
447 if(track->Eta()<fEtaMin || track->Eta()>fEtaMax) isSelected = kFALSE;
448
449 // Cut on y
450 if(track->Y()<fYMin || track->Y()>fYMax) isSelected = kFALSE;
451
452 // Cut on pt
453 if(track->Pt()<fPtMin || track->Pt() >fPtMax) isSelected = kFALSE;
454
455 return isSelected;
456}
457
458//_______________________________________________________________
459Bool_t AliSingleTrackEffCuts::IsVertexSelected(AliVEvent *event)
460{
461 //
462 // Check if the reconstructed vertex is selected
463 //
464
465 Bool_t accept = kTRUE;
466 Bool_t isAOD = event->IsA()->InheritsFrom("AliAODEvent");
467
468 const AliVVertex *vertex = event->GetPrimaryVertex();
469 if(!vertex){
470 accept = kFALSE;
471 AliInfo("no vtx");
472 return accept;
473 }
474
475 // Cut on vertex type
476 TString title=vertex->GetTitle();
477 if(title.Contains("Z") && fMinVtxType>1){
478 accept=kFALSE;
479 } else if(title.Contains("3D") && fMinVtxType>2){
480 accept=kFALSE;
481 }
482
483 // cut on minimum number of contributors
484 if(vertex->GetNContributors()<fMinVtxContr){
485 AliInfo(Form("too few contributors %d",vertex->GetNContributors()));
486 accept=kFALSE;
487 }
488
489 // cut on absolute |z| of the vertex
490 if(TMath::Abs(vertex->GetZ())>fMaxVtxZ) {
491 AliInfo("outside the Vtx range");
492 accept=kFALSE;
493 }
494
495 // cut on distance of SPD and TRK vertexes
496 if(fCutOnZVertexSPD==1) {
497 const AliVVertex *vSPD = NULL;
498 if(isAOD) {
499 vSPD = ((AliAODEvent*)event)->GetPrimaryVertexSPD();
500 }else {
501 vSPD = ((AliESDEvent*)event)->GetPrimaryVertexSPD();
502 }
503
504 if(vSPD && vSPD->GetNContributors()>=fMinVtxContr) {
505 if(TMath::Abs(vSPD->GetZ()-vertex->GetZ())>0.5) accept = kFALSE;
506 }
507 }
508
509 return accept;
510}
511
512//_________________________________________________________________________________________________
513void AliSingleTrackEffCuts::SetTPCSigmaPtBins(Int_t nPtBins, Float_t *pBinLimits, Float_t *sigmaBin)
514{
515 //
516 // Set TPC Pid number-of-Sigma in P bins
517 //
518
519 // Set the pt bins
520 if(fPTPCBinLimits) {
521 delete [] fPTPCBinLimits;
522 fPTPCBinLimits = NULL;
523 printf("Changing the TPC cut P bins\n");
524 }
525 if(fnSigmaTPC) {
526 delete [] fnSigmaTPC;
527 fnSigmaTPC = NULL;
528 printf("Changing the TPC Sigma cut per p bin\n");
529 }
530
531 fnPTPCBins = nPtBins;
532 fnPTPCBinLimits = nPtBins+1;
533 fPTPCBinLimits = new Float_t[fnPTPCBinLimits];
534 for(Int_t ib=0; ib<nPtBins+1; ib++) fPTPCBinLimits[ib]=pBinLimits[ib];
535 fnSigmaTPC = new Float_t[fnPTPCBins];
536 for(Int_t ib=0; ib<nPtBins; ib++) fnSigmaTPC[ib]=sigmaBin[ib];
537
538 return;
539}
540//_____________________________________________________________________________________________________
541void AliSingleTrackEffCuts::SetTOFSigmaPtBins(Int_t nPtBins, Float_t *pBinLimits, Float_t *sigmaBin)
542{
543 //
544 // Set TOF Pid number-of-Sigma in P bins
545 //
546
547 // Set the pt bins
548 if(fPTOFBinLimits) {
549 delete [] fPTOFBinLimits;
550 fPTOFBinLimits = NULL;
551 printf("Changing the TOF cut P bins\n");
552 }
553 if(fnSigmaTOF) {
554 delete [] fnSigmaTOF;
555 fnSigmaTOF = NULL;
556 printf("Changing the TOF Sigma cut per p bin\n");
557 }
558
559 fnPTOFBins = nPtBins;
560 fnPTOFBinLimits = nPtBins+1;
561 fPTOFBinLimits = new Float_t[fnPTOFBinLimits];
562 for(Int_t ib=0; ib<nPtBins+1; ib++) fPTOFBinLimits[ib]=pBinLimits[ib];
563 fnSigmaTOF = new Float_t[fnPTOFBins];
564 for(Int_t ib=0; ib<nPtBins; ib++) fnSigmaTOF[ib]=sigmaBin[ib];
565
566 return;
567}
568
569//___________________________________________________________________________
570Bool_t AliSingleTrackEffCuts::CheckTPCPIDStatus(AliAODTrack *track) const{
571 //
572 // Check TPC PID status
573 //
574
575 if ((track->GetStatus() & AliESDtrack::kTPCin)==0) return kFALSE;
576 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
577 if (nTPCClus<70) return kFALSE;
578 return kTRUE;
579}
580
581//___________________________________________________________________________
582Bool_t AliSingleTrackEffCuts::CheckTOFPIDStatus(AliAODTrack *track) const{
583 //
584 // Check TOC PID status
585 //
586
587 if ((track->GetStatus()&AliESDtrack::kTOFout)==0) return kFALSE;
588 if ((track->GetStatus()&AliESDtrack::kTIME)==0) return kFALSE;
589 if ((track->GetStatus()&AliESDtrack::kTOFpid)==0) return kFALSE;
590 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
591 return kTRUE;
592}
593
594//___________________________________________________________________________
595Bool_t AliSingleTrackEffCuts::IsRecoParticlePID(TObject *obj)
596{
597 //
598 // Check Particle PID (AOD only for now!)
599 //
600
601 Bool_t isSelected = kFALSE;
602 Bool_t isAOD = obj->IsA()->InheritsFrom("AliAODTrack");
603
604 if(!isAOD || !GetUsePid()) return isSelected;
605 if(!fuseTPCPid && !fuseTOFPid) return isSelected;
606
607 AliAODTrack *track = dynamic_cast<AliAODTrack*>(obj);
608 if(!track) { cout<<"No track found"<<endl; return isSelected; }
609
610 // AliAODPid *pid = track->GetDetPid();
611 // if(!pid) { cout<<"No AliAODPid found"<<endl; return isSelected; }
612
613 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
614 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
615 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
616 if(!pidResp) { cout<<"No PidResponse found"<<endl; return isSelected;}
617
618 Double_t pPart = track->P();
619
620 // Check detector status
621 Bool_t okTPC = CheckTPCPIDStatus(track);
622 Bool_t okTOF = CheckTOFPIDStatus(track);
623
624 // Check Number of Sigmas
625 Double_t nsigmaTPC=pidResp->NumberOfSigmasTPC((AliVParticle*)track,(AliPID::EParticleType)fParticlePid);
626 Double_t nsigmaTOF=pidResp->NumberOfSigmasTOF((AliVParticle*)track,(AliPID::EParticleType)fParticlePid);
627 Bool_t isTPCPid=false, isTOFPid=false;
628
629 // If use TPC and TPC infos are ok, check whether the sigma is ok in the given p range
630 if(fuseTPCPid && okTPC) {
631 for(Int_t j=0; j<fnPTPCBins; j++) {
632 // cout<<" checking bin: ("<<fPTPCBinLimits[j]<<","<<fPTPCBinLimits[j+1]<<") should be nsigma < "<<fnSigmaTPC[j]<<endl;
633 if ((pPart>fPTPCBinLimits[j]) && (pPart<fPTPCBinLimits[j+1]) && nsigmaTPC<fnSigmaTPC[j]) isTPCPid=true;
634 }
635 if(pPart>fPmaxTPC) isTPCPid=true;
636 }
637
638 // If use TPC and TPC infos are ok, check whether the sigma is ok in the given p range
639 if(fuseTOFPid && okTOF) {
640 for(Int_t j=0; j<fnPTOFBins; j++) {
641 if ((pPart>fPTOFBinLimits[j]) && (pPart<fPTOFBinLimits[j+1]) && nsigmaTOF<fnSigmaTOF[j]) isTPCPid=true;
642 }
643 if(pPart>fPmaxTOF) isTOFPid=true;
644 }
645
646 isSelected = (isTPCPid || isTOFPid) ? true : false;
647
648 return isSelected;
649}