Skip to content
Merged
Show file tree
Hide file tree
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
28 changes: 27 additions & 1 deletion ALICE3/DataModel/OTFTOF.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
DECLARE_SOA_COLUMN(OuterTOFTrackTime, outerTOFTrackTime, float); //! Track time generated at the OuterTOF
DECLARE_SOA_COLUMN(OuterTOFTrackLength, outerTOFTrackLength, float); //! track length for calculation of OuterTOF (generated)

DECLARE_SOA_COLUMN(TOFEventTime, tofEventTime, float); //! Event time reconstructed with the TOF

Check failure on line 35 in ALICE3/DataModel/OTFTOF.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TOFEventTimeErr, tofEventTimeErr, float); //! Uncertainty on the event time reconstructed with the TOF

Check failure on line 36 in ALICE3/DataModel/OTFTOF.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(NSigmaElectronInnerTOF, nSigmaElectronInnerTOF, float); //! NSigma electron InnerTOF
DECLARE_SOA_COLUMN(NSigmaMuonInnerTOF, nSigmaMuonInnerTOF, float); //! NSigma muon InnerTOF
DECLARE_SOA_COLUMN(NSigmaPionInnerTOF, nSigmaPionInnerTOF, float); //! NSigma pion InnerTOF
Expand All @@ -41,13 +41,26 @@
DECLARE_SOA_COLUMN(NSigmaProtonInnerTOF, nSigmaProtonInnerTOF, float); //! NSigma proton InnerTOF
DECLARE_SOA_COLUMN(InnerTOFTrackTimeReco, innerTOFTrackTimeReco, float); //! Track time measured at the InnerTOF
DECLARE_SOA_COLUMN(InnerTOFTrackLengthReco, innerTOFTrackLengthReco, float); //! track length for calculation of InnerTOF (reconstructed)

DECLARE_SOA_COLUMN(InnerTOFExpectedTimeEl, innerTOFExpectedTimeEl, float); //! Reconstructed expected time at the InnerTOF for the Electron mass hypotheses
DECLARE_SOA_COLUMN(InnerTOFExpectedTimeMu, innerTOFExpectedTimeMu, float); //! Reconstructed expected time at the InnerTOF for the Muon mass hypotheses
DECLARE_SOA_COLUMN(InnerTOFExpectedTimePi, innerTOFExpectedTimePi, float); //! Reconstructed expected time at the InnerTOF for the Pion mass hypotheses
DECLARE_SOA_COLUMN(InnerTOFExpectedTimeKa, innerTOFExpectedTimeKa, float); //! Reconstructed expected time at the InnerTOF for the Kaon mass hypotheses
DECLARE_SOA_COLUMN(InnerTOFExpectedTimePr, innerTOFExpectedTimePr, float); //! Reconstructed expected time at the InnerTOF for the Proton mass hypotheses

DECLARE_SOA_COLUMN(NSigmaElectronOuterTOF, nSigmaElectronOuterTOF, float); //! NSigma electron OuterTOF
DECLARE_SOA_COLUMN(NSigmaMuonOuterTOF, nSigmaMuonOuterTOF, float); //! NSigma muon OuterTOF
DECLARE_SOA_COLUMN(NSigmaPionOuterTOF, nSigmaPionOuterTOF, float); //! NSigma pion OuterTOF
DECLARE_SOA_COLUMN(NSigmaKaonOuterTOF, nSigmaKaonOuterTOF, float); //! NSigma kaon OuterTOF
DECLARE_SOA_COLUMN(NSigmaProtonOuterTOF, nSigmaProtonOuterTOF, float); //! NSigma proton OuterTOF
DECLARE_SOA_COLUMN(OuterTOFTrackTimeReco, outerTOFTrackTimeReco, float); //! Track time measured at the OuterTOF
DECLARE_SOA_COLUMN(OuterTOFTrackLengthReco, outerTOFTrackLengthReco, float); //! track length for calculation of OuterTOF (reconstructed)

DECLARE_SOA_COLUMN(OuterTOFExpectedTimeEl, outerTOFExpectedTimeEl, float); //! Reconstructed expected time at the OuterTOF for the Electron mass hypotheses
DECLARE_SOA_COLUMN(OuterTOFExpectedTimeMu, outerTOFExpectedTimeMu, float); //! Reconstructed expected time at the OuterTOF for the Muon mass hypotheses
DECLARE_SOA_COLUMN(OuterTOFExpectedTimePi, outerTOFExpectedTimePi, float); //! Reconstructed expected time at the OuterTOF for the Pion mass hypotheses
DECLARE_SOA_COLUMN(OuterTOFExpectedTimeKa, outerTOFExpectedTimeKa, float); //! Reconstructed expected time at the OuterTOF for the Kaon mass hypotheses
DECLARE_SOA_COLUMN(OuterTOFExpectedTimePr, outerTOFExpectedTimePr, float); //! Reconstructed expected time at the OuterTOF for the Proton mass hypotheses
} // namespace upgrade_tof

