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 fTCardCorrMaxInduced(100),
45 for(
Int_t j = 0; j < 4 ; j++)
74 AliWarning(
"Init EMCAL crosstalk emulation");
83 const std::map <std::string, Float_t (*)[fgkNsm]> properties2D = {
89 const std::map <std::string, Float_t *> properties1D = {
119 for (
unsigned int iProperty = 0; iProperty <
property.size(); iProperty++) {
120 val[iProperty][iSM] =
property.at(iProperty);
134 if (property.size() != 1) {
135 AliErrorStream() <<
"Trying to set single value for property " << name <<
", but given " <<
property.size() <<
" values. Please check your configuration!\n";
138 val[iSM] =
property.at(0);
150 fCellEnergyDistBefore =
new TH1F(
"hCellEnergyDistBefore",
"hCellEnergyDistBefore;E_{cell} (GeV)",1000,0,10);
152 fCellEnergyDistAfter =
new TH1F(
"hCellEnergyDistAfter",
"hCellEnergyDistAfter;E_{cell} (GeV)",1000,0,10);
165 AliError(
"Event ptr = 0, returning");
173 AliDebug(2, Form(
"Number of EMCAL cells = %d, returning",
fCaloCells->GetNumberOfCells()));
218 for (
Int_t icell = 0; icell < nCells; icell++)
227 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
228 fGeom->GetCellIndex(
id,imod,iTower,iIphi,iIeta);
229 fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
241 AliDebug(1,Form(
"Reference cell absId %d, iEta %d, iPhi %d, amp %2.3f",
id,ieta,iphi,amp));
248 Int_t absIDuplr = -1;
249 Int_t absIDdolr = -1;
252 Int_t absIDup2lr = -1;
254 Int_t absIDdo2lr = -1;
258 if ( (ieta%2) && ieta <= AliEMCALGeoParams::fgkEMCALCols-1 ) colShift = -1;
259 if ( !(ieta%2) && ieta >= 0 ) colShift = +1;
261 absIDlr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+colShift);
264 if ( iphi < AliEMCALGeoParams::fgkEMCALRows-1 )
266 absIDup =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
267 absIDuplr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta+colShift);
272 absIDdo =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
273 absIDdolr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta+colShift);
277 if ( iphi < AliEMCALGeoParams::fgkEMCALRows-2 )
279 absIDup2 =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+2, ieta);
280 absIDup2lr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+2, ieta+colShift);
285 absIDdo2 =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-2, ieta);
286 absIDdo2lr =
fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-2, ieta+colShift);
290 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi+1)/8) ) { absIDup = -1 ; absIDuplr = -1 ; }
291 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi-1)/8) ) { absIDdo = -1 ; absIDdolr = -1 ; }
292 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi+2)/8) ) { absIDup2 = -1 ; absIDup2lr = -1 ; }
293 if ( TMath::FloorNint(iphi/8) != TMath::FloorNint((iphi-2)/8) ) { absIDdo2 = -1 ; absIDdo2lr = -1 ; }
307 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" 308 "\t up2 %d (%d), down2 %d (%d), up2-lr %d (%d), down2-lr %d (%d)",
309 absIDup ,okup ,absIDdo ,okdo ,absIDlr,oklr,absIDuplr ,okuplr ,absIDdolr ,okdolr ,
310 absIDup2,okup2,absIDdo2,okdo2, absIDup2lr,okup2lr,absIDdo2lr,okdo2lr));
320 AliDebug(1,Form(
"Fraction for SM %d (min %2.3f, max %2.3f):\n" 321 "\t up-down : c %2.3e, p1 %2.3e, p2 %2.4e, sig %2.3e, fraction %2.3f\n" 322 "\t up-down-lr: c %2.3e, p1 %2.3e, p2 %2.4e, sig %2.3e, fraction %2.3f\n" 323 "\t left-right: c %2.3e, p1 %2.3e, p2 %2.4e, sig %2.3e, fraction %2.3f\n" 324 "\t 2nd row : c %2.3e, p1 %2.3e, p2 %2.4e, sig %2.3e, fraction %2.3f",
348 AliDebug(1,Form(
"Randomized fraction: up-down %2.3f; up-down-left-right %2.3f; left-right %2.3f; 2nd row %2.3f",
349 fracupdown,fracupdownleri,fracleri,frac2nd));
358 AliDebug(1,Form(
"Induced energy: up-down %2.3f; up-down-left-right %2.3f; left-right %2.3f; 2nd row %2.3f",
359 indEupdown,indEupdownleri,indEleri,indE2nd));
367 AliDebug(1,Form(
"Induced energy, saturated?: up-down %2.3f; up-down-left-right %2.3f; left-right %2.3f; 2nd row %2.3f",
368 indEupdown,indEupdownleri,indEleri,indE2nd));
472 fAODCellsTmp =
new AliAODCaloCells(
"tmpCaloCellsAOD",
"tmpCaloCellsAOD",AliAODCaloCells::kEMCALCell);
477 for (
Int_t icell = 0; icell < nCells; icell++)
480 fCaloCells->GetCell(icell, absId, amp, time, mclabel, efrac);
485 fAODCellsTmp->SetCell(icell, absId, amp, time, mclabel, efrac);
513 fCaloCells->CreateContainer(nCells+nCellsNew);
523 Int_t cellNumber = -1;
525 for(
Int_t j = 0; j < nCells; j++)
533 fCaloCells->SetCell(j, absId, amp, time, mclabel, efrac, highgain);
554 Int_t ok =
fCaloCells->SetCell(cellNumber, absId, amp, time, mclabel, efrac,1);
556 if ( !ok ) AliError(
"Induced new cell could not be added!");
588 if ( absID < 0 || absID >= 24*48*
fGeom->GetNumberOfSuperModules() )
591 Int_t imod = -1,iTower = -1, iIphi = -1, iIeta = -1;
592 if (!
fGeom->GetCellIndex(absID,imod,iTower,iIphi,iIeta))
603 printf(
"T-Card emulation activated, energy conservation <%d>, randomize E <%d>, induced energy parameters:\n",
605 printf(
"T-Card emulation super-modules fraction: Min cell E %2.2f Max induced E %2.2f\n",
610 printf(
"\t sm %d, fraction %2.3f, E frac abs min %2.3e max %2.3e \n",
613 for(
Int_t icell = 0; icell < 4; icell++)
615 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.
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()
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()
bool GetProperty(std::string propertyName, T &property, bool requiredProperty=true, std::string correctionName="")
Retrieve property.
void RetrieveAndSetProperties(const T &properties)