Skip to content

Commit d511876

Browse files
authored
[PWGHF] Apply UPC Lc ZDC timing cut online and simplify TTree (#16501)
1 parent 168c4f5 commit d511876

1 file changed

Lines changed: 28 additions & 32 deletions

File tree

PWGHF/D2H/Tasks/taskUpcLc.cxx

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,7 @@ DECLARE_SOA_TABLE(HfUpcQa, "AOD", "HFUPCQA",
9292
DECLARE_SOA_TABLE(HfUpcLcBdtInfos, "AOD", "HFUPCLCBDTINFOS",
9393
full::M,
9494
full::Pt,
95-
full::BkgScore,
96-
full::AmpFT0A,
97-
full::AmpFT0C,
98-
full::ZdcTimeZNA,
99-
full::ZdcTimeZNC);
95+
full::BkgScore);
10096

10197
DECLARE_SOA_TABLE(HfUpcLcInfos, "AOD", "HFUPCLCINFOS",
10298
full::M,
@@ -106,11 +102,7 @@ DECLARE_SOA_TABLE(HfUpcLcInfos, "AOD", "HFUPCLCINFOS",
106102
full::PtProng2,
107103
full::Chi2PCA,
108104
full::DecayLength,
109-
full::Cpa,
110-
full::AmpFT0A,
111-
full::AmpFT0C,
112-
full::ZdcTimeZNA,
113-
full::ZdcTimeZNC);
105+
full::Cpa);
114106
} // namespace o2::aod
115107

