Skip to content

Commit 05e3cb5

Browse files
[PWGLF] The efficiency calculation part is included by adding processMCLight and processMCTrue (#10444)
Co-authored-by: Navneet <navneet.kumar@cern.ch>
1 parent ea2f454 commit 05e3cb5

File tree

1 file changed

+77
-8
lines changed

1 file changed

+77
-8
lines changed

PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <TLorentzVector.h>
2626
#include <TMath.h>
2727
#include <TObjArray.h>
28-
// #include <TPDGCode.h>
28+
#include <TPDGCode.h>
2929
#include <string>
3030

3131
#include <array>
@@ -79,6 +79,8 @@ struct chargedkstaranalysis {
7979
{VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0},
8080
"Binning of the pT axis"};
8181

82+
AxisSpec k892pmCountAxis = {2, 0., 2., "K*^{+}(892) = 1, K*^{-}(892) = 2"};
83+
8284
HistogramRegistry histos1{
8385
"histos1",
8486
{},
@@ -146,8 +148,8 @@ struct chargedkstaranalysis {
146148

147149
// For rotational background
148150
Configurable<bool> fillRotation{"fillRotation", true, "fill rotation"};
149-
Configurable<float> confMinRot{"confMinRot", 5.0 * TMath::Pi() / 6.0, "Minimum of rotation"};
150-
Configurable<float> confMaxRot{"confMaxRot", 7.0 * TMath::Pi() / 6.0, "Maximum of rotation"};
151+
Configurable<float> confMinRot{"confMinRot", 5.0 * o2::constants::math::PI / 6.0, "Minimum of rotation"};
152+
Configurable<float> confMaxRot{"confMaxRot", 7.0 * o2::constants::math::PI / 6.0, "Maximum of rotation"};
151153
Configurable<int> nBkgRotations{"nBkgRotations", 9, "Number of rotated copies (background) per each original candidate"};
152154

153155
void init(InitContext const&)
@@ -224,7 +226,22 @@ struct chargedkstaranalysis {
224226
"Invariant mass of CKS meson MixedEvent Sign", kTHnSparseF,
225227
{invMassAxis, ptAxis, centAxis}, true);
226228
if (fillRotation) {
227-
histos1.add("hRotation", "hRotation", kTH1F, {{360, 0.0, 2.0 * TMath::Pi()}});
229+
histos1.add("hRotation", "hRotation", kTH1F, {{360, 0.0, o2::constants::math::TwoPI}});
230+
}
231+
232+
// for MC production
233+
if (doprocessMCTrue) {
234+
// DEBUG HISTOGRAMS
235+
histos1.add("hK892pmCounter", "Generated MC resonances", kTH1F, {k892pmCountAxis});
236+
histos1.add("k892pmPtGen", "pT distribution of True MC charged K*(892)", kTH1F, {ptAxis});
237+
histos1.add("k892pPtGen", "pT distribution of True MC K*(892) Plus", kTH1F, {ptAxis});
238+
histos1.add("k892mPtGen", "pT distribution of True MC K*(892) Minus", kTH1F, {ptAxis});
239+
240+
// histos.add("hDaughterCounter", "Generated MC resonance daughters", kTH1F, {daughterCountAxis});
241+
}
242+
if (doprocessMCLight) {
243+
// MC QA
244+
histos1.add("k892pmPtRec", "pT distribution of Reconstructed MC charged K*(892)", kTH1F, {ptAxis});
228245
}
229246
}
230247
double massPi = o2::constants::physics::MassPionCharged;
@@ -318,18 +335,35 @@ struct chargedkstaranalysis {
318335
// Reconstructed K*(892)pm 3d mass, pt, multiplicity histogram
319336
histos1.fill(HIST("chargekstarMassPtMultPtUnlikeSign"),
320337
lResonance.M(), lResonance.Pt(), multiplicity);
321-
338+
if constexpr (IsMC) {
339+
bool pass1 = false;
340+
bool pass2 = false;
341+
// LOG(info) << "track PDG:\t" << trk.pdgCode() << "\tV0 PDG:\t" << v0.pdgCode();
342+
if ((track.pdgCode() != PDG_t::kPiPlus) && (v0.pdgCode() != PDG_t::kK0Short)) { // One decay to K0s and the other to pi+ (K*(892)+ mother) - Particle pass
343+
pass1 = true;
344+
}
345+
if ((track.pdgCode() != PDG_t::kPiMinus) && (v0.pdgCode() != -310)) { // One decay to K0s and the other to pi+ (K*(892)+ mother) - Particle pass
346+
pass2 = true;
347+
}
348+
if (!pass1 && !pass2) // Go on only if we have both decay products, else skip to next iteration
349+
continue;
350+
if (track.motherPDG() != v0.motherPDG())
351+
continue;
352+
// LOG(info) << "track PDG:\t" << trk.pdgCode() << "\tV0 PDG:\t" << v0.pdgCode();
353+
if (track.motherPDG() != o2::constants::physics::Pdg::kKPlusStar892)
354+
continue;
355+
histos1.fill(HIST("k892pmPtRec"), lResonance.Pt());
356+
}
322357
} else {
323358
histos1.fill(HIST("chargedkstarinvmassMixedEvent"), lResonance.M());
324359
// Reconstructed K*(892)pm 3d mass, pt, multiplicity histogram
325360
histos1.fill(HIST("chargekstarMassPtMultPtMixedEvent"),
326361
lResonance.M(), lResonance.Pt(), multiplicity);
327362
}
328-
329363
if constexpr (!IsMix) {
330364
if (fillRotation) {
331365
for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) {
332-
auto rotangle = TMath::Pi();
366+
auto rotangle = o2::constants::math::PI;
333367
if (nBkgRotations > 1) {
334368
auto anglestart = confMinRot;
335369
auto angleend = confMaxRot;
@@ -341,7 +375,7 @@ struct chargedkstaranalysis {
341375
auto rotpionPy = lDecayDaughter.Px() * std::sin(rotangle) + lDecayDaughter.Py() * std::cos(rotangle);
342376
pionrot.SetXYZM(rotpionPx, rotpionPy, lDecayDaughter.Pz(), massPi);
343377
chargekstarrot = pionrot + lDecayV0;
344-
if (TMath::Abs(chargekstarrot.Rapidity()) > confRapidity) {
378+
if (std::abs(chargekstarrot.Rapidity()) > confRapidity) {
345379
continue;
346380
}
347381
histos1.fill(HIST("hSparseChargeKstarSameEventRotational"), chargekstarrot.M(), chargekstarrot.Pt(), multiplicity);
@@ -457,6 +491,41 @@ struct chargedkstaranalysis {
457491
}
458492
PROCESS_SWITCH(chargedkstaranalysis, processMEnew, "Process Mixed events new",
459493
true);
494+
495+
void processMCTrue(aod::ResoMCParents const& resoParents)
496+
{
497+
for (const auto& part : resoParents) { // loop over all pre-filtered MC particles
498+
if (std::abs(part.pdgCode()) != o2::constants::physics::Pdg::kKPlusStar892) // K*892(pm)
499+
continue;
500+
if (std::abs(part.y()) > 0.5) // rapidity cut
501+
continue;
502+
bool pass1 = false;
503+
bool pass2 = false;
504+
505+
if (part.daughterPDG1() == PDG_t::kPiPlus && part.daughterPDG2() == PDG_t::kK0Short) { // One decay to K0s and the other to pi+ (K*(892)+ mother) - Particle pass
506+
pass1 = true;
507+
histos1.fill(HIST("hK892pmCounter"), 0.5);
508+
histos1.fill(HIST("k892pPtGen"), part.pt());
509+
}
510+
if (part.daughterPDG1() == PDG_t::kPiMinus && part.daughterPDG2() == -310) { // One decay to AntiK0s and the other to pi- (K*(892)- mother) - Antiparticle pass
511+
pass2 = true;
512+
histos1.fill(HIST("hK892pmCounter"), 1.5);
513+
histos1.fill(HIST("k892mPtGen"), part.pt());
514+
}
515+
if (!pass1 && !pass2) // Go on only if we have both decay products, else skip to next iteration
516+
continue;
517+
histos1.fill(HIST("k892pmPtGen"), part.pt());
518+
}
519+
}
520+
PROCESS_SWITCH(chargedkstaranalysis, processMCTrue, "Process Event for MC", false);
521+
522+
void processMCLight(aod::ResoCollision const& collision,
523+
soa::Join<aod::ResoTracks, aod::ResoMCTracks> const& resotracks,
524+
soa::Join<aod::ResoV0s, aod::ResoMCV0s> const& resov0s)
525+
{
526+
fillHistograms<true, false>(collision, resotracks, resov0s);
527+
}
528+
PROCESS_SWITCH(chargedkstaranalysis, processMCLight, "Process Event for MC", false);
460529
};
461530

462531
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)