Skip to content

Commit d807fe7

Browse files
jokonigjokonig
andauthored
PWGJE/EMCal: Add option to shift cluster time in MC (#8153)
Co-authored-by: jokonig <jokonig@cern.ch>
1 parent 22c125c commit d807fe7

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

PWGJE/TableProducer/emcalCorrectionTask.cxx

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct EmcalCorrectionTask {
8787
Configurable<float> exoticCellInCrossMinAmplitude{"exoticCellInCrossMinAmplitude", 0.1, "Minimum energy of cells in cross, if lower not considered in cross"};
8888
Configurable<bool> useWeightExotic{"useWeightExotic", false, "States if weights should be used for exotic cell cut"};
8989
Configurable<bool> isMC{"isMC", false, "States if run over MC"};
90+
Configurable<int> applyCellTimeShift{"applyCellTimeShift", 0, "apply shift to the cell time; 0 = off; 1 = const shift; 2 = eta-dependent shift"};
9091

9192
// Require EMCAL cells (CALO type 1)
9293
Filter emccellfilter = aod::calo::caloType == selectedCellType;
@@ -108,6 +109,9 @@ struct EmcalCorrectionTask {
108109
// QA
109110
o2::framework::HistogramRegistry mHistManager{"EMCALCorrectionTaskQAHistograms"};
110111

112+
// EMCal geometry
113+
o2::emcal::Geometry* geometry;
114+
111115
void init(InitContext const&)
112116
{
113117
LOG(debug) << "Start init!";
@@ -124,7 +128,7 @@ struct EmcalCorrectionTask {
124128
mCcdbManager->get<TGeoManager>("GLO/Config/Geometry");
125129
}
126130
LOG(debug) << "After load geometry!";
127-
o2::emcal::Geometry* geometry = o2::emcal::Geometry::GetInstanceFromRunNumber(223409);
131+
geometry = o2::emcal::Geometry::GetInstanceFromRunNumber(223409);
128132
if (!geometry) {
129133
LOG(error) << "Failure accessing geometry";
130134
}
@@ -175,6 +179,7 @@ struct EmcalCorrectionTask {
175179
using o2HistType = o2::framework::HistType;
176180
using o2Axis = o2::framework::AxisSpec;
177181
o2Axis energyAxis{200, 0., 100., "E (GeV)"},
182+
timeAxis{300, -100, 200., "t (ns)"},
178183
etaAxis{160, -0.8, 0.8, "#eta"},
179184
phiAxis{72, 0, 2 * 3.14159, "phi"};
180185
mHistManager.add("hCellE", "hCellE", o2HistType::kTH1F, {energyAxis});
@@ -184,6 +189,7 @@ struct EmcalCorrectionTask {
184189
mHistManager.add("hCellRowCol", "hCellRowCol;Column;Row", o2HistType::kTH2D, {{97, 0, 97}, {600, 0, 600}});
185190
mHistManager.add("hClusterE", "hClusterE", o2HistType::kTH1F, {energyAxis});
186191
mHistManager.add("hClusterEtaPhi", "hClusterEtaPhi", o2HistType::kTH2F, {etaAxis, phiAxis});
192+
mHistManager.add("hClusterTime", "hClusterTime", o2HistType::kTH1F, {timeAxis});
187193
mHistManager.add("hGlobalTrackEtaPhi", "hGlobalTrackEtaPhi", o2HistType::kTH2F, {etaAxis, phiAxis});
188194
mHistManager.add("hGlobalTrackMult", "hGlobalTrackMult", o2HistType::kTH1D, {{200, -0.5, 199.5, "N_{trk}"}});
189195
mHistManager.add("hCollisionType", "hCollisionType;;#it{count}", o2HistType::kTH1D, {{3, -0.5, 2.5}});
@@ -258,7 +264,7 @@ struct EmcalCorrectionTask {
258264
}
259265
cellsBC.emplace_back(cell.cellNumber(),
260266
amplitude,
261-
cell.time(),
267+
cell.time() + getCellTimeShift(cell.cellNumber()),
262268
o2::emcal::intToChannelType(cell.cellType()));
263269
cellIndicesBC.emplace_back(cell.globalIndex());
264270
}
@@ -377,7 +383,7 @@ struct EmcalCorrectionTask {
377383
}
378384
cellsBC.emplace_back(cell.cellNumber(),
379385
amplitude,
380-
cell.time(),
386+
cell.time() + getCellTimeShift(cell.cellNumber()),
381387
o2::emcal::intToChannelType(cell.cellType()));
382388
cellIndicesBC.emplace_back(cell.globalIndex());
383389
cellLabels.emplace_back(cell.mcParticleIds(), cell.amplitudeA());
@@ -479,7 +485,7 @@ struct EmcalCorrectionTask {
479485
for (auto& cell : cellsInBC) {
480486
cellsBC.emplace_back(cell.cellNumber(),
481487
cell.amplitude(),
482-
cell.time(),
488+
cell.time() + getCellTimeShift(cell.cellNumber()),
483489
o2::emcal::intToChannelType(cell.cellType()));
484490
cellIndicesBC.emplace_back(cell.globalIndex());
485491
}
@@ -618,6 +624,7 @@ struct EmcalCorrectionTask {
618624
} // end of cells of cluser loop
619625
// fill histograms
620626
mHistManager.fill(HIST("hClusterE"), cluster.E());
627+
mHistManager.fill(HIST("hClusterTime"), cluster.getClusterTime());
621628
mHistManager.fill(HIST("hClusterEtaPhi"), pos.Eta(), TVector2::Phi_0_2pi(pos.Phi()));
622629
if (IndexMapPair && trackGlobalIndex) {
623630
for (unsigned int iTrack = 0; iTrack < std::get<0>(*IndexMapPair)[iCluster].size(); iTrack++) {
@@ -670,7 +677,7 @@ struct EmcalCorrectionTask {
670677
clustercellsambiguous(clustersAmbiguous.lastIndex(),
671678
cellIndicesBC[cellindex]);
672679
} // end of cells of cluster loop
673-
} // end of cluster loop
680+
} // end of cluster loop
674681
}
675682

676683
template <typename Collision>
@@ -782,6 +789,30 @@ struct EmcalCorrectionTask {
782789
return 1.f;
783790
}
784791
}
792+
793+
// Apply shift of the cell time
794+
// This has to be done to shift the cell time in MC (which is not calibrated to 0 due to the flight time of the particles to the EMCal surface (~15ns))
795+
float getCellTimeShift(const int16_t cellID)
796+
{
797+
if (isMC) {
798+
if (applyCellTimeShift == 1) { // constant shift
799+
LOG(debug) << "shift the cell time by 15ns";
800+
return -15.f; // roughly calculated by assuming particles travel with v=c (photons) and EMCal is 4.4m away from vertex
801+
} else if (applyCellTimeShift == 2) { // eta dependent shift ( as larger eta values are further away from collision point)
802+
// Use distance between vertex and EMCal (at eta = 0) and distance on EMCal surface (cell size times column) to calculate distance to cell
803+
// 0.2 is cell size in m (0.06) divided by the speed of light in m/ns (0.3)
804+
// 47.5 is the "middle" of the EMCal (2*48 cells in one column)
805+
float timeCol = 0.2f * (geometry->GlobalCol(cellID) - 47.5f); // calculate time to get to specific column
806+
float time = -sqrt(215.f + timeCol * timeCol); // 215 is 14.67ns^2 (time it takes to get the cell at eta = 0)
807+
LOG(debug) << "shift the cell time by " << time << " applyCellTimeShift " << applyCellTimeShift;
808+
return time;
809+
} else {
810+
return 0.f;
811+
}
812+
} else { // data
813+
return 0.f;
814+
}
815+
}
785816
};
786817

787818
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)