1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **********************************************************i****************/
19 // Data selection for flow framework
21 // origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
22 // mods: Redmer A. Bertens (rbertens@cern.ch)
24 // This class gurantees consistency of cut methods, trackparameter
25 // selection (global tracks, TPC only, etc..) and parameter mixing
26 // in the flow framework. Transparently handles different input types:
28 // This class works in 2 steps: first the requested track parameters are
29 // constructed (to be set by SetParamType() ), then cuts are applied.
30 // the constructed track can be requested AFTER checking the cuts by
31 // calling GetTrack(), in this case the cut object stays in control,
32 // caller does not have to delete the track.
33 // Additionally caller can request an AliFlowTrack object to be constructed
34 // according the parameter mixing scenario requested by SetParamMix().
35 // AliFlowTrack is made using MakeFlowTrack() method, its an 'object factory'
36 // so caller needs to take care of the freshly created object.
41 #include "TMCProcess.h"
42 #include "TParticle.h"
46 #include "AliMCEvent.h"
47 #include "AliESDEvent.h"
48 #include "AliAODEvent.h"
49 #include "AliVParticle.h"
50 #include "AliVVZERO.h"
51 #include "AliMCParticle.h"
52 #include "AliESDtrack.h"
53 #include "AliESDMuonTrack.h" // XZhang 20120604
54 #include "AliMultiplicity.h"
55 #include "AliAODTrack.h"
56 #include "AliAODTracklets.h" // XZhang 20120615
57 #include "AliFlowTrackSimple.h"
58 #include "AliFlowTrack.h"
59 #include "AliFlowTrackCuts.h"
61 #include "AliESDpid.h"
62 #include "AliESDPmdTrack.h"
63 #include "AliESDUtils.h" //TODO
64 #include "AliFlowBayesianPID.h"
66 ClassImp(AliFlowTrackCuts)
68 //-----------------------------------------------------------------------
69 AliFlowTrackCuts::AliFlowTrackCuts():
70 AliFlowTrackSimpleCuts(),
71 fAliESDtrackCuts(NULL),
72 fMuonTrackCuts(NULL), // XZhang 20120604
75 fCutMChasTrackReferences(kFALSE),
76 fCutMCprocessType(kFALSE),
77 fMCprocessType(kPNoProcess),
80 fCutMCfirstMotherPID(kFALSE),
82 fIgnoreSignInMCPID(kFALSE),
83 fCutMCisPrimary(kFALSE),
84 fRequireTransportBitForPrimaries(kTRUE),
86 fRequireCharge(kFALSE),
88 fCutSPDtrackletDeltaPhi(kFALSE),
89 fSPDtrackletDeltaPhiMax(FLT_MAX),
90 fSPDtrackletDeltaPhiMin(-FLT_MAX),
91 fIgnoreTPCzRange(kFALSE),
92 fIgnoreTPCzRangeMax(FLT_MAX),
93 fIgnoreTPCzRangeMin(-FLT_MAX),
94 fCutChi2PerClusterTPC(kFALSE),
95 fMaxChi2PerClusterTPC(FLT_MAX),
96 fMinChi2PerClusterTPC(-FLT_MAX),
97 fCutNClustersTPC(kFALSE),
98 fNClustersTPCMax(INT_MAX),
99 fNClustersTPCMin(INT_MIN),
100 fCutNClustersITS(kFALSE),
101 fNClustersITSMax(INT_MAX),
102 fNClustersITSMin(INT_MIN),
103 fUseAODFilterBit(kFALSE),
105 fCutDCAToVertexXY(kFALSE),
106 fCutDCAToVertexZ(kFALSE),
107 fCutMinimalTPCdedx(kFALSE),
109 fLinearizeVZEROresponse(kFALSE),
114 fCutPmdNcell(kFALSE),
122 fTrackLabel(INT_MIN),
127 fFlowTagType(AliFlowTrackSimple::kInvalid),
129 fBayesianResponse(NULL),
133 fParticleID(AliPID::kUnknown),
134 fParticleProbability(.9),
135 fAllowTOFmismatchFlag(kFALSE),
136 fRequireStrictTOFTPCagreement(kFALSE),
137 fCutRejectElectronsWithTPCpid(kFALSE),
140 fV0gainEqualization(NULL),
141 fApplyRecentering(kFALSE),
142 fV0gainEqualizationPerRing(kFALSE)
145 SetPriors(); //init arrays
147 // New PID procedure (Bayesian Combined PID)
148 // allocating here is necessary because we don't
149 // stream this member
150 // TODO: fix streaming problems AliFlowBayesianPID
151 fBayesianResponse = new AliFlowBayesianPID();
152 fBayesianResponse->SetNewTrackParam();
153 for(Int_t i(0); i < 4; i++) {
157 for(Int_t i(0); i < 8; i++) fUseVZERORing[i] = kTRUE;
161 //-----------------------------------------------------------------------
162 AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
163 AliFlowTrackSimpleCuts(name),
164 fAliESDtrackCuts(NULL),
165 fMuonTrackCuts(NULL), // XZhang 20120604
168 fCutMChasTrackReferences(kFALSE),
169 fCutMCprocessType(kFALSE),
170 fMCprocessType(kPNoProcess),
173 fCutMCfirstMotherPID(kFALSE),
174 fMCfirstMotherPID(0),
175 fIgnoreSignInMCPID(kFALSE),
176 fCutMCisPrimary(kFALSE),
177 fRequireTransportBitForPrimaries(kTRUE),
178 fMCisPrimary(kFALSE),
179 fRequireCharge(kFALSE),
181 fCutSPDtrackletDeltaPhi(kFALSE),
182 fSPDtrackletDeltaPhiMax(FLT_MAX),
183 fSPDtrackletDeltaPhiMin(-FLT_MAX),
184 fIgnoreTPCzRange(kFALSE),
185 fIgnoreTPCzRangeMax(FLT_MAX),
186 fIgnoreTPCzRangeMin(-FLT_MAX),
187 fCutChi2PerClusterTPC(kFALSE),
188 fMaxChi2PerClusterTPC(FLT_MAX),
189 fMinChi2PerClusterTPC(-FLT_MAX),
190 fCutNClustersTPC(kFALSE),
191 fNClustersTPCMax(INT_MAX),
192 fNClustersTPCMin(INT_MIN),
193 fCutNClustersITS(kFALSE),
194 fNClustersITSMax(INT_MAX),
195 fNClustersITSMin(INT_MIN),
196 fUseAODFilterBit(kFALSE),
198 fCutDCAToVertexXY(kFALSE),
199 fCutDCAToVertexZ(kFALSE),
200 fCutMinimalTPCdedx(kFALSE),
202 fLinearizeVZEROresponse(kFALSE),
207 fCutPmdNcell(kFALSE),
215 fTrackLabel(INT_MIN),
220 fFlowTagType(AliFlowTrackSimple::kInvalid),
222 fBayesianResponse(NULL),
226 fParticleID(AliPID::kUnknown),
227 fParticleProbability(.9),
228 fAllowTOFmismatchFlag(kFALSE),
229 fRequireStrictTOFTPCagreement(kFALSE),
230 fCutRejectElectronsWithTPCpid(kFALSE),
233 fV0gainEqualization(NULL),
234 fApplyRecentering(kFALSE),
235 fV0gainEqualizationPerRing(kFALSE)
238 SetTitle("AliFlowTrackCuts");
239 fESDpid.GetTPCResponse().SetBetheBlochParameters( 0.0283086,
244 SetPriors(); //init arrays
246 // New PID procedure (Bayesian Combined PID)
247 fBayesianResponse = new AliFlowBayesianPID();
248 fBayesianResponse->SetNewTrackParam();
249 for(Int_t i(0); i < 4; i++) {
253 for(Int_t i(0); i < 8; i++) fUseVZERORing[i] = kTRUE;
256 //-----------------------------------------------------------------------
257 AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
258 AliFlowTrackSimpleCuts(that),
259 fAliESDtrackCuts(NULL),
260 fMuonTrackCuts(NULL), // XZhang 20120604
263 fCutMChasTrackReferences(that.fCutMChasTrackReferences),
264 fCutMCprocessType(that.fCutMCprocessType),
265 fMCprocessType(that.fMCprocessType),
266 fCutMCPID(that.fCutMCPID),
268 fCutMCfirstMotherPID(that.fCutMCfirstMotherPID),
269 fMCfirstMotherPID(that.fMCfirstMotherPID),
270 fIgnoreSignInMCPID(that.fIgnoreSignInMCPID),
271 fCutMCisPrimary(that.fCutMCisPrimary),
272 fRequireTransportBitForPrimaries(that.fRequireTransportBitForPrimaries),
273 fMCisPrimary(that.fMCisPrimary),
274 fRequireCharge(that.fRequireCharge),
275 fFakesAreOK(that.fFakesAreOK),
276 fCutSPDtrackletDeltaPhi(that.fCutSPDtrackletDeltaPhi),
277 fSPDtrackletDeltaPhiMax(that.fSPDtrackletDeltaPhiMax),
278 fSPDtrackletDeltaPhiMin(that.fSPDtrackletDeltaPhiMin),
279 fIgnoreTPCzRange(that.fIgnoreTPCzRange),
280 fIgnoreTPCzRangeMax(that.fIgnoreTPCzRangeMax),
281 fIgnoreTPCzRangeMin(that.fIgnoreTPCzRangeMin),
282 fCutChi2PerClusterTPC(that.fCutChi2PerClusterTPC),
283 fMaxChi2PerClusterTPC(that.fMaxChi2PerClusterTPC),
284 fMinChi2PerClusterTPC(that.fMinChi2PerClusterTPC),
285 fCutNClustersTPC(that.fCutNClustersTPC),
286 fNClustersTPCMax(that.fNClustersTPCMax),
287 fNClustersTPCMin(that.fNClustersTPCMin),
288 fCutNClustersITS(that.fCutNClustersITS),
289 fNClustersITSMax(that.fNClustersITSMax),
290 fNClustersITSMin(that.fNClustersITSMin),
291 fUseAODFilterBit(that.fUseAODFilterBit),
292 fAODFilterBit(that.fAODFilterBit),
293 fCutDCAToVertexXY(that.fCutDCAToVertexXY),
294 fCutDCAToVertexZ(that.fCutDCAToVertexZ),
295 fCutMinimalTPCdedx(that.fCutMinimalTPCdedx),
296 fMinimalTPCdedx(that.fMinimalTPCdedx),
297 fLinearizeVZEROresponse(that.fLinearizeVZEROresponse),
298 fCutPmdDet(that.fCutPmdDet),
299 fPmdDet(that.fPmdDet),
300 fCutPmdAdc(that.fCutPmdAdc),
301 fPmdAdc(that.fPmdAdc),
302 fCutPmdNcell(that.fCutPmdNcell),
303 fPmdNcell(that.fPmdNcell),
304 fParamType(that.fParamType),
305 fParamMix(that.fParamMix),
310 fTrackLabel(INT_MIN),
315 fFlowTagType(that.fFlowTagType),
316 fESDpid(that.fESDpid),
317 fBayesianResponse(NULL),
318 fPIDsource(that.fPIDsource),
321 fParticleID(that.fParticleID),
322 fParticleProbability(that.fParticleProbability),
323 fAllowTOFmismatchFlag(that.fAllowTOFmismatchFlag),
324 fRequireStrictTOFTPCagreement(that.fRequireStrictTOFTPCagreement),
325 fCutRejectElectronsWithTPCpid(that.fCutRejectElectronsWithTPCpid),
328 fV0gainEqualization(NULL),
329 fApplyRecentering(that.fApplyRecentering),
330 fV0gainEqualizationPerRing(that.fV0gainEqualizationPerRing)
333 printf(" \n\n claling copy ctor \n\n" );
334 if (that.fTPCpidCuts) fTPCpidCuts = new TMatrixF(*(that.fTPCpidCuts));
335 if (that.fTOFpidCuts) fTOFpidCuts = new TMatrixF(*(that.fTOFpidCuts));
336 if (that.fAliESDtrackCuts) fAliESDtrackCuts = new AliESDtrackCuts(*(that.fAliESDtrackCuts));
337 if (that.fMuonTrackCuts) fMuonTrackCuts = new AliMuonTrackCuts(*(that.fMuonTrackCuts)); // XZhang 20120604
338 SetPriors(); //init arrays
339 if (that.fQA) DefineHistograms();
341 // New PID procedure (Bayesian Combined PID)
342 fBayesianResponse = new AliFlowBayesianPID();
343 fBayesianResponse->SetNewTrackParam();
345 // V0 gain calibration
346 // no reason to init fV0gainEqualizationPerRing, will be initialized on node if necessary
347 // pointer is set to NULL in initialization list of this constructor
348 // if (that.fV0gainEqualization) fV0gainEqualization = new TH1(*(that.fV0gainEqualization));
349 for(Int_t i(0); i < 4; i++) { // no use to copy these guys since they're only initialized on worked node
353 for(Int_t i(0); i < 8; i++) fUseVZERORing[i] = that.fUseVZERORing[i];
357 //-----------------------------------------------------------------------
358 AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
361 if (this==&that) return *this;
363 AliFlowTrackSimpleCuts::operator=(that);
364 //the following may seem excessive but if AliESDtrackCuts properly does copy and clone
365 //this approach is better memory-fragmentation-wise in some cases
366 if (that.fAliESDtrackCuts && fAliESDtrackCuts) *fAliESDtrackCuts=*(that.fAliESDtrackCuts);
367 if (that.fAliESDtrackCuts && !fAliESDtrackCuts) fAliESDtrackCuts=new AliESDtrackCuts(*(that.fAliESDtrackCuts));
368 if (!that.fAliESDtrackCuts) delete fAliESDtrackCuts; fAliESDtrackCuts=NULL;
370 if ( that.fMuonTrackCuts && fMuonTrackCuts) *fMuonTrackCuts = *(that.fMuonTrackCuts); // XZhang 20120604
371 if ( that.fMuonTrackCuts && !fMuonTrackCuts) fMuonTrackCuts = new AliMuonTrackCuts(*(fMuonTrackCuts)); // XZhang 20120604
372 if (!that.fMuonTrackCuts) delete fMuonTrackCuts; fMuonTrackCuts = NULL; // XZhang 20120604
373 if (!that.fV0gainEqualization) delete fV0gainEqualization; fV0gainEqualization = NULL;
375 //these guys we don't need to copy, just reinit
376 if (that.fQA) {fQA->Delete(); delete fQA; fQA=NULL; DefineHistograms();}
378 fCutMChasTrackReferences=that.fCutMChasTrackReferences;
379 fCutMCprocessType=that.fCutMCprocessType;
380 fMCprocessType=that.fMCprocessType;
381 fCutMCPID=that.fCutMCPID;
383 fCutMCfirstMotherPID=that.fCutMCfirstMotherPID;
384 fMCfirstMotherPID=that.fMCfirstMotherPID;
385 fIgnoreSignInMCPID=that.fIgnoreSignInMCPID,
386 fCutMCisPrimary=that.fCutMCisPrimary;
387 fRequireTransportBitForPrimaries=that.fRequireTransportBitForPrimaries;
388 fMCisPrimary=that.fMCisPrimary;
389 fRequireCharge=that.fRequireCharge;
390 fFakesAreOK=that.fFakesAreOK;
391 fCutSPDtrackletDeltaPhi=that.fCutSPDtrackletDeltaPhi;
392 fSPDtrackletDeltaPhiMax=that.fSPDtrackletDeltaPhiMax;
393 fSPDtrackletDeltaPhiMin=that.fSPDtrackletDeltaPhiMin;
394 fIgnoreTPCzRange=that.fIgnoreTPCzRange;
395 fIgnoreTPCzRangeMax=that.fIgnoreTPCzRangeMax;
396 fIgnoreTPCzRangeMin=that.fIgnoreTPCzRangeMin;
397 fCutChi2PerClusterTPC=that.fCutChi2PerClusterTPC;
398 fMaxChi2PerClusterTPC=that.fMaxChi2PerClusterTPC;
399 fMinChi2PerClusterTPC=that.fMinChi2PerClusterTPC;
400 fCutNClustersTPC=that.fCutNClustersTPC;
401 fNClustersTPCMax=that.fNClustersTPCMax;
402 fNClustersTPCMin=that.fNClustersTPCMin;
403 fCutNClustersITS=that.fCutNClustersITS;
404 fNClustersITSMax=that.fNClustersITSMax;
405 fNClustersITSMin=that.fNClustersITSMin;
406 fUseAODFilterBit=that.fUseAODFilterBit;
407 fAODFilterBit=that.fAODFilterBit;
408 fCutDCAToVertexXY=that.fCutDCAToVertexXY;
409 fCutDCAToVertexZ=that.fCutDCAToVertexZ;
410 fCutMinimalTPCdedx=that.fCutMinimalTPCdedx;
411 fMinimalTPCdedx=that.fMinimalTPCdedx;
412 fLinearizeVZEROresponse=that.fLinearizeVZEROresponse;
413 fCutPmdDet=that.fCutPmdDet;
414 fPmdDet=that.fPmdDet;
415 fCutPmdAdc=that.fCutPmdAdc;
416 fPmdAdc=that.fPmdAdc;
417 fCutPmdNcell=that.fCutPmdNcell;
418 fPmdNcell=that.fPmdNcell;
419 fFlowTagType=that.fFlowTagType;
421 fParamType=that.fParamType;
422 fParamMix=that.fParamMix;
433 fESDpid = that.fESDpid;
434 fPIDsource = that.fPIDsource;
438 if (that.fTPCpidCuts) fTPCpidCuts = new TMatrixF(*(that.fTPCpidCuts));
439 if (that.fTOFpidCuts) fTOFpidCuts = new TMatrixF(*(that.fTOFpidCuts));
441 fParticleID=that.fParticleID;
442 fParticleProbability=that.fParticleProbability;
443 fAllowTOFmismatchFlag=that.fAllowTOFmismatchFlag;
444 fRequireStrictTOFTPCagreement=that.fRequireStrictTOFTPCagreement;
445 fCutRejectElectronsWithTPCpid=that.fCutRejectElectronsWithTPCpid;
446 fProbBayes = that.fProbBayes;
447 fCurrCentr = that.fCurrCentr;
449 fApplyRecentering = that.fApplyRecentering;
450 fV0gainEqualizationPerRing = that.fV0gainEqualizationPerRing;
451 #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
452 if (that.fV0gainEqualization) fV0gainEqualization = new TH1(*(that.fV0gainEqualization));
454 //PH Lets try Clone, however the result might be wrong
455 if (that.fV0gainEqualization) fV0gainEqualization = (TH1*)that.fV0gainEqualization->Clone();
457 for(Int_t i(0); i < 4; i++) { // no use to copy these guys since they're only initialized on worked node
458 fV0Apol[i] = that.fV0Apol[i];
459 fV0Cpol[i] = that.fV0Cpol[i];
461 for(Int_t i(0); i < 8; i++) fUseVZERORing[i] = that.fUseVZERORing[i];
466 //-----------------------------------------------------------------------
467 AliFlowTrackCuts::~AliFlowTrackCuts()
470 delete fAliESDtrackCuts;
473 if (fMuonTrackCuts) delete fMuonTrackCuts; // XZhang 20120604
474 if (fQA) { fQA->SetOwner(); fQA->Delete(); delete fQA; }
475 if (fV0gainEqualization) delete fV0gainEqualization;
478 //-----------------------------------------------------------------------
479 void AliFlowTrackCuts::SetEvent(AliVEvent* event, AliMCEvent* mcEvent)
486 //do the magic for ESD
487 AliESDEvent* myESD = dynamic_cast<AliESDEvent*>(event);
488 AliAODEvent* myAOD = dynamic_cast<AliAODEvent*>(event);
489 if (fCutPID && myESD)
491 //TODO: maybe call it only for the TOF options?
492 // Added by F. Noferini for TOF PID
493 // old procedure now implemented inside fBayesianResponse
494 // fESDpid.MakePID(myESD,kFALSE);
496 fBayesianResponse->SetDetResponse(myESD, fCurrCentr,AliESDpid::kTOF_T0,kTRUE); // centrality = PbPb centrality class (0-100%) or -1 for pp collisions
497 fESDpid.SetTOFResponse(myESD,AliESDpid::kTOF_T0);
498 // End F. Noferini added part
500 if (fCutPID && myAOD){
501 fBayesianResponse->SetDetResponse(myAOD, fCurrCentr,AliESDpid::kTOF_T0); // centrality = PbPb centrality class (0-100%) or -1 for pp collisions
502 if(myAOD->GetTOFHeader()){
503 fESDpid.SetTOFResponse(myAOD,AliESDpid::kTOF_T0);
505 else{ // corrected on the fly track by track if tof header is not present (old AODs)
507 // End F. Noferini added part
510 if(fPIDsource==kTOFbayesian) fBayesianResponse->SetDetAND(1);
511 else if(fPIDsource==kTPCbayesian) fBayesianResponse->ResetDetOR(1);
514 //-----------------------------------------------------------------------
515 void AliFlowTrackCuts::SetCutMC( Bool_t b )
517 //will we be cutting on MC information?
520 //if we cut on MC info then also the Bethe Bloch should be the one tuned for MC
523 fESDpid.GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
531 //-----------------------------------------------------------------------
532 Bool_t AliFlowTrackCuts::IsSelected(TObject* obj, Int_t id)
535 AliVParticle* vparticle = dynamic_cast<AliVParticle*>(obj);
536 //if (vparticle) return PassesCuts(vparticle); // XZhang 20120604
537 if (vparticle) { // XZhang 20120604
538 if (fParamType==kMUON) return PassesMuonCuts(vparticle); // XZhang 20120604
539 return PassesCuts(vparticle); // XZhang 20120604
542 AliFlowTrackSimple* flowtrack = dynamic_cast<AliFlowTrackSimple*>(obj);
543 if (flowtrack) return PassesCuts(flowtrack);
544 AliMultiplicity* tracklets = dynamic_cast<AliMultiplicity*>(obj);
545 if (tracklets) return PassesCuts(tracklets,id);
546 AliAODTracklets* trkletAOD = dynamic_cast<AliAODTracklets*>(obj); // XZhang 20120615
547 if (trkletAOD) return PassesCuts(trkletAOD,id); // XZhang 20120615
548 AliESDPmdTrack* pmdtrack = dynamic_cast<AliESDPmdTrack*>(obj);
549 if (pmdtrack) return PassesPMDcuts(pmdtrack);
550 AliVEvent* vvzero = dynamic_cast<AliVEvent*>(obj); // should be removed; left for protection only
551 if (vvzero) return PassesV0cuts(id);
552 return kFALSE; //default when passed wrong type of object
555 //-----------------------------------------------------------------------
556 Bool_t AliFlowTrackCuts::IsSelectedMCtruth(TObject* obj, Int_t id)
559 AliVParticle* vparticle = dynamic_cast<AliVParticle*>(obj);
562 return PassesMCcuts(fMCevent,(fFakesAreOK)?TMath::Abs(vparticle->GetLabel()):vparticle->GetLabel());
564 AliMultiplicity* tracklets = dynamic_cast<AliMultiplicity*>(obj);
567 Int_t label0 = tracklets->GetLabel(id,0);
568 Int_t label1 = tracklets->GetLabel(id,1);
569 Int_t label = (fFakesAreOK)?TMath::Abs(label0):label0;
570 if (label0!=label1) label = -666;
571 return PassesMCcuts(fMCevent,label);
573 return kFALSE; //default when passed wrong type of object
576 //-----------------------------------------------------------------------
577 Bool_t AliFlowTrackCuts::PassesCuts(const AliFlowTrackSimple* track)
579 //check cuts on a flowtracksimple
581 //clean up from last iteration
583 return AliFlowTrackSimpleCuts::PassesCuts(track);
586 //-----------------------------------------------------------------------
587 Bool_t AliFlowTrackCuts::PassesCuts(const AliMultiplicity* tracklet, Int_t id)
589 //check cuts on a tracklets
591 if (id<0) return kFALSE;
593 //clean up from last iteration, and init label
598 fTrackPhi = tracklet->GetPhi(id);
599 fTrackEta = tracklet->GetEta(id);
601 if (fCutEta) {if ( fTrackEta < fEtaMin || fTrackEta >= fEtaMax ) return kFALSE;}
602 if (fCutPhi) {if ( fTrackPhi < fPhiMin || fTrackPhi >= fPhiMax ) return kFALSE;}
604 //check MC info if available
605 //if the 2 clusters have different label track cannot be good
606 //and should therefore not pass the mc cuts
607 Int_t label0 = tracklet->GetLabel(id,0);
608 Int_t label1 = tracklet->GetLabel(id,1);
609 //if possible get label and mcparticle
610 fTrackLabel = (label0==label1)?tracklet->GetLabel(id,1):-1;
611 if (!fFakesAreOK && fTrackLabel<0) return kFALSE;
612 if (fTrackLabel>=0 && fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
614 if (fCutMC && !PassesMCcuts()) return kFALSE;
618 //-----------------------------------------------------------------------
619 Bool_t AliFlowTrackCuts::PassesCuts(const AliAODTracklets* tracklet, Int_t id)
622 //check cuts on a tracklets
624 if (id<0) return kFALSE;
626 //clean up from last iteration, and init label
631 fTrackPhi = tracklet->GetPhi(id);
632 //fTrackEta = tracklet->GetEta(id);
633 fTrackEta = -1.*TMath::Log(TMath::Tan(tracklet->GetTheta(id)/2.));
635 if (fCutEta) {if ( fTrackEta < fEtaMin || fTrackEta >= fEtaMax ) return kFALSE;}
636 if (fCutPhi) {if ( fTrackPhi < fPhiMin || fTrackPhi >= fPhiMax ) return kFALSE;}
638 //check MC info if available
639 //if the 2 clusters have different label track cannot be good
640 //and should therefore not pass the mc cuts
641 Int_t label0 = tracklet->GetLabel(id,0);
642 Int_t label1 = tracklet->GetLabel(id,1);
643 //if possible get label and mcparticle
644 fTrackLabel = (label0==label1)?tracklet->GetLabel(id,1):-1;
645 if (!fFakesAreOK && fTrackLabel<0) return kFALSE;
646 if (fTrackLabel>=0 && fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
648 if (fCutMC && !PassesMCcuts()) return kFALSE;
652 //-----------------------------------------------------------------------
653 Bool_t AliFlowTrackCuts::PassesMCcuts(AliMCEvent* mcEvent, Int_t label)
656 if (!mcEvent) return kFALSE;
657 if (label<0) return kFALSE;//otherwise AliCMevent prints a warning before returning NULL
658 AliMCParticle* mcparticle = static_cast<AliMCParticle*>(mcEvent->GetTrack(label));
659 if (!mcparticle) {AliError("no MC track"); return kFALSE;}
663 if (IsPhysicalPrimary(mcEvent,label,fRequireTransportBitForPrimaries) != fMCisPrimary) return kFALSE;
667 Int_t pdgCode = mcparticle->PdgCode();
668 if (fIgnoreSignInMCPID)
670 if (TMath::Abs(fMCPID) != TMath::Abs(pdgCode)) return kFALSE;
674 if (fMCPID != pdgCode) return kFALSE;
677 if (fCutMCfirstMotherPID)
680 TParticle* tparticle=mcparticle->Particle();
681 Int_t firstMotherLabel = 0;
682 if (tparticle) { firstMotherLabel = tparticle->GetFirstMother(); }
683 AliVParticle* firstMotherParticle = mcEvent->GetTrack(firstMotherLabel);
684 Int_t pdgcodeFirstMother = 0;
685 if (firstMotherParticle) { pdgcodeFirstMother = firstMotherParticle->PdgCode(); }
686 if (pdgcodeFirstMother != fMCfirstMotherPID) return kFALSE;
688 if ( fCutMCprocessType )
690 TParticle* particle = mcparticle->Particle();
691 Int_t processID = particle->GetUniqueID();
692 if (processID != fMCprocessType ) return kFALSE;
694 if (fCutMChasTrackReferences)
696 if (mcparticle->GetNumberOfTrackReferences()<1) return kFALSE;
701 //-----------------------------------------------------------------------
702 Bool_t AliFlowTrackCuts::PassesMCcuts()
705 if (!fMCevent) return kFALSE;
706 if (fTrackLabel<0) return kFALSE;//otherwise AliCMevent prints a warning before returning NULL
707 fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
708 return PassesMCcuts(fMCevent,fTrackLabel);
711 //-----------------------------------------------------------------------
712 Bool_t AliFlowTrackCuts::PassesCuts(AliVParticle* vparticle)
714 //check cuts for an ESD vparticle
716 ////////////////////////////////////////////////////////////////
717 // start by preparing the track parameters to cut on //////////
718 ////////////////////////////////////////////////////////////////
719 //clean up from last iteration
722 //get the label and the mc particle
723 fTrackLabel = (fFakesAreOK)?TMath::Abs(vparticle->GetLabel()):vparticle->GetLabel();
724 if (fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
725 else fMCparticle=NULL;
727 Bool_t isMCparticle = kFALSE; //some things are different for MC particles, check!
728 AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*>(vparticle);
729 AliAODTrack* aodTrack = NULL;
732 //for an ESD track we do some magic sometimes like constructing TPC only parameters
733 //or doing some hybrid, handle that here
734 HandleESDtrack(esdTrack);
738 HandleVParticle(vparticle);
739 //now check if produced particle is MC
740 isMCparticle = (dynamic_cast<AliMCParticle*>(fTrack))!=NULL;
741 aodTrack = dynamic_cast<AliAODTrack*>(vparticle); //keep the additional dynamic cast out of the way for ESDs
743 ////////////////////////////////////////////////////////////////
744 ////////////////////////////////////////////////////////////////
746 if (!fTrack) return kFALSE;
747 //because it may be different from global, not needed for aodTrack because we dont do anything funky there
748 if (esdTrack) esdTrack = static_cast<AliESDtrack*>(fTrack);
751 //check the common cuts for the current particle fTrack (MC,AOD,ESD)
752 Double_t pt = fTrack->Pt();
753 Double_t p = fTrack->P();
754 if (!fFakesAreOK) {if (fTrackLabel<0) pass=kFALSE;}
755 if (fCutPt) {if (pt < fPtMin || pt >= fPtMax ) pass=kFALSE;}
756 if (fCutEta) {if (fTrack->Eta() < fEtaMin || fTrack->Eta() >= fEtaMax ) pass=kFALSE;}
757 if (fCutPhi) {if (fTrack->Phi() < fPhiMin || fTrack->Phi() >= fPhiMax ) pass=kFALSE;}
758 if (fRequireCharge) {if (fTrack->Charge() == 0) pass=kFALSE;}
759 if (fCutCharge && !isMCparticle) {if (fTrack->Charge() != fCharge) pass=kFALSE;}
760 if (fCutCharge && isMCparticle)
762 //in case of an MC particle the charge is stored in units of 1/3|e|
763 Int_t charge = TMath::Nint(fTrack->Charge()/3.0); //mc particles have charge in units of 1/3e
764 if (charge!=fCharge) pass=kFALSE;
766 //if(fCutPID) {if (fTrack->PID() != fPID) pass=kFALSE;}
768 //when additionally MC info is required
769 if (fCutMC && !PassesMCcuts()) pass=kFALSE;
771 //the case of ESD or AOD
772 if (esdTrack) { if (!PassesESDcuts(esdTrack)) { pass=kFALSE; } }
773 if (aodTrack) { if (!PassesAODcuts(aodTrack,pass)) { pass=kFALSE; } }
779 TParticle* tparticle=fMCparticle->Particle();
780 Int_t processID = tparticle->GetUniqueID();
781 Int_t firstMotherLabel = tparticle->GetFirstMother();
782 Bool_t primary = IsPhysicalPrimary();
784 //mcparticle->Particle()->ProductionVertex(v);
785 //Double_t prodvtxX = v.X();
786 //Double_t prodvtxY = v.Y();
788 Int_t pdgcode = fMCparticle->PdgCode();
789 AliVParticle* firstMotherParticle = fMCevent->GetTrack(firstMotherLabel);
790 Int_t pdgcodeFirstMother = 0;
791 if (firstMotherParticle) {pdgcodeFirstMother = firstMotherParticle->PdgCode();}
794 switch (TMath::Abs(pdgcode))
797 pdg = AliPID::kElectron + 0.5; break;
799 pdg = AliPID::kMuon + 0.5; break;
801 pdg = AliPID::kPion + 0.5; break;
803 pdg = AliPID::kKaon + 0.5; break;
805 pdg = AliPID::kProton + 0.5; break;
807 pdg = AliPID::kUnknown + 0.5; break;
809 pdg = TMath::Sign(pdg,static_cast<Float_t>(pdgcode));
811 Float_t geantCode = 0;
812 switch (pdgcodeFirstMother)
823 case 12: case 14: case 16: //#nu
827 geantCode=5; //#mu^{+}
830 geantCode=6; //#mu^{-}
841 case 130: //K^{0}_{L}
857 geantCode=15; //#bar{p}
860 geantCode=16; //K^{0}_{S}
866 geantCode=18; //#Lambda
869 geantCode=19; //#Sigma^{+}
872 geantCode=20; //#Sigma^{0}
875 geantCode=21; //#Sigma^{-}
878 geantCode=22; //#Theta^{0}
881 geantCode=23; //#Theta^{-}
884 geantCode=24; //#Omega^{-}
887 geantCode=25; //#bar{n}
890 geantCode=26; //#bar{#Lambda}
893 geantCode=27; //#bar{#Sigma}^{-}
896 geantCode=28; //#bar{#Sigma}^{0}
899 geantCode=29; //#bar{#Sigma}^{+}
902 geantCode=30; //#bar{#Theta}^{0}
905 geantCode=31; //#bar{#Theta}^{+}
908 geantCode=32; //#bar{#Omega}^{+}
911 geantCode=33; //#tau^{+}
914 geantCode=34; //#tau^{-}
917 geantCode=35; //D^{+}
920 geantCode=36; //D^{-}
923 geantCode=37; //D^{0}
926 geantCode=38; //#bar{D}^{0}
929 geantCode=39; //D_{s}^{+}
932 geantCode=40; //#bar{D_{s}}^{-}
935 geantCode=41; //#Lambda_{c}^{+}
938 geantCode=42; //W^{+}
941 geantCode=43; //W^{-}
944 geantCode=44; //Z^{0}
951 QAbefore(2)->Fill(p,pdg);
952 QAbefore(3)->Fill(p,primary?0.5:-0.5);
953 QAbefore(4)->Fill(p,static_cast<Float_t>(processID));
954 QAbefore(7)->Fill(p,geantCode+0.5);
955 if (pass) QAafter(2)->Fill(p,pdg);
956 if (pass) QAafter(3)->Fill(p,primary?0.5:-0.5);
957 if (pass) QAafter(4)->Fill(p,static_cast<Float_t>(processID));
958 if (pass) QAafter(7)->Fill(p,geantCode);
962 //true by default, if we didn't set any cuts
966 //_______________________________________________________________________
967 Bool_t AliFlowTrackCuts::PassesAODcuts(const AliAODTrack* track, Bool_t passedFid)
970 Bool_t pass = passedFid;
972 if (fCutNClustersTPC)
974 Int_t ntpccls = track->GetTPCNcls();
975 if (ntpccls < fNClustersTPCMin || ntpccls > fNClustersTPCMax) pass=kFALSE;
978 if (fCutNClustersITS)
980 Int_t nitscls = track->GetITSNcls();
981 if (nitscls < fNClustersITSMin || nitscls > fNClustersITSMax) pass=kFALSE;
984 if (fCutChi2PerClusterTPC)
986 Double_t chi2tpc = track->Chi2perNDF();
987 if (chi2tpc < fMinChi2PerClusterTPC || chi2tpc > fMaxChi2PerClusterTPC) pass=kFALSE;
990 if (GetRequireTPCRefit() && !(track->GetStatus() & AliESDtrack::kTPCrefit) ) pass=kFALSE;
991 if (GetRequireITSRefit() && !(track->GetStatus() & AliESDtrack::kITSrefit) ) pass=kFALSE;
993 if (fUseAODFilterBit && !track->TestFilterBit(fAODFilterBit)) pass=kFALSE;
995 if (fCutDCAToVertexXY && track->DCA()>GetMaxDCAToVertexXY()) pass=kFALSE;
997 if (fCutDCAToVertexZ && track->ZAtDCA()>GetMaxDCAToVertexZ()) pass=kFALSE;
999 Double_t dedx = track->GetTPCsignal();
1000 if (dedx < fMinimalTPCdedx) pass=kFALSE;
1002 track->GetIntegratedTimes(time);
1004 Double_t momTPC = track->GetTPCmomentum();
1005 QAbefore( 1)->Fill(momTPC,dedx);
1006 QAbefore( 5)->Fill(track->Pt(),track->DCA());
1007 QAbefore( 6)->Fill(track->Pt(),track->ZAtDCA());
1008 if (pass) QAafter( 1)->Fill(momTPC,dedx);
1009 if (pass) QAafter( 5)->Fill(track->Pt(),track->DCA());
1010 if (pass) QAafter( 6)->Fill(track->Pt(),track->ZAtDCA());
1011 QAbefore( 8)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kElectron]));
1012 if (pass) QAafter( 8)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kElectron]));
1013 QAbefore( 9)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kMuon]));
1014 if (pass) QAafter( 9)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kMuon]));
1015 QAbefore(10)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kPion]));
1016 if (pass) QAafter( 10)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kPion]));
1017 QAbefore(11)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kKaon]));
1018 if (pass) QAafter( 11)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kKaon]));
1019 QAbefore(12)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kProton]));
1020 if (pass) QAafter( 12)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kProton]));
1023 if (fCutPID && (fParticleID!=AliPID::kUnknown)) //if kUnknown don't cut on PID
1025 if (!PassesAODpidCut(track)) pass=kFALSE;
1031 //_______________________________________________________________________
1032 Bool_t AliFlowTrackCuts::PassesESDcuts(AliESDtrack* track)
1034 //check cuts on ESD tracks
1038 track->GetImpactParameters(dcaxy,dcaz);
1039 const AliExternalTrackParam* pout = track->GetOuterParam();
1040 const AliExternalTrackParam* pin = track->GetInnerParam();
1041 if (fIgnoreTPCzRange)
1045 Double_t zin = pin->GetZ();
1046 Double_t zout = pout->GetZ();
1047 if (zin*zout<0) pass=kFALSE; //reject if cross the membrane
1048 if (zin < fIgnoreTPCzRangeMin || zin > fIgnoreTPCzRangeMax) pass=kFALSE;
1049 if (zout < fIgnoreTPCzRangeMin || zout > fIgnoreTPCzRangeMax) pass=kFALSE;
1053 Int_t ntpccls = ( fParamType==kTPCstandalone )?
1054 track->GetTPCNclsIter1():track->GetTPCNcls();
1055 if (fCutChi2PerClusterTPC)
1057 Float_t tpcchi2 = (fParamType==kTPCstandalone)?
1058 track->GetTPCchi2Iter1():track->GetTPCchi2();
1059 tpcchi2 = (ntpccls>0)?tpcchi2/ntpccls:-FLT_MAX;
1060 if (tpcchi2<fMinChi2PerClusterTPC || tpcchi2 >=fMaxChi2PerClusterTPC)
1064 if (fCutMinimalTPCdedx)
1066 if (track->GetTPCsignal() < fMinimalTPCdedx) pass=kFALSE;
1069 if (fCutNClustersTPC)
1071 if (ntpccls < fNClustersTPCMin || ntpccls > fNClustersTPCMax) pass=kFALSE;
1074 Int_t nitscls = track->GetNcls(0);
1075 if (fCutNClustersITS)
1077 if (nitscls < fNClustersITSMin || nitscls > fNClustersITSMax) pass=kFALSE;
1080 //some stuff is still handled by AliESDtrackCuts class - delegate
1081 if (fAliESDtrackCuts)
1083 if (!fAliESDtrackCuts->IsSelected(track)) pass=kFALSE;
1086 //PID part with pid QA
1087 Double_t beta = GetBeta(track);
1088 Double_t dedx = Getdedx(track);
1091 if (pass) QAbefore(0)->Fill(track->GetP(),beta);
1092 if (pass) QAbefore(1)->Fill(pin->GetP(),dedx);
1094 if (fCutPID && (fParticleID!=AliPID::kUnknown)) //if kUnknown don't cut on PID
1096 if (!PassesESDpidCut(track)) pass=kFALSE;
1098 if (fCutRejectElectronsWithTPCpid)
1100 //reject electrons using standard TPC pid
1101 //TODO this should be rethought....
1102 Double_t pidTPC[AliPID::kSPECIES];
1103 track->GetTPCpid(pidTPC);
1104 if (pidTPC[AliPID::kElectron]<fParticleProbability) pass=kFALSE;
1108 if (pass) QAafter(0)->Fill(track->GetP(),beta);
1109 if (pass) QAafter(1)->Fill(pin->GetP(),dedx);
1111 //end pid part with qa
1115 Double_t pt = track->Pt();
1116 QAbefore(5)->Fill(pt,dcaxy);
1117 QAbefore(6)->Fill(pt,dcaz);
1118 if (pass) QAafter(5)->Fill(pt,dcaxy);
1119 if (pass) QAafter(6)->Fill(pt,dcaz);
1125 //-----------------------------------------------------------------------
1126 void AliFlowTrackCuts::HandleVParticle(AliVParticle* track)
1128 //handle the general case
1137 //-----------------------------------------------------------------------
1138 void AliFlowTrackCuts::HandleESDtrack(AliESDtrack* track)
1146 case kTPCstandalone:
1147 if (!track->FillTPCOnlyTrack(fTPCtrack))
1154 fTrack = &fTPCtrack;
1155 //recalculate the label and mc particle, they may differ as TPClabel != global label
1156 fTrackLabel = (fFakesAreOK)?TMath::Abs(fTrack->GetLabel()):fTrack->GetLabel();
1157 if (fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
1158 else fMCparticle=NULL;
1166 //-----------------------------------------------------------------------
1167 Int_t AliFlowTrackCuts::Count(AliVEvent* event)
1169 //calculate the number of track in given event.
1170 //if argument is NULL(default) take the event attached
1172 Int_t multiplicity = 0;
1175 for (Int_t i=0; i<GetNumberOfInputObjects(); i++)
1177 if (IsSelected(GetInputObject(i))) multiplicity++;
1182 for (Int_t i=0; i<event->GetNumberOfTracks(); i++)
1184 if (IsSelected(event->GetTrack(i))) multiplicity++;
1187 return multiplicity;
1190 //-----------------------------------------------------------------------
1191 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts()
1193 //returns the lhc10h vzero track cuts, this function
1194 //is left here for backward compatibility
1195 //if a run is recognized as 11h, the calibration method will
1196 //switch to 11h calbiration, which means that the cut
1197 //object is updated but not replaced.
1198 //calibratin is only available for PbPb runs
1199 return GetStandardVZEROOnlyTrackCuts2010();
1201 //-----------------------------------------------------------------------
1202 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts2010()
1204 //get standard V0 cuts
1205 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard vzero flow cuts 2010");
1206 cuts->SetParamType(kV0);
1207 cuts->SetEtaRange( -10, +10 );
1208 cuts->SetPhiMin( 0 );
1209 cuts->SetPhiMax( TMath::TwoPi() );
1210 // options for the reweighting
1211 cuts->SetV0gainEqualizationPerRing(kFALSE);
1212 cuts->SetApplyRecentering(kTRUE);
1213 // to exclude a ring , do e.g.
1214 // cuts->SetUseVZERORing(7, kFALSE);
1217 //-----------------------------------------------------------------------
1218 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts2011()
1220 //get standard V0 cuts for 2011 data
1221 //in this case, the vzero segments will be weighted by
1222 //VZEROEqMultiplicity,
1223 //if recentering is enableded, the sub-q vectors
1224 //will be taken from the event header, so make sure to run
1225 //the VZERO event plane selection task before this task !
1226 //recentering replaces the already evaluated q-vectors, so
1227 //when chosen, additional settings (e.g. excluding rings)
1228 //have no effect. recentering is true by default
1230 //NOTE user is responsible for running the vzero event plane
1231 //selection task in advance, e.g. add to your launcher macro
1233 // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
1234 // AddTaskVZEROEPSelection();
1236 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard vzero flow cuts 2011");
1237 cuts->SetParamType(kV0);
1238 cuts->SetEtaRange( -10, +10 );
1239 cuts->SetPhiMin( 0 );
1240 cuts->SetPhiMax( TMath::TwoPi() );
1241 cuts->SetApplyRecentering(kTRUE);
1244 //-----------------------------------------------------------------------
1245 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardGlobalTrackCuts2010()
1248 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard Global tracks");
1249 cuts->SetParamType(kGlobal);
1250 cuts->SetPtRange(0.2,5.);
1251 cuts->SetEtaRange(-0.8,0.8);
1252 cuts->SetMinNClustersTPC(70);
1253 cuts->SetMinChi2PerClusterTPC(0.1);
1254 cuts->SetMaxChi2PerClusterTPC(4.0);
1255 cuts->SetMinNClustersITS(2);
1256 cuts->SetRequireITSRefit(kTRUE);
1257 cuts->SetRequireTPCRefit(kTRUE);
1258 cuts->SetMaxDCAToVertexXY(0.3);
1259 cuts->SetMaxDCAToVertexZ(0.3);
1260 cuts->SetAcceptKinkDaughters(kFALSE);
1261 cuts->SetMinimalTPCdedx(10.);
1266 //-----------------------------------------------------------------------
1267 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts2010()
1270 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard TPC standalone 2010");
1271 cuts->SetParamType(kTPCstandalone);
1272 cuts->SetPtRange(0.2,5.);
1273 cuts->SetEtaRange(-0.8,0.8);
1274 cuts->SetMinNClustersTPC(70);
1275 cuts->SetMinChi2PerClusterTPC(0.2);
1276 cuts->SetMaxChi2PerClusterTPC(4.0);
1277 cuts->SetMaxDCAToVertexXY(3.0);
1278 cuts->SetMaxDCAToVertexZ(3.0);
1279 cuts->SetDCAToVertex2D(kTRUE);
1280 cuts->SetAcceptKinkDaughters(kFALSE);
1281 cuts->SetMinimalTPCdedx(10.);
1286 //-----------------------------------------------------------------------
1287 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts()
1290 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard TPC standalone");
1291 cuts->SetParamType(kTPCstandalone);
1292 cuts->SetPtRange(0.2,5.);
1293 cuts->SetEtaRange(-0.8,0.8);
1294 cuts->SetMinNClustersTPC(70);
1295 cuts->SetMinChi2PerClusterTPC(0.2);
1296 cuts->SetMaxChi2PerClusterTPC(4.0);
1297 cuts->SetMaxDCAToVertexXY(3.0);
1298 cuts->SetMaxDCAToVertexZ(3.0);
1299 cuts->SetDCAToVertex2D(kTRUE);
1300 cuts->SetAcceptKinkDaughters(kFALSE);
1301 cuts->SetMinimalTPCdedx(10.);
1306 //-----------------------------------------------------------------------
1307 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries)
1310 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard global track cuts 2009");
1311 delete cuts->fAliESDtrackCuts;
1312 cuts->fAliESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selPrimaries);
1313 cuts->SetParamType(kGlobal);
1317 //-----------------------------------------------------------------------------
1318 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardMuonTrackCuts(Bool_t isMC, Int_t passN)
1321 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard muon track cuts");
1322 cuts->SetParamType(kMUON);
1323 cuts->SetStandardMuonTrackCuts();
1324 cuts->SetIsMuonMC(isMC);
1325 cuts->SetMuonPassNumber(passN);
1329 //-----------------------------------------------------------------------
1330 Bool_t AliFlowTrackCuts::FillFlowTrackGeneric(AliFlowTrack* flowtrack) const
1332 //fill a flow track from tracklet,vzero,pmd,...
1333 TParticle *tmpTParticle=NULL;
1334 AliMCParticle* tmpAliMCParticle=NULL;
1338 flowtrack->SetPhi(fTrackPhi);
1339 flowtrack->SetEta(fTrackEta);
1340 flowtrack->SetWeight(fTrackWeight);
1342 case kTrackWithMCkine:
1343 if (!fMCparticle) return kFALSE;
1344 flowtrack->SetPhi( fMCparticle->Phi() );
1345 flowtrack->SetEta( fMCparticle->Eta() );
1346 flowtrack->SetPt( fMCparticle->Pt() );
1348 case kTrackWithMCpt:
1349 if (!fMCparticle) return kFALSE;
1350 flowtrack->SetPhi(fTrackPhi);
1351 flowtrack->SetEta(fTrackEta);
1352 flowtrack->SetWeight(fTrackWeight);
1353 flowtrack->SetPt(fMCparticle->Pt());
1355 case kTrackWithPtFromFirstMother:
1356 if (!fMCparticle) return kFALSE;
1357 flowtrack->SetPhi(fTrackPhi);
1358 flowtrack->SetEta(fTrackEta);
1359 flowtrack->SetWeight(fTrackWeight);
1360 tmpTParticle = fMCparticle->Particle();
1361 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
1362 flowtrack->SetPt(tmpAliMCParticle->Pt());
1365 flowtrack->SetPhi(fTrackPhi);
1366 flowtrack->SetEta(fTrackEta);
1367 flowtrack->SetWeight(fTrackWeight);
1370 flowtrack->SetSource(AliFlowTrack::kFromTracklet);
1374 //-----------------------------------------------------------------------
1375 Bool_t AliFlowTrackCuts::FillFlowTrackVParticle(AliFlowTrack* flowtrack) const
1377 //fill flow track from AliVParticle (ESD,AOD,MC)
1378 if (!fTrack) return kFALSE;
1379 TParticle *tmpTParticle=NULL;
1380 AliMCParticle* tmpAliMCParticle=NULL;
1381 AliExternalTrackParam* externalParams=NULL;
1382 AliESDtrack* esdtrack=NULL;
1386 flowtrack->Set(fTrack);
1388 case kTrackWithMCkine:
1389 flowtrack->Set(fMCparticle);
1391 case kTrackWithMCPID:
1392 flowtrack->Set(fTrack);
1393 //flowtrack->setPID(...) from mc, when implemented
1395 case kTrackWithMCpt:
1396 if (!fMCparticle) return kFALSE;
1397 flowtrack->Set(fTrack);
1398 flowtrack->SetPt(fMCparticle->Pt());
1400 case kTrackWithPtFromFirstMother:
1401 if (!fMCparticle) return kFALSE;
1402 flowtrack->Set(fTrack);
1403 tmpTParticle = fMCparticle->Particle();
1404 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
1405 flowtrack->SetPt(tmpAliMCParticle->Pt());
1407 case kTrackWithTPCInnerParams:
1408 esdtrack = dynamic_cast<AliESDtrack*>(fTrack);
1409 if (!esdtrack) return kFALSE;
1410 externalParams = const_cast<AliExternalTrackParam*>(esdtrack->GetTPCInnerParam());
1411 if (!externalParams) return kFALSE;
1412 flowtrack->Set(externalParams);
1415 flowtrack->Set(fTrack);
1418 if (fParamType==kMC)
1420 flowtrack->SetSource(AliFlowTrack::kFromMC);
1421 flowtrack->SetID(fTrackLabel);
1423 else if (dynamic_cast<AliESDtrack*>(fTrack))
1425 flowtrack->SetSource(AliFlowTrack::kFromESD);
1426 flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
1428 else if (dynamic_cast<AliESDMuonTrack*>(fTrack)) // XZhang 20120604
1429 { // XZhang 20120604
1430 flowtrack->SetSource(AliFlowTrack::kFromMUON); // XZhang 20120604
1431 flowtrack->SetID((Int_t)static_cast<AliESDMuonTrack*>(fTrack)->GetUniqueID()); // XZhang 20120604
1432 } // XZhang 20120604
1433 else if (dynamic_cast<AliAODTrack*>(fTrack))
1435 if (fParamType==kMUON) // XZhang 20120604
1436 flowtrack->SetSource(AliFlowTrack::kFromMUON); // XZhang 20120604
1437 else // XZhang 20120604
1438 flowtrack->SetSource(AliFlowTrack::kFromAOD); // XZhang 20120604
1439 flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
1441 else if (dynamic_cast<AliMCParticle*>(fTrack))
1443 flowtrack->SetSource(AliFlowTrack::kFromMC);
1444 flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
1449 //-----------------------------------------------------------------------
1450 Bool_t AliFlowTrackCuts::FillFlowTrack(AliFlowTrack* track) const
1452 //fill a flow track constructed from whatever we applied cuts on
1453 //return true on success
1457 return FillFlowTrackGeneric(track);
1459 return FillFlowTrackGeneric(track);
1461 return FillFlowTrackGeneric(track);
1463 return FillFlowTrackVParticle(track);
1467 //-----------------------------------------------------------------------
1468 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackSPDtracklet() const
1470 //make a flow track from tracklet
1471 AliFlowTrack* flowtrack=NULL;
1472 TParticle *tmpTParticle=NULL;
1473 AliMCParticle* tmpAliMCParticle=NULL;
1477 flowtrack = new AliFlowTrack();
1478 flowtrack->SetPhi(fTrackPhi);
1479 flowtrack->SetEta(fTrackEta);
1480 flowtrack->SetWeight(fTrackWeight);
1482 case kTrackWithMCkine:
1483 if (!fMCparticle) return NULL;
1484 flowtrack = new AliFlowTrack();
1485 flowtrack->SetPhi( fMCparticle->Phi() );
1486 flowtrack->SetEta( fMCparticle->Eta() );
1487 flowtrack->SetPt( fMCparticle->Pt() );
1489 case kTrackWithMCpt:
1490 if (!fMCparticle) return NULL;
1491 flowtrack = new AliFlowTrack();
1492 flowtrack->SetPhi(fTrackPhi);
1493 flowtrack->SetEta(fTrackEta);
1494 flowtrack->SetWeight(fTrackWeight);
1495 flowtrack->SetPt(fMCparticle->Pt());
1497 case kTrackWithPtFromFirstMother:
1498 if (!fMCparticle) return NULL;
1499 flowtrack = new AliFlowTrack();
1500 flowtrack->SetPhi(fTrackPhi);
1501 flowtrack->SetEta(fTrackEta);
1502 flowtrack->SetWeight(fTrackWeight);
1503 tmpTParticle = fMCparticle->Particle();
1504 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
1505 flowtrack->SetPt(tmpAliMCParticle->Pt());
1508 flowtrack = new AliFlowTrack();
1509 flowtrack->SetPhi(fTrackPhi);
1510 flowtrack->SetEta(fTrackEta);
1511 flowtrack->SetWeight(fTrackWeight);
1514 flowtrack->SetSource(AliFlowTrack::kFromTracklet);
1518 //-----------------------------------------------------------------------
1519 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackVParticle() const
1521 //make flow track from AliVParticle (ESD,AOD,MC)
1522 if (!fTrack) return NULL;
1523 AliFlowTrack* flowtrack=NULL;
1524 TParticle *tmpTParticle=NULL;
1525 AliMCParticle* tmpAliMCParticle=NULL;
1526 AliExternalTrackParam* externalParams=NULL;
1527 AliESDtrack* esdtrack=NULL;
1531 flowtrack = new AliFlowTrack(fTrack);
1533 case kTrackWithMCkine:
1534 flowtrack = new AliFlowTrack(fMCparticle);
1536 case kTrackWithMCPID:
1537 flowtrack = new AliFlowTrack(fTrack);
1538 //flowtrack->setPID(...) from mc, when implemented
1540 case kTrackWithMCpt:
1541 if (!fMCparticle) return NULL;
1542 flowtrack = new AliFlowTrack(fTrack);
1543 flowtrack->SetPt(fMCparticle->Pt());
1545 case kTrackWithPtFromFirstMother:
1546 if (!fMCparticle) return NULL;
1547 flowtrack = new AliFlowTrack(fTrack);
1548 tmpTParticle = fMCparticle->Particle();
1549 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
1550 flowtrack->SetPt(tmpAliMCParticle->Pt());
1552 case kTrackWithTPCInnerParams:
1553 esdtrack = dynamic_cast<AliESDtrack*>(fTrack);
1554 if (!esdtrack) return NULL;
1555 externalParams = const_cast<AliExternalTrackParam*>(esdtrack->GetTPCInnerParam());
1556 if (!externalParams) return NULL;
1557 flowtrack = new AliFlowTrack(externalParams);
1560 flowtrack = new AliFlowTrack(fTrack);
1563 if (fParamType==kMC)
1565 flowtrack->SetSource(AliFlowTrack::kFromMC);
1566 flowtrack->SetID(fTrackLabel);
1568 else if (dynamic_cast<AliESDtrack*>(fTrack))
1570 flowtrack->SetSource(AliFlowTrack::kFromESD);
1571 flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
1573 else if (dynamic_cast<AliAODTrack*>(fTrack))
1575 flowtrack->SetSource(AliFlowTrack::kFromAOD);
1576 flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
1578 else if (dynamic_cast<AliMCParticle*>(fTrack))
1580 flowtrack->SetSource(AliFlowTrack::kFromMC);
1581 flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
1586 //-----------------------------------------------------------------------
1587 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackPMDtrack() const
1589 //make a flow track from PMD track
1590 AliFlowTrack* flowtrack=NULL;
1591 TParticle *tmpTParticle=NULL;
1592 AliMCParticle* tmpAliMCParticle=NULL;
1596 flowtrack = new AliFlowTrack();
1597 flowtrack->SetPhi(fTrackPhi);
1598 flowtrack->SetEta(fTrackEta);
1599 flowtrack->SetWeight(fTrackWeight);
1601 case kTrackWithMCkine:
1602 if (!fMCparticle) return NULL;
1603 flowtrack = new AliFlowTrack();
1604 flowtrack->SetPhi( fMCparticle->Phi() );
1605 flowtrack->SetEta( fMCparticle->Eta() );
1606 flowtrack->SetWeight(fTrackWeight);
1607 flowtrack->SetPt( fMCparticle->Pt() );
1609 case kTrackWithMCpt:
1610 if (!fMCparticle) return NULL;
1611 flowtrack = new AliFlowTrack();
1612 flowtrack->SetPhi(fTrackPhi);
1613 flowtrack->SetEta(fTrackEta);
1614 flowtrack->SetWeight(fTrackWeight);
1615 flowtrack->SetPt(fMCparticle->Pt());
1617 case kTrackWithPtFromFirstMother:
1618 if (!fMCparticle) return NULL;
1619 flowtrack = new AliFlowTrack();
1620 flowtrack->SetPhi(fTrackPhi);
1621 flowtrack->SetEta(fTrackEta);
1622 flowtrack->SetWeight(fTrackWeight);
1623 tmpTParticle = fMCparticle->Particle();
1624 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
1625 flowtrack->SetPt(tmpAliMCParticle->Pt());
1628 flowtrack = new AliFlowTrack();
1629 flowtrack->SetPhi(fTrackPhi);
1630 flowtrack->SetEta(fTrackEta);
1631 flowtrack->SetWeight(fTrackWeight);
1635 flowtrack->SetSource(AliFlowTrack::kFromPMD);
1639 //-----------------------------------------------------------------------
1640 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackV0() const
1642 //make a flow track from V0
1643 AliFlowTrack* flowtrack=NULL;
1644 TParticle *tmpTParticle=NULL;
1645 AliMCParticle* tmpAliMCParticle=NULL;
1649 flowtrack = new AliFlowTrack();
1650 flowtrack->SetPhi(fTrackPhi);
1651 flowtrack->SetEta(fTrackEta);
1652 flowtrack->SetWeight(fTrackWeight);
1654 case kTrackWithMCkine:
1655 if (!fMCparticle) return NULL;
1656 flowtrack = new AliFlowTrack();
1657 flowtrack->SetPhi( fMCparticle->Phi() );
1658 flowtrack->SetEta( fMCparticle->Eta() );
1659 flowtrack->SetWeight(fTrackWeight);
1660 flowtrack->SetPt( fMCparticle->Pt() );
1662 case kTrackWithMCpt:
1663 if (!fMCparticle) return NULL;
1664 flowtrack = new AliFlowTrack();
1665 flowtrack->SetPhi(fTrackPhi);
1666 flowtrack->SetEta(fTrackEta);
1667 flowtrack->SetWeight(fTrackWeight);
1668 flowtrack->SetPt(fMCparticle->Pt());
1670 case kTrackWithPtFromFirstMother:
1671 if (!fMCparticle) return NULL;
1672 flowtrack = new AliFlowTrack();
1673 flowtrack->SetPhi(fTrackPhi);
1674 flowtrack->SetEta(fTrackEta);
1675 flowtrack->SetWeight(fTrackWeight);
1676 tmpTParticle = fMCparticle->Particle();
1677 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
1678 flowtrack->SetPt(tmpAliMCParticle->Pt());
1681 flowtrack = new AliFlowTrack();
1682 flowtrack->SetPhi(fTrackPhi);
1683 flowtrack->SetEta(fTrackEta);
1684 flowtrack->SetWeight(fTrackWeight);
1688 flowtrack->SetSource(AliFlowTrack::kFromV0);
1692 //-----------------------------------------------------------------------
1693 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrack() const
1695 //get a flow track constructed from whatever we applied cuts on
1696 //caller is resposible for deletion
1697 //if construction fails return NULL
1698 //TODO: for tracklets, PMD and V0 we probably need just one method,
1699 //something like MakeFlowTrackGeneric(), wait with this until
1700 //requirements quirks are known.
1704 return MakeFlowTrackSPDtracklet();
1706 return MakeFlowTrackPMDtrack();
1708 return MakeFlowTrackV0();
1710 return MakeFlowTrackVParticle();
1714 //-----------------------------------------------------------------------
1715 Bool_t AliFlowTrackCuts::IsPhysicalPrimary() const
1717 //check if current particle is a physical primary
1718 if (!fMCevent) return kFALSE;
1719 if (fTrackLabel<0) return kFALSE;
1720 return IsPhysicalPrimary(fMCevent, fTrackLabel, fRequireTransportBitForPrimaries);
1723 //-----------------------------------------------------------------------
1724 Bool_t AliFlowTrackCuts::IsPhysicalPrimary(AliMCEvent* mcEvent, Int_t label, Bool_t requiretransported)
1726 //check if current particle is a physical primary
1727 Bool_t physprim=mcEvent->IsPhysicalPrimary(label);
1728 AliMCParticle* track = static_cast<AliMCParticle*>(mcEvent->GetTrack(label));
1729 if (!track) return kFALSE;
1730 TParticle* particle = track->Particle();
1731 Bool_t transported = particle->TestBit(kTransportBit);
1732 //printf("label: %i prim: %s, transp: %s, pass: %s\n",label, (physprim)?"YES":"NO ",(transported)?"YES":"NO ",
1733 //(physprim && (transported || !requiretransported))?"YES":"NO" );
1734 return (physprim && (transported || !requiretransported));
1737 //-----------------------------------------------------------------------
1738 void AliFlowTrackCuts::DefineHistograms()
1740 //define qa histograms
1743 const Int_t kNbinsP=200;
1744 Double_t binsP[kNbinsP+1];
1746 for(int i=1; i<kNbinsP+1; i++)
1748 //if(binsP[i-1]+0.05<1.01)
1749 // binsP[i]=binsP[i-1]+0.05;
1751 binsP[i]=binsP[i-1]+0.05;
1754 const Int_t nBinsDCA=1000;
1755 Double_t binsDCA[nBinsDCA+1];
1756 for(int i=0; i<nBinsDCA+1; i++) {binsDCA[i]=0.01*i-5.;}
1757 //for(int i=1; i<41; i++) {binsDCA[i+100]=0.1*i+1.0;}
1759 Bool_t adddirstatus = TH1::AddDirectoryStatus();
1760 TH1::AddDirectory(kFALSE);
1761 fQA=new TList(); fQA->SetOwner();
1762 fQA->SetName(Form("%s QA",GetName()));
1763 TList* before = new TList(); before->SetOwner();
1764 before->SetName("before");
1765 TList* after = new TList(); after->SetOwner();
1766 after->SetName("after");
1769 before->Add(new TH2F("TOFbeta",";p [GeV/c];#beta",kNbinsP,binsP,1000,0.4,1.1)); //0
1770 after->Add(new TH2F("TOFbeta",";p [GeV/c];#beta",kNbinsP,binsP,1000,0.4,1.1)); //0
1771 before->Add(new TH2F("TPCdedx",";p [GeV/c];dEdx",kNbinsP,binsP,500,0,500)); //1
1772 after->Add(new TH2F("TPCdedx",";p [GeV/c];dEdx",kNbinsP,binsP,500,0,500)); //1
1773 before->Add(new TH2F("MC pid",";p[GeV/c];species",kNbinsP,binsP,10,-5, 5)); //2
1774 after->Add(new TH2F("MC pid",";p[GeV/c];species",kNbinsP,binsP,10,-5, 5)); //2
1776 TH2F* hb = new TH2F("MC primary",";p[GeV/c];primary",kNbinsP,binsP,2,-1,1);
1777 TH2F* ha = new TH2F("MC primary",";p[GeV/c];primary",kNbinsP,binsP,2,-1,1);
1779 axis = hb->GetYaxis();
1780 axis->SetBinLabel(1,"secondary");
1781 axis->SetBinLabel(2,"primary");
1782 axis = ha->GetYaxis();
1783 axis->SetBinLabel(1,"secondary");
1784 axis->SetBinLabel(2,"primary");
1785 before->Add(hb); //3
1787 //production process
1788 hb = new TH2F("MC production process",";p[GeV/c];",kNbinsP,binsP,kMaxMCProcess,
1789 -0.5, kMaxMCProcess-0.5);
1790 ha = new TH2F("MC production process",";p[GeV/c];",kNbinsP,binsP,kMaxMCProcess,
1791 -0.5, kMaxMCProcess-0.5);
1792 axis = hb->GetYaxis();
1793 for (Int_t i=0; i<kMaxMCProcess; i++)
1795 axis->SetBinLabel(i+1,TMCProcessName[i]);
1797 axis = ha->GetYaxis();
1798 for (Int_t i=0; i<kMaxMCProcess; i++)
1800 axis->SetBinLabel(i+1,TMCProcessName[i]);
1802 before->Add(hb); //4
1805 before->Add(new TH2F("DCAxy",";p_{t}[GeV/c];DCAxy[cm]", 100, 0., 10., nBinsDCA, binsDCA));//5
1806 after->Add(new TH2F("DCAxy",";p_{t}[GeV/c];DCAxy[cm]", 100, 0., 10., nBinsDCA, binsDCA));//5
1807 before->Add(new TH2F("DCAz",";p_{t}[GeV/c];DCAz[cm]", 100, 0., 10., nBinsDCA, binsDCA));//6
1808 after->Add(new TH2F("DCAz",";p_{t}[GeV/c];DCAz[cm]", 100, 0., 10., nBinsDCA, binsDCA));//6
1810 hb = new TH2F("MC first mother",";p[GeV/c];",kNbinsP,binsP,44,1.,45.);
1811 ha = new TH2F("MC first mother",";p[GeV/c];",kNbinsP,binsP,44,1.,45.);
1812 hb->GetYaxis()->SetBinLabel(1, "#gamma");
1813 ha->GetYaxis()->SetBinLabel(1, "#gamma");
1814 hb->GetYaxis()->SetBinLabel(2, "e^{+}");
1815 ha->GetYaxis()->SetBinLabel(2, "e^{+}");
1816 hb->GetYaxis()->SetBinLabel(3, "e^{-}");
1817 ha->GetYaxis()->SetBinLabel(3, "e^{-}");
1818 hb->GetYaxis()->SetBinLabel(4, "#nu");
1819 ha->GetYaxis()->SetBinLabel(4, "#nu");
1820 hb->GetYaxis()->SetBinLabel(5, "#mu^{+}");
1821 ha->GetYaxis()->SetBinLabel(5, "#mu^{+}");
1822 hb->GetYaxis()->SetBinLabel(6, "#mu^{-}");
1823 ha->GetYaxis()->SetBinLabel(6, "#mu^{-}");
1824 hb->GetYaxis()->SetBinLabel(7, "#pi^{0}");
1825 ha->GetYaxis()->SetBinLabel(7, "#pi^{0}");
1826 hb->GetYaxis()->SetBinLabel(8, "#pi^{+}");
1827 ha->GetYaxis()->SetBinLabel(8, "#pi^{+}");
1828 hb->GetYaxis()->SetBinLabel(9, "#pi^{-}");
1829 ha->GetYaxis()->SetBinLabel(9, "#pi^{-}");
1830 hb->GetYaxis()->SetBinLabel(10, "K^{0}_{L}");
1831 ha->GetYaxis()->SetBinLabel(10, "K^{0}_{L}");
1832 hb->GetYaxis()->SetBinLabel(11, "K^{+}");
1833 ha->GetYaxis()->SetBinLabel(11, "K^{+}");
1834 hb->GetYaxis()->SetBinLabel(12, "K^{-}");
1835 ha->GetYaxis()->SetBinLabel(12, "K^{-}");
1836 hb->GetYaxis()->SetBinLabel( 13, "n");
1837 ha->GetYaxis()->SetBinLabel( 13, "n");
1838 hb->GetYaxis()->SetBinLabel( 14, "p");
1839 ha->GetYaxis()->SetBinLabel( 14, "p");
1840 hb->GetYaxis()->SetBinLabel(15, "#bar{p}");
1841 ha->GetYaxis()->SetBinLabel(15, "#bar{p}");
1842 hb->GetYaxis()->SetBinLabel(16, "K^{0}_{S}");
1843 ha->GetYaxis()->SetBinLabel(16, "K^{0}_{S}");
1844 hb->GetYaxis()->SetBinLabel(17, "#eta");
1845 ha->GetYaxis()->SetBinLabel(17, "#eta");
1846 hb->GetYaxis()->SetBinLabel(18, "#Lambda");
1847 ha->GetYaxis()->SetBinLabel(18, "#Lambda");
1848 hb->GetYaxis()->SetBinLabel(19, "#Sigma^{+}");
1849 ha->GetYaxis()->SetBinLabel(19, "#Sigma^{+}");
1850 hb->GetYaxis()->SetBinLabel(20, "#Sigma^{0}");
1851 ha->GetYaxis()->SetBinLabel(20, "#Sigma^{0}");
1852 hb->GetYaxis()->SetBinLabel(21, "#Sigma^{-}");
1853 ha->GetYaxis()->SetBinLabel(21, "#Sigma^{-}");
1854 hb->GetYaxis()->SetBinLabel(22, "#Theta^{0}");
1855 ha->GetYaxis()->SetBinLabel(22, "#Theta^{0}");
1856 hb->GetYaxis()->SetBinLabel(23, "#Theta^{-}");
1857 ha->GetYaxis()->SetBinLabel(23, "#Theta^{-}");
1858 hb->GetYaxis()->SetBinLabel(24, "#Omega^{-}");
1859 ha->GetYaxis()->SetBinLabel(24, "#Omega^{-}");
1860 hb->GetYaxis()->SetBinLabel(25, "#bar{n}");
1861 ha->GetYaxis()->SetBinLabel(25, "#bar{n}");
1862 hb->GetYaxis()->SetBinLabel(26, "#bar{#Lambda}");
1863 ha->GetYaxis()->SetBinLabel(26, "#bar{#Lambda}");
1864 hb->GetYaxis()->SetBinLabel(27, "#bar{#Sigma}^{-}");
1865 ha->GetYaxis()->SetBinLabel(27, "#bar{#Sigma}^{-}");
1866 hb->GetYaxis()->SetBinLabel(28, "#bar{#Sigma}^{0}");
1867 ha->GetYaxis()->SetBinLabel(28, "#bar{#Sigma}^{0}");
1868 hb->GetYaxis()->SetBinLabel(29, "#bar{#Sigma}^{+}");
1869 ha->GetYaxis()->SetBinLabel(29, "#bar{#Sigma}^{+}");
1870 hb->GetYaxis()->SetBinLabel(30, "#bar{#Theta}^{0}");
1871 ha->GetYaxis()->SetBinLabel(30, "#bar{#Theta}^{0}");
1872 hb->GetYaxis()->SetBinLabel(31, "#bar{#Theta}^{+}");
1873 ha->GetYaxis()->SetBinLabel(31, "#bar{#Theta}^{+}");
1874 hb->GetYaxis()->SetBinLabel(32, "#bar{#Omega}^{+}");
1875 ha->GetYaxis()->SetBinLabel(32, "#bar{#Omega}^{+}");
1876 hb->GetYaxis()->SetBinLabel(33, "#tau^{+}");
1877 ha->GetYaxis()->SetBinLabel(33, "#tau^{+}");
1878 hb->GetYaxis()->SetBinLabel(34, "#tau^{-}");
1879 ha->GetYaxis()->SetBinLabel(34, "#tau^{-}");
1880 hb->GetYaxis()->SetBinLabel(35, "D^{+}");
1881 ha->GetYaxis()->SetBinLabel(35, "D^{+}");
1882 hb->GetYaxis()->SetBinLabel(36, "D^{-}");
1883 ha->GetYaxis()->SetBinLabel(36, "D^{-}");
1884 hb->GetYaxis()->SetBinLabel(37, "D^{0}");
1885 ha->GetYaxis()->SetBinLabel(37, "D^{0}");
1886 hb->GetYaxis()->SetBinLabel(38, "#bar{D}^{0}");
1887 ha->GetYaxis()->SetBinLabel(38, "#bar{D}^{0}");
1888 hb->GetYaxis()->SetBinLabel(39, "D_{s}^{+}");
1889 ha->GetYaxis()->SetBinLabel(39, "D_{s}^{+}");
1890 hb->GetYaxis()->SetBinLabel(40, "#bar{D_{s}}^{-}");
1891 ha->GetYaxis()->SetBinLabel(40, "#bar{D_{s}}^{-}");
1892 hb->GetYaxis()->SetBinLabel(41, "#Lambda_{c}^{+}");
1893 ha->GetYaxis()->SetBinLabel(41, "#Lambda_{c}^{+}");
1894 hb->GetYaxis()->SetBinLabel(42, "W^{+}");
1895 ha->GetYaxis()->SetBinLabel(42, "W^{+}");
1896 hb->GetYaxis()->SetBinLabel(43, "W^{-}");
1897 ha->GetYaxis()->SetBinLabel(43, "W^{-}");
1898 hb->GetYaxis()->SetBinLabel(44, "Z^{0}");
1899 ha->GetYaxis()->SetBinLabel(44, "Z^{0}");
1903 before->Add(new TH2F("TOFkElectron",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//8
1904 after->Add( new TH2F("TOFkElectron",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//8
1906 before->Add(new TH2F("TOFkMuon",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//9
1907 after->Add( new TH2F("TOFkMuon",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//9
1909 before->Add(new TH2F("TOFkPion",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//10
1910 after->Add( new TH2F("TOFkPion",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//10
1912 before->Add(new TH2F("TOFkKaon",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//11
1913 after->Add( new TH2F("TOFkKaon",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//11
1915 before->Add(new TH2F("TOFkProton",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//12
1916 after->Add( new TH2F("TOFkProton",";p_{t}[GeV/c];TOF signal - IT", kNbinsP,binsP,1000,-2e4, 2e4));//12
1918 TH1::AddDirectory(adddirstatus);
1921 //-----------------------------------------------------------------------
1922 Int_t AliFlowTrackCuts::GetNumberOfInputObjects() const
1924 //get the number of tracks in the input event according source
1925 //selection (ESD tracks, tracklets, MC particles etc.)
1926 AliESDEvent* esd=NULL;
1927 AliAODEvent* aod=NULL; // XZhang 20120615
1931 if (!fEvent) return 0; // XZhang 20120615
1932 esd = dynamic_cast<AliESDEvent*>(fEvent);
1933 aod = dynamic_cast<AliAODEvent*>(fEvent); // XZhang 20120615
1934 // if (!esd) return 0; // XZhang 20120615
1935 // return esd->GetMultiplicity()->GetNumberOfTracklets(); // XZhang 20120615
1936 if (esd) return esd->GetMultiplicity()->GetNumberOfTracklets(); // XZhang 20120615
1937 if (aod) return aod->GetTracklets()->GetNumberOfTracklets(); // XZhang 20120615
1939 if (!fMCevent) return 0;
1940 return fMCevent->GetNumberOfTracks();
1942 esd = dynamic_cast<AliESDEvent*>(fEvent);
1944 return esd->GetNumberOfPmdTracks();
1946 return fgkNumberOfV0tracks;
1947 case kMUON: // XZhang 20120604
1948 if (!fEvent) return 0; // XZhang 20120604
1949 esd = dynamic_cast<AliESDEvent*>(fEvent); // XZhang 20120604
1950 if (esd) return esd->GetNumberOfMuonTracks(); // XZhang 20120604
1951 return fEvent->GetNumberOfTracks(); // if AOD // XZhang 20120604
1953 if (!fEvent) return 0;
1954 return fEvent->GetNumberOfTracks();
1959 //-----------------------------------------------------------------------
1960 TObject* AliFlowTrackCuts::GetInputObject(Int_t i)
1962 //get the input object according the data source selection:
1963 //(esd tracks, traclets, mc particles,etc...)
1964 AliESDEvent* esd=NULL;
1965 AliAODEvent* aod=NULL; // XZhang 20120615
1969 if (!fEvent) return NULL; // XZhang 20120615
1970 esd = dynamic_cast<AliESDEvent*>(fEvent);
1971 aod = dynamic_cast<AliAODEvent*>(fEvent); // XZhang 20120615
1972 // if (!esd) return NULL; // XZhang 20120615
1973 // return const_cast<AliMultiplicity*>(esd->GetMultiplicity()); // XZhang 20120615
1974 if (esd) return const_cast<AliMultiplicity*>(esd->GetMultiplicity()); // XZhang 20120615
1975 if (aod) return const_cast<AliAODTracklets*>(aod->GetTracklets()); // XZhang 20120615
1977 if (!fMCevent) return NULL;
1978 return fMCevent->GetTrack(i);
1980 esd = dynamic_cast<AliESDEvent*>(fEvent);
1981 if (!esd) return NULL;
1982 return esd->GetPmdTrack(i);
1984 //esd = dynamic_cast<AliESDEvent*>(fEvent);
1985 //if (!esd) //contributed by G.Ortona
1987 // AliAODEvent* aod = dynamic_cast<AliAODEvent*>(fEvent);
1988 // if(!aod)return NULL;
1989 // return aod->GetVZEROData();
1991 //return esd->GetVZEROData();
1992 return fEvent; // left only for compatibility
1993 case kMUON: // XZhang 20120604
1994 if (!fEvent) return NULL; // XZhang 20120604
1995 esd = dynamic_cast<AliESDEvent*>(fEvent); // XZhang 20120604
1996 if (esd) return esd->GetMuonTrack(i); // XZhang 20120604
1997 return fEvent->GetTrack(i); // if AOD // XZhang 20120604
1999 if (!fEvent) return NULL;
2000 return fEvent->GetTrack(i);
2004 //-----------------------------------------------------------------------
2005 void AliFlowTrackCuts::Clear(Option_t*)
2016 //-----------------------------------------------------------------------
2017 Bool_t AliFlowTrackCuts::PassesAODpidCut(const AliAODTrack* track )
2019 if(!track->GetAODEvent()->GetTOFHeader()){
2020 AliAODPid *pidObj = track->GetDetPid();
2021 if (!pidObj) fESDpid.GetTOFResponse().SetTimeResolution(84.);
2023 Double_t sigmaTOFPidInAOD[10];
2024 pidObj->GetTOFpidResolution(sigmaTOFPidInAOD);
2025 if(sigmaTOFPidInAOD[0] > 84.){
2026 fESDpid.GetTOFResponse().SetTimeResolution(sigmaTOFPidInAOD[0]); // use the electron TOF PID sigma as time resolution (including the T0 used)
2031 //check if passes the selected pid cut for ESDs
2032 Bool_t pass = kTRUE;
2036 if (!PassesTOFbetaCut(track)) pass=kFALSE;
2039 if (!PassesTOFbayesianCut(track)) pass=kFALSE;
2042 if (!PassesTPCbayesianCut(track)) pass=kFALSE;
2051 //-----------------------------------------------------------------------
2052 Bool_t AliFlowTrackCuts::PassesESDpidCut(const AliESDtrack* track )
2054 //check if passes the selected pid cut for ESDs
2055 Bool_t pass = kTRUE;
2059 if (!PassesTPCpidCut(track)) pass=kFALSE;
2062 if (!PassesTPCdedxCut(track)) pass=kFALSE;
2065 if (!PassesTOFpidCut(track)) pass=kFALSE;
2068 if (!PassesTOFbetaCut(track)) pass=kFALSE;
2070 case kTOFbetaSimple:
2071 if (!PassesTOFbetaSimpleCut(track)) pass=kFALSE;
2074 if (!PassesTPCbayesianCut(track)) pass=kFALSE;
2076 // part added by F. Noferini
2078 if (!PassesTOFbayesianCut(track)) pass=kFALSE;
2080 // end part added by F. Noferini
2082 //part added by Natasha
2084 if (!PassesNucleiSelection(track)) pass=kFALSE;
2086 //end part added by Natasha
2089 printf("AliFlowTrackCuts::PassesCuts() this should never be called!\n");
2096 //-----------------------------------------------------------------------
2097 Bool_t AliFlowTrackCuts::PassesTOFbetaSimpleCut(const AliESDtrack* track )
2099 //check if passes PID cut using timing in TOF
2100 Bool_t goodtrack = (track->GetStatus() & AliESDtrack::kTOFpid) &&
2101 (track->GetTOFsignal() > 12000) &&
2102 (track->GetTOFsignal() < 100000) &&
2103 (track->GetIntegratedLength() > 365);
2105 if (!fAllowTOFmismatchFlag) {if ((track->GetStatus() & AliESDtrack::kTOFmismatch)) return kFALSE;}
2107 Bool_t statusMatchingHard = TPCTOFagree(track);
2108 if (fRequireStrictTOFTPCagreement && (!statusMatchingHard))
2111 if (!goodtrack) return kFALSE;
2113 const Float_t c = 2.99792457999999984e-02;
2114 Float_t p = track->GetP();
2115 Float_t l = track->GetIntegratedLength();
2116 Float_t trackT0 = fESDpid.GetTOFResponse().GetStartTime(p);
2117 Float_t timeTOF = track->GetTOFsignal()- trackT0;
2118 Float_t beta = l/timeTOF/c;
2119 Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
2120 track->GetIntegratedTimes(integratedTimes);
2121 Float_t betaHypothesis[5] = {0.0,0.0,0.0,0.0,0.0};
2122 Float_t s[5] = {0.0,0.0,0.0,0.0,0.0};
2123 for (Int_t i=0;i<5;i++)
2125 betaHypothesis[i] = l/integratedTimes[i]/c;
2126 s[i] = beta-betaHypothesis[i];
2129 switch (fParticleID)
2132 return ( (s[2]<0.015) && (s[2]>-0.015) &&
2136 return ( (s[3]<0.015) && (s[3]>-0.015) &&
2139 case AliPID::kProton:
2140 return ( (s[4]<0.015) && (s[4]>-0.015) &&
2149 //-----------------------------------------------------------------------
2150 Float_t AliFlowTrackCuts::GetBeta(const AliVTrack* track)
2153 Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
2154 track->GetIntegratedTimes(integratedTimes);
2156 const Float_t c = 2.99792457999999984e-02;
2157 Float_t p = track->P();
2158 Float_t l = integratedTimes[0]*c;
2159 Float_t trackT0 = fESDpid.GetTOFResponse().GetStartTime(p);
2160 Float_t timeTOF = track->GetTOFsignal()- trackT0;
2163 //-----------------------------------------------------------------------
2164 Bool_t AliFlowTrackCuts::PassesTOFbetaCut(const AliAODTrack* track )
2166 //check if track passes pid selection with an asymmetric TOF beta cut
2169 //printf("no TOFpidCuts\n");
2173 //check if passes PID cut using timing in TOF
2174 Bool_t goodtrack = (track->GetStatus() & AliESDtrack::kTOFpid) &&
2175 (track->GetTOFsignal() > 12000) &&
2176 (track->GetTOFsignal() < 100000);
2178 if (!goodtrack) return kFALSE;
2180 const Float_t c = 2.99792457999999984e-02;
2181 Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
2182 track->GetIntegratedTimes(integratedTimes);
2183 Float_t l = integratedTimes[0]*c;
2185 goodtrack = goodtrack && (l > 365);
2187 if (!goodtrack) return kFALSE;
2189 if (!fAllowTOFmismatchFlag) {if ((track->GetStatus() & AliESDtrack::kTOFmismatch)) return kFALSE;}
2191 Bool_t statusMatchingHard = TPCTOFagree(track);
2192 if (fRequireStrictTOFTPCagreement && (!statusMatchingHard))
2196 Float_t beta = GetBeta(track);
2198 //construct the pid index because it's not AliPID::EParticleType
2200 switch (fParticleID)
2208 case AliPID::kProton:
2216 Float_t p = track->P();
2217 Float_t betahypothesis = l/integratedTimes[pid]/c;
2218 Float_t betadiff = beta-betahypothesis;
2220 Float_t* arr = fTOFpidCuts->GetMatrixArray();
2221 Int_t col = TMath::BinarySearch(fTOFpidCuts->GetNcols(),arr,static_cast<Float_t>(p));
2222 if (col<0) return kFALSE;
2223 Float_t min = (*fTOFpidCuts)(1,col);
2224 Float_t max = (*fTOFpidCuts)(2,col);
2226 Bool_t pass = (betadiff>min && betadiff<max);
2230 //-----------------------------------------------------------------------
2231 Bool_t AliFlowTrackCuts::PassesTOFbetaCut(const AliESDtrack* track )
2233 //check if track passes pid selection with an asymmetric TOF beta cut
2236 //printf("no TOFpidCuts\n");
2240 //check if passes PID cut using timing in TOF
2241 Bool_t goodtrack = (track->GetStatus() & AliESDtrack::kTOFpid) &&
2242 (track->GetTOFsignal() > 12000) &&
2243 (track->GetTOFsignal() < 100000) &&
2244 (track->GetIntegratedLength() > 365);
2246 if (!fAllowTOFmismatchFlag) {if ((track->GetStatus() & AliESDtrack::kTOFmismatch)) return kFALSE;}
2248 if (!goodtrack) return kFALSE;
2250 Bool_t statusMatchingHard = TPCTOFagree(track);
2251 if (fRequireStrictTOFTPCagreement && (!statusMatchingHard))
2254 Float_t beta = GetBeta(track);
2256 Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
2257 track->GetIntegratedTimes(integratedTimes);
2259 //construct the pid index because it's not AliPID::EParticleType
2261 switch (fParticleID)
2269 case AliPID::kProton:
2277 const Float_t c = 2.99792457999999984e-02;
2278 Float_t l = track->GetIntegratedLength();
2279 Float_t p = track->GetP();
2280 Float_t betahypothesis = l/integratedTimes[pid]/c;
2281 Float_t betadiff = beta-betahypothesis;
2283 Float_t* arr = fTOFpidCuts->GetMatrixArray();
2284 Int_t col = TMath::BinarySearch(fTOFpidCuts->GetNcols(),arr,static_cast<Float_t>(p));
2285 if (col<0) return kFALSE;
2286 Float_t min = (*fTOFpidCuts)(1,col);
2287 Float_t max = (*fTOFpidCuts)(2,col);
2289 Bool_t pass = (betadiff>min && betadiff<max);
2294 //-----------------------------------------------------------------------
2295 Bool_t AliFlowTrackCuts::PassesTOFpidCut(const AliESDtrack* track) const
2297 //check if passes PID cut using default TOF pid
2298 Double_t pidTOF[AliPID::kSPECIES];
2299 track->GetTOFpid(pidTOF);
2300 if (pidTOF[fParticleID]>=fParticleProbability) return kTRUE;
2304 //-----------------------------------------------------------------------
2305 Bool_t AliFlowTrackCuts::PassesTPCpidCut(const AliESDtrack* track) const
2307 //check if passes PID cut using default TPC pid
2308 Double_t pidTPC[AliPID::kSPECIES];
2309 track->GetTPCpid(pidTPC);
2310 Double_t probablity = 0.;
2311 switch (fParticleID)
2314 probablity = pidTPC[AliPID::kPion] + pidTPC[AliPID::kMuon];
2317 probablity = pidTPC[fParticleID];
2319 if (probablity >= fParticleProbability) return kTRUE;
2323 //-----------------------------------------------------------------------
2324 Float_t AliFlowTrackCuts::Getdedx(const AliESDtrack* track) const
2327 return track->GetTPCsignal();
2330 //-----------------------------------------------------------------------
2331 Bool_t AliFlowTrackCuts::PassesTPCdedxCut(const AliESDtrack* track)
2333 //check if passes PID cut using dedx signal in the TPC
2336 //printf("no TPCpidCuts\n");
2340 const AliExternalTrackParam* tpcparam = track->GetInnerParam(); //tpc only params at the inner wall
2341 if (!tpcparam) return kFALSE;
2342 Double_t p = tpcparam->GetP();
2343 Float_t sigExp = fESDpid.GetTPCResponse().GetExpectedSignal(p, fParticleID);
2344 Float_t sigTPC = track->GetTPCsignal();
2345 Float_t s = (sigTPC-sigExp)/sigExp;
2347 Float_t* arr = fTPCpidCuts->GetMatrixArray();
2348 Int_t arrSize = fTPCpidCuts->GetNcols();
2349 Int_t col = TMath::BinarySearch( arrSize, arr, static_cast<Float_t>(p));
2350 if (col<0) return kFALSE;
2351 Float_t min = (*fTPCpidCuts)(1,col);
2352 Float_t max = (*fTPCpidCuts)(2,col);
2354 //printf("------------TPC pid cut %s\n",(s>min && s<max)?"PASS":"FAIL");
2355 return (s>min && s<max);
2358 //-----------------------------------------------------------------------
2359 void AliFlowTrackCuts::InitPIDcuts()
2361 //init matrices with PID cuts
2365 if (fParticleID==AliPID::kPion)
2367 t = new TMatrixF(3,15);
2368 (*t)(0,0) = 0.20; (*t)(1,0) = -0.4; (*t)(2,0) = 0.0;
2369 (*t)(0,1) = 0.25; (*t)(1,1) = -0.4; (*t)(2,1) = 0.1;
2370 (*t)(0,2) = 0.30; (*t)(1,2) = -0.4; (*t)(2,2) = 0.2;
2371 (*t)(0,3) = 0.35; (*t)(1,3) = -0.4; (*t)(2,3) = 0.2;
2372 (*t)(0,4) = 0.40; (*t)(1,4) = -0.4; (*t)(2,4) = 0.3;
2373 (*t)(0,5) = 0.45; (*t)(1,5) = -0.4; (*t)(2,5) = 0.3;
2374 (*t)(0,6) = 0.50; (*t)(1,6) = -0.4; (*t)(2,6) = 0.25;
2375 (*t)(0,7) = 0.55; (*t)(1,7) = -0.4; (*t)(2,7) = 0.15;
2376 (*t)(0,8) = 0.60; (*t)(1,8) = -0.4; (*t)(2,8) = 0.1;
2377 (*t)(0,9) = 0.65; (*t)(1,9) = -0.4; (*t)(2,9) = 0.05;
2378 (*t)(0,10) = 0.70; (*t)(1,10) = -0.4; (*t)(2,10) = 0;
2379 (*t)(0,11) = 0.75; (*t)(1,11) = -0.4; (*t)(2,11) = 0;
2380 (*t)(0,12) = 0.80; (*t)(1,12) = -0.4; (*t)(2,12) = -0.05;
2381 (*t)(0,13) = 0.85; (*t)(1,13) = -0.4; (*t)(2,13) = -0.1;
2382 (*t)(0,14) = 0.90; (*t)(1,14) = 0; (*t)(2,14) = 0;
2385 if (fParticleID==AliPID::kKaon)
2387 t = new TMatrixF(3,12);
2388 (*t)(0,0) = 0.20; (*t)(1,0) = -0.2; (*t)(2,0) = 0.2;
2389 (*t)(0,1) = 0.25; (*t)(1,1) = -0.2; (*t)(2,1) = 0.2;
2390 (*t)(0,2) = 0.30; (*t)(1,2) = -0.2; (*t)(2,2) = 0.2;
2391 (*t)(0,3) = 0.35; (*t)(1,3) = -0.2; (*t)(2,3) = 0.2;
2392 (*t)(0,4) = 0.40; (*t)(1,4) = -0.1; (*t)(2,4) = 0.2;
2393 (*t)(0,5) = 0.45; (*t)(1,5) = -0.1; (*t)(2,5) = 0.2;
2394 (*t)(0,6) = 0.50; (*t)(1,6) =-0.05; (*t)(2,6) = 0.2;
2395 (*t)(0,7) = 0.55; (*t)(1,7) = -0.1; (*t)(2,7) = 0.1;
2396 (*t)(0,8) = 0.60; (*t)(1,8) =-0.05; (*t)(2,8) = 0.1;
2397 (*t)(0,9) = 0.65; (*t)(1,9) = 0; (*t)(2,9) = 0.15;
2398 (*t)(0,10) = 0.70; (*t)(1,10) = 0.05; (*t)(2,10) = 0.2;
2399 (*t)(0,11) = 0.75; (*t)(1,11) = 0; (*t)(2,11) = 0;
2402 if (fParticleID==AliPID::kProton)
2404 t = new TMatrixF(3,9);
2405 (*t)(0,0) = 0.20; (*t)(1,0) = -0.1; (*t)(2,0) = 0.1;
2406 (*t)(0,1) = 0.25; (*t)(1,1) = -0.2; (*t)(2,1) = 0.2;
2407 (*t)(0,2) = 0.80; (*t)(1,2) = -0.1; (*t)(2,2) = 0.2;
2408 (*t)(0,3) = 0.85; (*t)(1,3) =-0.05; (*t)(2,3) = 0.2;
2409 (*t)(0,4) = 0.90; (*t)(1,4) =-0.05; (*t)(2,4) = 0.25;
2410 (*t)(0,5) = 0.95; (*t)(1,5) =-0.05; (*t)(2,5) = 0.25;
2411 (*t)(0,6) = 1.00; (*t)(1,6) = -0.1; (*t)(2,6) = 0.25;
2412 (*t)(0,7) = 1.10; (*t)(1,7) =-0.05; (*t)(2,7) = 0.3;
2413 (*t)(0,8) = 1.20; (*t)(1,8) = 0; (*t)(2,8) = 0;
2421 if (fParticleID==AliPID::kPion)
2423 //TOF pions, 0.9 purity
2424 t = new TMatrixF(3,61);
2425 (*t)(0,0) = 0.000; (*t)(1,0) = 0.000; (*t)(2,0) = 0.000;
2426 (*t)(0,1) = 0.050; (*t)(1,1) = 0.000; (*t)(2,1) = 0.000;
2427 (*t)(0,2) = 0.100; (*t)(1,2) = 0.000; (*t)(2,2) = 0.000;
2428 (*t)(0,3) = 0.150; (*t)(1,3) = 0.000; (*t)(2,3) = 0.000;
2429 (*t)(0,4) = 0.200; (*t)(1,4) = -0.030; (*t)(2,4) = 0.030;
2430 (*t)(0,5) = 0.250; (*t)(1,5) = -0.036; (*t)(2,5) = 0.032;
2431 (*t)(0,6) = 0.300; (*t)(1,6) = -0.038; (*t)(2,6) = 0.032;
2432 (*t)(0,7) = 0.350; (*t)(1,7) = -0.034; (*t)(2,7) = 0.032;
2433 (*t)(0,8) = 0.400; (*t)(1,8) = -0.032; (*t)(2,8) = 0.020;
2434 (*t)(0,9) = 0.450; (*t)(1,9) = -0.030; (*t)(2,9) = 0.020;
2435 (*t)(0,10) = 0.500; (*t)(1,10) = -0.030; (*t)(2,10) = 0.020;
2436 (*t)(0,11) = 0.550; (*t)(1,11) = -0.030; (*t)(2,11) = 0.020;
2437 (*t)(0,12) = 0.600; (*t)(1,12) = -0.030; (*t)(2,12) = 0.020;
2438 (*t)(0,13) = 0.650; (*t)(1,13) = -0.030; (*t)(2,13) = 0.020;
2439 (*t)(0,14) = 0.700; (*t)(1,14) = -0.030; (*t)(2,14) = 0.020;
2440 (*t)(0,15) = 0.750; (*t)(1,15) = -0.030; (*t)(2,15) = 0.020;
2441 (*t)(0,16) = 0.800; (*t)(1,16) = -0.030; (*t)(2,16) = 0.020;
2442 (*t)(0,17) = 0.850; (*t)(1,17) = -0.030; (*t)(2,17) = 0.020;
2443 (*t)(0,18) = 0.900; (*t)(1,18) = -0.030; (*t)(2,18) = 0.020;
2444 (*t)(0,19) = 0.950; (*t)(1,19) = -0.028; (*t)(2,19) = 0.028;
2445 (*t)(0,20) = 1.000; (*t)(1,20) = -0.028; (*t)(2,20) = 0.028;
2446 (*t)(0,21) = 1.100; (*t)(1,21) = -0.028; (*t)(2,21) = 0.028;
2447 (*t)(0,22) = 1.200; (*t)(1,22) = -0.026; (*t)(2,22) = 0.028;
2448 (*t)(0,23) = 1.300; (*t)(1,23) = -0.024; (*t)(2,23) = 0.028;
2449 (*t)(0,24) = 1.400; (*t)(1,24) = -0.020; (*t)(2,24) = 0.028;
2450 (*t)(0,25) = 1.500; (*t)(1,25) = -0.018; (*t)(2,25) = 0.028;
2451 (*t)(0,26) = 1.600; (*t)(1,26) = -0.016; (*t)(2,26) = 0.028;
2452 (*t)(0,27) = 1.700; (*t)(1,27) = -0.014; (*t)(2,27) = 0.028;
2453 (*t)(0,28) = 1.800; (*t)(1,28) = -0.012; (*t)(2,28) = 0.026;
2454 (*t)(0,29) = 1.900; (*t)(1,29) = -0.010; (*t)(2,29) = 0.026;
2455 (*t)(0,30) = 2.000; (*t)(1,30) = -0.008; (*t)(2,30) = 0.026;
2456 (*t)(0,31) = 2.100; (*t)(1,31) = -0.008; (*t)(2,31) = 0.024;
2457 (*t)(0,32) = 2.200; (*t)(1,32) = -0.006; (*t)(2,32) = 0.024;
2458 (*t)(0,33) = 2.300; (*t)(1,33) = -0.004; (*t)(2,33) = 0.024;
2459 (*t)(0,34) = 2.400; (*t)(1,34) = -0.004; (*t)(2,34) = 0.024;
2460 (*t)(0,35) = 2.500; (*t)(1,35) = -0.002; (*t)(2,35) = 0.024;
2461 (*t)(0,36) = 2.600; (*t)(1,36) = -0.002; (*t)(2,36) = 0.024;
2462 (*t)(0,37) = 2.700; (*t)(1,37) = 0.000; (*t)(2,37) = 0.024;
2463 (*t)(0,38) = 2.800; (*t)(1,38) = 0.000; (*t)(2,38) = 0.026;
2464 (*t)(0,39) = 2.900; (*t)(1,39) = 0.000; (*t)(2,39) = 0.024;
2465 (*t)(0,40) = 3.000; (*t)(1,40) = 0.002; (*t)(2,40) = 0.026;
2466 (*t)(0,41) = 3.100; (*t)(1,41) = 0.002; (*t)(2,41) = 0.026;
2467 (*t)(0,42) = 3.200; (*t)(1,42) = 0.002; (*t)(2,42) = 0.026;
2468 (*t)(0,43) = 3.300; (*t)(1,43) = 0.002; (*t)(2,43) = 0.026;
2469 (*t)(0,44) = 3.400; (*t)(1,44) = 0.002; (*t)(2,44) = 0.026;
2470 (*t)(0,45) = 3.500; (*t)(1,45) = 0.002; (*t)(2,45) = 0.026;
2471 (*t)(0,46) = 3.600; (*t)(1,46) = 0.002; (*t)(2,46) = 0.026;
2472 (*t)(0,47) = 3.700; (*t)(1,47) = 0.002; (*t)(2,47) = 0.026;
2473 (*t)(0,48) = 3.800; (*t)(1,48) = 0.002; (*t)(2,48) = 0.026;
2474 (*t)(0,49) = 3.900; (*t)(1,49) = 0.004; (*t)(2,49) = 0.024;
2475 (*t)(0,50) = 4.000; (*t)(1,50) = 0.004; (*t)(2,50) = 0.026;
2476 (*t)(0,51) = 4.100; (*t)(1,51) = 0.004; (*t)(2,51) = 0.026;
2477 (*t)(0,52) = 4.200; (*t)(1,52) = 0.004; (*t)(2,52) = 0.024;
2478 (*t)(0,53) = 4.300; (*t)(1,53) = 0.006; (*t)(2,53) = 0.024;
2479 (*t)(0,54) = 4.400; (*t)(1,54) = 0.000; (*t)(2,54) = 0.000;
2480 (*t)(0,55) = 4.500; (*t)(1,55) = 0.000; (*t)(2,55) = 0.000;
2481 (*t)(0,56) = 4.600; (*t)(1,56) = 0.000; (*t)(2,56) = 0.000;
2482 (*t)(0,57) = 4.700; (*t)(1,57) = 0.000; (*t)(2,57) = 0.000;
2483 (*t)(0,58) = 4.800; (*t)(1,58) = 0.000; (*t)(2,58) = 0.000;
2484 (*t)(0,59) = 4.900; (*t)(1,59) = 0.000; (*t)(2,59) = 0.000;
2485 (*t)(0,60) = 5.900; (*t)(1,60) = 0.000; (*t)(2,60) = 0.000;
2488 if (fParticleID==AliPID::kProton)
2490 //TOF protons, 0.9 purity
2491 t = new TMatrixF(3,61);
2492 (*t)(0,0) = 0.000; (*t)(1,0) = 0.000; (*t)(2,0) = 0.000;
2493 (*t)(0,1) = 0.050; (*t)(1,1) = 0.000; (*t)(2,1) = 0.000;
2494 (*t)(0,2) = 0.100; (*t)(1,2) = 0.000; (*t)(2,2) = 0.000;
2495 (*t)(0,3) = 0.150; (*t)(1,3) = 0.000; (*t)(2,3) = 0.000;
2496 (*t)(0,4) = 0.200; (*t)(1,4) = -0.07; (*t)(2,4) = 0.07;
2497 (*t)(0,5) = 0.200; (*t)(1,5) = -0.07; (*t)(2,5) = 0.07;
2498 (*t)(0,6) = 0.200; (*t)(1,6) = -0.07; (*t)(2,6) = 0.07;
2499 (*t)(0,7) = 0.200; (*t)(1,7) = -0.07; (*t)(2,7) = 0.07;
2500 (*t)(0,8) = 0.200; (*t)(1,8) = -0.07; (*t)(2,8) = 0.07;
2501 (*t)(0,9) = 0.200; (*t)(1,9) = -0.07; (*t)(2,9) = 0.07;
2502 (*t)(0,10) = 0.200; (*t)(1,10) = -0.07; (*t)(2,10) = 0.07;
2503 (*t)(0,11) = 0.200; (*t)(1,11) = -0.07; (*t)(2,11) = 0.07;
2504 (*t)(0,12) = 0.200; (*t)(1,12) = -0.07; (*t)(2,12) = 0.07;
2505 (*t)(0,13) = 0.200; (*t)(1,13) = -0.07; (*t)(2,13) = 0.07;
2506 (*t)(0,14) = 0.200; (*t)(1,14) = -0.07; (*t)(2,14) = 0.07;
2507 (*t)(0,15) = 0.200; (*t)(1,15) = -0.07; (*t)(2,15) = 0.07;
2508 (*t)(0,16) = 0.200; (*t)(1,16) = -0.07; (*t)(2,16) = 0.07;
2509 (*t)(0,17) = 0.850; (*t)(1,17) = -0.070; (*t)(2,17) = 0.070;
2510 (*t)(0,18) = 0.900; (*t)(1,18) = -0.072; (*t)(2,18) = 0.072;
2511 (*t)(0,19) = 0.950; (*t)(1,19) = -0.072; (*t)(2,19) = 0.072;
2512 (*t)(0,20) = 1.000; (*t)(1,20) = -0.074; (*t)(2,20) = 0.074;
2513 (*t)(0,21) = 1.100; (*t)(1,21) = -0.032; (*t)(2,21) = 0.032;
2514 (*t)(0,22) = 1.200; (*t)(1,22) = -0.026; (*t)(2,22) = 0.026;
2515 (*t)(0,23) = 1.300; (*t)(1,23) = -0.026; (*t)(2,23) = 0.026;
2516 (*t)(0,24) = 1.400; (*t)(1,24) = -0.024; (*t)(2,24) = 0.024;
2517 (*t)(0,25) = 1.500; (*t)(1,25) = -0.024; (*t)(2,25) = 0.024;
2518 (*t)(0,26) = 1.600; (*t)(1,26) = -0.026; (*t)(2,26) = 0.026;
2519 (*t)(0,27) = 1.700; (*t)(1,27) = -0.026; (*t)(2,27) = 0.026;
2520 (*t)(0,28) = 1.800; (*t)(1,28) = -0.026; (*t)(2,28) = 0.026;
2521 (*t)(0,29) = 1.900; (*t)(1,29) = -0.026; (*t)(2,29) = 0.026;
2522 (*t)(0,30) = 2.000; (*t)(1,30) = -0.026; (*t)(2,30) = 0.026;
2523 (*t)(0,31) = 2.100; (*t)(1,31) = -0.026; (*t)(2,31) = 0.026;
2524 (*t)(0,32) = 2.200; (*t)(1,32) = -0.026; (*t)(2,32) = 0.024;
2525 (*t)(0,33) = 2.300; (*t)(1,33) = -0.028; (*t)(2,33) = 0.022;
2526 (*t)(0,34) = 2.400; (*t)(1,34) = -0.028; (*t)(2,34) = 0.020;
2527 (*t)(0,35) = 2.500; (*t)(1,35) = -0.028; (*t)(2,35) = 0.018;
2528 (*t)(0,36) = 2.600; (*t)(1,36) = -0.028; (*t)(2,36) = 0.016;
2529 (*t)(0,37) = 2.700; (*t)(1,37) = -0.028; (*t)(2,37) = 0.016;
2530 (*t)(0,38) = 2.800; (*t)(1,38) = -0.030; (*t)(2,38) = 0.014;
2531 (*t)(0,39) = 2.900; (*t)(1,39) = -0.030; (*t)(2,39) = 0.012;
2532 (*t)(0,40) = 3.000; (*t)(1,40) = -0.030; (*t)(2,40) = 0.012;
2533 (*t)(0,41) = 3.100; (*t)(1,41) = -0.030; (*t)(2,41) = 0.010;
2534 (*t)(0,42) = 3.200; (*t)(1,42) = -0.030; (*t)(2,42) = 0.010;
2535 (*t)(0,43) = 3.300; (*t)(1,43) = -0.030; (*t)(2,43) = 0.010;
2536 (*t)(0,44) = 3.400; (*t)(1,44) = -0.030; (*t)(2,44) = 0.008;
2537 (*t)(0,45) = 3.500; (*t)(1,45) = -0.030; (*t)(2,45) = 0.008;
2538 (*t)(0,46) = 3.600; (*t)(1,46) = -0.030; (*t)(2,46) = 0.008;
2539 (*t)(0,47) = 3.700; (*t)(1,47) = -0.030; (*t)(2,47) = 0.006;
2540 (*t)(0,48) = 3.800; (*t)(1,48) = -0.030; (*t)(2,48) = 0.006;
2541 (*t)(0,49) = 3.900; (*t)(1,49) = -0.030; (*t)(2,49) = 0.006;
2542 (*t)(0,50) = 4.000; (*t)(1,50) = -0.028; (*t)(2,50) = 0.004;
2543 (*t)(0,51) = 4.100; (*t)(1,51) = -0.030; (*t)(2,51) = 0.004;
2544 (*t)(0,52) = 4.200; (*t)(1,52) = -0.030; (*t)(2,52) = 0.004;
2545 (*t)(0,53) = 4.300; (*t)(1,53) = -0.028; (*t)(2,53) = 0.002;
2546 (*t)(0,54) = 4.400; (*t)(1,54) = -0.030; (*t)(2,54) = 0.002;
2547 (*t)(0,55) = 4.500; (*t)(1,55) = -0.028; (*t)(2,55) = 0.002;
2548 (*t)(0,56) = 4.600; (*t)(1,56) = -0.028; (*t)(2,56) = 0.002;
2549 (*t)(0,57) = 4.700; (*t)(1,57) = -0.028; (*t)(2,57) = 0.000;
2550 (*t)(0,58) = 4.800; (*t)(1,58) = -0.028; (*t)(2,58) = 0.002;
2551 (*t)(0,59) = 4.900; (*t)(1,59) = 0.000; (*t)(2,59) = 0.000;
2552 (*t)(0,60) = 5.900; (*t)(1,60) = 0.000; (*t)(2,60) = 0.000;
2555 if (fParticleID==AliPID::kKaon)
2557 //TOF kaons, 0.9 purity
2558 t = new TMatrixF(3,61);
2559 (*t)(0,0) = 0.000; (*t)(1,0) = 0.000; (*t)(2,0) = 0.000;
2560 (*t)(0,1) = 0.050; (*t)(1,1) = 0.000; (*t)(2,1) = 0.000;
2561 (*t)(0,2) = 0.100; (*t)(1,2) = 0.000; (*t)(2,2) = 0.000;
2562 (*t)(0,3) = 0.150; (*t)(1,3) = 0.000; (*t)(2,3) = 0.000;
2563 (*t)(0,4) = 0.200; (*t)(1,4) = -0.05; (*t)(2,4) = 0.05;
2564 (*t)(0,5) = 0.200; (*t)(1,5) = -0.05; (*t)(2,5) = 0.05;
2565 (*t)(0,6) = 0.200; (*t)(1,6) = -0.05; (*t)(2,6) = 0.05;
2566 (*t)(0,7) = 0.200; (*t)(1,7) = -0.05; (*t)(2,7) = 0.05;
2567 (*t)(0,8) = 0.200; (*t)(1,8) = -0.05; (*t)(2,8) = 0.05;
2568 (*t)(0,9) = 0.200; (*t)(1,9) = -0.05; (*t)(2,9) = 0.05;
2569 (*t)(0,10) = 0.200; (*t)(1,10) = -0.05; (*t)(2,10) = 0.05;
2570 (*t)(0,11) = 0.550; (*t)(1,11) = -0.026; (*t)(2,11) = 0.026;
2571 (*t)(0,12) = 0.600; (*t)(1,12) = -0.026; (*t)(2,12) = 0.026;
2572 (*t)(0,13) = 0.650; (*t)(1,13) = -0.026; (*t)(2,13) = 0.026;
2573 (*t)(0,14) = 0.700; (*t)(1,14) = -0.026; (*t)(2,14) = 0.026;
2574 (*t)(0,15) = 0.750; (*t)(1,15) = -0.026; (*t)(2,15) = 0.026;
2575 (*t)(0,16) = 0.800; (*t)(1,16) = -0.026; (*t)(2,16) = 0.026;
2576 (*t)(0,17) = 0.850; (*t)(1,17) = -0.024; (*t)(2,17) = 0.024;
2577 (*t)(0,18) = 0.900; (*t)(1,18) = -0.024; (*t)(2,18) = 0.024;
2578 (*t)(0,19) = 0.950; (*t)(1,19) = -0.024; (*t)(2,19) = 0.024;
2579 (*t)(0,20) = 1.000; (*t)(1,20) = -0.024; (*t)(2,20) = 0.024;
2580 (*t)(0,21) = 1.100; (*t)(1,21) = -0.024; (*t)(2,21) = 0.024;
2581 (*t)(0,22) = 1.200; (*t)(1,22) = -0.024; (*t)(2,22) = 0.022;
2582 (*t)(0,23) = 1.300; (*t)(1,23) = -0.024; (*t)(2,23) = 0.020;
2583 (*t)(0,24) = 1.400; (*t)(1,24) = -0.026; (*t)(2,24) = 0.016;
2584 (*t)(0,25) = 1.500; (*t)(1,25) = -0.028; (*t)(2,25) = 0.014;
2585 (*t)(0,26) = 1.600; (*t)(1,26) = -0.028; (*t)(2,26) = 0.012;
2586 (*t)(0,27) = 1.700; (*t)(1,27) = -0.028; (*t)(2,27) = 0.010;
2587 (*t)(0,28) = 1.800; (*t)(1,28) = -0.028; (*t)(2,28) = 0.010;
2588 (*t)(0,29) = 1.900; (*t)(1,29) = -0.028; (*t)(2,29) = 0.008;
2589 (*t)(0,30) = 2.000; (*t)(1,30) = -0.028; (*t)(2,30) = 0.006;
2590 (*t)(0,31) = 2.100; (*t)(1,31) = -0.026; (*t)(2,31) = 0.006;
2591 (*t)(0,32) = 2.200; (*t)(1,32) = -0.024; (*t)(2,32) = 0.004;
2592 (*t)(0,33) = 2.300; (*t)(1,33) = -0.020; (*t)(2,33) = 0.002;
2593 (*t)(0,34) = 2.400; (*t)(1,34) = -0.020; (*t)(2,34) = 0.002;
2594 (*t)(0,35) = 2.500; (*t)(1,35) = -0.018; (*t)(2,35) = 0.000;
2595 (*t)(0,36) = 2.600; (*t)(1,36) = -0.016; (*t)(2,36) = 0.000;
2596 (*t)(0,37) = 2.700; (*t)(1,37) = -0.014; (*t)(2,37) = -0.002;
2597 (*t)(0,38) = 2.800; (*t)(1,38) = -0.014; (*t)(2,38) = -0.004;
2598 (*t)(0,39) = 2.900; (*t)(1,39) = -0.012; (*t)(2,39) = -0.004;
2599 (*t)(0,40) = 3.000; (*t)(1,40) = -0.010; (*t)(2,40) = -0.006;
2600 (*t)(0,41) = 3.100; (*t)(1,41) = 0.000; (*t)(2,41) = 0.000;
2601 (*t)(0,42) = 3.200; (*t)(1,42) = 0.000; (*t)(2,42) = 0.000;
2602 (*t)(0,43) = 3.300; (*t)(1,43) = 0.000; (*t)(2,43) = 0.000;
2603 (*t)(0,44) = 3.400; (*t)(1,44) = 0.000; (*t)(2,44) = 0.000;
2604 (*t)(0,45) = 3.500; (*t)(1,45) = 0.000; (*t)(2,45) = 0.000;
2605 (*t)(0,46) = 3.600; (*t)(1,46) = 0.000; (*t)(2,46) = 0.000;
2606 (*t)(0,47) = 3.700; (*t)(1,47) = 0.000; (*t)(2,47) = 0.000;
2607 (*t)(0,48) = 3.800; (*t)(1,48) = 0.000; (*t)(2,48) = 0.000;
2608 (*t)(0,49) = 3.900; (*t)(1,49) = 0.000; (*t)(2,49) = 0.000;
2609 (*t)(0,50) = 4.000; (*t)(1,50) = 0.000; (*t)(2,50) = 0.000;
2610 (*t)(0,51) = 4.100; (*t)(1,51) = 0.000; (*t)(2,51) = 0.000;
2611 (*t)(0,52) = 4.200; (*t)(1,52) = 0.000; (*t)(2,52) = 0.000;
2612 (*t)(0,53) = 4.300; (*t)(1,53) = 0.000; (*t)(2,53) = 0.000;
2613 (*t)(0,54) = 4.400; (*t)(1,54) = 0.000; (*t)(2,54) = 0.000;
2614 (*t)(0,55) = 4.500; (*t)(1,55) = 0.000; (*t)(2,55) = 0.000;
2615 (*t)(0,56) = 4.600; (*t)(1,56) = 0.000; (*t)(2,56) = 0.000;
2616 (*t)(0,57) = 4.700; (*t)(1,57) = 0.000; (*t)(2,57) = 0.000;
2617 (*t)(0,58) = 4.800; (*t)(1,58) = 0.000; (*t)(2,58) = 0.000;
2618 (*t)(0,59) = 4.900; (*t)(1,59) = 0.000; (*t)(2,59) = 0.000;
2619 (*t)(0,60) = 5.900; (*t)(1,60) = 0.000; (*t)(2,60) = 0.000;
2626 //-----------------------------------------------------------------------
2627 //-----------------------------------------------------------------------
2628 Bool_t AliFlowTrackCuts::PassesTPCbayesianCut(const AliAODTrack* track)
2630 fBayesianResponse->ComputeProb(track,track->GetAODEvent()); // fCurrCentr is needed for mismatch fraction
2631 Float_t *probabilities = fBayesianResponse->GetProb(); // Bayesian Probability (from 0 to 4) (Combined TPC || TOF) including a tuning of priors and TOF mism$
2633 Int_t kTPC = fBayesianResponse->GetCurrentMask(0); // is TPC on
2635 if(! kTPC) return kFALSE;
2639 switch (fParticleID)
2642 fProbBayes = probabilities[2];
2645 fProbBayes = probabilities[3];
2647 case AliPID::kProton:
2648 fProbBayes = probabilities[4];
2650 case AliPID::kElectron:
2651 fProbBayes = probabilities[0];
2654 fProbBayes = probabilities[1];
2656 case AliPID::kDeuteron:
2657 fProbBayes = probabilities[5];
2659 case AliPID::kTriton:
2660 fProbBayes = probabilities[6];
2663 fProbBayes = probabilities[7];
2669 if(fProbBayes > fParticleProbability){
2672 else if (fCutCharge && fCharge * track->Charge() > 0)
2677 //-----------------------------------------------------------------------
2678 Bool_t AliFlowTrackCuts::PassesTPCbayesianCut(const AliESDtrack* track)
2680 //cut on TPC bayesian pid
2681 //if (! fAllowTOFmismatchFlag) {if (track->GetStatus() & AliESDtrack::kTOFmismatch) return kFALSE;}
2683 //Bool_t statusMatchingHard = TPCTOFagree(track);
2684 //if (fRequireStrictTOFTPCagreement && (!statusMatchingHard))
2686 fBayesianResponse->ComputeProb(track,fCurrCentr); // fCurrCentr is needed for mismatch fraction
2687 Int_t kTPC = fBayesianResponse->GetCurrentMask(0); // is TPC on
2688 //Int_t kTOF = fBayesianResponse->GetCurrentMask(1); // is TOF on
2690 if(! kTPC) return kFALSE;
2692 // Bool_t statusMatchingHard = 1;
2693 // Float_t mismProb = 0;
2695 // statusMatchingHard = TPCTOFagree(track);
2696 // mismProb = fBayesianResponse->GetTOFMismProb();
2698 // if (fRequireStrictTOFTPCagreement && (!statusMatchingHard))
2701 Float_t *probabilities = fBayesianResponse->GetProb(); // Bayesian Probability (from 0 to 4) (Combined TPC || TOF) including a tuning of priors and TOF mismatch parameterization
2705 switch (fParticleID)
2708 fProbBayes = probabilities[2];
2711 fProbBayes = probabilities[3];
2713 case AliPID::kProton:
2714 fProbBayes = probabilities[4];
2716 case AliPID::kElectron:
2717 fProbBayes = probabilities[0];
2720 fProbBayes = probabilities[1];
2722 case AliPID::kDeuteron:
2723 fProbBayes = probabilities[5];
2725 case AliPID::kTriton:
2726 fProbBayes = probabilities[6];
2729 fProbBayes = probabilities[7];
2735 if(fProbBayes > fParticleProbability)
2739 else if (fCutCharge && fCharge * track->GetSign() > 0)
2744 //-----------------------------------------------------------------------
2745 Bool_t AliFlowTrackCuts::PassesTOFbayesianCut(const AliAODTrack* track)
2747 //check is track passes bayesian combined TOF+TPC pid cut
2748 Bool_t goodtrack = (track->GetStatus() & AliESDtrack::kTOFout) &&
2749 (track->GetStatus() & AliESDtrack::kTIME) &&
2750 (track->GetTOFsignal() > 12000) &&
2751 (track->GetTOFsignal() < 100000);
2756 Bool_t statusMatchingHard = TPCTOFagree(track);
2758 if (fRequireStrictTOFTPCagreement && (!statusMatchingHard))
2761 fBayesianResponse->ComputeProb(track,track->GetAODEvent()); // fCurrCentr is needed for mismatch fraction
2762 Float_t *probabilities = fBayesianResponse->GetProb(); // Bayesian Probability (from 0 to 4) (Combined TPC || TOF) including a tuning of priors and TOF mism$
2764 Float_t mismProb = fBayesianResponse->GetTOFMismProb(); // mismatch Bayesian probabilities
2768 switch (fParticleID)
2771 fProbBayes = probabilities[2];
2774 fProbBayes = probabilities[3];
2776 case AliPID::kProton:
2777 fProbBayes = probabilities[4];
2779 case AliPID::kElectron:
2780 fProbBayes = probabilities[0];
2783 fProbBayes = probabilities[1];
2785 case AliPID::kDeuteron:
2786 fProbBayes = probabilities[5];
2788 case AliPID::kTriton:
2789 fProbBayes = probabilities[6];
2792 fProbBayes = probabilities[7];
2798 if(fProbBayes > fParticleProbability && mismProb < 0.5){
2801 else if (fCutCharge && fCharge * track->Charge() > 0)
2807 //-----------------------------------------------------------------------
2808 // part added by F. Noferini (some methods)
2809 Bool_t AliFlowTrackCuts::PassesTOFbayesianCut(const AliESDtrack* track)
2811 //check is track passes bayesian combined TOF+TPC pid cut
2812 Bool_t goodtrack = (track->GetStatus() & AliESDtrack::kTOFout) &&
2813 (track->GetStatus() & AliESDtrack::kTIME) &&
2814 (track->GetTOFsignal() > 12000) &&
2815 (track->GetTOFsignal() < 100000) &&
2816 (track->GetIntegratedLength() > 365);
2821 if (! fAllowTOFmismatchFlag) {if (track->GetStatus() & AliESDtrack::kTOFmismatch) return kFALSE;}
2823 Bool_t statusMatchingHard = TPCTOFagree(track);
2824 if (fRequireStrictTOFTPCagreement && (!statusMatchingHard))
2827 fBayesianResponse->ComputeProb(track,fCurrCentr); // fCurrCentr is needed for mismatch fraction
2828 Float_t *probabilities = fBayesianResponse->GetProb(); // Bayesian Probability (from 0 to 4) (Combined TPC || TOF) including a tuning of priors and TOF mismatch parameterization
2830 Float_t mismProb = fBayesianResponse->GetTOFMismProb(); // mismatch Bayesian probabilities
2834 switch (fParticleID)
2837 fProbBayes = probabilities[2];
2840 fProbBayes = probabilities[3];
2842 case AliPID::kProton:
2843 fProbBayes = probabilities[4];
2845 case AliPID::kElectron:
2846 fProbBayes = probabilities[0];
2849 fProbBayes = probabilities[1];
2851 case AliPID::kDeuteron:
2852 fProbBayes = probabilities[5];
2854 case AliPID::kTriton:
2855 fProbBayes = probabilities[6];
2858 fProbBayes = probabilities[7];
2864 // printf("pt = %f -- all prob = [%4.2f,%4.2f,%4.2f,%4.2f,%4.2f] -- prob = %f\n",track->Pt(),fProbBayes[0],fProbBayes[1],fProbBayes[2],fProbBayes[3],fProbBayes[4],prob);
2865 if(fProbBayes > fParticleProbability && mismProb < 0.5){
2868 else if (fCutCharge && fCharge * track->GetSign() > 0)
2875 //-----------------------------------------------------------------------
2876 // part added by Natasha
2877 Bool_t AliFlowTrackCuts::PassesNucleiSelection(const AliESDtrack* track)
2879 //pid selection for heavy nuclei
2880 Bool_t select=kFALSE;
2882 //if (!track) continue;
2884 if (!track->GetInnerParam())
2885 return kFALSE; //break;
2887 const AliExternalTrackParam* tpcTrack = track->GetInnerParam();
2889 Double_t ptotTPC = tpcTrack->GetP();
2890 Double_t sigTPC = track->GetTPCsignal();
2891 Double_t dEdxBBA = 0.;
2892 Double_t dSigma = 0.;
2894 switch (fParticleID)
2896 case AliPID::kDeuteron:
2898 dEdxBBA = AliExternalTrackParam::BetheBlochAleph(ptotTPC/1.8756,
2904 dSigma = (sigTPC - dEdxBBA)/dEdxBBA;
2906 if( ptotTPC<=1.1 && (dSigma < (0.5 - (0.1818*ptotTPC)) ) && (dSigma > ( (0.218*ptotTPC - 0.4) ) ) )
2910 case AliPID::kTriton:
2917 // ----- Pass 2 -------
2918 dEdxBBA = 4.0 * AliExternalTrackParam::BetheBlochAleph( (2.*ptotTPC)/2.8084,
2924 dSigma = (sigTPC - dEdxBBA)/dEdxBBA;
2925 if(ptotTPC<=5.0 && (dSigma >= (-0.03968*ptotTPC - 0.1)) && (dSigma <= (0.31 - 0.0217*ptotTPC)))
2929 case AliPID::kAlpha:
2940 // end part added by Natasha
2941 //-----------------------------------------------------------------------
2942 void AliFlowTrackCuts::SetPriors(Float_t centrCur){
2943 //set priors for the bayesian pid selection
2944 fCurrCentr = centrCur;
2946 fBinLimitPID[0] = 0.300000;
2947 fBinLimitPID[1] = 0.400000;
2948 fBinLimitPID[2] = 0.500000;
2949 fBinLimitPID[3] = 0.600000;
2950 fBinLimitPID[4] = 0.700000;
2951 fBinLimitPID[5] = 0.800000;
2952 fBinLimitPID[6] = 0.900000;
2953 fBinLimitPID[7] = 1.000000;
2954 fBinLimitPID[8] = 1.200000;
2955 fBinLimitPID[9] = 1.400000;
2956 fBinLimitPID[10] = 1.600000;
2957 fBinLimitPID[11] = 1.800000;
2958 fBinLimitPID[12] = 2.000000;
2959 fBinLimitPID[13] = 2.200000;
2960 fBinLimitPID[14] = 2.400000;
2961 fBinLimitPID[15] = 2.600000;
2962 fBinLimitPID[16] = 2.800000;
2963 fBinLimitPID[17] = 3.000000;
3076 else if(centrCur < 20){
3186 else if(centrCur < 30){
3296 else if(centrCur < 40){
3406 else if(centrCur < 50){
3516 else if(centrCur < 60){
3626 else if(centrCur < 70){
3736 else if(centrCur < 80){
3956 for(Int_t i=18;i<fgkPIDptBin;i++){
3957 fBinLimitPID[i] = 3.0 + 0.2 * (i-18);
3958 fC[i][0] = fC[17][0];
3959 fC[i][1] = fC[17][1];
3960 fC[i][2] = fC[17][2];
3961 fC[i][3] = fC[17][3];
3962 fC[i][4] = fC[17][4];
3966 //---------------------------------------------------------------//
3967 Bool_t AliFlowTrackCuts::TPCTOFagree(const AliVTrack *track)
3969 //check pid agreement between TPC and TOF
3970 Bool_t status = kFALSE;
3972 const Float_t c = 2.99792457999999984e-02;
3974 Float_t mass[5] = {5.10998909999999971e-04,1.05658000000000002e-01,1.39570000000000000e-01,4.93676999999999977e-01,9.38271999999999995e-01};
3977 Double_t exptimes[5];
3978 track->GetIntegratedTimes(exptimes);
3980 Float_t dedx = track->GetTPCsignal();
3982 Float_t p = track->P();
3983 Float_t time = track->GetTOFsignal()- fESDpid.GetTOFResponse().GetStartTime(p);
3984 Float_t tl = exptimes[0]*c; // to work both for ESD and AOD
3986 Float_t betagammares = fESDpid.GetTOFResponse().GetExpectedSigma(p, exptimes[4], mass[4]);
3988 Float_t betagamma1 = tl/(time-5 *betagammares) * 33.3564095198152043;
3990 // printf("betagamma1 = %f\n",betagamma1);
3992 if(betagamma1 < 0.1) betagamma1 = 0.1;
3994 if(betagamma1 < 0.99999) betagamma1 /= TMath::Sqrt(1-betagamma1*betagamma1);
3995 else betagamma1 = 100;
3997 Float_t betagamma2 = tl/(time+5 *betagammares) * 33.3564095198152043;
3998 // printf("betagamma2 = %f\n",betagamma2);
4000 if(betagamma2 < 0.1) betagamma2 = 0.1;
4002 if(betagamma2 < 0.99999) betagamma2 /= TMath::Sqrt(1-betagamma2*betagamma2);
4003 else betagamma2 = 100;
4006 Float_t momtpc=track->GetTPCmomentum();
4008 for(Int_t i=0;i < 5;i++){
4009 Float_t resolutionTOF = fESDpid.GetTOFResponse().GetExpectedSigma(p, exptimes[i], mass[i]);
4010 if(TMath::Abs(exptimes[i] - time) < 5 * resolutionTOF){
4011 Float_t dedxExp = 0;
4012 if(i==0) dedxExp = fESDpid.GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kElectron);
4013 else if(i==1) dedxExp = fESDpid.GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kMuon);
4014 else if(i==2) dedxExp = fESDpid.GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kPion);
4015 else if(i==3) dedxExp = fESDpid.GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kKaon);
4016 else if(i==4) dedxExp = fESDpid.GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kProton);
4018 Float_t resolutionTPC = 2;
4019 if(i==0) resolutionTPC = fESDpid.GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kElectron);
4020 else if(i==1) resolutionTPC = fESDpid.GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kMuon);
4021 else if(i==2) resolutionTPC = fESDpid.GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kPion);
4022 else if(i==3) resolutionTPC = fESDpid.GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kKaon);
4023 else if(i==4) resolutionTPC = fESDpid.GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kProton);
4025 if(TMath::Abs(dedx - dedxExp) < 3 * resolutionTPC){
4031 Float_t bb1 = fESDpid.GetTPCResponse().Bethe(betagamma1);
4032 Float_t bb2 = fESDpid.GetTPCResponse().Bethe(betagamma2);
4033 Float_t bbM = fESDpid.GetTPCResponse().Bethe((betagamma1+betagamma2)*0.5);
4038 Float_t resolutionTOFpr = fESDpid.GetTOFResponse().GetExpectedSigma(p, exptimes[4], mass[4]);
4039 Float_t resolutionTPCpr = fESDpid.GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kProton);
4040 if(TMath::Abs(dedx-bb1) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){
4043 else if(TMath::Abs(dedx-bb2) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){
4046 else if(TMath::Abs(dedx-bbM) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){
4052 // end part added by F. Noferini
4053 //-----------------------------------------------------------------------
4055 //-----------------------------------------------------------------------
4056 const char* AliFlowTrackCuts::PIDsourceName(PIDsource s)
4058 //get the name of the particle id source
4064 return "TPCbayesian";
4072 return "TOFbayesianPID";
4073 case kTOFbetaSimple:
4074 return "TOFbetaSimple";
4082 //-----------------------------------------------------------------------
4083 const char* AliFlowTrackCuts::GetParamTypeName(trackParameterType type)
4085 //return the name of the selected parameter type
4092 case kTPCstandalone:
4093 return "TPCstandalone";
4095 return "SPDtracklets";
4100 case kMUON: // XZhang 20120604
4101 return "MUON"; // XZhang 20120604
4107 //-----------------------------------------------------------------------
4108 Bool_t AliFlowTrackCuts::PassesPMDcuts(const AliESDPmdTrack* track )
4110 //check PMD specific cuts
4111 //clean up from last iteration, and init label
4112 Int_t det = track->GetDetector();
4113 //Int_t smn = track->GetSmn();
4114 Float_t clsX = track->GetClusterX();
4115 Float_t clsY = track->GetClusterY();
4116 Float_t clsZ = track->GetClusterZ();
4117 Float_t ncell = track->GetClusterCells();
4118 Float_t adc = track->GetClusterADC();
4124 fTrackEta = GetPmdEta(clsX,clsY,clsZ);
4125 fTrackPhi = GetPmdPhi(clsX,clsY);
4129 if (fCutEta) {if ( fTrackEta < fEtaMin || fTrackEta >= fEtaMax ) pass = kFALSE;}
4130 if (fCutPhi) {if ( fTrackPhi < fPhiMin || fTrackPhi >= fPhiMax ) pass = kFALSE;}
4131 if (fCutPmdDet) {if(det != fPmdDet) pass = kFALSE;}
4132 if (fCutPmdAdc) {if(adc < fPmdAdc) pass = kFALSE;}
4133 if (fCutPmdNcell) {if(ncell < fPmdNcell) pass = kFALSE;}
4138 //-----------------------------------------------------------------------
4139 Bool_t AliFlowTrackCuts::PassesV0cuts(Int_t id)
4142 if (id<0) return kFALSE;
4144 //clean up from last iter
4149 fTrackPhi = TMath::PiOver4()*(0.5+id%8);
4151 // 10102013 weighting vzero tiles - rbertens@cern.ch
4152 if(!fV0gainEqualization) {
4153 // if for some reason the equalization is not initialized (e.g. 2011 data)
4154 // the fV0xpol[] weights are used to enable or disable vzero rings
4155 if(id<32) { // v0c side
4156 fTrackEta = -3.45+0.5*(id/8);
4157 if(id < 8) fTrackWeight = fEvent->GetVZEROEqMultiplicity(id)*fV0Cpol[0];
4158 else if (id < 16 ) fTrackWeight = fEvent->GetVZEROEqMultiplicity(id)*fV0Cpol[1];
4159 else if (id < 24 ) fTrackWeight = fEvent->GetVZEROEqMultiplicity(id)*fV0Cpol[2];
4160 else if (id < 32 ) fTrackWeight = fEvent->GetVZEROEqMultiplicity(id)*fV0Cpol[3];
4161 } else { // v0a side
4162 fTrackEta = +4.8-0.6*((id/8)-4);
4163 if( id < 40) fTrackWeight = fEvent->GetVZEROEqMultiplicity(id)*fV0Apol[0];
4164 else if ( id < 48 ) fTrackWeight = fEvent->GetVZEROEqMultiplicity(id)*fV0Apol[1];
4165 else if ( id < 56 ) fTrackWeight = fEvent->GetVZEROEqMultiplicity(id)*fV0Apol[2];
4166 else if ( id < 64 ) fTrackWeight = fEvent->GetVZEROEqMultiplicity(id)*fV0Apol[3];
4168 } else { // the equalization is initialized
4169 // note that disabled rings have already been excluded on calibration level in
4170 // AliFlowEvent (so for a disabled ring, fV0xpol is zero
4171 if(id<32) { // v0c side
4172 fTrackEta = -3.45+0.5*(id/8);
4173 if(id < 8) fTrackWeight = fEvent->GetVZEROData()->GetMultiplicity(id)*fV0Cpol[0]/fV0gainEqualization->GetBinContent(1+id);
4174 else if (id < 16 ) fTrackWeight = fEvent->GetVZEROData()->GetMultiplicity(id)*fV0Cpol[1]/fV0gainEqualization->GetBinContent(1+id);
4175 else if (id < 24 ) fTrackWeight = fEvent->GetVZEROData()->GetMultiplicity(id)*fV0Cpol[2]/fV0gainEqualization->GetBinContent(1+id);
4176 else if (id < 32 ) fTrackWeight = fEvent->GetVZEROData()->GetMultiplicity(id)*fV0Cpol[3]/fV0gainEqualization->GetBinContent(1+id);
4177 } else { // v0a side
4178 fTrackEta = +4.8-0.6*((id/8)-4);
4179 if( id < 40) fTrackWeight = fEvent->GetVZEROData()->GetMultiplicity(id)*fV0Apol[0]/fV0gainEqualization->GetBinContent(1+id);
4180 else if ( id < 48 ) fTrackWeight = fEvent->GetVZEROData()->GetMultiplicity(id)*fV0Apol[1]/fV0gainEqualization->GetBinContent(1+id);
4181 else if ( id < 56 ) fTrackWeight = fEvent->GetVZEROData()->GetMultiplicity(id)*fV0Apol[2]/fV0gainEqualization->GetBinContent(1+id);
4182 else if ( id < 64 ) fTrackWeight = fEvent->GetVZEROData()->GetMultiplicity(id)*fV0Apol[3]/fV0gainEqualization->GetBinContent(1+id);
4184 // printf ( " tile %i and weight %.2f \n", id, fTrackWeight);
4187 if (fLinearizeVZEROresponse && id < 64)
4189 //this is only needed in pass1 of LHC10h
4190 Float_t multV0[fgkNumberOfV0tracks];
4192 AliESDUtils::GetCorrV0((AliESDEvent*)fEvent,dummy,multV0);
4193 fTrackWeight = multV0[id];
4197 if (fCutEta) {if ( fTrackEta < fEtaMin || fTrackEta >= fEtaMax ) pass = kFALSE;}
4198 if (fCutPhi) {if ( fTrackPhi < fPhiMin || fTrackPhi >= fPhiMax ) pass = kFALSE;}
4203 //-----------------------------------------------------------------------------
4204 Bool_t AliFlowTrackCuts::PassesMuonCuts(AliVParticle* vparticle)
4208 fTrackLabel = (fFakesAreOK)?TMath::Abs(vparticle->GetLabel()):vparticle->GetLabel();
4209 if (fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
4210 else fMCparticle=NULL;
4212 AliESDMuonTrack *esdTrack = dynamic_cast<AliESDMuonTrack*>(vparticle);
4213 AliAODTrack *aodTrack = dynamic_cast<AliAODTrack*>(vparticle);
4214 if ((!esdTrack) && (!aodTrack)) return kFALSE;
4215 if (!fMuonTrackCuts->IsSelected(vparticle)) return kFALSE;
4216 HandleVParticle(vparticle); if (!fTrack) return kFALSE;
4220 //----------------------------------------------------------------------------//
4221 Double_t AliFlowTrackCuts::GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos)
4223 //get PMD "track" eta coordinate
4224 Float_t rpxpy, theta, eta;
4225 rpxpy = TMath::Sqrt(xPos*xPos + yPos*yPos);
4226 theta = TMath::ATan2(rpxpy,zPos);
4227 eta = -TMath::Log(TMath::Tan(0.5*theta));
4231 //--------------------------------------------------------------------------//
4232 Double_t AliFlowTrackCuts::GetPmdPhi(Float_t xPos, Float_t yPos)
4234 //Get PMD "track" phi coordinate
4235 Float_t pybypx, phi = 0., phi1;
4238 if(yPos>0) phi = 90.;
4239 if(yPos<0) phi = 270.;
4244 if(pybypx < 0) pybypx = - pybypx;
4245 phi1 = TMath::ATan(pybypx)*180./3.14159;
4247 if(xPos > 0 && yPos > 0) phi = phi1; // 1st Quadrant
4248 if(xPos < 0 && yPos > 0) phi = 180 - phi1; // 2nd Quadrant
4249 if(xPos < 0 && yPos < 0) phi = 180 + phi1; // 3rd Quadrant
4250 if(xPos > 0 && yPos < 0) phi = 360 - phi1; // 4th Quadrant
4253 phi = phi*3.14159/180.;
4257 //---------------------------------------------------------------//
4258 void AliFlowTrackCuts::Browse(TBrowser* b)
4260 //some browsing capabilities
4261 if (fQA) b->Add(fQA);
4264 //---------------------------------------------------------------//
4265 Long64_t AliFlowTrackCuts::Merge(TCollection* list)
4268 if (!fQA || !list) return 0;
4269 if (list->IsEmpty()) return 0;
4270 AliFlowTrackCuts* obj=NULL;
4273 while ( (obj = dynamic_cast<AliFlowTrackCuts*>(next())) )
4275 if (obj==this) continue;
4276 tmplist.Add(obj->GetQA());
4278 return fQA->Merge(&tmplist);