Skip to content

Commit 064fdda

Browse files
committed
Fixes
1 parent fe8b929 commit 064fdda

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

‎ALICE3/Core/FlatTrackSmearer.cxx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
112112
LOGF(error, "LUT header PDG mismatch: expected %d, got %d; not loading", pdg, header.pdg);
113113
return false;
114114
}
115-
} catch (framework::RuntimeErrorRef ref) {
115+
} catch (framework::RuntimeErrorRef& ref) {
116116
LOGF(error, "%s", framework::error_from_ref(ref).what);
117117
return false;
118118
}
@@ -136,7 +136,7 @@ bool TrackSmearer::adoptTable(int pdg, const uint8_t* buffer, size_t size, bool
136136
return false;
137137
}
138138
mLUTData[ipdg] = FlatLutData::AdoptFromBuffer(buffer, size);
139-
} catch (framework::RuntimeErrorRef ref) {
139+
} catch (framework::RuntimeErrorRef& ref) {
140140
LOGF(error, "%s", framework::error_from_ref(ref).what);
141141
}
142142

@@ -159,7 +159,7 @@ bool TrackSmearer::viewTable(int pdg, const uint8_t* buffer, size_t size, bool f
159159
return false;
160160
}
161161
mLUTData[ipdg] = FlatLutData::ViewFromBuffer(buffer, size);
162-
} catch (framework::RuntimeErrorRef ref) {
162+
} catch (framework::RuntimeErrorRef& ref) {
163163
LOGF(error, "%s", framework::error_from_ref(ref).what);
164164
}
165165

