+ //------------------------------------------------------
+ //Event rejection depending on vertex, pileup, v0and
+ //------------------------------------------------------
+ if(fDoEventSelection){
+ if(!fCaloFilterPatch){
+ //Do not analyze events with pileup
+ Bool_t bPileup = fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.); //Default values, if not it does not compile
+ //Bool_t bPileup = event->IsPileupFromSPD();
+ if(bPileup) return kFALSE;
+
+ if(fDoV0ANDEventSelection){
+ Bool_t bV0AND = kTRUE;
+ AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
+ if(esd)
+ bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND);
+ //else bV0AND = //FIXME FOR AODs
+ if(!bV0AND) return kFALSE;
+ }
+
+ if(!CheckForPrimaryVertex()) return kFALSE;
+ }//CaloFilter patch
+ else{
+ if(fInputEvent->GetNumberOfCaloClusters() > 0) {
+ AliVCluster * calo = fInputEvent->GetCaloCluster(0);
+ if(calo->GetNLabels() == 4){
+ Int_t * selection = calo->GetLabels();
+ Bool_t bPileup = selection[0];
+ if(bPileup) return kFALSE;
+
+ Bool_t bGoodV = selection[1];
+ if(!bGoodV) return kFALSE;
+
+ if(fDoV0ANDEventSelection){
+ Bool_t bV0AND = selection[2];
+ if(!bV0AND) return kFALSE;
+ }
+
+ fTrackMult = selection[3];
+ if(fTrackMult == 0) return kFALSE;
+ } else {
+ //First filtered AODs, track multiplicity stored there.
+ fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
+ if(fTrackMult == 0) return kFALSE;
+ }
+ }//at least one cluster
+ else {
+ //printf("AliCaloTrackReader::FillInputEvent() - No clusters in event\n");
+ //Remove events with vertex (0,0,0), bad vertex reconstruction
+ if(TMath::Abs(fVertex[0][0]) < 1.e-6 && TMath::Abs(fVertex[0][1]) < 1.e-6 && TMath::Abs(fVertex[0][2]) < 1.e-6) return kFALSE;
+
+ //First filtered AODs, track multiplicity stored there.
+ fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
+ if(fTrackMult == 0) return kFALSE;
+ }// no cluster
+ }// CaloFileter patch
+ }// Event selection
+ //------------------------------------------------------
+
+ //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested
+ //If we need a centrality bin, we select only those events in the corresponding bin.
+ if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100){
+ Int_t cen = GetEventCentrality();
+ if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
+ }
+