Skip to content

Commit adc45e9

Browse files
cterrevofgrosa
andauthored
[PWGHF] removing check in accept. for recMC (#11649)
Co-authored-by: Fabrizio <fabrizio.grosa@cern.ch>
1 parent a844b18 commit adc45e9

File tree

1 file changed

+13
-33
lines changed

1 file changed

+13
-33
lines changed

PWGHF/D2H/Tasks/taskXic.cxx

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
/// \author Himanshu Sharma <himanshu.sharma@cern.ch>, University and INFN Padova
2020
/// \author Cristina Terrevoli <cristina.terrevoli@cern.ch>, INFN Bari
2121

22-
#include <vector>
22+
#include "PWGHF/Core/HfHelper.h"
23+
#include "PWGHF/Core/SelectorCuts.h"
24+
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
25+
#include "PWGHF/DataModel/CandidateSelectionTables.h"
2326

2427
#include "CommonConstants/PhysicsConstants.h"
2528
#include "Framework/AnalysisTask.h"
2629
#include "Framework/HistogramRegistry.h"
2730
#include "Framework/O2DatabasePDGPlugin.h"
2831
#include "Framework/runDataProcessing.h"
2932

30-
#include "PWGHF/Core/HfHelper.h"
31-
#include "PWGHF/Core/SelectorCuts.h"
32-
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
33-
#include "PWGHF/DataModel/CandidateSelectionTables.h"
33+
#include <vector>
3434

3535
using namespace o2;
3636
using namespace o2::analysis;
@@ -234,9 +234,9 @@ struct HfTaskXic {
234234
const AxisSpec thnAxisMCAllProngAccepted{2, -0.5, 1.5, "All MC prongs accepted"};
235235

236236
if (doprocessDataWithMl || doprocessMcWithMl) { // with ML
237-
registry.add("hnXicVarsWithBdt", "THn for Xic candidates with BDT scores", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisBdtScoreXicBkg, thnAxisBdtScoreXicPrompt, thnAxisBdtScoreXicNonPrompt, thnAxisMcOrigin, thnAxisPtMC, thnAxisYMC, thnAxisMCAllProngAccepted});
237+
registry.add("hnXicVarsWithBdt", "THn for Xic candidates with BDT scores", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisBdtScoreXicBkg, thnAxisBdtScoreXicPrompt, thnAxisBdtScoreXicNonPrompt, thnAxisMcOrigin});
238238
} else {
239-
registry.add("hnXicVars", "THn for Xic candidates", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisChi2PCA, thnAxisDecLength, thnAxisDecLengthXY, thnAxisCPA, thnAxisMcOrigin, thnAxisPtMC, thnAxisYMC, thnAxisMCAllProngAccepted});
239+
registry.add("hnXicVars", "THn for Xic candidates", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisChi2PCA, thnAxisDecLength, thnAxisDecLengthXY, thnAxisCPA, thnAxisMcOrigin});
240240
}
241241
}
242242
} // end init
@@ -430,9 +430,6 @@ struct HfTaskXic {
430430
// Get the corresponding MC particle.
431431
auto mcParticleProng0 = candidate.template prong0_as<aod::TracksWMc>().template mcParticle_as<soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>();
432432
auto pdgCodeProng0 = std::abs(mcParticleProng0.pdgCode());
433-
auto yProng0 = RecoDecay::y(mcParticleProng0.pVector(), o2::constants::physics::MassXiCPlus);
434-
std::array<float, 3> ptProngs;
435-
std::array<float, 3> etaProngs;
436433
// Signal
437434
registry.fill(HIST("MC/reconstructed/signal/hPtRecSig"), ptCandidate); // rec. level pT
438435

@@ -464,7 +461,8 @@ struct HfTaskXic {
464461
registry.fill(HIST("MC/reconstructed/signal/hEtaVsPtRecSig"), candidate.eta(), ptCandidate);
465462

466463
/// reconstructed signal prompt
467-
if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) {
464+
int origin = candidate.originMcRec();
465+
if (origin == RecoDecay::OriginType::Prompt) {
468466
if ((candidate.isSelXicToPKPi() >= selectionFlagXic) && pdgCodeProng0 == kProton) {
469467
registry.fill(HIST("MC/reconstructed/prompt/hMassRecSigPrompt"), massXicToPKPi);
470468
registry.fill(HIST("MC/reconstructed/prompt/hMassVsPtRecSigPrompt"), massXicToPKPi, ptCandidate);
@@ -489,40 +487,22 @@ struct HfTaskXic {
489487
}
490488

491489
if (enableTHn) {
492-
double massXic(-1);
493490
double outputBkg(-1), outputPrompt(-1), outputFD(-1);
494491
const int ternaryCl = 3;
495-
bool allProngsInAcceptance = false;
496492
if ((candidate.isSelXicToPKPi() >= selectionFlagXic) && pdgCodeProng0 == kProton) {
497-
massXic = hfHelper.invMassXicToPKPi(candidate);
498-
int counter = 0;
499-
for (const auto& daught : mcParticleProng0.template daughters_as<soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>()) {
500-
ptProngs[counter] = daught.pt();
501-
etaProngs[counter] = daught.eta();
502-
counter++;
503-
}
504-
allProngsInAcceptance = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]) && isProngInAcceptance(etaProngs[2], ptProngs[2]);
505493
if constexpr (useMl) {
506494
if (candidate.mlProbXicToPKPi().size() == ternaryCl) {
507495
outputBkg = candidate.mlProbXicToPKPi()[0]; /// bkg score
508496
outputPrompt = candidate.mlProbXicToPKPi()[1]; /// prompt score
509497
outputFD = candidate.mlProbXicToPKPi()[2]; /// non-prompt score
510498
}
511499
/// Fill the ML outputScores and variables of candidate (todo: add multiplicity)
512-
registry.get<THnSparse>(HIST("hnXicVarsWithBdt"))->Fill(massXic, ptCandidate, outputBkg, outputPrompt, outputFD, candidate.originMcRec(), mcParticleProng0.pt(), yProng0, allProngsInAcceptance);
500+
registry.get<THnSparse>(HIST("hnXicVarsWithBdt"))->Fill(massXicToPKPi, ptCandidate, outputBkg, outputPrompt, outputFD, origin);
513501
} else {
514-
registry.get<THnSparse>(HIST("hnXicVars"))->Fill(massXic, ptCandidate, candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.cpa(), candidate.originMcRec(), mcParticleProng0.pt(), yProng0, allProngsInAcceptance);
502+
registry.get<THnSparse>(HIST("hnXicVars"))->Fill(massXicToPKPi, ptCandidate, candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.cpa(), origin);
515503
}
516504
}
517505
if ((candidate.isSelXicToPiKP() >= selectionFlagXic) && pdgCodeProng0 == kPiPlus) {
518-
massXic = hfHelper.invMassXicToPiKP(candidate);
519-
int counter = 0;
520-
for (const auto& daught : mcParticleProng0.template daughters_as<soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>()) {
521-
ptProngs[counter] = daught.pt();
522-
etaProngs[counter] = daught.eta();
523-
counter++;
524-
}
525-
allProngsInAcceptance = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]) && isProngInAcceptance(etaProngs[2], ptProngs[2]);
526506
if constexpr (useMl) {
527507
if (candidate.mlProbXicToPiKP().size() == ternaryCl) {
528508
outputBkg = candidate.mlProbXicToPiKP()[0]; /// bkg score
@@ -531,9 +511,9 @@ struct HfTaskXic {
531511
}
532512
/// Fill the ML outputScores and variables of candidate (todo: add multiplicity)
533513
// add here the pT_Mother, y_Mother, level (reco, Gen, Gen + Acc)
534-
registry.get<THnSparse>(HIST("hnXicVarsWithBdt"))->Fill(massXic, ptCandidate, outputBkg, outputPrompt, outputFD, candidate.originMcRec(), mcParticleProng0.pt(), yProng0, allProngsInAcceptance);
514+
registry.get<THnSparse>(HIST("hnXicVarsWithBdt"))->Fill(massXicToPiKP, ptCandidate, outputBkg, outputPrompt, outputFD, origin);
535515
} else {
536-
registry.get<THnSparse>(HIST("hnXicVars"))->Fill(massXic, ptCandidate, candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.cpa(), candidate.originMcRec(), mcParticleProng0.pt(), yProng0, allProngsInAcceptance);
516+
registry.get<THnSparse>(HIST("hnXicVars"))->Fill(massXicToPiKP, ptCandidate, candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.cpa(), origin);
537517
}
538518
}
539519
} // enable THn

0 commit comments

Comments
 (0)