Skip to content

Commit 47aaf0f

Browse files
committed
refactor particle base with strings
1 parent 12f1add commit 47aaf0f

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

PWGHF/D2H/Macros/runMassFitter.C

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,28 @@ void runMassFitter(const std::string& configFileName)
181181
sgnFunc[iSliceVar] = sgnFuncConfig[iSliceVar];
182182
}
183183

184-
std::map<std::string, std::tuple<std::string, std::string, std::string>> particles{
185-
{"Dplus", {"K#pi#pi", "D+", "D^{+} #rightarrow K^{-}#pi^{+}#pi^{+} + c.c."}},
186-
{"D0", {"K#pi", "D0", "D^{0} #rightarrow K^{-}#pi^{+} + c.c."}},
187-
{"Ds", {"KK#pi", "D_s+", "D_{s}^{+} #rightarrow K^{-}K^{+}#pi^{+} + c.c."}},
188-
{"LcToPKPi", {"pK#pi", "Lambda_c+", "#Lambda_{c}^{+} #rightarrow pK^{-}#pi^{+} + c.c."}},
189-
{"LcToPK0s", {"pK^{0}_{s}", "Lambda_c+", "#Lambda_{c}^{+} #rightarrow pK^{0}_{s} + c.c."}},
190-
{"Dstar", {"D^{0}pi^{+}", "D*+", "D^{*+} #rightarrow D^{0}#pi^{+} + c.c."}},
191-
{"XicToXiPiPi", {"#Xi#pi#pi", "Xi_c+", "#Xi_{c}^{+} #rightarrow #Xi^{-}#pi^{+}#pi^{+} + c.c."}}};
184+
struct decayInfo {
185+
std::string decayProducts;
186+
std::string pdgName;
187+
std::string decayFormulaLhs;
188+
std::string decayFormulaRhs;
189+
};
190+
191+
std::map<std::string, decayInfo> particles{
192+
{"Dplus", {"K#pi#pi", "D+", "D^{+}", "K^{-}#pi^{+}#pi^{+}"}},
193+
{"D0", {"K#pi", "D0", "D^{0}", "K^{-}#pi^{+}"}},
194+
{"Ds", {"KK#pi", "D_s+", "D_{s}^{+}", "K^{-}K^{+}#pi^{+}"}},
195+
{"LcToPKPi", {"pK#pi", "Lambda_c+", "#Lambda_{c}^{+}", "pK^{-}#pi^{+}"}},
196+
{"LcToPK0s", {"pK^{0}_{s}", "Lambda_c+", "#Lambda_{c}^{+}", "pK^{0}_{s}"}},
197+
{"Dstar", {"D^{0}pi^{+}", "D*+", "D^{*+}", "D^{0}#pi^{+}"}},
198+
{"XicToXiPiPi", {"#Xi#pi#pi", "Xi_c+", "#Xi_{c}^{+}", "#Xi^{-}#pi^{+}#pi^{+}"}}};
192199
if (particles.find(particleName.c_str()) == particles.end()) {
193200
throw std::runtime_error("ERROR: only Dplus, D0, Ds, LcToPKPi, LcToPK0s, Dstar and XicToXiPiPi particles supported! Exit");
194201
}
195-
const auto& particleTuple = particles[particleName.c_str()];
196-
const std::string massAxisTitle = "#it{M}(" + std::get<0>(particleTuple) + ") (GeV/#it{c}^{2})";
197-
const double massPDG = TDatabasePDG::Instance()->GetParticle(std::get<1>(particleTuple).c_str())->Mass();
198-
const std::vector<std::string> plotLabels = {std::get<2>(particleTuple), collisionSystem.c_str()};
202+
const auto& particle = particles[particleName.c_str()];
203+
const std::string massAxisTitle = "#it{M}(" + particle.decayProducts + ") (GeV/#it{c}^{2})";
204+
const double massPDG = TDatabasePDG::Instance()->GetParticle(particle.pdgName.c_str())->Mass();
205+
const std::vector<std::string> plotLabels = {(particle.decayFormulaLhs + " #rightarrow " + particle.decayFormulaRhs + " + c.c.").c_str(), collisionSystem};
199206

200207
// load inv-mass histograms
201208
auto* inputFile = openFileWithNullptrCheck(inputFileName);

0 commit comments

Comments
 (0)