-/*
-//___________________________________________________________
-void AliCaloTrackReader::RejectExoticEvents(TArrayI patches)
-{
- // Reject events triggered by exotic cells
-
- if(!GetFiredTriggerClasses().Contains("EMC") && !fForceExoticRejection)
- {
- fIsExoticEvent = kFALSE;
- return;
- }
-
- Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
-
- // simple method, just count how many exotics and how many high energy clusters
- // over the trigger threshold there are
-
- if(!fTriggerPatchExoticRejection)
- {
- Int_t nOfHighECl = 0 ;
- Int_t nExo = 0 ;
- for (Int_t iclus = 0 ; iclus < nclusters; iclus++)
- {
- AliVCluster * clus = 0;
- if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
- {
- if (IsEMCALCluster(clus) && clus->E() > fTriggerEventThreshold)
- {
- Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
- Bool_t bad = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
- clus->GetCellsAbsId(),clus->GetNCells());
-
- if ( exotic)
- {
- //printf("- Exotic E %f, tof %f\n",clus->E(),clus->GetTOF()*1e9);
- nExo++;
- }
- else if(!bad && !exotic) nOfHighECl++;
-
- }//EMCAL cluster
- }// cluster exists
- }// cluster loop
-
- //printf("- trigger %2.1f, n Exotic %d, n high energy %d\n", fTriggerEventThreshold,nExo,nOfHighECl);
-
- if ( ( nExo > 0 ) && ( nOfHighECl == 0 ) )
- {
- fIsExoticEvent = kTRUE ;
- //printf("*** Exotic Event\n");
- }
- else
- fIsExoticEvent = kFALSE;
-
- }
- //Check if there is any trigger patch that has an associated exotic cluster
- else
- {
- //printf("Trigger Exotic?\n");
-
-
- Int_t nPatch = patches.GetSize();
-
-// for(Int_t iabsId =0; iabsId < nTrig; iabsId++)
-// {
-// Int_t absIDCell[4];
-// GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(absIDTrig[iabsId], absIDCell);
-// printf("Patch %d absIdTrigger %d: AbsIdCells: %d - %d - %d - %d \n",iabsId,absIDTrig[iabsId],absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
-// }
-
- // Loop on the clusters, check if there is any that falls into one of the patches
- for (Int_t iclus = 0; iclus < nclusters; iclus++)
- {
- AliVCluster * clus = 0;
- fIsExoticEvent = kFALSE;
- if ( (clus = fInputEvent->GetCaloCluster(iclus)) && IsEMCALCluster(clus))
- {
- Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
-
-// if(nPatch > 4)
-// {
-// Float_t frac = -1;
-// Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
-// Double_t tof = clus->GetTOF();
-// Bool_t bad = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
-// clus->GetCellsAbsId(),clus->GetNCells());
-// GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
-// printf("cluster %d, E %2.2f, tof %2.2f, AbsId max %d, exo %d, bad %d\n",iclus,clus->E(),tof*1e9,absIdMax,exotic,bad);
-// }
-
- if(exotic)
- {
- Float_t frac = -1;
- Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
- //Double_t tof = clus->GetTOF();
- //GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
- //printf("cluster %d, E %2.2f, tof %2.2f, AbsId max %d\n",iclus,clus->E(),tof*1e9,absIdMax);
-
- for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
- {
- Int_t absIDCell[4];
- GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
- for(Int_t ipatch = 0; ipatch < 4; ipatch++)
- {
- //Loop on the cluster cells and check if any is in patch, ideally
- // max id should suffice, but not always
- // for(Int_t iCell = 0; iCell<clus->GetNCells(); iCell++)
- // {
- // Int_t id = clus->GetCellsAbsId()[iCell];
- // Double_t tofCell = fInputEvent->GetEMCALCells()->GetCellTime(id);
- // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(id,fInputEvent->GetBunchCrossNumber(),tofCell);
- // //printf(" id %d - E %2.2f - tof %2.2f; ",clus->GetCellsAbsId()[iCell],
- // // fInputEvent->GetEMCALCells()->GetCellAmplitude(id), tofCell*1e9);
- // if(clus->GetCellsAbsId()[iCell] == absIDCell[ipatch])
- // {
- // //printf("\n *** Exotic trigger : absId %d, E %2.1f \n",clus->GetCellsAbsId()[iCell],clus->E());
- // fIsExoticEvent = kTRUE;
- // //return;
- // }
- // //else printf("\n");
- // }
-
- if(absIdMax == absIDCell[ipatch])
- {
- Double_t tof = clus->GetTOF();
- GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
- //printf("*** Exotic trigger : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), clus->GetTOF()*1e9);
-
- fIsExoticEvent = kTRUE;
- return;
- }
- }// cell patch loop
- }// trigger patch loop
- }// exotic cluster
- }// EMCal cluster
- }// Cluster loop
- }// exotic and trigger patch event flag
-
-}
-*/
-
-/*
-//______________________________________________________________________
-void AliCaloTrackReader::RejectTriggeredEventsByPileUp(TArrayI patches)
-{
- // Reject events triggered by exotic cells
-
- if(!GetFiredTriggerClasses().Contains("EMC") && !fForceExoticRejection)
- {
- fTriggerClusterBC = 0;
- return;
- }
-
- TClonesArray * clusterList = 0;
- if (fInputEvent->FindListObject(fEMCALClustersListName))
- {
- clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
- }
- else if(fOutputEvent)
- {
- clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
- }
-
- Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
- if(clusterList) nclusters = clusterList->GetEntriesFast();
-
- // simple method, just count how many exotics and how many high energy clusters
- // over the trigger threshold there are
-
- if(!fTriggerPatchExoticRejection)
- {
- Int_t nOfHighECl = 0 ;
- Int_t nOutBC = 0 ;
- Float_t tofcluster = 1000;
- Float_t eBCN =-1;
-
- for (Int_t iclus = 0 ; iclus < nclusters; iclus++)
- {
- AliVCluster * clus = 0;
-
- if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
- else clus = fInputEvent->GetCaloCluster(iclus);
-
- if ( clus )
- {
- if (IsEMCALCluster(clus) && clus->E() > fTriggerEventThreshold)
- {
- Bool_t bad = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
- clus->GetCellsAbsId(),clus->GetNCells());
-
- Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
-
- if(bad || exotic || clus->E() < 1) continue;
-
- Float_t frac = -1;
- Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
-
- Double_t tof = clus->GetTOF();
- if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
- GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
- tof *=1.e9;
-
- if ( TMath::Abs(tof) > 25 )
- {
- nOutBC++;
- if(clus->E() > eBCN)
- {
- tofcluster = tof;
- eBCN = clus->E();
- }
-
- //printf("Simple: Large time: E %f, tof %f, absId %d\n",clus->E(),tofcluster, absIdMax);
-
- }
- else
- {
- //printf("Simple: OK cluster E %f, tof %f\n",clus->E(),tofcluster);
- nOfHighECl++;
- }
-
- }//EMCAL cluster
- }// cluster exists
- }// cluster loop
-
- //printf("- n OutBC %d, n high energy %d\n", nOutBC,nOfHighECl);
-
- Double_t tofclusterUS = TMath::Abs(tofcluster);
- if ( ( nOutBC > 0 ) && ( nOfHighECl == 0 ) )
- {
- if (tofclusterUS < 75 ) fTriggerClusterBC = 1 ;
- else if(tofclusterUS < 125) fTriggerClusterBC = 2 ;
- else if(tofclusterUS < 175) fTriggerClusterBC = 3 ;
- else if(tofclusterUS < 225) fTriggerClusterBC = 4 ;
- else if(tofclusterUS < 275) fTriggerClusterBC = 5 ;
- else fTriggerClusterBC = 6 ;
-
- if(tofcluster < 0) fTriggerClusterBC*=-1;
-
- }
- else if(( nOutBC == 0 ) && ( nOfHighECl == 0 ) )
- {
- fTriggerClusterBC = 7 ;
- }
- else
- {
- fTriggerClusterBC = 0;
- }
-
- //printf("*** Simple: Trigger tag BC %d, tof %2.2f, E %2.2f\n",fTriggerClusterBC, tofcluster, eBCN);
-
- }
- //Check if there is any trigger patch that has an associated exotic cluster
- else
- {
- //printf("Trigger Exotic?\n");
-
- Int_t nPatch = patches.GetSize();
-
- // Loop on the clusters, check if there is any that falls into one of the patches
-
- Float_t tofcluster = 1000;
- Float_t eBCN =-1;
-
- Bool_t ok = kFALSE;
- Bool_t ok2 = kFALSE;
-
- for (Int_t iclus = 0; iclus < nclusters; iclus++)
- {
- AliVCluster * clus = 0;
- if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
- else clus = fInputEvent->GetCaloCluster(iclus);
-
- if ( clus )
- {
- Bool_t bad = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
- clus->GetCellsAbsId(),clus->GetNCells());
-
- Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
-
- if(bad || exotic || clus->E() < 1) continue;
-
- Float_t frac = -1;
- Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
-
- Double_t tof = clus->GetTOF();
-
- if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
- GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
- tof *=1.e9;
-
- // in case no final match with the trigger, check if there was a high energy cluster
- // with the timing of BC=0
- if(clus->E() > fTriggerEventThreshold)
- {
- if(TMath::Abs(tof) < 25) ok = kTRUE;
- else ok2 = kTRUE;
- }
- //printf("cluster %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad %d\n",iclus,clus->E(),tof,absIdMax, exotic, bad);
-
- // if ( TMath::Abs(tof) > 25 )
- // {
- //printf("cluster %d, E %2.2f, tof %2.2f, AbsId max %d\n",iclus,clus->E(),tof*1e9,absIdMax);
-
- for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
- {
- Int_t absIDCell[4];
- GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
- //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
- // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
-
-
- for(Int_t ipatch = 0; ipatch < 4; ipatch++)
- {
- if(absIdMax == absIDCell[ipatch])
- {
- //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
- if(clus->E() > eBCN)
- {
- tofcluster = tof;
- eBCN = clus->E();
- }
- }
- }// cell patch loop
- }// trigger patch loop
-// }// out BC
- }// EMCal cluster
- }// Cluster loop
-
- Double_t tofclusterUS = TMath::Abs(tofcluster);
-
- if (tofcluster == 1000)
- {
- if(ok) fTriggerClusterBC = 6 ; // no trigger match but high energy cluster with time at BC=0
- else fTriggerClusterBC = 7 ; // no trigger match and no likely good cluster
- }
- else if(tofclusterUS < 25 ) fTriggerClusterBC = 0 ;
- else if(tofclusterUS < 75 ) fTriggerClusterBC = 1 ;
- else if(tofclusterUS < 125) fTriggerClusterBC = 2 ;
- else if(tofclusterUS < 175) fTriggerClusterBC = 3 ;
- else if(tofclusterUS < 225) fTriggerClusterBC = 4 ;
- else fTriggerClusterBC = 5 ;
-
- //printf(" selected tof %f\n",tofcluster);
-
- if(tofcluster < 0) fTriggerClusterBC*=-1;
-
- //if(fTriggerClusterBC != 0) printf("*** Patches: Trigger out of BC %d, tof %2.2f, E %2.2f\n",fTriggerClusterBC,tofcluster,eBCN);
-
- //if(fTriggerClusterBC==7) printf("*** No trigger match, high energy cluster? %d\n",ok2);
- //if(fTriggerClusterBC==6) printf("*** No trigger match, but high energy cluster in BC0\n");
-
- }// exotic and trigger patch event flag
-
-}
-*/
-