Skip to content

Commit 55d92a5

Browse files
committed
apply ZDC timing cut online
1 parent 4efc60e commit 55d92a5

1 file changed

Lines changed: 34 additions & 33 deletions

File tree

PWGHF/D2H/Tasks/taskUpcLc.cxx

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/// \author Ran Tu <ran.tu@cern.ch>, Fudan University
1818

1919
#include "PWGHF/Core/CentralityEstimation.h"
20+
#include "PWGHF/Core/DecayChannels.h"
2021
#include "PWGHF/Core/HfHelper.h"
2122
#include "PWGHF/Core/SelectorCuts.h"
2223
#include "PWGHF/DataModel/AliasTables.h"
@@ -28,11 +29,12 @@
2829
#include "PWGUD/Core/SGSelector.h"
2930
#include "PWGUD/Core/UPCHelpers.h"
3031

32+
#include "Common/Core/RecoDecay.h"
3133
#include "Common/DataModel/EventSelection.h"
3234
#include "Common/DataModel/Multiplicity.h"
3335

3436
#include <CCDB/BasicCCDBManager.h>
35-
#include <CommonDataFormat/TimeStamp.h>
37+
#include <CommonConstants/PhysicsConstants.h>
3638
#include <Framework/ASoA.h>
3739
#include <Framework/AnalysisDataModel.h>
3840
#include <Framework/AnalysisHelpers.h>
@@ -42,9 +44,12 @@
4244
#include <Framework/HistogramSpec.h>
4345
#include <Framework/InitContext.h>
4446
#include <Framework/Logger.h>
47+
#include <Framework/OutputObjHeader.h>
4548
#include <Framework/runDataProcessing.h>
4649
#include <ReconstructionDataFormats/Vertex.h>
4750

51+
#include <TPDGCode.h>
52+
4853
#include <array>
4954
#include <cmath>
5055
#include <numeric>
@@ -92,11 +97,7 @@ DECLARE_SOA_TABLE(HfUpcQa, "AOD", "HFUPCQA",
9297
DECLARE_SOA_TABLE(HfUpcLcBdtInfos, "AOD", "HFUPCLCBDTINFOS",
9398
full::M,
9499
full::Pt,
95-
full::BkgScore,
96-
full::AmpFT0A,
97-
full::AmpFT0C,
98-
full::ZdcTimeZNA,
99-
full::ZdcTimeZNC);
100+
full::BkgScore);
100101

101102
DECLARE_SOA_TABLE(HfUpcLcInfos, "AOD", "HFUPCLCINFOS",
102103
full::M,
@@ -106,11 +107,7 @@ DECLARE_SOA_TABLE(HfUpcLcInfos, "AOD", "HFUPCLCINFOS",
106107
full::PtProng2,
107108
full::Chi2PCA,
108109
full::DecayLength,
109-
full::Cpa,
110-
full::AmpFT0A,
111-
full::AmpFT0C,
112-
full::ZdcTimeZNA,
113-
full::ZdcTimeZNC);
110+
full::Cpa);
114111
} // namespace o2::aod
115112

