PWGHF: Adding first implementation of D0-D0bar correlation code (data/MC-reco/MC-kine)#5450
PWGHF: Adding first implementation of D0-D0bar correlation code (data/MC-reco/MC-kine)#5450fcolamar wants to merge 30 commits intoAliceO2Group:devAliceO2Group/AliceO2:devfrom
Conversation
|
Hi @vkucera, I modified the task names, which were inadequate, and the filename according to the coding conventions. |
|
Thanks, please have a look at the General Naming Rules. That might be clearer. |
|
@vkucera but what is the specific problem in this case? |
There are still some variables, histogram names and other pieces, like underscores, to fix. Also missing braces. |
|
Thanks for the update. It still does not comply with the conventions but I will comment together with other suggestions. |
vkucera
left a comment
There was a problem hiding this comment.
Most comments on the first task apply to the others too.
The tasks share many hard-coded constants which should be defined only once.
| double dPhi = phiDbar - phiD; | ||
|
|
||
| if (dPhi < -o2::constants::math::PI / 2.) | ||
| dPhi = dPhi + 2. * o2::constants::math::PI; | ||
| if (dPhi > 3. * o2::constants::math::PI / 2.) | ||
| dPhi = dPhi - 2. * o2::constants::math::PI; | ||
|
|
||
| return dPhi; |
| double phi = std::atan2((yVertex2 - yVertex1), (xVertex2 - xVertex1)); | ||
|
|
||
| if (phi < 0.) | ||
| phi = phi + 2. * o2::constants::math::PI; | ||
| if (phi > 2. * o2::constants::math::PI) | ||
| phi = phi - 2. * o2::constants::math::PI; | ||
|
|
||
| return phi; |
There was a problem hiding this comment.
You can replace this with
return RecoDecay::Phi(xVertex2 - xVertex1, yVertex2 - yVertex1);| /// D0 analysis task - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) | ||
| struct TaskD0D0barCorrelation { | ||
|
|
||
| double maxEtaCut = 5., PtThresholdForMaxEtaCut = 10.; //for hDDbarVsEtaCut, gives eta increment of 0.1 and pt thr increments of 0.5 |
There was a problem hiding this comment.
- Is
maxEtaCutsupposed to be different fromcutEtaCandMax? - Should
maxEtaCut,PtThresholdForMaxEtaCutbe configurable or constant? - The increments are independent of these values. So the comment is incorrect.
- The actual increments of
ptCutandetaCutare hard-coded, whereas the bin widths ofhDDbarVsEtaCutare defined with separate binning factors. They should be linked via constants.
There was a problem hiding this comment.
- Yes because cutEtaCandMax is a selection done on the candidates (which at some points could be changed to a y selection), while maxEtaCut defines the limit of the scan for the potential detector acceptance
- so I was initially in doubt, but I think that with values large enough, as the current, they can be kept as constant (modified it, but moved outside the tasks to avoid multiple definition)
- yes right, it's a leftover from a previous version, with dynamic increment depending on those variables, I forgot changing the comment
- ok, modified
| if (cutEtaCandMax >= 0. && std::abs(candidate1.eta()) > cutEtaCandMax) | ||
| continue; | ||
| if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) | ||
| continue; | ||
| //check decay channel flag for candidate1 |
There was a problem hiding this comment.
Add readability-braces-around-statements.
There was a problem hiding this comment.
Done (also for the other equivalent cases)
| {{"hmass", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{200, 1., 3.}}}}, | ||
| {"hmassD0", "D0,D0bar candidates;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{200, 1., 3.}}}}, | ||
| {"hmassD0bar", "D0,D0bar candidates;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{200, 1., 3.}}}}, | ||
| {"hmass2DCorrelationPairs", "D0,D0bar candidates 2D;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 1., 3.}, {200, 1., 3.}}}}, | ||
| {"hptcand", "D0,D0bar candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, | ||
| {"hptprong0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, | ||
| {"hptprong1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, | ||
| {"hselectionstatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, |
There was a problem hiding this comment.
Better to stick to the camelCase convention.
(We have to fix it in the existing tasks so it's better if the new code is already ok.)
There was a problem hiding this comment.
Ah ok, I had noticed that these names was not following the convention, but since was present in other tasks I hadn't modified them in mine. Done now
|
|
||
| Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= d_selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= d_selectionFlagD0bar); | ||
|
|
||
| void process(aod::Collision const& collision, soa::Filtered<aod::Big2Prong> const& candidates, aod::BigTracks const& tracks) |
There was a problem hiding this comment.
The track table does not seem to be used anywhere.
There was a problem hiding this comment.
You are right: this was needed in the previous version, before the grouping of candidates with collisions, to ensure that D0 mesons were correlated with D0bar mesons from the same event (and the collision was tracked via the information stored in the daughter track table), but after implementing the grouping that check has been removed, and the track table is not used anymore. I'm removing it.
|
|
||
| //loop over particles at MC gen level | ||
| for (auto& particle1 : particlesMC) { | ||
| if (std::abs(particle1.pdgCode()) == 4) { //c or cbar quark found |
There was a problem hiding this comment.
Why don't you just continue if it isn't 4?
There was a problem hiding this comment.
I modified as you proposed since it's cleaner
| registry.fill(HIST("hptcandMCGen"), particle1.pt()); | ||
| registry.fill(HIST("hEtaMCGen"), particle1.eta()); | ||
| registry.fill(HIST("hPhiMCGen"), particle1.phi()); |
There was a problem hiding this comment.
Do I understand correctly that (only) these histograms should be filled for each c(bar) and each fragmentation stage?
There was a problem hiding this comment.
Ah thanks, this is a mistake indeed: it's due to a leftover from a previous version, where I had two version of these plots (with and without inclusion of fragmentation quarks) to check the effects on those distributions from double-countings due to fragmentation.
I deleted one version after doing the check, removed the suffix from the histogram names, but left the 'wrong' version (before fragmentation check).
Also, at this point it's useless to have the instruction that skips the fragmentation (L691-692 of old commit) so late in the task, with a couple of if instructions before, so I moved that instruction at the beginning, and removed the if's.
| //get corresponding gen-level D0, if exists, and evaluate gen-rec phi-difference with two approaches | ||
| if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { //ok to keep both D0 and D0bar | ||
| int indexGen = RecoDecay::getMother(particlesMC, candidate1.index0_as<aod::BigTracksMC>().label(), 421, true); //MC-gen corresponding index for MC-reco candidate | ||
| if (indexGen > 0) { |
There was a problem hiding this comment.
What I want to do is to enaure that what follows is done only if a gen-reco match is ensured, but looking how the returned variable is initialised in RecoDecay::getMother, I think I should set the condition to > -1, rather than 0 (this is what I'm doing now, please correct me if not ok)
There was a problem hiding this comment.
The gen-rec match is ensured already by requiring:
if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { Therefore getMother will always return a valid index.
There was a problem hiding this comment.
Ok, removed the condition
| registry.fill(HIST("hDifferenceGenPhiStdPhi"), getDeltaPhi(phi1Std, phi1Gen), pt1); | ||
| registry.fill(HIST("hDifferenceGenPhiByVtxPhi"), getDeltaPhi(phi1ByVtx, phi1Gen), pt1); |
There was a problem hiding this comment.
Shouldn't resolution be constrained to range [-π, +π]?
There was a problem hiding this comment.
I preferred having a full version with positives and negatives which acted also as control plot in case of spotting potential asymmetries (though remote), then one can always reflect while processing the plot.
There was a problem hiding this comment.
The point here is that getDeltaPhi returns angles in range [-π/2, 3*π/2], which makes no sense for resolution.
Resolution expresses how far the rec. value is from the gen. value and that can never be larger than π for an angle.
There was a problem hiding this comment.
Ah I misread the comment (read [0,pi] instead). Ok then, I modified the code accordingly
| if (partMothPDG == 4) | ||
| continue; | ||
| registry.fill(HIST("hcountD0triggersMCGen"), 0); //to count trigger c quark (for normalisation) | ||
| if (!std::abs(particle1.pdgCode()) == 4) { //search c or cbar particles |
There was a problem hiding this comment.
This is not gonna work. Should be:
if (std::abs(particle1.pdgCode()) != 4) {| //get corresponding gen-level D0, if exists, and evaluate gen-rec phi-difference with two approaches | ||
| if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { //ok to keep both D0 and D0bar | ||
| int indexGen = RecoDecay::getMother(particlesMC, candidate1.index0_as<aod::BigTracksMC>().label(), 421, true); //MC-gen corresponding index for MC-reco candidate | ||
| if (indexGen > 0) { |
There was a problem hiding this comment.
The gen-rec match is ensured already by requiring:
if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { Therefore getMother will always return a valid index.
| registry.fill(HIST("hDeltaEtaVsPtMCGen"), pt1, pt2, deltaEta); | ||
| registry.fill(HIST("hDeltaPhiVsPtMCGen"), pt1, pt2, deltaPhi); | ||
| registry.fill(HIST("hDeltaPtDDbarMCGen"), pt2 - pt1); | ||
| registry.fill(HIST("hDeltaPtMaxMinMCGen"), std::max(particle2.pt(), particle1.pt()) - std::min(particle2.pt(), particle1.pt())); |
There was a problem hiding this comment.
Changed as done for previous occurrences
There was a problem hiding this comment.
Committed updated version which satisfies the new requests for adaptAnalysisTask (#PR5558).
No modifications are needed for the charge()->sign() update (#PR5611)
|
Hello all, is there any further comment on this PR? |
|
Hi @fcolamar , your branch is 247 commits behind |
merging with changes from remote dev
|
Hi Vit, I updated the branch with the new dev commits, the only needed modification was an update to the CMakeLists.txt which was indeed modified by Fabio Catalano this morning. Tried to compile and it works fine (I couldn't test the code yet due to errors when running the validation framework, though I don't expect problems) |
| if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { | ||
| continue; |
There was a problem hiding this comment.
Right, copy-paste from above selection on eta done without thinking... Removed the abs (here and later on)
|
|
||
| /// definition of variables for D0D0bar pairs vs eta acceptance studies (hDDbarVsEtaCut, in data-like, MC-reco and MC-kine tasks) | ||
| const double maxEtaCut = 5.; | ||
| const double PtThresholdForMaxEtaCut = 10.; |
| const double PtThresholdForMaxEtaCut = 10.; | ||
| const double incrementEtaCut = 0.1; | ||
| const double incrementPtThreshold = 0.5; | ||
| const double epsilon = 10E-5; |
There was a problem hiding this comment.
Is it supposed to be 1e-4?
| /// | ||
| /// \author Fabio Colamaria <fabio.colamaria@ba.infn.it>, INFN Bari | ||
|
|
||
| #include <cmath> |
There was a problem hiding this comment.
Removed (leftover from previous version with math operations that were directly implemented here)
| // the following is needed to extend the standard candidate table, and allow grouping candidate table by collisions | ||
| namespace o2::aod | ||
| { | ||
| namespace hf_2prong_correlation | ||
| { | ||
| DECLARE_SOA_INDEX_COLUMN(Collision, collision); | ||
| } // namespace hf_2prong_correlation | ||
| DECLARE_SOA_TABLE(HF2ProngCollis, "AOD", "COLLID_2PR", aod::hf_2prong_correlation::CollisionId); | ||
|
|
||
| using Big2Prong = soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate, aod::HF2ProngCollis>; | ||
| using Big2ProngMC = soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate, aod::HfCandProng2MCRec, aod::HF2ProngCollis>; | ||
| } // namespace o2::aod | ||
|
|
||
| // preliminary task to fill the column index to the extended candidate table | ||
| struct CreateBig2Prong { | ||
|
|
||
| Produces<aod::HF2ProngCollis> create2ProngIndexCollColumn; | ||
| void process(aod::HfCandProng2 const& candidates, aod::Tracks const& tracks) | ||
| { | ||
| for (auto& candidate : candidates) { | ||
| int indexColl = candidate.index0_as<aod::Tracks>().collisionId(); //takes index of collision from first D daughter | ||
| create2ProngIndexCollColumn(indexColl); | ||
| } | ||
| } | ||
| }; |
There was a problem hiding this comment.
This should be removed once #5469 gets merged.
There was a problem hiding this comment.
Sure, for now I left it in place
There was a problem hiding this comment.
Since #5469 was merged this morning, I adapted the task and committed the updated version
|
Draft PR ready for new review |
|
Adapted to merging of #5469 PR, ready for review |
|
This PR did not have any update in the last 30 days. Is it still needed? Unless further action in will be closed in 5 days. |
Implementation of analysis task for D0-D0bar correlations.
Allows running in data-like, MC-reco and MC-kine modes.
ULS and LS analysis enables.