Skip to content

Commit 4fcbcb1

Browse files
authored
[PWGUD/Core] out-of-line decayTree to avoid pulling in HistogramRegistry.h (#16877)
1 parent 22dfa17 commit 4fcbcb1

2 files changed

Lines changed: 164 additions & 159 deletions

File tree

PWGUD/Core/decayTree.cxx

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,4 +1228,162 @@ std::vector<std::vector<int>> decayTree::combinations(int nPool)
12281228
return copes;
12291229
}
12301230

1231+
void decayTree::createHistograms(o2::framework::HistogramRegistry& registry)
1232+
{
1233+
// definitions
1234+
auto etax = o2::framework::AxisSpec(100, -1.5, 1.5);
1235+
auto nSax = o2::framework::AxisSpec(300, -15.0, 15.0);
1236+
auto chi2ax = o2::framework::AxisSpec(100, 0.0, 5.0);
1237+
auto nClax = o2::framework::AxisSpec(170, 0.0, 170.0);
1238+
auto angax = o2::framework::AxisSpec(315, 0.0, 3.15);
1239+
auto dcaxyax = o2::framework::AxisSpec(400, -0.2, 0.2);
1240+
auto dcazax = o2::framework::AxisSpec(600, -0.3, 0.3);
1241+
auto sTPCax = o2::framework::AxisSpec(1000, 0., 1000.);
1242+
1243+
std::string base;
1244+
std::string hname;
1245+
std::string annot;
1246+
fhistPointers.clear();
1247+
for (const auto& res : getResonances()) {
1248+
auto max = o2::framework::AxisSpec(res->nmassBins(), res->massHistRange()[0], res->massHistRange()[1]);
1249+
auto momax = o2::framework::AxisSpec(res->nmomBins(), res->momHistRange()[0], res->momHistRange()[1]);
1250+
1251+
// M-pT, M-eta, pT-eta
1252+
for (const auto& cc : fccs) {
1253+
base = cc;
1254+
base.append("/").append(res->name()).append("/");
1255+
hname = base + "mpt";
1256+
annot = "M versus pT; M (" + res->name() + ") GeV/c^{2}; pT (" + res->name() + ") GeV/c";
1257+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, momax}})});
1258+
hname = base + "meta";
1259+
annot = "M versus eta; M (" + res->name() + ") GeV/c^{2}; eta (" + res->name() + ")";
1260+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, etax}})});
1261+
hname = base + "pteta";
1262+
annot = "pT versus eta; pT (" + res->name() + ") GeV/c; eta (" + res->name() + ")";
1263+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {momax, etax}})});
1264+
1265+
// M versus daughters
1266+
auto daughs = res->getDaughters();
1267+
auto ndaughs = daughs.size();
1268+
for (auto i = 0; i < static_cast<int>(ndaughs); i++) {
1269+
auto d1 = getResonance(daughs[i]);
1270+
1271+
// M vs pT daughter
1272+
hname = base;
1273+
hname.append("MvspT_").append(res->name()).append(d1->name());
1274+
annot = "M versus pT; M (" + res->name() + ") GeV/c^{2}; pT (" + d1->name() + ") GeV/c";
1275+
auto momax1 = o2::framework::AxisSpec(d1->nmomBins(), d1->momHistRange()[0], d1->momHistRange()[1]);
1276+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, momax1}})});
1277+
1278+
// M vs eta daughter
1279+
hname = base;
1280+
hname.append("Mvseta_").append(res->name()).append(d1->name());
1281+
annot = "M versus eta; M (" + res->name() + ") GeV/c^{2}; eta (" + d1->name() + ")";
1282+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, etax}})});
1283+
1284+
if (d1->isFinal()) {
1285+
// M vs dcaXYZ
1286+
hname = base;
1287+
hname.append("MvsdcaXY_").append(res->name()).append(d1->name());
1288+
annot = "M versus dcaXY; M (" + res->name() + ") GeV/c^{2}; dca_{XY} (" + d1->name() + ") #mu m";
1289+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, dcaxyax}})});
1290+
hname = base;
1291+
hname.append("MvsdcaZ_").append(res->name()).append(d1->name());
1292+
annot = "M versus dcaZ; M (" + res->name() + ") GeV/c^{2}; dca_{Z} (" + d1->name() + ") #mu m";
1293+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, dcazax}})});
1294+
1295+
// M vs chi2 track
1296+
hname = base;
1297+
hname.append("Mvschi2_").append(res->name()).append(d1->name());
1298+
annot = "M versus chi2; M (" + res->name() + ") GeV/c^{2}; chi2 (" + d1->name() + ")";
1299+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, chi2ax}})});
1300+
1301+
// M vs nCl track
1302+
hname = base;
1303+
hname.append("MvsnCl_").append(res->name()).append(d1->name());
1304+
annot = "M versus nCl; M (" + res->name() + ") GeV/c^{2}; nCl (" + d1->name() + ")";
1305+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, nClax}})});
1306+
1307+
// M versus detector hits
1308+
hname = base;
1309+
hname.append("MvsdetHits_").append(res->name()).append(d1->name());
1310+
annot = "M versus detector hits; M (" + res->name() + ") GeV/c^{2}; ITS + 2*TPC + 4*TRD + 8*TOF (" + d1->name() + ")";
1311+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, {16, -0.5, 15.5}}})});
1312+
} else {
1313+
// M vs Mi
1314+
hname = base;
1315+
hname.append("MvsM_").append(res->name()).append(d1->name());
1316+
annot = "M versus M; M (" + res->name() + ") GeV/c^{2}; M (" + d1->name() + ") GeV/c^{2}";
1317+
auto max1 = o2::framework::AxisSpec(res->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]);
1318+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, max1}})});
1319+
}
1320+
}
1321+
1322+
// daughters vs daughters
1323+
for (auto i = 0; i < static_cast<int>(ndaughs - 1); i++) {
1324+
auto d1 = getResonance(daughs[i]);
1325+
auto max1 = o2::framework::AxisSpec(d1->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]);
1326+
for (auto j = i + 1; j < static_cast<int>(ndaughs); j++) {
1327+
auto d2 = getResonance(daughs[j]);
1328+
auto max2 = o2::framework::AxisSpec(d2->nmassBins(), d2->massHistRange()[0], d2->massHistRange()[1]);
1329+
1330+
// M1 vs M2
1331+
hname = base;
1332+
hname.append("MvsM_").append(d1->name()).append(d2->name());
1333+
annot = std::string("M versus M; M (").append(d1->name()).append(") GeV/c^{2}; M (").append(d2->name()).append(") GeV/c^{2}");
1334+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max1, max2}})});
1335+
1336+
// angle(d1, d2)
1337+
hname = base;
1338+
hname.append("angle_").append(d1->name()).append(d2->name());
1339+
annot = std::string("angle; Angle (").append(d1->name()).append(", ").append(d2->name()).append(")");
1340+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {angax}})});
1341+
1342+
// M vs angle(d1, d2)
1343+
hname = base;
1344+
hname.append("Mvsangle_").append(d1->name()).append(d2->name());
1345+
annot = std::string("M versus angle; M (").append(res->name()).append(") GeV/c^{2}; Angle (").append(d1->name()).append(", ").append(d2->name()).append(")");
1346+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, angax}})});
1347+
1348+
// both daughters are finals
1349+
if (d1->isFinal() && d2->isFinal()) {
1350+
hname = base;
1351+
hname.append("TPCsignal_").append(d1->name()).append(d2->name());
1352+
annot = std::string("TPC signal of both tracks; TPCsignal (").append(d1->name()).append("); TPCsignal (").append(d2->name()).append(")");
1353+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {sTPCax, sTPCax}})});
1354+
}
1355+
}
1356+
}
1357+
1358+
// for finals only
1359+
if (res->isFinal()) {
1360+
// dca
1361+
hname = base;
1362+
hname.append("dcaXY");
1363+
annot = std::string("dcaXY; dca_{XY}(").append(res->name()).append(")");
1364+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {dcaxyax}})});
1365+
hname = base;
1366+
hname.append("dcaZ");
1367+
annot = std::string("dcaZ; dca_{Z}(").append(res->name()).append(")");
1368+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {dcazax}})});
1369+
1370+
// nSIgma[TPC, TOF] vs pT
1371+
for (const auto& det : fdets) {
1372+
for (const auto& part : fparts) {
1373+
hname = base;
1374+
hname.append("nS").append(part).append(det);
1375+
annot = std::string("nSigma_").append(det).append(" versus p; p (").append(res->name()).append(") GeV/c; nSigma_{").append(det).append(", ").append(part).append("} (").append(res->name()).append(")");
1376+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {momax, nSax}})});
1377+
}
1378+
}
1379+
1380+
// detector hits
1381+
hname = base;
1382+
hname.append("detectorHits");
1383+
annot = std::string("detectorHits; Detector(").append(res->name()).append(")");
1384+
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {{4, 0.5, 4.5}}})});
1385+
}
1386+
}
1387+
}
1388+
}
12311389
// -----------------------------------------------------------------------------

