Skip to content

Commit bc17093

Browse files
authored
[PWGHF] Ds-h correlation, adding derived data for SE analysis (#10045)
1 parent beca1e0 commit bc17093

File tree

3 files changed

+73
-69
lines changed

3 files changed

+73
-69
lines changed

PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
/// \file DerivedDataCorrelations.h
12+
/// \file DerivedDataCorrelationTables.h
1313
/// \brief Tables for producing derived data for correlation analysis
1414
/// \author Samuele Cattaruzzi <samuele.cattaruzzi@cern.ch>
1515

@@ -40,32 +40,54 @@ using HfcRedCollision = HfcRedCollisions::iterator;
4040
namespace hf_candidate_reduced
4141
{
4242
DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index
43-
DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate
44-
DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate
45-
DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate
46-
DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate
43+
DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate
44+
DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate
45+
DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate
46+
DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate
47+
DECLARE_SOA_COLUMN(BdtScorePrompt, bdtScorePrompt, float); //! BDT output score for prompt hypothesis
48+
DECLARE_SOA_COLUMN(BdtScoreBkg, bdtScoreBkg, float); //! BDT output score for backgronud hypothesis
4749
} // namespace hf_candidate_reduced
48-
DECLARE_SOA_TABLE(DsCandReduceds, "AOD", "DSCANDREDUCED", //! Table with Ds candidate info (rectangular selection)
50+
DECLARE_SOA_TABLE(DsCandReduceds, "AOD", "DSCANDREDUCED", //! Table with Ds candidate info
4951
soa::Index<>,
5052
aod::hf_candidate_reduced::HfcRedCollisionId,
5153
aod::hf_candidate_reduced::PhiCand,
5254
aod::hf_candidate_reduced::EtaCand,
5355
aod::hf_candidate_reduced::PtCand,
5456
aod::hf_candidate_reduced::InvMassDs);
5557

58+
DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds candidate selection info
59+
soa::Index<>,
60+
aod::hf_candidate_reduced::HfcRedCollisionId,
61+
aod::hf_candidate_reduced::BdtScorePrompt,
62+
aod::hf_candidate_reduced::BdtScoreBkg);
63+
5664
namespace hf_assoc_track_reduced
5765
{
58-
DECLARE_SOA_COLUMN(TrackId, trackId, int); //! Original track index
59-
DECLARE_SOA_COLUMN(EtaAssocTrack, etaAssocTrack, float); //! Eta of the track
60-
DECLARE_SOA_COLUMN(PhiAssocTrack, phiAssocTrack, float); //! Phi of the track
61-
DECLARE_SOA_COLUMN(PtAssocTrack, ptAssocTrack, float); //! Pt of the track
66+
DECLARE_SOA_COLUMN(TrackId, trackId, int); //! Original track index
67+
DECLARE_SOA_COLUMN(NTpcCrossedRows, nTpcCrossedRows, int); //! Number of crossed TPC Rows
68+
DECLARE_SOA_COLUMN(ItsClusterMap, itsClusterMap, int); //! ITS cluster map, one bit per a layer, starting from the innermost
69+
DECLARE_SOA_COLUMN(ItsNCls, itsNCls, int); //! Number of ITS clusters
70+
DECLARE_SOA_COLUMN(EtaAssocTrack, etaAssocTrack, float); //! Eta of the track
71+
DECLARE_SOA_COLUMN(PhiAssocTrack, phiAssocTrack, float); //! Phi of the track
72+
DECLARE_SOA_COLUMN(PtAssocTrack, ptAssocTrack, float); //! Pt of the track
73+
DECLARE_SOA_COLUMN(DcaXY, dcaXY, float); //! Impact parameter in XY of the track to the primary vertex
74+
DECLARE_SOA_COLUMN(DcaZ, dcaZ, float); //! Impact parameter in Z of the track to the primary vertex
6275
} // namespace hf_assoc_track_reduced
6376
DECLARE_SOA_TABLE(AssocTrackReds, "AOD", "ASSOCTRACKRED", //! Table with associated track info
6477
soa::Index<>,
6578
aod::hf_candidate_reduced::HfcRedCollisionId,
6679
aod::hf_assoc_track_reduced::PhiAssocTrack,
6780
aod::hf_assoc_track_reduced::EtaAssocTrack,
68-
aod::hf_assoc_track_reduced::PtAssocTrack)
81+
aod::hf_assoc_track_reduced::PtAssocTrack);
82+
83+
DECLARE_SOA_TABLE(AssocTrackSelInfos, "AOD", "ASSOCTRACKSELINFO", //! Table with associated track info
84+
soa::Index<>,
85+
aod::hf_candidate_reduced::HfcRedCollisionId,
86+
aod::hf_assoc_track_reduced::NTpcCrossedRows,
87+
aod::hf_assoc_track_reduced::ItsClusterMap,
88+
aod::hf_assoc_track_reduced::ItsNCls,
89+
aod::hf_assoc_track_reduced::DcaXY,
90+
aod::hf_assoc_track_reduced::DcaZ)
6991
} // namespace o2::aod
7092

