Skip to content

Commit 88e7bc4

Browse files
committed
adding process function for Event and Signal loss
1 parent cfd6a78 commit 88e7bc4

File tree

1 file changed

+119
-50
lines changed

1 file changed

+119
-50
lines changed

PWGLF/Tasks/Resonances/k892analysispbpb.cxx

Lines changed: 119 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct K892analysispbpb {
7171
Configurable<int> cDCABins{"cDCABins", 300, "DCA binning"};
7272
Configurable<int> cPDGbins{"cPDGbins", 5000, "number of PDG bins"};
7373
Configurable<float> cPDGMax{"cPDGMax", 9500000.0f, "PDG limit"};
74-
74+
7575
// events
7676
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
7777
Configurable<bool> timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"};
@@ -106,10 +106,8 @@ struct K892analysispbpb {
106106
Configurable<float> cMaxTOFnSigmaKaon{"cMaxTOFnSigmaKaon", 3.0, "TOF nSigma cut for Kaon"}; // TOF
107107
Configurable<float> cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC
108108
Configurable<float> cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF
109-
Configurable<bool> cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection
110-
Configurable<bool> cTofBetaCut{"cTofBetaCut", false, "selection on TOF beta"};
111-
112-
109+
Configurable<bool> cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection
110+
Configurable<bool> cTofBetaCut{"cTofBetaCut", false, "selection on TOF beta"};
113111

114112
Configurable<bool> cTPClowpt{"cTPClowpt", true, "apply TPC at low pt"};
115113
Configurable<bool> cTOFonlyHighpt{"cTOFonlyHighpt", false, "apply TOF only at high pt"};
@@ -122,8 +120,10 @@ struct K892analysispbpb {
122120

123121
// event mixing
124122
Configurable<int> cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"};
123+
125124
ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"};
126125
ConfigurableAxis cfgMultBins{"cfgMultBins", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"};
126+
ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0.0, 3.00065, 4.28798, 6.14552, 7.6196, 8.90942, 10.0897, 11.2002, 12.2709, 13.3167, 14.4173, 23.2518}, "Binning of the impact parameter axis"};
127127

128128
// cuts on mother
129129
Configurable<bool> cfgCutsOnMother{"cfgCutsOnMother", false, "Enamble additional cuts on mother"};
@@ -157,6 +157,7 @@ struct K892analysispbpb {
157157
AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^2)"};
158158
AxisSpec pidQAAxis = {cPIDBins, -cPIDQALimit, cPIDQALimit};
159159
AxisSpec pdgCodeAxis = {cPDGbins, 0, cPDGMax};
160+
AxisSpec impactParAxis = {binsImpactPar, "Impact Parameter"};
160161

161162
if ((!doprocessMC && !doprocessMCRun2) || doprocessMixedEventMC || doprocessMixedEventMCRun2) {
162163
// event histograms
@@ -286,7 +287,7 @@ struct K892analysispbpb {
286287
histos.add("k892GenInvmass", "Invariant mass of generated K(892)0", kTH1F, {invMassAxis});
287288
histos.add("k892GenInvmassAnti", "Invariant mass of generated Anti-K(892)0", kTH1F, {invMassAxis});
288289

289-
histos.add("h3Reck892invmass", "Invariant mass of Reconstructed MC K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis});
290+
histos.add("h3Reck892invmass", "Invariant mass of Reconstructed MC K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis});
290291
histos.add("h3Reck892invmassAnti", "Invariant mass of Reconstructed MC Anti-K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis});
291292
histos.add("k892Gen", "pT distribution of True MC K(892)0", kTH3F, {mcLabelAxis, ptAxis, centAxis});
292293
histos.add("k892GenAnti", "pT distribution of True MC Anti-K(892)0", kTH3F, {mcLabelAxis, ptAxis, centAxis});
@@ -295,22 +296,30 @@ struct K892analysispbpb {
295296
histos.add("h3k892GenInvmass", "Invariant mass of generated K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis});
296297
histos.add("h3k892GenInvmassAnti", "Invariant mass of generated Anti-K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis});
297298

298-
histos.add("h3Reck892invmassPtGen" ,"Invariant mass of Reconstructed MC K(892)0 with Pt Gen", kTH3F, {centAxis, ptAxis, invMassAxis});
299-
histos.add("h3Reck892invmassAntiPtGen","Invariant mass of Reconstructed MC Anti-K(892)0 with Pt Gen", kTH3F, {centAxis, ptAxis, invMassAxis});
300-
histos.add("h3PtRecvsPtGenAnti" ,"reconstructed K* Pt vs generated K* pt", kTH3F, {centAxis, ptAxis, ptAxis});
301-
histos.add("h3PtRecvsPtGen" ,"reconstructed Anti-K* Pt vs generated Anti-K* pt", kTH3F, {centAxis, ptAxis, ptAxis});
302-
303-
histos.add("h3k892invmassWrongDaughters_DS", "Invariant mass of K*0 with wrong daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis});
299+
histos.add("h3Reck892invmassPtGen", "Invariant mass of Reconstructed MC K(892)0 with Pt Gen", kTH3F, {centAxis, ptAxis, invMassAxis});
300+
histos.add("h3Reck892invmassAntiPtGen", "Invariant mass of Reconstructed MC Anti-K(892)0 with Pt Gen", kTH3F, {centAxis, ptAxis, invMassAxis});
301+
histos.add("h3PtRecvsPtGenAnti", "reconstructed K* Pt vs generated K* pt", kTH3F, {centAxis, ptAxis, ptAxis});
302+
histos.add("h3PtRecvsPtGen", "reconstructed Anti-K* Pt vs generated Anti-K* pt", kTH3F, {centAxis, ptAxis, ptAxis});
303+
304+
histos.add("h3k892invmassWrongDaughters_DS", "Invariant mass of K*0 with wrong daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis});
304305
histos.add("h3k892invmassWrongDaughters_DSAnti", "Invariant mass of K*0 with wrong daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis});
305-
histos.add("h3k892invmassRightDaughters_DS", "Invariant mass of K*0 with right daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis});
306+
histos.add("h3k892invmassRightDaughters_DS", "Invariant mass of K*0 with right daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis});
306307
histos.add("h3k892invmassRightDaughters_DSAnti", "Invariant mass of K*0 with right daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis});
307308

308-
309-
histos.add("h3k892invmassSameMother_DS", "Invariant mass same mother DS", kTH3F, {centAxis, ptAxis, invMassAxis});
309+
histos.add("h3k892invmassSameMother_DS", "Invariant mass same mother DS", kTH3F, {centAxis, ptAxis, invMassAxis});
310310
histos.add("h3k892invmassSameMother_DSAnti", "Invariant mass same mother DS anti", kTH3F, {centAxis, ptAxis, invMassAxis});
311-
histos.add("h3PdgCodeSameMother_DS", "PDG code same mother DS", kTH3F, {centAxis, ptAxis, pdgCodeAxis});
312-
histos.add("h3PdgCodeSameMother_DSAnti", "PDG code same mother DS anti", kTH3F, {centAxis, ptAxis, pdgCodeAxis});
313-
311+
histos.add("h3PdgCodeSameMother_DS", "PDG code same mother DS", kTH3F, {centAxis, ptAxis, pdgCodeAxis});
312+
histos.add("h3PdgCodeSameMother_DSAnti", "PDG code same mother DS anti", kTH3F, {centAxis, ptAxis, pdgCodeAxis});
313+
}
314+
315+
if (doprocessEvtLossSigLossMC) {
316+
histos.add("QAevent/hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis});
317+
histos.add("QAevent/hImpactParameterRec", "Impact parameter of selected MC events", kTH1F, {impactParAxis});
318+
histos.add("QAevent/hImpactParvsCentrRec", "Impact parameter of selected MC events vs centrality", kTH2F, {{120, 0.0f, 120.0f}, impactParAxis});
319+
histos.add("QAevent/k892genBeforeEvtSel", "K* before event selections", kTH2F, {ptAxis, impactParAxis});
320+
histos.add("QAevent/k892genBeforeEvtSelAnti", "K* before event selections", kTH2F, {ptAxis, impactParAxis});
321+
histos.add("QAevent/k892genAfterEvtSel", "K* after event selections", kTH2F, {ptAxis, impactParAxis});
322+
histos.add("QAevent/k892genAfterEvtSelAnti", "K* after event selections", kTH2F, {ptAxis, impactParAxis});
314323
}
315324

316325
// Print output histograms statistics
@@ -395,7 +404,7 @@ struct K892analysispbpb {
395404
if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) <= cMaxTOFnSigmaKaon) { // tof cut only
396405
return true;
397406
}
398-
407+
399408
} else if (cTOFandTPCHighpt) {
400409

401410
if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) <= cMaxTOFnSigmaKaon && candidate.hasTPC() && std::abs(candidate.tpcNSigmaKa()) <= cMaxTPCnSigmaKaon) { // tof and tpc cut
@@ -433,7 +442,7 @@ struct K892analysispbpb {
433442
if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) <= cMaxTOFnSigmaPion) { // tof cut only
434443
return true;
435444
}
436-
445+
437446
} else if (cTOFandTPCHighpt) {
438447

439448
if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) <= cMaxTOFnSigmaPion && candidate.hasTPC() && std::abs(candidate.tpcNSigmaPi()) <= cMaxTPCnSigmaPion) { // tof and tpc cut
@@ -594,8 +603,8 @@ struct K892analysispbpb {
594603
ldaughterRot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta, massKa);
595604
lResonanceRot = lDecayDaughter1 + ldaughterRot;
596605
}
597-
if (std::abs(lResonanceRot.Rapidity()) >= 0.5)
598-
continue;
606+
if (std::abs(lResonanceRot.Rapidity()) >= 0.5)
607+
continue;
599608
if (cfgCutsOnMother) {
600609
if (lResonanceRot.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow
601610
continue;
@@ -696,24 +705,24 @@ struct K892analysispbpb {
696705

697706
if constexpr (!IsMix) {
698707

699-
bool isSameMother = false;
708+
bool isSameMother = false;
700709
bool isMotherOk = false;
701710
int pdgCodeMother = -999;
702-
auto ptMother = -9999;
703-
for (const auto& mothertrack1 : mctrack1.template mothers_as<aod::McParticles>()) {
711+
auto ptMother = -9999;
712+
for (const auto& mothertrack1 : mctrack1.template mothers_as<aod::McParticles>()) {
704713
for (const auto& mothertrack2 : mctrack2.template mothers_as<aod::McParticles>()) {
705714
if (mothertrack1.pdgCode() != mothertrack2.pdgCode())
706715
continue;
707716
if (mothertrack1.globalIndex() != mothertrack2.globalIndex())
708717
continue;
709-
710-
if (std::abs(mothertrack1.pdgCode() == 1000822080)) //Pb PDG code
711-
continue;
712-
713-
pdgCodeMother = mothertrack1.pdgCode();
714-
ptMother = mothertrack1.pt();
715-
isSameMother = true;
716-
718+
719+
if (std::abs(mothertrack1.pdgCode() == 1000822080)) // Pb PDG code
720+
continue;
721+
722+
pdgCodeMother = mothertrack1.pdgCode();
723+
ptMother = mothertrack1.pt();
724+
isSameMother = true;
725+
717726
if (std::abs(mothertrack1.pdgCode()) != 313)
718727
continue;
719728

@@ -726,17 +735,16 @@ struct K892analysispbpb {
726735
}
727736
}
728737

738+
if (isSameMother) {
739+
if (track1Sign < 0) {
740+
histos.fill(HIST("h3k892invmassSameMother_DS"), multiplicity, lResonance.Pt(), lResonance.M());
741+
histos.fill(HIST("h3PdgCodeSameMother_DS"), multiplicity, lResonance.Pt(), pdgCodeMother);
742+
} else if (track1Sign > 0) {
743+
histos.fill(HIST("h3k892invmassSameMother_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M());
744+
histos.fill(HIST("h3PdgCodeSameMother_DSAnti"), multiplicity, lResonance.Pt(), pdgCodeMother);
745+
}
746+
}
729747

730-
if(isSameMother) {
731-
if (track1Sign < 0) {
732-
histos.fill(HIST("h3k892invmassSameMother_DS"), multiplicity, lResonance.Pt(), lResonance.M());
733-
histos.fill(HIST("h3PdgCodeSameMother_DS"), multiplicity, lResonance.Pt(), pdgCodeMother);
734-
} else if (track1Sign > 0) {
735-
histos.fill(HIST("h3k892invmassSameMother_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M());
736-
histos.fill(HIST("h3PdgCodeSameMother_DSAnti"), multiplicity, lResonance.Pt(), pdgCodeMother);
737-
}
738-
}
739-
740748
if (!isMotherOk)
741749
continue;
742750

@@ -756,14 +764,14 @@ struct K892analysispbpb {
756764
histos.fill(HIST("k892Rec"), lResonance.Pt(), multiplicity);
757765
histos.fill(HIST("k892Recinvmass"), lResonance.M());
758766
histos.fill(HIST("h3Reck892invmass"), multiplicity, lResonance.Pt(), lResonance.M());
759-
histos.fill(HIST("h3Reck892invmassPtGen"), multiplicity, ptMother, lResonance.M());
760-
histos.fill(HIST("h3PtRecvsPtGen"), multiplicity, lResonance.Pt(), ptMother);
767+
histos.fill(HIST("h3Reck892invmassPtGen"), multiplicity, ptMother, lResonance.M());
768+
histos.fill(HIST("h3PtRecvsPtGen"), multiplicity, lResonance.Pt(), ptMother);
761769
} else {
762770
histos.fill(HIST("k892RecAnti"), lResonance.Pt(), multiplicity);
763771
histos.fill(HIST("k892RecinvmassAnti"), lResonance.M());
764772
histos.fill(HIST("h3Reck892invmassAnti"), multiplicity, lResonance.Pt(), lResonance.M());
765-
histos.fill(HIST("h3Reck892invmassAntiPtGen"), multiplicity, ptMother, lResonance.M());
766-
histos.fill(HIST("h3PtRecvsPtGenAnti"), multiplicity, lResonance.Pt(), ptMother);
773+
histos.fill(HIST("h3Reck892invmassAntiPtGen"), multiplicity, ptMother, lResonance.M());
774+
histos.fill(HIST("h3PtRecvsPtGenAnti"), multiplicity, lResonance.Pt(), ptMother);
767775
}
768776
}
769777
} // end of IsMC
@@ -854,7 +862,7 @@ struct K892analysispbpb {
854862
auto candPosKatoftpc = posKatoftpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache);
855863

856864
fillHistograms<IsMC, IsMix, IsRot, IsRun2>(collision1, candNegPitoftpc, candPosKatoftpc);
857-
865+
858866
} else if (cTOFonlyHighpt) {
859867
//+-
860868
auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache);
@@ -1035,8 +1043,68 @@ struct K892analysispbpb {
10351043
}
10361044
PROCESS_SWITCH(K892analysispbpb, processMixedEventMCRun2, "Process Mixed event MC Run2", false);
10371045

1038-
void processMC(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMCrec>& recCollisions, TrackCandidatesMCrec const& RecTracks)
1046+
void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMCrec>& recCollisions)
10391047
{
1048+
1049+
// Event loss estimation
1050+
auto impactPar = mcCollision.impactParameter();
1051+
histos.fill(HIST("QAevent/hImpactParameterGen"), impactPar);
1052+
1053+
// Signal loss estimation
1054+
for (const auto& mcPart : mcParticles) {
1055+
if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 313)
1056+
continue;
1057+
1058+
// signal loss estimation
1059+
if (mcPart.pdgCode() > 0) // no cuts, purely generated
1060+
histos.fill(HIST("QAevent/k892genBeforeEvtSel"), mcPart.pt(), impactPar);
1061+
else
1062+
histos.fill(HIST("QAevent/k892genBeforeEvtSelAnti"), mcPart.pt(), impactPar);
1063+
}
1064+
1065+
if (recCollisions.size() == 0)
1066+
return;
1067+
1068+
auto numcontributors = -999;
1069+
bool isSel = false;
1070+
auto centrality = -999.;
1071+
for (const auto& RecCollision : recCollisions) {
1072+
if (!myEventSelections(RecCollision))
1073+
continue;
1074+
1075+
if (RecCollision.numContrib() <= numcontributors)
1076+
continue;
1077+
else
1078+
numcontributors = RecCollision.numContrib();
1079+
1080+
centrality = RecCollision.centFT0C();
1081+
isSel = true;
1082+
}
1083+
1084+
if (!isSel)
1085+
return;
1086+
1087+
histos.fill(HIST("QAevent/hImpactParameterRec"), impactPar);
1088+
histos.fill(HIST("QAevent/hImpactParvsCentrRec"), centrality, impactPar);
1089+
1090+
// Generated MC
1091+
for (const auto& mcPart : mcParticles) {
1092+
if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 313)
1093+
continue;
1094+
1095+
// signal loss estimation
1096+
if (mcPart.pdgCode() > 0) // no cuts, purely generated
1097+
histos.fill(HIST("QAevent/k892genAfterEvtSel"), mcPart.pt(), impactPar);
1098+
else
1099+
histos.fill(HIST("QAevent/k892genAfterEvtSelAnti"), mcPart.pt(), impactPar);
1100+
1101+
} // end loop on gen particles
1102+
}
1103+
PROCESS_SWITCH(K892analysispbpb, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false);
1104+
1105+
void processMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMCrec>& recCollisions, TrackCandidatesMCrec const& RecTracks)
1106+
{
1107+
10401108
histos.fill(HIST("QAevent/hMCrecCollSels"), 0);
10411109
if (recCollisions.size() == 0) {
10421110
histos.fill(HIST("QAevent/hMCrecCollSels"), 1);
@@ -1051,10 +1119,11 @@ struct K892analysispbpb {
10511119

10521120
if (!myEventSelections(RecCollision))
10531121
continue;
1054-
histos.fill(HIST("QAevent/hMCrecCollSels"), 8);
10551122

1123+
histos.fill(HIST("QAevent/hMCrecCollSels"), 8);
10561124
auto centrality = RecCollision.centFT0C();
10571125
histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality);
1126+
10581127
auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache);
10591128

10601129
// <IsMC, IsMix, IsRot, IsRun2>

0 commit comments

Comments
 (0)