PWGUD/Core/decayTree.h

Lines changed: 6 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#ifndef PWGUD_CORE_DECAYTREE_H_
1313
#define PWGUD_CORE_DECAYTREE_H_
1414

15-
#include <Framework/HistogramRegistry.h>
1615
#include <Framework/HistogramSpec.h>
1716
#include <Framework/Logger.h>
1817

@@ -29,6 +28,11 @@
2928
#include <utility>
3029
#include <vector>
3130

31+
namespace o2::framework
32+
{
33+
class HistogramRegistry;
34+
}
35+
3236
// -----------------------------------------------------------------------------
3337
class pidSelector
3438
{
@@ -835,164 +839,7 @@ class decayTree
835839
}
836840

837841
// create histograms
838-
void createHistograms(o2::framework::HistogramRegistry& registry)
839-
{
840-
// definitions
841-
auto etax = o2::framework::AxisSpec(100, -1.5, 1.5);
842-
auto nSax = o2::framework::AxisSpec(300, -15.0, 15.0);
843-
auto chi2ax = o2::framework::AxisSpec(100, 0.0, 5.0);
844-
auto nClax = o2::framework::AxisSpec(170, 0.0, 170.0);
845-
auto angax = o2::framework::AxisSpec(315, 0.0, 3.15);
846-
auto dcaxyax = o2::framework::AxisSpec(400, -0.2, 0.2);
847-
auto dcazax = o2::framework::AxisSpec(600, -0.3, 0.3);
848-
auto sTPCax = o2::framework::AxisSpec(1000, 0., 1000.);
849-
850-
std::string base;
851-
std::string hname;
852-
std::string annot;
853-
fhistPointers.clear();
854-
for (const auto& res : getResonances()) {
855-
auto max = o2::framework::AxisSpec(res->nmassBins(), res->massHistRange()[0], res->massHistRange()[1]);
856-
auto momax = o2::framework::AxisSpec(res->nmomBins(), res->momHistRange()[0], res->momHistRange()[1]);
857-
858-
// M-pT, M-eta, pT-eta
859-
for (const auto& cc : fccs) {
860-
base = cc;
861-
base.append("/").append(res->name()).append("/");
862-
hname = base + "mpt";
863-
annot = "M versus pT; M (" + res->name() + ") GeV/c^{2}; pT (" + res->name() + ") GeV/c";
864-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, momax}})});
865-
hname = base + "meta";
866-
annot = "M versus eta; M (" + res->name() + ") GeV/c^{2}; eta (" + res->name() + ")";
867-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, etax}})});
868-
hname = base + "pteta";
869-
annot = "pT versus eta; pT (" + res->name() + ") GeV/c; eta (" + res->name() + ")";
870-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {momax, etax}})});
871-
872-
// M versus daughters
873-
auto daughs = res->getDaughters();
874-
auto ndaughs = daughs.size();
875-
for (auto i = 0; i < static_cast<int>(ndaughs); i++) {
876-
auto d1 = getResonance(daughs[i]);
877-
878-
// M vs pT daughter
879-
hname = base;
880-
hname.append("MvspT_").append(res->name()).append(d1->name());
881-
annot = "M versus pT; M (" + res->name() + ") GeV/c^{2}; pT (" + d1->name() + ") GeV/c";
882-
auto momax1 = o2::framework::AxisSpec(d1->nmomBins(), d1->momHistRange()[0], d1->momHistRange()[1]);
883-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, momax1}})});
884-
885-
// M vs eta daughter
886-
hname = base;
887-
hname.append("Mvseta_").append(res->name()).append(d1->name());
888-
annot = "M versus eta; M (" + res->name() + ") GeV/c^{2}; eta (" + d1->name() + ")";
889-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, etax}})});
890-
891-
if (d1->isFinal()) {
892-
// M vs dcaXYZ
893-
hname = base;
894-
hname.append("MvsdcaXY_").append(res->name()).append(d1->name());
895-
annot = "M versus dcaXY; M (" + res->name() + ") GeV/c^{2}; dca_{XY} (" + d1->name() + ") #mu m";
896-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, dcaxyax}})});
897-
hname = base;
898-
hname.append("MvsdcaZ_").append(res->name()).append(d1->name());
899-
annot = "M versus dcaZ; M (" + res->name() + ") GeV/c^{2}; dca_{Z} (" + d1->name() + ") #mu m";
900-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, dcazax}})});
901-
902-
// M vs chi2 track
903-
hname = base;
904-
hname.append("Mvschi2_").append(res->name()).append(d1->name());
905-
annot = "M versus chi2; M (" + res->name() + ") GeV/c^{2}; chi2 (" + d1->name() + ")";
906-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, chi2ax}})});
907-
908-
// M vs nCl track
909-
hname = base;
910-
hname.append("MvsnCl_").append(res->name()).append(d1->name());
911-
annot = "M versus nCl; M (" + res->name() + ") GeV/c^{2}; nCl (" + d1->name() + ")";
912-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, nClax}})});
913-
914-
// M versus detector hits
915-
hname = base;
916-
hname.append("MvsdetHits_").append(res->name()).append(d1->name());
917-
annot = "M versus detector hits; M (" + res->name() + ") GeV/c^{2}; ITS + 2*TPC + 4*TRD + 8*TOF (" + d1->name() + ")";
918-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, {16, -0.5, 15.5}}})});
919-
} else {
920-
// M vs Mi
921-
hname = base;
922-
hname.append("MvsM_").append(res->name()).append(d1->name());
923-
annot = "M versus M; M (" + res->name() + ") GeV/c^{2}; M (" + d1->name() + ") GeV/c^{2}";
924-
auto max1 = o2::framework::AxisSpec(res->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]);
925-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, max1}})});
926-
}
927-
}
928-
929-
// daughters vs daughters
930-
for (auto i = 0; i < static_cast<int>(ndaughs - 1); i++) {
931-
auto d1 = getResonance(daughs[i]);
932-
auto max1 = o2::framework::AxisSpec(d1->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]);
933-
for (auto j = i + 1; j < static_cast<int>(ndaughs); j++) {
934-
auto d2 = getResonance(daughs[j]);
935-
auto max2 = o2::framework::AxisSpec(d2->nmassBins(), d2->massHistRange()[0], d2->massHistRange()[1]);
936-
937-
// M1 vs M2
938-
hname = base;
939-
hname.append("MvsM_").append(d1->name()).append(d2->name());
940-
annot = std::string("M versus M; M (").append(d1->name()).append(") GeV/c^{2}; M (").append(d2->name()).append(") GeV/c^{2}");
941-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max1, max2}})});
942-
943-
// angle(d1, d2)
944-
hname = base;
945-
hname.append("angle_").append(d1->name()).append(d2->name());
946-
annot = std::string("angle; Angle (").append(d1->name()).append(", ").append(d2->name()).append(")");
947-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {angax}})});
948-
949-
// M vs angle(d1, d2)
950-
hname = base;
951-
hname.append("Mvsangle_").append(d1->name()).append(d2->name());
952-
annot = std::string("M versus angle; M (").append(res->name()).append(") GeV/c^{2}; Angle (").append(d1->name()).append(", ").append(d2->name()).append(")");
953-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, angax}})});
954-
955-
// both daughters are finals
956-
if (d1->isFinal() && d2->isFinal()) {
957-
hname = base;
958-
hname.append("TPCsignal_").append(d1->name()).append(d2->name());
959-
annot = std::string("TPC signal of both tracks; TPCsignal (").append(d1->name()).append("); TPCsignal (").append(d2->name()).append(")");
960-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {sTPCax, sTPCax}})});
961-
}
962-
}
963-
}
964-
965-
// for finals only
966-
if (res->isFinal()) {
967-
// dca
968-
hname = base;
969-
hname.append("dcaXY");
970-
annot = std::string("dcaXY; dca_{XY}(").append(res->name()).append(")");
971-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {dcaxyax}})});
972-
hname = base;
973-
hname.append("dcaZ");
974-
annot = std::string("dcaZ; dca_{Z}(").append(res->name()).append(")");
975-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {dcazax}})});
976-
977-
// nSIgma[TPC, TOF] vs pT
978-
for (const auto& det : fdets) {
979-
for (const auto& part : fparts) {
980-
hname = base;
981-
hname.append("nS").append(part).append(det);
982-
annot = std::string("nSigma_").append(det).append(" versus p; p (").append(res->name()).append(") GeV/c; nSigma_{").append(det).append(", ").append(part).append("} (").append(res->name()).append(")");
983-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {momax, nSax}})});
984-
}
985-
}
986-
987-
// detector hits
988-
hname = base;
989-
hname.append("detectorHits");
990-
annot = std::string("detectorHits; Detector(").append(res->name()).append(")");
991-
fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {{4, 0.5, 4.5}}})});
992-
}
993-
}
994-
}
995-
}
842+
void createHistograms(o2::framework::HistogramRegistry& registry);
996843

997844
// ClassDefNV(decayTree, 1);
998845
};

0 commit comments

Comments
 (0)