116108
/// Λc± → p± K∓ π± analysis task
@@ -125,6 +117,7 @@ struct HfTaskUpcLc {
125117
Configurable<bool> fillTreeOnlySingleGap{"fillTreeOnlySingleGap", false, "Only fill the tree for candidates that pass the single-gap UPC events"};
126118
Configurable<bool> fillTreeUpcQa{"fillTreeUpcQa", false, "Fill Tree for UPC QA"};
127119
Configurable<bool> verticesWithUpc{"verticesWithUpc", false, "Consider vertices with UPC settings"};
120+
Configurable<float> zdcTimeThreshold{"zdcTimeThreshold", 2., "Threshold for ZNA/ZNC time"};
128121
// CCDB configuration
129122
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
130123
Configurable<std::string> ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"};
@@ -167,7 +160,7 @@ struct HfTaskUpcLc {
167160
registry.add("Data/hUpcGapAfterSelection", "UPC gap type after selection;Gap side;Counts", {HistType::kTH1F, {{7, -1.5, 5.5}}});
168161
registry.add("Data/hUpcMulti", "Multiplicity of UPC events;Multiplicity;Counts", {HistType::kTH1F, {{200, -0.5, 199.5}}});
169162
registry.add("Data/hUpcVtz", "Vertex Z position of UPC events;Vz (cm);Counts", {HistType::kTH1F, {{200, -10., 10.}}});
170-
163+
registry.add("Data/eta_vs_Multi", "Eta vs Multiplicity;Eta;Multiplicity", {HistType::kTH2F, {{20, -1., 1.}, {200, -0.5, 199.5}}});
171164
hfEvSel.addHistograms(registry);
172165
ccdb->setURL(ccdbUrl);
173166
ccdb->setCaching(true);
@@ -226,9 +219,13 @@ struct HfTaskUpcLc {
226219
float zdcEnergyZNC = -1.f;
227220
float zdcTimeZNA = -1.f;
228221
float zdcTimeZNC = -1.f;
222+
bool gapA0nXn = false;
223+
bool gapCXn0n = false;
224+
229225
if (verticesWithUpc && !upcFlag) {
230226
continue;
231227
}
228+
232229
if (hasZdc) {
233230
const auto zdc = bcForUPC.zdc();
234231
zdcEnergyZNA = zdc.energyCommonZNA();
@@ -240,12 +237,22 @@ struct HfTaskUpcLc {
240237
registry.fill(HIST("Data/zdc/timeZNA_vs_timeZNC"), zdcTimeZNA, zdcTimeZNC);
241238
registry.fill(HIST("Data/hUpcGapAfterSelection"), static_cast<int>(gap));
242239
}
243-
if (gap == o2::aod::sgselector::TrueGap::SingleGapA || gap == o2::aod::sgselector::TrueGap::SingleGapC) {
244-
registry.fill(HIST("Data/hUpcMulti"), collision.multNTracksPV());
245-
registry.fill(HIST("Data/hUpcVtz"), collision.posZ());
246-
if (fillTreeUpcQa) {
247-
rowUpcQa(numPvContributors, collision.multNTracksPV(), collision.posZ(), fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC);
248-
}
240+
const bool ignoreZdcTime = (zdcTimeThreshold < 0.f);
241+
242+
if (gap == o2::aod::sgselector::TrueGap::SingleGapA && (ignoreZdcTime || (std::abs(zdcTimeZNA) > zdcTimeThreshold && std::abs(zdcTimeZNC) < zdcTimeThreshold))) {
243+
gapA0nXn = true;
244+
}
245+
if (gap == o2::aod::sgselector::TrueGap::SingleGapC && (ignoreZdcTime || (std::abs(zdcTimeZNA) < zdcTimeThreshold && std::abs(zdcTimeZNC) > zdcTimeThreshold))) {
246+
gapCXn0n = true;
247+
}
248+
if (fillTreeOnlySingleGap & !gapA0nXn & !gapCXn0n) {
249+
continue;
250+
}
251+
registry.fill(HIST("Data/hUpcMulti"), collision.multNTracksPV());
252+
registry.fill(HIST("Data/hUpcVtz"), collision.posZ());
253+
254+
if (fillTreeUpcQa) {
255+
rowUpcQa(numPvContributors, collision.multNTracksPV(), collision.posZ(), fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC);
249256
}
250257

251258
for (const auto& candidate : groupedLcCandidates) {
@@ -262,34 +269,23 @@ struct HfTaskUpcLc {
262269
const auto decayLength = candidate.decayLength();
263270
const auto chi2PCA = candidate.chi2PCA();
264271
const auto cpa = candidate.cpa();
272+
const auto eta = candidate.eta();
265273

266274
double outputBkg(-1);
267275

268276
auto fillTHnData = [&](bool isPKPi) {
269277
const auto massLc = isPKPi ? HfHelper::invMassLcToPKPi(candidate) : HfHelper::invMassLcToPiKP(candidate);
270-
278+
registry.fill(HIST("Data/eta_vs_Multi"), eta, collision.multNTracksPV());
271279
if constexpr (FillMl) {
272280
const auto& mlProb = isPKPi ? candidate.mlProbLcToPKPi() : candidate.mlProbLcToPiKP();
273281
if (mlProb.size() == NumberOfMlClasses) {
274282
outputBkg = mlProb[MlClassBackground]; /// bkg score
275283
}
276284
/// Fill the ML outputScores and variables of candidate
277-
if (fillTreeOnlySingleGap) {
278-
if (gap == o2::aod::sgselector::TrueGap::SingleGapA || gap == o2::aod::sgselector::TrueGap::SingleGapC) {
279-
rowCandUpcBdt(massLc, pt, outputBkg, fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC);
280-
}
281-
} else {
282-
rowCandUpcBdt(massLc, pt, outputBkg, fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC);
283-
}
285+
rowCandUpcBdt(massLc, pt, outputBkg);
284286

285287
} else {
286-
if (fillTreeOnlySingleGap) {
287-
if (gap == o2::aod::sgselector::TrueGap::SingleGapA || gap == o2::aod::sgselector::TrueGap::SingleGapC) {
288-
rowCandUpc(massLc, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC);
289-
}
290-
} else {
291-
rowCandUpc(massLc, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC);
292-
}
288+
rowCandUpc(massLc, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa);
293289
}
294290
};
295291

0 commit comments

Comments
 (0)