Skip to content

Commit ff1f4cf

Browse files
authored
Refactor drawTrackSmearer to use PDG constants
1 parent 1da3d2e commit ff1f4cf

1 file changed

Lines changed: 26 additions & 10 deletions

File tree

ALICE3/Macros/drawTrackSmearer.C

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
/// \file drawTrackSmearer.C
13+
/// \brief Draw the ALICE3 track-smearing performance curves for key particle species.
14+
1215
#include "FlatTrackSmearer.h"
1316
#include "TrackUtilities.h"
1417

@@ -17,11 +20,24 @@
1720
#include <TColor.h>
1821
#include <TGraph.h>
1922

20-
void drawTrackSmearer(const std::vector<std::pair<int, std::string>>& filenames = {{11, "/tmp/lut/lutCov.acts.11.2T.dNdEta5.dat"},
21-
{13, "/tmp/lut/lutCov.acts.13.2T.dNdEta5.dat"},
22-
{211, "/tmp/lut/lutCov.acts.211.2T.dNdEta5.dat"},
23-
{2212, "/tmp/lut/lutCov.acts.2212.2T.dNdEta5.dat"},
24-
{321, "/tmp/lut/lutCov.acts.321.2T.dNdEta5.dat"}})
23+
#include <TPDGCode.h>
24+
25+
namespace
26+
{
27+
constexpr int kElectronPdg = static_cast<int>(PDG_t::kElectron);
28+
constexpr int kMuonPdg = static_cast<int>(PDG_t::kMuonMinus);
29+
constexpr int kPionPdg = static_cast<int>(PDG_t::kPiPlus);
30+
constexpr int kProtonPdg = static_cast<int>(PDG_t::kProton);
31+
constexpr int kKaonPdg = static_cast<int>(PDG_t::kKPlus);
32+
33+
const std::vector<std::pair<int, std::string>> kDefaultLutFiles = {{kElectronPdg, "/tmp/lut/lutCov.acts.11.2T.dNdEta5.dat"},
34+
{kMuonPdg, "/tmp/lut/lutCov.acts.13.2T.dNdEta5.dat"},
35+
{kPionPdg, "/tmp/lut/lutCov.acts.211.2T.dNdEta5.dat"},
36+
{kProtonPdg, "/tmp/lut/lutCov.acts.2212.2T.dNdEta5.dat"},
37+
{kKaonPdg, "/tmp/lut/lutCov.acts.321.2T.dNdEta5.dat"}};
38+
} // namespace
39+
40+
void drawTrackSmearer(const std::vector<std::pair<int, std::string>>& filenames = kDefaultLutFiles)
2541
{
2642

2743
o2::delphes::TrackSmearer trackSmearer;
@@ -50,15 +66,15 @@ void drawTrackSmearer(const std::vector<std::pair<int, std::string>>& filenames
5066
}
5167

5268
int color = 0;
53-
if (pdg == 11) {
69+
if (pdg == kElectronPdg) {
5470
color = TColor::GetColor("#e41a1c");
55-
} else if (pdg == 13) {
71+
} else if (pdg == kMuonPdg) {
5672
color = TColor::GetColor("#377eb8");
57-
} else if (pdg == 211) {
73+
} else if (pdg == kPionPdg) {
5874
color = TColor::GetColor("#4daf4a");
59-
} else if (pdg == 2212) {
75+
} else if (pdg == kProtonPdg) {
6076
color = TColor::GetColor("#984ea3");
61-
} else if (pdg == 321) {
77+
} else if (pdg == kKaonPdg) {
6278
color = TColor::GetColor("#ff7f00");
6379
}
6480
gPt->SetLineColor(color);

0 commit comments

Comments
 (0)