18 #include <TRefArray.h>
19 #include <TClonesArray.h>
21 #include <TGeoManager.h>
23 #include <TInterpreter.h>
27 #include "AliAnalysisTask.h"
28 #include "AliAnalysisManager.h"
29 #include "AliESDEvent.h"
30 #include "AliGeomManager.h"
31 #include "AliVCaloCells.h"
32 #include "AliAODCaloCluster.h"
33 #include "AliCDBManager.h"
34 #include "AliCDBStorage.h"
35 #include "AliCDBEntry.h"
37 #include "AliVEventHandler.h"
38 #include "AliAODInputHandler.h"
39 #include "AliOADBContainer.h"
40 #include "AliAODMCParticle.h"
41 #include "AliCentrality.h"
42 #include "AliMultSelection.h"
45 #include "AliEMCALAfterBurnerUF.h"
46 #include "AliEMCALGeometry.h"
47 #include "AliEMCALClusterizerNxN.h"
48 #include "AliEMCALClusterizerv1.h"
49 #include "AliEMCALClusterizerv2.h"
50 #include "AliEMCALRecPoint.h"
51 #include "AliEMCALDigit.h"
65 , fGeom(0), fGeomName(
"")
66 , fGeomMatrixSet(kFALSE), fLoadGeomMatrices(kFALSE)
67 , fOCDBpath(
""), fAccessOCDB(kFALSE)
68 , fDigitsArr(0), fClusterArr(0)
69 , fCaloClusterArr(0), fCaloCells(0)
70 , fRecParam(0), fClusterizer(0)
71 , fUnfolder(0), fJustUnfold(kFALSE)
72 , fOutputAODBranch(0), fOutputAODBranchName(
"")
73 , fOutputAODCells (0), fOutputAODCellsName (
""), fInputCaloCellsName (
"")
74 , fOutputAODBranchSet(0)
75 , fFillAODFile(kFALSE), fFillAODHeader(0)
76 , fFillAODCaloCells(0), fRun(-1)
77 , fRecoUtils(0), fConfigName(
"")
79 , fCellLabels(), fCellSecondLabels(), fCellTime()
80 , fCellMatchdEta(), fCellMatchdPhi()
81 , fRecalibrateWithClusterTime(0)
82 , fMaxEvent(0), fDoTrackMatching(kFALSE), fUpdateCell(0)
83 , fSelectCell(kFALSE), fSelectCellMinE(0), fSelectCellMinFrac(0)
84 , fRejectBelowThreshold(kFALSE)
85 , fRemoveLEDEvents(kTRUE),fRemoveExoticEvents(kFALSE)
86 , fImportGeometryFromFile(kTRUE), fImportGeometryFilePath(
"")
87 , fOADBSet(kFALSE), fAccessOADB(kTRUE), fOADBFilePath(
"")
88 , fConstantTimeShift(0)
89 , fCentralityClass(
""), fUseAliCentrality(0), fSelectEMCALEvent(0)
90 , fEMCALEnergyCut(0.), fEMCALNcellsCut (0)
91 , fSetCellMCLabelFromCluster(0)
92 , fSetCellMCLabelFromEdepFrac(0)
93 , fRemapMCLabelForAODs(0)
95 , fTCardCorrEmulation(0), fTCardCorrClusEnerConserv(0)
96 , fRandom(0), fRandomizeTCard(1)
97 , fTCardCorrMinAmp(0.01), fTCardCorrMaxInduced(100)
101 for(
Int_t i = 0; i < 22; i++)
108 for(
Int_t j = 0; j < 4 ; j++)
128 , fGeom(0), fGeomName(
"")
129 , fGeomMatrixSet(kFALSE), fLoadGeomMatrices(kFALSE)
130 , fOCDBpath(
""), fAccessOCDB(kFALSE)
131 , fDigitsArr(0), fClusterArr(0)
132 , fCaloClusterArr(0), fCaloCells(0)
133 , fRecParam(0), fClusterizer(0)
134 , fUnfolder(0), fJustUnfold(kFALSE)
135 , fOutputAODBranch(0), fOutputAODBranchName(
"")
136 , fOutputAODCells (0), fOutputAODCellsName (
""), fInputCaloCellsName (
"")
137 , fOutputAODBranchSet(0)
138 , fFillAODFile(kFALSE), fFillAODHeader(0)
139 , fFillAODCaloCells(0), fRun(-1)
140 , fRecoUtils(0), fConfigName(
"")
141 , fOrgClusterCellId()
142 , fCellLabels(), fCellSecondLabels(), fCellTime()
143 , fCellMatchdEta(), fCellMatchdPhi()
144 , fRecalibrateWithClusterTime(0)
145 , fMaxEvent(0), fDoTrackMatching(kFALSE), fUpdateCell(0)
146 , fSelectCell(kFALSE), fSelectCellMinE(0), fSelectCellMinFrac(0)
147 , fRejectBelowThreshold(kFALSE)
148 , fRemoveLEDEvents(kTRUE), fRemoveExoticEvents(kFALSE)
149 , fImportGeometryFromFile(kTRUE), fImportGeometryFilePath(
"")
150 , fOADBSet(kFALSE), fAccessOADB(kTRUE), fOADBFilePath(
"")
151 , fConstantTimeShift(0)
152 , fCentralityClass(
""), fUseAliCentrality(0), fSelectEMCALEvent(0)
153 , fEMCALEnergyCut(0.), fEMCALNcellsCut (0)
154 , fSetCellMCLabelFromCluster(0)
155 , fSetCellMCLabelFromEdepFrac(0)
156 , fRemapMCLabelForAODs(0)
157 , fInputFromFilter(0)
158 , fTCardCorrEmulation(0), fTCardCorrClusEnerConserv(0)
159 , fRandom(0), fRandomizeTCard(1)
160 , fTCardCorrMinAmp(0.01), fTCardCorrMaxInduced(100)
163 for(
Int_t i = 0; i < 22; i++)
170 for(
Int_t j = 0; j < 4 ; j++)
223 if ( absID < 0 || absID >= 24*48*
fGeom->GetNumberOfSuperModules() )
226 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
227 if (!
fGeom->GetCellIndex(absID,imod,iTower,iIphi,iIeta))
230 fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
233 if (
fRecoUtils->IsBadChannelsRemovalSwitchedOn() &&
234 fRecoUtils->GetEMCALChannelStatus(imod, ieta, iphi) )
251 Int_t nCluster =
fEvent -> GetNumberOfCaloClusters();
254 for(
Int_t icalo = 0; icalo < nCluster; icalo++)
256 AliVCluster *clus = (AliVCluster*) (
fEvent->GetCaloCluster(icalo));
262 AliDebug(1, Form(
"Accept : E %2.2f > %2.2f, nCells %d > %d",
270 AliDebug(1,
"Reject");
286 AliInfo(Form(
"Get AODB parameters from EMCAL in %s for run %d, and <%s>",
fOADBFilePath.Data(),
fRun,pass.Data()));
291 if(
fRecoUtils->IsBadChannelsRemovalSwitchedOn())
293 AliOADBContainer *contBC=
new AliOADBContainer(
"");
294 contBC->InitFromFile(Form(
"%s/EMCALBadChannels.root",
fOADBFilePath.Data()),
"AliEMCALBadChannels");
300 fRecoUtils->SwitchOnDistToBadChannelRecalculation();
301 AliInfo(
"Remove EMCAL bad cells");
303 for (
Int_t i=0; i < nSM; ++i)
305 TH2I *hbm =
fRecoUtils->GetEMCALChannelStatusMap(i);
310 hbm=(TH2I*)arrayBC->FindObject(Form(
"EMCALBadChannelMap_Mod%d",i));
314 AliError(Form(
"Can not get EMCALBadChannelMap_Mod%d",i));
318 hbm->SetDirectory(0);
322 }
else AliInfo(
"Do NOT remove EMCAL bad channels");
330 AliOADBContainer *contRF=
new AliOADBContainer(
"");
332 contRF->InitFromFile(Form(
"%s/EMCALRecalib.root",
fOADBFilePath.Data()),
"AliEMCALRecalib");
346 AliInfo(
"Recalibrate EMCAL");
347 for (
Int_t i=0; i<nSM; ++i)
354 h = (
TH2F*)recalib->FindObject(Form(
"EMCALRecalFactors_SM%d",i));
358 AliError(Form(
"Could not load EMCALRecalFactors_SM%d",i));
364 fRecoUtils->SetEMCALChannelRecalibrationFactors(i,h);
366 }
else AliInfo(
"Do NOT recalibrate EMCAL, no params object array");
367 }
else AliInfo(
"Do NOT recalibrate EMCAL, no params for pass");
368 }
else AliInfo(
"Do NOT recalibrate EMCAL, no params for run");
376 AliOADBContainer *contRFTD=
new AliOADBContainer(
"");
378 contRFTD->InitFromFile(Form(
"%s/EMCALTemperatureCorrCalib.root",
fOADBFilePath.Data()),
"AliEMCALRunDepTempCalibCorrections");
380 TH1S *htd=(TH1S*)contRFTD->GetObject(
fRun);
385 AliWarning(Form(
"No TemperatureCorrCalib Objects for run: %d",
fRun));
389 Int_t maxEntry = contRFTD->GetNumberOfEntries();
391 while ( (ic < maxEntry) && (contRFTD->UpperLimit(ic) <
fRun) ) {
396 Int_t closest = lower;
397 if ( (ic<maxEntry) &&
398 (contRFTD->LowerLimit(ic)-
fRun) < (
fRun - contRFTD->UpperLimit(lower)) ) {
402 AliWarning(Form(
"TemperatureCorrCalib Objects found closest id %d from run: %d", closest, contRFTD->LowerLimit(closest)));
403 htd = (TH1S*) contRFTD->GetObjectByIndex(closest);
408 AliInfo(
"Recalibrate (Temperature) EMCAL");
410 for (
Int_t ism=0; ism<nSM; ++ism)
412 for (
Int_t icol=0; icol<48; ++icol)
414 for (
Int_t irow=0; irow<24; ++irow)
418 Int_t absID =
fGeom->GetAbsCellIdFromCellIndexes(ism, irow, icol);
419 factor *= htd->GetBinContent(absID) / 10000. ;
422 fRecoUtils->SetEMCALChannelRecalibrationFactor(ism,icol,irow,factor);
426 }
else AliInfo(
"Do NOT recalibrate EMCAL with T variations, no params TH1");
434 AliOADBContainer *contTRF=
new AliOADBContainer(
"");
436 contTRF->InitFromFile(Form(
"%s/EMCALTimeCalib.root",
fOADBFilePath.Data()),
"AliEMCALTimeCalib");
444 if ( pass==
"spc_calo" ) passM =
"pass3";
445 if (
fRun > 209121 ) passM =
"pass1";
446 if ( pass ==
"muon_calo_pass1" &&
fRun > 209121 &&
fRun < 244284 )
453 AliInfo(
"Time Recalibrate EMCAL");
454 for (
Int_t ibc = 0; ibc < 4; ++ibc)
456 TH1F *h =
fRecoUtils->GetEMCALChannelTimeRecalibrationFactors(ibc);
461 h = (TH1F*)trecalpass->FindObject(Form(
"hAllTimeAvBC%d",ibc));
465 AliError(Form(
"Could not load hAllTimeAvBC%d",ibc));
471 fRecoUtils->SetEMCALChannelTimeRecalibrationFactors(ibc,h);
473 }
else AliInfo(
"Do NOT recalibrate time EMCAL, no params for pass");
474 }
else AliInfo(
"Do NOT recalibrate time EMCAL, no params for run");
480 if(
fRecoUtils->IsL1PhaseInTimeRecalibrationOn() )
483 if (!
fRecoUtils->GetEMCALL1PhaseInTimeRecalibrationArray())
484 fRecoUtils->InitEMCALL1PhaseInTimeRecalibration() ;
486 AliOADBContainer *contBC =
new AliOADBContainer(
"");
488 TFile *timeFile=
new TFile(Form(
"%s/EMCALTimeL1PhaseCalib.root",
fOADBFilePath.Data()),
"read");
489 if (!timeFile || timeFile->IsZombie())
491 AliFatal(Form(
"EMCALTimeL1PhaseCalib.root was not found in the path provided: %s",
fOADBFilePath.Data()));
495 if (timeFile)
delete timeFile;
497 contBC->InitFromFile(Form(
"%s/EMCALTimeL1PhaseCalib.root",
fOADBFilePath.Data()),
"AliEMCALTimeL1PhaseCalib");
502 AliError(Form(
"No external L1 phase in time calibration set for run number: %d",
fRun));
503 fRecoUtils->SwitchOffL1PhaseInTimeRecalibration();
510 if ( pass==
"muon_calo_pass1" &&
fRun > 209121 &&
fRun < 244284 )
516 AliError(Form(
"No external L1 phase in time calibration set for: %d -%s",
fRun,pass2.Data()));
517 fRecoUtils->SwitchOffL1PhaseInTimeRecalibration();
519 else AliInfo(
"Recalibrate L1 Phase time");
523 if ( DebugLevel()>0 ) arrayBCpass->Print();
525 TH1C *h =
fRecoUtils->GetEMCALL1PhaseInTimeRecalibrationForAllSM();
528 h = (TH1C*)arrayBCpass->FindObject(Form(
"h%d",
fRun));
532 AliFatal(Form(
"There is no calibration histogram h%d for this run",
fRun));
537 fRecoUtils->SetEMCALL1PhaseInTimeRecalibrationForAllSM(h);
559 AliCDBManager *cdb = AliCDBManager::Instance();
563 cdb->SetDefaultStorage(
fOCDBpath.Data());
564 AliInfo(Form(
"Default storage %s",
fOCDBpath.Data()));
573 cdb->SetSpecificStorage(
"EMCAL/Calib/Data",
"raw://");
574 cdb->SetSpecificStorage(
"EMCAL/Calib/Time",
"raw://");
575 cdb->SetSpecificStorage(
"EMCAL/Calib/Pedestals",
"raw://");
578 TString path = cdb->GetDefaultStorage()->GetBaseFolder();
615 new((*fDigitsArr)[idigit]) AliEMCALDigit( -2, -2, j,
fTCardCorrCellsEner[j], fixTime,AliEMCALDigit::kHG,idigit, 0, 0, 0);
634 AliAODInputHandler* aodIH =
dynamic_cast<AliAODInputHandler*
>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
635 Int_t eventN = Entry();
636 if(aodIH) eventN = aodIH->GetReadEntry();
645 if (aodIH && aodIH->GetMergeEvents())
649 if(!aodIH->GetMergeEMCALCells())
650 AliFatal(
"Events merged but not EMCAL cells, check analysis settings!");
652 AliDebug(1,
"Use embedded events");
654 AliDebug(1,Form(
"\t InputEvent N Clusters %d, N Cells %d",
655 InputEvent()->GetNumberOfCaloClusters(),InputEvent()->GetEMCALCells()->GetNumberOfCells()));
657 AliDebug(1,Form(
"\t MergedEvent N Clusters %d, N Cells %d",
658 aodIH->GetEventToMerge()->GetNumberOfCaloClusters(), aodIH->GetEventToMerge()->GetEMCALCells()->GetNumberOfCells()));
669 AliDebug(1,Form(
"\t OutputEvent N Clusters %d, N Cells %d",
670 AODEvent()->GetNumberOfCaloClusters(), AODEvent()->GetEMCALCells()->GetNumberOfCells()));
686 AliError(
"Event not available");
721 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
747 Int_t nClusters =
fEvent->GetNumberOfCaloClusters();
748 Int_t nClustersOrg = 0;
750 AliAODInputHandler* aodIH =
dynamic_cast<AliAODInputHandler*
>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
751 if(aodIH && aodIH->GetEventToMerge())
752 nClusters = aodIH->GetEventToMerge()->GetNumberOfCaloClusters();
760 for (
Int_t i = 0; i < nClusters; i++)
762 AliVCluster *clus = 0;
763 if(aodIH && aodIH->GetEventToMerge())
764 clus = aodIH->GetEventToMerge()->GetCaloCluster(i);
766 clus =
fEvent->GetCaloCluster(i);
772 if(!clus->IsEMCAL())
continue;
774 Int_t label = clus->GetLabel();
776 if (clus->GetNLabels() >=2 ) label2 = clus->GetLabelAt(1) ;
786 UShort_t * index = clus->GetCellsAbsId() ;
787 for(
Int_t icell=0; icell < clus->GetNCells(); icell++ )
790 fCellTime[index[icell]] = clus->GetTOF();
814 Int_t bc = InputEvent()->GetBunchCrossNumber();
824 if( amp < fRecParam->GetMinECut() ||
826 time <
fRecParam->GetTimeMin() ) accept = kFALSE;
843 AliDebug(2,Form(
"Remove channel absId %d, index %d of %d, amp %f, time %f",
844 id,icell,
fCaloCells->GetNumberOfCells(), amp, time*1.e9));
882 if (mcLabel > 0 && efrac < 1.e-6) efrac = 1;
897 AliVCluster *clus = 0;
902 AliInfo(
"Negative original cluster index, skip \n");
906 if(aodIH && aodIH->GetEventToMerge())
907 clus = aodIH->GetEventToMerge()->GetCaloCluster(iclus);
909 clus =
fEvent->GetCaloCluster(iclus);
911 fRecoUtils->RecalculateCellLabelsRemoveAddedGenerator(
id, clus, MCEvent(), amp, labeArr, eDepArr);
912 nLabels = labeArr.GetSize();
927 if(amp <= 0.01) continue ;
931 AliEMCALDigit* digit =
new((*fDigitsArr)[idigit]) AliEMCALDigit( mcLabel, mcLabel,
id, amp, time,AliEMCALDigit::kHG,idigit, 0, 0, eDep);
934 digit->SetListOfParents(nLabels,labeArr.GetArray(),eDepArr.GetArray());
960 AliWarning(Form(
"No array with CaloClusters, input RecPoints entries %d",
fClusterArr->GetEntriesFast()));
964 AliDebug(1,Form(
"N clusters: before recluster %d, after recluster %d, recpoints %d",
984 Int_t cellMCLabel = 0;
986 Int_t nClustersOrg = 0;
989 for (
Int_t i = 0; i <
fEvent->GetNumberOfCaloClusters(); i++)
991 AliVCluster *clus =
fEvent->GetCaloCluster(i);
995 if(
fRecoUtils->ClusterContainsBadChannel(
fGeom,clus->GetCellsAbsId(), clus->GetNCells()))
1006 for (
Int_t icell = 0; icell <
fCaloCells->GetNumberOfCells(); icell++)
1008 if (
fCaloCells->GetCell(icell, cellNumber, cellAmplitude, cellTime, cellMCLabel, cellEFrac) != kTRUE)
1011 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
1012 fGeom->GetCellIndex(cellNumber,imod,iTower,iIphi,iIeta);
1013 fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
1016 if(
fRecoUtils->IsBadChannelsRemovalSwitchedOn() &&
1017 fRecoUtils->GetEMCALChannelStatus(imod, ieta, iphi))
1020 fCaloCells->SetCell(icell, cellNumber, cellAmplitude*
fRecoUtils->GetEMCALChannelRecalibrationFactor(imod,ieta,iphi),cellTime);
1026 AliESDCaloCluster * esdCluster =
dynamic_cast<AliESDCaloCluster*
> (clus);
1027 AliAODCaloCluster * aodCluster =
dynamic_cast<AliAODCaloCluster*
> (clus);
1038 AliWarning(
"Wrong CaloCluster type?");
1069 if ( debug > 0 ) printf(
"ConfigureEMCALRecoUtils() - **** Start ***\n");
1072 if(!fRecoUtils) fRecoUtils =
new AliEMCALRecoUtils ;
1078 if ( debug > 0 ) printf(
"ConfigureEMCALRecoUtils() - Remove exotics in EMCAL\n");
1079 fRecoUtils->SwitchOnRejectExoticCell() ;
1080 fRecoUtils->SwitchOnRejectExoticCluster();
1083 fRecoUtils->SetExoticCellFractionCut(0.97);
1084 fRecoUtils->SetExoticCellMinAmplitudeCut(4.);
1089 if(bRecalE && ! bMC)
1091 if ( debug > 0 ) printf(
"ConfigureEMCALRecoUtils() - Switch on energy recalibration in EMCAL\n");
1092 fRecoUtils->SwitchOnRecalibration();
1093 fRecoUtils->SwitchOnRunDepCorrection();
1100 if ( debug > 0 ) printf(
"ConfigureEMCALRecoUtils() - Switch on bad channels removal in EMCAL\n");
1101 fRecoUtils->SwitchOnBadChannelsRemoval();
1102 fRecoUtils->SwitchOnDistToBadChannelRecalculation();
1107 if(bRecalT && ! bMC)
1109 if ( debug > 0 ) printf(
"ConfigureEMCALRecoUtils() - Switch on time recalibration in EMCAL\n");
1110 fRecoUtils->SwitchOnTimeRecalibration();
1111 fRecoUtils->SwitchOnL1PhaseInTimeRecalibration() ;
1116 fRecoUtils->SetPositionAlgorithm(AliEMCALRecoUtils::kPosTowerGlobal);
1124 if ( debug > 0 ) printf(
"ConfigureEMCALRecoUtils() xxx SET Non linearity correction kBeamTestCorrected xxx\n");
1125 fRecoUtils->SetNonLinearityFunction(AliEMCALRecoUtils::kBeamTestCorrectedv3);
1129 if ( debug > 0 ) printf(
"ConfigureEMCALRecoUtils() xxx SET Non linearity correction kPi0MCv3 xxx\n");
1130 fRecoUtils->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0MCv3);
1135 if ( debug > 0 ) printf(
"ConfigureEMCALRecoUtils() xxx DON'T SET Non linearity correction xxx\n");
1136 fRecoUtils->SetNonLinearityFunction(AliEMCALRecoUtils::kNoCorrection);
1146 AliVCaloCells &eventEMcells = *(
fEvent->GetEMCALCells());
1147 Int_t nEMcell = eventEMcells.GetNumberOfCells() ;
1149 AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());
1150 aodEMcells.CreateContainer(nEMcell);
1151 aodEMcells.SetType(AliVCaloCells::kEMCALCell);
1153 for (
Int_t iCell = 0; iCell < nEMcell; iCell++)
1155 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
1156 fGeom->GetCellIndex(eventEMcells.GetCellNumber(iCell),imod,iTower,iIphi,iIeta);
1157 fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
1161 calibFactor =
fRecoUtils->GetEMCALChannelRecalibrationFactor(imod,ieta,iphi);
1164 if(!
fRecoUtils->GetEMCALChannelStatus(imod, ieta, iphi))
1166 aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),eventEMcells.GetAmplitude(iCell)*calibFactor,
1167 eventEMcells.GetTime(iCell),eventEMcells.GetMCLabel(iCell),eventEMcells.GetEFraction(iCell));
1171 aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),0,-1,-1,0);
1188 for (
Int_t i = 0; i < 6; i++) covVtx[i] = 0.;
1190 AliAODHeader* header =
dynamic_cast<AliAODHeader*
>(AODEvent()->GetHeader());
1191 if(!header) AliFatal(
"Not a standard AOD");
1192 header->SetRunNumber(
fRun);
1196 TTree* tree = fInputHandler->GetTree();
1199 TFile*
file = tree->GetCurrentFile();
1200 if (file) header->SetESDFileName(file->GetName());
1203 else if (aodevent) {
1204 AliAODHeader * aodheader =
dynamic_cast<AliAODHeader*
>(aodevent->GetHeader());
1205 if(!aodheader) AliFatal(
"Not a standard AOD");
1206 header->SetESDFileName(aodheader->GetESDFileName());
1209 header->SetBunchCrossNumber(
fEvent->GetBunchCrossNumber());
1210 header->SetOrbitNumber(
fEvent->GetOrbitNumber());
1211 header->SetPeriodNumber(
fEvent->GetPeriodNumber());
1212 header->SetEventType(
fEvent->GetEventType());
1217 if(
fEvent->GetCentrality())
1218 header->SetCentrality(
new AliCentrality(*(
fEvent->GetCentrality())));
1220 header->SetCentrality(0);
1224 header->SetOfflineTrigger(fInputHandler->IsEventSelected());
1226 header->SetFiredTriggerClasses(
fEvent->GetFiredTriggerClasses());
1228 header->SetTriggerMask(
fEvent->GetTriggerMask());
1229 header->SetTriggerCluster(
fEvent->GetTriggerCluster());
1233 header->SetL0TriggerInputs(esdevent->GetHeader()->GetL0TriggerInputs());
1234 header->SetL1TriggerInputs(esdevent->GetHeader()->GetL1TriggerInputs());
1235 header->SetL2TriggerInputs(esdevent->GetHeader()->GetL2TriggerInputs());
1239 header->SetL0TriggerInputs(aodevent->GetHeader()->GetL0TriggerInputs());
1240 header->SetL1TriggerInputs(aodevent->GetHeader()->GetL1TriggerInputs());
1241 header->SetL2TriggerInputs(aodevent->GetHeader()->GetL2TriggerInputs());
1244 header->SetMagneticField(
fEvent->GetMagneticField());
1247 header->SetZDCN1Energy(
fEvent->GetZDCN1Energy());
1248 header->SetZDCP1Energy(
fEvent->GetZDCP1Energy());
1249 header->SetZDCN2Energy(
fEvent->GetZDCN2Energy());
1250 header->SetZDCP2Energy(
fEvent->GetZDCP2Energy());
1251 header->SetZDCEMEnergy(
fEvent->GetZDCEMEnergy(0),
fEvent->GetZDCEMEnergy(1));
1255 fEvent->GetDiamondCovXY(diamcov);
1256 header->SetDiamond(diamxy,diamcov);
1257 if (esdevent) header->SetDiamondZ(esdevent->GetDiamondZ(),esdevent->GetSigma2DiamondZ());
1258 else if (aodevent) header->SetDiamondZ(aodevent->GetDiamondZ(),aodevent->GetSigma2DiamondZ());
1261 Int_t nVertices = 1 ;;
1262 Int_t nCaloClus =
fEvent->GetNumberOfCaloClusters();
1264 AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0);
1267 TClonesArray &vertices = *(AODEvent()->GetVertices());
1272 fEvent->GetPrimaryVertex()->GetXYZ(pos);
1276 esdevent->GetPrimaryVertex()->GetCovMatrix(covVtx);
1277 chi = esdevent->GetPrimaryVertex()->GetChi2toNDF();
1281 aodevent->GetPrimaryVertex()->GetCovMatrix(covVtx);
1282 chi = aodevent->GetPrimaryVertex()->GetChi2perNDF();
1285 AliAODVertex * primary =
new(vertices[jVertices++])
1287 primary->SetName(
fEvent->GetPrimaryVertex()->GetName());
1288 primary->SetTitle(
fEvent->GetPrimaryVertex()->GetTitle());
1308 for(
Int_t i = 0; i < kNumberOfCaloClusters; i++)
1310 AliAODCaloCluster *newCluster = (AliAODCaloCluster *)
fCaloClusterArr->At(i);
1312 newCluster->SetID(i);
1315 newCluster->SetE(
fRecoUtils->CorrectClusterEnergyLinearity(newCluster));
1323 newCluster->AddTrackMatched(
fEvent->GetTrack(trackIndex));
1324 AliDebug(2,Form(
"Matched Track index %d to new cluster %d",trackIndex,i));
1328 fRecoUtils->GetMatchedResiduals(newCluster->GetID(),dZ,dR);
1329 newCluster->SetTrackDistance(dR,dZ);
1333 Int_t absId0 = newCluster->GetCellsAbsId()[0];
1352 new((*fOutputAODBranch)[i]) AliAODCaloCluster(*newCluster);
1354 AliDebug(2,Form(
"New cluster %d of %d, energy %f, mc label %d",
1355 newCluster->GetID(), kNumberOfCaloClusters, newCluster->E(), newCluster->GetLabel()));
1387 if (!AliAnalysisManager::GetAnalysisManager()->GetTree())
1389 AliError(
"AliAnalysisTaskEMCALClusterize::GetPass() - Pointer to tree = 0, returning null");
1393 if (!AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile())
1395 AliError(
"AliAnalysisTaskEMCALClusterize::GetPass() - Null pointer input file, returning null");
1399 TString pass(AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile()->GetName());
1400 if (pass.Contains(
"ass1"))
return TString(
"pass1");
1401 else if (pass.Contains(
"ass2"))
return TString(
"pass2");
1402 else if (pass.Contains(
"ass3"))
return TString(
"pass3");
1403 else if (pass.Contains(
"ass4"))
return TString(
"pass4");
1404 else if (pass.Contains(
"ass5"))
return TString(
"pass5");
1405 else if (pass.Contains(
"LHC11c") && pass.Contains(
"spc_calo") )
return TString(
"spc_calo");
1406 else if (pass.Contains(
"calo") || pass.Contains(
"high_lumi"))
1408 AliInfo(
"Path contains <calo> or <high-lumi>, set as <pass1>");
1411 else if (pass.Contains(
"LHC14a1a"))
1413 AliInfo(
"Enable EMCal energy calibration for this MC production!!");
1421 AliInfo(
"Pass number string not found");
1432 if(fDebug >=0) (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fDebug);
1437 fBranchNames =
"ESD:AliESDHeader.,EMCALCells.";
1455 AliInfo(Form(
"Configure analysis with %s",
fConfigName.Data()));
1494 if (
fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv1)
1496 else if(
fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerv2)
1498 else if(
fRecParam->GetClusterizerFlag() == AliEMCALRecParam::kClusterizerNxN)
1506 AliFatal(Form(
"Clusterizer < %d > not available",
fRecParam->GetClusterizerFlag()));
1531 for (i = 0; i < 8; i++)
1536 for (i = 0; i < 3; i++)
1561 fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(
fRun);
1562 AliInfo(Form(
"Get EMCAL geometry name <%s> for run %d",
fGeom->GetName(),
fRun));
1567 AliInfo(Form(
"Set EMCAL geometry name to <%s>",
fGeomName.Data()));
1587 AliDebug(1,Form(
"Init for run=%d",
fRun));
1588 if (!gGeoManager) AliDebug(1,
"Careful!, gGeoManager not loaded, load misalign matrices");
1593 AliInfo(
"Load user defined EMCAL geometry matrices");
1596 AliOADBContainer emcGeoMat(
"AliEMCALgeo");
1597 emcGeoMat.InitFromFile(Form(
"%s/EMCALlocal2master.root",
fOADBFilePath.Data()),
"AliEMCALgeo");
1600 for(
Int_t mod=0; mod < (
fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++)
1605 AliDebug(2,Form(
"EMCAL matrices SM %d, %p",mod,((TGeoHMatrix*) matEMCAL->At(mod))));
1608 fGeomMatrix[mod] = (TGeoHMatrix*) matEMCAL->At(mod) ;
1613 if(DebugLevel() > 1)
1618 else if(gGeoManager)
1620 AliWarning(Form(
"Set matrix for SM %d from gGeoManager",mod));
1621 fGeom->SetMisalMatrix(
fGeom->GetMatrixForSuperModuleFromGeoManager(mod),mod) ;
1625 AliError(Form(
"Alignment atrix for SM %d is not available",mod));
1632 else if(!gGeoManager)
1634 AliInfo(
"Get geo matrices from data");
1636 if(!strcmp(
fEvent->GetName(),
"AliAODEvent"))
1638 AliWarning(
"Use ideal geometry, values geometry matrix not kept in AODs");
1642 AliDebug(1,
"Load Misaligned matrices");
1648 AliError(
"This event does not contain ESDs?");
1649 if(
fFillAODFile) AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kFALSE);
1653 for(
Int_t mod=0; mod < (
fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++)
1655 if(DebugLevel() > 1)
1656 esd->GetEMCALMatrix(mod)->Print();
1658 if(esd->GetEMCALMatrix(mod))
fGeom->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ;
1681 Int_t bc = InputEvent()->GetBunchCrossNumber();
1702 if(totCellE < 1)
return kTRUE;
1715 if(run < 146858 || run > 146860)
return kFALSE ;
1718 Int_t ncellsSM3 = 0;
1721 if (
fCaloCells->GetAmplitude (icell) > 0.1 &&
1722 fCaloCells->GetCellNumber(icell)/(24*48)==3 ) ncellsSM3++;
1727 Int_t ncellcut = 21;
1728 if(triggerclasses.Contains(
"EMC")) ncellcut = 35;
1730 if( ncellsSM3 >= ncellcut)
1732 AliInfo(Form(
"Reject event %d with ncells in SM3 %d",(
Int_t)Entry(),ncellsSM3));
1733 if(
fFillAODFile) AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kFALSE);;
1751 for (
Int_t icell = 0; icell <
fCaloCells->GetNumberOfCells(); icell++)
1760 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
1761 fGeom->GetCellIndex(
id,imod,iTower,iIphi,iIeta);
1762 fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
1771 AliDebug(1,Form(
"Reference cell absId %d, iEta %d, iPhi %d, amp %2.3f",
id,ieta,iphi,amp));
1778 Int_t absIDuplr = -1;
1779 Int_t absIDdolr = -1;
1781 Int_t absIDup2 = -1;
1782 Int_t absIDup2lr = -1;
1783 Int_t absIDdo2 = -1;
1784 Int_t absIDdo2lr = -1;
1788 if ( (ieta%2) && ieta <= AliEMCALGeoParams::fgkEMCALCols-1 ) colShift = -1;
1789 if ( !(ieta%2) && ieta >= 0 ) colShift = +1;
1791 absIDlr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+colShift);
1794 if ( iphi < AliEMCALGeoParams::fgkEMCALRows-1 )
1796 absIDup =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
1797 absIDuplr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta+colShift);
1802 absIDdo =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
1803 absIDdolr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta+colShift);
1807 if ( iphi < AliEMCALGeoParams::fgkEMCALRows-2 )
1809 absIDup2 =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+2, ieta);
1810 absIDup2lr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+2, ieta+colShift);
1815 absIDdo2 =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-2, ieta);
1816 absIDdo2lr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-2, ieta+colShift);
1820 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi+1)/8) ) { absIDup = -1 ; absIDuplr = -1 ; }
1821 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi-1)/8) ) { absIDdo = -1 ; absIDdolr = -1 ; }
1822 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi+2)/8) ) { absIDup2 = -1 ; absIDup2lr = -1 ; }
1823 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi-2)/8) ) { absIDdo2 = -1 ; absIDdo2lr = -1 ; }
1837 AliDebug(1,Form(
"Same T-Card cells:\n \t up %d (%d), down %d (%d), left-right %d (%d), up-lr %d (%d), down-lr %d (%d)\n"
1838 "\t up2 %d (%d), down2 %d (%d), up2-lr %d (%d), down2-lr %d (%d)",
1839 absIDup ,okup ,absIDdo ,okdo ,absIDlr,oklr,absIDuplr ,okuplr ,absIDdolr ,okdolr ,
1840 absIDup2,okup2,absIDdo2,okdo2, absIDup2lr,okup2lr,absIDdo2lr,okdo2lr));
1850 AliDebug(1,Form(
"Fraction for SM %d (min %2.3f, max %2.3f):\n"
1851 "\t up-down : c %2.3e, p1 %2.3e, p2 %2.4e, sig %2.3e, fraction %2.3f\n"
1852 "\t up-down-lr: c %2.3e, p1 %2.3e, p2 %2.4e, sig %2.3e, fraction %2.3f\n"
1853 "\t left-right: c %2.3e, p1 %2.3e, p2 %2.4e, sig %2.3e, fraction %2.3f\n"
1854 "\t 2nd row : c %2.3e, p1 %2.3e, p2 %2.4e, sig %2.3e, fraction %2.3f",
1878 AliDebug(1,Form(
"Randomized fraction: up-down %2.3f; up-down-left-right %2.3f; left-right %2.3f; 2nd row %2.3f",
1879 fracupdown,fracupdownleri,fracleri,frac2nd));
1888 AliDebug(1,Form(
"Induced energy: up-down %2.3f; up-down-left-right %2.3f; left-right %2.3f; 2nd row %2.3f",
1889 indEupdown,indEupdownleri,indEleri,indE2nd));
1897 AliDebug(1,Form(
"Induced energy, saturated?: up-down %2.3f; up-down-left-right %2.3f; left-right %2.3f; 2nd row %2.3f",
1898 indEupdown,indEupdownleri,indEleri,indE2nd));
1989 AliInfo(Form(
"Geometry: name <%s>, matrix set <%d>, load matrix <%d>, import geo <%d> from path <%s>",
1998 AliInfo(Form(
"Just Unfold clusters <%d>, new clusters list name <%s>, new cells name <%s>",
2003 AliInfo(Form(
"Use cell time for cluster <%d>, Apply constant time shift <%2.2f>, Do track-matching <%d>, Update cells <%d>, Input from ESD filter <%d>",
2009 AliInfo(Form(
"Centrality bin [%2.2f,%2.2f], class <%s>, use AliCentrality? <%d>",
2015 AliInfo(Form(
"MC label from cluster <%d>, Use EdepFrac <%d>, remap AODs <%d>",
2026 AliInfo(
"T-Card emulation not activated");
2030 AliInfo(Form(
"T-Card emulation activated, energy conservation <%d>, randomize E <%d>, induced energy parameters:",
2033 AliInfo(Form(
"T-Card emulation super-modules fraction: Min cell E %2.2f Max induced E %2.2f",
2036 for(
Int_t ism = 0; ism < 22; ism++)
2038 printf(
"\t sm %d, fraction %2.3f, E frac abs min %2.3e max %2.3e \n",
2041 for(
Int_t icell = 0; icell < 4; icell++)
2043 printf(
"\t \t cell type %d, c %2.4e, p0 %2.4e, p1 %2.4e, sigma %2.4e \n",
2060 AliEMCALRecPoint *recPoint = (AliEMCALRecPoint*)
fClusterArr->At(i);
2062 const Int_t ncells = recPoint->GetMultiplicity();
2063 Int_t ncellsTrue = 0;
2065 if(recPoint->GetEnergy() <
fRecParam->GetClusteringThreshold())
continue;
2069 Double32_t ratios[ncells];
2072 AliAODInputHandler* aodIH =
dynamic_cast<AliAODInputHandler*
>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
2077 AliEMCALDigit *digit = (AliEMCALDigit*)
fDigitsArr->At(recPoint->GetDigitsList()[
c]);
2079 absIds[ncellsTrue] = digit->GetId();
2080 ratios[ncellsTrue] = recPoint->GetEnergiesList()[
c]/digit->GetAmplitude();
2082 if ( !
fRecParam->GetUnfold() && (ratios[ncellsTrue] > 1 || ratios[ncellsTrue] < 1) )
2083 AliWarning(Form(
"recpoint cell E %2.3f but digit E %2.3f and no unfolding", recPoint->GetEnergiesList()[
c], digit->GetAmplitude()));
2091 AliDebug(2,Form(
"Too small energy in cell of cluster: cluster cell %f, digit %f",
2092 recPoint->GetEnergiesList()[
c],digit->GetAmplitude()));
2098 clusterE +=recPoint->GetEnergiesList()[
c];
2101 if (aodIH && aodIH->GetMergeEvents())
2104 AliVCaloCells* meEMCALCells = aodIH->GetEventToMerge()->GetEMCALCells();
2105 AliVCaloCells* ouEMCALCells = AODEvent()->GetEMCALCells();
2107 Float_t sigAmplitude = meEMCALCells->GetCellAmplitude(absIds[ncellsTrue]);
2109 Float_t sumAmplitude = ouEMCALCells->GetCellAmplitude(absIds[ncellsTrue]);
2112 if(sumAmplitude > 0) ratios[ncellsTrue] = sigAmplitude/sumAmplitude;
2123 AliDebug(2,Form(
"Skipping cluster with no cells avobe threshold E = %f, ncells %d",
2124 recPoint->GetEnergy(), ncells));
2130 if(clusterE < fRecParam->GetClusteringThreshold())
2132 AliDebug(2,Form(
"Remove cluster with energy below seed threshold %f",clusterE));
2142 recPoint->GetGlobalPosition(gpos);
2147 (*fCaloClusterArr)[j] =
new AliAODCaloCluster() ;
2148 AliAODCaloCluster *clus =
dynamic_cast<AliAODCaloCluster *
>(
fCaloClusterArr->At(j) ) ;
2150 clus->SetType(AliVCluster::kEMCALClusterv1);
2151 clus->SetE(clusterE);
2152 clus->SetPosition(g);
2153 clus->SetNCells(ncellsTrue);
2154 clus->SetCellsAbsId(absIds);
2155 clus->SetCellsAmplitudeFraction(ratios);
2157 clus->SetTOF(recPoint->GetTime()) ;
2158 clus->SetNExMax(recPoint->GetNExMax());
2159 clus->SetDistanceToBadChannel(recPoint->GetDistanceToBadTower());
2161 if(ncells == ncellsTrue)
2164 recPoint->GetElipsAxis(elipAxis);
2165 clus->SetM02(elipAxis[0]*elipAxis[0]) ;
2166 clus->SetM20(elipAxis[1]*elipAxis[1]) ;
2167 clus->SetDispersion(recPoint->GetDispersion());
2173 AliDebug(2,Form(
"Cells removed from cluster (ncells %d, ncellsTrue %d), recalculate Shower Shape",ncells,ncellsTrue));
2175 AliVCaloCells* cells = 0x0;
2176 if (aodIH && aodIH->GetMergeEvents()) cells = AODEvent() ->GetEMCALCells();
2177 else cells = InputEvent()->GetEMCALCells();
2179 fRecoUtils->RecalculateClusterShowerShapeParameters(
fGeom,cells,clus);
2193 Int_t parentMult = 0;
2194 Int_t *parentList = recPoint->GetParents(parentMult);
2195 Float_t *parentListDE = recPoint->GetParentsDE();
2197 clus->SetLabel(parentList, parentMult);
2199 clus->SetClusterMCEdepFractionFromEdepArray(parentListDE);
2213 for(
Int_t icell = 0; icell < ncellsTrue ; icell++)
2217 const AliEMCALDigit * dig = (
const AliEMCALDigit*)
fDigitsArr->At(idigit);
2222 mcEdepFracPerCell[icell] = 0;
2224 Int_t nparents = dig->GetNiparent();
2227 Int_t digLabel =-1 ;
2230 Float_t mcEDepFrac[4] = {0,0,0,0};
2233 for (
Int_t jndex = 0 ; jndex < nparents ; jndex++ )
2235 digLabel = dig->GetIparent (jndex+1);
2236 edep = dig->GetDEParent(jndex+1);
2239 if ( digLabel == parentList[0] ) mcEDepFrac[0] = edep;
2240 else if ( digLabel == parentList[1] ) mcEDepFrac[1] = edep;
2241 else if ( digLabel == parentList[2] ) mcEDepFrac[2] = edep;
2242 else if ( digLabel == parentList[3] ) mcEDepFrac[3] = edep;
2249 mcEdepFracPerCell[icell] = clus->PackMCEdepFraction(mcEDepFrac);
2254 clus->SetCellsMCEdepFractionMap(mcEdepFracPerCell);
2256 delete [] mcEdepFracPerCell;
2269 if(label < 0) return ;
2274 TClonesArray * arr =
dynamic_cast<TClonesArray*
>(evt->FindListObject(
"mcparticles")) ;
2277 if(label < arr->GetEntriesFast())
2279 AliAODMCParticle * particle =
dynamic_cast<AliAODMCParticle *
>(arr->At(label));
2280 if(!particle) return ;
2282 if(label == particle->Label())
return ;
2288 for(
Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2290 AliAODMCParticle * particle =
dynamic_cast<AliAODMCParticle *
>(arr->At(ind));
2291 if(!particle) continue ;
2293 if(label == particle->Label())
2331 AliAODCaloCluster * clus)
2333 Int_t parentMult = 0;
2334 Int_t *parentList = recPoint->GetParents(parentMult);
2335 clus->SetLabel(parentList, parentMult);
2339 for (
Int_t iLoopCell = 0 ; iLoopCell < clus->GetNCells() ; iLoopCell++ )
2342 Int_t idCell = clus->GetCellAbsId(iLoopCell) ;
2346 for (
UInt_t iLoopLabels = 0 ; iLoopLabels < clus->GetNLabels() ; iLoopLabels++ )
2349 if (
fCellSecondLabels[idCell] == clus->GetLabelAt(iLoopLabels) ) iNewLabel = 0;
2353 Int_t * newLabelArray =
new Int_t[clus->GetNLabels()+1] ;
2354 for (
UInt_t iLoopNewLabels = 0 ; iLoopNewLabels < clus->GetNLabels() ; iLoopNewLabels++ )
2356 newLabelArray[iLoopNewLabels] = clus->GetLabelAt(iLoopNewLabels) ;
2360 clus->SetLabel(newLabelArray,clus->GetNLabels()+1) ;
2361 delete [] newLabelArray;
2377 Int_t nLabTotOrg = 0;
2381 AliVEvent *
event =
fEvent;
2384 AliAODInputHandler* aodIH =
dynamic_cast<AliAODInputHandler*
>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
2385 if(aodIH && aodIH->GetEventToMerge())
2386 event = aodIH->GetEventToMerge();
2390 for (
Int_t iLoopCell = 0 ; iLoopCell < clus->GetNCells() ; iLoopCell++ )
2392 Int_t idCell = clus->GetCellAbsId(iLoopCell) ;
2399 for(
Int_t icl =0; icl < nClu; icl++)
2401 if(((
Int_t)clArray.GetAt(icl))==-1 )
continue;
2402 if( idCluster == ((
Int_t)clArray.GetAt(icl)) ) set = kFALSE;
2406 if( set && idCluster >= 0)
2408 clArray.SetAt(idCluster,nClu++);
2410 nLabTotOrg+=(
event->GetCaloCluster(idCluster))->GetNLabels();
2415 AliVCluster * clOrg =
event->GetCaloCluster(idCluster);
2417 if(emax < clOrg->E())
2426 if(nClu==0 || nLabTotOrg == 0)
2434 if(idMax != ((
Int_t)clArray.GetAt(0)))
2436 Int_t maxIndex = -1;
2437 Int_t firstCluster = ((
Int_t)clArray.GetAt(0));
2438 for (
Int_t iLoopCluster = 0 ; iLoopCluster < nClu ; iLoopCluster++ )
2440 if(idMax == ((
Int_t)clArray.GetAt(iLoopCluster))) maxIndex = iLoopCluster;
2443 if(firstCluster >=0 && idMax >=0)
2445 clArray.SetAt(idMax,0);
2446 clArray.SetAt(firstCluster,maxIndex);
2451 TArrayI clMCArray(nLabTotOrg) ;
2455 for (
Int_t iLoopCluster = 0 ; iLoopCluster < nClu ; iLoopCluster++ )
2457 Int_t idCluster = (
Int_t) clArray.GetAt(iLoopCluster);
2459 AliVCluster * clOrg =
event->GetCaloCluster(idCluster);
2460 Int_t nLab = clOrg->GetNLabels();
2462 for (
Int_t iLab = 0 ; iLab < nLab ; iLab++ )
2464 Int_t lab = clOrg->GetLabelAt(iLab) ;
2469 for(
Int_t iLabTot =0; iLabTot < nLabTot; iLabTot++)
2471 if( lab == ((
Int_t)clMCArray.GetAt(iLabTot)) ) set = kFALSE;
2475 if( set ) clMCArray.SetAt(lab,nLabTot++);
2482 clus->SetLabel(clMCArray.GetArray(), nLabTot);
2507 AliInfo(
"Cluster branch name not set, set it to newEMCALClustersArray");
2538 if(!
fRecoUtils->IsBadChannelsRemovalSwitchedOn() &&
2542 !
fRecoUtils->IsL1PhaseInTimeRecalibrationOn() &&
2553 else if ( ncells != ndigis )
2559 for (
Int_t idigit = 0; idigit < ndigis; ++idigit)
2561 AliEMCALDigit *digit =
static_cast<AliEMCALDigit*
>(
fDigitsArr->At(idigit));
2563 Double_t cellAmplitude = digit->GetAmplitude();
2564 Short_t cellNumber = digit->GetId();
2565 Double_t cellTime = digit->GetTime();
2567 Bool_t highGain = kFALSE;
2568 if( digit->GetType() == AliEMCALDigit::kHG ) highGain = kTRUE;
2573 Int_t nparents = digit->GetNiparent();
2574 Int_t cellMcEDepFrac =-1 ;
2578 for (
Int_t jndex = 0 ; jndex < nparents ; jndex++ )
2580 if(cellMcEDepFrac >= digit->GetDEParent(jndex+1))
continue ;
2582 cellMcLabel = digit->GetIparent (jndex+1);
2583 cellMcEDepFrac= digit->GetDEParent(jndex+1);
2587 if ( cellMcEDepFrac < 0 ) cellMcEDepFrac = 0.;
2590 fCaloCells ->SetCell(idigit, cellNumber, cellAmplitude, cellTime, cellMcLabel, cellMcEDepFrac, highGain);
2592 fOutputAODCells->SetCell(idigit, cellNumber, cellAmplitude, cellTime, cellMcLabel, cellMcEDepFrac, highGain);
2634 fRun = InputEvent()->GetRunNumber();
2638 AliInfo(Form(
"Set run to %d",
fRun));
2648 AliDebug(1,Form(
"Skip Event %d", (
Int_t) Entry()));
TString fOutputAODCellsName
New of output cells AOD branch name.
void FillAODCaloCells()
Put calo cells in standard branch.
Float_t fTCardCorrMinAmp
Minimum cell energy to induce signal on adjacent cells.
AliVCaloCells * fCaloCells
! CaloCells container
Bool_t fTCardCorrEmulation
Activate T-Card cells energy correlation.
Float_t fTCardCorrInduceEnerFracP1[4][22]
Induced energy loss gauss fraction param1 on 0-same row, diff col, 1-up/down cells left/right col 2-l...
virtual void ResetArrays()
Reset arrays containing information for all possible cells.
TString GetPass()
Get or guess pass number/string from path of filename.
Bool_t fSetCellMCLabelFromEdepFrac
Bool_t fFillAODHeader
Copy header to standard branch.
TClonesArray * fDigitsArr
! Digits array
Bool_t fTCardCorrClusEnerConserv
When making correlation, subtract from the reference cell the induced energy on the neighbour cells...
AliEMCALClusterizer * fClusterizer
! EMCAL clusterizer
AliAnalysisTaskEMCALClusterize()
Constructor.
Bool_t fJustUnfold
Just unfold, do not recluster.
Bool_t fImportGeometryFromFile
Import geometry settings in geometry.root file.
Bool_t fSelectCell
Reject cells from cluster if energy is too low and recalculate position/energy and other...
TString fConfigName
Name of analysis configuration file.
Float_t fTCardCorrInduceEnerFracMax[22]
In case fTCardCorrInduceEnerFracP1 is non null, restrict the maximum fraction of induced energy per S...
void PrintTCardParam()
Print parameters for T-Card correlation emulation.
Int_t fCellSecondLabels[fgkNEMCalCells]
Array with Second MC label to be passed to digit.
TRandom3 fRandom
Random generator.
void MakeCellTCardCorrelation()
void SetClustersMCLabelFrom2SelectedLabels(AliEMCALRecPoint *recPoint, AliAODCaloCluster *clus)
Int_t fSetCellMCLabelFromCluster
Float_t fCellMatchdEta[fgkNEMCalCells]
Array with cluster-track dPhi.
TClonesArray * fOutputAODBranch
! AOD Branch with output clusters
TString fOADBFilePath
Default path $ALICE_PHYSICS/OADB/EMCAL, if needed change.
Float_t fTCardCorrCellsEner[fgkNEMCalCells]
Array with induced cell energy in T-Card neighbour cells.
virtual ~AliAnalysisTaskEMCALClusterize()
Destructor.
TString fImportGeometryFilePath
path fo geometry.root file
Float_t fTCardCorrInduceEnerFrac[4][22]
Induced energy loss gauss fraction param0 on 0-same row, diff col, 1-up/down cells left/right col 2-l...
void ConfigureEMCALRecoUtils(Bool_t bMC=kFALSE, Bool_t bExotic=kTRUE, Bool_t bNonLin=kFALSE, Bool_t bRecalE=kTRUE, Bool_t bBad=kTRUE, Bool_t bRecalT=kTRUE, Int_t debug=-1)
Bool_t fPrintOnce
Print once analysis parameters.
Bool_t fSelectEMCALEvent
Process the event if there is some high energy cluster.
Bool_t AcceptEventEMCAL()
Float_t fTCardCorrMaxInduced
Maximum induced energy signal on adjacent cells.
Float_t GetEventCentrality() const
Get centrality/multiplicity percentile.
Bool_t fInputFromFilter
Get the input from AODs from the filter.
TString fOutputAODBranchName
New of output clusters AOD branch.
AliEMCALGeometry * fGeom
EMCAL geometry.
void ClusterUnfolding()
Take the event clusters and unfold them.
Bool_t fAccessOADB
Get calibration from OADB for EMCAL.
Bool_t fRemoveLEDEvents
Remove LED events, use only for LHC11a.
AliEMCALRecoUtils * fRecoUtils
Access to factorized reconstruction algorithms.
Bool_t fRejectBelowThreshold
split (false-default) or reject (true) cell energy below threshold after UF
Float_t fConstantTimeShift
Apply a 600 ns time shift in case of simulation, shift in ns.
void SetClustersMCLabelFromOriginalClusters(AliAODCaloCluster *clus)
Bool_t fUpdateCell
On/Off the upate of the CaloCells container.
Float_t fSelectCellMinE
Min energy cell threshold, after unfolding.
Bool_t fOADBSet
AODB parameters already set.
AliAODCaloCells * fOutputAODCells
! AOD Branch with output cells
virtual void UserCreateOutputObjects()
Float_t fTCardCorrInduceEner[4][22]
Induced energy loss gauss constant on 0-same row, diff col, 1-up/down cells left/right col 2-left/rig...
virtual void FillCaloClusterInEvent()
Int_t fCellLabels[fgkNEMCalCells]
Array with MC label to be passed to digit.
Bool_t fRemoveExoticEvents
Remove exotic events.
void AddNewTCardInducedCellsToDigit()
Bool_t fDoTrackMatching
On/Off the matching recalculation to speed up analysis in PbPb.
virtual void UserExec(Option_t *option)
Float_t fCellMatchdPhi[fgkNEMCalCells]
Array with cluster-track dEta.
Float_t fTCardCorrInduceEnerProb[22]
Probability to induce energy loss per SM.
AliMultSelection * GetMultSelCen() const
TString fInputCaloCellsName
Input cells branch name, if different from default branch.
TGeoHMatrix * fGeomMatrix[22]
Geometry matrices with alignments.
Bool_t IsLEDEvent(const Int_t run)
Check if event is LED, is so remove it. Affected LHC11a runs.
AliEMCALRecParam * fRecParam
Reconstruction parameters container.
TString fGeomName
Name of geometry to use.
Bool_t fOutputAODBranchSet
Set the AOD clusters branch in the input event once.
void PrintParam()
Print clusterization task parameters.
void RemapMCLabelForAODs(Int_t &label)
TString fOCDBpath
Path with OCDB location.
AliEMCALAfterBurnerUF * fUnfolder
! Unfolding procedure
Bool_t fGeomMatrixSet
Set geometry matrices only once, for the first event.
Float_t fCentralityBin[2]
Minimum and maximum value of the centrality for the analysis.
Int_t fMaxEvent
Set a maximum event.
Bool_t fFillAODCaloCells
Copy calocells to standard branch.
TObjArray * fCaloClusterArr
! CaloClusters array
Double_t fCellTime[fgkNEMCalCells]
Array with cluster time to be passed to digit in case of AODs.
AliCentrality * GetCentrality() const
TString fCentralityClass
Name of selected centrality class.
TFile * file
TList with histograms for a given trigger.
Bool_t fAccessOCDB
Need to access info from OCDB (not really)
TObjArray * fClusterArr
! Recpoints array
Bool_t fRecalibrateWithClusterTime
Use fCellTime to store time of cells in cluster.
Int_t GetRunNumber(TString)
void InitClusterization()
void FillAODHeader()
Put event header information in standard AOD branch.
static const Int_t fgkNEMCalCells
Total number of cells in the calorimeter, 10*48*24 (EMCal) + 4*48*8 (EMCal/DCal 1/3) + 6*32*24 (DCal)...
Float_t fTCardCorrInduceEnerFracMin[22]
In case fTCardCorrInduceEnerFracP1 is non null, restrict the minimum fraction of induced energy per S...
virtual void RecPoints2Clusters()
Int_t fEMCALNcellsCut
At least an EMCAL cluster with fNCellsCut cells over fEnergyCut.
Reclusterize EMCal clusters, put them in a new branch for other following analysis.
Bool_t fTCardCorrCellsNew[fgkNEMCalCells]
Array with induced cell energy in T-Card neighbour cells, that before had no signal.
Bool_t fLoadGeomMatrices
Matrices set from configuration, not get from geometry.root or from ESDs/AODs.
Float_t fEMCALEnergyCut
At least an EMCAL cluster with this energy in the event.
Bool_t fRandomizeTCard
Use random induced energy.
Bool_t fUseAliCentrality
Use the centrality estimator from AliCentrality or AliMultSelection.
Float_t fTCardCorrInduceEnerFracWidth[4][22]
Induced energy loss gauss witdth on 0-same row, diff col, 1-up/down cells left/right col 2-left/righ ...
Int_t fOrgClusterCellId[fgkNEMCalCells]
Array ID of cluster to wich the cell belongs in unmodified clusters.
Float_t fSelectCellMinFrac
Min fraction of cell energy after unfolding cut.
Bool_t fRemapMCLabelForAODs
Remap AOD cells MC label. Needed in old AOD productions.
Bool_t AcceptCell(Int_t absID)