DECLARE_SOA_TABLE(UpgradeTofMCs, "AOD", "UPGRADETOFMC",
Expand All @@ -74,8 +87,21 @@
upgrade_tof::OuterTOFTrackTimeReco,
upgrade_tof::OuterTOFTrackLengthReco);

using UpgradeTof = UpgradeTofs::iterator;
DECLARE_SOA_TABLE(UpgradeTofExpectedTimes, "AOD", "UPGRADETOFEXPT",
upgrade_tof::InnerTOFExpectedTimeEl,
upgrade_tof::InnerTOFExpectedTimeMu,
upgrade_tof::InnerTOFExpectedTimePi,
upgrade_tof::InnerTOFExpectedTimeKa,
upgrade_tof::InnerTOFExpectedTimePr,
upgrade_tof::OuterTOFExpectedTimeEl,
upgrade_tof::OuterTOFExpectedTimeMu,
upgrade_tof::OuterTOFExpectedTimePi,
upgrade_tof::OuterTOFExpectedTimeKa,
upgrade_tof::OuterTOFExpectedTimePr);

using UpgradeTofMC = UpgradeTofMCs::iterator;
using UpgradeTof = UpgradeTofs::iterator;
using UpgradeTofExpectedTime = UpgradeTofExpectedTimes::iterator;

} // namespace o2::aod

