1 //////////////////////////////////////////////////////////////////////
3 // $Id: AliFlowSelection.cxx 18618 2007-05-16 15:38:22Z snelling $
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).
56 fPidProbPart[0] = 1 ; // = 0.
57 fPidProbPart[1] = 0 ; // = 1.
58 fPtPart[0] = 1 ; // = 0.
59 fPtPart[1] = 0 ; // = 10.
60 fPPart[0] = 1 ; // = 0.
61 fPPart[1] = 0 ; // = 10.
62 fEtaPart[0] = 1 ; // = -0.9
63 fEtaPart[1] = 0 ; // = 0.9
64 fEtaAbsPart[0] = 1 ; // = 0.
65 fEtaAbsPart[1] = 0 ; // = 0.9
66 fFitPtsPart[0] = 1 ; // = 0
67 fFitPtsPart[1] = 0 ; // = 0
68 fDedxPtsPart[0] = 1 ; // = 0
69 fDedxPtsPart[1] = 0 ; // = 0
70 fFitOverMaxPtsPart[0] = 1 ; // = 0.
71 fFitOverMaxPtsPart[1] = 0 ; // = 0.
72 fChiSqPart[0] = 1 ; // = 0.
73 fChiSqPart[1] = 0 ; // = 100.
74 fDcaGlobalPart[0] = 1 ; // = 0.
75 fDcaGlobalPart[1] = 0 ; // = 1.
76 fDcaOverSigma[0] = 1 ; // = 0. ;
77 fDcaOverSigma[1] = 0 ; // = 1. ;
78 fYPart[0] = 1 ; // = 0.
79 fYPart[1] = 0 ; // = 0.
95 fV0LenghtOverSigma[0] = 1 ;
96 fV0LenghtOverSigma[1] = 0 ;
102 //-----------------------------------------------------------------------
103 AliFlowSelection::~AliFlowSelection()
105 // default destructor (dummy)
107 //-----------------------------------------------------------------------
108 Bool_t AliFlowSelection::Select(AliFlowEvent* pFlowEvent) const
110 // Returns kTRUE if the event is selected.
112 if((fCent>=0) && ((Int_t)pFlowEvent->Centrality() != fCent)) { return kFALSE ; }
113 //if(pFlowEvent->RunID() != fRun) { return kFALSE ; }
114 //if(pFlowEvent->... != ...) { return kFALSE ; }
118 //-----------------------------------------------------------------------
119 Bool_t AliFlowSelection::Select(AliFlowTrack* pFlowTrack) const
121 // Selects particles for event plane determination.
122 // Returns kTRUE if the track is selected.
124 if(!pFlowTrack->Select(fHarmonic, fSelection, fSubevent)) { return kFALSE ; }
127 //-----------------------------------------------------------------------
128 Bool_t AliFlowSelection::Select(AliFlowV0* pFlowV0) const
130 // Returns kTRUE if the v0 is selected. (dummy)
132 if(!pFlowV0) { return kFALSE ; }
135 //-----------------------------------------------------------------------
136 Bool_t AliFlowSelection::SelectPart(AliFlowTrack* pFlowTrack) const
138 // Make track selection for Correlation Analysis & Vn (charged particles
139 // to correlate with the event plane).
140 // Returns kTRUE if the track is selected.
143 if(fPidPart[0] != '\0')
145 if(strstr(fPidPart, "h")!=0) // if fPidPart contains the char "h"
147 int charge = pFlowTrack->Charge();
148 if(strcmp("h+", fPidPart)==0 && charge != 1) return kFALSE; // if fPidPart == "h+"
149 if(strcmp("h-", fPidPart)==0 && charge != -1) return kFALSE;
153 const Char_t* pid = pFlowTrack->Pid() ;
154 if(strstr(pid, fPidPart)==0) return kFALSE; // if pFlowTrack->Pid() does not contain fPidPart (RP. selected parts.)
159 float pidProb = pFlowTrack->MostLikelihoodRespFunc() ;
160 if(fPidProbPart[1] > fPidProbPart[0] && (pidProb < fPidProbPart[0] || pidProb > fPidProbPart[1])) return kFALSE;
163 bool constrainable = pFlowTrack->IsConstrainable() ;
164 if(fConstrainablePart && !constrainable) return kFALSE;
167 float pt = pFlowTrack->Pt();
168 if(fPtPart[1] > fPtPart[0] && (pt < fPtPart[0] || pt > fPtPart[1])) return kFALSE;
171 float totalp = pFlowTrack->P();
172 if(fPPart[1] > fPPart[0] && (totalp < fPPart[0] || totalp > fPPart[1])) return kFALSE;
175 float eta = pFlowTrack->Eta();
176 if(fEtaPart[1] > fEtaPart[0] && (eta < fEtaPart[0] || eta > fEtaPart[1])) return kFALSE;
179 float absEta = TMath::Abs(pFlowTrack->Eta());
180 if(fEtaAbsPart[1] > fEtaAbsPart[0] && (absEta < fEtaAbsPart[0] || absEta > fEtaAbsPart[1])) return kFALSE;
183 int fitPts = pFlowTrack->FitPtsTPC();
184 if(fFitPtsPart[1] > fFitPtsPart[0] && (fitPts < fFitPtsPart[0] || fitPts > fFitPtsPart[1])) return kFALSE;
186 // Fit Points over Max Points (TPC)
187 int maxPts = pFlowTrack->MaxPtsTPC();
190 float fitOverMaxPts = (float)(fitPts)/(float)maxPts ;
191 if(fFitOverMaxPtsPart[1] > fFitOverMaxPtsPart[0] && (fitOverMaxPts < fFitOverMaxPtsPart[0] || fitOverMaxPts > fFitOverMaxPtsPart[1])) return kFALSE;
194 // Chi Squared (main Vertex)
195 float chiSq = pFlowTrack->Chi2();
196 if(fChiSqPart[1] > fChiSqPart[0] && (chiSq < fChiSqPart[0] || chiSq > fChiSqPart[1])) return kFALSE;
199 float globdca = pFlowTrack->Dca();
200 if(fDcaGlobalPart[1] > fDcaGlobalPart[0] && (globdca < fDcaGlobalPart[0] || globdca > fDcaGlobalPart[1])) return kFALSE;
203 float dcaSigma = 1. ;
204 if(pFlowTrack->TransDcaError() != 0) { dcaSigma = pFlowTrack->TransDca() / pFlowTrack->TransDcaError() ; }
205 if(fDcaOverSigma[1] > fDcaOverSigma[0] && (dcaSigma < fDcaOverSigma[0] || dcaSigma > fDcaOverSigma[1])) return kFALSE;
208 float y = pFlowTrack->Y();
209 if(fYPart[1] > fYPart[0] && (y < fYPart[0] || y > fYPart[1])) return kFALSE;
213 //-----------------------------------------------------------------------
214 Bool_t AliFlowSelection::SelectPart(AliFlowV0* pFlowV0) const
216 // Make v0 selection for Correlation Analysis & Vn (neutral particles
217 // to correlate with the event plane).
218 // Returns kTRUE if the v0 is selected.
221 float mass = pFlowV0->Mass() ;
222 if(fV0Mass[1]>fV0Mass[0])
224 float massMin = fV0Mass[0]-fV0SideBand ;
225 float massMax = fV0Mass[1]+fV0SideBand ;
226 if((mass < massMin) || (mass > massMax)) return kFALSE ;
230 float pt = pFlowV0->Pt();
231 if(fV0Pt[1] > fV0Pt[0] && (pt < fV0Pt[0] || pt > fV0Pt[1])) return kFALSE;
234 float totalp = pFlowV0->P();
235 if(fV0P[1] > fV0P[0] && (totalp < fV0P[0] || totalp > fV0P[1])) return kFALSE;
238 float eta = pFlowV0->Eta();
239 if(fV0Eta[1] > fV0Eta[0] && (eta < fV0Eta[0] || eta > fV0Eta[1])) return kFALSE;
242 float absEta = TMath::Abs(pFlowV0->Eta());
243 if(fV0EtaAbs[1] > fV0EtaAbs[0] && (absEta < fV0EtaAbs[0] || absEta > fV0EtaAbs[1])) return kFALSE;
245 // Chi Squared (main Vertex)
246 float chiSq = pFlowV0->Chi2();
247 if(fV0ChiSq[1] > fV0ChiSq[0] && (chiSq < fV0ChiSq[0] || chiSq > fV0ChiSq[1])) return kFALSE;
250 float cdca = pFlowV0->DaughtersDca() ;
251 if(fV0DcaCross[1] > fV0DcaCross[0] && (cdca < fV0DcaCross[0] || cdca > fV0DcaCross[1])) return kFALSE;
254 float lenght = pFlowV0->V0Lenght() ;
255 if(fV0Lenght[1] > fV0Lenght[0] && (lenght < fV0Lenght[0] || lenght > fV0Lenght[1])) return kFALSE;
258 float sigma = pFlowV0->Sigma() ;
261 float lenghtOverSigma = lenght/sigma ;
262 if(fV0LenghtOverSigma[1] > fV0LenghtOverSigma[0] && (lenghtOverSigma < fV0LenghtOverSigma[0] || lenghtOverSigma > fV0LenghtOverSigma[1])) return kFALSE;
266 float y = pFlowV0->Y();
267 if(fV0Y[1] > fV0Y[0] && (y < fV0Y[0] || y > fV0Y[1])) return kFALSE;
270 // if(fV0Pid[0] != '\0')
272 // int numPid = TMath::Abs(pFlowV0->MostLikelihoodPID()) ;
273 // if((fV0Pid = "gamma") && (fMostLikelihoodPID != 22)) { return kFALSE ; }
274 // else if((fV0Pid = "K0") && (fMostLikelihoodPID != 311)) { return kFALSE ; }
275 // else if((fV0Pid = "K0s") && (fMostLikelihoodPID != 310)) { return kFALSE ; }
276 // else if((fV0Pid = "K0l") && (fMostLikelihoodPID != 130)) { return kFALSE ; }
277 // else if((fV0Pid = "Lambda0") && (fMostLikelihoodPID != 3122)) { return kFALSE ; }
282 //-----------------------------------------------------------------------
283 Bool_t AliFlowSelection::SelectV0Part(AliFlowV0* pFlowV0) const
285 // selects v0s in the invariant Mass window
287 float mass = pFlowV0->Mass() ;
288 if(fV0Mass[1]>fV0Mass[0])
290 if(mass < fV0Mass[0] || mass > fV0Mass[1]) return kFALSE ;
294 //-----------------------------------------------------------------------
295 Bool_t AliFlowSelection::SelectV0Side(AliFlowV0* pFlowV0) const
297 // selects v0s in the sidebands of the Mass window
299 float mass = pFlowV0->Mass() ;
300 if(fV0Mass[1]>fV0Mass[0])
302 float massMin = fV0Mass[0]-fV0SideBand ;
303 float massMax = fV0Mass[1]+fV0SideBand ;
304 if((mass < massMin) || (mass >= fV0Mass[0] && mass <= fV0Mass[1]) || (mass > massMax)) return kFALSE ;
308 //-----------------------------------------------------------------------
309 Bool_t AliFlowSelection::SelectV0sxSide(AliFlowV0* pFlowV0) const
311 // selects v0s in the left hand sideband
313 float mass = pFlowV0->Mass() ;
314 float massMin = fV0Mass[0]-fV0SideBand ;
315 if((mass >= massMin) && (mass < fV0Mass[0])) { return kTRUE ; }
316 else { return kFALSE ; }
318 //-----------------------------------------------------------------------
319 Bool_t AliFlowSelection::SelectV0dxSide(AliFlowV0* pFlowV0) const
321 // selects v0s in the right hand sideband
323 float mass = pFlowV0->Mass() ;
324 float massMax = fV0Mass[1]+fV0SideBand ;
325 if((mass > fV0Mass[1]) && (mass <= massMax)) { return kTRUE ; }
326 else { return kFALSE ; }
328 //-----------------------------------------------------------------------
329 void AliFlowSelection::PrintList() const
331 // Prints the selection criteria for correlation analysis
333 cout << "#################################################################" << endl;
334 cout << "# Selection List (particles correlated to the event plane):" << endl;
335 cout << "# " << endl;
336 if(fPidPart[0]!='\0')
337 { cout << "# P.id for particles correlated to the event plane: " << fPidPart << " " << endl ; }
338 if(fPtPart[1]>fPtPart[0])
339 { cout << "# Pt for particles correlated to the event plane: " << fPtPart[0] << " to " << fPtPart[1] << " GeV/c" << endl ; }
340 if(fPPart[1]>fPPart[0])
341 { cout << "# P for particles correlated to the event plane: " << fPPart[0] << " to " << fPPart[1] << " GeV/c" << endl ; }
342 if(fEtaPart[1]>fEtaPart[0])
343 { cout << "# Eta for particles correlated to the event plane: " << fEtaPart[0] << " to " << fEtaPart[1] << endl ; }
344 if(fEtaAbsPart[1]>fEtaAbsPart[0])
345 { cout << "# |Eta| for V0s correlated to the event plane: " << fEtaAbsPart[0] << " to " << fEtaAbsPart[1] << endl ; }
346 if(fYPart[1]>fYPart[0])
347 { cout << "# Y for particles correlated to the event plane: " << fYPart[0] << " to " << fYPart[1] << endl ; }
348 if(fFitPtsPart[1]>fFitPtsPart[0])
349 { cout << "# Fit Points for particles correlated to the event plane: " << fFitPtsPart[0] << " to " << fFitPtsPart[1] << endl ; }
350 if(fDedxPtsPart[1]>fDedxPtsPart[0])
351 { cout << "# Dedx Points for particles correlated to the event plane: " << fDedxPtsPart[0] << " to " << fDedxPtsPart[1] << endl ; }
352 if(fFitOverMaxPtsPart[1]>fFitOverMaxPtsPart[0])
353 { cout << "# Fit/Max Points for particles correlated to the event plane: " << fFitOverMaxPtsPart[0] << " to " << fFitOverMaxPtsPart[1] << endl ; }
354 if(fChiSqPart[1]>fChiSqPart[0])
355 { cout << "# Chi2 for particles correlated to the event plane: " << fChiSqPart[0] << " to " << fChiSqPart[1] << endl ; }
356 if(fDcaGlobalPart[1]>fDcaGlobalPart[0])
357 { cout << "# Global Dca for particles correlated with the event plane: " << fDcaGlobalPart[0] << " to " << fDcaGlobalPart[1] << endl ; }
358 if(fDcaOverSigma[1]>fDcaOverSigma[0])
359 { cout << "# Transverse Dca / Sigma for particles correlated with the event plane: " << fDcaOverSigma[0] << " to " << fDcaOverSigma[1] << endl ; }
360 if(fConstrainablePart) { cout << "# Constrainability cut: Constrained Tracks " << endl ; }
361 cout << "#################################################################" << endl;
363 //-----------------------------------------------------------------------
364 void AliFlowSelection::PrintV0List() const
366 // Prints the selection criteria for V0s
368 cout << "#################################################################" << endl;
369 cout << "# Selection List (V0s correlated with the event plane):" << endl;
370 cout << "# " << endl;
371 // if(fV0Pid[0]!='\0') { cout << "# P.id for V0s correlated to the event plane: " << fV0Pid << " " << endl ; }
372 if(fV0Mass[1]>fV0Mass[0])
375 { cout << "# Invariant Mass for V0s correlated to the event plane: " << fV0Mass[0] << " to " << fV0Mass[1] << endl ; }
377 { cout << "# Invariant Mass for V0-SideBands correlated to the event plane: " << fV0Mass[0]-fV0SideBand << " to " << fV0Mass[0] << " & " << fV0Mass[1] << " to " << fV0Mass[1]+fV0SideBand << endl ; }
379 if(fV0Pt[1]>fV0Pt[0])
380 { cout << "# Pt for V0s correlated to the event plane: " << fV0Pt[0] << " to " << fV0Pt[1] << " GeV/c" << endl ; }
382 { cout << "# P for V0s correlated to the event plane: " << fV0P[0] << " to " << fV0P[1] << " GeV/c" << endl ; }
383 if(fV0Eta[1]>fV0Eta[0])
384 { cout << "# Eta for V0s correlated to the event plane: " << fV0Eta[0] << " to " << fV0Eta[1] << endl ; }
385 if(fV0EtaAbs[1]>fV0EtaAbs[0])
386 { cout << "# |Eta| for V0s correlated to the event plane: " << fV0EtaAbs[0] << " to " << fV0EtaAbs[1] << endl ; }
388 { cout << "# Y for V0s correlated to the event plane: " << fV0Y[0] << " to " << fV0Y[1] << endl ; }
389 if(fV0ChiSq[1]>fV0ChiSq[0])
390 { cout << "# Chi2 for V0s correlated to the event plane: " << fV0ChiSq[0] << " to " << fV0ChiSq[1] << endl ; }
391 if(fV0DcaCross[1]>fV0DcaCross[0])
392 { cout << "# Closest approach between the daughter tracks for V0s correlated to the event plane: " << fV0DcaCross[0] << " to " << fV0DcaCross[1] << endl ; }
393 if(fV0Lenght[1]>fV0Lenght[0])
394 { cout << "# ... for V0s correlated to the event plane: " << fV0Lenght[0] << " to " << fV0Lenght[1] << endl ; }
395 if(fV0LenghtOverSigma[1]>fV0LenghtOverSigma[0])
396 { cout << "# ... for V0s correlated to the event plane: " << fV0LenghtOverSigma[0] << " to " << fV0LenghtOverSigma[1] << endl ; }
397 cout << "#################################################################" << endl;
399 //-----------------------------------------------------------------------
400 void AliFlowSelection::PrintSelectionList() const
402 // Prints the list of selection cuts for RP determination
406 cout << "#######################################################" << endl;
407 cout << "# Event centrality: " << endl ;
409 if(fCent==0) { lowC=0 ; hiC=AliFlowConstants::fgCentNorm[0] * AliFlowConstants::fgMaxMult ; }
410 else if(fCent>8) { lowC=AliFlowConstants::fgCentNorm[8] * AliFlowConstants::fgMaxMult ; hiC=99999 ; }
411 else { lowC=AliFlowConstants::fgCentNorm[fCent-1] * AliFlowConstants::fgMaxMult ; hiC=AliFlowConstants::fgCentNorm[fCent] * AliFlowConstants::fgMaxMult ; }
412 cout << "# - Centrality Class = " << fCent << " ( " << (int)lowC << " < mult < " << (int)hiC << " ) . " << endl ;
416 cout << "#######################################################" << endl;
417 cout << "# All centralities " << endl ;
420 cout << "#######################################################" << endl;
421 cout << "# Tracks used for the event plane: " << endl ;
422 cout << "# - Selection[0] (for all " << AliFlowConstants::kHars << " Harmonics) : " << endl ;
423 cout << "# NO CUTS " << endl ;
424 cout << "# - Selection[1+] (for all " << AliFlowConstants::kHars << " Harmonics) : " << endl ;
425 if(Pid()[0] != '\0') { cout << "# Particle ID = " << Pid() << endl ; }
426 if(ConstrainCut()) { cout << "# Constrainable Tracks " << endl ; }
427 if(DcaGlobalCutHi()>DcaGlobalCutLo()) { cout << "# Global Dca Tpc cuts = " << DcaGlobalCutLo() << " , " << DcaGlobalCutHi() << endl ; }
428 for (int k = 1; k < AliFlowConstants::kSels; k++)
430 for (int j = 0; j < AliFlowConstants::kHars ; j++)
432 cout << "# - Selection[" << k << "] , Harmonic[" << j+1 << "] :" << endl ;
433 if(NhitsCut(k)) { cout << "# Minimum TPC hits = " << NhitsCut(k) << endl ; }
434 if(EtaCutHi(j,k)>EtaCutLo(j,k)) { cout << "# TMath::Abs(Eta) cuts = " << EtaCutLo(j,k) << " , " << EtaCutHi(j,k) << endl ; }
435 if(PtCutHi(j,k)>PtCutLo(j,k)) { cout << "# Pt cuts = " << PtCutLo(j,k) << " , " << PtCutHi(j,k) << endl ; }
438 cout << "#######################################################" << endl;
440 //-----------------------------------------------------------------------
441 void AliFlowSelection::SetHarmonic(const Int_t& harN)
443 // sets the Harmonic #
445 if(harN < 0 || harN >= AliFlowConstants::kHars)
447 cout << "### Harmonic " << harN << " not valid" << endl;
450 else { fHarmonic = harN; }
452 //-----------------------------------------------------------------------
453 void AliFlowSelection::SetSelection(const Int_t& selN)
455 // sets the Selection #
457 if(selN < 0 || selN >= AliFlowConstants::kSels)
459 cout << "### Selection " << selN << " not valid" << endl;
462 else { fSelection = selN; }
464 //-----------------------------------------------------------------------
465 void AliFlowSelection::SetSubevent(const Int_t& subN)
467 // sets the Sub-Event # (-1 for the full-event)
469 if(subN < -1 || subN > AliFlowConstants::kSubs)
471 cout << "### Subevent " << subN << " not valid" << endl;
474 else { fSubevent = subN; }
476 //-----------------------------------------------------------------------
477 Float_t AliFlowSelection::PtMaxPart() const
479 // Returns the upper pT cut for particle used in correlation analysis
481 if(fPtPart[1]>fPtPart[0]) { return fPtPart[1] ; }
484 //-----------------------------------------------------------------------