}
// init recalibration factors
- if( needRecalib ) {
+ if( needRecalib )
+ {
Int_t fInitRecalib = InitRecalib();
if (fInitRecalib==0)
AliError("InitRecalib returned false, returning");
AliWarning("InitRecalib OK");
if (fInitRecalib>1)
AliWarning(Form("No recalibration available: %d - %s", event->GetRunNumber(), fFilepass.Data()));
- fReCalibCluster = kFALSE;
+
+ Int_t fInitRunDepRecalib = InitRunDepRecalib();
+ if (fInitRunDepRecalib==0)
+ AliError("InitrunDepRecalib returned false, returning");
+ if (fInitRunDepRecalib==1)
+ AliWarning("InitRecalib OK");
+ if (fInitRunDepRecalib>1)
+ AliWarning(Form("No Temperature recalibration available: %d - %s", event->GetRunNumber(), fFilepass.Data()));
+
+ fReCalibCluster = kFALSE;
+
}
+
+
// init time calibration
if( needTimecalib ){
Int_t initTC = InitTimeCalibration();
return 1;
}
+//_____________________________________________________
+Int_t AliEMCALTenderSupply::InitRunDepRecalib()
+{
+ // Initialising recalibration factors.
+
+ AliVEvent *event = GetEvent();
+
+ if (!event)
+ return 0;
+
+ if (fDebugLevel>0)
+ AliInfo("Initialising recalibration factors");
+
+ // init default maps first
+ if( !fEMCALRecoUtils->GetEMCALRecalibrationFactorsArray() )
+ fEMCALRecoUtils->InitEMCALRecalibrationFactors() ;
+
+ Int_t runRC = event->GetRunNumber();
+
+ AliOADBContainer *contRF=new AliOADBContainer("");
+ if (fBasePath!="")
+ { //if fBasePath specified in the ->SetBasePath()
+ if (fDebugLevel>0) AliInfo(Form("Loading Recalib OADB from given path %s",fBasePath.Data()));
+
+ TFile *fRunDepRecalib= new TFile(Form("%s/EMCALTemperatureCorrCalib.root",fBasePath.Data()),"read");
+ if (!fRunDepRecalib || fRunDepRecalib->IsZombie())
+ {
+ AliFatal(Form("EMCALTemperatureCorrCalib.root not found in %s",fBasePath.Data()));
+ return 0;
+ }
+
+ if (fRunDepRecalib) delete fRunDepRecalib;
+
+ contRF->InitFromFile(Form("%s/EMCALTemperatureCorrCalib.root",fBasePath.Data()),"AliEMCALRunDepTempCalibCorrections");
+ }
+ else
+ { // Else choose the one in the $ALICE_ROOT directory
+ if (fDebugLevel>0) AliInfo("Loading Recalib OADB from $ALICE_ROOT/OADB/EMCAL");
+
+ TFile *fRunDepRecalib= new TFile("$ALICE_ROOT/OADB/EMCAL/EMCALTemperatureCorrCalib.root","read");
+ if (!fRunDepRecalib || fRunDepRecalib->IsZombie())
+ {
+ AliFatal("$ALICE_ROOT/OADB/EMCAL/EMCALTemperatureCorrCalib.root was not found");
+ return 0;
+ }
+
+ if (fRunDepRecalib) delete fRunDepRecalib;
+
+ contRF->InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALTemperatureCorrCalib.root","AliEMCALRunDepTempCalibCorrections");
+ }
+
+ TH1S *rundeprecal=(TH1S*)contRF->GetObject(runRC);
+ if (!rundeprecal)
+ {
+ AliError(Form("No Objects for run: %d",runRC));
+ return 2;
+ }
+
+ if (fDebugLevel>0) rundeprecal->Print();
+
+ Int_t nSM = fEMCALGeo->GetEMCGeometry()->GetNumberOfSuperModules();
+
+ for (Int_t ism=0; ism<nSM; ++ism)
+ {
+ for (Int_t icol=0; icol<48; ++icol)
+ {
+ for (Int_t irow=0; irow<24; ++irow)
+ {
+ Float_t factor = fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(ism,icol,irow);
+
+ Int_t absID = fEMCALGeo->GetAbsCellIdFromCellIndexes(ism, irow, icol); // original calibration factor
+ factor *= rundeprecal->GetBinContent(absID) / 10000. ; // correction dependent on T
+ //printf("\t ism %d, icol %d, irow %d,absID %d, corrA %2.3f, corrB %2.3f, corrAB %2.3f\n",ism, icol, irow, absID,
+ // GetEMCALChannelRecalibrationFactor(ism,icol,irow) , rundeprecal->GetBinContent(absID) / 10000., factor);
+ fEMCALRecoUtils->SetEMCALChannelRecalibrationFactor(ism,icol,irow,factor);
+ } // columns
+ } // rows
+ } // SM loop
+
+ return 1;
+}
+
+
//_____________________________________________________
Int_t AliEMCALTenderSupply::InitTimeCalibration()
{
Int_t InitRecParam();
Bool_t InitMisalignMatrix();
Int_t InitRecalib();
+ Int_t InitRunDepRecalib();
Int_t InitTimeCalibration();
void Clusterize();
void FillDigitsArray();
#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;
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;
-
-}
((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c) ; }
//Recalibrate channels energy with run dependent corrections
+ Bool_t IsRunDepRecalibrationOn() const { return fUseRunCorrectionFactors ; }
+
void SwitchOffRunDepCorrection() { fUseRunCorrectionFactors = kFALSE ; }
void SwitchOnRunDepCorrection() { fUseRunCorrectionFactors = kTRUE ;
- SwitchOnRecalibration() ; }
- void SetRunDependentCorrections(Int_t runnumber);
-
+ SwitchOnRecalibration() ; }
// Time Recalibration
void RecalibrateCellTime(const Int_t absId, const Int_t bc, Double_t & time) const;
// Recalibrate with run dependent corrections, energy
Bool_t fUseRunCorrectionFactors; // Use Run Dependent Correction
- Bool_t fRunCorrectionFactorsSet; // Run Correction set at leat once
// Bad Channels
Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels
fRemoveBadChannels(kFALSE), fPHOSBadChannelMap(0x0),
fNCellsFromPHOSBorder(0),
fNMaskCellColumns(0), fMaskCellColumns(0x0),
- fRecalibration(kFALSE), fPHOSRecalibrationFactors(),
+ fRecalibration(kFALSE), fRunDependentCorrection(kFALSE), fPHOSRecalibrationFactors(),
fEMCALRecoUtils(new AliEMCALRecoUtils),
fRecalculatePosition(kFALSE), fCorrectELinearity(kFALSE),
fRecalculateMatching(kFALSE),
}else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for run\n"); // run number array ok
// once set, apply run dependent corrections if requested
- fEMCALRecoUtils->SetRunDependentCorrections(runnumber);
-
+ //fEMCALRecoUtils->SetRunDependentCorrections(runnumber);
+
} // Recalibration on
+ // Energy Recalibration, apply on top of previous calibration factors
+ if(fRunDependentCorrection)
+ {
+ AliOADBContainer *contRFTD=new AliOADBContainer("");
+
+ contRFTD->InitFromFile(Form("%s/EMCALTemperatureCorrCalib.root",fOADBFilePathEMCAL.Data()),"AliEMCALRunDepTempCalibCorrections");
+
+ TH1S *htd=(TH1S*)contRFTD->GetObject(runnumber);
+
+ if(htd)
+ {
+ printf("AliCalorimeterUtils::SetOADBParameters() - Recalibrate (Temperature) EMCAL \n");
+
+ for (Int_t ism=0; ism<nSM; ++ism)
+ {
+ for (Int_t icol=0; icol<48; ++icol)
+ {
+ for (Int_t irow=0; irow<24; ++irow)
+ {
+ Float_t factor = GetEMCALChannelRecalibrationFactor(ism,icol,irow);
+
+ Int_t absID = fEMCALGeo->GetAbsCellIdFromCellIndexes(ism, irow, icol); // original calibration factor
+ factor *= htd->GetBinContent(absID) / 10000. ; // correction dependent on T
+ //printf("\t ism %d, icol %d, irow %d,absID %d, corrA %2.3f, corrB %2.3f, corrAB %2.3f\n",ism, icol, irow, absID,
+ // GetEMCALChannelRecalibrationFactor(ism,icol,irow) , htd->GetBinContent(absID) / 10000., factor);
+ SetEMCALChannelRecalibrationFactor(ism,icol,irow,factor);
+ } // columns
+ } // rows
+ } // SM loop
+ }else printf("AliCalorimeterUtils::SetOADBParameters() - Do NOT recalibrate EMCAL with T variations, no params TH1 \n");
+ } // Run by Run T calibration
// Time Recalibration
if(fEMCALRecoUtils->IsTimeRecalibrationOn())
printf("Remove Clusters with max cell at less than %d cells from EMCAL border and %d cells from PHOS border\n",
fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder(), fNCellsFromPHOSBorder);
if(fEMCALRecoUtils->IsEMCALNoBorderAtEta0()) printf("Do not remove EMCAL clusters at Eta = 0\n");
- printf("Recalibrate Clusters? %d\n",fRecalibration);
+ printf("Recalibrate Clusters? %d, run by run %d\n",fRecalibration,fRunDependentCorrection);
printf("Recalculate Clusters Position? %d\n",fRecalculatePosition);
printf("Recalculate Clusters Energy? %d\n",fCorrectELinearity);
printf("Matching criteria: dR < %2.2f[cm], dZ < %2.2f[cm]\n",fCutR,fCutZ);
// Run dependent energy calibrations (EMCAL)
- void SwitchOffRunDepCorrection() { fEMCALRecoUtils->SwitchOffRunDepCorrection() ; }
- void SwitchOnRunDepCorrection() { fEMCALRecoUtils->SwitchOnRunDepCorrection() ; }
+ void SwitchOffRunDepCorrection() { fRunDependentCorrection = kFALSE ; }
+ void SwitchOnRunDepCorrection() { fRunDependentCorrection = kTRUE ; }
// Time Recalibration (EMCAL)
Int_t fNMaskCellColumns; // Number of masked columns
Int_t* fMaskCellColumns; //[fNMaskCellColumns] list of masked cell collumn
Bool_t fRecalibration; // Switch on or off the recalibration
+ Bool_t fRunDependentCorrection;// Switch on or off the recalibration dependent on T
TObjArray * fPHOSRecalibrationFactors; // Array of histograms with map of recalibration factors, PHOS
AliEMCALRecoUtils* fEMCALRecoUtils; // EMCAL utils for cluster rereconstruction
Bool_t fRecalculatePosition; // Recalculate cluster position
AliCalorimeterUtils( const AliCalorimeterUtils & cu) ; // cpy ctor
AliCalorimeterUtils & operator = (const AliCalorimeterUtils & cu) ; // cpy assignment
- ClassDef(AliCalorimeterUtils,13)
+ ClassDef(AliCalorimeterUtils,14)
} ;
fGeoMatrixSet=kTRUE;
}//ESD
}//Load matrices from Data
-
- //Recover time dependent corrections, put then in recalibration histograms. Do it once
- fEMCALRecoUtils->SetRunDependentCorrections(InputEvent()->GetRunNumber());
}//first event
-
//Cluster Loop
for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
}else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params object array \n"); // array ok
}else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for pass\n"); // array pass ok
}else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL, no params for run\n"); // run number array ok
-
- // once set, apply run dependent corrections if requested
- fRecoUtils->SetRunDependentCorrections(runnumber);
-
+
} // Recalibration on
+ // Energy Recalibration, apply on top of previous calibration factors
+ if(fRecoUtils->IsRunDepRecalibrationOn())
+ {
+ AliOADBContainer *contRFTD=new AliOADBContainer("");
+
+ contRFTD->InitFromFile(Form("%s/EMCALTemperatureCorrCalib.root",fOADBFilePath.Data()),"AliEMCALRunDepTempCalibCorrections");
+
+ TH1S *htd=(TH1S*)contRFTD->GetObject(runnumber);
+
+ if(htd)
+ {
+ printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Recalibrate (Temperature) EMCAL \n");
+
+ for (Int_t ism=0; ism<nSM; ++ism)
+ {
+ for (Int_t icol=0; icol<48; ++icol)
+ {
+ for (Int_t irow=0; irow<24; ++irow)
+ {
+ Float_t factor = fRecoUtils->GetEMCALChannelRecalibrationFactor(ism,icol,irow);
+
+ Int_t absID = fGeom->GetAbsCellIdFromCellIndexes(ism, irow, icol); // original calibration factor
+ factor *= htd->GetBinContent(absID) / 10000. ; // correction dependent on T
+ //printf("\t ism %d, icol %d, irow %d,absID %d, corrA %2.3f, corrB %2.3f, corrAB %2.3f\n",ism, icol, irow, absID,
+ // GetEMCALChannelRecalibrationFactor(ism,icol,irow) , htd->GetBinContent(absID) / 10000., factor);
+ fRecoUtils->SetEMCALChannelRecalibrationFactor(ism,icol,irow,factor);
+ } // columns
+ } // rows
+ } // SM loop
+ }else printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT recalibrate EMCAL with T variations, no params TH1 \n");
+ } // Run by Run T calibration
// Time Recalibration
if(fRecoUtils->IsTimeRecalibrationOn())
if(bRecalE && ! bMC)
{
reco->SwitchOnRecalibration();
+ reco->SwitchOnRunDepCorrection();
}
// Remove EMCAL hot channels