]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWGPP/EvTrkSelection/AliSingleTrackEffCuts.cxx
bug fix.
[u/mrichter/AliRoot.git] / PWGPP / EvTrkSelection / AliSingleTrackEffCuts.cxx
... / ...
CommitLineData
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
22using std::cout;
23using std::endl;
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();
311 AliMCParticle* mcPart = dynamic_cast<AliMCParticle *>(obj);
312 if(!stack->IsPhysicalPrimary(mcPart->GetLabel())) {
313 isSelected = kFALSE;
314 }
315 } else { // Check on AODs
316 AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle *>(obj);
317 if(!mcPart->IsPhysicalPrimary()) isSelected = kFALSE;
318 }
319
320 return isSelected;
321}
322
323
324//_____________________________________________________________________
325Bool_t AliSingleTrackEffCuts::IsMCParticleInKineAcceptance(TObject *obj)
326{
327 //
328 // Check generated particles (eta, y, pt)
329 //
330
331 if(!obj) return kFALSE;
332 if(!obj->InheritsFrom("AliVParticle")) AliError("object must derived from AliVParticle !");
333 AliVParticle* particle = dynamic_cast<AliVParticle *>(obj);
334 if(!particle) return kFALSE;
335
336 Bool_t isSelected = kTRUE;
337
338 // Cut on eta
339 if(particle->Eta()<fEtaMin || particle->Eta()>fEtaMax) isSelected = kFALSE;
340
341 // Cut on y
342 Double_t energy = particle->E();
343 Double_t pz = particle->Pz();
344 Double_t particleY = (TMath::Abs(energy-pz)>1e-10) ? 0.5*TMath::Log( (energy+pz)/(energy-pz) ) : 1e6;
345 if(particleY<fYMin || particleY>fYMax) isSelected = kFALSE;
346
347 // Cut on pt
348 if(particle->Pt()<fPtMin || particle->Pt()>fPtMax) isSelected = kFALSE;
349
350 return isSelected;
351}
352
353
354//_______________________________________________________________________
355Bool_t AliSingleTrackEffCuts::IsMCParticleInReconstructable(TObject *obj)
356{
357 //
358 // Check if particle has left enough hits in the detectors (only at ESD level)
359 //
360
361 if(!obj) return kFALSE;
362 TString className(obj->ClassName());
363 if (className.CompareTo("AliMCParticle") != 0) {
364 AliError("obj must point to an AliMCParticle !");
365 return kTRUE; // <===================================== FIX ME !!
366 }
367
368 AliMCParticle * part = dynamic_cast<AliMCParticle*>(obj);
369 if(!part) return kFALSE;
370
371 Bool_t isSelected = kTRUE;
372
373 Int_t nHitsITS=0, nHitsTPC=0, nHitsTRD=0, nHitsTOF=0, nHitsMUON=0;
374 for(Int_t iTrackRef=0; iTrackRef<part->GetNumberOfTrackReferences(); iTrackRef++) {
375 AliTrackReference * trackRef = part->GetTrackReference(iTrackRef);
376 if(trackRef){
377 Int_t detectorId = trackRef->DetectorId();
378 switch(detectorId) {
379 case AliTrackReference::kITS : nHitsITS++ ;
380 case AliTrackReference::kTPC : nHitsTPC++ ;
381 case AliTrackReference::kTRD : nHitsTRD++ ;
382 case AliTrackReference::kTOF : nHitsTOF++ ;
383 case AliTrackReference::kMUON : nHitsMUON++ ;
384 }
385 }
386 }
387
388 if(nHitsITS<fnClusITS) isSelected = kFALSE;
389 if(nHitsTPC<fnClusTPC) isSelected = kFALSE;
390 if(nHitsTOF<fnClusTOF) isSelected = kFALSE;
391 if(nHitsMUON<fnClusMUON) isSelected = kFALSE;
392
393 return isSelected;
394}
395
396
397//_____________________________________________________________
398Bool_t AliSingleTrackEffCuts::IsRecoEventSelected(TObject* obj)
399{
400 //
401 // Event selection at reconstructed level (trigger, zvtx)
402 //
403
404 AliVEvent *event = dynamic_cast<AliVEvent*>(obj);
405 if(!event) return kFALSE;
406
407 Bool_t isSelected = kTRUE;
408
409 // Check if event is accepted by the Physics selection
410 UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
411 Bool_t isEvtSelected = (trigFired & fTriggerMask);
412 if(!isEvtSelected) isSelected = kFALSE;
413
414 // Vertex selection
415 Bool_t isVtxSelected = IsVertexSelected(event);
416 if(!isVtxSelected) isSelected = kFALSE;
417
418 return isSelected;
419}
420
421
422//______________________________________________________________________
423Bool_t AliSingleTrackEffCuts::IsRecoParticleKineAcceptance(TObject *obj)
424{
425 //
426 // Check if reconstructed particle is in the acceptance (eta, y, pt)
427 //
428
429 Bool_t isSelected = kTRUE;
430
431 AliVParticle *track = dynamic_cast<AliVParticle*>(obj);
432
433 // Cut on eta
434 if(track->Eta()<fEtaMin || track->Eta()>fEtaMax) isSelected = kFALSE;
435
436 // Cut on y
437 if(track->Y()<fYMin || track->Y()>fYMax) isSelected = kFALSE;
438
439 // Cut on pt
440 if(track->Pt()<fPtMin || track->Pt() >fPtMax) isSelected = kFALSE;
441
442 return isSelected;
443}
444
445//_______________________________________________________________
446Bool_t AliSingleTrackEffCuts::IsVertexSelected(AliVEvent *event)
447{
448 //
449 // Check if the reconstructed vertex is selected
450 //
451
452 Bool_t accept = kTRUE;
453 Bool_t isAOD = event->IsA()->InheritsFrom("AliAODEvent");
454
455 const AliVVertex *vertex = event->GetPrimaryVertex();
456 if(!vertex){
457 accept = kFALSE;
458 AliInfo("no vtx");
459 return accept;
460 }
461
462 // Cut on vertex type
463 TString title=vertex->GetTitle();
464 if(title.Contains("Z") && fMinVtxType>1){
465 accept=kFALSE;
466 } else if(title.Contains("3D") && fMinVtxType>2){
467 accept=kFALSE;
468 }
469
470 // cut on minimum number of contributors
471 if(vertex->GetNContributors()<fMinVtxContr){
472 AliInfo(Form("too few contributors %d",vertex->GetNContributors()));
473 accept=kFALSE;
474 }
475
476 // cut on absolute |z| of the vertex
477 if(TMath::Abs(vertex->GetZ())>fMaxVtxZ) {
478 AliInfo("outside the Vtx range");
479 accept=kFALSE;
480 }
481
482 // cut on distance of SPD and TRK vertexes
483 if(fCutOnZVertexSPD==1) {
484 const AliVVertex *vSPD = NULL;
485 if(isAOD) {
486 vSPD = ((AliAODEvent*)event)->GetPrimaryVertexSPD();
487 }else {
488 vSPD = ((AliESDEvent*)event)->GetPrimaryVertexSPD();
489 }
490
491 if(vSPD && vSPD->GetNContributors()>=fMinVtxContr) {
492 if(TMath::Abs(vSPD->GetZ()-vertex->GetZ())>0.5) accept = kFALSE;
493 }
494 }
495
496 return accept;
497}
498
499//_________________________________________________________________________________________________
500void AliSingleTrackEffCuts::SetTPCSigmaPtBins(Int_t nPtBins, Float_t *pBinLimits, Float_t *sigmaBin)
501{
502 //
503 // Set TPC Pid number-of-Sigma in P bins
504 //
505
506 // Set the pt bins
507 if(fPTPCBinLimits) {
508 delete [] fPTPCBinLimits;
509 fPTPCBinLimits = NULL;
510 printf("Changing the TPC cut P bins\n");
511 }
512 if(fnSigmaTPC) {
513 delete [] fnSigmaTPC;
514 fnSigmaTPC = NULL;
515 printf("Changing the TPC Sigma cut per p bin\n");
516 }
517
518 fnPTPCBins = nPtBins;
519 fnPTPCBinLimits = nPtBins+1;
520 fPTPCBinLimits = new Float_t[fnPTPCBinLimits];
521 for(Int_t ib=0; ib<nPtBins+1; ib++) fPTPCBinLimits[ib]=pBinLimits[ib];
522 fnSigmaTPC = new Float_t[fnPTPCBins];
523 for(Int_t ib=0; ib<nPtBins; ib++) fnSigmaTPC[ib]=sigmaBin[ib];
524
525 return;
526}
527//_____________________________________________________________________________________________________
528void AliSingleTrackEffCuts::SetTOFSigmaPtBins(Int_t nPtBins, Float_t *pBinLimits, Float_t *sigmaBin)
529{
530 //
531 // Set TOF Pid number-of-Sigma in P bins
532 //
533
534 // Set the pt bins
535 if(fPTOFBinLimits) {
536 delete [] fPTOFBinLimits;
537 fPTOFBinLimits = NULL;
538 printf("Changing the TOF cut P bins\n");
539 }
540 if(fnSigmaTOF) {
541 delete [] fnSigmaTOF;
542 fnSigmaTOF = NULL;
543 printf("Changing the TOF Sigma cut per p bin\n");
544 }
545
546 fnPTOFBins = nPtBins;
547 fnPTOFBinLimits = nPtBins+1;
548 fPTOFBinLimits = new Float_t[fnPTOFBinLimits];
549 for(Int_t ib=0; ib<nPtBins+1; ib++) fPTOFBinLimits[ib]=pBinLimits[ib];
550 fnSigmaTOF = new Float_t[fnPTOFBins];
551 for(Int_t ib=0; ib<nPtBins; ib++) fnSigmaTOF[ib]=sigmaBin[ib];
552
553 return;
554}
555
556//___________________________________________________________________________
557Bool_t AliSingleTrackEffCuts::CheckTPCPIDStatus(AliAODTrack *track) const{
558 //
559 // Check TPC PID status
560 //
561
562 if ((track->GetStatus() & AliESDtrack::kTPCin)==0) return kFALSE;
563 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
564 if (nTPCClus<70) return kFALSE;
565 return kTRUE;
566}
567
568//___________________________________________________________________________
569Bool_t AliSingleTrackEffCuts::CheckTOFPIDStatus(AliAODTrack *track) const{
570 //
571 // Check TOC PID status
572 //
573
574 if ((track->GetStatus()&AliESDtrack::kTOFout)==0) return kFALSE;
575 if ((track->GetStatus()&AliESDtrack::kTIME)==0) return kFALSE;
576 if ((track->GetStatus()&AliESDtrack::kTOFpid)==0) return kFALSE;
577 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
578 return kTRUE;
579}
580
581//___________________________________________________________________________
582Bool_t AliSingleTrackEffCuts::IsRecoParticlePID(TObject *obj)
583{
584 //
585 // Check Particle PID (AOD only for now!)
586 //
587
588 Bool_t isSelected = kFALSE;
589 Bool_t isAOD = obj->IsA()->InheritsFrom("AliAODTrack");
590
591 if(!isAOD || !GetUsePid()) return isSelected;
592 if(!fuseTPCPid && !fuseTOFPid) return isSelected;
593
594 AliAODTrack *track = dynamic_cast<AliAODTrack*>(obj);
595 if(!track) { cout<<"No track found"<<endl; return isSelected; }
596
597 // AliAODPid *pid = track->GetDetPid();
598 // if(!pid) { cout<<"No AliAODPid found"<<endl; return isSelected; }
599
600 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
601 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
602 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
603 if(!pidResp) { cout<<"No PidResponse found"<<endl; return isSelected;}
604
605 Double_t pPart = track->P();
606
607 // Check detector status
608 Bool_t okTPC = CheckTPCPIDStatus(track);
609 Bool_t okTOF = CheckTOFPIDStatus(track);
610
611 // Check Number of Sigmas
612 Double_t nsigmaTPC=pidResp->NumberOfSigmasTPC((AliVParticle*)track,(AliPID::EParticleType)fParticlePid);
613 Double_t nsigmaTOF=pidResp->NumberOfSigmasTOF((AliVParticle*)track,(AliPID::EParticleType)fParticlePid);
614 Bool_t isTPCPid=false, isTOFPid=false;
615
616 // If use TPC and TPC infos are ok, check whether the sigma is ok in the given p range
617 if(fuseTPCPid && okTPC) {
618 for(Int_t j=0; j<fnPTPCBins; j++) {
619 // cout<<" checking bin: ("<<fPTPCBinLimits[j]<<","<<fPTPCBinLimits[j+1]<<") should be nsigma < "<<fnSigmaTPC[j]<<endl;
620 if ((pPart>fPTPCBinLimits[j]) && (pPart<fPTPCBinLimits[j+1]) && nsigmaTPC<fnSigmaTPC[j]) isTPCPid=true;
621 }
622 if(pPart>fPmaxTPC) isTPCPid=true;
623 }
624
625 // If use TPC and TPC infos are ok, check whether the sigma is ok in the given p range
626 if(fuseTOFPid && okTOF) {
627 for(Int_t j=0; j<fnPTOFBins; j++) {
628 if ((pPart>fPTOFBinLimits[j]) && (pPart<fPTOFBinLimits[j+1]) && nsigmaTOF<fnSigmaTOF[j]) isTPCPid=true;
629 }
630 if(pPart>fPmaxTOF) isTOFPid=true;
631 }
632
633 isSelected = (isTPCPid || isTOFPid) ? true : false;
634
635 return isSelected;
636}