Skip to content

Commit 02b17da

Browse files
author
Ana Marin
committed
Changes for testing TPC PID NN v3
1 parent 64b8ebe commit 02b17da

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Common/Tools/PID/pidTPCModule.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ struct pidTPCConfigurables : o2::framework::ConfigurableGroup {
127127
o2::framework::Configurable<int> useNetworkHe{"useNetworkHe", 1, {"Switch for applying neural network on the helium3 mass hypothesis (if network enabled) (set to 0 to disable)"}};
128128
o2::framework::Configurable<int> useNetworkAl{"useNetworkAl", 1, {"Switch for applying neural network on the alpha mass hypothesis (if network enabled) (set to 0 to disable)"}};
129129
o2::framework::Configurable<float> networkBetaGammaCutoff{"networkBetaGammaCutoff", 0.45, {"Lower value of beta-gamma to override the NN application"}};
130+
o2::framework::Configurable<std::string> irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
130131
};
131132

132133
// helper getter - FIXME should be separate
@@ -432,6 +433,8 @@ class pidTPCModule
432433
// Filling a std::vector<float> to be evaluated by the network
433434
// Evaluation on single tracks brings huge overhead: Thus evaluation is done on one large vector
434435
for (int i = 0; i < 9; i++) { // Loop over particle number for which network correction is used
436+
float hadronicRate = 0.;
437+
uint64_t timeStamp_bcOld = 0;
435438
for (auto const& trk : tracks) {
436439
if (!trk.hasTPC()) {
437440
continue;
@@ -450,9 +453,22 @@ class pidTPCModule
450453
if (input_dimensions == 7 && networkVersion == "2") {
451454
track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.;
452455
}
456+
if (input_dimensions == 8 && networkVersion == "3") {
457+
track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.;
458+
if (trk.has_collision()) {
459+
auto trk_bc = (collisions.iteratorAt(trk.collisionId())).template bc_as<B>();
460+
if (trk_bc.timestamp() != timeStamp_bcOld){
461+
hadronicRate = mRateFetcher.fetch(ccdb.service, trk_bc.timestamp(), trk_bc.runNumber(), pidTPCopts.irSource.value) * 1.e-3;
462+
}
463+
timeStamp_bcOld=trk_bc.timestamp();
464+
track_properties[counter_track_props + 7] = hadronicRate / 50.;
465+
} else {
466+
track_properties[counter_track_props + 7] = 1;
467+
}
468+
}
453469
counter_track_props += input_dimensions;
454470
}
455-
471+
456472
auto start_network_eval = std::chrono::high_resolution_clock::now();
457473
float* output_network = network.evalModel(track_properties);
458474
auto stop_network_eval = std::chrono::high_resolution_clock::now();

0 commit comments

Comments
 (0)