Skip to content

Commit c636c9b

Browse files
authored
TOF PID: dev process to speed up CPU (#1342)
* TOF PID: dev process to speed up CPU * Avoid Lambda * Fix
1 parent 89713d5 commit c636c9b

1 file changed

Lines changed: 88 additions & 2 deletions

File tree

Common/TableProducer/PID/pidTOFFull.cxx

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ struct tofPidFull {
7878

7979
void init(o2::framework::InitContext& initContext)
8080
{
81-
if (doprocessWSlice == true && doprocessWoSlice == true) {
82-
LOGF(fatal, "Cannot enable processWoSlice and processWSlice at the same time. Please choose one.");
81+
if (doprocessWSlice == true && doprocessWoSlice == true && doprocessWoSliceDev == true) {
82+
LOGF(fatal, "Cannot enable processWoSlice and processWSlice and doprocessWoSliceDev at the same time. Please choose one.");
83+
}
84+
if (doprocessWSlice == false && doprocessWoSlice == false && doprocessWoSliceDev == false) {
85+
LOGF(fatal, "Cannot run without any of processWoSlice and processWSlice and doprocessWoSliceDev enabled. Please choose one.");
8386
}
8487

8588
// Checking the tables are requested in the workflow and enabling them
@@ -293,6 +296,89 @@ struct tofPidFull {
293296
}
294297
}
295298
PROCESS_SWITCH(tofPidFull, processWoSlice, "Process without track slices", false);
299+
300+
void processWoSliceDev(Trks const& tracks, aod::Collisions const&, aod::BCsWithTimestamps const&)
301+
{
302+
constexpr auto responseEl = ResponseImplementation<PID::Electron>();
303+
constexpr auto responseMu = ResponseImplementation<PID::Muon>();
304+
constexpr auto responsePi = ResponseImplementation<PID::Pion>();
305+
constexpr auto responseKa = ResponseImplementation<PID::Kaon>();
306+
constexpr auto responsePr = ResponseImplementation<PID::Proton>();
307+
constexpr auto responseDe = ResponseImplementation<PID::Deuteron>();
308+
constexpr auto responseTr = ResponseImplementation<PID::Triton>();
309+
constexpr auto responseHe = ResponseImplementation<PID::Helium3>();
310+
constexpr auto responseAl = ResponseImplementation<PID::Alpha>();
311+
312+
#define doReserveTable(Particle) \
313+
if (pid##Particle.value == 1) { \
314+
tablePID##Particle.reserve(tracks.size()); \
315+
}
316+
317+
doReserveTable(El);
318+
doReserveTable(Mu);
319+
doReserveTable(Pi);
320+
doReserveTable(Ka);
321+
doReserveTable(Pr);
322+
doReserveTable(De);
323+
doReserveTable(Tr);
324+
doReserveTable(He);
325+
doReserveTable(Al);
326+
327+
#undef doReserveTable
328+
329+
int lastCollisionId = -1; // Last collision ID analysed
330+
for (auto const& track : tracks) { // Loop on all tracks
331+
if (!track.has_collision()) { // Track was not assigned, cannot compute NSigma (no event time) -> filling with empty table
332+
333+
#define doFillTableEmpty(Particle) \
334+
if (pid##Particle.value == 1) { \
335+
tablePID##Particle(-999.f, \
336+
-999.f); \
337+
}
338+
339+
doFillTableEmpty(El);
340+
doFillTableEmpty(Mu);
341+
doFillTableEmpty(Pi);
342+
doFillTableEmpty(Ka);
343+
doFillTableEmpty(Pr);
344+
doFillTableEmpty(De);
345+
doFillTableEmpty(Tr);
346+
doFillTableEmpty(He);
347+
doFillTableEmpty(Al);
348+
349+
#undef doFillTableEmpty
350+
351+
continue;
352+
}
353+
354+
if (enableTimeDependentResponse && (track.collisionId() != lastCollisionId)) { // Time dependent calib is enabled and this is a new collision
355+
lastCollisionId = track.collisionId(); // Cache last collision ID
356+
timestamp.value = track.collision().bc_as<aod::BCsWithTimestamps>().timestamp();
357+
LOG(debug) << "Updating parametrization from path '" << parametrizationPath << "' and timestamp " << timestamp.value;
358+
mRespParams.SetParameters(ccdb->getForTimeStamp<o2::pid::tof::TOFResoParams>(parametrizationPath, timestamp));
359+
}
360+
361+
// Check and fill enabled tables
362+
#define doFillTable(Particle) \
363+
if (pid##Particle.value == 1) { \
364+
tablePID##Particle(response##Particle.GetExpectedSigma(mRespParams, track), \
365+
response##Particle.GetSeparation(mRespParams, track)); \
366+
}
367+
368+
doFillTable(El);
369+
doFillTable(Mu);
370+
doFillTable(Pi);
371+
doFillTable(Ka);
372+
doFillTable(Pr);
373+
doFillTable(De);
374+
doFillTable(Tr);
375+
doFillTable(He);
376+
doFillTable(Al);
377+
378+
#undef doFillTable
379+
}
380+
}
381+
PROCESS_SWITCH(tofPidFull, processWoSliceDev, "Process without track slices dev", false);
296382
};
297383

298384
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)