Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions Common/TableProducer/PID/pidTPCModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
// helper getter - FIXME should be separate
int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code
{
switch (abs(pdgCode)) {

Check failure on line 138 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
case 11:
return o2::track::PID::Electron;
case 13:
Expand Down Expand Up @@ -434,7 +434,7 @@

// Filling a std::vector<float> to be evaluated by the network
// Evaluation on single tracks brings huge overhead: Thus evaluation is done on one large vector
for (int i = 0; i < 9; i++) { // Loop over particle number for which network correction is used

Check failure on line 437 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
for (auto const& trk : tracks) {
if (!trk.hasTPC()) {
continue;
Expand All @@ -450,7 +450,7 @@
track_properties[counter_track_props + 3] = o2::track::pid_constants::sMasses[i];
track_properties[counter_track_props + 4] = trk.has_collision() ? mults[trk.collisionId()] / 11000. : 1.;
track_properties[counter_track_props + 5] = std::sqrt(nNclNormalization / trk.tpcNClsFound());
if (input_dimensions == 7 && networkVersion == "2") {

Check failure on line 453 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.;
}
counter_track_props += input_dimensions;
Expand Down Expand Up @@ -519,10 +519,10 @@
// For now only the option 2: sigma will be used. The other options are kept if there would be demand later on
if (network.getNumOutputNodes() == 1) { // Expected mean correction; no sigma correction
nSigma = (tpcSignal - network_prediction[count_tracks + tracksForNet_size * pid] * expSignal) / expSigma;
} else if (network.getNumOutputNodes() == 2) { // Symmetric sigma correction

Check failure on line 522 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
expSigma = (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) * expSignal;
nSigma = (tpcSignal / expSignal - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]);
} else if (network.getNumOutputNodes() == 3) { // Asymmetric sigma corection

Check failure on line 525 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (tpcSignal / expSignal >= network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) {
expSigma = (network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) * expSignal;
nSigma = (tpcSignal / expSignal - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]);
Expand Down Expand Up @@ -633,6 +633,18 @@

// if corrected dE/dx is requested, correct it here on the spot and use that
if (pidTPCopts.useCorrecteddEdx) {

//_________________________________________________________
// bypass TPC signal in case TracksQA information present
if constexpr (soa::is_table<TTracksQA>) {
tpcSignalToEvaluatePID = -999.f;
if (indexTrack2TrackQA[trk.globalIndex()] != -1) {
auto trackQA = tracksQA.rawIteratorAt(indexTrack2TrackQA[trk.globalIndex()]);
tpcSignalToEvaluatePID = trackQA.tpcdEdxNorm();
}
}
//_________________________________________________________

double hadronicRate;
int occupancy;
if (trk.has_collision()) {
Expand All @@ -648,12 +660,12 @@
occupancy = 0;
}

float fTPCSignal = trk.tpcSignal();
float fTPCSignal = tpcSignalToEvaluatePID;
float fNormMultTPC = multTPC / 11000.;

float fTrackOccN = occupancy / 1000.;
float fOccTPCN = fNormMultTPC * 10; //(fNormMultTPC*10).clip(0,12)
if (fOccTPCN > 12)

Check failure on line 668 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
fOccTPCN = 12;
else if (fOccTPCN < 0)
fOccTPCN = 0;
Expand All @@ -664,9 +676,9 @@
float a1pt2 = a1pt * a1pt;
float atgl = std::abs(trk.tgl());
float mbb0R = 50 / fTPCSignal;
if (mbb0R > 1.05)

Check failure on line 679 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mbb0R = 1.05;
else if (mbb0R < 0.05)

Check failure on line 681 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mbb0R = 0.05;
// float mbb0R = max(0.05, min(50 / fTPCSignal, 1.05));
float a1ptmbb0R = a1pt * mbb0R;
Expand All @@ -678,9 +690,9 @@
float fTPCSignalN_CR0 = str_dedx_correction.fReal_fTPCSignalN(vec_occu, vec_track);

float mbb0R1 = 50 / (fTPCSignal / fTPCSignalN_CR0);
if (mbb0R1 > 1.05)

Check failure on line 693 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mbb0R1 = 1.05;
else if (mbb0R1 < 0.05)

Check failure on line 695 in Common/TableProducer/PID/pidTPCModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mbb0R1 = 0.05;

std::vector<float> vec_track1 = {mbb0R1, a1pt, atgl, atgl * mbb0R1, a1pt * mbb0R1, side, a1pt2};
Expand All @@ -689,17 +701,6 @@
// change the signal used for PID
tpcSignalToEvaluatePID = fTPCSignal / fTPCSignalN_CR1;

//_________________________________________________________
// bypass TPC signal in case TracksQA information present
if constexpr (soa::is_table<TTracksQA>) {
tpcSignalToEvaluatePID = -999.f;
if (indexTrack2TrackQA[trk.globalIndex()] != -1) {
auto trackQA = tracksQA.rawIteratorAt(indexTrack2TrackQA[trk.globalIndex()]);
tpcSignalToEvaluatePID = trackQA.tpcdEdxNorm();
}
}
//_________________________________________________________

if (pidTPCopts.savedEdxsCorrected) {
// populated cursor if requested or autodetected
products.dEdxCorrected(tpcSignalToEvaluatePID);
Expand Down
Loading