2020
2121#include " Common/Core/RecoDecay.h"
2222
23- #include < CommonConstants/MathConstants.h>
24- #include < Framework/ASoA.h>
25- #include < Framework/AnalysisDataModel.h>
26- #include < Framework/AnalysisHelpers.h>
27- #include < Framework/AnalysisTask.h>
28- #include < Framework/Configurable.h>
29- #include < Framework/HistogramRegistry.h>
30- #include < Framework/HistogramSpec.h>
31- #include < Framework/InitContext.h>
32- #include < Framework/OutputObjHeader.h>
33- #include < Framework/runDataProcessing.h>
34-
35- #include < cstdlib>
23+ #include " Framework/AnalysisDataModel.h"
24+ #include " Framework/AnalysisTask.h"
25+ #include " Framework/HistogramRegistry.h"
26+ #include " Framework/Logger.h"
27+ #include " Framework/runDataProcessing.h"
28+
3629#include < string>
30+ #include < type_traits>
3731#include < vector>
3832
3933#include < math.h>
@@ -84,7 +78,8 @@ DECLARE_SOA_COLUMN(D0MD, d0MD, float);
8478DECLARE_SOA_COLUMN (D0PtD, d0PtD, float );
8579DECLARE_SOA_COLUMN (D0EtaD, d0EtaD, float );
8680DECLARE_SOA_COLUMN (D0PhiD, d0PhiD, float );
87- DECLARE_SOA_COLUMN (D0Reflection, d0Reflection, int );
81+ DECLARE_SOA_COLUMN (D0MatchedFrom, d0MatchedFrom, int );
82+ DECLARE_SOA_COLUMN (D0SelectedAs, d0SelectedAs, int );
8883} // namespace d0Info
8984
9085DECLARE_SOA_TABLE (D0Tables, " AOD" , " D0TABLE" ,
@@ -99,6 +94,20 @@ DECLARE_SOA_TABLE(D0Tables, "AOD", "D0TABLE",
9994 d0Info::D0Phi,
10095 d0Info::D0Y );
10196
97+ DECLARE_SOA_TABLE (D0McDTables, " AOD" , " D0MCDTABLE" ,
98+ o2::soa::Index<>,
99+ collisionInfo::CollisionTableId,
100+ d0Info::D0PromptBDT,
101+ d0Info::D0NonPromptBDT,
102+ d0Info::D0BkgBDT,
103+ d0Info::D0M ,
104+ d0Info::D0Pt,
105+ d0Info::D0Eta,
106+ d0Info::D0Phi,
107+ d0Info::D0Y ,
108+ d0Info::D0MatchedFrom,
109+ d0Info::D0SelectedAs);
110+
102111DECLARE_SOA_TABLE (D0McPTables, " AOD" , " D0MCPTABLE" ,
103112 o2::soa::Index<>,
104113 collisionInfo::McCollisionTableId,
@@ -160,9 +169,10 @@ DECLARE_SOA_TABLE_STAGED(JetMatchedTables, "JETMATCHEDTABLE",
160169struct JetCorrelationD0 {
161170 // Define new table
162171 Produces<aod::CollisionTables> tableCollision;
163- Produces<aod::MatchCollTables> tableMatchedCollision;
164172 Produces<aod::McCollisionTables> tableMcCollision;
173+ Produces<aod::MatchCollTables> tableMatchedCollision;
165174 Produces<aod::D0Tables> tableD0;
175+ Produces<aod::D0McDTables> tableD0McDetector;
166176 Produces<aod::D0McPTables> tableD0McParticle;
167177 Produces<aod::JetTables> tableJet;
168178 Produces<aod::JetMcPTables> tableJetMcParticle;
@@ -318,15 +328,35 @@ struct JetCorrelationD0 {
318328 }
319329 const auto scores = d0Candidate.mlScores ();
320330 fillD0Histograms (d0Candidate, scores);
321- tableD0 (tableCollision.lastIndex (), // might want to add some more detector level D0 quantities like prompt or non prompt info
331+
332+ int matchedFrom = 0 ;
333+ int decayChannel = o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK;
334+ int selectedAs = 0 ;
335+
336+ if (d0Candidate.flagMcMatchRec () == decayChannel) { // matched to D0 on truth level
337+ matchedFrom = 1 ;
338+ }
339+ else if (d0Candidate.flagMcMatchRec () == -decayChannel) { // matched to D0bar on truth level
340+ matchedFrom = -1 ;
341+ }
342+ if (d0Candidate.candidateSelFlag () & BIT (0 )) { // CandidateSelFlag == BIT(0) -> selected as D0
343+ selectedAs = 1 ;
344+ }
345+ else if (d0Candidate.candidateSelFlag () & BIT (1 )) { // CandidateSelFlag == BIT(1) -> selected as D0bar
346+ selectedAs = -1 ;
347+ }
348+
349+ tableD0McDetector (tableCollision.lastIndex (), // might want to add some more detector level D0 quantities like prompt or non prompt info
322350 scores[2 ],
323351 scores[1 ],
324352 scores[0 ],
325353 d0Candidate.m (),
326354 d0Candidate.pt (),
327355 d0Candidate.eta (),
328356 d0Candidate.phi (),
329- d0Candidate.y ());
357+ d0Candidate.y (),
358+ matchedFrom,
359+ selectedAs);
330360 for (const auto & jet : jets) {
331361 if (jet.pt () < jetPtCutMin) {
332362 continue ;
@@ -337,7 +367,7 @@ struct JetCorrelationD0 {
337367 }
338368 fillJetHistograms (jet, dPhi);
339369 tableJet (tableCollision.lastIndex (),
340- tableD0 .lastIndex (),
370+ tableD0McDetector .lastIndex (),
341371 jet.pt (),
342372 jet.eta (),
343373 jet.phi (),
@@ -417,9 +447,6 @@ struct JetCorrelationD0 {
417447 if (McDJet.has_matchedJetGeo ()) { // geometric matching
418448 for (auto const & McPJet : McDJet.template matchedJetGeo_as <aod::ChargedMCParticleLevelJets>()) {
419449 float dPhiP = RecoDecay::constrainAngle (McPJet.phi () - d0Particle.phi (), -o2::constants::math::PI );
420- // if (std::abs(dPhiP - o2::constants::math::PI) > (o2::constants::math::PI / 2)) {
421- // continue;
422- // }
423450 tableJetMatched (tableMatchedCollision.lastIndex (),
424451 McDJet.pt (),
425452 McDJet.eta (),
0 commit comments