From 46108aa637c071fe0459148f95472465f3489e07 Mon Sep 17 00:00:00 2001 From: Ana Marin Date: Thu, 14 Aug 2025 00:26:55 +0200 Subject: [PATCH 1/4] DPG: to use NN including Hadronic Rate in the training, mitigation of run by run variations --- Common/TableProducer/PID/CMakeLists.txt | 2 +- Common/TableProducer/PID/pidTPC.cxx | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Common/TableProducer/PID/CMakeLists.txt b/Common/TableProducer/PID/CMakeLists.txt index e0ea2d40ab3..86787fd13b7 100644 --- a/Common/TableProducer/PID/CMakeLists.txt +++ b/Common/TableProducer/PID/CMakeLists.txt @@ -55,7 +55,7 @@ o2physics_add_dpl_workflow(pid-tpc-base o2physics_add_dpl_workflow(pid-tpc SOURCES pidTPC.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase O2Physics::AnalysisCCDB O2Physics::MLCore COMPONENT_NAME Analysis) # HMPID diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index e9c2015afbc..3bb5113a132 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -37,6 +37,7 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTPC.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Tools/ML/model.h" #include "CCDB/BasicCCDBManager.h" @@ -151,7 +152,9 @@ struct tpcPid { Configurable useNetworkAl{"useNetworkAl", 1, {"Switch for applying neural network on the alpha mass hypothesis (if network enabled) (set to 0 to disable)"}}; Configurable networkBetaGammaCutoff{"networkBetaGammaCutoff", 0.45, {"Lower value of beta-gamma to override the NN application"}}; Configurable networkInputBatchedMode{"networkInputBatchedMode", -1, {"-1: Takes all tracks, >0: Takes networkInputBatchedMode number of tracks at once"}}; - + Configurable irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; + ctpRateFetcher mRateFetcher; + // Parametrization configuration bool useCCDBParam = false; std::vector track_properties; @@ -400,6 +403,16 @@ struct tpcPid { if (input_dimensions == 7 && networkVersion == "2") { track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; } + if (input_dimensions == 8 && networkVersion == "3") { + if(trk.has_collision()){ + auto trk_bc = (collisions.iteratorAt(trk.collisionId())).template bc_as(); + float hadronicRate = mRateFetcher.fetch(ccdb.service, trk_bc.timestamp(), trk_bc.runNumber(), irSource) * 1.e-3; + track_properties[counter_track_props + 7] = hadronicRate/50.; + }else{ + track_properties[counter_track_props + 7] =1; + } + } + counter_track_props += input_dimensions; in_batch_counter++; total_input_count++; From bf6689e7fda566591be239b23e7d4eee4a573a65 Mon Sep 17 00:00:00 2001 From: Ana Marin Date: Fri, 15 Aug 2025 19:22:32 +0200 Subject: [PATCH 2/4] [Common] Fixing formatting errors --- Common/TableProducer/PID/pidTPC.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index 3bb5113a132..7e5dc7cf95e 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -154,7 +154,6 @@ struct tpcPid { Configurable networkInputBatchedMode{"networkInputBatchedMode", -1, {"-1: Takes all tracks, >0: Takes networkInputBatchedMode number of tracks at once"}}; Configurable irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; ctpRateFetcher mRateFetcher; - // Parametrization configuration bool useCCDBParam = false; std::vector track_properties; @@ -404,12 +403,12 @@ struct tpcPid { track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; } if (input_dimensions == 8 && networkVersion == "3") { - if(trk.has_collision()){ + if (trk.has_collision()) { auto trk_bc = (collisions.iteratorAt(trk.collisionId())).template bc_as(); float hadronicRate = mRateFetcher.fetch(ccdb.service, trk_bc.timestamp(), trk_bc.runNumber(), irSource) * 1.e-3; - track_properties[counter_track_props + 7] = hadronicRate/50.; + track_properties[counter_track_props + 7] = hadronicRate / 50.; }else{ - track_properties[counter_track_props + 7] =1; + track_properties[counter_track_props + 7] = 1; } } From e02c9c4bf80d2c528f2294778c925ad2add96a64 Mon Sep 17 00:00:00 2001 From: Ana Marin Date: Fri, 15 Aug 2025 20:06:40 +0200 Subject: [PATCH 3/4] [Common] Fixing formatting errors --- Common/TableProducer/PID/pidTPC.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index 7e5dc7cf95e..267e0e5c5d1 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -407,7 +407,7 @@ struct tpcPid { auto trk_bc = (collisions.iteratorAt(trk.collisionId())).template bc_as(); float hadronicRate = mRateFetcher.fetch(ccdb.service, trk_bc.timestamp(), trk_bc.runNumber(), irSource) * 1.e-3; track_properties[counter_track_props + 7] = hadronicRate / 50.; - }else{ + } else { track_properties[counter_track_props + 7] = 1; } } From d205d5bad5f2c6279d2e0588c80e4a3880329047 Mon Sep 17 00:00:00 2001 From: Ana Marin Date: Fri, 15 Aug 2025 20:10:54 +0200 Subject: [PATCH 4/4] [Common] Fixing formatting errors --- Common/TableProducer/PID/pidTPC.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index 267e0e5c5d1..7f95b39e5a0 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -33,11 +33,11 @@ #include "TableHelper.h" #include "pidTPCBase.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/PID/TPCPIDResponse.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTPC.h" -#include "Common/CCDB/ctpRateFetcher.h" #include "Tools/ML/model.h" #include "CCDB/BasicCCDBManager.h"