7193
#endif // PWGHF_HFC_DATAMODEL_DERIVEDDATACORRELATIONTABLES_H_

PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ struct HfCorrelatorDsHadrons {
143143
Produces<aod::TrackRecoInfo> entryTrackRecoInfo;
144144
Produces<aod::HfcRedCollisions> collReduced;
145145
Produces<aod::DsCandReduceds> candReduced;
146+
Produces<aod::DsCandSelInfos> candSelInfo;
146147
Produces<aod::AssocTrackReds> assocTrackReduced;
148+
Produces<aod::AssocTrackSelInfos> assocTrackSelInfo;
147149

148150
Configurable<bool> fillHistoData{"fillHistoData", true, "Flag for filling histograms in data processes"};
149151
Configurable<bool> fillHistoMcRec{"fillHistoMcRec", true, "Flag for filling histograms in MC Rec processes"};
@@ -432,7 +434,7 @@ struct HfCorrelatorDsHadrons {
432434
entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows());
433435
}
434436
} // end track loop
435-
} // end candidate loop
437+
} // end candidate loop
436438
}
437439
PROCESS_SWITCH(HfCorrelatorDsHadrons, processData, "Process data", true);
438440

@@ -691,7 +693,7 @@ struct HfCorrelatorDsHadrons {
691693
} // end loop generated particles
692694
} // end loop generated Ds
693695
} // end loop reconstructed collision
694-
} // end loop generated collision
696+
} // end loop generated collision
695697
}
696698
PROCESS_SWITCH(HfCorrelatorDsHadrons, processMcGen, "Process MC Gen mode", false);
697699

@@ -700,40 +702,6 @@ struct HfCorrelatorDsHadrons {
700702
MyTracksData const& tracks)
701703
{
702704

703-
for (const auto& collision : collisions) {
704-
auto thisCollId = collision.globalIndex();
705-
auto candsDsThisColl = candidates.sliceBy(candsDsPerCollision, thisCollId);
706-
auto tracksThisColl = tracks.sliceBy(trackIndicesPerCollision, thisCollId);
707-
708-
// Ds fill histograms and Ds candidates information stored
709-
for (const auto& candidate : candsDsThisColl) {
710-
// candidate selected
711-
if (candidate.isSelDsToKKPi() >= selectionFlagDs) {
712-
candReduced(hfcReducedCollisionIndex, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToKKPi(candidate));
713-
} else if (candidate.isSelDsToPiKK() >= selectionFlagDs) {
714-
candReduced(hfcReducedCollisionIndex, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToPiKK(candidate));
715-
}
716-
}
717-
718-
// tracks information
719-
for (const auto& track : tracksThisColl) {
720-
if (!track.isGlobalTrackWoDCA()) {
721-
continue;
722-
}
723-
assocTrackReduced(hfcReducedCollisionIndex, track.phi(), track.eta(), track.pt());
724-
}
725-
726-
collReduced(collision.multFT0M(), collision.posZ());
727-
hfcReducedCollisionIndex++;
728-
}
729-
}
730-
PROCESS_SWITCH(HfCorrelatorDsHadrons, processDerivedDataDs, "Process derived data Ds", false);
731-
732-
void processDerivedDataDsLastIndex(SelCollisionsWithDs const& collisions,
733-
CandDsData const& candidates,
734-
MyTracksData const& tracks)
735-
{
736-
737705
for (const auto& collision : collisions) {
738706
auto thisCollId = collision.globalIndex();
739707
auto candsDsThisColl = candidates.sliceBy(candsDsPerCollision, thisCollId);
@@ -743,11 +711,20 @@ struct HfCorrelatorDsHadrons {
743711

744712
// Ds fill histograms and Ds candidates information stored
745713
for (const auto& candidate : candsDsThisColl) {
714+
std::vector<float> outputMl = {-1., -1., -1.};
746715
// candidate selected
747716
if (candidate.isSelDsToKKPi() >= selectionFlagDs) {
717+
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
718+
outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)];
719+
}
748720
candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToKKPi(candidate));
721+
candSelInfo(indexHfcReducedCollision, outputMl[0], outputMl[2]);
749722
} else if (candidate.isSelDsToPiKK() >= selectionFlagDs) {
723+
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
724+
outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)];
725+
}
750726
candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToPiKK(candidate));
727+
candSelInfo(indexHfcReducedCollision, outputMl[0], outputMl[2]);
751728
}
752729
}
753730

