* provided "as is" without express or implied warranty. *
**************************************************************************/
-
///////////////////////////////////////////////////////////////////////////////
// //
// EMCAL tender, apply corrections to EMCAL clusters and do track matching. //
,fTask(0)
,fRun(0)
,fEMCALGeo(0x0)
-,fEMCALGeoName("EMCAL_COMPLETEV1")
+,fEMCALGeoName("")
,fEMCALRecoUtils(0)
,fConfigName("")
,fDebugLevel(0)
,fRecalShowerShape(kFALSE)
,fInputTree(0)
,fInputFile(0)
+,fGetPassFromFileName(kTRUE)
,fFilepass(0)
,fMass(-1)
,fStep(-1)
,fExoticCellFraction(-1)
,fExoticCellDiffTime(-1)
,fExoticCellMinAmplitude(-1)
+,fSetCellMCLabelFromCluster(kFALSE)
{
// Default constructor.
- for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = 0 ;
- fEMCALRecoUtils = new AliEMCALRecoUtils;
+
+ for(Int_t i = 0; i < 12; i++) fEMCALMatrix[i] = 0 ;
}
//_____________________________________________________
,fTask(0)
,fRun(0)
,fEMCALGeo(0x0)
-,fEMCALGeoName("EMCAL_COMPLETEV1")
+,fEMCALGeoName("")
,fEMCALRecoUtils(0)
,fConfigName("")
,fDebugLevel(0)
,fRecalShowerShape(kFALSE)
,fInputTree(0)
,fInputFile(0)
-,fFilepass(0)
+,fGetPassFromFileName(kTRUE)
+,fFilepass("")
,fMass(-1)
,fStep(-1)
,fCutEtaPhiSum(kTRUE)
,fExoticCellFraction(-1)
,fExoticCellDiffTime(-1)
,fExoticCellMinAmplitude(-1)
+,fSetCellMCLabelFromCluster(kFALSE)
{
// Named constructor
- for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = 0 ;
- fEMCALRecoUtils = new AliEMCALRecoUtils;
+ for(Int_t i = 0; i < 12; i++) fEMCALMatrix[i] = 0 ;
}
//_____________________________________________________
,fTask(task)
,fRun(0)
,fEMCALGeo(0x0)
-,fEMCALGeoName("EMCAL_COMPLETEV1")
+,fEMCALGeoName("")
,fEMCALRecoUtils(0)
,fConfigName("")
,fDebugLevel(0)
,fRecalShowerShape(kFALSE)
,fInputTree(0)
,fInputFile(0)
-,fFilepass(0)
+,fGetPassFromFileName(kTRUE)
+,fFilepass("")
,fMass(-1)
,fStep(-1)
,fCutEtaPhiSum(kTRUE)
,fExoticCellFraction(-1)
,fExoticCellDiffTime(-1)
,fExoticCellMinAmplitude(-1)
+,fSetCellMCLabelFromCluster(kFALSE)
{
- // Named constructor
+ // Named constructor.
- for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = 0 ;
- fEMCALRecoUtils = new AliEMCALRecoUtils;
+ for(Int_t i = 0; i < 12; i++) fEMCALMatrix[i] = 0 ;
}
//_____________________________________________________
{
//Destructor
- delete fEMCALRecoUtils;
- delete fRecParam;
- delete fUnfolder;
- if (!fClusterizer) {
- fDigitsArr->Clear("C");
- delete fDigitsArr;
- } else {
- delete fClusterizer;
- fDigitsArr = 0;
+ if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode())
+ {
+ delete fEMCALRecoUtils;
+ delete fRecParam;
+ delete fUnfolder;
+ if (!fClusterizer)
+ {
+ fDigitsArr->Clear("C");
+ delete fDigitsArr;
+ } else
+ {
+ delete fClusterizer;
+ fDigitsArr = 0;
+ }
}
}
+//_____________________________________________________
+void AliEMCALTenderSupply::SetDefaults()
+{
+ // Set default settings.
+
+ SwitchOnBadCellRemove();
+ SwitchOnExoticCellRemove();
+ SwitchOnCalibrateEnergy();
+ SwitchOnCalibrateTime();
+ SwitchOnUpdateCell();
+ SwitchOnReclustering();
+ SwitchOnClusterBadChannelCheck();
+ SwitchOnClusterExoticChannelCheck();
+ SwitchOnTrackMatch();
+}
+
//_____________________________________________________
Bool_t AliEMCALTenderSupply::RunChanged() const
{
- // Get run number
+ // Get run number.
+
return (fTender && fTender->RunChanged()) || (fTask && fRun != fTask->InputEvent()->GetRunNumber());
}
fExoticCellDiffTime = tender->fExoticCellDiffTime;
fExoticCellMinAmplitude = tender->fExoticCellMinAmplitude;
- for(Int_t i = 0; i < 10; i++)
+ for(Int_t i = 0; i < 12; i++)
fEMCALMatrix[i] = tender->fEMCALMatrix[i] ;
}
AliInfo( "=============================================================" );
}
- // Init geometry
- fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName) ;
+ // init reco utils
+
+ if(!fEMCALRecoUtils)
+ fEMCALRecoUtils = new AliEMCALRecoUtils;
+
+ // init geometry if requested
+ if (fEMCALGeoName.Length()>0)
+ fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName) ;
// digits array
fDigitsArr = new TClonesArray("AliEMCALDigit",1000);
- // Initialising non-linearity parameters
+ // initialising non-linearity parameters
if( fNonLinearThreshold != -1 )
fEMCALRecoUtils->SetNonLinearityThreshold(fNonLinearThreshold);
if( fNonLinearFunc != -1 )
if( fExoticCellMinAmplitude != -1 )
fEMCALRecoUtils->SetExoticCellMinAmplitudeCut( fExoticCellMinAmplitude );
- // Setting track matching parameters ... mass, step size and residual cut
+ // setting track matching parameters ... mass, step size and residual cut
if( fMass != -1 )
fEMCALRecoUtils->SetMass(fMass);
if( fStep != -1 )
//_____________________________________________________
AliVEvent* AliEMCALTenderSupply::GetEvent()
{
- // return the event pointer
+ // Return the event pointer.
if (fTender) {
return fTender->GetEvent();
}
return 0;
-
}
//_____________________________________________________
void AliEMCALTenderSupply::ProcessEvent()
{
// Event loop.
-
+
AliVEvent *event = GetEvent();
if (!event) {
return;
}
- // Initialising parameters once per run number
+ // Initialising parameters once per run number
if (RunChanged()) {
+ AliWarning( "Run changed, initializing parameters" );
fRun = event->GetRunNumber();
- AliWarning( "Run changed, initializing parameters" );
+ // init geometry if not already done
+ if (fEMCALGeoName.Length()==0) {
+ fEMCALGeoName = "EMCAL_FIRSTYEARV1";
+ if (fRun>139517) {
+ fEMCALGeoName = "EMCAL_COMPLETEV1";
+ }
+ if (fRun>170593) {
+ fEMCALGeoName = "EMCAL_COMPLETE12SMV1";
+ }
+ fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName);
+ if (!fEMCALGeo) {
+ AliFatal(Form("Can not create geometry: %s", fEMCALGeoName.Data()));
+ return;
+ }
+ }
// get pass
- GetPass();
+ if (fGetPassFromFileName)
+ GetPass();
// define what recalib parameters are needed for various switches
// this is based on implementation in AliEMCALRecoUtils
}
// 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()));
+
}
+
+
// init time calibration
if( needTimecalib ){
Int_t initTC = InitTimeCalibration();
if( fCalibrateEnergy || fCalibrateTime || fBadCellRemove )
fEMCALRecoUtils->ResetCellsCalibrated();
- // CELL RECALIBRATION -------------------------------------------------------
+ // CELL RECALIBRATION -------------------------------------------------------
// cell objects will be updated
// the cell calibrations are also processed locally any time those are needed
// in case that the cell objects are not to be updated here for later use
Clusterize();
UpdateClusters();
}
-
+
// Store good clusters
TClonesArray *clusArr = dynamic_cast<TClonesArray*>(event->FindListObject("caloClusters"));
if (!clusArr)
// CLUSTER ENERGY ---------------------------------------------
// does process local cell recalibration energy and time without replacing
// the global cell values, in case of no cell recalib done yet
- if( fReCalibCluster )
+ if( fReCalibCluster ) {
fEMCALRecoUtils->RecalibrateClusterEnergy(fEMCALGeo, clust, cells);
-
+ if (clust->E() < 1e-9) {
+ delete clusArr->RemoveAt(icluster);
+ continue;
+ }
+ }
+
// CLUSTER POSITION -------------------------------------------
// does process local cell energy recalibration, if enabled and cells
- // not calibratied yet
+ // not calibrated yet
if( fRecalClusPos )
fEMCALRecoUtils->RecalculateClusterPosition(fEMCALGeo, cells, clust);
Bool_t AliEMCALTenderSupply::InitMisalignMatrix()
{
// Initialising misalignment matrices
+
AliVEvent *event = GetEvent();
if (!event)
Int_t runGM = event->GetRunNumber();
TObjArray *mobj = 0;
- if(fMisalignSurvey == kdefault)
- { //take default alignment corresponding to run no
+ if(fMisalignSurvey == kdefault)
+ { //take default alignment corresponding to run no
AliOADBContainer emcalgeoCont(Form("emcal"));
emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
mobj=(TObjArray*)emcalgeoCont.GetObject(runGM,"EmcalMatrices");
- }
-
- if(fMisalignSurvey == kSurveybyS)
- { //take alignment at sector level
- if (runGM <= 140000) { //2010 data
- AliOADBContainer emcalgeoCont(Form("emcal2010"));
- emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
- mobj=(TObjArray*)emcalgeoCont.GetObject(100,"survey10");
-
- } else if (runGM>140000)
- { // 2011 LHC11a pass1 data
- AliOADBContainer emcalgeoCont(Form("emcal2011"));
- emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
- mobj=(TObjArray*)emcalgeoCont.GetObject(100,"survey11byS");
}
- }
+
+ if(fMisalignSurvey == kSurveybyS)
+ { //take alignment at sector level
+ if (runGM <= 140000) { //2010 data
+ AliOADBContainer emcalgeoCont(Form("emcal2010"));
+ emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
+ mobj=(TObjArray*)emcalgeoCont.GetObject(100,"survey10");
+ }
+ else if (runGM>140000)
+ { // 2011 LHC11a pass1 data
+ AliOADBContainer emcalgeoCont(Form("emcal2011"));
+ emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
+ mobj=(TObjArray*)emcalgeoCont.GetObject(100,"survey11byS");
+ }
+ }
- if(fMisalignSurvey == kSurveybyM)
- { //take alignment at module level
- if (runGM <= 140000) { //2010 data
- AliOADBContainer emcalgeoCont(Form("emcal2010"));
- emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
- mobj=(TObjArray*)emcalgeoCont.GetObject(100,"survey10");
-
- } else if (runGM>140000)
- { // 2011 LHC11a pass1 data
- AliOADBContainer emcalgeoCont(Form("emcal2011"));
- emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
- mobj=(TObjArray*)emcalgeoCont.GetObject(100,"survey11byM");
+ if(fMisalignSurvey == kSurveybyM)
+ { //take alignment at module level
+ if (runGM <= 140000) { //2010 data
+ AliOADBContainer emcalgeoCont(Form("emcal2010"));
+ emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
+ mobj=(TObjArray*)emcalgeoCont.GetObject(100,"survey10");
+ }
+ else if (runGM>140000)
+ { // 2011 LHC11a pass1 data
+ AliOADBContainer emcalgeoCont(Form("emcal2011"));
+ emcalgeoCont.InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root",Form("AliEMCALgeo"));
+ mobj=(TObjArray*)emcalgeoCont.GetObject(100,"survey11byM");
+ }
}
- }
if(!mobj)
{
return kFALSE;
}
- for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++)
- {
- fEMCALMatrix[mod] = (TGeoHMatrix*) mobj->At(mod);
- fEMCALGeo->SetMisalMatrix(fEMCALMatrix[mod],mod);
- fEMCALMatrix[mod]->Print();
- }
+ for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++)
+ {
+ fEMCALMatrix[mod] = (TGeoHMatrix*) mobj->At(mod);
+ fEMCALGeo->SetMisalMatrix(fEMCALMatrix[mod],mod);
+ fEMCALMatrix[mod]->Print();
+ }
return kTRUE;
}
contRF->InitFromFile(Form("%s/EMCALRecalib.root",fBasePath.Data()),"AliEMCALRecalib");
}
- else
- { // Else choose the one in the $ALICE_ROOT directory
- if (fDebugLevel>0) AliInfo("Loading Recalib OADB from $ALICE_ROOT/OADB/EMCAL");
-
- TFile *fRecalib= new TFile("$ALICE_ROOT/OADB/EMCAL/EMCALRecalib.root","read");
- if (!fRecalib || fRecalib->IsZombie())
- {
- AliFatal("$ALICE_ROOT/OADB/EMCAL/EMCALRecalib.root was not found");
- return 0;
- }
-
- if (fRecalib) delete fRecalib;
-
- contRF->InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALRecalib.root","AliEMCALRecalib");
+ else
+ { // Else choose the one in the $ALICE_ROOT directory
+ if (fDebugLevel>0) AliInfo("Loading Recalib OADB from $ALICE_ROOT/OADB/EMCAL");
+
+ TFile *fRecalib= new TFile("$ALICE_ROOT/OADB/EMCAL/EMCALRecalib.root","read");
+ if (!fRecalib || fRecalib->IsZombie())
+ {
+ AliFatal("$ALICE_ROOT/OADB/EMCAL/EMCALRecalib.root was not found");
+ return 0;
}
+
+ if (fRecalib) delete fRecalib;
+
+ contRF->InitFromFile("$ALICE_ROOT/OADB/EMCAL/EMCALRecalib.root","AliEMCALRecalib");
+ }
TObjArray *recal=(TObjArray*)contRF->GetObject(runRC);
if (!recal)
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)
+ {
+ AliWarning(Form("No TemperatureCorrCalib Objects for run: %d",runRC));
+ // let's get the closest runnumber instead then..
+ Int_t lower = 0;
+ Int_t ic = 0;
+ Int_t maxEntry = contRF->GetNumberOfEntries();
+
+ while ( (ic < maxEntry) && (contRF->UpperLimit(ic) < runRC) ) {
+ lower = ic;
+ ic++;
+ }
+
+ Int_t closest = lower;
+ if ( (ic<maxEntry) &&
+ (contRF->LowerLimit(ic)-runRC) < (runRC - contRF->UpperLimit(lower)) ) {
+ closest = ic;
+ }
+
+ AliWarning(Form("TemperatureCorrCalib Objects found closest id %d from run: %d", closest, contRF->LowerLimit(closest)));
+ rundeprecal = (TH1S*) contRF->GetObjectByIndex(closest);
+ }
+
+ 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()
{
AliInfo("Initialising time calibration map");
// init default maps first
- if( !fEMCALRecoUtils->GetEMCALTimeRecalibrationFactorsArray() )
+ if ( !fEMCALRecoUtils->GetEMCALTimeRecalibrationFactorsArray() )
fEMCALRecoUtils->InitEMCALTimeRecalibrationFactors() ;
Int_t runBC = event->GetRunNumber();
// just like with bad cell rejection in reco utils (inside RecalibrateCells)
if( fRejectExoticCells )
{
- Int_t absId =-1;
+ Short_t absId =-1;
+ Double_t ecell = 0;
+ Double_t tcell = 0;
+ Double_t efrac = 0;
+ Short_t mclabel = -1;
Bool_t isExot = kFALSE;
// loop through cells
Int_t nEMcell = cells->GetNumberOfCells() ;
for (Int_t iCell = 0; iCell < nEMcell; iCell++)
{
- absId = cells->GetCellNumber(iCell);
+ cells->GetCell( iCell, absId, ecell, tcell, mclabel, efrac );
isExot = fEMCALRecoUtils->IsExoticCell( absId, cells, bunchCrossNo );
// zero if exotic
if( isExot )
- cells->SetCell( iCell, absId, 0.0, 0.0 );
+ cells->SetCell( iCell, absId, 0.0, -1.0, mclabel, efrac );
} // cell loop
} // reject exotic cells
//_____________________________________________________
TString AliEMCALTenderSupply::GetBeamType()
{
-
// Get beam type : pp-AA-pA
- // ESDs have it directly, AODs we hardcode it
+ // ESDs have it directly, AODs get it from hardcoded run number ranges
AliVEvent *event = GetEvent();
TString beamType;
- if (event->InheritsFrom("AliESDEvent")) {
- AliESDEvent *esd = dynamic_cast<AliESDEvent*>(event);
+ AliESDEvent *esd = dynamic_cast<AliESDEvent*>(event);
+ if (esd) {
const AliESDRun *run = esd->GetESDRun();
beamType = run->GetBeamType();
}
- else if (event->InheritsFrom("AliAODEvent")) {
+ else
+ {
Int_t runNumber = event->GetRunNumber();
if ((runNumber >= 136851 && runNumber <= 139517) // LHC10h
- || (runNumber >= 166529 && runNumber <= 170593)) // LHC11h
- {
- beamType = "A-A";
- }
+ || (runNumber >= 166529 && runNumber <= 170593)) // LHC11h
+ {
+ beamType = "A-A";
+ }
else
- {
- beamType = "p-p";
- }
+ {
+ beamType = "p-p";
+ }
}
return beamType;
//_____________________________________________________
Int_t AliEMCALTenderSupply::InitRecParam()
{
- // exit if reco params exist (probably shipped by the user already)
+ // Init reco params if not yet exist (probably shipped by the user already)
+
if( fRecParam != 0 )
return 2;
AliVEvent *event = GetEvent();
- if (!event)
+ if (!event)
return;
+
+ // In case of MC productions done before aliroot tag v5-02-Rev09
+ // assing the cluster label to all the cells belonging to this cluster
+ // very rough
+ Int_t cellLabels[12672];
+ if(fSetCellMCLabelFromCluster)
+ {
+ for (Int_t i = 0; i < 12672; i++) cellLabels[i] = 0;
+
+ Int_t nClusters = event->GetNumberOfCaloClusters();
+ for (Int_t i = 0; i < nClusters; i++)
+ {
+ AliVCluster *clus = event->GetCaloCluster(i);
+
+ if(!clus) continue;
+
+ if(!clus->IsEMCAL()) continue ;
+
+ Int_t label = clus->GetLabel();
+ UShort_t * index = clus->GetCellsAbsId() ;
+
+ for(Int_t icell=0; icell < clus->GetNCells(); icell++ )
+ cellLabels[index[icell]] = label;
+
+ }// cluster loop
+ }
fDigitsArr->Clear("C");
AliVCaloCells *cells = event->GetEMCALCells();
if (cells->GetCell(icell, cellNumber, cellAmplitude, cellTime, mcLabel, efrac) != kTRUE)
break;
- // Do not add if already too low (some cells set to 0 if bad channels)
- if (cellAmplitude < fRecParam->GetMinECut() )
+ // Do not add if energy already too low (some cells set to 0 if bad channels)
+ if (cellAmplitude < fRecParam->GetMinECut())
continue;
// If requested, do not include exotic cells
if (fEMCALRecoUtils->IsExoticCell(cellNumber,cells,event->GetBunchCrossNumber()))
continue;
-
- AliEMCALDigit *digit = static_cast<AliEMCALDigit*>(fDigitsArr->New(idigit));
- digit->SetId(cellNumber);
- digit->SetTime(cellTime);
- digit->SetTimeR(cellTime);
- digit->SetIndexInList(idigit);
- digit->SetType(AliEMCALDigit::kHG);
- digit->SetAmplitude(cellAmplitude);
+
+ if(fSetCellMCLabelFromCluster) mcLabel = cellLabels[cellNumber];
+
+ new((*fDigitsArr)[idigit]) AliEMCALDigit(mcLabel, mcLabel, cellNumber,
+ (Float_t)cellAmplitude, (Float_t)cellTime,
+ AliEMCALDigit::kHG,idigit, 0, 0, 1);
idigit++;
}
}
Int_t nents = clus->GetEntriesFast();
for (Int_t i=0; i < nents; ++i)
{
- AliESDCaloCluster *c = static_cast<AliESDCaloCluster*>(clus->At(i));
+ AliVCluster *c = dynamic_cast<AliVCluster*>(clus->At(i));
if (!c)
continue;
if (c->IsEMCAL())
clus->Compress();
RecPoints2Clusters(clus);
-
}
//_____________________________________________________
void AliEMCALTenderSupply::RecPoints2Clusters(TClonesArray *clus)
{
- // Convert AliEMCALRecoPoints to AliESDCaloClusters.
+ // Convert AliEMCALRecoPoints to AliESDCaloClusters/AliAODCaloClusters.
// Cluster energy, global position, cells and their amplitude fractions are restored.
AliVEvent *event = GetEvent();
Float_t g[3];
gpos.GetXYZ(g);
- AliESDCaloCluster *c = static_cast<AliESDCaloCluster*>(clus->New(nout++));
+ AliVCluster *c = static_cast<AliVCluster*>(clus->New(nout++));
c->SetID(nout-1);
c->SetType(AliVCluster::kEMCALClusterv1);
c->SetE(recpoint->GetEnergy());
recpoint->GetElipsAxis(elipAxis);
c->SetM02(elipAxis[0]*elipAxis[0]) ;
c->SetM20(elipAxis[1]*elipAxis[1]) ;
- AliESDCaloCluster *cesd = static_cast<AliESDCaloCluster*>(c);
- cesd->SetCellsAbsId(absIds);
- cesd->SetCellsAmplitudeFraction(ratios);
+ c->SetCellsAbsId(absIds);
+ c->SetCellsAmplitudeFraction(ratios);
+
+ //MC
+ AliESDCaloCluster *esdClus = dynamic_cast<AliESDCaloCluster*>(c);
+ if (esdClus) {
+ Int_t parentMult = 0;
+ Int_t *parentList = recpoint->GetParents(parentMult);
+ if (parentMult > 0) {
+ TArrayI parents(parentMult, parentList);
+ esdClus->AddLabels(parents);
+ }
+ }
+ else {
+ AliAODCaloCluster *aodClus = dynamic_cast<AliAODCaloCluster*>(c);
+ if (aodClus) {
+ Int_t parentMult = 0;
+ Int_t *parentList = recpoint->GetParents(parentMult);
+ aodClus->SetLabel(parentList, parentMult);
+ }
+ }
}
}
//_____________________________________________________
void AliEMCALTenderSupply::GetPass()
{
- // Get passx from filename.
+ // Get passx from filename
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
fInputTree = mgr->GetTree();
if (fname.Contains("pass1")) fFilepass = TString("pass1");
else if (fname.Contains("pass2")) fFilepass = TString("pass2");
else if (fname.Contains("pass3")) fFilepass = TString("pass3");
+ else if (fname.Contains("pass4")) fFilepass = TString("pass4");
else
{
AliError(Form("Pass number string not found: %s", fname.Data()));