Skip to content

Commit

Permalink
add QA plots for MC + add dca v0-to-pv cut (AliceO2Group#5958)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciacco authored May 2, 2024
1 parent 6255cbe commit 13610f9
Showing 1 changed file with 56 additions and 5 deletions.
61 changes: 56 additions & 5 deletions PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,19 @@ float etaFromMom(std::array<float, 3> const& momA, std::array<float, 3> const& m
(1.f * momA[2] + 1.f * momB[2]) * (1.f * momA[2] + 1.f * momB[2])) -
(1.f * momA[2] + 1.f * momB[2])));
}
float CalculateDCAStraightToPV(float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ)
{
return std::sqrt((std::pow((pvY - Y) * Pz - (pvZ - Z) * Py, 2) + std::pow((pvX - X) * Pz - (pvZ - Z) * Px, 2) + std::pow((pvX - X) * Py - (pvY - Y) * Px, 2)) / (Px * Px + Py * Py + Pz * Pz));
}
} // namespace

struct CandidateV0 {
float pt;
float eta;
float mass;
float cpa;
float dcav0daugh;
float dcav0pv;
int64_t globalIndexPos = -999;
int64_t globalIndexNeg = -999;
};
Expand Down Expand Up @@ -245,8 +253,8 @@ struct antidLambdaEbye {
Configurable<float> tofMassMaxQA{"tofMassMaxQA", 0.6f, "(temporary) tof mass cut (for QA histograms)"};

Configurable<float> v0setting_dcav0dau{"v0setting_dcav0dau", 1, "DCA V0 Daughters"};
Configurable<float> v0setting_dcapostopv{"v0setting_dcapostopv", 0.1f, "DCA Pos To PV"};
Configurable<float> v0setting_dcanegtopv{"v0setting_dcanegtopv", 0.1f, "DCA Neg To PV"};
Configurable<float> v0setting_dcav0pv{"v0setting_dcav0pv", 1, "DCA V0 to Pv"};
Configurable<float> v0setting_dcadaughtopv{"v0setting_dcadaughtopv", 0.1f, "DCA Pos To PV"};
Configurable<double> v0setting_cospa{"v0setting_cospa", 0.98, "V0 CosPA"};
Configurable<float> v0setting_radius{"v0setting_radius", 0.5f, "v0radius"};
Configurable<float> v0setting_lifetime{"v0setting_lifetime", 40.f, "v0 lifetime cut"};
Expand Down Expand Up @@ -480,13 +488,26 @@ struct antidLambdaEbye {
// v0 QA
histos.add<TH3>("QA/massLambda", ";Centrality (%);#it{p}_{T} (GeV/#it{c});#it{M}(p + #pi^{-}) (GeV/#it{c}^{2});Entries", HistType::kTH3F, {centAxis, momAxis, massLambdaAxis});
histos.add<TH1>("QA/cosPa", ";cosPa;Entries", HistType::kTH1F, {cosPaAxis});
histos.add<TH1>("QA/cosPaSig", ";cosPa;Entries", HistType::kTH1F, {cosPaAxis});
histos.add<TH1>("QA/cosPaBkg", ";cosPa;Entries", HistType::kTH1F, {cosPaAxis});
histos.add<TH1>("QA/dcaV0daughSig", ";dcaV0daugh;Entries", HistType::kTH1F, {dcaV0daughAxis});
histos.add<TH1>("QA/dcaV0daughBkg", ";dcaV0daugh;Entries", HistType::kTH1F, {dcaV0daughAxis});
histos.add<TH1>("QA/dcaV0PvSig", ";dcaV0Pv;Entries", HistType::kTH1F, {dcaV0daughAxis});
histos.add<TH1>("QA/dcaV0PvBkg", ";dcaV0Pv;Entries", HistType::kTH1F, {dcaV0daughAxis});
histos.add<TH2>("QA/cosPaDcaV0daughSig", ";cosPa;dcaV0daugh", HistType::kTH2F, {cosPaAxis, dcaV0daughAxis});
histos.add<TH2>("QA/cosPaDcaV0daughBkg", ";cosPa;dcaV0daugh", HistType::kTH2F, {cosPaAxis, dcaV0daughAxis});
histos.add<TH3>("QA/massLambdaEvRej", ";Centrality (%);#it{p}_{T} (GeV/#it{c});#it{M}(p + #pi^{-}) (GeV/#it{c}^{2});Entries", HistType::kTH3F, {centAxis, momAxis, massLambdaAxis});
histos.add<TH3>("QA/massLambdaEvRejSig", ";Centrality (%);#it{p}_{T} (GeV/#it{c});#it{M}(p + #pi^{-}) (GeV/#it{c}^{2});Entries", HistType::kTH3F, {centAxis, momAxis, massLambdaAxis});
histos.add<TH3>("QA/massLambdaEvRejBkg", ";Centrality (%);#it{p}_{T} (GeV/#it{c});#it{M}(p + #pi^{-}) (GeV/#it{c}^{2});Entries", HistType::kTH3F, {centAxis, momAxis, massLambdaAxis});
histos.add<TH1>("QA/radius", ";radius;Entries", HistType::kTH1F, {radiusAxis});
histos.add<TH1>("QA/dcaV0daugh", ";dcaV0daugh;Entries", HistType::kTH1F, {dcaV0daughAxis});
histos.add<TH1>("QA/dcaV0Pv", ";dcaV0Pv;Entries", HistType::kTH1F, {dcaV0daughAxis});
histos.add<TH1>("QA/dcaPosPv", ";dcaPosPv;Entries", HistType::kTH1F, {dcaDaughPvAxis});
histos.add<TH1>("QA/dcaNegPv", ";dcaNegPv;Entries", HistType::kTH1F, {dcaDaughPvAxis});
histos.add<TH1>("QA/cosPaBeforeCut", ";cosPa;Entries", HistType::kTH1F, {cosPaAxis});
histos.add<TH1>("QA/radiusBeforeCut", ";radius;Entries", HistType::kTH1F, {radiusAxis});
histos.add<TH1>("QA/dcaV0daughBeforeCut", ";dcaV0daugh;Entries", HistType::kTH1F, {dcaV0daughAxis});
histos.add<TH1>("QA/dcaV0PvBeforeCut", ";dcaV0Pv;Entries", HistType::kTH1F, {dcaV0daughAxis});

// d QA
histos.add<TH2>("QA/dcaPv", ";#it{p}_{T} (GeV/#it{c});dcaPv;Entries", HistType::kTH2F, {momAxis, dcaDaughPvAxis});
Expand Down Expand Up @@ -726,6 +747,17 @@ struct antidLambdaEbye {
continue;
}

float dcaV0Pv = CalculateDCAStraightToPV(
vtx[0], vtx[1], vtx[2],
momPos[0] + momNeg[0],
momPos[1] + momNeg[1],
momPos[2] + momNeg[2],
collision.posX(), collision.posY(), collision.posZ());
histos.fill(HIST("QA/dcaV0PvBeforeCut"), dcaV0Pv);
if (std::abs(dcaV0Pv) > v0setting_dcav0pv) {
continue;
}

double cosPA = RecoDecay::cpa(primVtx, vtx, momV0);
histos.fill(HIST("QA/cosPaBeforeCut"), cosPA);
if (cosPA < v0setting_cospa) {
Expand All @@ -741,13 +773,13 @@ struct antidLambdaEbye {

o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, posTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo);
auto posDcaToPv = std::hypot(dcaInfo[0], dcaInfo[1]);
if (posDcaToPv < v0setting_dcapostopv && std::abs(dcaInfo[0]) < v0setting_dcapostopv) {
if (posDcaToPv < v0setting_dcadaughtopv && std::abs(dcaInfo[0]) < v0setting_dcadaughtopv) {
continue;
}

o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, negTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo);
auto negDcaToPv = std::hypot(dcaInfo[0], dcaInfo[1]);
if (negDcaToPv < v0setting_dcanegtopv && std::abs(dcaInfo[0]) < v0setting_dcanegtopv) {
if (negDcaToPv < v0setting_dcadaughtopv && std::abs(dcaInfo[0]) < v0setting_dcadaughtopv) {
continue;
}

Expand All @@ -764,6 +796,7 @@ struct antidLambdaEbye {
histos.fill(HIST("QA/dcaV0daugh"), dcaV0dau);
histos.fill(HIST("QA/dcaPosPv"), posDcaToPv);
histos.fill(HIST("QA/dcaNegPv"), negDcaToPv);
histos.fill(HIST("QA/dcaV0Pv"), dcaV0Pv);

if (matter) {
tempHistos.fill(HIST("tempLambda"), std::abs(etaV0), ptV0);
Expand All @@ -777,6 +810,10 @@ struct antidLambdaEbye {
CandidateV0 candV0;
candV0.pt = ptV0;
candV0.eta = etaV0;
candV0.mass = mLambda;
candV0.cpa = cosPA;
candV0.dcav0daugh = dcaV0dau;
candV0.dcav0pv = dcaV0Pv;
candV0.globalIndexPos = posTrack.globalIndex();
candV0.globalIndexNeg = negTrack.globalIndex();
candidateV0s.push_back(candV0);
Expand All @@ -795,6 +832,9 @@ struct antidLambdaEbye {
candidateV0s.push_back(candV0);
return -1;
}
for (auto& candidateV0 : candidateV0s) {
histos.fill(HIST("QA/massLambdaEvRej"), centrality, candidateV0.pt, candidateV0.mass);
}

histos.fill(HIST("nEv"), subsample, centrality);

Expand Down Expand Up @@ -874,12 +914,23 @@ struct antidLambdaEbye {
continue;
if (!((mcTrackPos.pdgCode() == 2212 && mcTrackNeg.pdgCode() == -211) || (mcTrackPos.pdgCode() == 211 && mcTrackNeg.pdgCode() == -2212)))
continue;
if (std::abs(posMother.pdgCode()) != 3122)
if (std::abs(posMother.pdgCode()) != 3122) {
histos.fill(HIST("QA/cosPaBkg"), candidateV0.cpa);
histos.fill(HIST("QA/dcaV0daughBkg"), candidateV0.dcav0daugh);
histos.fill(HIST("QA/dcaV0PvBkg"), candidateV0.dcav0pv);
histos.fill(HIST("QA/cosPaDcaV0daughBkg"), candidateV0.cpa, candidateV0.dcav0daugh);
histos.fill(HIST("QA/massLambdaEvRejBkg"), centrality, candidateV0.pt, candidateV0.mass);
continue;
}
if (!posMother.isPhysicalPrimary() && !posMother.has_mothers())
continue;
if (((posMother.flags() & 0x8) && doprocessMcRun2) || (posMother.flags() & 0x2) || (posMother.flags() & 0x1))
continue;
histos.fill(HIST("QA/cosPaSig"), candidateV0.cpa);
histos.fill(HIST("QA/dcaV0daughSig"), candidateV0.dcav0daugh);
histos.fill(HIST("QA/dcaV0PvSig"), candidateV0.dcav0pv);
histos.fill(HIST("QA/cosPaDcaV0daughSig"), candidateV0.cpa, candidateV0.dcav0daugh);
histos.fill(HIST("QA/massLambdaEvRejSig"), centrality, candidateV0.pt, candidateV0.mass);
if (posMother.pdgCode() > 0) {
histos.fill(HIST("recL"), centrality, candidateV0.pt, std::abs(candidateV0.eta));
if (fillOnlySignal)
Expand Down

0 comments on commit 13610f9

Please sign in to comment.