‎ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct OnTheFlyRichPid {
7878
Produces<aod::UpgradeRichSignal> upgradeRichSignal;
7979

8080
// necessary for particle charges
81-
Service<o2::framework::O2DatabasePDG> pdg{};
81+
Service<o2::framework::O2DatabasePDG> pdgDatabase{};
8282
// Necessary for LUTs
8383
Service<o2::ccdb::BasicCCDBManager> ccdb{};
8484

@@ -359,19 +359,19 @@ struct OnTheFlyRichPid {
359359
histos.add("hSectorID", "hSectorID", kTH1F, {axisSector});
360360

361361
const int kNspec = 9; // electron, muon, pion, kaon, proton, deuteron, triton, helium3, alpha
362-
std::string particleNames1[kNspec] = {"#it{e}", "#it{#mu}", "#it{#pi}", "#it{K}", "#it{p}", "#it{d}", "#it{t}", "^{3}He", "#it{#alpha}"};
363-
std::string particleNames2[kNspec] = {"Elec", "Muon", "Pion", "Kaon", "Prot", "Deut", "Trit", "He3", "Al"};
362+
const std::array<std::string, kNspec> particleNames1 = {"#it{e}", "#it{#mu}", "#it{#pi}", "#it{K}", "#it{p}", "#it{d}", "#it{t}", "^{3}He", "#it{#alpha}"};
363+
const std::array<std::string, kNspec> particleNames2 = {"Elec", "Muon", "Pion", "Kaon", "Prot", "Deut", "Trit", "He3", "Al"};
364364
for (int iTrue = 0; iTrue < kNspec; iTrue++) {
365-
std::string nameTitleBarrelTrackRes = "h2dBarrelAngularResTrack" + particleNames2[iTrue] + "VsP";
366-
std::string nameTitleBarrelTotalRes = "h2dBarrelAngularResTotal" + particleNames2[iTrue] + "VsP";
365+
const std::string nameTitleBarrelTrackRes = "h2dBarrelAngularResTrack" + particleNames2[iTrue] + "VsP";
366+
const std::string nameTitleBarrelTotalRes = "h2dBarrelAngularResTotal" + particleNames2[iTrue] + "VsP";
367367
const AxisSpec axisTrackAngularRes{static_cast<int>(nBinsAngularRes), 0.0f, +5.0f, "Track angular resolution - " + particleNames1[iTrue] + " (mrad)"};
368368
const AxisSpec axisTotalAngularRes{static_cast<int>(nBinsAngularRes), 0.0f, +5.0f, "Total angular resolution - " + particleNames1[iTrue] + " (mrad)"};
369369
histos.add(nameTitleBarrelTrackRes.c_str(), nameTitleBarrelTrackRes.c_str(), kTH2F, {axisMomentum, axisTrackAngularRes});
370370
histos.add(nameTitleBarrelTotalRes.c_str(), nameTitleBarrelTotalRes.c_str(), kTH2F, {axisMomentum, axisTotalAngularRes});
371371
}
372372
for (int iTrue = 0; iTrue < kNspec; iTrue++) {
373373
for (int iHyp = 0; iHyp < kNspec; iHyp++) {
374-
std::string nameTitle = "h2dBarrelNsigmaTrue" + particleNames2[iTrue] + "Vs" + particleNames2[iHyp] + "Hypothesis";
374+
const std::string nameTitle = "h2dBarrelNsigmaTrue" + particleNames2[iTrue] + "Vs" + particleNames2[iHyp] + "Hypothesis";
375375
if (iTrue == iHyp) {
376376
const AxisSpec axisNsigmaCorrect{static_cast<int>(nBinsNsigmaCorrectSpecies), -10.0f, +10.0f, "N#sigma - True " + particleNames1[iTrue] + " vs " + particleNames1[iHyp] + " hypothesis"};
377377
histos.add(nameTitle.c_str(), nameTitle.c_str(), kTH2F, {axisMomentum, axisNsigmaCorrect});
@@ -578,9 +578,9 @@ struct OnTheFlyRichPid {
578578
// float zSecTof = detCenters[iSecor].Z();
579579
const float rSecRichSquared = rSecRich * rSecRich;
580580
const float zSecRichSquared = zSecRich * zSecRich;
581-
const float radiusRipple = (rSecRichSquared + zSecRichSquared) / (rSecRich + zSecRich / std::tan(polar));
582-
const float zRipple = radiusRipple / std::tan(polar);
583-
const float absZ = std::hypot(radiusRipple - rSecRich, zRipple - zSecRich);
581+
const float radRipple = (rSecRichSquared + zSecRichSquared) / (rSecRich + zSecRich / std::tan(polar));
582+
const float zRipple = radRipple / std::tan(polar);
583+
const float absZ = std::hypot(radRipple - rSecRich, zRipple - zSecRich);
584584
float fraction = 1.;
585585
if (tileZlength / 2. - absZ < radius) {
586586
fraction = fraction - (1. / o2::constants::math::PI) * std::acos((tileZlength / 2. - absZ) / radius);
@@ -727,7 +727,7 @@ struct OnTheFlyRichPid {
727727
// First we compute the number of charged particles in the event
728728
float dNdEta = 0.f;
729729
if (flagRICHLoadDelphesLUTs) {
730-
for (const auto& track : tracks) {
730+
for (const auto& track : tracks) { // We first compute the number of charged particles in the event
731731
if (!track.has_mcParticle()) {
732732
continue;
733733
}
@@ -738,7 +738,7 @@ struct OnTheFlyRichPid {
738738
if (mcParticle.has_daughters()) {
739739
continue;
740740
}
741-
const auto& pdgInfo = pdg->GetParticle(mcParticle.pdgCode());
741+
const auto& pdgInfo = pdgDatabase->GetParticle(mcParticle.pdgCode());
742742
if (!pdgInfo) {
743743
// LOG(warning) << "PDG code " << mcParticle.pdgCode() << " not found in the database";
744744
continue;
@@ -772,7 +772,7 @@ struct OnTheFlyRichPid {
772772
}
773773

774774
// get particle to calculate Cherenkov angle and resolution
775-
auto pdgInfo = pdg->GetParticle(mcParticle.pdgCode());
775+
const& auto pdgInfo = pdgDatabase->GetParticle(mcParticle.pdgCode());
776776
if (pdgInfo == nullptr) {
777777
fillDummyValues();
778778
continue;

‎ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct OnTheFlyTofPid {
7979
Produces<aod::UpgradeTofShortLived> upgradeTofShortLived;
8080

8181
// necessary for particle charges
82-
Service<o2::framework::O2DatabasePDG> pdg{};
82+
Service<o2::framework::O2DatabasePDG> pdgDatabase{};
8383
// Necessary for LUTs
8484
Service<o2::ccdb::BasicCCDBManager> ccdb{};
8585

@@ -567,7 +567,7 @@ struct OnTheFlyTofPid {
567567

568568
// Todo: check the different mass hypothesis iteratively
569569
for (const auto& track : tracks) {
570-
auto pdgInfo = pdg->GetParticle(track.mPdgCode);
570+
auto pdgInfo = pdgDatabase->GetParticle(track.mPdgCode);
571571
if (pdgInfo == nullptr) {
572572
continue;
573573
}
@@ -626,12 +626,12 @@ struct OnTheFlyTofPid {
626626
{
627627
// Compute tracking contribution to timing using the error propagation formula
628628
// Uses light speed in m/ps, magnetic field in T (*0.1 for conversion kGauss -> T)
629-
double a0 = mass * mass;
630-
double a1 = 0.299792458 * (0.1 * magneticField) * (0.01 * o2::constants::physics::LightSpeedCm2NS / 1e+3);
631-
double a2 = (detRadius * 0.01) * (detRadius * 0.01) * (0.299792458) * (0.299792458) * (0.1 * magneticField) * (0.1 * magneticField) / 2.0;
632-
double dtofOndPt = (std::pow(pt, 4) * std::pow(std::cosh(eta), 2) * std::acos(1.0 - a2 / std::pow(pt, 2)) - 2.0 * a2 * std::pow(pt, 2) * (a0 + std::pow(pt * std::cosh(eta), 2)) / std::sqrt(a2 * (2.0 * std::pow(pt, 2) - a2))) / (a1 * std::pow(pt, 3) * std::sqrt(a0 + std::pow(pt * std::cosh(eta), 2)));
633-
double dtofOndEta = std::pow(pt, 2) * std::sinh(eta) * std::cosh(eta) * std::acos(1.0 - a2 / std::pow(pt, 2)) / (a1 * std::sqrt(a0 + std::pow(pt * std::cosh(eta), 2)));
634-
double trackTimeResolution = std::hypot(std::fabs(dtofOndPt) * trackPtResolution, std::fabs(dtofOndEta) * trackEtaResolution);
629+
const double a0 = 1.0 * mass * mass;
630+
const double a1 = 0.299792458 * (0.1 * magneticField) * (0.01 * o2::constants::physics::LightSpeedCm2NS / 1e+3);
631+
const double a2 = (detRadius * 0.01) * (detRadius * 0.01) * (0.299792458) * (0.299792458) * (0.1 * magneticField) * (0.1 * magneticField) / 2.0;
632+
const double dtofOndPt = (std::pow(pt, 4) * std::pow(std::cosh(eta), 2) * std::acos(1.0 - a2 / std::pow(pt, 2)) - 2.0 * a2 * std::pow(pt, 2) * (a0 + std::pow(pt * std::cosh(eta), 2)) / std::sqrt(a2 * (2.0 * std::pow(pt, 2) - a2))) / (a1 * std::pow(pt, 3) * std::sqrt(a0 + std::pow(pt * std::cosh(eta), 2)));
633+
const double dtofOndEta = std::pow(pt, 2) * std::sinh(eta) * std::cosh(eta) * std::acos(1.0 - a2 / std::pow(pt, 2)) / (a1 * std::sqrt(a0 + std::pow(pt * std::cosh(eta), 2)));
634+
const double trackTimeResolution = std::hypot(std::fabs(dtofOndPt) * trackPtResolution, std::fabs(dtofOndEta) * trackEtaResolution);
635635
return trackTimeResolution;
636636
}
637637

@@ -667,7 +667,7 @@ struct OnTheFlyTofPid {
667667
if (mcParticle.has_daughters()) {
668668
continue;
669669
}
670-
const auto& pdgInfo = pdg->GetParticle(mcParticle.pdgCode());
670+
const auto& pdgInfo = pdgDatabase->GetParticle(mcParticle.pdgCode());
671671
if (!pdgInfo) {
672672
// LOG(warning) << "PDG code " << mcParticle.pdgCode() << " not found in the database";
673673
continue;

0 commit comments

Comments
 (0)