1 //////////////////////////////////////////////////////////////////////
5 // Author: Emanuele Simili
7 //////////////////////////////////////////////////////////////////////
8 //_____________________________________________________________
11 // the AliFlowSelection Class selects tracks from the AliFlowEvent.
12 // There are two kind of selection :
13 // - Selection of tracks for the R.P. determination is performed via the
14 // method Select(AliFlowTrack*): it simply checks the labels array of
15 // the track. Those arrays must be previously filled by calling
16 // AliFlowEvent::SetSelection(), wich uses the static cuts defined here.
17 // Set the flag to Select via SetHarmonic() and SetSelection().
18 // - Selection of tracks for Correlation Analysis is performed via the
19 // method SelectPart(AliFlowEvent*): cuts are applied to tracks
20 // (such as p.id, pT, total P, rapidity, eta, number of fit points,
21 // ratio of fit points to max points, chi2, and global dca).
22 // Set the cuts to apply via the appropriate Set...() methods.
24 // The AliFlowSelection Class is adapted from the original StFlowSelection,
25 // succesfully used to study flow in the STAR experiment at RICH.
26 // Original Authors: Raimond Snellings & Art Poskanzer
29 #include "AliFlowSelection.h"
30 #include "AliFlowEvent.h"
31 #include "AliFlowTrack.h"
32 #include "AliFlowV0.h"
33 #include "AliFlowConstants.h"
38 using namespace std; //required for resolving the 'cout' symbol
40 // - 1st selection (both harmonic) is Disabled ! - the 2 following are the same (basic cuts, no P.id)
41 Float_t AliFlowSelection::fgEtaTpcCuts[2][AliFlowConstants::kHars][AliFlowConstants::kSels] = {{{1.0,0.0},{1.0,0.0}},{{0.0,1.1},{0.0,1.1}}} ;
42 Float_t AliFlowSelection::fgPtTpcCuts[2][AliFlowConstants::kHars][AliFlowConstants::kSels] = {{{1.0,0.1},{1.0,0.1}},{{0.0,10.0},{0.0,10.0}}} ;
43 Float_t AliFlowSelection::fgDcaGlobalCuts[2] = { 0. , 1. } ;
44 Char_t AliFlowSelection::fgPid[10] = { '\0' } ;
45 Bool_t AliFlowSelection::fgConstrainable = kTRUE ;
46 Int_t AliFlowSelection::fgTPChits[AliFlowConstants::kSels] = { 0 , 1 } ;
48 ClassImp(AliFlowSelection)
49 //-----------------------------------------------------------------------
50 AliFlowSelection::AliFlowSelection():
51 fHarmonic(-1), fSelection(-1), fSubevent(-1), fPtBinsPart(AliFlowConstants::kPtBinsPart), fCent(-1), fRun(-1), fV0SideBand(0.), fConstrainablePart(kFALSE)
53 // Default constructor: when initialized all selection cuts are disabled (lo>hi).
57 fPidProbPart[0] = 1 ; // = 0.
58 fPidProbPart[1] = 0 ; // = 1.
59 fPtPart[0] = 1 ; // = 0.
60 fPtPart[1] = 0 ; // = 10.
61 fPPart[0] = 1 ; // = 0.
62 fPPart[1] = 0 ; // = 10.
63 fEtaPart[0] = 1 ; // = -0.9
64 fEtaPart[1] = 0 ; // = 0.9
65 fEtaAbsPart[0] = 1 ; // = 0.
66 fEtaAbsPart[1] = 0 ; // = 0.9
67 fFitPtsPart[0] = 1 ; // = 0
68 fFitPtsPart[1] = 0 ; // = 0
69 fDedxPtsPart[0] = 1 ; // = 0
70 fDedxPtsPart[1] = 0 ; // = 0
71 fFitOverMaxPtsPart[0] = 1 ; // = 0.
72 fFitOverMaxPtsPart[1] = 0 ; // = 0.
73 fChiSqPart[0] = 1 ; // = 0.
74 fChiSqPart[1] = 0 ; // = 100.
75 fDcaGlobalPart[0] = 1 ; // = 0.
76 fDcaGlobalPart[1] = 0 ; // = 1.
77 fDcaOverSigma[0] = 1 ; // = 0. ;
78 fDcaOverSigma[1] = 0 ; // = 1. ;
79 fYPart[0] = 1 ; // = 0.
80 fYPart[1] = 0 ; // = 0.
97 fV0LenghtOverSigma[0] = 1 ;
98 fV0LenghtOverSigma[1] = 0 ;
104 //-----------------------------------------------------------------------
105 AliFlowSelection::~AliFlowSelection()
107 // default destructor (dummy)
109 //-----------------------------------------------------------------------
110 Bool_t AliFlowSelection::Select(AliFlowEvent* pFlowEvent) const
112 // Returns kTRUE if the event is selected.
114 if((fCent>=0) && ((Int_t)pFlowEvent->Centrality() != fCent)) { return kFALSE ; }
115 //if(pFlowEvent->RunID() != fRun) { return kFALSE ; }
116 //if(pFlowEvent->... != ...) { return kFALSE ; }
120 //-----------------------------------------------------------------------
121 Bool_t AliFlowSelection::Select(AliFlowTrack* pFlowTrack) const
123 // Selects particles for event plane determination.
124 // Returns kTRUE if the track is selected.
126 if(!pFlowTrack->Select(fHarmonic, fSelection, fSubevent)) { return kFALSE ; }
129 //-----------------------------------------------------------------------
130 Bool_t AliFlowSelection::Select(AliFlowV0* pFlowV0) const
132 // Returns kTRUE if the v0 is selected. (dummy)
134 if(!pFlowV0) { return kFALSE ; }
137 //-----------------------------------------------------------------------
138 Bool_t AliFlowSelection::SelectPart(AliFlowTrack* pFlowTrack) const
140 // Make track selection for Correlation Analysis & Vn (charged particles
141 // to correlate with the event plane).
142 // Returns kTRUE if the track is selected.
145 if(fPidPart[0] != '\0')
147 if(strstr(fPidPart, "h")!=0) // if fPidPart contains the char "h"
149 int charge = pFlowTrack->Charge();
150 if(strcmp("h+", fPidPart)==0 && charge != 1) return kFALSE; // if fPidPart == "h+"
151 if(strcmp("h-", fPidPart)==0 && charge != -1) return kFALSE;
155 const Char_t* pid = pFlowTrack->Pid() ;
156 if(strstr(pid, fPidPart)==0) return kFALSE; // if pFlowTrack->Pid() does not contain fPidPart (RP. selected parts.)
161 float pidProb = pFlowTrack->MostLikelihoodRespFunc() ;
162 if(fPidProbPart[1] > fPidProbPart[0] && (pidProb < fPidProbPart[0] || pidProb > fPidProbPart[1])) return kFALSE;
165 bool constrainable = pFlowTrack->IsConstrainable() ;
166 if(fConstrainablePart && !constrainable) return kFALSE;
169 float pt = pFlowTrack->Pt();
170 if(fPtPart[1] > fPtPart[0] && (pt < fPtPart[0] || pt > fPtPart[1])) return kFALSE;
173 float totalp = pFlowTrack->P();
174 if(fPPart[1] > fPPart[0] && (totalp < fPPart[0] || totalp > fPPart[1])) return kFALSE;
177 float eta = pFlowTrack->Eta();
178 if(fEtaPart[1] > fEtaPart[0] && (eta < fEtaPart[0] || eta > fEtaPart[1])) return kFALSE;
181 float absEta = TMath::Abs(pFlowTrack->Eta());
182 if(fEtaAbsPart[1] > fEtaAbsPart[0] && (absEta < fEtaAbsPart[0] || absEta > fEtaAbsPart[1])) return kFALSE;
185 int fitPts = pFlowTrack->FitPtsTPC();
186 if(fFitPtsPart[1] > fFitPtsPart[0] && (fitPts < fFitPtsPart[0] || fitPts > fFitPtsPart[1])) return kFALSE;
188 // Fit Points over Max Points (TPC)
189 int maxPts = pFlowTrack->MaxPtsTPC();
192 float fitOverMaxPts = (float)(fitPts)/(float)maxPts ;
193 if(fFitOverMaxPtsPart[1] > fFitOverMaxPtsPart[0] && (fitOverMaxPts < fFitOverMaxPtsPart[0] || fitOverMaxPts > fFitOverMaxPtsPart[1])) return kFALSE;
196 // Chi Squared (main Vertex)
197 float chiSq = pFlowTrack->Chi2();
198 if(fChiSqPart[1] > fChiSqPart[0] && (chiSq < fChiSqPart[0] || chiSq > fChiSqPart[1])) return kFALSE;
201 float globdca = pFlowTrack->Dca();
202 if(fDcaGlobalPart[1] > fDcaGlobalPart[0] && (globdca < fDcaGlobalPart[0] || globdca > fDcaGlobalPart[1])) return kFALSE;
205 float dcaSigma = 1. ;
206 if(pFlowTrack->TransDcaError() != 0) { dcaSigma = pFlowTrack->TransDca() / pFlowTrack->TransDcaError() ; }
207 if(fDcaOverSigma[1] > fDcaOverSigma[0] && (dcaSigma < fDcaOverSigma[0] || dcaSigma > fDcaOverSigma[1])) return kFALSE;
210 float y = pFlowTrack->Y();
211 if(fYPart[1] > fYPart[0] && (y < fYPart[0] || y > fYPart[1])) return kFALSE;
215 //-----------------------------------------------------------------------
216 Bool_t AliFlowSelection::SelectPart(AliFlowV0* pFlowV0) const
218 // Make v0 selection for Correlation Analysis & Vn (neutral particles
219 // to correlate with the event plane).
220 // Returns kTRUE if the v0 is selected.
223 if(fV0Pid[0] != '\0')
225 if(strstr(fV0Pid, '\0')!=0)
227 int charge = pFlowV0->Charge();
228 if(strcmp("0", fV0Pid)==0 && charge != 0) return kFALSE;
232 const Char_t* pid = pFlowV0->Pid() ;
233 if(strstr(pid, fV0Pid)==0) return kFALSE;
238 float mass = pFlowV0->Mass() ;
239 if(fV0Mass[1]>fV0Mass[0])
241 float massMin = fV0Mass[0]-fV0SideBand ;
242 float massMax = fV0Mass[1]+fV0SideBand ;
243 if((mass < massMin) || (mass > massMax)) return kFALSE ;
247 float pt = pFlowV0->Pt();
248 if(fV0Pt[1] > fV0Pt[0] && (pt < fV0Pt[0] || pt > fV0Pt[1])) return kFALSE;
251 float totalp = pFlowV0->P();
252 if(fV0P[1] > fV0P[0] && (totalp < fV0P[0] || totalp > fV0P[1])) return kFALSE;
255 float eta = pFlowV0->Eta();
256 if(fV0Eta[1] > fV0Eta[0] && (eta < fV0Eta[0] || eta > fV0Eta[1])) return kFALSE;
259 float absEta = TMath::Abs(pFlowV0->Eta());
260 if(fV0EtaAbs[1] > fV0EtaAbs[0] && (absEta < fV0EtaAbs[0] || absEta > fV0EtaAbs[1])) return kFALSE;
262 // Chi Squared (main Vertex)
263 float chiSq = pFlowV0->Chi2();
264 if(fV0ChiSq[1] > fV0ChiSq[0] && (chiSq < fV0ChiSq[0] || chiSq > fV0ChiSq[1])) return kFALSE;
267 float cdca = pFlowV0->DaughtersDca() ;
268 if(fV0DcaCross[1] > fV0DcaCross[0] && (cdca < fV0DcaCross[0] || cdca > fV0DcaCross[1])) return kFALSE;
271 float lenght = pFlowV0->V0Lenght() ;
272 if(fV0Lenght[1] > fV0Lenght[0] && (lenght < fV0Lenght[0] || lenght > fV0Lenght[1])) return kFALSE;
275 float sigma = pFlowV0->Sigma() ;
278 float lenghtOverSigma = lenght/sigma ;
279 if(fV0LenghtOverSigma[1] > fV0LenghtOverSigma[0] && (lenghtOverSigma < fV0LenghtOverSigma[0] || lenghtOverSigma > fV0LenghtOverSigma[1])) return kFALSE;
283 float y = pFlowV0->Y();
284 if(fV0Y[1] > fV0Y[0] && (y < fV0Y[0] || y > fV0Y[1])) return kFALSE;
288 //-----------------------------------------------------------------------
289 Bool_t AliFlowSelection::SelectV0Part(AliFlowV0* pFlowV0) const
291 // selects v0s in the invariant Mass window
293 float mass = pFlowV0->Mass() ;
294 if(fV0Mass[1]>fV0Mass[0])
296 if(mass < fV0Mass[0] || mass > fV0Mass[1]) return kFALSE ;
300 //-----------------------------------------------------------------------
301 Bool_t AliFlowSelection::SelectV0Side(AliFlowV0* pFlowV0) const
303 // selects v0s in the sidebands of the Mass window
305 float mass = pFlowV0->Mass() ;
306 if(fV0Mass[1]>fV0Mass[0])
308 float massMin = fV0Mass[0]-fV0SideBand ;
309 float massMax = fV0Mass[1]+fV0SideBand ;
310 if((mass < massMin) || (mass >= fV0Mass[0] && mass <= fV0Mass[1]) || (mass > massMax)) return kFALSE ;
314 //-----------------------------------------------------------------------
315 Bool_t AliFlowSelection::SelectV0sxSide(AliFlowV0* pFlowV0) const
317 // selects v0s in the left hand sideband
319 float mass = pFlowV0->Mass() ;
320 float massMin = fV0Mass[0]-fV0SideBand ;
321 if((mass >= massMin) && (mass < fV0Mass[0])) { return kTRUE ; }
322 else { return kFALSE ; }
324 //-----------------------------------------------------------------------
325 Bool_t AliFlowSelection::SelectV0dxSide(AliFlowV0* pFlowV0) const
327 // selects v0s in the right hand sideband
329 float mass = pFlowV0->Mass() ;
330 float massMax = fV0Mass[1]+fV0SideBand ;
331 if((mass > fV0Mass[1]) && (mass <= massMax)) { return kTRUE ; }
332 else { return kFALSE ; }
334 //-----------------------------------------------------------------------
335 void AliFlowSelection::PrintList() const
337 // Prints the selection criteria for correlation analysis
339 cout << "#################################################################" << endl;
340 cout << "# Selection List (particles correlated to the event plane):" << endl;
341 cout << "# " << endl;
342 if(fPidPart[0]!='\0')
343 { cout << "# P.id for particles correlated to the event plane: " << fPidPart << " " << endl ; }
344 if(fPtPart[1]>fPtPart[0])
345 { cout << "# Pt for particles correlated to the event plane: " << fPtPart[0] << " to " << fPtPart[1] << " GeV/c" << endl ; }
346 if(fPPart[1]>fPPart[0])
347 { cout << "# P for particles correlated to the event plane: " << fPPart[0] << " to " << fPPart[1] << " GeV/c" << endl ; }
348 if(fEtaPart[1]>fEtaPart[0])
349 { cout << "# Eta for particles correlated to the event plane: " << fEtaPart[0] << " to " << fEtaPart[1] << endl ; }
350 if(fEtaAbsPart[1]>fEtaAbsPart[0])
351 { cout << "# |Eta| for V0s correlated to the event plane: " << fEtaAbsPart[0] << " to " << fEtaAbsPart[1] << endl ; }
352 if(fYPart[1]>fYPart[0])
353 { cout << "# Y for particles correlated to the event plane: " << fYPart[0] << " to " << fYPart[1] << endl ; }
354 if(fFitPtsPart[1]>fFitPtsPart[0])
355 { cout << "# Fit Points for particles correlated to the event plane: " << fFitPtsPart[0] << " to " << fFitPtsPart[1] << endl ; }
356 if(fDedxPtsPart[1]>fDedxPtsPart[0])
357 { cout << "# Dedx Points for particles correlated to the event plane: " << fDedxPtsPart[0] << " to " << fDedxPtsPart[1] << endl ; }
358 if(fFitOverMaxPtsPart[1]>fFitOverMaxPtsPart[0])
359 { cout << "# Fit/Max Points for particles correlated to the event plane: " << fFitOverMaxPtsPart[0] << " to " << fFitOverMaxPtsPart[1] << endl ; }
360 if(fChiSqPart[1]>fChiSqPart[0])
361 { cout << "# Chi2 for particles correlated to the event plane: " << fChiSqPart[0] << " to " << fChiSqPart[1] << endl ; }
362 if(fDcaGlobalPart[1]>fDcaGlobalPart[0])
363 { cout << "# Global Dca for particles correlated with the event plane: " << fDcaGlobalPart[0] << " to " << fDcaGlobalPart[1] << endl ; }
364 if(fDcaOverSigma[1]>fDcaOverSigma[0])
365 { cout << "# Transverse Dca / Sigma for particles correlated with the event plane: " << fDcaOverSigma[0] << " to " << fDcaOverSigma[1] << endl ; }
366 if(fConstrainablePart) { cout << "# Constrainability cut: Constrained Tracks " << endl ; }
367 cout << "#################################################################" << endl;
369 //-----------------------------------------------------------------------
370 void AliFlowSelection::PrintV0List() const
372 // Prints the selection criteria for V0s
374 cout << "#################################################################" << endl;
375 cout << "# Selection List (V0s correlated with the event plane):" << endl;
376 cout << "# " << endl;
378 { cout << "# P.id for V0s correlated to the event plane: " << fV0Pid << " " << endl ; }
379 if(fV0Mass[1]>fV0Mass[0])
382 { cout << "# Invariant Mass for V0s correlated to the event plane: " << fV0Mass[0] << " to " << fV0Mass[1] << endl ; }
384 { cout << "# Invariant Mass for V0-SideBands correlated to the event plane: " << fV0Mass[0]-fV0SideBand << " to " << fV0Mass[0] << " & " << fV0Mass[1] << " to " << fV0Mass[1]+fV0SideBand << endl ; }
386 if(fV0Pt[1]>fV0Pt[0])
387 { cout << "# Pt for V0s correlated to the event plane: " << fV0Pt[0] << " to " << fV0Pt[1] << " GeV/c" << endl ; }
389 { cout << "# P for V0s correlated to the event plane: " << fV0P[0] << " to " << fV0P[1] << " GeV/c" << endl ; }
390 if(fV0Eta[1]>fV0Eta[0])
391 { cout << "# Eta for V0s correlated to the event plane: " << fV0Eta[0] << " to " << fV0Eta[1] << endl ; }
392 if(fV0EtaAbs[1]>fV0EtaAbs[0])
393 { cout << "# |Eta| for V0s correlated to the event plane: " << fV0EtaAbs[0] << " to " << fV0EtaAbs[1] << endl ; }
395 { cout << "# Y for V0s correlated to the event plane: " << fV0Y[0] << " to " << fV0Y[1] << endl ; }
396 if(fV0ChiSq[1]>fV0ChiSq[0])
397 { cout << "# Chi2 for V0s correlated to the event plane: " << fV0ChiSq[0] << " to " << fV0ChiSq[1] << endl ; }
398 if(fV0DcaCross[1]>fV0DcaCross[0])
399 { cout << "# Closest approach between the daughter tracks for V0s correlated to the event plane: " << fV0DcaCross[0] << " to " << fV0DcaCross[1] << endl ; }
400 if(fV0Lenght[1]>fV0Lenght[0])
401 { cout << "# ... for V0s correlated to the event plane: " << fV0Lenght[0] << " to " << fV0Lenght[1] << endl ; }
402 if(fV0LenghtOverSigma[1]>fV0LenghtOverSigma[0])
403 { cout << "# ... for V0s correlated to the event plane: " << fV0LenghtOverSigma[0] << " to " << fV0LenghtOverSigma[1] << endl ; }
404 cout << "#################################################################" << endl;
406 //-----------------------------------------------------------------------
407 void AliFlowSelection::PrintSelectionList() const
409 // Prints the list of selection cuts for RP determination
413 cout << "#######################################################" << endl;
414 cout << "# Event centrality: " << endl ;
416 if(fCent==0) { lowC=0 ; hiC=AliFlowConstants::fgCentNorm[0] * AliFlowConstants::fgMaxMult ; }
417 else if(fCent>8) { lowC=AliFlowConstants::fgCentNorm[8] * AliFlowConstants::fgMaxMult ; hiC=99999 ; }
418 else { lowC=AliFlowConstants::fgCentNorm[fCent-1] * AliFlowConstants::fgMaxMult ; hiC=AliFlowConstants::fgCentNorm[fCent] * AliFlowConstants::fgMaxMult ; }
419 cout << "# - Centrality Class = " << fCent << " ( " << (int)lowC << " < mult < " << (int)hiC << " ) . " << endl ;
423 cout << "#######################################################" << endl;
424 cout << "# All centralities " << endl ;
427 cout << "#######################################################" << endl;
428 cout << "# Tracks used for the event plane: " << endl ;
429 cout << "# - Selection[0] (for all " << AliFlowConstants::kHars << " Harmonics) : " << endl ;
430 cout << "# NO CUTS " << endl ;
431 cout << "# - Selection[1+] (for all " << AliFlowConstants::kHars << " Harmonics) : " << endl ;
432 if(Pid()[0] != '\0') { cout << "# Particle ID = " << Pid() << endl ; }
433 if(ConstrainCut()) { cout << "# Constrainable Tracks " << endl ; }
434 if(DcaGlobalCutHi()>DcaGlobalCutLo()) { cout << "# Global Dca Tpc cuts = " << DcaGlobalCutLo() << " , " << DcaGlobalCutHi() << endl ; }
435 for (int k = 1; k < AliFlowConstants::kSels; k++)
437 for (int j = 0; j < AliFlowConstants::kHars ; j++)
439 cout << "# - Selection[" << k << "] , Harmonic[" << j+1 << "] :" << endl ;
440 if(NhitsCut(k)) { cout << "# Minimum TPC hits = " << NhitsCut(k) << endl ; }
441 if(EtaCutHi(j,k)>EtaCutLo(j,k)) { cout << "# TMath::Abs(Eta) cuts = " << EtaCutLo(j,k) << " , " << EtaCutHi(j,k) << endl ; }
442 if(PtCutHi(j,k)>PtCutLo(j,k)) { cout << "# Pt cuts = " << PtCutLo(j,k) << " , " << PtCutHi(j,k) << endl ; }
445 cout << "#######################################################" << endl;
447 //-----------------------------------------------------------------------
448 void AliFlowSelection::SetHarmonic(const Int_t& harN)
450 // sets the Harmonic #
452 if(harN < 0 || harN >= AliFlowConstants::kHars)
454 cout << "### Harmonic " << harN << " not valid" << endl;
457 else { fHarmonic = harN; }
459 //-----------------------------------------------------------------------
460 void AliFlowSelection::SetSelection(const Int_t& selN)
462 // sets the Selection #
464 if(selN < 0 || selN >= AliFlowConstants::kSels)
466 cout << "### Selection " << selN << " not valid" << endl;
469 else { fSelection = selN; }
471 //-----------------------------------------------------------------------
472 void AliFlowSelection::SetSubevent(const Int_t& subN)
474 // sets the Sub-Event # (-1 for the full-event)
476 if(subN < -1 || subN > AliFlowConstants::kSubs)
478 cout << "### Subevent " << subN << " not valid" << endl;
481 else { fSubevent = subN; }
483 //-----------------------------------------------------------------------
484 Float_t AliFlowSelection::PtMaxPart() const
486 // Returns the upper pT cut for particle used in correlation analysis
488 if(fPtPart[1]>fPtPart[0]) { return fPtPart[1] ; }
491 //-----------------------------------------------------------------------