Expand Down
21 changes: 15 additions & 6 deletions ALICE3/TableProducer/OTF/onTheFlyTOFPID.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
struct OnTheFlyTofPid {
Produces<aod::UpgradeTofMC> upgradeTofMC;
Produces<aod::UpgradeTof> upgradeTof;
Produces<aod::UpgradeTofExpectedTime> upgradeTofExpectedTime;

// necessary for particle charges
Service<o2::framework::O2DatabasePDG> pdg;
Expand Down Expand Up @@ -141,7 +142,7 @@
mapPdgLut.insert(std::make_pair(321, lutKaChar));
mapPdgLut.insert(std::make_pair(2212, lutPrChar));

for (auto e : mapPdgLut) {
for (const auto& e : mapPdgLut) {
if (!mSmearer.loadTable(e.first, e.second)) {
LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second;
}
Expand Down Expand Up @@ -180,7 +181,7 @@

std::string particle_names1[5] = {"#it{e}", "#it{#mu}", "#it{#pi}", "#it{K}", "#it{p}"};
std::string particle_names2[5] = {"Elec", "Muon", "Pion", "Kaon", "Prot"};
for (int i_true = 0; i_true < 5; i_true++) {

Check failure on line 184 in ALICE3/TableProducer/OTF/onTheFlyTOFPID.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.
std::string name_title_inner_track_res = "h2dInnerTimeResTrack" + particle_names2[i_true] + "VsP";
std::string name_title_inner_total_res = "h2dInnerTimeResTotal" + particle_names2[i_true] + "VsP";
std::string name_title_outer_track_res = "h2dOuterTimeResTrack" + particle_names2[i_true] + "VsP";
Expand All @@ -193,8 +194,8 @@
histos.add(name_title_outer_total_res.c_str(), name_title_outer_total_res.c_str(), kTH2F, {axisMomentum, axisTotalTimeRes});
}

for (int i_true = 0; i_true < 5; i_true++) {

Check failure on line 197 in ALICE3/TableProducer/OTF/onTheFlyTOFPID.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.
for (int i_hyp = 0; i_hyp < 5; i_hyp++) {

Check failure on line 198 in ALICE3/TableProducer/OTF/onTheFlyTOFPID.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.
std::string name_title_inner = "h2dInnerNsigmaTrue" + particle_names2[i_true] + "Vs" + particle_names2[i_hyp] + "Hypothesis";
std::string name_title_outer = "h2dOuterNsigmaTrue" + particle_names2[i_true] + "Vs" + particle_names2[i_hyp] + "Hypothesis";
if (i_true == i_hyp) {
Expand Down Expand Up @@ -298,7 +299,7 @@
cosAngle = (point2[0] - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (point2[1] - trcCircle.yC) * (startPoint[1] - trcCircle.yC);
}
cosAngle /= modulus;
length = trcCircle.rC * TMath::ACos(cosAngle);

Check failure on line 302 in ALICE3/TableProducer/OTF/onTheFlyTOFPID.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
length *= std::sqrt(1.0f + track.getTgl() * track.getTgl());
}
return length;
Expand Down Expand Up @@ -350,7 +351,7 @@
float sum = 0.;
float sumw = 0.;

for (auto& track : tracks) {
for (const auto& track : tracks) {
auto pdgInfo = pdg->GetParticle(track.mPdgCode);
if (pdgInfo == nullptr) {
continue;
Expand Down Expand Up @@ -473,7 +474,7 @@
float xPv = -100, trackLengthInnerTOF = -1, trackLengthOuterTOF = -1;
if (o2track.propagateToDCA(mcPvVtx, simConfig.dBz))
xPv = o2track.getX();
if (xPv > -99.) {

Check failure on line 477 in ALICE3/TableProducer/OTF/onTheFlyTOFPID.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.
trackLengthInnerTOF = trackLength(o2track, simConfig.innerTOFRadius, simConfig.dBz);
trackLengthOuterTOF = trackLength(o2track, simConfig.outerTOFRadius, simConfig.dBz);
}
Expand All @@ -498,7 +499,7 @@
auto recoTrack = getTrackParCov(track);
if (recoTrack.propagateToDCA(pvVtx, simConfig.dBz))
xPv = recoTrack.getX();
if (xPv > -99.) {

Check failure on line 502 in ALICE3/TableProducer/OTF/onTheFlyTOFPID.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.
trackLengthRecoInnerTOF = trackLength(recoTrack, simConfig.innerTOFRadius, simConfig.dBz);
trackLengthRecoOuterTOF = trackLength(recoTrack, simConfig.outerTOFRadius, simConfig.dBz);
}
Expand Down Expand Up @@ -549,8 +550,9 @@
const float noSmearingPt = trkWithTime.mNoSmearingPt;

// Straight to Nsigma
float deltaTimeInnerTOF[5], nSigmaInnerTOF[5];
float deltaTimeOuterTOF[5], nSigmaOuterTOF[5];
static std::array<float, 5> expectedTimeInnerTOF, expectedTimeOuterTOF;
static std::array<float, 5> deltaTimeInnerTOF, deltaTimeOuterTOF;
static std::array<float, 5> nSigmaInnerTOF, nSigmaOuterTOF;
static constexpr int lpdg_array[5] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
float masses[5];

Expand All @@ -570,14 +572,19 @@
}
}

for (int ii = 0; ii < 5; ii++) {

Check failure on line 575 in ALICE3/TableProducer/OTF/onTheFlyTOFPID.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.
nSigmaInnerTOF[ii] = -100;
nSigmaOuterTOF[ii] = -100;

auto pdgInfoThis = pdg->GetParticle(lpdg_array[ii]);
masses[ii] = pdgInfoThis->Mass();
deltaTimeInnerTOF[ii] = trackLengthRecoInnerTOF / velocity(momentum, masses[ii]) - measuredTimeInnerTOF;
deltaTimeOuterTOF[ii] = trackLengthRecoOuterTOF / velocity(momentum, masses[ii]) - measuredTimeOuterTOF;
const float v = velocity(momentum, masses[ii]);

expectedTimeInnerTOF[ii] = trackLengthInnerTOF / v;
expectedTimeOuterTOF[ii] = trackLengthOuterTOF / v;

deltaTimeInnerTOF[ii] = measuredTimeInnerTOF - expectedTimeInnerTOF[ii];
deltaTimeOuterTOF[ii] = measuredTimeOuterTOF - expectedTimeInnerTOF[ii];

// Evaluate total sigma (layer + tracking resolution)
float innerTotalTimeReso = simConfig.innerTOFTimeReso;
Expand Down Expand Up @@ -665,7 +672,7 @@
}

if (plotsConfig.doQAplots) {
for (int ii = 0; ii < 5; ii++) {

Check failure on line 675 in ALICE3/TableProducer/OTF/onTheFlyTOFPID.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.
if (std::fabs(mcParticle.pdgCode()) != pdg->GetParticle(lpdg_array[ii])->PdgCode()) {
continue;
}
Expand Down Expand Up @@ -769,6 +776,8 @@
measuredTimeInnerTOF, trackLengthRecoInnerTOF,
nSigmaOuterTOF[0], nSigmaOuterTOF[1], nSigmaOuterTOF[2], nSigmaOuterTOF[3], nSigmaOuterTOF[4],
measuredTimeOuterTOF, trackLengthRecoOuterTOF);
upgradeTofExpectedTime(expectedTimeInnerTOF[0], expectedTimeInnerTOF[1], expectedTimeInnerTOF[2], expectedTimeInnerTOF[3], expectedTimeInnerTOF[4],
expectedTimeOuterTOF[0], expectedTimeOuterTOF[1], expectedTimeOuterTOF[2], expectedTimeOuterTOF[3], expectedTimeOuterTOF[4]);
}
}
};
Expand Down
Loading