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