Skip to content

Commit dd7c619

Browse files
committed
Trigger,PWGEM: fix TAP in globalDimuonFilter.cxx
1 parent 8e6418b commit dd7c619

File tree

1 file changed

+59
-32
lines changed

1 file changed

+59
-32
lines changed

EventFiltering/PWGEM/globalDimuonFilter.cxx

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ struct globalDimuonFilter {
7878
Configurable<float> maxEta{"maxEta", -2.5, "max. eta acceptance for MFT-MCH-MID"};
7979
Configurable<float> minRabs{"minRabs", 17.6, "min. R at absorber end for global muon (min. eta = -3.6)"}; // std::tan(2.f * std::atan(std::exp(- -3.6)) ) * -505. = 27.6
8080
Configurable<float> maxRabs{"maxRabs", 89.5, "max. R at absorber end"};
81-
Configurable<float> maxDCAxy{"maxDCAxy", 0.5, "max. DCAxy for global muons"};
81+
Configurable<float> maxDCAxy{"maxDCAxy", 0.3, "max. DCAxy for global muons"};
8282
Configurable<float> maxMatchingChi2MCHMFT{"maxMatchingChi2MCHMFT", 100.f, "max. chi2 for MCH-MFT matching"};
83-
Configurable<float> maxChi2{"maxChi2", 1e+10, "max. chi2/ndf for global muon"};
83+
Configurable<float> maxChi2{"maxChi2", 20, "max. chi2/ndf for global muon"};
8484
Configurable<float> maxChi2MFT{"maxChi2MFT", 1e+10, "max. chi2/ndf for MFTsa"};
8585
Configurable<int> minNclsMFT{"minNclsMFT", 5, "min ncluster of MFT"};
8686
Configurable<int> minNclsMCH{"minNclsMCH", 5, "min ncluster of MCH"};
@@ -216,15 +216,15 @@ struct globalDimuonFilter {
216216

217217
const AxisSpec axisMll{{0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00, 4.50, 5.00, 5.50, 6.00, 6.50, 7.00, 7.50, 8.00, 8.1, 8.2, 8.3, 8.4, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0}, "m_{#mu#mu} (GeV/c^{2})"};
218218
const AxisSpec axisPtll{{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.5, 3, 3.5, 4, 4.5, 5, 6, 7, 8, 9, 10}, "p_{T,#mu#mu} (GeV/c)"};
219-
const AxisSpec axisYll{30, -4.0, -2.5, "y_{#mu#mu}"};
219+
const AxisSpec axisYll{40, -4.0, -2.0, "y_{#mu#mu}"};
220220

221221
fRegistry.add("Pair/same/uls/hs", "dimuon", kTHnSparseD, {axisMll, axisPtll, axisYll}, false);
222222
fRegistry.add("Pair/same/lspp/hs", "dimuon", kTHnSparseD, {axisMll, axisPtll, axisYll}, false);
223223
fRegistry.add("Pair/same/lsmm/hs", "dimuon", kTHnSparseD, {axisMll, axisPtll, axisYll}, false);
224224

225225
const AxisSpec axisMllLMR{{0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.10, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.20, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.27, 2.28, 2.29, 2.30, 2.31, 2.32, 2.33, 2.34, 2.35, 2.36, 2.37, 2.38, 2.39, 2.40, 2.41, 2.42, 2.43, 2.44, 2.45, 2.46, 2.47, 2.48, 2.49, 2.50, 2.51, 2.52, 2.53, 2.54, 2.55, 2.56, 2.57, 2.58, 2.59, 2.60, 2.61, 2.62, 2.63, 2.64, 2.65, 2.66, 2.67, 2.68, 2.69, 2.70, 2.71, 2.72, 2.73, 2.74, 2.75, 2.76, 2.77, 2.78, 2.79, 2.80, 2.81, 2.82, 2.83, 2.84, 2.85, 2.86, 2.87, 2.88, 2.89, 2.90, 2.91, 2.92, 2.93, 2.94, 2.95, 2.96, 2.97, 2.98, 2.99, 3.00, 3.01, 3.02, 3.03, 3.04, 3.05, 3.06, 3.07, 3.08, 3.09, 3.10, 3.11, 3.12, 3.13, 3.14, 3.15, 3.16, 3.17, 3.18, 3.19, 3.20, 3.21, 3.22, 3.23, 3.24, 3.25, 3.26, 3.27, 3.28, 3.29, 3.30, 3.31, 3.32, 3.33, 3.34, 3.35, 3.36, 3.37, 3.38, 3.39, 3.40, 3.41, 3.42, 3.43, 3.44, 3.45, 3.46, 3.47, 3.48, 3.49, 3.50, 3.51, 3.52, 3.53, 3.54, 3.55, 3.56, 3.57, 3.58, 3.59, 3.60, 3.61, 3.62, 3.63, 3.64, 3.65, 3.66, 3.67, 3.68, 3.69, 3.70, 3.71, 3.72, 3.73, 3.74, 3.75, 3.76, 3.77, 3.78, 3.79, 3.80, 3.81, 3.82, 3.83, 3.84, 3.85, 3.86, 3.87, 3.88, 3.89, 3.90, 3.91, 3.92, 3.93, 3.94, 3.95, 3.96, 3.97, 3.98, 3.99, 4.00}, "m_{#mu#mu} (GeV/c^{2})"};
226226
const AxisSpec axisPt{{0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.5, 3, 3.5, 4, 4.5, 5, 6, 7, 8, 9, 10}, "p_{T,#mu} (GeV/c)"};
227-
const AxisSpec axisEta{30, -4.0, -2.5, "#eta_{#mu}"};
227+
const AxisSpec axisEta{40, -4.0, -2.0, "#eta_{#mu}"};
228228
const AxisSpec axisPhi{36, 0, 2 * M_PI, "#varphi_{#mu} (rad.)"};
229229
const AxisSpec axisDEta{100, -0.5, 0.5, "#Delta#eta"};
230230
const AxisSpec axisDPhi{90, -M_PI / 4, M_PI / 4, "#Delta#varphi (rad.)"};
@@ -989,16 +989,11 @@ struct globalDimuonFilter {
989989
fRegistry.fill(HIST("hCollisionCounter"), 9);
990990

991991
auto fwdtracks_per_coll = fwdtracks.sliceBy(perCollision, collision.globalIndex());
992-
std::vector<std::tuple<int, ROOT::Math::PtEtaPhiMVector>> posMuons;
993-
std::vector<std::tuple<int, ROOT::Math::PtEtaPhiMVector>> negMuons;
992+
std::vector<std::pair<int, ROOT::Math::PtEtaPhiMVector>> posMuons;
993+
std::vector<std::pair<int, ROOT::Math::PtEtaPhiMVector>> negMuons;
994994
posMuons.reserve(fwdtracks_per_coll.size());
995995
negMuons.reserve(fwdtracks_per_coll.size());
996996

997-
std::vector<int> posProbeMuons;
998-
std::vector<int> negProbeMuons;
999-
posProbeMuons.reserve(fwdtracks_per_coll.size());
1000-
negProbeMuons.reserve(fwdtracks_per_coll.size());
1001-
1002997
for (const auto& fwdtrack : fwdtracks_per_coll) {
1003998
float pt = 999.f, eta = 999.f, phi = 999.f;
1004999
if (isSelectedGlobalMuon(collision, fwdtrack, fwdtracks, mfttracks, mftCovs, pt, eta, phi)) {
@@ -1008,7 +1003,33 @@ struct globalDimuonFilter {
10081003
negMuons.emplace_back(std::make_tuple(fwdtrack.globalIndex(), ROOT::Math::PtEtaPhiMVector(pt, eta, phi, o2::constants::physics::MassMuon)));
10091004
}
10101005
}
1006+
} // end of fwdtrack loop
1007+
1008+
// make pairs
1009+
runPairing(collision, posMuons, negMuons, fwdtracks, mfttracks, mftCovs);
1010+
1011+
posMuons.clear();
1012+
posMuons.shrink_to_fit();
1013+
negMuons.clear();
1014+
negMuons.shrink_to_fit();
1015+
} // end of collision loop
10111016

1017+
// for TAP
1018+
for (const auto& collision : collisions) {
1019+
auto bc = collision.template bc_as<MyBCs>();
1020+
initCCDB(bc);
1021+
1022+
if (!isSelectedCollision(collision)) {
1023+
continue;
1024+
}
1025+
1026+
auto fwdtracks_per_coll = fwdtracks.sliceBy(perCollision, collision.globalIndex());
1027+
std::vector<int> posProbeMuons;
1028+
std::vector<int> negProbeMuons;
1029+
posProbeMuons.reserve(fwdtracks_per_coll.size());
1030+
negProbeMuons.reserve(fwdtracks_per_coll.size());
1031+
1032+
for (const auto& fwdtrack : fwdtracks_per_coll) {
10121033
if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
10131034
if (fwdtrack.sign() > 0) {
10141035
posProbeMuons.emplace_back(fwdtrack.globalIndex());
@@ -1018,17 +1039,9 @@ struct globalDimuonFilter {
10181039
}
10191040
} // end of fwdtrack loop
10201041

1021-
// make pairs
1022-
runPairing(collision, posMuons, negMuons, fwdtracks, mfttracks, mftCovs);
1023-
10241042
// track cut efficiency
10251043
runTAP(collision, posProbeMuons, negProbeMuons, fwdtracks, mfttracks, mftCovs);
10261044

1027-
posMuons.clear();
1028-
posMuons.shrink_to_fit();
1029-
negMuons.clear();
1030-
negMuons.shrink_to_fit();
1031-
10321045
posProbeMuons.clear();
10331046
posProbeMuons.shrink_to_fit();
10341047
negProbeMuons.clear();
@@ -1125,11 +1138,6 @@ struct globalDimuonFilter {
11251138
posMuons.reserve(fwdtrackIdsThisCollision.size());
11261139
negMuons.reserve(fwdtrackIdsThisCollision.size());
11271140

1128-
std::vector<int> posProbeMuons;
1129-
std::vector<int> negProbeMuons;
1130-
posProbeMuons.reserve(fwdtrackIdsThisCollision.size());
1131-
negProbeMuons.reserve(fwdtrackIdsThisCollision.size());
1132-
11331141
for (const auto& fwdtrackId : fwdtrackIdsThisCollision) {
11341142
auto fwdtrack = fwdtrackId.template fwdtrack_as<MyFwdTracks>();
11351143
float pt = 999.f, eta = 999.f, phi = 999.f;
@@ -1140,7 +1148,34 @@ struct globalDimuonFilter {
11401148
negMuons.emplace_back(std::make_pair(fwdtrack.globalIndex(), ROOT::Math::PtEtaPhiMVector(pt, eta, phi, o2::constants::physics::MassMuon)));
11411149
}
11421150
}
1151+
} // end of fwdtrack loop
1152+
1153+
// make pairs
1154+
runPairing(collision, posMuons, negMuons, fwdtracks, mfttracks, mftCovs);
1155+
1156+
posMuons.clear();
1157+
posMuons.shrink_to_fit();
1158+
negMuons.clear();
1159+
negMuons.shrink_to_fit();
1160+
} // end of collision loop
1161+
1162+
// for TAP
1163+
for (const auto& collision : collisions) {
1164+
auto bc = collision.template bc_as<MyBCs>();
1165+
initCCDB(bc);
11431166

1167+
if (!isSelectedCollision(collision)) {
1168+
continue;
1169+
}
1170+
1171+
auto fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex());
1172+
std::vector<int> posProbeMuons;
1173+
std::vector<int> negProbeMuons;
1174+
posProbeMuons.reserve(fwdtrackIdsThisCollision.size());
1175+
negProbeMuons.reserve(fwdtrackIdsThisCollision.size());
1176+
1177+
for (const auto& fwdtrackId : fwdtrackIdsThisCollision) {
1178+
auto fwdtrack = fwdtrackId.template fwdtrack_as<MyFwdTracks>();
11441179
if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
11451180
if (fwdtrack.sign() > 0) {
11461181
posProbeMuons.emplace_back(fwdtrack.globalIndex());
@@ -1150,17 +1185,9 @@ struct globalDimuonFilter {
11501185
}
11511186
} // end of fwdtrack loop
11521187

1153-
// make pairs
1154-
runPairing(collision, posMuons, negMuons, fwdtracks, mfttracks, mftCovs);
1155-
11561188
// track cut efficiency
11571189
runTAP(collision, posProbeMuons, negProbeMuons, fwdtracks, mfttracks, mftCovs);
11581190

1159-
posMuons.clear();
1160-
posMuons.shrink_to_fit();
1161-
negMuons.clear();
1162-
negMuons.shrink_to_fit();
1163-
11641191
posProbeMuons.clear();
11651192
posProbeMuons.shrink_to_fit();
11661193
negProbeMuons.clear();

0 commit comments

Comments
 (0)