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
58 changes: 29 additions & 29 deletions ALICE3/TableProducer/OTF/onTheFlyTOFPID.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@

struct : ConfigurableGroup {
Configurable<bool> doQAplots{"doQAplots", true, "do basic velocity plot qa"};
Configurable<bool> doSeparationVsPt{"doSeparationVsPt", true, "Produce plots vs pt or p"};
Configurable<int> nBinsBeta{"nBinsBeta", 2200, "number of bins in beta"};
Configurable<int> nBinsP{"nBinsP", 80, "number of bins in momentum"};
Configurable<int> nBinsP{"nBinsP", 80, "number of bins in momentum/pT depending on doSeparationVsPt"};
Configurable<int> nBinsTrackLengthInner{"nBinsTrackLengthInner", 300, "number of bins in track length"};
Configurable<int> nBinsTrackLengthOuter{"nBinsTrackLengthOuter", 300, "number of bins in track length"};
Configurable<int> nBinsTrackDeltaLength{"nBinsTrackDeltaLength", 100, "number of bins in delta track length"};
Expand Down Expand Up @@ -193,7 +194,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 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.
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 @@ -206,28 +207,29 @@
h2dOuterTimeResTotal[i_true] = histos.add<TH2>(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 210 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 211 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";
std::string name_title_inner_delta = "h2dInnerDeltaTrue" + particle_names2[i_true] + "Vs" + particle_names2[i_hyp] + "Hypothesis";
std::string name_title_outer_delta = "h2dOuterDeltaTrue" + particle_names2[i_true] + "Vs" + particle_names2[i_hyp] + "Hypothesis";
const AxisSpec axisX{plotsConfig.doSeparationVsPt.value ? axisPt : axisMomentum};
if (i_true == i_hyp) {
const AxisSpec axisNsigmaCorrect{static_cast<int>(plotsConfig.nBinsNsigmaCorrectSpecies), plotsConfig.minNsigmaRange, plotsConfig.maxNsigmaRange, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"};
h2dInnerNsigmaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_inner.c_str(), name_title_inner.c_str(), kTH2F, {axisMomentum, axisNsigmaCorrect});
h2dOuterNsigmaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_outer.c_str(), name_title_outer.c_str(), kTH2F, {axisMomentum, axisNsigmaCorrect});
h2dInnerNsigmaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_inner.c_str(), name_title_inner.c_str(), kTH2F, {axisX, axisNsigmaCorrect});
h2dOuterNsigmaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_outer.c_str(), name_title_outer.c_str(), kTH2F, {axisX, axisNsigmaCorrect});

const AxisSpec axisDeltaCorrect{static_cast<int>(plotsConfig.nBinsDeltaCorrectSpecies), plotsConfig.minDeltaRange, plotsConfig.maxDeltaRange, "#Delta - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"};
h2dInnerDeltaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_inner_delta.c_str(), name_title_inner_delta.c_str(), kTH2F, {axisMomentum, axisDeltaCorrect});
h2dOuterDeltaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_outer_delta.c_str(), name_title_outer_delta.c_str(), kTH2F, {axisMomentum, axisDeltaCorrect});
h2dInnerDeltaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_inner_delta.c_str(), name_title_inner_delta.c_str(), kTH2F, {axisX, axisDeltaCorrect});
h2dOuterDeltaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_outer_delta.c_str(), name_title_outer_delta.c_str(), kTH2F, {axisX, axisDeltaCorrect});
} else {
const AxisSpec axisNsigmaWrong{static_cast<int>(plotsConfig.nBinsNsigmaWrongSpecies), plotsConfig.minNsigmaRange, plotsConfig.maxNsigmaRange, "N#sigma - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"};
h2dInnerNsigmaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_inner.c_str(), name_title_inner.c_str(), kTH2F, {axisMomentum, axisNsigmaWrong});
h2dOuterNsigmaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_outer.c_str(), name_title_outer.c_str(), kTH2F, {axisMomentum, axisNsigmaWrong});
h2dInnerNsigmaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_inner.c_str(), name_title_inner.c_str(), kTH2F, {axisX, axisNsigmaWrong});
h2dOuterNsigmaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_outer.c_str(), name_title_outer.c_str(), kTH2F, {axisX, axisNsigmaWrong});

