Skip to content
4 changes: 2 additions & 2 deletions Common/TableProducer/PID/pidTPCBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code
{
switch (abs(pdgCode)) {

Check failure on line 51 in Common/TableProducer/PID/pidTPCBase.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 @@ -100,8 +100,8 @@
for (int i = 0; i < fMatrix.GetNrows(); i++) {
for (int j = 0; j < fMatrix.GetNcols(); j++) {
double param = fMatrix(i, j);
double value1 = i > static_cast<int>(vec1.size()) ? 0 : vec1[i];
double value2 = j > static_cast<int>(vec2.size()) ? 0 : vec2[j];
double value1 = i >= static_cast<int>(vec1.size()) ? 0 : vec1[i];
double value2 = j >= static_cast<int>(vec2.size()) ? 0 : vec2[j];
result += param * value1 * value2;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Common/TableProducer/eventSelection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@
// first bc of the first orbit
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
// duration of TF in bcs
nBCsPerTF = confNumberOfOrbitsPerTF < 0 ? runInfo.orbitsPerTF * nBCsPerOrbit : confNumberOfOrbitsPerTF * nBCsPerOrbit;
nBCsPerTF = confNumberOfOrbitsPerTF < 0 ? runInfo.orbitsPerTF * nBCsPerOrbit : static_cast<int64_t>(confNumberOfOrbitsPerTF) * nBCsPerOrbit;
if (strLPMProductionTag == "LHC25f3") // temporary workaround for MC production LHC25f3 anchored to Pb-Pb 2023 apass5 (to be removed once the info is in ccdb)
nBCsPerTF = 8 * nBCsPerOrbit;
nBCsPerTF = static_cast<int64_t>(8) * nBCsPerOrbit;
}

// timestamp of the middle of the run used to access run-wise CCDB entries
Expand Down Expand Up @@ -1373,15 +1373,15 @@
double perBcRateTCE = static_cast<double>(mCounterTCE[i + 1] - mCounterTCE[i]) / nOrbits / nCollidingBCs;
double perBcRateZNC = static_cast<double>(mCounterZNC[i + 1] - mCounterZNC[i]) / nOrbits / nCollidingBCs;
double perBcRateZEM = static_cast<double>(mCounterZEM[i + 1] - mCounterZEM[i]) / nOrbits / nCollidingBCs;
double muTVX = (perBcRateTVX < 1 && perBcRateTVX > 1e-10) ? -std::log(1 - perBcRateTVX) : 0;

Check failure on line 1376 in Common/TableProducer/eventSelection.cxx

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.
double muTCE = (perBcRateTCE < 1 && perBcRateTCE > 1e-10) ? -std::log(1 - perBcRateTCE) : 0;

Check failure on line 1377 in Common/TableProducer/eventSelection.cxx

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.
double muZNC = (perBcRateZNC < 1 && perBcRateZNC > 1e-10) ? -std::log(1 - perBcRateZNC) : 0;

Check failure on line 1378 in Common/TableProducer/eventSelection.cxx

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.
double muZEM = (perBcRateZEM < 1 && perBcRateZEM > 1e-10) ? -std::log(1 - perBcRateZEM) : 0;

Check failure on line 1379 in Common/TableProducer/eventSelection.cxx

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.
LOGP(debug, "orbit={} muTVX={} muTCE={} muZNC={} muZEM={}", mOrbits[i], muTVX, muTCE, muZNC, muZEM);
mPileupCorrectionTVX.push_back(muTVX > 1e-10 ? muTVX / (1 - std::exp(-muTVX)) : 1);

Check failure on line 1381 in Common/TableProducer/eventSelection.cxx

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.
mPileupCorrectionTCE.push_back(muTCE > 1e-10 ? muTCE / (1 - std::exp(-muTCE)) : 1);

Check failure on line 1382 in Common/TableProducer/eventSelection.cxx

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.
mPileupCorrectionZNC.push_back(muZNC > 1e-10 ? muZNC / (1 - std::exp(-muZNC)) : 1);

Check failure on line 1383 in Common/TableProducer/eventSelection.cxx

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.
mPileupCorrectionZEM.push_back(muZEM > 1e-10 ? muZEM / (1 - std::exp(-muZEM)) : 1);

Check failure on line 1384 in Common/TableProducer/eventSelection.cxx

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.
}
// filling last orbit range using previous orbit range
mPileupCorrectionTVX.push_back(mPileupCorrectionTVX.back());
Expand Down
3 changes: 0 additions & 3 deletions Common/TableProducer/selectionStudyTable.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
}

// handle resonances first to make sure phys prim crit does not reject them
if (mcPart.pdgCode() == 333) {

Check failure on line 76 in Common/TableProducer/selectionStudyTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
ptph.push_back(mcPart.pt());
}
if (std::abs(mcPart.pdgCode()) == 313) {
Expand Down Expand Up @@ -105,9 +105,6 @@
if (std::abs(mcPart.pdgCode()) == 3334) {
ptom.push_back(mcPart.pt());
}
if (std::abs(mcPart.pdgCode()) == 3334) {
ptom.push_back(mcPart.pt());
}
// inclusive HF for now
if (std::abs(mcPart.pdgCode()) == 421) {
ptd.push_back(mcPart.pt());
Expand Down
24 changes: 12 additions & 12 deletions Common/Tasks/qaMuon.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ struct muonQa {
for (size_t i = 0; i < 2; i++) {
std::string topBottom = (i == 0) ? "top" : "bottom";
AxisSpec deAxis = {26, 0, 26, "DE index"};
AxisSpec phiAxis = {16, -180, 180, "#phi (degrees)"};
AxisSpec phiAxisInner = {16, -180, 180, "#phi (degrees)"};
for (size_t j = 0; j < 2; j++) {
std::string sign = (j == 0) ? "positive" : "negative";
for (int chamber = 0; chamber < 10; chamber++) {
Expand All @@ -535,17 +535,17 @@ struct muonQa {
residualsHistosPerDE[i][j][chamber]["dx_vs_de"] = registryResidualsMFT.add((histPath + "dx_vs_de").c_str(), "Cluster x residual vs. DE index", {HistType::kTH2F, {deAxis, dxAxis}});
residualsHistosPerDE[i][j][chamber]["dy_vs_de"] = registryResidualsMFT.add((histPath + "dy_vs_de").c_str(), "Cluster y residual vs. DE index", {HistType::kTH2F, {deAxis, dxAxis}});

residualsHistosPerDE[i][j][chamber]["dx_vs_phi"] = registryResidualsMFT.add((histPath + "dx_vs_phi").c_str(), "Cluster x residual vs. cluster #phi", {HistType::kTH2F, {phiAxis, dxAxis}});
residualsHistosPerDE[i][j][chamber]["dy_vs_phi"] = registryResidualsMFT.add((histPath + "dy_vs_phi").c_str(), "Cluster y residual vs. cluster #phi", {HistType::kTH2F, {phiAxis, dxAxis}});
residualsHistosPerDE[i][j][chamber]["dx_vs_phi"] = registryResidualsMFT.add((histPath + "dx_vs_phi").c_str(), "Cluster x residual vs. cluster #phi", {HistType::kTH2F, {phiAxisInner, dxAxis}});
residualsHistosPerDE[i][j][chamber]["dy_vs_phi"] = registryResidualsMFT.add((histPath + "dy_vs_phi").c_str(), "Cluster y residual vs. cluster #phi", {HistType::kTH2F, {phiAxisInner, dxAxis}});

// mixed events
histPath = std::string("Alignment/mixed-event/Residuals/MFT/MFT_") + topBottom + "/" + sign + "/CH" + std::to_string(chamber + 1) + "/";
// Delta x and y at cluster
residualsHistosPerDEMixedEvents[i][j][chamber]["dx_vs_de"] = registryResidualsMFT.add((histPath + "dx_vs_de").c_str(), "Cluster x residual vs. DE index", {HistType::kTH2F, {deAxis, dxAxis}});
residualsHistosPerDEMixedEvents[i][j][chamber]["dy_vs_de"] = registryResidualsMFT.add((histPath + "dy_vs_de").c_str(), "Cluster y residual vs. DE index", {HistType::kTH2F, {deAxis, dxAxis}});

residualsHistosPerDEMixedEvents[i][j][chamber]["dx_vs_phi"] = registryResidualsMFT.add((histPath + "dx_vs_phi").c_str(), "Cluster x residual vs. cluster #phi", {HistType::kTH2F, {phiAxis, dxAxis}});
residualsHistosPerDEMixedEvents[i][j][chamber]["dy_vs_phi"] = registryResidualsMFT.add((histPath + "dy_vs_phi").c_str(), "Cluster y residual vs. cluster #phi", {HistType::kTH2F, {phiAxis, dxAxis}});
residualsHistosPerDEMixedEvents[i][j][chamber]["dx_vs_phi"] = registryResidualsMFT.add((histPath + "dx_vs_phi").c_str(), "Cluster x residual vs. cluster #phi", {HistType::kTH2F, {phiAxisInner, dxAxis}});
residualsHistosPerDEMixedEvents[i][j][chamber]["dy_vs_phi"] = registryResidualsMFT.add((histPath + "dy_vs_phi").c_str(), "Cluster y residual vs. cluster #phi", {HistType::kTH2F, {phiAxisInner, dxAxis}});
}
}
}
Expand Down Expand Up @@ -619,7 +619,7 @@ struct muonQa {
AxisSpec rAbsAxis = {10, 0., 100.0, "R_{abs} (cm)"};
AxisSpec dcaAxis = {400, -10.0, 10.0, "DCA"};
AxisSpec dcaAxisReduced = {40, -10.0, 10.0, "DCA"};
AxisSpec phiAxis = {36, -180.0, 180.0, "#phi (degrees)"};
AxisSpec phiAxisInner = {36, -180.0, 180.0, "#phi (degrees)"};
// dimuons
AxisSpec invMassAxis = {400, 1, 5, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"};
AxisSpec invMassCorrelationAxis = {80, 0, 8, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"};
Expand Down Expand Up @@ -682,8 +682,8 @@ struct muonQa {
registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} DCA", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxisReduced}});
registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} DCA", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxisReduced}});
//
registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}});
registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}});
registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxisInner}});
registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxisInner}});
}
// MCH-MID tracks with MCH acceptance cuts
registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_MuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}});
Expand Down Expand Up @@ -1607,8 +1607,8 @@ struct muonQa {
fgValues.dcaY = (propmuon.getY() - collision.y);
float dcaXY = std::sqrt(fgValues.dcaX * fgValues.dcaX + fgValues.dcaY * fgValues.dcaY);

mch::TrackParam trackParam = mch::TrackParam(muon.first());
float p = trackParam.p();
mch::TrackParam trackParamInner = mch::TrackParam(muon.first());
float p = trackParamInner.p();
fgValues.pDca = p * dcaXY;
}

