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 **************************************************************************/
19 // An event cut class for the flow framework
21 // origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
27 #include "AliVVertex.h"
28 #include "AliVEvent.h"
29 #include "AliESDEvent.h"
30 #include "AliESDVZERO.h"
31 #include "AliMultiplicity.h"
32 #include "AliMCEvent.h"
33 #include "AliFlowEventCuts.h"
34 #include "AliFlowTrackCuts.h"
36 ClassImp(AliFlowEventCuts)
38 //-----------------------------------------------------------------------
39 AliFlowEventCuts::AliFlowEventCuts():
41 fCutNumberOfTracks(kFALSE),
42 fNumberOfTracksMax(INT_MAX),
43 fNumberOfTracksMin(INT_MIN),
45 fRefMultMethod(kTPConly),
50 fCutPrimaryVertexX(kFALSE),
51 fPrimaryVertexXmax(INT_MAX),
52 fPrimaryVertexXmin(INT_MIN),
53 fCutPrimaryVertexY(kFALSE),
54 fPrimaryVertexYmax(INT_MAX),
55 fPrimaryVertexYmin(INT_MIN),
56 fCutPrimaryVertexZ(kFALSE),
57 fPrimaryVertexZmax(INT_MAX),
58 fPrimaryVertexZmin(INT_MIN),
59 fCutNContributors(kFALSE),
60 fNContributorsMax(INT_MAX),
61 fNContributorsMin(INT_MIN),
69 //-----------------------------------------------------------------------
70 AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title):
72 fCutNumberOfTracks(kFALSE),
73 fNumberOfTracksMax(INT_MAX),
74 fNumberOfTracksMin(INT_MIN),
76 fRefMultMethod(kTPConly),
81 fCutPrimaryVertexX(kFALSE),
82 fPrimaryVertexXmax(INT_MAX),
83 fPrimaryVertexXmin(INT_MIN),
84 fCutPrimaryVertexY(kFALSE),
85 fPrimaryVertexYmax(INT_MAX),
86 fPrimaryVertexYmin(INT_MIN),
87 fCutPrimaryVertexZ(kFALSE),
88 fPrimaryVertexZmax(INT_MAX),
89 fPrimaryVertexZmin(INT_MIN),
90 fCutNContributors(kFALSE),
91 fNContributorsMax(INT_MAX),
92 fNContributorsMin(INT_MIN),
100 ////-----------------------------------------------------------------------
101 AliFlowEventCuts::AliFlowEventCuts(const AliFlowEventCuts& that):
103 fCutNumberOfTracks(that.fCutNumberOfTracks),
104 fNumberOfTracksMax(that.fNumberOfTracksMax),
105 fNumberOfTracksMin(that.fNumberOfTracksMin),
106 fCutRefMult(that.fCutRefMult),
107 fRefMultMethod(that.fRefMultMethod),
108 fRefMultMax(that.fRefMultMax),
109 fRefMultMin(that.fRefMultMin),
112 fCutPrimaryVertexX(that.fCutPrimaryVertexX),
113 fPrimaryVertexXmax(that.fPrimaryVertexXmax),
114 fPrimaryVertexXmin(that.fPrimaryVertexXmin),
115 fCutPrimaryVertexY(that.fCutPrimaryVertexX),
116 fPrimaryVertexYmax(that.fPrimaryVertexYmax),
117 fPrimaryVertexYmin(that.fPrimaryVertexYmin),
118 fCutPrimaryVertexZ(that.fCutPrimaryVertexX),
119 fPrimaryVertexZmax(that.fPrimaryVertexZmax),
120 fPrimaryVertexZmin(that.fPrimaryVertexZmin),
121 fCutNContributors(that.fCutNContributors),
122 fNContributorsMax(that.fNContributorsMax),
123 fNContributorsMin(that.fNContributorsMin),
124 fCutMeanPt(that.fCutMeanPt),
125 fMeanPtMax(that.fMeanPtMax),
126 fMeanPtMin(that.fMeanPtMin)
129 if (that.fRefMultCuts)
130 fRefMultCuts = new AliFlowTrackCuts(*(that.fRefMultCuts));
131 if (that.fMeanPtCuts)
132 fMeanPtCuts = new AliFlowTrackCuts(*(that.fMeanPtCuts));
135 ////-----------------------------------------------------------------------
136 AliFlowEventCuts::~AliFlowEventCuts()
143 ////-----------------------------------------------------------------------
144 AliFlowEventCuts& AliFlowEventCuts::operator=(const AliFlowEventCuts& that)
147 fCutNumberOfTracks=that.fCutNumberOfTracks;
148 fNumberOfTracksMax=that.fNumberOfTracksMax;
149 fNumberOfTracksMin=that.fNumberOfTracksMin;
150 fCutRefMult=that.fCutRefMult;
151 fRefMultMethod=that.fRefMultMethod;
152 fRefMultMax=that.fRefMultMax;
153 fRefMultMin=that.fRefMultMin;
154 if (that.fRefMultCuts) *fRefMultCuts=*(that.fRefMultCuts);
155 if (that.fMeanPtCuts) *fMeanPtCuts=*(that.fMeanPtCuts);
156 fCutPrimaryVertexX=that.fCutPrimaryVertexX;
157 fPrimaryVertexXmin=that.fPrimaryVertexXmin;
158 fPrimaryVertexXmax=that.fPrimaryVertexXmax;
159 fPrimaryVertexYmin=that.fPrimaryVertexYmin;
160 fPrimaryVertexYmax=that.fPrimaryVertexYmax;
161 fPrimaryVertexZmin=that.fPrimaryVertexZmin;
162 fPrimaryVertexZmax=that.fPrimaryVertexZmax;
163 fCutNContributors=that.fCutNContributors;
164 fNContributorsMax=that.fNContributorsMax;
165 fNContributorsMin=that.fNContributorsMin;
166 fCutMeanPt=that.fCutMeanPt;
167 fMeanPtMax=that.fMeanPtMax;
168 fMeanPtMin=that.fMeanPtMin;
172 //-----------------------------------------------------------------------
173 Bool_t AliFlowEventCuts::IsSelected(const TObject* obj)
176 const AliVEvent* vevent = dynamic_cast<const AliVEvent*>(obj);
177 if (vevent) return PassesCuts(vevent);
178 return kFALSE; //when passed wrong type of object
180 //-----------------------------------------------------------------------
181 Bool_t AliFlowEventCuts::PassesCuts(const AliVEvent *event)
183 ///check if event passes cuts
184 if(fCutNumberOfTracks) {if (event->GetNumberOfTracks() < fNumberOfTracksMin || event->GetNumberOfTracks() >= fNumberOfTracksMax ) return kFALSE;}
187 //reference multiplicity still to be defined
188 Double_t refMult = RefMult(event);
189 if (refMult < fRefMultMin || refMult >= fRefMultMax )
192 const AliVVertex* pvtx=event->GetPrimaryVertex();
193 Double_t pvtxx = pvtx->GetX();
194 Double_t pvtxy = pvtx->GetY();
195 Double_t pvtxz = pvtx->GetZ();
196 Int_t ncontrib = pvtx->GetNContributors();
197 if (fCutNContributors)
199 if (ncontrib < fNContributorsMin || ncontrib >= fNContributorsMax)
202 if (fCutPrimaryVertexX)
204 if (pvtxx < fPrimaryVertexXmin || pvtxx >= fPrimaryVertexXmax)
207 if (fCutPrimaryVertexY)
209 if (pvtxy < fPrimaryVertexYmin || pvtxy >= fPrimaryVertexYmax)
212 if (fCutPrimaryVertexZ)
214 if (pvtxz < fPrimaryVertexZmin || pvtxz >= fPrimaryVertexZmax)
220 Int_t ntracks=event->GetNumberOfTracks();
222 for (Int_t i=0; i<ntracks; i++)
224 AliVParticle* track = event->GetTrack(i);
225 if (!track) continue;
227 if (fMeanPtCuts) pass=fMeanPtCuts->IsSelected(track);
230 meanpt += track->Pt();
234 meanpt=meanpt/nselected;
235 if (meanpt<fMeanPtMin || meanpt >= fMeanPtMax) return kFALSE;
240 //-----------------------------------------------------------------------
241 AliFlowEventCuts* AliFlowEventCuts::StandardCuts()
243 //make a set of standard event cuts, caller becomes owner
244 AliFlowEventCuts* cuts = new AliFlowEventCuts();
248 //-----------------------------------------------------------------------
249 Int_t AliFlowEventCuts::RefMult(const AliVEvent* event)
251 //calculate the reference multiplicity, if all fails return 0
252 AliESDVZERO* vzero = NULL;
253 const AliESDEvent* esdevent = dynamic_cast<const AliESDEvent*>(event);
254 const AliMultiplicity* mult = esdevent->GetMultiplicity();
258 switch (fRefMultMethod)
261 fRefMultCuts = AliFlowTrackCuts::GetStandardTPCOnlyTrackCuts();
262 fRefMultCuts->SetEtaRange(-0.8,0.8);
263 fRefMultCuts->SetPtMin(0.15);
266 fRefMultCuts = new AliFlowTrackCuts();
267 fRefMultCuts->SetParamType(AliFlowTrackCuts::kESD_SPDtracklet);
268 fRefMultCuts->SetEtaRange(-0.8,0.8);
271 if (!esdevent) return 0;
272 vzero=esdevent->GetVZEROData();
273 if (!vzero) return 0;
274 refmult += TMath::Nint(vzero->GetMTotV0A());
275 refmult += TMath::Nint(vzero->GetMTotV0C());
279 refmult = mult->GetNumberOfITSClusters(1);
286 fRefMultCuts->SetEvent(const_cast<AliVEvent*>(event));
287 for (Int_t i=0; i<fRefMultCuts->GetNumberOfInputObjects(); i++)
289 if (fRefMultCuts->IsSelected(fRefMultCuts->GetInputObject(i),i))