Skip to content

Commit 5cf168a

Browse files
committed
[PWGJE] additional EMCal time calibration (fix)
1 parent 6cc98ca commit 5cf168a

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

PWGJE/TableProducer/emcalCorrectionTask.cxx

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ struct EmcalCorrectionTask {
126126
// EMCal geometry
127127
o2::emcal::Geometry* geometry;
128128

129+
std::vector<std::pair<int, int>> mExtraTimeShiftRunRanges;
130+
131+
// Current run number
132+
int runNumber{0};
133+
129134
void init(InitContext const&)
130135
{
131136
LOG(debug) << "Start init!";
@@ -250,6 +255,16 @@ struct EmcalCorrectionTask {
250255
mHistManager.add("hContributors", "hContributors;contributor per cell hit;#it{counts}", O2HistType::kTH1I, {{20, 0, 20}});
251256
mHistManager.add("hMCParticleEnergy", "hMCParticleEnergy;#it{E} (GeV/#it{c});#it{counts}", O2HistType::kTH1F, {energyAxis});
252257
}
258+
259+
// For some runs, LG cells require an extra time shift of 2 * 8.8ns due to problems in the time calibration
260+
// Affected run ranges (inclusive) are initialised here (min,max)
261+
mExtraTimeShiftRunRanges.emplace_back(535365, 535645); // LHC23g-LHC23h
262+
mExtraTimeShiftRunRanges.emplace_back(535725, 536126); // LHC23h-LHC23l
263+
mExtraTimeShiftRunRanges.emplace_back(536199, 536202); // LHC23l-LHC23m
264+
mExtraTimeShiftRunRanges.emplace_back(536239, 536346); // LHC23m-LHC23n
265+
mExtraTimeShiftRunRanges.emplace_back(536565, 536590); // Commisioning-LHC23r
266+
mExtraTimeShiftRunRanges.emplace_back(542280, 543854); // LHC23zv-LHC23zy
267+
mExtraTimeShiftRunRanges.emplace_back(559544, 559856); // PbPb 2024
253268
}
254269

255270
// void process(aod::Collision const& collision, soa::Filtered<aod::Tracks> const& fullTracks, aod::Calos const& cells)
@@ -268,6 +283,10 @@ struct EmcalCorrectionTask {
268283
std::unordered_map<uint64_t, int> numberCellsInBC; // Number of cells mapped to the global BC index of all BCs to check whether EMCal was readout
269284
for (const auto& bc : bcs) {
270285
LOG(debug) << "Next BC";
286+
287+
// get run number
288+
runNumber = bc.runNumber();
289+
271290
// Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer.
272291
// In particular, we need to filter only EMCAL cells.
273292

@@ -297,7 +316,7 @@ struct EmcalCorrectionTask {
297316
}
298317
cellsBC.emplace_back(cell.cellNumber(),
299318
amplitude,
300-
cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType())),
319+
cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), runNumber),
301320
o2::emcal::intToChannelType(cell.cellType()));
302321
cellIndicesBC.emplace_back(cell.globalIndex());
303322
}
@@ -396,6 +415,9 @@ struct EmcalCorrectionTask {
396415
// Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer.
397416
// In particular, we need to filter only EMCAL cells.
398417

418+
// get run number
419+
runNumber = bc.runNumber();
420+
399421
// Get the collisions matched to the BC using foundBCId of the collision
400422
auto collisionsInFoundBC = collisions.sliceBy(collisionsPerFoundBC, bc.globalIndex());
401423
auto cellsInBC = cells.sliceBy(mcCellsPerFoundBC, bc.globalIndex());
@@ -425,7 +447,7 @@ struct EmcalCorrectionTask {
425447
}
426448
cellsBC.emplace_back(cell.cellNumber(),
427449
amplitude,
428-
cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType())),
450+
cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), runNumber),
429451
o2::emcal::intToChannelType(cell.cellType()));
430452
cellIndicesBC.emplace_back(cell.globalIndex());
431453
cellLabels.emplace_back(cell.mcParticleIds(), cell.amplitudeA());
@@ -514,13 +536,18 @@ struct EmcalCorrectionTask {
514536
int previousCollisionId = 0; // Collision ID of the last unique BC. Needed to skip unordered collisions to ensure ordered collisionIds in the cluster table
515537
int nBCsProcessed = 0;
516538
int nCellsProcessed = 0;
539+
517540
for (const auto& bc : bcs) {
518541
LOG(debug) << "Next BC";
519542
// Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer.
520543
// In particular, we need to filter only EMCAL cells.
521544

522545
// Get the collisions matched to the BC using global bc index of the collision
523546
// since we do not have event selection available here!
547+
548+
// get run number
549+
runNumber = bc.runNumber();
550+
524551
auto collisionsInBC = collisions.sliceBy(collisionsPerBC, bc.globalIndex());
525552
auto cellsInBC = cells.sliceBy(cellsPerFoundBC, bc.globalIndex());
526553

@@ -536,7 +563,7 @@ struct EmcalCorrectionTask {
536563
for (const auto& cell : cellsInBC) {
537564
cellsBC.emplace_back(cell.cellNumber(),
538565
cell.amplitude(),
539-
cell.time() + getCellTimeShift(cell.cellNumber(), cell.amplitude(), o2::emcal::intToChannelType(cell.cellType())),
566+
cell.time() + getCellTimeShift(cell.cellNumber(), cell.amplitude(), o2::emcal::intToChannelType(cell.cellType()), runNumber),
540567
o2::emcal::intToChannelType(cell.cellType()));
541568
cellIndicesBC.emplace_back(cell.globalIndex());
542569
}
@@ -873,7 +900,7 @@ struct EmcalCorrectionTask {
873900
// Apply shift of the cell time in data and MC
874901
// In MC this has to be done to shift the cell time, which is not calibrated to 0 due to the flight time of the particles to the EMCal surface (~15ns)
875902
// In data this is done to correct for the time walk effect
876-
float getCellTimeShift(const int16_t cellID, const float cellEnergy, const emcal::ChannelType_t cellType)
903+
float getCellTimeShift(const int16_t cellID, const float cellEnergy, const emcal::ChannelType_t cellType, const int runNumber)
877904
{
878905
if (!applyCellTimeCorrection) {
879906
return 0.f;
@@ -909,6 +936,14 @@ struct EmcalCorrectionTask {
909936
else // Very high energy regime
910937
timeshift = 1.9; // Parameters extracted from LHC24aj (pp), but also usable for other periods
911938
}
939+
// Temporary extra shift for bug in time calibraiton of apass4 Pb-Pb 2024, requires pos shift of 2*8.8 ns for low gain cells
940+
if(cellType == emcal::ChannelType_t::LOW_GAIN){
941+
for(const auto& range : mExtraTimeShiftRunRanges){
942+
if(runNumber >= range.first && runNumber <= range.second){
943+
timeshift += 2 * 8.8;
944+
}
945+
}
946+
}
912947
LOG(debug) << "Shift the cell time by " << timeshift << " + " << timesmear << " ns";
913948
}
914949
return timeshift + timesmear;

0 commit comments

Comments
 (0)