11 #include <AliEMCALGeometry.h> 13 #include <AliAODEvent.h> 29 fCellEnergyDistBefore(0),
30 fCellEnergyDistAfter(0),
31 fTCardCorrClusEnerConserv(kFALSE),
33 fRandomizeTCard(kTRUE),
34 fTCardCorrMinAmp(0.01),
35 fTCardCorrMinInduced(0),
36 fTCardCorrMaxInducedELeak(0),
37 fTCardCorrMaxInduced(100),
47 for(
Int_t j = 0; j < 4 ; j++)
76 AliWarning(
"Init EMCAL crosstalk emulation");
87 const std::map <std::string, Float_t (*)[fgkNsm]> properties2D = {
93 const std::map <std::string, Float_t *> properties1D = {
123 for (
unsigned int iProperty = 0; iProperty <
property.size(); iProperty++) {
124 val[iProperty][iSM] =
property.at(iProperty);
138 if (property.size() != 1) {
139 AliErrorStream() <<
"Trying to set single value for property " << name <<
", but given " <<
property.size() <<
" values. Please check your configuration!\n";
142 val[iSM] =
property.at(0);
154 fCellEnergyDistBefore =
new TH1F(
"hCellEnergyDistBefore",
"hCellEnergyDistBefore;E_{cell} (GeV)",1000,0,10);
156 fCellEnergyDistAfter =
new TH1F(
"hCellEnergyDistAfter",
"hCellEnergyDistAfter;E_{cell} (GeV)",1000,0,10);
169 AliError(
"Event ptr = 0, returning");
177 AliDebug(2, Form(
"Number of EMCAL cells = %d, returning",
fCaloCells->GetNumberOfCells()));
222 for (
Int_t icell = 0; icell < nCells; icell++)
231 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
232 fGeom->GetCellIndex(
id,imod,iTower,iIphi,iIeta);
233 fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
245 AliDebug(1,Form(
"Reference cell absId %d, iEta %d, iPhi %d, amp %2.3f",
id,ieta,iphi,amp));
252 Int_t absIDuplr = -1;
253 Int_t absIDdolr = -1;
256 Int_t absIDup2lr = -1;
258 Int_t absIDdo2lr = -1;
262 if ( (ieta%2) && ieta <= AliEMCALGeoParams::fgkEMCALCols-1 ) colShift = -1;
263 if ( !(ieta%2) && ieta >= 0 ) colShift = +1;
265 absIDlr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+colShift);
268 if ( iphi < AliEMCALGeoParams::fgkEMCALRows-1 )
270 absIDup =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
271 absIDuplr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta+colShift);
276 absIDdo =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
277 absIDdolr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta+colShift);
281 if ( iphi < AliEMCALGeoParams::fgkEMCALRows-2 )
283 absIDup2 =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+2, ieta);
284 absIDup2lr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+2, ieta+colShift);
289 absIDdo2 =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-2, ieta);
290 absIDdo2lr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-2, ieta+colShift);
294 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi+1)/8) ) { absIDup = -1 ; absIDuplr = -1 ; }
295 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi-1)/8) ) { absIDdo = -1 ; absIDdolr = -1 ; }
296 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi+2)/8) ) { absIDup2 = -1 ; absIDup2lr = -1 ; }
297 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi-2)/8) ) { absIDdo2 = -1 ; absIDdo2lr = -1 ; }
301 AliDebug(1,Form(
"cell up %d:" ,absIDup));
303 AliDebug(1,Form(
"cell down %d:",absIDdo));
306 AliDebug(1,Form(
"cell up left-right %d:" ,absIDuplr));
308 AliDebug(1,Form(
"cell down left-right %d:",absIDdolr));
311 AliDebug(1,Form(
"cell left-right %d:",absIDlr));
314 AliDebug(1,Form(
"cell up 2nd row %d:" ,absIDup2));
316 AliDebug(1,Form(
"cell down 2nd row %d:",absIDdo2));
319 AliDebug(1,Form(
"cell up left-right 2nd row %d:" ,absIDup2lr));
321 AliDebug(1,Form(
"cell down left-right 2nd row %d:",absIDdo2lr));
351 AliDebug(1,Form(
"\t fraction %2.3f",frac));
358 AliDebug(1,Form(
"\t randomized fraction %2.3f",frac));
362 if ( frac < 0.0001 )
return;
370 AliDebug(1,Form(
"\t induced E %2.3f",inducedE));
410 fAODCellsTmp =
new AliAODCaloCells(
"tmpCaloCellsAOD",
"tmpCaloCellsAOD",AliAODCaloCells::kEMCALCell);
415 for (
Int_t icell = 0; icell < nCells; icell++)
418 fCaloCells->GetCell(icell, absId, amp, time, mclabel, efrac);
423 fAODCellsTmp->SetCell(icell, absId, amp, time, mclabel, efrac);
451 fCaloCells->CreateContainer(nCells+nCellsNew);
461 Int_t cellNumber = -1;
463 for(
Int_t j = 0; j < nCells; j++)
471 fCaloCells->SetCell(j, absId, amp, time, mclabel, efrac, highgain);
492 Int_t ok =
fCaloCells->SetCell(cellNumber, absId, amp, time, mclabel, efrac,1);
494 if ( !ok ) AliError(
"Induced new cell could not be added!");
526 if ( absID < 0 || absID >= 24*48*
fGeom->GetNumberOfSuperModules() )
529 Int_t imod = -1,iTower = -1, iIphi = -1, iIeta = -1;
530 if (!
fGeom->GetCellIndex(absID,imod,iTower,iIphi,iIeta))
541 printf(
"T-Card emulation activated, energy conservation <%d>, randomize E <%d>, induced energy parameters:\n",
544 printf(
"T-Card emulation super-modules fraction: Min cell E %2.1f MeV; " 545 "induced Min E %2.1f MeV; Max at low E %2.1f MeV; Max E %2.2f GeV\n",
551 printf(
"\t sm %d, fraction %2.3f, E frac abs min %2.3e max %2.3e \n",
554 for(
Int_t icell = 0; icell < 4; icell++)
556 printf(
"\t \t cell type %d, c %2.4e, p0 %2.4e, p1 %2.4e, sigma %2.4e \n",
Float_t fTCardCorrInduceEnerFracP1[4][fgkNsm]
Induced energy loss gauss fraction param1 on 0-same row, diff col, 1-up/down cells left/right col 2-l...
void AddInducedEnergiesToNewCells()
Bool_t fTCardCorrCellsNew[fgkNEMCalCells]
Array with induced cell energy in T-Card neighbour cells, that before had no signal.
AliEMCALGeometry * fGeom
! Geometry object
Bool_t fPrintOnce
Print once analysis parameters.
Bool_t fRandomizeTCard
Use random induced energy.
virtual void ResetArrays()
Float_t fTCardCorrMaxInduced
Maximum induced energy signal on adjacent cells.
static const Int_t fgkNsm
Total number of super-modules.
Float_t fTCardCorrMinInduced
Minimum induced energy signal on adjacent cells, sum of induced plus original energy, use same as cell energy clusterization cut.
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)...
TRandom3 fRandom
Random generator.
Correction component to emulate cell-level crosstalk in the EMCal correction framework.
Bool_t fTCardCorrClusEnerConserv
When making correlation, subtract from the reference cell the induced energy on the neighbour cells...
virtual ~AliEmcalCorrectionCellEmulateCrosstalk()
virtual void UserCreateOutputObjects()
Float_t fTCardCorrInduceEnerProb[fgkNsm]
Probability to induce energy loss per SM.
AliVEvent * InputEvent() const
void SetProperty(Float_t val[][fgkNsm], std::vector< double > &property, unsigned int iSM, const std::string &name)
AliAODCaloCells * fAODCellsTmp
! Temporal array of cells copy
AliVCaloCells * fCaloCells
! Pointer to CaloCells
Some utilities for cluster and cell treatment.
void MakeCellTCardCorrelation()
Float_t fTCardCorrMaxInducedELeak
Maximum value of induced energy signal that is always leaked, ~5-10 MeV.
AliEMCALRecoUtils * fRecoUtils
Pointer to RecoUtils.
Float_t fTCardCorrInduceEnerFrac[4][fgkNsm]
Induced energy loss gauss fraction param0 on 0-same row, diff col, 1-up/down cells left/right col 2-l...
Float_t fTCardCorrMinAmp
Minimum cell energy to induce signal on adjacent cells.
Float_t fTCardCorrInduceEnerFracWidth[4][fgkNsm]
Induced energy loss gauss witdth on 0-same row, diff col, 1-up/down cells left/right col 2-left/righ ...
void AddInducedEnergiesToExistingCells()
Base class for correction components in the EMCal correction framework.
Float_t fTCardCorrCellsEner[fgkNEMCalCells]
Array with induced cell energy in T-Card neighbour cells.
Float_t fTCardCorrInduceEnerFracMin[fgkNsm]
In case fTCardCorrInduceEnerFracP1 is non null, restrict the minimum fraction of induced energy per S...
void UserCreateOutputObjects()
TList * fOutput
! List of output histograms
Bool_t fCreateHisto
Flag to make some basic histograms.
TH1F * fCellEnergyDistBefore
! cell energy distribution, before energy smearing
TH1F * fCellEnergyDistAfter
! cell energy distribution, after energy smearing
virtual Bool_t Initialize()
Bool_t AcceptCell(Int_t absID)
Float_t fTCardCorrInduceEner[4][fgkNsm]
Induced energy loss gauss constant on 0-same row, diff col, 1-up/down cells left/right col 2-left/rig...
static RegisterCorrectionComponent< AliEmcalCorrectionCellEmulateCrosstalk > reg
AliEmcalCorrectionEventManager fEventManager
Minimal task which inherits from AliAnalysisTaskSE and manages access to the event.
Float_t fTCardCorrInduceEnerFracMax[fgkNsm]
In case fTCardCorrInduceEnerFracP1 is non null, restrict the maximum fraction of induced energy per S...
AliEmcalCorrectionCellEmulateCrosstalk()
void CalculateInducedEnergyInTCardCell(Int_t absId, Int_t absIdRef, Int_t sm, Float_t ampRef, Int_t cellCase)
bool GetProperty(std::string propertyName, T &property, bool requiredProperty=true, std::string correctionName="")
Retrieve property.
void RetrieveAndSetProperties(const T &properties)