]>
Commit | Line | Data |
---|---|---|
daf66719 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | // AliFlowEventCuts: | |
19 | // An event cut class for the flow framework | |
20 | // | |
21 | // origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch) | |
22 | ||
23 | #include <limits.h> | |
24 | #include <float.h> | |
25 | #include "TNamed.h" | |
ee242db3 | 26 | #include "AliVVertex.h" |
daf66719 | 27 | #include "AliVEvent.h" |
333ce021 | 28 | #include "AliESDEvent.h" |
9a0783cc | 29 | #include "AliMultiplicity.h" |
333ce021 | 30 | #include "AliMCEvent.h" |
daf66719 | 31 | #include "AliFlowEventCuts.h" |
9a0783cc | 32 | #include "AliFlowTrackCuts.h" |
daf66719 | 33 | |
34 | ClassImp(AliFlowEventCuts) | |
35 | ||
36 | //----------------------------------------------------------------------- | |
37 | AliFlowEventCuts::AliFlowEventCuts(): | |
38 | TNamed(), | |
39 | fCutNumberOfTracks(kFALSE), | |
40 | fNumberOfTracksMax(INT_MAX), | |
5559ce24 | 41 | fNumberOfTracksMin(INT_MIN), |
42 | fCutRefMult(kFALSE), | |
9a0783cc | 43 | fRefMultMethod(kTPConly), |
5559ce24 | 44 | fRefMultMax(INT_MAX), |
333ce021 | 45 | fRefMultMin(INT_MIN), |
ee242db3 | 46 | fRefMultCuts(NULL), |
47 | fCutPrimaryVertexX(kFALSE), | |
48 | fPrimaryVertexXmax(INT_MAX), | |
49 | fPrimaryVertexXmin(INT_MIN), | |
50 | fCutPrimaryVertexY(kFALSE), | |
51 | fPrimaryVertexYmax(INT_MAX), | |
52 | fPrimaryVertexYmin(INT_MIN), | |
53 | fCutPrimaryVertexZ(kFALSE), | |
54 | fPrimaryVertexZmax(INT_MAX), | |
55 | fPrimaryVertexZmin(INT_MIN), | |
56 | fCutNContributors(kFALSE), | |
57 | fNContributorsMax(INT_MAX), | |
58 | fNContributorsMin(INT_MIN) | |
daf66719 | 59 | { |
60 | //constructor | |
61 | } | |
62 | ||
957517fa | 63 | //----------------------------------------------------------------------- |
64 | AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title): | |
65 | TNamed(name, title), | |
66 | fCutNumberOfTracks(kFALSE), | |
67 | fNumberOfTracksMax(INT_MAX), | |
68 | fNumberOfTracksMin(INT_MIN), | |
69 | fCutRefMult(kFALSE), | |
9a0783cc | 70 | fRefMultMethod(kTPConly), |
957517fa | 71 | fRefMultMax(INT_MAX), |
333ce021 | 72 | fRefMultMin(INT_MIN), |
ee242db3 | 73 | fRefMultCuts(NULL), |
74 | fCutPrimaryVertexX(kFALSE), | |
75 | fPrimaryVertexXmax(INT_MAX), | |
76 | fPrimaryVertexXmin(INT_MIN), | |
77 | fCutPrimaryVertexY(kFALSE), | |
78 | fPrimaryVertexYmax(INT_MAX), | |
79 | fPrimaryVertexYmin(INT_MIN), | |
80 | fCutPrimaryVertexZ(kFALSE), | |
81 | fPrimaryVertexZmax(INT_MAX), | |
82 | fPrimaryVertexZmin(INT_MIN), | |
83 | fCutNContributors(kFALSE), | |
84 | fNContributorsMax(INT_MAX), | |
85 | fNContributorsMin(INT_MIN) | |
957517fa | 86 | { |
87 | //constructor | |
88 | } | |
89 | ||
daf66719 | 90 | ////----------------------------------------------------------------------- |
03d364db | 91 | AliFlowEventCuts::AliFlowEventCuts(const AliFlowEventCuts& that): |
92 | TNamed(that), | |
93 | fCutNumberOfTracks(that.fCutNumberOfTracks), | |
94 | fNumberOfTracksMax(that.fNumberOfTracksMax), | |
95 | fNumberOfTracksMin(that.fNumberOfTracksMin), | |
96 | fCutRefMult(that.fCutRefMult), | |
97 | fRefMultMethod(that.fRefMultMethod), | |
98 | fRefMultMax(that.fRefMultMax), | |
99 | fRefMultMin(that.fRefMultMin), | |
ee242db3 | 100 | fRefMultCuts(NULL), |
101 | fCutPrimaryVertexX(that.fCutPrimaryVertexX), | |
102 | fPrimaryVertexXmax(that.fPrimaryVertexXmax), | |
103 | fPrimaryVertexXmin(that.fPrimaryVertexXmin), | |
104 | fCutPrimaryVertexY(that.fCutPrimaryVertexX), | |
105 | fPrimaryVertexYmax(that.fPrimaryVertexYmax), | |
106 | fPrimaryVertexYmin(that.fPrimaryVertexYmin), | |
107 | fCutPrimaryVertexZ(that.fCutPrimaryVertexX), | |
108 | fPrimaryVertexZmax(that.fPrimaryVertexZmax), | |
109 | fPrimaryVertexZmin(that.fPrimaryVertexZmin), | |
110 | fCutNContributors(that.fCutNContributors), | |
111 | fNContributorsMax(that.fNContributorsMax), | |
112 | fNContributorsMin(that.fNContributorsMin) | |
03d364db | 113 | { |
114 | //copy constructor | |
ee242db3 | 115 | if (that.fRefMultCuts) |
116 | fRefMultCuts = new AliFlowTrackCuts(*(that.fRefMultCuts)); | |
03d364db | 117 | } |
118 | ||
daf66719 | 119 | ////----------------------------------------------------------------------- |
03d364db | 120 | AliFlowEventCuts& AliFlowEventCuts::operator=(const AliFlowEventCuts& that) |
121 | { | |
122 | //assignment | |
123 | fCutNumberOfTracks=that.fCutNumberOfTracks; | |
124 | fNumberOfTracksMax=that.fNumberOfTracksMax; | |
125 | fNumberOfTracksMin=that.fNumberOfTracksMin; | |
126 | fCutRefMult=that.fCutRefMult; | |
127 | fRefMultMethod=that.fRefMultMethod; | |
128 | fRefMultMax=that.fRefMultMax; | |
129 | fRefMultMin=that.fRefMultMin; | |
ee242db3 | 130 | if (that.fRefMultCuts) *fRefMultCuts=*(that.fRefMultCuts); |
131 | fCutPrimaryVertexX=that.fCutPrimaryVertexX; | |
132 | fPrimaryVertexXmin=that.fPrimaryVertexXmin; | |
133 | fPrimaryVertexXmax=that.fPrimaryVertexXmax; | |
134 | fPrimaryVertexYmin=that.fPrimaryVertexYmin; | |
135 | fPrimaryVertexYmax=that.fPrimaryVertexYmax; | |
136 | fPrimaryVertexZmin=that.fPrimaryVertexZmin; | |
137 | fPrimaryVertexZmax=that.fPrimaryVertexZmax; | |
138 | fCutNContributors=that.fCutNContributors; | |
139 | fNContributorsMax=that.fNContributorsMax; | |
140 | fNContributorsMin=that.fNContributorsMin; | |
03d364db | 141 | return *this; |
142 | } | |
daf66719 | 143 | |
144 | //----------------------------------------------------------------------- | |
145 | Bool_t AliFlowEventCuts::IsSelected(const TObject* obj) | |
146 | { | |
147 | //check cuts | |
148 | const AliVEvent* vevent = dynamic_cast<const AliVEvent*>(obj); | |
149 | if (vevent) return PassesCuts(vevent); | |
150 | return kFALSE; //when passed wrong type of object | |
151 | } | |
152 | //----------------------------------------------------------------------- | |
153 | Bool_t AliFlowEventCuts::PassesCuts(const AliVEvent *event) | |
154 | { | |
155 | ///check if event passes cuts | |
5559ce24 | 156 | if(fCutNumberOfTracks) {if (event->GetNumberOfTracks() < fNumberOfTracksMin || event->GetNumberOfTracks() >= fNumberOfTracksMax ) return kFALSE;} |
157 | if(fCutRefMult) | |
158 | { | |
159 | //reference multiplicity still to be defined | |
03d364db | 160 | Double_t refMult = RefMult(event); |
161 | if (refMult < fRefMultMin || refMult >= fRefMultMax ) | |
5559ce24 | 162 | return kFALSE; |
163 | } | |
ee242db3 | 164 | const AliVVertex* pvtx=event->GetPrimaryVertex(); |
165 | Double_t pvtxx = pvtx->GetX(); | |
166 | Double_t pvtxy = pvtx->GetY(); | |
167 | Double_t pvtxz = pvtx->GetZ(); | |
168 | Int_t ncontrib = pvtx->GetNContributors(); | |
169 | if (fCutNContributors) | |
170 | { | |
171 | if (ncontrib < fNContributorsMin || ncontrib >= fNContributorsMax) | |
172 | return kFALSE; | |
173 | } | |
174 | if (fCutPrimaryVertexX) | |
175 | { | |
176 | if (pvtxx < fPrimaryVertexXmin || pvtxx >= fPrimaryVertexXmax) | |
177 | return kFALSE; | |
178 | } | |
179 | if (fCutPrimaryVertexY) | |
180 | { | |
181 | if (pvtxy < fPrimaryVertexYmin || pvtxy >= fPrimaryVertexYmax) | |
182 | return kFALSE; | |
183 | } | |
184 | if (fCutPrimaryVertexZ) | |
185 | { | |
186 | if (pvtxz < fPrimaryVertexZmin || pvtxz >= fPrimaryVertexZmax) | |
187 | return kFALSE; | |
188 | } | |
daf66719 | 189 | return kTRUE; |
190 | } | |
191 | ||
192 | //----------------------------------------------------------------------- | |
193 | AliFlowEventCuts* AliFlowEventCuts::StandardCuts() | |
194 | { | |
195 | //make a set of standard event cuts, caller becomes owner | |
196 | AliFlowEventCuts* cuts = new AliFlowEventCuts(); | |
197 | return cuts; | |
198 | } | |
333ce021 | 199 | |
200 | //----------------------------------------------------------------------- | |
03d364db | 201 | Int_t AliFlowEventCuts::RefMult(const AliVEvent* event) |
333ce021 | 202 | { |
9a0783cc | 203 | //calculate the reference multiplicity, if all fails return 0 |
204 | Int_t refmult=0; | |
205 | ||
206 | //in the case of an ESD | |
333ce021 | 207 | const AliESDEvent* esd=dynamic_cast<const AliESDEvent*>(event); |
9a0783cc | 208 | if (esd) |
209 | { | |
210 | AliMultiplicity* tracklets=NULL; | |
211 | switch (fRefMultMethod) | |
212 | { | |
213 | case kTPConly: | |
03d364db | 214 | if (!fRefMultCuts) |
9a0783cc | 215 | { |
216 | //if not explicitly passed, make default cuts | |
03d364db | 217 | fRefMultCuts = AliFlowTrackCuts::GetStandardTPCOnlyTrackCuts(); |
218 | fRefMultCuts->SetEtaRange(-0.8,0.8); | |
219 | fRefMultCuts->SetPtMin(0.15); | |
9a0783cc | 220 | } |
221 | for (Int_t i=0; i<esd->GetNumberOfTracks();i++) | |
222 | { | |
223 | AliESDtrack* track = esd->GetTrack(i); | |
03d364db | 224 | if (fRefMultCuts->IsSelected(track)) refmult++; |
9a0783cc | 225 | } |
226 | break; | |
227 | case kSPDtracklets: | |
03d364db | 228 | if (!fRefMultCuts) |
9a0783cc | 229 | { |
03d364db | 230 | //if not explicitly passed, make default fRefMultCuts |
231 | fRefMultCuts = new AliFlowTrackCuts(); | |
232 | fRefMultCuts->SetEtaRange(-0.8,0.8); | |
9a0783cc | 233 | } |
234 | tracklets = const_cast<AliMultiplicity*>(esd->GetMultiplicity()); | |
235 | for (Int_t i=0; i<tracklets->GetNumberOfTracklets(); i++) | |
236 | { | |
03d364db | 237 | if (fRefMultCuts->IsSelected(tracklets,i)) refmult++; |
9a0783cc | 238 | } |
239 | break; | |
240 | default: | |
241 | return 0; | |
242 | } | |
243 | return refmult; | |
244 | } | |
245 | ||
246 | //in case of MC event | |
333ce021 | 247 | AliMCEvent* mc=const_cast<AliMCEvent*>(dynamic_cast<const AliMCEvent*>(event)); |
248 | if (mc) return mc->GetNumberOfPrimaries(); | |
9a0783cc | 249 | |
250 | return event->GetNumberOfTracks(); //default, at least returns some number | |
333ce021 | 251 | } |