Skip to content

Commit f98de60

Browse files
authored
[PWGJE] EMCal correction task: apply MC cell corrections after cross-… (#18727)
1 parent c966efb commit f98de60

1 file changed

Lines changed: 27 additions & 29 deletions

File tree

‎PWGJE/TableProducer/emcalCorrectionTask.cxx‎

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ struct EmcalCorrectionTask {
391391
emcCrossTalk.initObjects(emcCrossTalkConf);
392392
if (emcCrossTalkConf.createHistograms.value) {
393393
mHistManager.add<TH1>("hCellEnergyDistBefore", "Cell energy before cross-talk emulation", {o2::framework::HistType::kTH1D, {energyDenseAxis}});
394-
mHistManager.add<TH1>("hCellEnergyDistAfter", "Cell energy after cross-talk emulation", {o2::framework::HistType::kTH1D, {energyDenseAxis}});
394+
mHistManager.add<TH1>("hCellEnergyDistAfter", "Cell energy after cross-talk emulation and corrections", {o2::framework::HistType::kTH1D, {energyDenseAxis}});
395395
}
396396
}
397397

@@ -825,19 +825,9 @@ struct EmcalCorrectionTask {
825825
}
826826
mHistManager.fill(HIST("hMCParticleEnergy"), cellparticle.e());
827827
}
828-
auto amplitude = cell.amplitude();
829-
if (static_cast<bool>(hasShaperCorrection) && emcal::intToChannelType(cell.cellType()) == emcal::ChannelType_t::LOW_GAIN) { // Apply shaper correction to LG cells
830-
amplitude = o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(amplitude);
831-
}
832-
if (mcCellEnergyShift != 1.) {
833-
amplitude *= mcCellEnergyShift; // Fine tune the MC cell energy
834-
}
835-
if (mcCellEnergyResolutionBroadening != 0.) {
836-
amplitude *= (1. + normalgaus(rdgen) * mcCellEnergyResolutionBroadening); // Fine tune the MC cell energy resolution
837-
}
838828
cellsBC.emplace_back(cell.cellNumber(),
839-
amplitude,
840-
cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), mRunNumber),
829+
cell.amplitude(),
830+
cell.time(),
841831
o2::emcal::intToChannelType(cell.cellType()));
842832
cellIndicesBC.emplace_back(cell.globalIndex());
843833
cellLabels.emplace_back(std::vector<int>{cell.mcParticleIds().begin(), cell.mcParticleIds().end()}, std::vector<float>{cell.amplitudeA().begin(), cell.amplitudeA().end()});
@@ -869,9 +859,18 @@ struct EmcalCorrectionTask {
869859
} // if (isMC.value && emcCrossTalkConf.enableCrossTalk.value)
870860
// shaper correction has to come AFTER cross talk
871861
for (auto& cell : cellsBC) { // o2-linter: disable=const-ref-in-for-loop (we are changing a value here)
872-
if (cell.getLowGain()) {
873-
cell.setAmplitude(o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(cell.getAmplitude()));
862+
auto amplitude = cell.getAmplitude();
863+
if (static_cast<bool>(hasShaperCorrection) && cell.getLowGain()) { // Apply shaper correction to LG cells
864+
amplitude = o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(amplitude);
865+
}
866+
if (mcCellEnergyShift != 1.) {
867+
amplitude *= mcCellEnergyShift; // Fine tune the MC cell energy
868+
}
869+
if (mcCellEnergyResolutionBroadening != 0.) {
870+
amplitude *= (1. + normalgaus(rdgen) * mcCellEnergyResolutionBroadening); // Fine tune the MC cell energy resolution
874871
}
872+
cell.setAmplitude(amplitude);
873+
cell.setTimeStamp(cell.getTimeStamp() + getCellTimeShift(cell.getTower(), amplitude, cell.getType(), mRunNumber));
875874
}
876875
LOG(detail) << "Number of cells for BC (CF): " << cellsBC.size();
877876
nCellsProcessed += cellsBC.size();
@@ -1020,19 +1019,9 @@ struct EmcalCorrectionTask {
10201019
}
10211020
mHistManager.fill(HIST("hMCParticleEnergy"), cellparticle.e());
10221021
}
1023-
auto amplitude = cell.amplitude();
1024-
if (static_cast<bool>(hasShaperCorrection) && emcal::intToChannelType(cell.cellType()) == emcal::ChannelType_t::LOW_GAIN) { // Apply shaper correction to LG cells
1025-
amplitude = o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(amplitude);
1026-
}
1027-
if (mcCellEnergyShift != 1.) {
1028-
amplitude *= mcCellEnergyShift; // Fine tune the MC cell energy
1029-
}
1030-
if (mcCellEnergyResolutionBroadening != 0.) {
1031-
amplitude *= (1. + normalgaus(rdgen) * mcCellEnergyResolutionBroadening); // Fine tune the MC cell energy resolution
1032-
}
10331022
cellsBC.emplace_back(cell.cellNumber(),
1034-
amplitude,
1035-
cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), mRunNumber),
1023+
cell.amplitude(),
1024+
cell.time(),
10361025
o2::emcal::intToChannelType(cell.cellType()));
10371026
cellIndicesBC.emplace_back(cell.globalIndex());
10381027
cellLabels.emplace_back(std::vector<int>{cell.mcParticleIds().begin(), cell.mcParticleIds().end()}, std::vector<float>{cell.amplitudeA().begin(), cell.amplitudeA().end()});
@@ -1064,9 +1053,18 @@ struct EmcalCorrectionTask {
10641053
} // if (isMC.value && emcCrossTalkConf.enableCrossTalk.value)
10651054
// shaper correction has to come AFTER cross talk
10661055
for (auto& cell : cellsBC) { // o2-linter: disable=const-ref-in-for-loop (we are changing a value here)
1067-
if (cell.getLowGain()) {
1068-
cell.setAmplitude(o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(cell.getAmplitude()));
1056+
auto amplitude = cell.getAmplitude();
1057+
if (static_cast<bool>(hasShaperCorrection) && cell.getLowGain()) { // Apply shaper correction to LG cells
1058+
amplitude = o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(amplitude);
1059+
}
1060+
if (mcCellEnergyShift != 1.) {
1061+
amplitude *= mcCellEnergyShift; // Fine tune the MC cell energy
1062+
}
1063+
if (mcCellEnergyResolutionBroadening != 0.) {
1064+
amplitude *= (1. + normalgaus(rdgen) * mcCellEnergyResolutionBroadening); // Fine tune the MC cell energy resolution
10691065
}
1066+
cell.setAmplitude(amplitude);
1067+
cell.setTimeStamp(cell.getTimeStamp() + getCellTimeShift(cell.getTower(), amplitude, cell.getType(), mRunNumber));
10701068
}
10711069
LOG(detail) << "Number of cells for BC (CF): " << cellsBC.size();
10721070
nCellsProcessed += cellsBC.size();

0 commit comments

Comments
 (0)