@@ -757,12 +734,13 @@ struct HfCorrelatorDsHadrons {
757734
continue;
758735
}
759736
assocTrackReduced(indexHfcReducedCollision, track.phi(), track.eta(), track.pt());
737+
assocTrackSelInfo(indexHfcReducedCollision, track.tpcNClsCrossedRows(), track.itsClusterMap(), track.itsNCls(), track.dcaXY(), track.dcaZ());
760738
}
761739

762740
collReduced(collision.multFT0M(), collision.posZ());
763741
}
764742
}
765-
PROCESS_SWITCH(HfCorrelatorDsHadrons, processDerivedDataDsLastIndex, "Process derived data Ds w lastIndex", false);
743+
PROCESS_SWITCH(HfCorrelatorDsHadrons, processDerivedDataDs, "Process derived data Ds", false);
766744

767745
// Event Mixing
768746
void processDataME(SelCollisionsWithDs const& collisions,

PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ struct HfTaskCorrelationDsHadrons {
4646
Configurable<bool> selNoSameBunchPileUpColl{"selNoSameBunchPileUpColl", true, "Flag for rejecting the collisions associated with the same bunch crossing"};
4747
Configurable<bool> removeCollWSplitVtx{"removeCollWSplitVtx", false, "Flag for rejecting the splitted collisions"};
4848
Configurable<bool> loadAccXEffFromCCDB{"loadAccXEffFromCCDB", false, "Flag for loading efficiency distributions from CCDB"};
49+
Configurable<bool> separateTrackOrigins{"separateTrackOrigins", false, "Flag to enable separation of track origins (from c or b)"};
4950
// Configurable<bool> doMcCollisionCheck{"doMcCollisionCheck", false, "Flag for applying the collision check and selection based on MC collision info"};
5051
Configurable<int> selectionFlagDs{"selectionFlagDs", 7, "Selection Flag for Ds (avoid the case of flag = 0, no outputMlScore)"};
5152
Configurable<int> nTpcCrossedRaws{"nTpcCrossedRaws", 70, "Number of crossed TPC Rows"};
@@ -55,13 +56,13 @@ struct HfTaskCorrelationDsHadrons {
5556
Configurable<float> dcaXYTrackMax{"dcaXYTrackMax", 1., "max. DCA_xy of tracks"};
5657
Configurable<float> dcaZTrackMax{"dcaZTrackMax", 1., "max. DCA_z of tracks"};
5758
Configurable<float> etaTrackMax{"etaTrackMax", 0.8, "max. eta of tracks"};
58-
Configurable<float> ptCandMin{"ptCandMin", 1., "min. cand. pT"};
59-
Configurable<float> ptCandMax{"ptCandMax", 50., "max. cand pT"};
60-
Configurable<float> ptTrackMin{"ptTrackMin", 0.3, "min. track pT"};
61-
Configurable<float> ptTrackMax{"ptTrackMax", 50., "max. track pT"};
62-
Configurable<float> yCandMax{"yCandMax", 0.8, "max. cand. rapidity"};
63-
Configurable<float> yCandGenMax{"yCandGenMax", 0.5, "max. gen. cand. rapidity"};
64-
Configurable<float> ptDaughterMin{"ptDaughterMin", 0.1, "min. daughter pT"};
59+
Configurable<float> ptCandMin{"ptCandMin", 1., "min. cand. pT (used in eff. process only)"};
60+
Configurable<float> ptCandMax{"ptCandMax", 50., "max. cand pT (used in eff. process only)"};
61+
Configurable<float> ptTrackMin{"ptTrackMin", 0.3, "min. track pT (used in eff. process only)"};
62+
Configurable<float> ptTrackMax{"ptTrackMax", 50., "max. track pT (used in eff. process only)"};
63+
Configurable<float> yCandMax{"yCandMax", 0.8, "max. cand. rapidity (used in eff. process only)"};
64+
Configurable<float> yCandGenMax{"yCandGenMax", 0.5, "max. gen. cand. rapidity (used in eff. process only)"};
65+
Configurable<float> ptDaughterMin{"ptDaughterMin", 0.1, "min. daughter pT (used in eff. process only)"};
6566
Configurable<std::vector<int>> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."};
6667
Configurable<std::vector<double>> binsPtD{"binsPtD", std::vector<double>{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"};
6768
Configurable<std::vector<double>> binsPtHadron{"binsPtHadron", std::vector<double>{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for assoc particle efficiency"};
@@ -83,7 +84,6 @@ struct HfTaskCorrelationDsHadrons {
8384
Configurable<std::string> promptEffCcdbPath{"promptEffCcdbPath", "", "CCDB path for trigger efficiency"};
8485
Configurable<std::string> fdEffCcdbPath{"fdEffCcdbPath", "", "CCDB path for trigger efficiency"};
8586
Configurable<int64_t> timestampCcdb{"timestampCcdb", -1, "timestamp of the efficiency files used to query in CCDB"};
86-
Configurable<int64_t> ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
8787

8888
std::shared_ptr<TH1> mEfficiencyD = nullptr;
8989
std::shared_ptr<TH1> mEfficiencyAssociated = nullptr;
@@ -250,7 +250,7 @@ struct HfTaskCorrelationDsHadrons {
250250
ccdb->setURL(ccdbUrl);
251251
ccdb->setCaching(true);
252252
ccdb->setLocalObjectValidityChecking();
253-
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
253+
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
254254

255255
mEfficiencyD = std::shared_ptr<TH1>(ccdb->getForTimeStamp<TH1F>(promptEffCcdbPath, timestampCcdb));
256256
if (mEfficiencyD == nullptr) {
@@ -743,7 +743,7 @@ struct HfTaskCorrelationDsHadrons {
743743
}
744744

745745
} // end loop reconstructed collision
746-
} // end loop generated collisions
746+
} // end loop generated collisions
747747
}
748748
PROCESS_SWITCH(HfTaskCorrelationDsHadrons, processMcCandEfficiency, "Process MC for calculating candidate reconstruction efficiency", false);
749749

@@ -895,11 +895,13 @@ struct HfTaskCorrelationDsHadrons {
895895
} else if (std::abs(mcParticle.pdgCode()) == kMuonMinus) {
896896
registry.fill(HIST("hPtPrmMuonMcGen"), mcParticle.pt());
897897
}
898-
int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true);
899-
if (trackOrigin == 1) { // charm orgin
900-
registry.fill(HIST("hPtPrmPromptPartMcGen"), mcParticle.pt());
901-
} else if (trackOrigin == 2) { // beauty origin
902-
registry.fill(HIST("hPtPrmNonPromptPartMcGen"), mcParticle.pt());
898+
if (separateTrackOrigins) {
899+
int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true);
900+
if (trackOrigin == 1) { // charm orgin
901+
registry.fill(HIST("hPtPrmPromptPartMcGen"), mcParticle.pt());
902+
} else if (trackOrigin == 2) { // beauty origin
903+
registry.fill(HIST("hPtPrmNonPromptPartMcGen"), mcParticle.pt());
904+
}
903905
}
904906
}
905907
}
@@ -934,11 +936,13 @@ struct HfTaskCorrelationDsHadrons {
934936
registry.fill(HIST("hPtPrmMuonMcRec"), track.pt());
935937
}
936938
// check track origin
937-
int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true);
938-
if (trackOrigin == 1) { // charm orgin
939-
registry.fill(HIST("hPtPrmPromptPartMcRec"), track.pt());
940-
} else if (trackOrigin == 2) { // beauty origin
941-
registry.fill(HIST("hPtPrmNonPromptPartMcRec"), track.pt());
939+
if (separateTrackOrigins) {
940+
int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true);
941+
if (trackOrigin == 1) { // charm orgin
942+
registry.fill(HIST("hPtPrmPromptPartMcRec"), track.pt());
943+
} else if (trackOrigin == 2) { // beauty origin
944+
registry.fill(HIST("hPtPrmNonPromptPartMcRec"), track.pt());
945+
}
942946
}
943947
}
944948
}
@@ -949,7 +953,7 @@ struct HfTaskCorrelationDsHadrons {
949953
}
950954

951955
} // end loop reconstructed collision
952-
} // end loop generated collisions
956+
} // end loop generated collisions
953957
}
954958
PROCESS_SWITCH(HfTaskCorrelationDsHadrons, processMcTrackEfficiency, "Process MC for calculating associated particle tracking efficiency", false);
955959
};

0 commit comments

Comments
 (0)