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),
49 fCutPrimaryVertexX(kFALSE),
50 fPrimaryVertexXmax(INT_MAX),
51 fPrimaryVertexXmin(INT_MIN),
52 fCutPrimaryVertexY(kFALSE),
53 fPrimaryVertexYmax(INT_MAX),
54 fPrimaryVertexYmin(INT_MIN),
55 fCutPrimaryVertexZ(kFALSE),
56 fPrimaryVertexZmax(INT_MAX),
57 fPrimaryVertexZmin(INT_MIN),
58 fCutNContributors(kFALSE),
59 fNContributorsMax(INT_MAX),
60 fNContributorsMin(INT_MIN)
65 //-----------------------------------------------------------------------
66 AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title):
68 fCutNumberOfTracks(kFALSE),
69 fNumberOfTracksMax(INT_MAX),
70 fNumberOfTracksMin(INT_MIN),
72 fRefMultMethod(kTPConly),
76 fCutPrimaryVertexX(kFALSE),
77 fPrimaryVertexXmax(INT_MAX),
78 fPrimaryVertexXmin(INT_MIN),
79 fCutPrimaryVertexY(kFALSE),
80 fPrimaryVertexYmax(INT_MAX),
81 fPrimaryVertexYmin(INT_MIN),
82 fCutPrimaryVertexZ(kFALSE),
83 fPrimaryVertexZmax(INT_MAX),
84 fPrimaryVertexZmin(INT_MIN),
85 fCutNContributors(kFALSE),
86 fNContributorsMax(INT_MAX),
87 fNContributorsMin(INT_MIN)
92 ////-----------------------------------------------------------------------
93 AliFlowEventCuts::AliFlowEventCuts(const AliFlowEventCuts& that):
95 fCutNumberOfTracks(that.fCutNumberOfTracks),
96 fNumberOfTracksMax(that.fNumberOfTracksMax),
97 fNumberOfTracksMin(that.fNumberOfTracksMin),
98 fCutRefMult(that.fCutRefMult),
99 fRefMultMethod(that.fRefMultMethod),
100 fRefMultMax(that.fRefMultMax),
101 fRefMultMin(that.fRefMultMin),
103 fCutPrimaryVertexX(that.fCutPrimaryVertexX),
104 fPrimaryVertexXmax(that.fPrimaryVertexXmax),
105 fPrimaryVertexXmin(that.fPrimaryVertexXmin),
106 fCutPrimaryVertexY(that.fCutPrimaryVertexX),
107 fPrimaryVertexYmax(that.fPrimaryVertexYmax),
108 fPrimaryVertexYmin(that.fPrimaryVertexYmin),
109 fCutPrimaryVertexZ(that.fCutPrimaryVertexX),
110 fPrimaryVertexZmax(that.fPrimaryVertexZmax),
111 fPrimaryVertexZmin(that.fPrimaryVertexZmin),
112 fCutNContributors(that.fCutNContributors),
113 fNContributorsMax(that.fNContributorsMax),
114 fNContributorsMin(that.fNContributorsMin)
117 if (that.fRefMultCuts)
118 fRefMultCuts = new AliFlowTrackCuts(*(that.fRefMultCuts));
121 ////-----------------------------------------------------------------------
122 AliFlowEventCuts& AliFlowEventCuts::operator=(const AliFlowEventCuts& that)
125 fCutNumberOfTracks=that.fCutNumberOfTracks;
126 fNumberOfTracksMax=that.fNumberOfTracksMax;
127 fNumberOfTracksMin=that.fNumberOfTracksMin;
128 fCutRefMult=that.fCutRefMult;
129 fRefMultMethod=that.fRefMultMethod;
130 fRefMultMax=that.fRefMultMax;
131 fRefMultMin=that.fRefMultMin;
132 if (that.fRefMultCuts) *fRefMultCuts=*(that.fRefMultCuts);
133 fCutPrimaryVertexX=that.fCutPrimaryVertexX;
134 fPrimaryVertexXmin=that.fPrimaryVertexXmin;
135 fPrimaryVertexXmax=that.fPrimaryVertexXmax;
136 fPrimaryVertexYmin=that.fPrimaryVertexYmin;
137 fPrimaryVertexYmax=that.fPrimaryVertexYmax;
138 fPrimaryVertexZmin=that.fPrimaryVertexZmin;
139 fPrimaryVertexZmax=that.fPrimaryVertexZmax;
140 fCutNContributors=that.fCutNContributors;
141 fNContributorsMax=that.fNContributorsMax;
142 fNContributorsMin=that.fNContributorsMin;
146 //-----------------------------------------------------------------------
147 Bool_t AliFlowEventCuts::IsSelected(const TObject* obj)
150 const AliVEvent* vevent = dynamic_cast<const AliVEvent*>(obj);
151 if (vevent) return PassesCuts(vevent);
152 return kFALSE; //when passed wrong type of object
154 //-----------------------------------------------------------------------
155 Bool_t AliFlowEventCuts::PassesCuts(const AliVEvent *event)
157 ///check if event passes cuts
158 if(fCutNumberOfTracks) {if (event->GetNumberOfTracks() < fNumberOfTracksMin || event->GetNumberOfTracks() >= fNumberOfTracksMax ) return kFALSE;}
161 //reference multiplicity still to be defined
162 Double_t refMult = RefMult(event);
163 if (refMult < fRefMultMin || refMult >= fRefMultMax )
166 const AliVVertex* pvtx=event->GetPrimaryVertex();
167 Double_t pvtxx = pvtx->GetX();
168 Double_t pvtxy = pvtx->GetY();
169 Double_t pvtxz = pvtx->GetZ();
170 Int_t ncontrib = pvtx->GetNContributors();
171 if (fCutNContributors)
173 if (ncontrib < fNContributorsMin || ncontrib >= fNContributorsMax)
176 if (fCutPrimaryVertexX)
178 if (pvtxx < fPrimaryVertexXmin || pvtxx >= fPrimaryVertexXmax)
181 if (fCutPrimaryVertexY)
183 if (pvtxy < fPrimaryVertexYmin || pvtxy >= fPrimaryVertexYmax)
186 if (fCutPrimaryVertexZ)
188 if (pvtxz < fPrimaryVertexZmin || pvtxz >= fPrimaryVertexZmax)
194 //-----------------------------------------------------------------------
195 AliFlowEventCuts* AliFlowEventCuts::StandardCuts()
197 //make a set of standard event cuts, caller becomes owner
198 AliFlowEventCuts* cuts = new AliFlowEventCuts();
202 //-----------------------------------------------------------------------
203 Int_t AliFlowEventCuts::RefMult(const AliVEvent* event)
205 //calculate the reference multiplicity, if all fails return 0
206 AliESDVZERO* vzero = NULL;
207 const AliESDEvent* esdevent = dynamic_cast<const AliESDEvent*>(event);
211 switch (fRefMultMethod)
214 fRefMultCuts = AliFlowTrackCuts::GetStandardTPCOnlyTrackCuts();
215 fRefMultCuts->SetEtaRange(-0.8,0.8);
216 fRefMultCuts->SetPtMin(0.15);
219 fRefMultCuts = new AliFlowTrackCuts();
220 fRefMultCuts->SetParamType(AliFlowTrackCuts::kESD_SPDtracklet);
221 fRefMultCuts->SetEtaRange(-0.8,0.8);
224 if (!esdevent) return 0;
225 vzero=esdevent->GetVZEROData();
226 if (!vzero) return 0;
227 refmult+=TMath::Nint(vzero->GetMTotV0A());
228 refmult+=TMath::Nint(vzero->GetMTotV0C());
235 fRefMultCuts->SetEvent(const_cast<AliVEvent*>(event));
236 for (Int_t i=0; i<fRefMultCuts->GetNumberOfInputObjects(); i++)
238 if (fRefMultCuts->IsSelected(fRefMultCuts->GetInputObject(i),i))