+Bool_t AliAnalysisTaskJetServices::IsEventSelectedESD(AliESDEvent* esd){
+ if(!esd)return kFALSE;
+ const AliESDVertex *vtx = esd->GetPrimaryVertex();
+ // We can check the type of the vertex by its name and title
+ // if vertexer failed title is empty (default c'tor) and ncontributors is 0
+ // vtx name title
+ // Tracks PrimaryVertex VertexerTracksNoConstraint
+ // TPC TPCVertex VertexerTracksNoConstraint
+ // SPD SPDVertex vertexer: 3D
+ // SPD SPDVertex vertexer: Z
+
+
+
+ if(vtx->GetNContributors()<1)return kFALSE;
+
+ // do not want tpc only primary vertex
+ TString vtxName(vtx->GetName());
+ if(vtxName.Contains("TPCVertex"))return kFALSE;
+ Float_t zvtx = vtx->GetZ();
+ Float_t yvtx = vtx->GetY();
+ Float_t xvtx = vtx->GetX();
+
+ // here we may fill the histos for run dependence....
+
+ xvtx -= fVtxXMean;
+ yvtx -= fVtxYMean;
+ zvtx -= fVtxZMean;
+
+ Float_t r2 = yvtx*yvtx+xvtx*xvtx;
+
+ Bool_t eventSel = TMath::Abs(zvtx)<fVtxZCut&&r2<(fVtxRCut*fVtxRCut);
+ return eventSel;
+}
+
+Bool_t AliAnalysisTaskJetServices::IsEventSelectedAOD(AliAODEvent* aod){
+ if(!aod)return kFALSE;
+ const AliAODVertex *vtx = aod->GetPrimaryVertex();
+ // We can check the type of the vertex by its name and title
+ // if vertexer failed title is empty (default c'tor) and ncontributors is 0
+ // vtx name title
+ // Tracks PrimaryVertex VertexerTracksNoConstraint
+ // TPC TPCVertex VertexerTracksNoConstraint
+ // SPD SPDVertex vertexer: 3D
+ // SPD SPDVertex vertexer: Z
+
+
+
+ if(vtx->GetNContributors()<1)return kFALSE;
+
+ // do not want tpc only primary vertex
+ TString vtxName(vtx->GetName());
+ if(vtxName.Contains("TPCVertex"))return kFALSE;
+
+ Float_t zvtx = vtx->GetZ();
+ Float_t yvtx = vtx->GetY();
+ Float_t xvtx = vtx->GetX();
+
+ // here we may fill the histos for run dependence....
+
+ xvtx -= fVtxXMean;
+ yvtx -= fVtxYMean;
+ zvtx -= fVtxZMean;
+
+ Float_t r2 = yvtx*yvtx+xvtx*xvtx;
+ Bool_t eventSel = TMath::Abs(zvtx)<fVtxZCut&&r2<(fVtxRCut*fVtxRCut);
+ return eventSel;
+}
+
+