#include "AliEMCALRecoUtils.h"
#include "AliEMCALGeometry.h"
#include "AliTrackerBase.h"
-#include "AliEMCALCalibTimeDepCorrection.h" // Run dependent
#include "AliEMCALPIDUtils.h"
fNonLinearityFunction(0), fNonLinearThreshold(0),
fSmearClusterEnergy(kFALSE), fRandom(),
fCellsRecalibrated(kFALSE), fRecalibration(kFALSE), fEMCALRecalibrationFactors(),
- fTimeRecalibration(kFALSE), fEMCALTimeRecalibrationFactors(),
- fUseRunCorrectionFactors(kFALSE), fRunCorrectionFactorsSet(kFALSE),
+ fTimeRecalibration(kFALSE), fEMCALTimeRecalibrationFactors(), fUseRunCorrectionFactors(kFALSE),
fRemoveBadChannels(kFALSE), fRecalDistToBadChannels(kFALSE), fEMCALBadChannelMap(),
fNCellsFromEMCALBorder(0), fNoEMCALBorderAtEta0(kTRUE),
fRejectExoticCluster(kFALSE), fRejectExoticCells(kFALSE),
fCellsRecalibrated(reco.fCellsRecalibrated),
fRecalibration(reco.fRecalibration), fEMCALRecalibrationFactors(reco.fEMCALRecalibrationFactors),
fTimeRecalibration(reco.fTimeRecalibration), fEMCALTimeRecalibrationFactors(reco.fEMCALTimeRecalibrationFactors),
- fUseRunCorrectionFactors(reco.fUseRunCorrectionFactors), fRunCorrectionFactorsSet(reco.fRunCorrectionFactorsSet),
+ fUseRunCorrectionFactors(reco.fUseRunCorrectionFactors),
fRemoveBadChannels(reco.fRemoveBadChannels), fRecalDistToBadChannels(reco.fRecalDistToBadChannels),
fEMCALBadChannelMap(reco.fEMCALBadChannelMap),
fNCellsFromEMCALBorder(reco.fNCellsFromEMCALBorder), fNoEMCALBorderAtEta0(reco.fNoEMCALBorderAtEta0),
fEMCALTimeRecalibrationFactors = reco.fEMCALTimeRecalibrationFactors;
fUseRunCorrectionFactors = reco.fUseRunCorrectionFactors;
- fRunCorrectionFactorsSet = reco.fRunCorrectionFactorsSet;
fRemoveBadChannels = reco.fRemoveBadChannels;
fRecalDistToBadChannels = reco.fRecalDistToBadChannels;
AliEMCALRecoUtils::~AliEMCALRecoUtils()
{
//Destructor.
-
+
if(fEMCALRecalibrationFactors)
{
fEMCALRecalibrationFactors->Clear();
delete fEMCALRecalibrationFactors;
- }
+ }
if(fEMCALTimeRecalibrationFactors)
{
fEMCALTimeRecalibrationFactors->Clear();
delete fEMCALTimeRecalibrationFactors;
- }
+ }
if(fEMCALBadChannelMap)
{
return kFALSE;
}
- geom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
-
+ geom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
+
// Do not include bad channels found in analysis,
if( IsBadChannelsRemovalSwitchedOn() && GetEMCALChannelStatus(imod, ieta, iphi))
{
const AliVCluster* cluster,
AliVCaloCells* cells)
{
- // Given the list of AbsId of the cluster, get the maximum cell and
- // check if there are fNCellsFromBorder from the calorimeter border
-
+ // Given the list of AbsId of the cluster, get the maximum cell and
+ // check if there are fNCellsFromBorder from the calorimeter border
+
if(!cluster)
{
AliInfo("Cluster pointer null!");
}
//If the distance to the border is 0 or negative just exit accept all clusters
- if(cells->GetType()==AliVCaloCells::kEMCALCell && fNCellsFromEMCALBorder <= 0 ) return kTRUE;
+ if(cells->GetType()==AliVCaloCells::kEMCALCell && fNCellsFromEMCALBorder <= 0 ) return kTRUE;
- Int_t absIdMax = -1, iSM =-1, ieta = -1, iphi = -1;
+ Int_t absIdMax = -1, iSM =-1, ieta = -1, iphi = -1;
Bool_t shared = kFALSE;
GetMaxEnergyCell(geom, cells, cluster, absIdMax, iSM, ieta, iphi, shared);
AliDebug(2,Form("Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f, Ncells from border %d, EMCAL eta=0 %d\n",
absIdMax, cells->GetCellAmplitude(absIdMax), cluster->E(), fNCellsFromEMCALBorder, fNoEMCALBorderAtEta0));
-
- if(absIdMax==-1) return kFALSE;
-
- //Check if the cell is close to the borders:
- Bool_t okrow = kFALSE;
- Bool_t okcol = kFALSE;
+
+ if(absIdMax==-1) return kFALSE;
+
+ //Check if the cell is close to the borders:
+ Bool_t okrow = kFALSE;
+ Bool_t okcol = kFALSE;
if(iSM < 0 || iphi < 0 || ieta < 0 )
{
{
if(iSM%2==0)
{
- if(ieta >= fNCellsFromEMCALBorder) okcol = kTRUE;
+ if(ieta >= fNCellsFromEMCALBorder) okcol = kTRUE;
}
else
{
- if(ieta < 48-fNCellsFromEMCALBorder) okcol = kTRUE;
+ if(ieta < 48-fNCellsFromEMCALBorder) okcol = kTRUE;
}
}//eta 0 not checked
AliDebug(2,Form("EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d: column? %d, row? %d\nq",
fNCellsFromEMCALBorder, ieta, iphi, iSM, okcol, okrow));
-
- if (okcol && okrow)
+
+ if (okcol && okrow)
{
//printf("Accept\n");
return kTRUE;
}
- else
+ else
{
//printf("Reject\n");
AliDebug(2,Form("Reject cluster in border, max cell : ieta %d, iphi %d, SM %d\n",ieta, iphi, iSM));
return kFALSE;
}
-
-}
+
+}
//_______________________________________________________________________________
{
// Check that in the cluster cells, there is no bad channel of those stored
// in fEMCALBadChannelMap or fPHOSBadChannelMap
-
+
if(!fRemoveBadChannels) return kFALSE;
if(!fEMCALBadChannelMap) return kFALSE;
-
+
Int_t icol = -1;
Int_t irow = -1;
Int_t imod = -1;
Int_t iTower = -1, iIphi = -1, iIeta = -1;
geom->GetCellIndex(cellList[iCell],imod,iTower,iIphi,iIeta);
if(fEMCALBadChannelMap->GetEntries() <= imod) continue;
- geom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol);
+ geom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol);
if(GetEMCALChannelStatus(imod, icol, irow))
{
AliDebug(2,Form("Cluster with bad channel: SM %d, col %d, row %d\n",imod, icol, irow));
return kTRUE;
}
-
+
}// cell cluster loop
-
+
return kFALSE;
}
-//_____________________________________________________________________________________________
-Bool_t AliEMCALRecoUtils::IsExoticCell(const Int_t absID, AliVCaloCells* cells, const Int_t bc)
-{
- // Look to cell neighbourhood and reject if it seems exotic
- // Do before recalibrating the cells
- if(!fRejectExoticCells) return kFALSE;
+//___________________________________________________________________________
+Float_t AliEMCALRecoUtils::GetECross(const Int_t absID, const Double_t tcell,
+ AliVCaloCells* cells, const Int_t bc)
+{
+ //Calculate the energy in the cross around the energy given cell
AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
geom->GetCellIndex(absID,imod,iTower,iIphi,iIeta);
- geom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
+ geom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
//Get close cells index, energy and time, not in corners
- Int_t absID1 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
- Int_t absID2 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
+ Int_t absID1 = -1;
+ Int_t absID2 = -1;
+
+ if( iphi < AliEMCALGeoParams::fgkEMCALRows-1) absID1 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
+ if( iphi > 0 ) absID2 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
// In case of cell in eta = 0 border, depending on SM shift the cross cell index
+
Int_t absID3 = -1;
Int_t absID4 = -1;
- if ( ieta == AliEMCALGeoParams::fgkEMCALCols - 1 && !(imod%2) )
+ if ( ieta == AliEMCALGeoParams::fgkEMCALCols-1 && !(imod%2) )
{
- absID3 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, 0);
- absID4 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
+ absID3 = geom-> GetAbsCellIdFromCellIndexes(imod+1, iphi, 0);
+ absID4 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
}
else if( ieta == 0 && imod%2 )
{
- absID3 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
- absID4 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, AliEMCALGeoParams::fgkEMCALCols-1);
+ absID3 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
+ absID4 = geom-> GetAbsCellIdFromCellIndexes(imod-1, iphi, AliEMCALGeoParams::fgkEMCALCols-1);
}
else
{
- absID3 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
- absID4 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
+ if( ieta < AliEMCALGeoParams::fgkEMCALCols-1 )
+ absID3 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
+ if( ieta > 0 )
+ absID4 = geom-> GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
}
-
- Float_t ecell = 0, ecell1 = 0, ecell2 = 0, ecell3 = 0, ecell4 = 0;
- Double_t tcell = 0, tcell1 = 0, tcell2 = 0, tcell3 = 0, tcell4 = 0;
- Bool_t accept = 0, accept1 = 0, accept2 = 0, accept3 = 0, accept4 = 0;
- accept = AcceptCalibrateCell(absID, bc, ecell ,tcell ,cells);
-
- if(!accept) return kTRUE; // reject this cell
+ //printf("IMOD %d, AbsId %d, a %d, b %d, c %d e %d \n",imod,absID,absID1,absID2,absID3,absID4);
- if(ecell < fExoticCellMinAmplitude) return kFALSE; // do not reject low energy cells
+ Float_t ecell1 = 0, ecell2 = 0, ecell3 = 0, ecell4 = 0;
+ Double_t tcell1 = 0, tcell2 = 0, tcell3 = 0, tcell4 = 0;
+ Bool_t accept1 = 0, accept2 = 0, accept3 = 0, accept4 = 0;
accept1 = AcceptCalibrateCell(absID1,bc, ecell1,tcell1,cells);
accept2 = AcceptCalibrateCell(absID2,bc, ecell2,tcell2,cells);
accept4 = AcceptCalibrateCell(absID4,bc, ecell4,tcell4,cells);
/*
- printf("Cell absID %d \n",absID);
- printf("\t accept1 %d, accept2 %d, accept3 %d, accept4 %d\n",
- accept1,accept2,accept3,accept4);
- printf("\t id %d: id1 %d, id2 %d, id3 %d, id4 %d\n",
- absID,absID1,absID2,absID3,absID4);
- printf("\t e %f: e1 %f, e2 %f, e3 %f, e4 %f\n",
- ecell,ecell1,ecell2,ecell3,ecell4);
- printf("\t t %f: t1 %f, t2 %f, t3 %f, t4 %f;\n dt1 %f, dt2 %f, dt3 %f, dt4 %f\n",
- tcell*1.e9,tcell1*1.e9,tcell2*1.e9,tcell3*1.e9,tcell4*1.e9,
- TMath::Abs(tcell-tcell1)*1.e9, TMath::Abs(tcell-tcell2)*1.e9, TMath::Abs(tcell-tcell3)*1.e9, TMath::Abs(tcell-tcell4)*1.e9);
- */
+ printf("Cell absID %d \n",absID);
+ printf("\t accept1 %d, accept2 %d, accept3 %d, accept4 %d\n",
+ accept1,accept2,accept3,accept4);
+ printf("\t id %d: id1 %d, id2 %d, id3 %d, id4 %d\n",
+ absID,absID1,absID2,absID3,absID4);
+ printf("\t e %f: e1 %f, e2 %f, e3 %f, e4 %f\n",
+ ecell,ecell1,ecell2,ecell3,ecell4);
+ printf("\t t %f: t1 %f, t2 %f, t3 %f, t4 %f;\n dt1 %f, dt2 %f, dt3 %f, dt4 %f\n",
+ tcell*1.e9,tcell1*1.e9,tcell2*1.e9,tcell3*1.e9,tcell4*1.e9,
+ TMath::Abs(tcell-tcell1)*1.e9, TMath::Abs(tcell-tcell2)*1.e9, TMath::Abs(tcell-tcell3)*1.e9, TMath::Abs(tcell-tcell4)*1.e9);
+ */
if(TMath::Abs(tcell-tcell1)*1.e9 > fExoticCellDiffTime) ecell1 = 0 ;
if(TMath::Abs(tcell-tcell2)*1.e9 > fExoticCellDiffTime) ecell2 = 0 ;
if(TMath::Abs(tcell-tcell3)*1.e9 > fExoticCellDiffTime) ecell3 = 0 ;
if(TMath::Abs(tcell-tcell4)*1.e9 > fExoticCellDiffTime) ecell4 = 0 ;
+
+ return ecell1+ecell2+ecell3+ecell4;
+
+}
- Float_t eCross = ecell1+ecell2+ecell3+ecell4;
+//_____________________________________________________________________________________________
+Bool_t AliEMCALRecoUtils::IsExoticCell(const Int_t absID, AliVCaloCells* cells, const Int_t bc)
+{
+ // Look to cell neighbourhood and reject if it seems exotic
+ // Do before recalibrating the cells
- //printf("\t eCell %f, eCross %f, 1-eCross/eCell %f\n",ecell,eCross,1-eCross/ecell);
+ if(!fRejectExoticCells) return kFALSE;
+
+ Float_t ecell = 0;
+ Double_t tcell = 0;
+ Bool_t accept = AcceptCalibrateCell(absID, bc, ecell ,tcell ,cells);
+
+ if(!accept) return kTRUE; // reject this cell
+
+ if(ecell < fExoticCellMinAmplitude) return kFALSE; // do not reject low energy cells
+
+ Float_t eCross = GetECross(absID,tcell,cells,bc);
if(1-eCross/ecell > fExoticCellFraction)
{
case kPi0MC:
{
//Non-Linearity correction (from MC with function ([0]*exp(-[1]/E))+(([2]/([3]*2.*TMath::Pi())*exp(-(E-[4])^2/(2.*[3]^2)))))
- //Double_t fNonLinearityParams[0] = 1.014;
- //Double_t fNonLinearityParams[1] = -0.03329;
- //Double_t fNonLinearityParams[2] = -0.3853;
- //Double_t fNonLinearityParams[3] = 0.5423;
- //Double_t fNonLinearityParams[4] = -0.4335;
+ //fNonLinearityParams[0] = 1.014;
+ //fNonLinearityParams[1] =-0.03329;
+ //fNonLinearityParams[2] =-0.3853;
+ //fNonLinearityParams[3] = 0.5423;
+ //fNonLinearityParams[4] =-0.4335;
energy *= (fNonLinearityParams[0]*exp(-fNonLinearityParams[1]/energy))+
((fNonLinearityParams[2]/(fNonLinearityParams[3]*2.*TMath::Pi())*
exp(-(energy-fNonLinearityParams[4])*(energy-fNonLinearityParams[4])/(2.*fNonLinearityParams[3]*fNonLinearityParams[3]))));
break;
}
+ case kPi0MCv2:
+ {
+ //Non-Linearity correction (from MC with function [0]/((x+[1])^[2]))+1;
+ //fNonLinearityParams[0] = 3.11111e-02;
+ //fNonLinearityParams[1] =-5.71666e-02;
+ //fNonLinearityParams[2] = 5.67995e-01;
+
+ energy *= fNonLinearityParams[0]/TMath::Power(energy+fNonLinearityParams[1],fNonLinearityParams[2])+1;
+ break;
+ }
+
+ case kPi0MCv3:
+ {
+ //Same as beam test corrected, change parameters
+ //fNonLinearityParams[0] = 9.81039e-01
+ //fNonLinearityParams[1] = 1.13508e-01;
+ //fNonLinearityParams[2] = 1.00173e+00;
+ //fNonLinearityParams[3] = 9.67998e-02;
+ //fNonLinearityParams[4] = 2.19381e+02;
+ //fNonLinearityParams[5] = 6.31604e+01;
+ //fNonLinearityParams[6] = 1;
+ energy *= fNonLinearityParams[6]/(fNonLinearityParams[0]*(1./(1.+fNonLinearityParams[1]*exp(-energy/fNonLinearityParams[2]))*1./(1.+fNonLinearityParams[3]*exp((energy-fNonLinearityParams[4])/fNonLinearityParams[5]))));
+
+ break;
+ }
+
+
case kPi0GammaGamma:
{
//Non-Linearity correction (from Olga Data with function p0+p1*exp(-p2*E))
- //Double_t fNonLinearityParams[0] = 1.04;
- //Double_t fNonLinearityParams[1] = -0.1445;
- //Double_t fNonLinearityParams[2] = 1.046;
+ //fNonLinearityParams[0] = 1.04;
+ //fNonLinearityParams[1] = -0.1445;
+ //fNonLinearityParams[2] = 1.046;
energy /= (fNonLinearityParams[0]+fNonLinearityParams[1]*exp(-fNonLinearityParams[2]*energy)); //Olga function
break;
}
void AliEMCALRecoUtils::InitNonLinearityParam()
{
//Initialising Non Linearity Parameters
-
+
if(fNonLinearityFunction == kPi0MC)
{
fNonLinearityParams[0] = 1.014;
fNonLinearityParams[4] = -0.4335;
}
+ if(fNonLinearityFunction == kPi0MCv2)
+ {
+ fNonLinearityParams[0] = 3.11111e-02;
+ fNonLinearityParams[1] =-5.71666e-02;
+ fNonLinearityParams[2] = 5.67995e-01;
+ }
+
+ if(fNonLinearityFunction == kPi0MCv3)
+ {
+ fNonLinearityParams[0] = 9.81039e-01;
+ fNonLinearityParams[1] = 1.13508e-01;
+ fNonLinearityParams[2] = 1.00173e+00;
+ fNonLinearityParams[3] = 9.67998e-02;
+ fNonLinearityParams[4] = 2.19381e+02;
+ fNonLinearityParams[5] = 6.31604e+01;
+ fNonLinearityParams[6] = 1;
+ }
+
if(fNonLinearityFunction == kPi0GammaGamma)
{
fNonLinearityParams[0] = 1.04;
fNonLinearityParams[1] = -0.1445;
fNonLinearityParams[2] = 1.046;
- }
+ }
if(fNonLinearityFunction == kPi0GammaConversion)
{
fNonLinearityParams[0] = 0.139393;
fNonLinearityParams[1] = 0.0566186;
fNonLinearityParams[2] = 0.982133;
- }
+ }
if(fNonLinearityFunction == kBeamTest)
{
{
//Init EMCAL recalibration factors
AliDebug(2,"AliCalorimeterUtils::InitEMCALRecalibrationFactors()");
- //In order to avoid rewriting the same histograms
+ //In order to avoid rewriting the same histograms
Bool_t oldStatus = TH1::AddDirectoryStatus();
TH1::AddDirectory(kFALSE);
fEMCALRecalibrationFactors->SetOwner(kTRUE);
fEMCALRecalibrationFactors->Compress();
-
+
//In order to avoid rewriting the same histograms
- TH1::AddDirectory(oldStatus);
+ TH1::AddDirectory(oldStatus);
}
//_________________________________________________________
fEMCALTimeRecalibrationFactors->Compress();
//In order to avoid rewriting the same histograms
- TH1::AddDirectory(oldStatus);
+ TH1::AddDirectory(oldStatus);
}
//____________________________________________________
AliDebug(2,"AliEMCALRecoUtils::InitEMCALBadChannelStatusMap()");
//In order to avoid rewriting the same histograms
Bool_t oldStatus = TH1::AddDirectoryStatus();
-
+ TH1::AddDirectory(kFALSE);
+
fEMCALBadChannelMap = new TObjArray(12);
//TH2F * hTemp = new TH2I("EMCALBadChannelMap","EMCAL SuperModule bad channel map", 48, 0, 48, 24, 0, 24);
for (int i = 0; i < 12; i++)
fEMCALBadChannelMap->Compress();
//In order to avoid rewriting the same histograms
- TH1::AddDirectory(oldStatus);
+ TH1::AddDirectory(oldStatus);
}
//____________________________________________________________________________
// Recalibrate the cluster energy and Time, considering the recalibration map
// and the energy of the cells and time that compose the cluster.
// bc= bunch crossing number returned by esdevent->GetBunchCrossNumber();
-
+
if(!cluster)
{
AliInfo("Cluster pointer null!");
UShort_t * index = cluster->GetCellsAbsId() ;
Double_t * fraction = cluster->GetCellsAmplitudeFraction() ;
Int_t ncells = cluster->GetNCells();
-
+
//Initialize some used variables
Float_t energy = 0;
Int_t absId =-1;
Int_t iTower = -1, iIphi = -1, iIeta = -1;
geom->GetCellIndex(absId,imod,iTower,iIphi,iIeta);
if(fEMCALRecalibrationFactors->GetEntries() <= imod) continue;
- geom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol);
+ geom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol);
factor = GetEMCALChannelRecalibrationFactor(imod,icol,irow);
AliDebug(2,Form("AliEMCALRecoUtils::RecalibrateClusterEnergy - recalibrate cell: module %d, col %d, row %d, cell fraction %f,recalibration factor %f, cell energy %f\n",
absIdMax = absId;
}
}
-
+
AliDebug(2,Form("AliEMCALRecoUtils::RecalibrateClusterEnergy - Energy before %f, after %f \n",cluster->E(),energy));
cluster->SetE(energy);
return;
}
- Int_t absId =-1;
+ Short_t absId =-1;
Bool_t accept = kFALSE;
Float_t ecell = 0;
Double_t tcell = 0;
+ Double_t ecellin = 0;
+ Double_t tcellin = 0;
+ Short_t mclabel = -1;
+ Double_t efrac = 0;
Int_t nEMcell = cells->GetNumberOfCells() ;
for (Int_t iCell = 0; iCell < nEMcell; iCell++)
{
- absId = cells->GetCellNumber(iCell);
+ cells->GetCell( iCell, absId, ecellin, tcellin, mclabel, efrac );
accept = AcceptCalibrateCell(absId, bc, ecell ,tcell ,cells);
if(!accept)
{
ecell = 0;
- tcell = 0;
+ tcell = -1;
}
//Set new values
- cells->SetCell(iCell,absId,ecell, tcell);
+ cells->SetCell(iCell,absId,ecell, tcell, mclabel, efrac);
}
fCellsRecalibrated = kTRUE;
if (!fCellsRecalibrated)
{
geom->GetCellIndex(absId,iSM,iTower,iIphi,iIeta);
- geom->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta);
+ geom->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta);
if(IsRecalibrationOn())
{
eCell = cells->GetCellAmplitude(absId);
geom->GetCellIndex(absId,iSupMod,iTower,iIphi,iIeta);
- geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta);
+ geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta);
if (!fCellsRecalibrated)
{
}
//Get channels map of the supermodule where the cluster is.
- Int_t absIdMax = -1, iSupMod =-1, icolM = -1, irowM = -1;
+ Int_t absIdMax = -1, iSupMod =-1, icolM = -1, irowM = -1;
Bool_t shared = kFALSE;
GetMaxEnergyCell(geom, cells, cluster, absIdMax, iSupMod, icolM, irowM, shared);
TH2D* hMap = (TH2D*)fEMCALBadChannelMap->At(iSupMod);
- Int_t dRrow, dRcol;
+ Int_t dRrow, dRcol;
Float_t minDist = 10000.;
Float_t dist = 0.;
fPIDUtils->ComputePID(cluster->E(),cluster->GetM02());
Float_t pidlist[AliPID::kSPECIESN+1];
- for(Int_t i = 0; i < AliPID::kSPECIESN+1; i++) pidlist[i] = fPIDUtils->GetPIDFinal(i);
+ for(Int_t i = 0; i < AliPID::kSPECIESN+1; i++) pidlist[i] = fPIDUtils->GetPIDFinal(i);
cluster->SetPID(pidlist);
}
-//____________________________________________________________________________________________
+//___________________________________________________________________________________________________________________
void AliEMCALRecoUtils::RecalculateClusterShowerShapeParameters(const AliEMCALGeometry * geom,
AliVCaloCells* cells,
- AliVCluster * cluster)
+ AliVCluster * cluster,
+ Float_t & l0, Float_t & l1,
+ Float_t & disp, Float_t & dEta, Float_t & dPhi,
+ Float_t & sEta, Float_t & sPhi, Float_t & sEtaPhi)
{
// Calculates new center of gravity in the local EMCAL-module coordinates
// and tranfers into global ALICE coordinates
return;
}
- Int_t nstat = 0;
- Float_t wtot = 0. ;
Double_t eCell = 0.;
Float_t fraction = 1.;
Float_t recalFactor = 1.;
- Int_t iSupMod = -1;
- Int_t iTower = -1;
- Int_t iIphi = -1;
- Int_t iIeta = -1;
- Int_t iphi = -1;
- Int_t ieta = -1;
- Double_t etai = -1.;
- Double_t phii = -1.;
-
- Double_t w = 0.;
- Double_t d = 0.;
- Double_t dxx = 0.;
- Double_t dzz = 0.;
- Double_t dxz = 0.;
- Double_t xmean = 0.;
- Double_t zmean = 0.;
+ Int_t iSupMod = -1;
+ Int_t iTower = -1;
+ Int_t iIphi = -1;
+ Int_t iIeta = -1;
+ Int_t iphi = -1;
+ Int_t ieta = -1;
+ Double_t etai = -1.;
+ Double_t phii = -1.;
+
+ Int_t nstat = 0 ;
+ Float_t wtot = 0.;
+ Double_t w = 0.;
+ Double_t etaMean = 0.;
+ Double_t phiMean = 0.;
//Loop on cells
for(Int_t iDigit=0; iDigit < cluster->GetNCells(); iDigit++)
w = GetCellWeight(eCell,cluster->E());
etai=(Double_t)ieta;
- phii=(Double_t)iphi;
+ phii=(Double_t)iphi;
+
if(w > 0.0)
{
wtot += w ;
- nstat++;
+ nstat++;
//Shower shape
- dxx += w * etai * etai ;
- xmean+= w * etai ;
- dzz += w * phii * phii ;
- zmean+= w * phii ;
- dxz += w * etai * phii ;
+ sEta += w * etai * etai ;
+ etaMean += w * etai ;
+ sPhi += w * phii * phii ;
+ phiMean += w * phii ;
+ sEtaPhi += w * etai * phii ;
}
}
else
AliError(Form("Wrong energy %f and/or amplitude %f\n", eCell, cluster->E()));
}//cell loop
- //Normalize to the weight
+ //Normalize to the weight
if (wtot > 0)
{
- xmean /= wtot ;
- zmean /= wtot ;
+ etaMean /= wtot ;
+ phiMean /= wtot ;
}
else
AliError(Form("Wrong weight %f\n", wtot));
- //Calculate dispersion
+ //Calculate dispersion
for(Int_t iDigit=0; iDigit < cluster->GetNCells(); iDigit++)
{
//Get from the absid the supermodule, tower and eta/phi numbers
w = GetCellWeight(eCell,cluster->E());
etai=(Double_t)ieta;
- phii=(Double_t)iphi;
- if(w > 0.0) d += w*((etai-xmean)*(etai-xmean)+(phii-zmean)*(phii-zmean));
+ phii=(Double_t)iphi;
+ if(w > 0.0)
+ {
+ disp += w *((etai-etaMean)*(etai-etaMean)+(phii-phiMean)*(phii-phiMean));
+ dEta += w * (etai-etaMean)*(etai-etaMean) ;
+ dPhi += w * (phii-phiMean)*(phii-phiMean) ;
+ }
}
else
AliError(Form("Wrong energy %f and/or amplitude %f\n", eCell, cluster->E()));
//Normalize to the weigth and set shower shape parameters
if (wtot > 0 && nstat > 1)
{
- d /= wtot ;
- dxx /= wtot ;
- dzz /= wtot ;
- dxz /= wtot ;
- dxx -= xmean * xmean ;
- dzz -= zmean * zmean ;
- dxz -= xmean * zmean ;
- cluster->SetM02(0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ));
- cluster->SetM20(0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ));
+ disp /= wtot ;
+ dEta /= wtot ;
+ dPhi /= wtot ;
+ sEta /= wtot ;
+ sPhi /= wtot ;
+ sEtaPhi /= wtot ;
+
+ sEta -= etaMean * etaMean ;
+ sPhi -= phiMean * phiMean ;
+ sEtaPhi -= etaMean * phiMean ;
+
+ l0 = (0.5 * (sEta + sPhi) + TMath::Sqrt( 0.25 * (sEta - sPhi) * (sEta - sPhi) + sEtaPhi * sEtaPhi ));
+ l1 = (0.5 * (sEta + sPhi) - TMath::Sqrt( 0.25 * (sEta - sPhi) * (sEta - sPhi) + sEtaPhi * sEtaPhi ));
}
else
{
- d=0. ;
- cluster->SetM20(0.) ;
- cluster->SetM02(0.) ;
- }
+ l0 = 0. ;
+ l1 = 0. ;
+ dEta = 0. ; dPhi = 0. ; disp = 0. ;
+ sEta = 0. ; sPhi = 0. ; sEtaPhi = 0. ;
+ }
- if (d>=0)
- cluster->SetDispersion(TMath::Sqrt(d)) ;
- else
- cluster->SetDispersion(0) ;
}
+//____________________________________________________________________________________________
+void AliEMCALRecoUtils::RecalculateClusterShowerShapeParameters(const AliEMCALGeometry * geom,
+ AliVCaloCells* cells,
+ AliVCluster * cluster)
+{
+ // Calculates new center of gravity in the local EMCAL-module coordinates
+ // and tranfers into global ALICE coordinates
+ // Calculates Dispersion and main axis and puts them into the cluster
+
+ Float_t l0 = 0., l1 = 0.;
+ Float_t disp = 0., dEta = 0., dPhi = 0.;
+ Float_t sEta = 0., sPhi = 0., sEtaPhi = 0.;
+
+ AliEMCALRecoUtils::RecalculateClusterShowerShapeParameters(geom,cells,cluster,l0,l1,disp,
+ dEta, dPhi, sEta, sPhi, sEtaPhi);
+
+ cluster->SetM02(l0);
+ cluster->SetM20(l1);
+ if(disp > 0. ) cluster->SetDispersion(TMath::Sqrt(disp)) ;
+
+}
+
//____________________________________________________________________________
void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
TObjArray * clusterArr,
{
clusterArray = new TObjArray(event->GetNumberOfCaloClusters());
for(Int_t icl=0; icl<event->GetNumberOfCaloClusters(); icl++)
- {
- AliVCluster *cluster = (AliVCluster*) event->GetCaloCluster(icl);
- if(geom && !IsGoodCluster(cluster,geom,(AliVCaloCells*)event->GetEMCALCells())) continue;
- clusterArray->AddAt(cluster,icl);
- }
+ {
+ AliVCluster *cluster = (AliVCluster*) event->GetCaloCluster(icl);
+ if(geom && !IsGoodCluster(cluster,geom,(AliVCaloCells*)event->GetEMCALCells())) continue;
+ clusterArray->AddAt(cluster,icl);
+ }
}
Int_t matched=0;
{
printf("Wrong input data type! Should be \"AOD\" or \"ESD\"\n");
if(clusterArray)
- {
- clusterArray->Clear();
- delete clusterArray;
- }
+ {
+ clusterArray->Clear();
+ delete clusterArray;
+ }
return;
}
Float_t eta, phi;
if(!ExtrapolateTrackToEMCalSurface(&emcalParam, 430., fMass, fStepSurface, eta, phi))
{
- if(aodevent && trackParam) delete trackParam;
- continue;
+ if(aodevent && trackParam) delete trackParam;
+ continue;
}
// if(esdevent)
// {
-// esdTrack->SetOuterParam(&emcalParam,AliExternalTrackParam::kMultSec);
+// esdTrack->SetOuterParam(&emcalParam,AliExternalTrackParam::kMultSec);
// }
if(TMath::Abs(eta)>0.75 || (phi) < 70*TMath::DegToRad() || (phi) > 190*TMath::DegToRad())
{
- if(aodevent && trackParam) delete trackParam;
- continue;
+ if(aodevent && trackParam) delete trackParam;
+ continue;
}
Float_t dEta = -999, dPhi = -999;
if(!clusterArr)
{
- index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArray, dEta, dPhi);
+ index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArray, dEta, dPhi);
}
else
{
- index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArr, dEta, dPhi);
+ index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArr, dEta, dPhi);
}
if(index>-1)
{
Float_t tmpR=TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi);
if(tmpR<dRMax)
- {
- dRMax=tmpR;
- dEtaMax=tmpEta;
- dPhiMax=tmpPhi;
- index=icl;
- }
+ {
+ dRMax=tmpR;
+ dEtaMax=tmpEta;
+ dPhiMax=tmpPhi;
+ index=icl;
+ }
}
else if(fCutEtaPhiSeparate)
{
if(TMath::Abs(tmpEta)<TMath::Abs(dEtaMax) && TMath::Abs(tmpPhi)<TMath::Abs(dPhiMax))
- {
- dEtaMax = tmpEta;
- dPhiMax = tmpPhi;
- index=icl;
- }
+ {
+ dEtaMax = tmpEta;
+ dPhiMax = tmpPhi;
+ index=icl;
+ }
}
else
{
{
//Require at least one SPD point + anything else in ITS
if( (esdTrack->HasPointOnITSLayer(0) || esdTrack->HasPointOnITSLayer(1)) == kFALSE)
- cuts[10] = kTRUE;
+ cuts[10] = kTRUE;
}
Bool_t cut=kFALSE;
//________________________________________________________________________
-void AliEMCALRecoUtils::SetClusterMatchedToTrack(const AliESDEvent *event)
+void AliEMCALRecoUtils::SetClusterMatchedToTrack(const AliVEvent *event)
{
// Checks if tracks are matched to EMC clusters and set the matched EMCAL cluster index to ESD track.
-
+
Int_t nTracks = event->GetNumberOfTracks();
for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack)
{
- AliESDtrack* track = event->GetTrack(iTrack);
+ AliVTrack* track = dynamic_cast<AliVTrack*>(event->GetTrack(iTrack));
if (!track)
{
AliWarning(Form("Could not receive track %d", iTrack));
continue;
}
- Int_t matchClusIndex = GetMatchedClusterIndex(iTrack);
+ Int_t matchClusIndex = GetMatchedClusterIndex(iTrack);
track->SetEMCALcluster(matchClusIndex); //sets -1 if track not matched within residual
- if(matchClusIndex != -1)
- track->SetStatus(AliESDtrack::kEMCALmatch);
- else
- track->ResetStatus(AliESDtrack::kEMCALmatch);
+ /*the following can be done better if AliVTrack::SetStatus will be there. Patch pending with Andreas/Peter*/
+ AliESDtrack* esdtrack = dynamic_cast<AliESDtrack*>(track);
+ if (esdtrack) {
+ if(matchClusIndex != -1)
+ esdtrack->SetStatus(AliESDtrack::kEMCALmatch);
+ else
+ esdtrack->ResetStatus(AliESDtrack::kEMCALmatch);
+ } else {
+ AliAODTrack* aodtrack = dynamic_cast<AliAODTrack*>(track);
+ if(matchClusIndex != -1)
+ aodtrack->SetStatus(AliESDtrack::kEMCALmatch);
+ else
+ aodtrack->ResetStatus(AliESDtrack::kEMCALmatch);
+ }
+
}
- AliDebug(2,"Track matched to closest cluster");
+ AliDebug(2,"Track matched to closest cluster");
}
//_________________________________________________________________________
-void AliEMCALRecoUtils::SetTracksMatchedToCluster(const AliESDEvent *event)
+void AliEMCALRecoUtils::SetTracksMatchedToCluster(const AliVEvent *event)
{
// Checks if EMC clusters are matched to ESD track.
// Adds track indexes of all the tracks matched to a cluster withing residuals in ESDCalocluster.
for (Int_t iClus=0; iClus < event->GetNumberOfCaloClusters(); ++iClus)
{
- AliESDCaloCluster *cluster = event->GetCaloCluster(iClus);
+ AliVCluster *cluster = event->GetCaloCluster(iClus);
if (!cluster->IsEMCAL())
continue;
// Get all other tracks matched to the cluster
for(Int_t iTrk=0; iTrk<nTracks; ++iTrk)
{
- AliESDtrack* track = event->GetTrack(iTrk);
+ AliVTrack* track = dynamic_cast<AliVTrack*>(event->GetTrack(iTrk));
if(iTrk == matchTrackIndex) continue;
if(track->GetEMCALcluster() == iClus)
{
//printf("Tender::SetTracksMatchedToCluster - cluster E %f, N matches %d, first match %d\n",cluster->E(),nMatched,arrayTrackMatched[0]);
arrayTrackMatched.Set(nMatched);
- cluster->AddTracksMatched(arrayTrackMatched);
+ AliESDCaloCluster *esdcluster = dynamic_cast<AliESDCaloCluster*>(cluster);
+ if (esdcluster)
+ esdcluster->AddTracksMatched(arrayTrackMatched);
+ else if (nMatched>0) {
+ AliAODCaloCluster *aodcluster = dynamic_cast<AliAODCaloCluster*>(cluster);
+ if (aodcluster)
+ aodcluster->AddTrackMatched(event->GetTrack(arrayTrackMatched.At(0)));
+ }
Float_t eta= -999, phi = -999;
if (matchTrackIndex != -1)
cluster->SetTrackDistance(phi, eta);
}
- AliDebug(2,"Cluster matched to tracks");
+ AliDebug(2,"Cluster matched to tracks");
}
-
//___________________________________________________
void AliEMCALRecoUtils::Print(const Option_t *) const
{
printf("DCSToVertex2D = %d, MaxDCAToVertexXY = %2.2f, MaxDCAToVertexZ = %2.2f\n",fCutDCAToVertex2D,fCutMaxDCAToVertexXY,fCutMaxDCAToVertexZ);
}
-//_________________________________________________________________
-void AliEMCALRecoUtils::SetRunDependentCorrections(Int_t runnumber)
-{
- //Get EMCAL time dependent corrections from file and put them in the recalibration histograms
- //Do it only once and only if it is requested
-
- if(!fUseRunCorrectionFactors) return;
- if(fRunCorrectionFactorsSet) return;
-
- AliInfo(Form("AliEMCALRecoUtils::GetRunDependentCorrections() - Get Correction Factors for Run number %d\n",runnumber));
-
- AliEMCALCalibTimeDepCorrection *corr = new AliEMCALCalibTimeDepCorrection();
- corr->ReadRootInfo(Form("CorrectionFiles/Run%d_Correction.root",runnumber));
-
- SwitchOnRecalibration();
-
- AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance();
-
- for(Int_t ism = 0; ism < geom->GetNumberOfSuperModules(); ism++)
- {
- for(Int_t icol = 0; icol < 48; icol++)
- {
- for(Int_t irow = 0; irow < 24; irow++)
- {
- Float_t orgRecalFactor = GetEMCALChannelRecalibrationFactors(ism)->GetBinContent(icol,irow);
- Float_t newRecalFactor = orgRecalFactor*corr->GetCorrection(ism, icol,irow,0);
- GetEMCALChannelRecalibrationFactors(ism)->SetBinContent(icol,irow,newRecalFactor);
- //printf("ism %d, icol %d, irow %d, corrections : org %f, time dep %f, final %f (org*time %f)\n",ism, icol, irow,
- // orgRecalFactor, corr->GetCorrection(ism, icol,irow,0),
- // (GetEMCALChannelRecalibrationFactors(ism))->GetBinContent(icol,irow),newRecalFactor);
- }
- }
- }
-
- fRunCorrectionFactorsSet = kTRUE;
-
-}