116113
/// Λc± → p± K∓ π± analysis task
@@ -125,6 +122,7 @@ struct HfTaskUpcLc {
125122
Configurable<bool> fillTreeOnlySingleGap{"fillTreeOnlySingleGap", false, "Only fill the tree for candidates that pass the single-gap UPC events"};
126123
Configurable<bool> fillTreeUpcQa{"fillTreeUpcQa", false, "Fill Tree for UPC QA"};
127124
Configurable<bool> verticesWithUpc{"verticesWithUpc", false, "Consider vertices with UPC settings"};
125+
Configurable<float> zdcTimeThreshold{"zdcTimeThreshold", 2., "Threshold for ZNA/ZNC time"};
128126
// CCDB configuration
129127
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
130128
Configurable<std::string> ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"};
@@ -167,7 +165,7 @@ struct HfTaskUpcLc {
167165
registry.add("Data/hUpcGapAfterSelection", "UPC gap type after selection;Gap side;Counts", {HistType::kTH1F, {{7, -1.5, 5.5}}});
168166
registry.add("Data/hUpcMulti", "Multiplicity of UPC events;Multiplicity;Counts", {HistType::kTH1F, {{200, -0.5, 199.5}}});
169167
registry.add("Data/hUpcVtz", "Vertex Z position of UPC events;Vz (cm);Counts", {HistType::kTH1F, {{200, -10., 10.}}});
170-
168+
registry.add("Data/eta_vs_Multi", "Eta vs Multiplicity;Eta;Multiplicity", {HistType::kTH2F, {{20, -1., 1.}, {200, -0.5, 199.5}}});
171169
hfEvSel.addHistograms(registry);
172170
ccdb->setURL(ccdbUrl);
173171
ccdb->setCaching(true);
@@ -226,9 +224,13 @@ struct HfTaskUpcLc {
226224
float zdcEnergyZNC = -1.f;
227225
float zdcTimeZNA = -1.f;
228226
float zdcTimeZNC = -1.f;
227+
bool gapA0nXn = false;
228+
bool gapCXn0n = false;
229+
229230
if (verticesWithUpc && !upcFlag) {
230231
continue;
231232
}
233+
232234
if (hasZdc) {
233235
const auto zdc = bcForUPC.zdc();
234236
zdcEnergyZNA = zdc.energyCommonZNA();
@@ -240,12 +242,22 @@ struct HfTaskUpcLc {
240242
registry.fill(HIST("Data/zdc/timeZNA_vs_timeZNC"), zdcTimeZNA, zdcTimeZNC);
241243
registry.fill(HIST("Data/hUpcGapAfterSelection"), static_cast<int>(gap));
242244
}
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-
}
245+
const bool ignoreZdcTime = (zdcTimeThreshold < 0.f);
246+
247+
if (gap == o2::aod::sgselector::TrueGap::SingleGapA && (ignoreZdcTime || (std::abs(zdcTimeZNA) > zdcTimeThreshold && std::abs(zdcTimeZNC) < zdcTimeThreshold))) {
248+
gapA0nXn = true;
249+
}
250+
if (gap == o2::aod::sgselector::TrueGap::SingleGapC && (ignoreZdcTime || (std::abs(zdcTimeZNA) < zdcTimeThreshold && std::abs(zdcTimeZNC) > zdcTimeThreshold))) {
251+
gapCXn0n = true;
252+
}
253+
if (fillTreeOnlySingleGap & !gapA0nXn & !gapCXn0n) {
254+
continue;
255+
}
256+
registry.fill(HIST("Data/hUpcMulti"), collision.multNTracksPV());
257+
registry.fill(HIST("Data/hUpcVtz"), collision.posZ());
258+
259+
if (fillTreeUpcQa) {
260+
rowUpcQa(numPvContributors, collision.multNTracksPV(), collision.posZ(), fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC);
249261
}
250262

251263
for (const auto& candidate : groupedLcCandidates) {
@@ -262,34 +274,23 @@ struct HfTaskUpcLc {
262274
const auto decayLength = candidate.decayLength();
263275
const auto chi2PCA = candidate.chi2PCA();
264276
const auto cpa = candidate.cpa();
277+
const auto eta = candidate.eta();
265278

266279
double outputBkg(-1);
267280

268281
auto fillTHnData = [&](bool isPKPi) {
269282
const auto massLc = isPKPi ? HfHelper::invMassLcToPKPi(candidate) : HfHelper::invMassLcToPiKP(candidate);
270-
283+
registry.fill(HIST("Data/eta_vs_Multi"), eta, collision.multNTracksPV());
271284
if constexpr (FillMl) {
272285
const auto& mlProb = isPKPi ? candidate.mlProbLcToPKPi() : candidate.mlProbLcToPiKP();
273286
if (mlProb.size() == NumberOfMlClasses) {
274287
outputBkg = mlProb[MlClassBackground]; /// bkg score
275288
}
276289
/// 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-
}
290+
rowCandUpcBdt(massLc, pt, outputBkg);
284291

285292
} 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-
}
293+
rowCandUpc(massLc, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa);
293294
}
294295
};
295296

0 commit comments

Comments
 (0)