]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/JetTasks/AliAnalyseLeadingTrackUE.cxx
removed a relic debug hack in previous commit
[u/mrichter/AliRoot.git] / PWG4 / JetTasks / AliAnalyseLeadingTrackUE.cxx
CommitLineData
a75aacd6 1/*************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: A.Abrahantes, E.Lopez, S.Vallero *
5 * Version 1.0 *
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 **************************************************************************/
a75aacd6 15//#include <TBranch.h>
16//#include <TCanvas.h>
17//#include <TChain.h>
18//#include <TFile.h>
19//#include <TH1F.h>
20//#include <TH1I.h>
21//#include <TH2F.h>
22#include <TList.h>
23//#include <TLorentzVector.h>
24#include <TMath.h>
25#include <TObjArray.h>
26#include <TObject.h>
27//#include <TProfile.h>
28//#include <TRandom.h>
29//#include <TSystem.h>
30//#include <TTree.h>
31#include <TVector3.h>
32
33#include "AliAnalyseLeadingTrackUE.h"
34//#include "AliAnalysisTask.h"
35
36//#include "AliAnalysisHelperJetTasks.h"
37//#include "AliAnalysisManager.h"
38#include "AliAODEvent.h"
39//#include "AliAODHandler.h"
a75aacd6 40//#include "AliAODJet.h"
41#include "AliAODMCParticle.h"
42#include "AliAODTrack.h"
43#include "AliESDEvent.h"
44#include "AliESDtrack.h"
45#include "AliESDtrackCuts.h"
46//#include "AliGenPythiaEventHeader.h"
47#include "AliInputEventHandler.h"
48//#include "AliKFVertex.h"
144bd037 49//#include "AliLog.h"
a75aacd6 50#include "AliMCEvent.h"
51//#include "AliMCEventHandler.h"
52//#include "AliStack.h"
53#include "AliVParticle.h"
54
55////////////////////////////////////////////////
56//---------------------------------------------
57// Class for transverse regions analysis
58//---------------------------------------------
59////////////////////////////////////////////////
60
61
62using namespace std;
63
64ClassImp(AliAnalyseLeadingTrackUE)
65
66//-------------------------------------------------------------------
67AliAnalyseLeadingTrackUE::AliAnalyseLeadingTrackUE() :
68 TObject(),
69 fDebug(0),
70 fFilterBit(16),
71 fOnlyHadrons(kFALSE),
3712ba26 72 fTrackEtaCut(0.8),
73 fEsdTrackCuts(0x0),
74 fEsdTrackCutsSPD(0x0),
75 fEsdTrackCutsSDD(0x0)
a75aacd6 76{
77 // constructor
78}
79
80
81//-------------------------------------------------------------------
82AliAnalyseLeadingTrackUE & AliAnalyseLeadingTrackUE::operator = (const AliAnalyseLeadingTrackUE & /*source*/)
83{
84 // assignment operator
85 return *this;
86}
87
88
89//-------------------------------------------------------------------
90AliAnalyseLeadingTrackUE::~AliAnalyseLeadingTrackUE()
91{
92
93 //clear memory
94
95}
96
97
98//____________________________________________________________________
3712ba26 99Bool_t AliAnalyseLeadingTrackUE::ApplyCuts(TObject* track)
a75aacd6 100{
a75aacd6 101
102 // select track according to set of cuts
3712ba26 103 if (! fEsdTrackCuts->IsSelected(track) )return kFALSE;
104 if (!fEsdTrackCutsSPD->IsSelected(track) && fEsdTrackCutsSDD->IsSelected(track)) return kFALSE;
105
a75aacd6 106 return kTRUE;
107}
108
109
3712ba26 110//____________________________________________________________________
111void AliAnalyseLeadingTrackUE::DefineESDCuts(Int_t /*filterbit*/){
112
113 // Reproduces the cuts of the corresponding bit in the ESD->AOD filtering
114 // (see $ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C)
a75aacd6 115
3712ba26 116 fEsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
117 fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
118
119 // Add SPD requirement
120 fEsdTrackCutsSPD = new AliESDtrackCuts("SPD", "Require 1 cluster in SPD");
121 fEsdTrackCutsSPD->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
122
123 // Add SDD requirement
124 fEsdTrackCutsSDD = new AliESDtrackCuts("SDD", "Require 1 cluster in first layer SDD");
125 fEsdTrackCutsSDD->SetClusterRequirementITS(AliESDtrackCuts::kSDD,AliESDtrackCuts::kFirst);
126}
a75aacd6 127
128
129//____________________________________________________________________
130TObjArray* AliAnalyseLeadingTrackUE::FindLeadingObjects(TObject *obj)
131{
132
133 // Returns an array of charged particles (or jets) ordered according to their pT.
134
135 Int_t nTracks = NParticles(obj);
136
137
138 if( !nTracks ) return 0;
139
140 // Define array of AliVParticle objects
141 TObjArray* tracks = new TObjArray(nTracks);
142
143 // Loop over tracks or jets
144 for (Int_t ipart=0; ipart<nTracks; ++ipart) {
145 AliVParticle* part = ParticleWithCuts( obj, ipart );
146 if (!part) continue;
147 // Accept leading-tracks in a limited pseudo-rapidity range
148 if( TMath::Abs(part->Eta()) > fTrackEtaCut ) continue;
149 tracks->AddLast( part );
150 }
151 // Order tracks by pT
152 QSortTracks( *tracks, 0, tracks->GetEntriesFast() );
153
154 nTracks = tracks->GetEntriesFast();
155 if( !nTracks ) return 0;
156
157 return tracks;
158 }
159
160
b1831bcb 161//-------------------------------------------------------------------
162TObjArray* AliAnalyseLeadingTrackUE::GetAcceptedParticles(TObject* obj, TObject* arrayMC, Bool_t onlyprimaries, Int_t particleSpecies)
163{
164 // Returns an array of particles that pass the cuts, if arrayMC is given each reconstructed particle is replaced by its corresponding MC particles, depending on the parameter onlyprimaries only for primaries
165 // particleSpecies: -1 all particles are returned
166 // 0 (pions) 1 (kaons) 2 (protons) 3 (others) particles
167
168 Int_t nTracks = NParticles(obj);
169 TObjArray* tracks = new TObjArray;
170
171 // Loop over tracks or jets
172 for (Int_t ipart=0; ipart<nTracks; ++ipart) {
173 AliVParticle* part = ParticleWithCuts( obj, ipart, onlyprimaries, particleSpecies );
174 if (!part) continue;
175
176 if (arrayMC && arrayMC->InheritsFrom("TClonesArray") && obj->InheritsFrom("AliAODEvent")) {
177 Int_t label = ((AliAODTrack*)part)->GetLabel();
178 // re-define part as the matched MC particle
179 part = (AliAODMCParticle*)ParticleWithCuts(arrayMC, TMath::Abs(label),onlyprimaries, particleSpecies);
180 if (!part)continue;
181 }
182
183 tracks->Add(part);
184 }
185
186 return tracks;
187}
188
a75aacd6 189//-------------------------------------------------------------------
190TObjArray* AliAnalyseLeadingTrackUE::GetMinMaxRegion(TList *transv1, TList *transv2)
191{
192
193 // Returns two lists of particles, one for MIN and one for MAX region
194 Double_t sumpT1 = 0.;
195 Double_t sumpT2 = 0.;
196
197 Int_t particles1 = transv1->GetEntries();
198 Int_t particles2 = transv2->GetEntries();
199
200 // Loop on transverse region 1
201 for (Int_t i=0; i<particles1; i++){
202 AliVParticle *part = (AliVParticle*)transv1->At(i);
203 sumpT1 += part->Pt();
204 }
205
206 // Loop on transverse region 2
207 for (Int_t i=0; i<particles2; i++){
208 AliVParticle *part = (AliVParticle*)transv2->At(i);
209 sumpT2 += part->Pt();
210 }
211
212 TObjArray *regionParticles = new TObjArray;
213 if ( sumpT2 >= sumpT1 ){
214 regionParticles->AddLast(transv1); // MIN
215 regionParticles->AddLast(transv2); // MAX
216 }else {
217 regionParticles->AddLast(transv2); // MIN
218 regionParticles->AddLast(transv1); // MAX
219 }
220
221 return regionParticles;
222}
223
224//-------------------------------------------------------------------
225Int_t AliAnalyseLeadingTrackUE::NParticles(TObject* obj)
226{
227
228 //Returns the number of particles in AliAODMCParticle array or AliAODTracks or AliESDTracks
229
230 Int_t nTracks;
231
232 if (obj->InheritsFrom("TClonesArray")){ // MC particles
233 TClonesArray *arrayMC = dynamic_cast<TClonesArray*>(obj);
234 nTracks = arrayMC->GetEntriesFast();
235 }else if (obj->InheritsFrom("TObjArray")){ // list of AliVParticle
236 TObjArray *array = dynamic_cast<TObjArray*>(obj);
237 nTracks = array->GetEntriesFast();
238 }else if (obj->InheritsFrom("AliAODEvent")){ // RECO AOD tracks
239 AliAODEvent *aodEvent = dynamic_cast<AliAODEvent*>(obj);
240 nTracks = aodEvent->GetNTracks();
241 }else if (obj->InheritsFrom("AliESDEvent")){ // RECO ESD tracks
242 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(obj);
243 nTracks = esdEvent->GetNumberOfTracks();
3712ba26 244 }else if (obj->InheritsFrom("AliMCEvent")){ // RECO ESD tracks
245 AliMCEvent *mcEvent = dynamic_cast<AliMCEvent*>(obj);
246 nTracks = mcEvent->GetNumberOfTracks();
a75aacd6 247 }else {
248 if (fDebug > 1) AliFatal(" Analysis type not defined !!! ");
249 return 0;
250 }
251
252 return nTracks;
253}
254
255
256//-------------------------------------------------------------------
b1831bcb 257AliVParticle* AliAnalyseLeadingTrackUE::ParticleWithCuts(TObject* obj, Int_t ipart, Bool_t onlyprimaries, Int_t particleSpecies)
a75aacd6 258{
259 // Returns track or MC particle at position "ipart" if passes selection criteria
b1831bcb 260 // particleSpecies: -1 all particles are returned
261 // 0 (pions) 1 (kaons) 2 (protons) 3 (others) particles
a75aacd6 262 AliVParticle *part=0;
263
264 if (obj->InheritsFrom("TClonesArray")){ // AOD-MC PARTICLE
265 TClonesArray *arrayMC = dynamic_cast<TClonesArray*>(obj);
266 part = (AliVParticle*)arrayMC->At( ipart );
267 if (!part)return 0;
268 // eventually only primaries
269 if (onlyprimaries && !( ((AliAODMCParticle*)part)->IsPhysicalPrimary()) )return 0;
270 // eventually only hadrons
271 if (fOnlyHadrons){
272 Int_t pdgCode = ((AliAODMCParticle*)part)->GetPdgCode();
273 Bool_t isHadron = TMath::Abs(pdgCode)==211 || // Pion
274 TMath::Abs(pdgCode)==2212 || // Proton
275 TMath::Abs(pdgCode)==321; // Kaon
276 if (!isHadron) return 0;
277 }
b1831bcb 278 if (particleSpecies != -1) {
279 // find the primary mother
280 AliVParticle* mother = part;
281 while (!((AliAODMCParticle*)mother)->IsPhysicalPrimary())
282 {
283 if (((AliAODMCParticle*)mother)->GetMother() < 0)
284 {
285 mother = 0;
286 break;
287 }
288
289 mother = (AliVParticle*) arrayMC->At(((AliAODMCParticle*)mother)->GetMother());
290 if (!mother)
291 break;
292 }
293
294 if (mother)
295 {
296 Int_t pdgCode = ((AliAODMCParticle*)mother)->GetPdgCode();
297 if (particleSpecies == 0 && TMath::Abs(pdgCode)!=211)
298 return 0;
299 if (particleSpecies == 1 && TMath::Abs(pdgCode)!=321)
300 return 0;
301 if (particleSpecies == 2 && TMath::Abs(pdgCode)!=2212)
302 return 0;
303 if (particleSpecies == 3 && (TMath::Abs(pdgCode)==211 || TMath::Abs(pdgCode)==321 || TMath::Abs(pdgCode)==2212))
304 return 0;
305 }
306 }
a75aacd6 307
308 }else if (obj->InheritsFrom("TObjArray")){ // list of AliVParticle
309 TObjArray *array = dynamic_cast<TObjArray*>(obj);
310 part = (AliVParticle*)array->At( ipart );
311 if (!part)return 0;
312 }else if (obj->InheritsFrom("AliMCEvent")){ // MC PARTICLE
313 AliMCEvent* mcEvent = dynamic_cast<AliMCEvent*>(obj);
314 part = mcEvent->GetTrack( ipart );
315 if (!part) return 0;
316 // eventually only primaries
317 if (onlyprimaries && !( mcEvent->IsPhysicalPrimary(ipart)) )return 0;
318 // eventually only hadrons
319 //TO-DO
320 /*if (fOnlyHadrons){
321 Int_t pdgCode = part->GetPdgCode();
322 Bool_t isHadron = TMath::Abs(pdgCode)==211 || // Pion
323 TMath::Abs(pdgCode)==2212 || // Proton
324 TMath::Abs(pdgCode)==321; // Kaon
325 if (!isHadron) return 0;
326 }
327 */
328
329 }else if (obj->InheritsFrom("AliAODEvent")){ // RECO AOD TRACKS
330 AliAODEvent *aodEvent = dynamic_cast<AliAODEvent*>(obj);
331 part = aodEvent->GetTrack(ipart);
332 // track selection cuts
144bd037 333 if ( !(((AliAODTrack*)part)->TestFilterBit(fFilterBit)) ) return 0;
334 //if ( !(((AliAODTrack*)part)->TestFilterBit(fFilterBit)) && !(((AliAODTrack*)part)->TestFilterBit(32)) ) return 0;
a75aacd6 335 // only primary candidates
336 //if ( ((AliAODTrack*)part)->IsPrimaryCandidate() )return 0;
337 // eventually only hadrons
338 if (fOnlyHadrons){
339 Bool_t isHadron = ((AliAODTrack*)part)->GetMostProbablePID()==AliAODTrack::kPion ||
340 ((AliAODTrack*)part)->GetMostProbablePID()==AliAODTrack::kKaon ||
341 ((AliAODTrack*)part)->GetMostProbablePID()==AliAODTrack::kProton;
342 if (!isHadron) return 0;
343 }
344
345 }else if (obj->InheritsFrom("AliESDEvent")){ // RECO ESD TRACKS
346 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(obj);
347 part = esdEvent->GetTrack(ipart);
348 if (!part)return 0;
349 // track selection cuts
3712ba26 350 if (!( ApplyCuts(part)) )return 0;
a75aacd6 351
352 // only primary candidates (does not exist for ESD tracks??????)
353 //if ( ((AliAODTrack*)part)->IsPrimaryCandidate() )return 0;
354
355 // eventually only hadrons
356 //TO-DO
357 /*if (fOnlyHadrons){
358 Bool_t isHadron = ((AliAODTrack*)part)->GetMostProbablePID()==AliAODTrack::kPion ||
359 ((AliAODTrack*)part)->GetMostProbablePID()==AliAODTrack::kKaon ||
360 ((AliAODTrack*)part)->GetMostProbablePID()==AliAODTrack::kProton;
361 if (!isHadron) return 0;
362 }
363 */
364 }else {
365 if (fDebug > 1) AliFatal(" Analysis type not defined !!! ");
366 return 0;
367 }
368
369 // only charged
370 if (!part->Charge())return 0;
371
372 return part;
373}
374
375
376//-------------------------------------------------------------------
377void AliAnalyseLeadingTrackUE::QSortTracks(TObjArray &a, Int_t first, Int_t last)
378{
379 // Sort array of TObjArray of tracks by Pt using a quicksort algorithm.
380
381 static TObject *tmp;
382 static int i; // "static" to save stack space
383 int j;
384
385 while (last - first > 1) {
386 i = first;
387 j = last;
388 for (;;) {
389 while (++i < last && ((AliVParticle*)a[i])->Pt() > ((AliVParticle*)a[first])->Pt() )
390 ;
391 while (--j > first && ((AliVParticle*)a[j])->Pt() < ((AliVParticle*)a[first])->Pt() )
392 ;
393 if (i >= j)
394 break;
395
396 tmp = a[i];
397 a[i] = a[j];
398 a[j] = tmp;
399 }
400 if (j == first) {
401 ++first;
402 continue;
403 }
404 tmp = a[first];
405 a[first] = a[j];
406 a[j] = tmp;
407 if (j - first < last - (j + 1)) {
408 QSortTracks(a, first, j);
409 first = j + 1; // QSortTracks(j + 1, last);
410 } else {
411 QSortTracks(a, j + 1, last);
412 last = j; // QSortTracks(first, j);
413 }
414 }
415}
416
417//____________________________________________________________________
418TObjArray* AliAnalyseLeadingTrackUE::SortRegions(const AliVParticle* leading, TObject* obj, TObject* arrayMC, Bool_t onlyprimaries)
419{
420
421 // Assign particles to towards, away or transverse regions.
422 // Returns a lists of particles for each region.
423
424 static const Double_t k60rad = 60.*TMath::Pi()/180.;
425 static const Double_t k120rad = 120.*TMath::Pi()/180.;
426
427 // Define output lists of particles
428 TList *toward = new TList();
429 TList *away = new TList();
430 // Two transverse regions, for the moment those are not yet MIN and MAX!!!
431 // MIN and MAX can be sorted in GetMinMaxRegion function
432 TList *transverse1 = new TList();
433 TList *transverse2 = new TList();
434
435 TObjArray *regionParticles = new TObjArray;
05c47aff 436 regionParticles->SetOwner(kTRUE);
437
a75aacd6 438 regionParticles->AddLast(toward);
439 regionParticles->AddLast(away);
440 regionParticles->AddLast(transverse1);
441 regionParticles->AddLast(transverse2);
442
443 if (!leading)
444 return regionParticles;
445
446 // Switch to vector for leading particle
447 TVector3 leadVect(leading->Px(),leading->Py(),leading->Pz());
448
449 Int_t nTracks = NParticles(obj);
450 if( !nTracks ) return 0;
451 // Loop over tracks
452 for (Int_t ipart=0; ipart<nTracks; ++ipart) {
453 AliVParticle* part = ParticleWithCuts(obj, ipart);
454 if (!part)continue;
455 //Switch to vectors for particles
456 TVector3 partVect(part->Px(), part->Py(), part->Pz());
457
458 Int_t region = 0;
459 if( TMath::Abs(partVect.Eta()) > fTrackEtaCut ) continue;
460 // transverse regions
461 if (leadVect.DeltaPhi(partVect) < -k60rad && leadVect.DeltaPhi(partVect) > -k120rad )region = -1; //left
462 if (leadVect.DeltaPhi(partVect) > k60rad && leadVect.DeltaPhi(partVect) < k120rad ) region = 1; //right
463
464 if (TMath::Abs(leadVect.DeltaPhi(partVect)) < k60rad ) region = 2; //forward
465 if (TMath::Abs(leadVect.DeltaPhi(partVect)) > k120rad ) region = -2; //backward
466
467 // skip leading particle
b1831bcb 468 if (leading == part)
a75aacd6 469 continue;
470
471 if (!region)continue;
472 if (arrayMC && arrayMC->InheritsFrom("TClonesArray") && obj->InheritsFrom("AliAODEvent")){
473 Int_t label = ((AliAODTrack*)part)->GetLabel();
474 // re-define part as the matched MC particle
475 part = (AliAODMCParticle*)ParticleWithCuts(arrayMC, TMath::Abs(label),onlyprimaries);
476 if (!part)continue;
477 // skip leading particle
478 if (leading == part)
479 continue;
480 }
481 if (arrayMC && arrayMC->InheritsFrom("AliMCEvent") && obj->InheritsFrom("AliESDEvent")){
482 Int_t label = ((AliESDtrack*)part)->GetLabel();
483 // look for the matched MC particle (but do not re-define part)
484 if (!ParticleWithCuts(arrayMC, TMath::Abs(label),onlyprimaries)) continue;
485 }
486
487 if ( region == 1 ) transverse1->Add(part);
488 if ( region == -1 ) transverse2->Add(part);
489 if ( region == 2 ) toward->Add(part);
490 if ( region == -2 ) away->Add(part);
491
492 }//end loop on tracks
493
494 return regionParticles;
495
496}
497
498
499//____________________________________________________________________
500Bool_t AliAnalyseLeadingTrackUE::TriggerSelection(const TObject* obj)
501{
502
503 //Use AliPhysicsSelection to select good events
504 if( !obj->InheritsFrom("AliAODInputHandler") ) { // not needed for AOD input
144bd037 505 if (!(((AliInputEventHandler*)obj)->IsEventSelected()&AliVEvent::kMB))return kFALSE;
a75aacd6 506 }
507
05c47aff 508 // TODO for AOD input trigger bit needs to be checked too (is stored in the AOD)
509
a75aacd6 510 return kTRUE;
511
512}
513
514//____________________________________________________________________
515Bool_t AliAnalyseLeadingTrackUE::VertexSelection(const TObject* obj, Int_t ntracks, Double_t zed)
516{
517
518 //Require 1 vertex (no TPC stand-alone) with a minimum number of tracks and z-coordinate in a limited range
519
520 if (obj->InheritsFrom("AliAODEvent")){
521 Int_t nVertex = ((AliAODEvent*)obj)->GetNumberOfVertices();
522 if( nVertex > 0 ) {
523 AliAODVertex* vertex = (AliAODVertex*)((AliAODEvent*)obj)->GetPrimaryVertex();
144bd037 524 Int_t nTracksPrim = vertex->GetNContributors();
a75aacd6 525 Double_t zVertex = vertex->GetZ();
526 if (fDebug > 1)AliInfo(Form(" Vertex in = %f with %d particles by %s data ...",zVertex,nTracksPrim,vertex->GetName()));
144bd037 527 // Reject TPC only vertex
528 TString name(vertex->GetName());
529 if (name.CompareTo("PrimaryVertex") && name.CompareTo("SPDVertex"))return kFALSE;
530
531 // Select a quality vertex by number of tracks?
a75aacd6 532 if( nTracksPrim < ntracks || TMath::Abs(zVertex) > zed ) {
533 if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");
534 return kFALSE;
535 }
536 // TODO remove vertexer Z events with dispersion > 0.02: Doesn't work for AOD at present
537 //if (strcmp(vertex->GetTitle(), "AliVertexerZ") == 0 && vertex->GetDispersion() > 0.02)
538 // return kFALSE;
539 if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED...");
540 } else {
541 if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");
542 return kFALSE;
543 }
544 }
545
546 if (obj->InheritsFrom("AliMCEvent"))
547 {
548 if (TMath::Abs(((AliMCEvent*) obj)->GetPrimaryVertex()->GetZ()) > zed)
549 {
550 if (fDebug > 1) AliInfo(" Primary-vertex Selection: event (based on MC) REJECTED ...");
551 return kFALSE;
552 }
553 }
144bd037 554
555 // ESD case for DCA studies
556 if (obj->InheritsFrom("AliESDEvent")){
557 AliESDVertex* vertex = (AliESDVertex*)((AliESDEvent*)obj)->GetPrimaryVertex();
558 if ( vertex){
559 Int_t nTracksPrim = vertex->GetNContributors();
560 Double_t zVertex = vertex->GetZ();
561 if (fDebug > 1)AliInfo(Form(" Vertex in = %f with %d particles by %s data ...",zVertex,nTracksPrim,vertex->GetName()));
562 // Reject SPD or TPC only vertex
563 TString name(vertex->GetName());
564 if (name.CompareTo("PrimaryVertex") && name.CompareTo("SPDVertex"))return kFALSE;
565
566 // Select a quality vertex by number of tracks?
567 if( nTracksPrim < ntracks || TMath::Abs(zVertex) > zed ) {
568 if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");
569 return kFALSE;
570 }
571 // TODO remove vertexer Z events with dispersion > 0.02: Doesn't work for AOD at present
572 //if (strcmp(vertex->GetTitle(), "AliVertexerZ") == 0 && vertex->GetDispersion() > 0.02)
573 // return kFALSE;
574 if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED...");
575 } else {
576 if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ...");
577 return kFALSE;
578 }
579 }
a75aacd6 580
581 return kTRUE;
582}