Expand Down Expand Up @@ -1674,14 +1674,14 @@ struct muonQa {
// double pz = pMCH * cos(M_PI / 2 - atan(mft.tgl()));
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));

double chi2 = muon.chi2();
double chi2Inner = muon.chi2();
double signed1Pt = endPoint == kToDCA ? muon.signed1Pt() : sign / pt;
SMatrix5 tpars(muon.x(), muon.y(), muon.phi(), muon.tgl(), signed1Pt);
std::vector<double> v1{0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0};
SMatrix55 tcovs(v1.begin(), v1.end());
o2::track::TrackParCovFwd fwdtrack{muon.z(), tpars, tcovs, chi2};
o2::track::TrackParCovFwd fwdtrack{muon.z(), tpars, tcovs, chi2Inner};
track.setParameters(tpars);
track.setZ(fwdtrack.getZ());
track.setCovariances(tcovs);
Expand Down
15 changes: 8 additions & 7 deletions Common/Tools/EventSelectionModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,10 @@ class EventSelectionModule
diffVzParMean = *parMeans;
diffVzParSigma = *parSigmas;
LOGP(info, ">>> special treatment for diffVz for light ion run {}", runLightIons);
for (int i = 0; i < 5; i++)
LOGP(info, " mean par {} = {}", i, diffVzParMean[i]);
for (int i = 0; i < 5; i++)
LOGP(info, " sigma par {} = {}", i, diffVzParSigma[i]);
for (int j = 0; j < 5; j++)
LOGP(info, " mean par {} = {}", j, diffVzParMean[j]);
for (int j = 0; j < 5; j++)
LOGP(info, " sigma par {} = {}", j, diffVzParSigma[j]);
break;
}
}
Expand Down Expand Up @@ -1042,8 +1042,9 @@ class EventSelectionModule
}
}
}
} // end of if TOF-matched vertex
else { // for non-TOF and low-mult vertices, consider nearby nominal bcs
// end of if TOF-matched vertex
} else {
// for non-TOF and low-mult vertices, consider nearby nominal bcs
int64_t meanBC = globalBC + TMath::Nint(sumHighPtTime / sumHighPtW / bcNS);
int64_t bestGlobalBC = findBestGlobalBC(meanBC, evselOpts.confSigmaBCforHighPtTracks, vNcontributors[colIndex], col.posZ(), mapGlobalBcVtxZ);
if (bestGlobalBC > 0) {
Expand All @@ -1062,7 +1063,7 @@ class EventSelectionModule
foundBCindex = bc.globalIndex(); // keep original BC index
}
} // end of non-TOF matched vertices
// sanitity check: if BC was not found
// sanity check: if BC was not found
if (foundBCindex == -1) {
foundBCindex = bc.globalIndex();
}
Expand Down
36 changes: 16 additions & 20 deletions Common/Tools/PID/pidTPCModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ typedef struct Str_dEdx_correction {
for (int i = 0; i < fMatrix.GetNrows(); i++) {
for (int j = 0; j < fMatrix.GetNcols(); j++) {
double param = fMatrix(i, j);
double value1 = i > static_cast<int>(vec1.size()) ? 0 : vec1[i];
double value2 = j > static_cast<int>(vec2.size()) ? 0 : vec2[j];
double value1 = i >= static_cast<int>(vec1.size()) ? 0 : vec1[i];
double value2 = j >= static_cast<int>(vec2.size()) ? 0 : vec2[j];
result += param * value1 * value2;
}
}
Expand All @@ -201,14 +201,10 @@ typedef struct Str_dEdx_correction {
class pidTPCModule
{
public:
pidTPCModule()
{
// constructor
}
o2::aod::pid::pidTPCConfigurables pidTPCopts;

// TPC PID Response
o2::pid::tpc::Response* response;
o2::pid::tpc::Response* response{nullptr};

// Network correction for TPC PID response
ml::OnnxModel network;
Expand Down Expand Up @@ -237,13 +233,13 @@ class pidTPCModule
pidTPCopts = external_pidtpcopts;

if (pidTPCopts.useCorrecteddEdx.value) {
LOGF(info, "***************************************************");
LOGF(info, " WARNING: YOU HAVE SWITCHED ON 'corrected dEdx!");
LOGF(info, " This mode is still in development and it is meant");
LOGF(info, " ONLY FOR EXPERTS at this time. Please switch ");
LOGF(info, " this option off UNLESS you are absolutely SURE");
LOGF(info, " of what you're doing! You've been warned!");
LOGF(info, "***************************************************");
LOGF(warning, "***************************************************");
LOGF(warning, " WARNING: YOU HAVE SWITCHED ON 'corrected dEdx!");
LOGF(warning, " This mode is still in development and it is meant");
LOGF(warning, " ONLY FOR EXPERTS at this time. Please switch ");
LOGF(warning, " this option off UNLESS you are absolutely SURE");
LOGF(warning, " of what you're doing! You've been warned!");
LOGF(warning, "***************************************************");
}

if (pidTPCopts.skipTPCOnly.value == -1) {
Expand All @@ -262,7 +258,7 @@ class pidTPCModule
pidTPCopts.skipTPCOnly.value = 1;

// loop over devices in this execution
auto& workflows = context.services().template get<o2::framework::RunningWorkflowInfo const>();
auto const& workflows = context.services().template get<o2::framework::RunningWorkflowInfo const>();
for (o2::framework::DeviceSpec const& device : workflows.devices) {
// Look for propagation service
if (device.name.compare("propagation-service") == 0) {
Expand Down Expand Up @@ -544,7 +540,7 @@ class pidTPCModule
constexpr int ExpectedInputDimensionsNNV3 = 8;
constexpr auto NetworkVersionV2 = "2";
constexpr auto NetworkVersionV3 = "3";
for (int i = 0; i < NParticleTypes; i++) { // Loop over particle number for which network correction is used
for (int j = 0; j < NParticleTypes; j++) { // Loop over particle number for which network correction is used
for (auto const& trk : tracks) {
if (!trk.hasTPC()) {
continue;
Expand All @@ -557,7 +553,7 @@ class pidTPCModule
track_properties[counter_track_props] = trk.tpcInnerParam();
track_properties[counter_track_props + 1] = trk.tgl();
track_properties[counter_track_props + 2] = trk.signed1Pt();
track_properties[counter_track_props + 3] = o2::track::pid_constants::sMasses[i];
track_properties[counter_track_props + 3] = o2::track::pid_constants::sMasses[j];
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 == ExpectedInputDimensionsNNV2 && networkVersion == NetworkVersionV2) {
Expand Down Expand Up @@ -587,9 +583,9 @@ class pidTPCModule
float* output_network = network.evalModel(track_properties);
auto stop_network_eval = std::chrono::high_resolution_clock::now();
duration_network += std::chrono::duration<float, std::ratio<1, 1000000000>>(stop_network_eval - start_network_eval).count();
for (uint64_t i = 0; i < prediction_size; i += output_dimensions) {
for (int j = 0; j < output_dimensions; j++) {
network_prediction[i + j + prediction_size * loop_counter] = output_network[i + j];
for (uint64_t k = 0; k < prediction_size; k += output_dimensions) {
for (int l = 0; l < output_dimensions; l++) {
network_prediction[k + l + prediction_size * loop_counter] = output_network[k + l];
}
}

Expand Down
Loading