Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PWGHF/D2H/Tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ o2physics_add_dpl_workflow(task-lc
o2physics_add_dpl_workflow(task-upc-lc
SOURCES taskUpcLc.cxx
REUSE_FROM HfCandidatesPCH
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::SGCutParHolder O2Physics::EventFilteringUtils
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::SGCutParHolder O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(task-lc-to-k0s-p
Expand Down
40 changes: 35 additions & 5 deletions PWGHF/D2H/Tasks/taskUpcLc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "PWGUD/Core/SGSelector.h"
#include "PWGUD/Core/UPCHelpers.h"

#include "Common/CCDB/ctpRateFetcher.h"
#include "Common/Core/RecoDecay.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/Multiplicity.h"
Expand All @@ -48,6 +49,9 @@
#include <Framework/runDataProcessing.h>
#include <ReconstructionDataFormats/Vertex.h>

#include <TH1.h>
#include <TH2.h>

#include <array>
#include <cmath>
#include <cstdint>
Expand All @@ -70,6 +74,8 @@ namespace full
DECLARE_SOA_COLUMN(M, m, float);
DECLARE_SOA_COLUMN(Pt, pt, float);
DECLARE_SOA_COLUMN(BkgScore, bkgScore, float);
DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); //! Run number of the collision
DECLARE_SOA_COLUMN(HasLcCandidate, hasLcCandidate, bool); //! At least one selected Lc candidate within the task rapidity acceptance
DECLARE_SOA_COLUMN(PtProng0, ptProng0, float);
DECLARE_SOA_COLUMN(PtProng1, ptProng1, float);
DECLARE_SOA_COLUMN(PtProng2, ptProng2, float);
Expand All @@ -94,12 +100,15 @@ DECLARE_SOA_TABLE(HfUpcQa, "AOD", "HFUPCQA",
full::AmpFT0A,
full::AmpFT0C,
full::ZdcTimeZNA,
full::ZdcTimeZNC);
full::ZdcTimeZNC,
full::HasLcCandidate,
full::RunNumber);

DECLARE_SOA_TABLE(HfUpcLcBdtInfos, "AOD", "HFUPCLCBDTINFOS",
full::M,
full::Pt,
full::BkgScore);
full::BkgScore,
full::RunNumber);

DECLARE_SOA_TABLE(HfUpcLcInfos, "AOD", "HFUPCLCINFOS",
full::M,
Expand Down Expand Up @@ -153,13 +162,15 @@ struct HfTaskUpcLc {
Configurable<bool> fillHistQa{"fillHistQa", false, "Fill histograms for UPC detector QA"};
Configurable<bool> verticesWithUpc{"verticesWithUpc", false, "Consider vertices with UPC settings"};
Configurable<float> zdcTimeThreshold{"zdcTimeThreshold", 2., "Threshold for ZNA/ZNC time"};
Configurable<std::string> irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (pp: T0VTX, Pb-Pb: ZNC hadronic)"};
// CCDB configuration
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"};
Configurable<std::string> ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"};

HfEventSelection hfEvSel; // event selection and monitoring
HfUpcGapThresholds upcThresholds; // UPC gap determination thresholds
ctpRateFetcher mRateFetcher;
SliceCache cache;
Service<o2::ccdb::BasicCCDBManager> ccdb{};

Expand All @@ -174,6 +185,8 @@ struct HfTaskUpcLc {
Preslice<aod::HfCand3Prong> candLcPerCollision = aod::hf_cand::collisionId;
PresliceUnsorted<aod::McCollisionLabels> colPerMcCollision = aod::mcparticle::mcCollisionId;

ConfigurableAxis axisInteractionRate{"axisInteractionRate", {1000, 0., 100.}, "Interaction rate axis (kHz)"};

HistogramRegistry registry{"registry", {}};

enum MlClasses : int {
Expand All @@ -191,6 +204,11 @@ struct HfTaskUpcLc {
}

auto vbins = std::vector<double>(binsPt);
if (fillHistQa) {
auto hInteractionRateVsRun = registry.add<TH2>("Data/hInteractionRateVsRun", "Selected collisions;Run number;Hadronic interaction rate (kHz)", HistType::kTH2F, {{1, 0., 1.}, axisInteractionRate});
hInteractionRateVsRun->SetCanExtend(TH1::kXaxis);
hInteractionRateVsRun->GetXaxis()->LabelsOption("v");
}
registry.add("Data/fitInfo/ampFT0A_vs_ampFT0C", "FT0-A vs FT0-C amplitude;FT0-A amplitude (a.u.);FT0-C amplitude (a.u.)", {HistType::kTH2F, {{200, 0., 200}, {200, 0., 200}}});
registry.add("Data/zdc/energyZNA_vs_energyZNC", "ZNA vs ZNC common energy;E_{ZNA}^{common} (a.u.);E_{ZNC}^{common} (a.u.)", {HistType::kTH2F, {{100, 0., 10}, {100, 0., 10}}});
registry.add("Data/zdc/timeZNA_vs_timeZNC", "ZNA vs ZNC time;ZNA Time;ZNC time", {HistType::kTH2F, {{200, -10., 10}, {200, -10., 10}}});
Expand Down Expand Up @@ -323,17 +341,25 @@ struct HfTaskUpcLc {
registry.fill(HIST("Data/hUpcMulti"), multNTracksPV);
registry.fill(HIST("Data/hUpcVtz"), posZ);

if (fillTreeUpcQa) {
rowUpcQa(numPvContributors, multNTracksPV, posZ, fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC);
if constexpr (!IsMc) {
if (fillHistQa) {
const double rate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource, true);
if (rate >= 0.) {
const auto runLabel = std::to_string(bc.runNumber());
registry.get<TH2>(HIST("Data/hInteractionRateVsRun"))->Fill(runLabel.c_str(), rate * 1.e-3, 1.); // Hz to kHz
}
}
}

bool hasLcCandidate = false;
for (const auto& candidate : groupedLcCandidates) {
if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) {
continue;
}
if (yCandRecoMax >= 0. && std::abs(HfHelper::yLc(candidate)) > yCandRecoMax) {
continue;
}
hasLcCandidate = true;
const auto pt = candidate.pt();
const auto ptProng0 = candidate.ptProng0();
const auto ptProng1 = candidate.ptProng1();
Expand Down Expand Up @@ -371,7 +397,7 @@ struct HfTaskUpcLc {
outputBkg = mlProb[MlClassBackground]; /// bkg score
}
/// Fill the ML outputScores and variables of candidate
rowCandUpcBdt(massLc, pt, outputBkg);
rowCandUpcBdt(massLc, pt, outputBkg, bc.runNumber());

} else {
rowCandUpc(massLc, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa);
Expand All @@ -385,6 +411,10 @@ struct HfTaskUpcLc {
fillTHnData(false);
}
}
if (fillTreeUpcQa) {
// One QA row per selected collision, including collisions without Lc candidates.
rowUpcQa(numPvContributors, multNTracksPV, posZ, fitInfo.ampFT0A, fitInfo.ampFT0C, zdcTimeZNA, zdcTimeZNC, hasLcCandidate, bc.runNumber());
}
}
}

Expand Down
Loading