const AxisSpec axisDeltaWrong{static_cast<int>(plotsConfig.nBinsDeltaWrongSpecies), plotsConfig.minDeltaRange, plotsConfig.maxDeltaRange, "#Delta - True " + particle_names1[i_true] + " vs " + particle_names1[i_hyp] + " hypothesis"};
h2dInnerDeltaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_inner_delta.c_str(), name_title_inner_delta.c_str(), kTH2F, {axisMomentum, axisDeltaWrong});
h2dOuterDeltaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_outer_delta.c_str(), name_title_outer_delta.c_str(), kTH2F, {axisMomentum, axisDeltaWrong});
h2dInnerDeltaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_inner_delta.c_str(), name_title_inner_delta.c_str(), kTH2F, {axisX, axisDeltaWrong});
h2dOuterDeltaTrue[i_true][i_hyp] = histos.add<TH2>(name_title_outer_delta.c_str(), name_title_outer_delta.c_str(), kTH2F, {axisX, axisDeltaWrong});
}
}
}
Expand Down Expand Up @@ -460,27 +462,25 @@

// First we compute the number of charged particles in the event if LUTs are loaded
float dNdEta = 0.f;
if (simConfig.flagTOFLoadDelphesLUTs) {
for (const auto& track : tracks) {
if (!track.has_mcParticle())
continue;
auto mcParticle = track.mcParticle();
if (std::abs(mcParticle.eta()) > simConfig.multiplicityEtaRange) {
continue;
}
if (mcParticle.has_daughters()) {
continue;
}
const auto& pdgInfo = pdg->GetParticle(mcParticle.pdgCode());
if (!pdgInfo) {
// LOG(warning) << "PDG code " << mcParticle.pdgCode() << " not found in the database";
continue;
}
if (pdgInfo->Charge() == 0) {
continue;
}
dNdEta += 1.f;
for (const auto& track : tracks) {
if (!track.has_mcParticle())
continue;
auto mcParticle = track.mcParticle();
if (std::abs(mcParticle.eta()) > simConfig.multiplicityEtaRange) {
continue;
}
if (mcParticle.has_daughters()) {
continue;
}
const auto& pdgInfo = pdg->GetParticle(mcParticle.pdgCode());
if (!pdgInfo) {
// LOG(warning) << "PDG code " << mcParticle.pdgCode() << " not found in the database";
continue;
}
if (pdgInfo->Charge() == 0) {
continue;
}
dNdEta += 1.f;
}
if (plotsConfig.doQAplots) {
histos.fill(HIST("h1dNdeta"), dNdEta);
Expand All @@ -500,7 +500,7 @@
float xPv = -100, trackLengthInnerTOF = -1, trackLengthOuterTOF = -1;
if (o2track.propagateToDCA(mcPvVtx, simConfig.dBz))
xPv = o2track.getX();
if (xPv > -99.) {

Check failure on line 503 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 @@ -525,7 +525,7 @@
auto recoTrack = getTrackParCov(track);
if (recoTrack.propagateToDCA(pvVtx, simConfig.dBz))
xPv = recoTrack.getX();
if (xPv > -99.) {

Check failure on line 528 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 @@ -601,7 +601,7 @@
}
}

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

Check failure on line 604 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;

Expand Down Expand Up @@ -640,7 +640,7 @@
float transverse_momentum = momentum / std::cosh(pseudorapidity);
h2dOuterTimeResTrack[ii]->Fill(momentum, outerTrackTimeReso);
h2dOuterTimeResTotal[ii]->Fill(momentum, outerTotalTimeReso);
if (ii == 2) {

Check failure on line 643 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.
histos.fill(HIST("h2dRelativePtResolution"), transverse_momentum, 100.0 * pt_resolution / transverse_momentum);
histos.fill(HIST("h2dRelativeEtaResolution"), pseudorapidity, 100.0 * eta_resolution / (std::fabs(pseudorapidity) + 1e-6));
}
Expand All @@ -659,18 +659,18 @@
}

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

Check failure on line 662 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(pdgArray[ii])->PdgCode()) {
continue;
}
if (trackLengthRecoInnerTOF > 0) {
for (int iii = 0; iii < 5; iii++) {

Check failure on line 667 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.
h2dInnerNsigmaTrue[ii][iii]->Fill(momentum, nSigmaInnerTOF[iii]);
h2dInnerDeltaTrue[ii][iii]->Fill(momentum, deltaTimeInnerTOF[iii]);
}
}
if (trackLengthRecoOuterTOF > 0) {
for (int iii = 0; iii < 5; iii++) {

Check failure on line 673 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.
h2dOuterNsigmaTrue[ii][iii]->Fill(momentum, nSigmaOuterTOF[iii]);
h2dOuterDeltaTrue[ii][iii]->Fill(momentum, deltaTimeOuterTOF[iii]);
}
Expand Down
Loading